scenri 0.20.1 → 0.20.2

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.
@@ -0,0 +1,108 @@
1
+ var ox=e=>{throw TypeError(e)};var ix=(e,t,n)=>t.has(e)||ox("Cannot "+n);var os=(e,t,n)=>(ix(e,t,"read from private field"),n?n.call(e):t.get(e)),lx=(e,t,n)=>t.has(e)?ox("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Gg=(e,t,n,r)=>(ix(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function UT(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function X9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yg={exports:{}},h0={},qg={exports:{}},bn={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var cx;function WT(){if(cx)return bn;cx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function m(z){return z===null||typeof z!="object"?null:(z=g&&z[g]||z["@@iterator"],typeof z=="function"?z:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function k(z,Y,Z){this.props=z,this.context=Y,this.refs=b,this.updater=Z||w}k.prototype.isReactComponent={},k.prototype.setState=function(z,Y){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,Y,"setState")},k.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function S(){}S.prototype=k.prototype;function E(z,Y,Z){this.props=z,this.context=Y,this.refs=b,this.updater=Z||w}var C=E.prototype=new S;C.constructor=E,y(C,k.prototype),C.isPureReactComponent=!0;var A=Array.isArray,L=Object.prototype.hasOwnProperty,T={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function j(z,Y,Z){var ee,pe={},se=null,xe=null;if(Y!=null)for(ee in Y.ref!==void 0&&(xe=Y.ref),Y.key!==void 0&&(se=""+Y.key),Y)L.call(Y,ee)&&!M.hasOwnProperty(ee)&&(pe[ee]=Y[ee]);var J=arguments.length-2;if(J===1)pe.children=Z;else if(1<J){for(var te=Array(J),X=0;X<J;X++)te[X]=arguments[X+2];pe.children=te}if(z&&z.defaultProps)for(ee in J=z.defaultProps,J)pe[ee]===void 0&&(pe[ee]=J[ee]);return{$$typeof:e,type:z,key:se,ref:xe,props:pe,_owner:T.current}}function P(z,Y){return{$$typeof:e,type:z.type,key:Y,ref:z.ref,props:z.props,_owner:z._owner}}function R(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function H(z){var Y={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Z){return Y[Z]})}var D=/\/+/g;function B(z,Y){return typeof z=="object"&&z!==null&&z.key!=null?H(""+z.key):Y.toString(36)}function V(z,Y,Z,ee,pe){var se=typeof z;(se==="undefined"||se==="boolean")&&(z=null);var xe=!1;if(z===null)xe=!0;else switch(se){case"string":case"number":xe=!0;break;case"object":switch(z.$$typeof){case e:case t:xe=!0}}if(xe)return xe=z,pe=pe(xe),z=ee===""?"."+B(xe,0):ee,A(pe)?(Z="",z!=null&&(Z=z.replace(D,"$&/")+"/"),V(pe,Y,Z,"",function(X){return X})):pe!=null&&(R(pe)&&(pe=P(pe,Z+(!pe.key||xe&&xe.key===pe.key?"":(""+pe.key).replace(D,"$&/")+"/")+z)),Y.push(pe)),1;if(xe=0,ee=ee===""?".":ee+":",A(z))for(var J=0;J<z.length;J++){se=z[J];var te=ee+B(se,J);xe+=V(se,Y,Z,te,pe)}else if(te=m(z),typeof te=="function")for(z=te.call(z),J=0;!(se=z.next()).done;)se=se.value,te=ee+B(se,J++),xe+=V(se,Y,Z,te,pe);else if(se==="object")throw Y=String(z),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return xe}function U(z,Y,Z){if(z==null)return z;var ee=[],pe=0;return V(z,ee,"","",function(se){return Y.call(Z,se,pe++)}),ee}function K(z){if(z._status===-1){var Y=z._result;Y=Y(),Y.then(function(Z){(z._status===0||z._status===-1)&&(z._status=1,z._result=Z)},function(Z){(z._status===0||z._status===-1)&&(z._status=2,z._result=Z)}),z._status===-1&&(z._status=0,z._result=Y)}if(z._status===1)return z._result.default;throw z._result}var O={current:null},F={transition:null},I={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:F,ReactCurrentOwner:T};function G(){throw Error("act(...) is not supported in production builds of React.")}return bn.Children={map:U,forEach:function(z,Y,Z){U(z,function(){Y.apply(this,arguments)},Z)},count:function(z){var Y=0;return U(z,function(){Y++}),Y},toArray:function(z){return U(z,function(Y){return Y})||[]},only:function(z){if(!R(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},bn.Component=k,bn.Fragment=n,bn.Profiler=a,bn.PureComponent=E,bn.StrictMode=r,bn.Suspense=f,bn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,bn.act=G,bn.cloneElement=function(z,Y,Z){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var ee=y({},z.props),pe=z.key,se=z.ref,xe=z._owner;if(Y!=null){if(Y.ref!==void 0&&(se=Y.ref,xe=T.current),Y.key!==void 0&&(pe=""+Y.key),z.type&&z.type.defaultProps)var J=z.type.defaultProps;for(te in Y)L.call(Y,te)&&!M.hasOwnProperty(te)&&(ee[te]=Y[te]===void 0&&J!==void 0?J[te]:Y[te])}var te=arguments.length-2;if(te===1)ee.children=Z;else if(1<te){J=Array(te);for(var X=0;X<te;X++)J[X]=arguments[X+2];ee.children=J}return{$$typeof:e,type:z.type,key:pe,ref:se,props:ee,_owner:xe}},bn.createContext=function(z){return z={$$typeof:l,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},z.Provider={$$typeof:i,_context:z},z.Consumer=z},bn.createElement=j,bn.createFactory=function(z){var Y=j.bind(null,z);return Y.type=z,Y},bn.createRef=function(){return{current:null}},bn.forwardRef=function(z){return{$$typeof:u,render:z}},bn.isValidElement=R,bn.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:K}},bn.memo=function(z,Y){return{$$typeof:h,type:z,compare:Y===void 0?null:Y}},bn.startTransition=function(z){var Y=F.transition;F.transition={};try{z()}finally{F.transition=Y}},bn.unstable_act=G,bn.useCallback=function(z,Y){return O.current.useCallback(z,Y)},bn.useContext=function(z){return O.current.useContext(z)},bn.useDebugValue=function(){},bn.useDeferredValue=function(z){return O.current.useDeferredValue(z)},bn.useEffect=function(z,Y){return O.current.useEffect(z,Y)},bn.useId=function(){return O.current.useId()},bn.useImperativeHandle=function(z,Y,Z){return O.current.useImperativeHandle(z,Y,Z)},bn.useInsertionEffect=function(z,Y){return O.current.useInsertionEffect(z,Y)},bn.useLayoutEffect=function(z,Y){return O.current.useLayoutEffect(z,Y)},bn.useMemo=function(z,Y){return O.current.useMemo(z,Y)},bn.useReducer=function(z,Y,Z){return O.current.useReducer(z,Y,Z)},bn.useRef=function(z){return O.current.useRef(z)},bn.useState=function(z){return O.current.useState(z)},bn.useSyncExternalStore=function(z,Y,Z){return O.current.useSyncExternalStore(z,Y,Z)},bn.useTransition=function(){return O.current.useTransition()},bn.version="18.3.1",bn}var ux;function mv(){return ux||(ux=1,qg.exports=WT()),qg.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var dx;function KT(){if(dx)return h0;dx=1;var e=mv(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(u,f,h){var p,g={},m=null,w=null;h!==void 0&&(m=""+h),f.key!==void 0&&(m=""+f.key),f.ref!==void 0&&(w=f.ref);for(p in f)r.call(f,p)&&!i.hasOwnProperty(p)&&(g[p]=f[p]);if(u&&u.defaultProps)for(p in f=u.defaultProps,f)g[p]===void 0&&(g[p]=f[p]);return{$$typeof:t,type:u,key:m,ref:w,props:g,_owner:a.current}}return h0.Fragment=n,h0.jsx=l,h0.jsxs=l,h0}var fx;function GT(){return fx||(fx=1,Yg.exports=KT()),Yg.exports}var o=GT(),s=mv();const zn=X9(s),Fc=UT({__proto__:null,default:zn},[s]);var gh={},Xg={exports:{}},Os={},Qg={exports:{}},Jg={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var hx;function YT(){return hx||(hx=1,(function(e){function t(F,I){var G=F.length;F.push(I);e:for(;0<G;){var z=G-1>>>1,Y=F[z];if(0<a(Y,I))F[z]=I,F[G]=Y,G=z;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var I=F[0],G=F.pop();if(G!==I){F[0]=G;e:for(var z=0,Y=F.length,Z=Y>>>1;z<Z;){var ee=2*(z+1)-1,pe=F[ee],se=ee+1,xe=F[se];if(0>a(pe,G))se<Y&&0>a(xe,pe)?(F[z]=xe,F[se]=G,z=se):(F[z]=pe,F[ee]=G,z=ee);else if(se<Y&&0>a(xe,G))F[z]=xe,F[se]=G,z=se;else break e}}return I}function a(F,I){var G=F.sortIndex-I.sortIndex;return G!==0?G:F.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var f=[],h=[],p=1,g=null,m=3,w=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(F){for(var I=n(h);I!==null;){if(I.callback===null)r(h);else if(I.startTime<=F)r(h),I.sortIndex=I.expirationTime,t(f,I);else break;I=n(h)}}function A(F){if(b=!1,C(F),!y)if(n(f)!==null)y=!0,K(L);else{var I=n(h);I!==null&&O(A,I.startTime-F)}}function L(F,I){y=!1,b&&(b=!1,S(j),j=-1),w=!0;var G=m;try{for(C(I),g=n(f);g!==null&&(!(g.expirationTime>I)||F&&!H());){var z=g.callback;if(typeof z=="function"){g.callback=null,m=g.priorityLevel;var Y=z(g.expirationTime<=I);I=e.unstable_now(),typeof Y=="function"?g.callback=Y:g===n(f)&&r(f),C(I)}else r(f);g=n(f)}if(g!==null)var Z=!0;else{var ee=n(h);ee!==null&&O(A,ee.startTime-I),Z=!1}return Z}finally{g=null,m=G,w=!1}}var T=!1,M=null,j=-1,P=5,R=-1;function H(){return!(e.unstable_now()-R<P)}function D(){if(M!==null){var F=e.unstable_now();R=F;var I=!0;try{I=M(!0,F)}finally{I?B():(T=!1,M=null)}}else T=!1}var B;if(typeof E=="function")B=function(){E(D)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,U=V.port2;V.port1.onmessage=D,B=function(){U.postMessage(null)}}else B=function(){k(D,0)};function K(F){M=F,T||(T=!0,B())}function O(F,I){j=k(function(){F(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_continueExecution=function(){y||w||(y=!0,K(L))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(F){switch(m){case 1:case 2:case 3:var I=3;break;default:I=m}var G=m;m=I;try{return F()}finally{m=G}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,I){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var G=m;m=F;try{return I()}finally{m=G}},e.unstable_scheduleCallback=function(F,I,G){var z=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?z+G:z):G=z,F){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=G+Y,F={id:p++,callback:I,priorityLevel:F,startTime:G,expirationTime:Y,sortIndex:-1},G>z?(F.sortIndex=G,t(h,F),n(f)===null&&F===n(h)&&(b?(S(j),j=-1):b=!0,O(A,G-z))):(F.sortIndex=Y,t(f,F),y||w||(y=!0,K(L))),F},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(F){var I=m;return function(){var G=m;m=I;try{return F.apply(this,arguments)}finally{m=G}}}})(Jg)),Jg}var px;function qT(){return px||(px=1,Qg.exports=YT()),Qg.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var mx;function XT(){if(mx)return Os;mx=1;var e=mv(),t=qT();function n(c){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+c,v=1;v<arguments.length;v++)d+="&args[]="+encodeURIComponent(arguments[v]);return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,a={};function i(c,d){l(c,d),l(c+"Capture",d)}function l(c,d){for(a[c]=d,c=0;c<d.length;c++)r.add(d[c])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},g={};function m(c){return f.call(g,c)?!0:f.call(p,c)?!1:h.test(c)?g[c]=!0:(p[c]=!0,!1)}function w(c,d,v,x){if(v!==null&&v.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:v!==null?!v.acceptsBooleans:(c=c.toLowerCase().slice(0,5),c!=="data-"&&c!=="aria-");default:return!1}}function y(c,d,v,x){if(d===null||typeof d>"u"||w(c,d,v,x))return!0;if(x)return!1;if(v!==null)switch(v.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function b(c,d,v,x,N,$,W){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=N,this.mustUseProperty=v,this.propertyName=c,this.type=d,this.sanitizeURL=$,this.removeEmptyString=W}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(c){k[c]=new b(c,0,!1,c,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(c){var d=c[0];k[d]=new b(d,1,!1,c[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(c){k[c]=new b(c,2,!1,c.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(c){k[c]=new b(c,2,!1,c,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(c){k[c]=new b(c,3,!1,c.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(c){k[c]=new b(c,3,!0,c,null,!1,!1)}),["capture","download"].forEach(function(c){k[c]=new b(c,4,!1,c,null,!1,!1)}),["cols","rows","size","span"].forEach(function(c){k[c]=new b(c,6,!1,c,null,!1,!1)}),["rowSpan","start"].forEach(function(c){k[c]=new b(c,5,!1,c.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function E(c){return c[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(c){var d=c.replace(S,E);k[d]=new b(d,1,!1,c,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(c){var d=c.replace(S,E);k[d]=new b(d,1,!1,c,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(c){var d=c.replace(S,E);k[d]=new b(d,1,!1,c,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(c){k[c]=new b(c,1,!1,c.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(c){k[c]=new b(c,1,!1,c.toLowerCase(),null,!0,!0)});function C(c,d,v,x){var N=k.hasOwnProperty(d)?k[d]:null;(N!==null?N.type!==0:x||!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(y(d,v,N,x)&&(v=null),x||N===null?m(d)&&(v===null?c.removeAttribute(d):c.setAttribute(d,""+v)):N.mustUseProperty?c[N.propertyName]=v===null?N.type===3?!1:"":v:(d=N.attributeName,x=N.attributeNamespace,v===null?c.removeAttribute(d):(N=N.type,v=N===3||N===4&&v===!0?"":""+v,x?c.setAttributeNS(x,d,v):c.setAttribute(d,v))))}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,L=Symbol.for("react.element"),T=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),H=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),F=Symbol.iterator;function I(c){return c===null||typeof c!="object"?null:(c=F&&c[F]||c["@@iterator"],typeof c=="function"?c:null)}var G=Object.assign,z;function Y(c){if(z===void 0)try{throw Error()}catch(v){var d=v.stack.trim().match(/\n( *(at )?)/);z=d&&d[1]||""}return`
34
+ `+z+c}var Z=!1;function ee(c,d){if(!c||Z)return"";Z=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(d)if(d=function(){throw Error()},Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(Be){var x=Be}Reflect.construct(c,[],d)}else{try{d.call()}catch(Be){x=Be}c.call(d.prototype)}else{try{throw Error()}catch(Be){x=Be}c()}}catch(Be){if(Be&&x&&typeof Be.stack=="string"){for(var N=Be.stack.split(`
35
+ `),$=x.stack.split(`
36
+ `),W=N.length-1,he=$.length-1;1<=W&&0<=he&&N[W]!==$[he];)he--;for(;1<=W&&0<=he;W--,he--)if(N[W]!==$[he]){if(W!==1||he!==1)do if(W--,he--,0>he||N[W]!==$[he]){var ye=`
37
+ `+N[W].replace(" at new "," at ");return c.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",c.displayName)),ye}while(1<=W&&0<=he);break}}}finally{Z=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?Y(c):""}function pe(c){switch(c.tag){case 5:return Y(c.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return c=ee(c.type,!1),c;case 11:return c=ee(c.type.render,!1),c;case 1:return c=ee(c.type,!0),c;default:return""}}function se(c){if(c==null)return null;if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case M:return"Fragment";case T:return"Portal";case P:return"Profiler";case j:return"StrictMode";case B:return"Suspense";case V:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case H:return(c.displayName||"Context")+".Consumer";case R:return(c._context.displayName||"Context")+".Provider";case D:var d=c.render;return c=c.displayName,c||(c=d.displayName||d.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case U:return d=c.displayName||null,d!==null?d:se(c.type)||"Memo";case K:d=c._payload,c=c._init;try{return se(c(d))}catch{}}return null}function xe(c){var d=c.type;switch(c.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=d.render,c=c.displayName||c.name||"",d.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return se(d);case 8:return d===j?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function J(c){switch(typeof c){case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function te(c){var d=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function X(c){var d=te(c)?"checked":"value",v=Object.getOwnPropertyDescriptor(c.constructor.prototype,d),x=""+c[d];if(!c.hasOwnProperty(d)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var N=v.get,$=v.set;return Object.defineProperty(c,d,{configurable:!0,get:function(){return N.call(this)},set:function(W){x=""+W,$.call(this,W)}}),Object.defineProperty(c,d,{enumerable:v.enumerable}),{getValue:function(){return x},setValue:function(W){x=""+W},stopTracking:function(){c._valueTracker=null,delete c[d]}}}}function ae(c){c._valueTracker||(c._valueTracker=X(c))}function Le(c){if(!c)return!1;var d=c._valueTracker;if(!d)return!0;var v=d.getValue(),x="";return c&&(x=te(c)?c.checked?"true":"false":c.value),c=x,c!==v?(d.setValue(c),!0):!1}function ce(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}function Se(c,d){var v=d.checked;return G({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:v??c._wrapperState.initialChecked})}function Ze(c,d){var v=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;v=J(d.value!=null?d.value:v),c._wrapperState={initialChecked:x,initialValue:v,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function gt(c,d){d=d.checked,d!=null&&C(c,"checked",d,!1)}function Ke(c,d){gt(c,d);var v=J(d.value),x=d.type;if(v!=null)x==="number"?(v===0&&c.value===""||c.value!=v)&&(c.value=""+v):c.value!==""+v&&(c.value=""+v);else if(x==="submit"||x==="reset"){c.removeAttribute("value");return}d.hasOwnProperty("value")?$e(c,d.type,v):d.hasOwnProperty("defaultValue")&&$e(c,d.type,J(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(c.defaultChecked=!!d.defaultChecked)}function nt(c,d,v){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+c._wrapperState.initialValue,v||d===c.value||(c.value=d),c.defaultValue=d}v=c.name,v!==""&&(c.name=""),c.defaultChecked=!!c._wrapperState.initialChecked,v!==""&&(c.name=v)}function $e(c,d,v){(d!=="number"||ce(c.ownerDocument)!==c)&&(v==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+v&&(c.defaultValue=""+v))}var ne=Array.isArray;function Q(c,d,v,x){if(c=c.options,d){d={};for(var N=0;N<v.length;N++)d["$"+v[N]]=!0;for(v=0;v<c.length;v++)N=d.hasOwnProperty("$"+c[v].value),c[v].selected!==N&&(c[v].selected=N),N&&x&&(c[v].defaultSelected=!0)}else{for(v=""+J(v),d=null,N=0;N<c.length;N++){if(c[N].value===v){c[N].selected=!0,x&&(c[N].defaultSelected=!0);return}d!==null||c[N].disabled||(d=c[N])}d!==null&&(d.selected=!0)}}function We(c,d){if(d.dangerouslySetInnerHTML!=null)throw Error(n(91));return G({},d,{value:void 0,defaultValue:void 0,children:""+c._wrapperState.initialValue})}function Ne(c,d){var v=d.value;if(v==null){if(v=d.children,d=d.defaultValue,v!=null){if(d!=null)throw Error(n(92));if(ne(v)){if(1<v.length)throw Error(n(93));v=v[0]}d=v}d==null&&(d=""),v=d}c._wrapperState={initialValue:J(v)}}function ie(c,d){var v=J(d.value),x=J(d.defaultValue);v!=null&&(v=""+v,v!==c.value&&(c.value=v),d.defaultValue==null&&c.defaultValue!==v&&(c.defaultValue=v)),x!=null&&(c.defaultValue=""+x)}function q(c){var d=c.textContent;d===c._wrapperState.initialValue&&d!==""&&d!==null&&(c.value=d)}function oe(c){switch(c){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Re(c,d){return c==null||c==="http://www.w3.org/1999/xhtml"?oe(d):c==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var ze,Ye=(function(c){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(d,v,x,N){MSApp.execUnsafeLocalFunction(function(){return c(d,v,x,N)})}:c})(function(c,d){if(c.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in c)c.innerHTML=d;else{for(ze=ze||document.createElement("div"),ze.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=ze.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;d.firstChild;)c.appendChild(d.firstChild)}});function Ie(c,d){if(d){var v=c.firstChild;if(v&&v===c.lastChild&&v.nodeType===3){v.nodeValue=d;return}}c.textContent=d}var De={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ge=["Webkit","ms","Moz","O"];Object.keys(De).forEach(function(c){Ge.forEach(function(d){d=d+c.charAt(0).toUpperCase()+c.substring(1),De[d]=De[c]})});function ft(c,d,v){return d==null||typeof d=="boolean"||d===""?"":v||typeof d!="number"||d===0||De.hasOwnProperty(c)&&De[c]?(""+d).trim():d+"px"}function bt(c,d){c=c.style;for(var v in d)if(d.hasOwnProperty(v)){var x=v.indexOf("--")===0,N=ft(v,d[v],x);v==="float"&&(v="cssFloat"),x?c.setProperty(v,N):c[v]=N}}var at=G({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Zt(c,d){if(d){if(at[c]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,c));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function jt(c,d){if(c.indexOf("-")===-1)return typeof d.is=="string";switch(c){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ft=null;function Pt(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var Tt=null,ke=null,et=null;function Et(c){if(c=Qd(c)){if(typeof Tt!="function")throw Error(n(280));var d=c.stateNode;d&&(d=P1(d),Tt(c.stateNode,c.type,d))}}function Qe(c){ke?et?et.push(c):et=[c]:ke=c}function st(){if(ke){var c=ke,d=et;if(et=ke=null,Et(c),d)for(c=0;c<d.length;c++)Et(d[c])}}function rt(c,d){return c(d)}function qt(){}var Yt=!1;function an(c,d,v){if(Yt)return c(d,v);Yt=!0;try{return rt(c,d,v)}finally{Yt=!1,(ke!==null||et!==null)&&(qt(),st())}}function Wt(c,d){var v=c.stateNode;if(v===null)return null;var x=P1(v);if(x===null)return null;v=x[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(c=c.type,x=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!x;break e;default:c=!1}if(c)return null;if(v&&typeof v!="function")throw Error(n(231,d,typeof v));return v}var Mn=!1;if(u)try{var Bt={};Object.defineProperty(Bt,"passive",{get:function(){Mn=!0}}),window.addEventListener("test",Bt,Bt),window.removeEventListener("test",Bt,Bt)}catch{Mn=!1}function re(c,d,v,x,N,$,W,he,ye){var Be=Array.prototype.slice.call(arguments,3);try{d.apply(v,Be)}catch(dt){this.onError(dt)}}var ue=!1,de=null,_e=!1,Fe=null,xt={onError:function(c){ue=!0,de=c}};function yt(c,d,v,x,N,$,W,he,ye){ue=!1,de=null,re.apply(xt,arguments)}function kt(c,d,v,x,N,$,W,he,ye){if(yt.apply(this,arguments),ue){if(ue){var Be=de;ue=!1,de=null}else throw Error(n(198));_e||(_e=!0,Fe=Be)}}function ot(c){var d=c,v=c;if(c.alternate)for(;d.return;)d=d.return;else{c=d;do d=c,(d.flags&4098)!==0&&(v=d.return),c=d.return;while(c)}return d.tag===3?v:null}function ht(c){if(c.tag===13){var d=c.memoizedState;if(d===null&&(c=c.alternate,c!==null&&(d=c.memoizedState)),d!==null)return d.dehydrated}return null}function je(c){if(ot(c)!==c)throw Error(n(188))}function me(c){var d=c.alternate;if(!d){if(d=ot(c),d===null)throw Error(n(188));return d!==c?null:c}for(var v=c,x=d;;){var N=v.return;if(N===null)break;var $=N.alternate;if($===null){if(x=N.return,x!==null){v=x;continue}break}if(N.child===$.child){for($=N.child;$;){if($===v)return je(N),c;if($===x)return je(N),d;$=$.sibling}throw Error(n(188))}if(v.return!==x.return)v=N,x=$;else{for(var W=!1,he=N.child;he;){if(he===v){W=!0,v=N,x=$;break}if(he===x){W=!0,x=N,v=$;break}he=he.sibling}if(!W){for(he=$.child;he;){if(he===v){W=!0,v=$,x=N;break}if(he===x){W=!0,x=$,v=N;break}he=he.sibling}if(!W)throw Error(n(189))}}if(v.alternate!==x)throw Error(n(190))}if(v.tag!==3)throw Error(n(188));return v.stateNode.current===v?c:d}function tt(c){return c=me(c),c!==null?Ct(c):null}function Ct(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){var d=Ct(c);if(d!==null)return d;c=c.sibling}return null}var be=t.unstable_scheduleCallback,it=t.unstable_cancelCallback,wt=t.unstable_shouldYield,Pe=t.unstable_requestPaint,Xe=t.unstable_now,Lt=t.unstable_getCurrentPriorityLevel,Ut=t.unstable_ImmediatePriority,At=t.unstable_UserBlockingPriority,_t=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,Ve=t.unstable_IdlePriority,Je=null,_=null;function fe(c){if(_&&typeof _.onCommitFiberRoot=="function")try{_.onCommitFiberRoot(Je,c,void 0,(c.current.flags&128)===128)}catch{}}var we=Math.clz32?Math.clz32:ct,Ue=Math.log,Me=Math.LN2;function ct(c){return c>>>=0,c===0?32:31-(Ue(c)/Me|0)|0}var Ot=64,zt=4194304;function Rt(c){switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function kn(c,d){var v=c.pendingLanes;if(v===0)return 0;var x=0,N=c.suspendedLanes,$=c.pingedLanes,W=v&268435455;if(W!==0){var he=W&~N;he!==0?x=Rt(he):($&=W,$!==0&&(x=Rt($)))}else W=v&~N,W!==0?x=Rt(W):$!==0&&(x=Rt($));if(x===0)return 0;if(d!==0&&d!==x&&(d&N)===0&&(N=x&-x,$=d&-d,N>=$||N===16&&($&4194240)!==0))return d;if((x&4)!==0&&(x|=v&16),d=c.entangledLanes,d!==0)for(c=c.entanglements,d&=x;0<d;)v=31-we(d),N=1<<v,x|=c[v],d&=~N;return x}function Jt(c,d){switch(c){case 1:case 2:case 4:return d+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Sn(c,d){for(var v=c.suspendedLanes,x=c.pingedLanes,N=c.expirationTimes,$=c.pendingLanes;0<$;){var W=31-we($),he=1<<W,ye=N[W];ye===-1?((he&v)===0||(he&x)!==0)&&(N[W]=Jt(he,d)):ye<=d&&(c.expiredLanes|=he),$&=~he}}function Qn(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function dn(){var c=Ot;return Ot<<=1,(Ot&4194240)===0&&(Ot=64),c}function mr(c){for(var d=[],v=0;31>v;v++)d.push(c);return d}function Kt(c,d,v){c.pendingLanes|=d,d!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,d=31-we(d),c[d]=v}function wr(c,d){var v=c.pendingLanes&~d;c.pendingLanes=d,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=d,c.mutableReadLanes&=d,c.entangledLanes&=d,d=c.entanglements;var x=c.eventTimes;for(c=c.expirationTimes;0<v;){var N=31-we(v),$=1<<N;d[N]=0,x[N]=-1,c[N]=-1,v&=~$}}function Hr(c,d){var v=c.entangledLanes|=d;for(c=c.entanglements;v;){var x=31-we(v),N=1<<x;N&d|c[x]&d&&(c[x]|=d),v&=~N}}var wn=0;function _o(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var Rn,Ks,Ps,on,yn,Wn=!1,Ur=[],Jn=null,Fn=null,es=null,ca=new Map,Vo=new Map,ms=[],Gs="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Zo(c,d){switch(c){case"focusin":case"focusout":Jn=null;break;case"dragenter":case"dragleave":Fn=null;break;case"mouseover":case"mouseout":es=null;break;case"pointerover":case"pointerout":ca.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vo.delete(d.pointerId)}}function Ys(c,d,v,x,N,$){return c===null||c.nativeEvent!==$?(c={blockedOn:d,domEventName:v,eventSystemFlags:x,nativeEvent:$,targetContainers:[N]},d!==null&&(d=Qd(d),d!==null&&Ks(d)),c):(c.eventSystemFlags|=x,d=c.targetContainers,N!==null&&d.indexOf(N)===-1&&d.push(N),c)}function uo(c,d,v,x,N){switch(d){case"focusin":return Jn=Ys(Jn,c,d,v,x,N),!0;case"dragenter":return Fn=Ys(Fn,c,d,v,x,N),!0;case"mouseover":return es=Ys(es,c,d,v,x,N),!0;case"pointerover":var $=N.pointerId;return ca.set($,Ys(ca.get($)||null,c,d,v,x,N)),!0;case"gotpointercapture":return $=N.pointerId,Vo.set($,Ys(Vo.get($)||null,c,d,v,x,N)),!0}return!1}function le(c){var d=Wl(c.target);if(d!==null){var v=ot(d);if(v!==null){if(d=v.tag,d===13){if(d=ht(v),d!==null){c.blockedOn=d,yn(c.priority,function(){Ps(v)});return}}else if(d===3&&v.stateNode.current.memoizedState.isDehydrated){c.blockedOn=v.tag===3?v.stateNode.containerInfo:null;return}}}c.blockedOn=null}function He(c){if(c.blockedOn!==null)return!1;for(var d=c.targetContainers;0<d.length;){var v=tu(c.domEventName,c.eventSystemFlags,d[0],c.nativeEvent);if(v===null){v=c.nativeEvent;var x=new v.constructor(v.type,v);Ft=x,v.target.dispatchEvent(x),Ft=null}else return d=Qd(v),d!==null&&Ks(d),c.blockedOn=v,!1;d.shift()}return!0}function lt(c,d,v){He(c)&&v.delete(d)}function en(){Wn=!1,Jn!==null&&He(Jn)&&(Jn=null),Fn!==null&&He(Fn)&&(Fn=null),es!==null&&He(es)&&(es=null),ca.forEach(lt),Vo.forEach(lt)}function nn(c,d){c.blockedOn===d&&(c.blockedOn=null,Wn||(Wn=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,en)))}function Zn(c){function d(N){return nn(N,c)}if(0<Ur.length){nn(Ur[0],c);for(var v=1;v<Ur.length;v++){var x=Ur[v];x.blockedOn===c&&(x.blockedOn=null)}}for(Jn!==null&&nn(Jn,c),Fn!==null&&nn(Fn,c),es!==null&&nn(es,c),ca.forEach(d),Vo.forEach(d),v=0;v<ms.length;v++)x=ms[v],x.blockedOn===c&&(x.blockedOn=null);for(;0<ms.length&&(v=ms[0],v.blockedOn===null);)le(v),v.blockedOn===null&&ms.shift()}var Tn=A.ReactCurrentBatchConfig,Pn=!0;function un(c,d,v,x){var N=wn,$=Tn.transition;Tn.transition=null;try{wn=1,ua(c,d,v,x)}finally{wn=N,Tn.transition=$}}function gr(c,d,v,x){var N=wn,$=Tn.transition;Tn.transition=null;try{wn=4,ua(c,d,v,x)}finally{wn=N,Tn.transition=$}}function ua(c,d,v,x){if(Pn){var N=tu(c,d,v,x);if(N===null)I2(c,d,x,Or,v),Zo(c,x);else if(uo(N,c,d,v,x))x.stopPropagation();else if(Zo(c,x),d&4&&-1<Gs.indexOf(c)){for(;N!==null;){var $=Qd(N);if($!==null&&Rn($),$=tu(c,d,v,x),$===null&&I2(c,d,x,Or,v),$===N)break;N=$}N!==null&&x.stopPropagation()}else I2(c,d,x,null,v)}}var Or=null;function tu(c,d,v,x){if(Or=null,c=Pt(x),c=Wl(c),c!==null)if(d=ot(c),d===null)c=null;else if(v=d.tag,v===13){if(c=ht(d),c!==null)return c;c=null}else if(v===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;c=null}else d!==c&&(c=null);return Or=c,null}function gs(c){switch(c){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Lt()){case Ut:return 1;case At:return 4;case _t:case Ae:return 16;case Ve:return 536870912;default:return 16}default:return 16}}var fo=null,zl=null,nu=null;function g1(){if(nu)return nu;var c,d=zl,v=d.length,x,N="value"in fo?fo.value:fo.textContent,$=N.length;for(c=0;c<v&&d[c]===N[c];c++);var W=v-c;for(x=1;x<=W&&d[v-x]===N[$-x];x++);return nu=N.slice(c,1<x?1-x:void 0)}function Li(c){var d=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&d===13&&(c=13)):c=d,c===10&&(c=13),32<=c||c===13?c:0}function ru(){return!0}function v1(){return!1}function vs(c){function d(v,x,N,$,W){this._reactName=v,this._targetInst=N,this.type=x,this.nativeEvent=$,this.target=W,this.currentTarget=null;for(var he in c)c.hasOwnProperty(he)&&(v=c[he],this[he]=v?v($):$[he]);return this.isDefaultPrevented=($.defaultPrevented!=null?$.defaultPrevented:$.returnValue===!1)?ru:v1,this.isPropagationStopped=v1,this}return G(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var v=this.nativeEvent;v&&(v.preventDefault?v.preventDefault():typeof v.returnValue!="unknown"&&(v.returnValue=!1),this.isDefaultPrevented=ru)},stopPropagation:function(){var v=this.nativeEvent;v&&(v.stopPropagation?v.stopPropagation():typeof v.cancelBubble!="unknown"&&(v.cancelBubble=!0),this.isPropagationStopped=ru)},persist:function(){},isPersistent:ru}),d}var ho={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$i=vs(ho),Ti=G({},ho,{view:0,detail:0}),w1=vs(Ti),su,Bl,Di,Ul=G({},Ti,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ts,button:0,buttons:0,relatedTarget:function(c){return c.relatedTarget===void 0?c.fromElement===c.srcElement?c.toElement:c.fromElement:c.relatedTarget},movementX:function(c){return"movementX"in c?c.movementX:(c!==Di&&(Di&&c.type==="mousemove"?(su=c.screenX-Di.screenX,Bl=c.screenY-Di.screenY):Bl=su=0,Di=c),su)},movementY:function(c){return"movementY"in c?c.movementY:Bl}}),Vd=vs(Ul),y1=G({},Ul,{dataTransfer:0}),ge=vs(y1),pt=G({},Ti,{relatedTarget:0}),tn=vs(pt),pn=G({},ho,{animationName:0,elapsedTime:0,pseudoElement:0}),rn=vs(pn),An=G({},ho,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),Wr=vs(An),On=G({},ho,{data:0}),sr=vs(On),or={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Oa={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},b1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Dn(c){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(c):(c=b1[c])?!!d[c]:!1}function ts(){return Dn}var ws=G({},Ti,{key:function(c){if(c.key){var d=or[c.key]||c.key;if(d!=="Unidentified")return d}return c.type==="keypress"?(c=Li(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?Oa[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ts,charCode:function(c){return c.type==="keypress"?Li(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?Li(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),A2=vs(ws),Zd=G({},Ul,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),au=vs(Zd),x1=G({},Ti,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ts}),Ia=vs(x1),k1=G({},ho,{propertyName:0,elapsedTime:0,pseudoElement:0}),S1=vs(k1),I$=G({},Ul,{deltaX:function(c){return"deltaX"in c?c.deltaX:"wheelDeltaX"in c?-c.wheelDeltaX:0},deltaY:function(c){return"deltaY"in c?c.deltaY:"wheelDeltaY"in c?-c.wheelDeltaY:"wheelDelta"in c?-c.wheelDelta:0},deltaZ:0,deltaMode:0}),F$=vs(I$),_$=[9,13,27,32],N2=u&&"CompositionEvent"in window,zd=null;u&&"documentMode"in document&&(zd=document.documentMode);var V$=u&&"TextEvent"in window&&!zd,Qy=u&&(!N2||zd&&8<zd&&11>=zd),Jy=" ",eb=!1;function tb(c,d){switch(c){case"keyup":return _$.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nb(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var ou=!1;function Z$(c,d){switch(c){case"compositionend":return nb(d);case"keypress":return d.which!==32?null:(eb=!0,Jy);case"textInput":return c=d.data,c===Jy&&eb?null:c;default:return null}}function z$(c,d){if(ou)return c==="compositionend"||!N2&&tb(c,d)?(c=g1(),nu=zl=fo=null,ou=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return Qy&&d.locale!=="ko"?null:d.data;default:return null}}var B$={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rb(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d==="input"?!!B$[c.type]:d==="textarea"}function sb(c,d,v,x){Qe(x),d=N1(d,"onChange"),0<d.length&&(v=new $i("onChange","change",null,v,x),c.push({event:v,listeners:d}))}var Bd=null,Ud=null;function U$(c){kb(c,0)}function E1(c){var d=du(c);if(Le(d))return c}function W$(c,d){if(c==="change")return d}var ab=!1;if(u){var M2;if(u){var R2="oninput"in document;if(!R2){var ob=document.createElement("div");ob.setAttribute("oninput","return;"),R2=typeof ob.oninput=="function"}M2=R2}else M2=!1;ab=M2&&(!document.documentMode||9<document.documentMode)}function ib(){Bd&&(Bd.detachEvent("onpropertychange",lb),Ud=Bd=null)}function lb(c){if(c.propertyName==="value"&&E1(Ud)){var d=[];sb(d,Ud,c,Pt(c)),an(U$,d)}}function K$(c,d,v){c==="focusin"?(ib(),Bd=d,Ud=v,Bd.attachEvent("onpropertychange",lb)):c==="focusout"&&ib()}function G$(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return E1(Ud)}function Y$(c,d){if(c==="click")return E1(d)}function q$(c,d){if(c==="input"||c==="change")return E1(d)}function X$(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var Fa=typeof Object.is=="function"?Object.is:X$;function Wd(c,d){if(Fa(c,d))return!0;if(typeof c!="object"||c===null||typeof d!="object"||d===null)return!1;var v=Object.keys(c),x=Object.keys(d);if(v.length!==x.length)return!1;for(x=0;x<v.length;x++){var N=v[x];if(!f.call(d,N)||!Fa(c[N],d[N]))return!1}return!0}function cb(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function ub(c,d){var v=cb(c);c=0;for(var x;v;){if(v.nodeType===3){if(x=c+v.textContent.length,c<=d&&x>=d)return{node:v,offset:d-c};c=x}e:{for(;v;){if(v.nextSibling){v=v.nextSibling;break e}v=v.parentNode}v=void 0}v=cb(v)}}function db(c,d){return c&&d?c===d?!0:c&&c.nodeType===3?!1:d&&d.nodeType===3?db(c,d.parentNode):"contains"in c?c.contains(d):c.compareDocumentPosition?!!(c.compareDocumentPosition(d)&16):!1:!1}function fb(){for(var c=window,d=ce();d instanceof c.HTMLIFrameElement;){try{var v=typeof d.contentWindow.location.href=="string"}catch{v=!1}if(v)c=d.contentWindow;else break;d=ce(c.document)}return d}function P2(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d&&(d==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||d==="textarea"||c.contentEditable==="true")}function Q$(c){var d=fb(),v=c.focusedElem,x=c.selectionRange;if(d!==v&&v&&v.ownerDocument&&db(v.ownerDocument.documentElement,v)){if(x!==null&&P2(v)){if(d=x.start,c=x.end,c===void 0&&(c=d),"selectionStart"in v)v.selectionStart=d,v.selectionEnd=Math.min(c,v.value.length);else if(c=(d=v.ownerDocument||document)&&d.defaultView||window,c.getSelection){c=c.getSelection();var N=v.textContent.length,$=Math.min(x.start,N);x=x.end===void 0?$:Math.min(x.end,N),!c.extend&&$>x&&(N=x,x=$,$=N),N=ub(v,$);var W=ub(v,x);N&&W&&(c.rangeCount!==1||c.anchorNode!==N.node||c.anchorOffset!==N.offset||c.focusNode!==W.node||c.focusOffset!==W.offset)&&(d=d.createRange(),d.setStart(N.node,N.offset),c.removeAllRanges(),$>x?(c.addRange(d),c.extend(W.node,W.offset)):(d.setEnd(W.node,W.offset),c.addRange(d)))}}for(d=[],c=v;c=c.parentNode;)c.nodeType===1&&d.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<d.length;v++)c=d[v],c.element.scrollLeft=c.left,c.element.scrollTop=c.top}}var J$=u&&"documentMode"in document&&11>=document.documentMode,iu=null,L2=null,Kd=null,$2=!1;function hb(c,d,v){var x=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;$2||iu==null||iu!==ce(x)||(x=iu,"selectionStart"in x&&P2(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Kd&&Wd(Kd,x)||(Kd=x,x=N1(L2,"onSelect"),0<x.length&&(d=new $i("onSelect","select",null,d,v),c.push({event:d,listeners:x}),d.target=iu)))}function C1(c,d){var v={};return v[c.toLowerCase()]=d.toLowerCase(),v["Webkit"+c]="webkit"+d,v["Moz"+c]="moz"+d,v}var lu={animationend:C1("Animation","AnimationEnd"),animationiteration:C1("Animation","AnimationIteration"),animationstart:C1("Animation","AnimationStart"),transitionend:C1("Transition","TransitionEnd")},T2={},pb={};u&&(pb=document.createElement("div").style,"AnimationEvent"in window||(delete lu.animationend.animation,delete lu.animationiteration.animation,delete lu.animationstart.animation),"TransitionEvent"in window||delete lu.transitionend.transition);function j1(c){if(T2[c])return T2[c];if(!lu[c])return c;var d=lu[c],v;for(v in d)if(d.hasOwnProperty(v)&&v in pb)return T2[c]=d[v];return c}var mb=j1("animationend"),gb=j1("animationiteration"),vb=j1("animationstart"),wb=j1("transitionend"),yb=new Map,bb="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Hi(c,d){yb.set(c,d),i(d,[c])}for(var D2=0;D2<bb.length;D2++){var H2=bb[D2],eT=H2.toLowerCase(),tT=H2[0].toUpperCase()+H2.slice(1);Hi(eT,"on"+tT)}Hi(mb,"onAnimationEnd"),Hi(gb,"onAnimationIteration"),Hi(vb,"onAnimationStart"),Hi("dblclick","onDoubleClick"),Hi("focusin","onFocus"),Hi("focusout","onBlur"),Hi(wb,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),nT=new Set("cancel close invalid load scroll toggle".split(" ").concat(Gd));function xb(c,d,v){var x=c.type||"unknown-event";c.currentTarget=v,kt(x,d,void 0,c),c.currentTarget=null}function kb(c,d){d=(d&4)!==0;for(var v=0;v<c.length;v++){var x=c[v],N=x.event;x=x.listeners;e:{var $=void 0;if(d)for(var W=x.length-1;0<=W;W--){var he=x[W],ye=he.instance,Be=he.currentTarget;if(he=he.listener,ye!==$&&N.isPropagationStopped())break e;xb(N,he,Be),$=ye}else for(W=0;W<x.length;W++){if(he=x[W],ye=he.instance,Be=he.currentTarget,he=he.listener,ye!==$&&N.isPropagationStopped())break e;xb(N,he,Be),$=ye}}}if(_e)throw c=Fe,_e=!1,Fe=null,c}function er(c,d){var v=d[B2];v===void 0&&(v=d[B2]=new Set);var x=c+"__bubble";v.has(x)||(Sb(d,c,2,!1),v.add(x))}function O2(c,d,v){var x=0;d&&(x|=4),Sb(v,c,x,d)}var A1="_reactListening"+Math.random().toString(36).slice(2);function Yd(c){if(!c[A1]){c[A1]=!0,r.forEach(function(v){v!=="selectionchange"&&(nT.has(v)||O2(v,!1,c),O2(v,!0,c))});var d=c.nodeType===9?c:c.ownerDocument;d===null||d[A1]||(d[A1]=!0,O2("selectionchange",!1,d))}}function Sb(c,d,v,x){switch(gs(d)){case 1:var N=un;break;case 4:N=gr;break;default:N=ua}v=N.bind(null,d,v,c),N=void 0,!Mn||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(N=!0),x?N!==void 0?c.addEventListener(d,v,{capture:!0,passive:N}):c.addEventListener(d,v,!0):N!==void 0?c.addEventListener(d,v,{passive:N}):c.addEventListener(d,v,!1)}function I2(c,d,v,x,N){var $=x;if((d&1)===0&&(d&2)===0&&x!==null)e:for(;;){if(x===null)return;var W=x.tag;if(W===3||W===4){var he=x.stateNode.containerInfo;if(he===N||he.nodeType===8&&he.parentNode===N)break;if(W===4)for(W=x.return;W!==null;){var ye=W.tag;if((ye===3||ye===4)&&(ye=W.stateNode.containerInfo,ye===N||ye.nodeType===8&&ye.parentNode===N))return;W=W.return}for(;he!==null;){if(W=Wl(he),W===null)return;if(ye=W.tag,ye===5||ye===6){x=$=W;continue e}he=he.parentNode}}x=x.return}an(function(){var Be=$,dt=Pt(v),vt=[];e:{var ut=yb.get(c);if(ut!==void 0){var $t=$i,Ht=c;switch(c){case"keypress":if(Li(v)===0)break e;case"keydown":case"keyup":$t=A2;break;case"focusin":Ht="focus",$t=tn;break;case"focusout":Ht="blur",$t=tn;break;case"beforeblur":case"afterblur":$t=tn;break;case"click":if(v.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$t=Vd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$t=ge;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$t=Ia;break;case mb:case gb:case vb:$t=rn;break;case wb:$t=S1;break;case"scroll":$t=w1;break;case"wheel":$t=F$;break;case"copy":case"cut":case"paste":$t=Wr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$t=au}var It=(d&4)!==0,vr=!It&&c==="scroll",Te=It?ut!==null?ut+"Capture":null:ut;It=[];for(var Ce=Be,Oe;Ce!==null;){Oe=Ce;var St=Oe.stateNode;if(Oe.tag===5&&St!==null&&(Oe=St,Te!==null&&(St=Wt(Ce,Te),St!=null&&It.push(qd(Ce,St,Oe)))),vr)break;Ce=Ce.return}0<It.length&&(ut=new $t(ut,Ht,null,v,dt),vt.push({event:ut,listeners:It}))}}if((d&7)===0){e:{if(ut=c==="mouseover"||c==="pointerover",$t=c==="mouseout"||c==="pointerout",ut&&v!==Ft&&(Ht=v.relatedTarget||v.fromElement)&&(Wl(Ht)||Ht[zo]))break e;if(($t||ut)&&(ut=dt.window===dt?dt:(ut=dt.ownerDocument)?ut.defaultView||ut.parentWindow:window,$t?(Ht=v.relatedTarget||v.toElement,$t=Be,Ht=Ht?Wl(Ht):null,Ht!==null&&(vr=ot(Ht),Ht!==vr||Ht.tag!==5&&Ht.tag!==6)&&(Ht=null)):($t=null,Ht=Be),$t!==Ht)){if(It=Vd,St="onMouseLeave",Te="onMouseEnter",Ce="mouse",(c==="pointerout"||c==="pointerover")&&(It=au,St="onPointerLeave",Te="onPointerEnter",Ce="pointer"),vr=$t==null?ut:du($t),Oe=Ht==null?ut:du(Ht),ut=new It(St,Ce+"leave",$t,v,dt),ut.target=vr,ut.relatedTarget=Oe,St=null,Wl(dt)===Be&&(It=new It(Te,Ce+"enter",Ht,v,dt),It.target=Oe,It.relatedTarget=vr,St=It),vr=St,$t&&Ht)t:{for(It=$t,Te=Ht,Ce=0,Oe=It;Oe;Oe=cu(Oe))Ce++;for(Oe=0,St=Te;St;St=cu(St))Oe++;for(;0<Ce-Oe;)It=cu(It),Ce--;for(;0<Oe-Ce;)Te=cu(Te),Oe--;for(;Ce--;){if(It===Te||Te!==null&&It===Te.alternate)break t;It=cu(It),Te=cu(Te)}It=null}else It=null;$t!==null&&Eb(vt,ut,$t,It,!1),Ht!==null&&vr!==null&&Eb(vt,vr,Ht,It,!0)}}e:{if(ut=Be?du(Be):window,$t=ut.nodeName&&ut.nodeName.toLowerCase(),$t==="select"||$t==="input"&&ut.type==="file")var Vt=W$;else if(rb(ut))if(ab)Vt=q$;else{Vt=G$;var Xt=K$}else($t=ut.nodeName)&&$t.toLowerCase()==="input"&&(ut.type==="checkbox"||ut.type==="radio")&&(Vt=Y$);if(Vt&&(Vt=Vt(c,Be))){sb(vt,Vt,v,dt);break e}Xt&&Xt(c,ut,Be),c==="focusout"&&(Xt=ut._wrapperState)&&Xt.controlled&&ut.type==="number"&&$e(ut,"number",ut.value)}switch(Xt=Be?du(Be):window,c){case"focusin":(rb(Xt)||Xt.contentEditable==="true")&&(iu=Xt,L2=Be,Kd=null);break;case"focusout":Kd=L2=iu=null;break;case"mousedown":$2=!0;break;case"contextmenu":case"mouseup":case"dragend":$2=!1,hb(vt,v,dt);break;case"selectionchange":if(J$)break;case"keydown":case"keyup":hb(vt,v,dt)}var Qt;if(N2)e:{switch(c){case"compositionstart":var sn="onCompositionStart";break e;case"compositionend":sn="onCompositionEnd";break e;case"compositionupdate":sn="onCompositionUpdate";break e}sn=void 0}else ou?tb(c,v)&&(sn="onCompositionEnd"):c==="keydown"&&v.keyCode===229&&(sn="onCompositionStart");sn&&(Qy&&v.locale!=="ko"&&(ou||sn!=="onCompositionStart"?sn==="onCompositionEnd"&&ou&&(Qt=g1()):(fo=dt,zl="value"in fo?fo.value:fo.textContent,ou=!0)),Xt=N1(Be,sn),0<Xt.length&&(sn=new sr(sn,c,null,v,dt),vt.push({event:sn,listeners:Xt}),Qt?sn.data=Qt:(Qt=nb(v),Qt!==null&&(sn.data=Qt)))),(Qt=V$?Z$(c,v):z$(c,v))&&(Be=N1(Be,"onBeforeInput"),0<Be.length&&(dt=new sr("onBeforeInput","beforeinput",null,v,dt),vt.push({event:dt,listeners:Be}),dt.data=Qt))}kb(vt,d)})}function qd(c,d,v){return{instance:c,listener:d,currentTarget:v}}function N1(c,d){for(var v=d+"Capture",x=[];c!==null;){var N=c,$=N.stateNode;N.tag===5&&$!==null&&(N=$,$=Wt(c,v),$!=null&&x.unshift(qd(c,$,N)),$=Wt(c,d),$!=null&&x.push(qd(c,$,N))),c=c.return}return x}function cu(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function Eb(c,d,v,x,N){for(var $=d._reactName,W=[];v!==null&&v!==x;){var he=v,ye=he.alternate,Be=he.stateNode;if(ye!==null&&ye===x)break;he.tag===5&&Be!==null&&(he=Be,N?(ye=Wt(v,$),ye!=null&&W.unshift(qd(v,ye,he))):N||(ye=Wt(v,$),ye!=null&&W.push(qd(v,ye,he)))),v=v.return}W.length!==0&&c.push({event:d,listeners:W})}var rT=/\r\n?/g,sT=/\u0000|\uFFFD/g;function Cb(c){return(typeof c=="string"?c:""+c).replace(rT,`
38
+ `).replace(sT,"")}function M1(c,d,v){if(d=Cb(d),Cb(c)!==d&&v)throw Error(n(425))}function R1(){}var F2=null,_2=null;function V2(c,d){return c==="textarea"||c==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var Z2=typeof setTimeout=="function"?setTimeout:void 0,aT=typeof clearTimeout=="function"?clearTimeout:void 0,jb=typeof Promise=="function"?Promise:void 0,oT=typeof queueMicrotask=="function"?queueMicrotask:typeof jb<"u"?function(c){return jb.resolve(null).then(c).catch(iT)}:Z2;function iT(c){setTimeout(function(){throw c})}function z2(c,d){var v=d,x=0;do{var N=v.nextSibling;if(c.removeChild(v),N&&N.nodeType===8)if(v=N.data,v==="/$"){if(x===0){c.removeChild(N),Zn(d);return}x--}else v!=="$"&&v!=="$?"&&v!=="$!"||x++;v=N}while(v);Zn(d)}function Oi(c){for(;c!=null;c=c.nextSibling){var d=c.nodeType;if(d===1||d===3)break;if(d===8){if(d=c.data,d==="$"||d==="$!"||d==="$?")break;if(d==="/$")return null}}return c}function Ab(c){c=c.previousSibling;for(var d=0;c;){if(c.nodeType===8){var v=c.data;if(v==="$"||v==="$!"||v==="$?"){if(d===0)return c;d--}else v==="/$"&&d++}c=c.previousSibling}return null}var uu=Math.random().toString(36).slice(2),po="__reactFiber$"+uu,Xd="__reactProps$"+uu,zo="__reactContainer$"+uu,B2="__reactEvents$"+uu,lT="__reactListeners$"+uu,cT="__reactHandles$"+uu;function Wl(c){var d=c[po];if(d)return d;for(var v=c.parentNode;v;){if(d=v[zo]||v[po]){if(v=d.alternate,d.child!==null||v!==null&&v.child!==null)for(c=Ab(c);c!==null;){if(v=c[po])return v;c=Ab(c)}return d}c=v,v=c.parentNode}return null}function Qd(c){return c=c[po]||c[zo],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function du(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(n(33))}function P1(c){return c[Xd]||null}var U2=[],fu=-1;function Ii(c){return{current:c}}function tr(c){0>fu||(c.current=U2[fu],U2[fu]=null,fu--)}function Gn(c,d){fu++,U2[fu]=c.current,c.current=d}var Fi={},ns=Ii(Fi),Ls=Ii(!1),Kl=Fi;function hu(c,d){var v=c.type.contextTypes;if(!v)return Fi;var x=c.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var N={},$;for($ in v)N[$]=d[$];return x&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=d,c.__reactInternalMemoizedMaskedChildContext=N),N}function $s(c){return c=c.childContextTypes,c!=null}function L1(){tr(Ls),tr(ns)}function Nb(c,d,v){if(ns.current!==Fi)throw Error(n(168));Gn(ns,d),Gn(Ls,v)}function Mb(c,d,v){var x=c.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return v;x=x.getChildContext();for(var N in x)if(!(N in d))throw Error(n(108,xe(c)||"Unknown",N));return G({},v,x)}function $1(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Fi,Kl=ns.current,Gn(ns,c),Gn(Ls,Ls.current),!0}function Rb(c,d,v){var x=c.stateNode;if(!x)throw Error(n(169));v?(c=Mb(c,d,Kl),x.__reactInternalMemoizedMergedChildContext=c,tr(Ls),tr(ns),Gn(ns,c)):tr(Ls),Gn(Ls,v)}var Bo=null,T1=!1,W2=!1;function Pb(c){Bo===null?Bo=[c]:Bo.push(c)}function uT(c){T1=!0,Pb(c)}function _i(){if(!W2&&Bo!==null){W2=!0;var c=0,d=wn;try{var v=Bo;for(wn=1;c<v.length;c++){var x=v[c];do x=x(!0);while(x!==null)}Bo=null,T1=!1}catch(N){throw Bo!==null&&(Bo=Bo.slice(c+1)),be(Ut,_i),N}finally{wn=d,W2=!1}}return null}var pu=[],mu=0,D1=null,H1=0,da=[],fa=0,Gl=null,Uo=1,Wo="";function Yl(c,d){pu[mu++]=H1,pu[mu++]=D1,D1=c,H1=d}function Lb(c,d,v){da[fa++]=Uo,da[fa++]=Wo,da[fa++]=Gl,Gl=c;var x=Uo;c=Wo;var N=32-we(x)-1;x&=~(1<<N),v+=1;var $=32-we(d)+N;if(30<$){var W=N-N%5;$=(x&(1<<W)-1).toString(32),x>>=W,N-=W,Uo=1<<32-we(d)+N|v<<N|x,Wo=$+c}else Uo=1<<$|v<<N|x,Wo=c}function K2(c){c.return!==null&&(Yl(c,1),Lb(c,1,0))}function G2(c){for(;c===D1;)D1=pu[--mu],pu[mu]=null,H1=pu[--mu],pu[mu]=null;for(;c===Gl;)Gl=da[--fa],da[fa]=null,Wo=da[--fa],da[fa]=null,Uo=da[--fa],da[fa]=null}var qs=null,Xs=null,ar=!1,_a=null;function $b(c,d){var v=ga(5,null,null,0);v.elementType="DELETED",v.stateNode=d,v.return=c,d=c.deletions,d===null?(c.deletions=[v],c.flags|=16):d.push(v)}function Tb(c,d){switch(c.tag){case 5:var v=c.type;return d=d.nodeType!==1||v.toLowerCase()!==d.nodeName.toLowerCase()?null:d,d!==null?(c.stateNode=d,qs=c,Xs=Oi(d.firstChild),!0):!1;case 6:return d=c.pendingProps===""||d.nodeType!==3?null:d,d!==null?(c.stateNode=d,qs=c,Xs=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(v=Gl!==null?{id:Uo,overflow:Wo}:null,c.memoizedState={dehydrated:d,treeContext:v,retryLane:1073741824},v=ga(18,null,null,0),v.stateNode=d,v.return=c,c.child=v,qs=c,Xs=null,!0):!1;default:return!1}}function Y2(c){return(c.mode&1)!==0&&(c.flags&128)===0}function q2(c){if(ar){var d=Xs;if(d){var v=d;if(!Tb(c,d)){if(Y2(c))throw Error(n(418));d=Oi(v.nextSibling);var x=qs;d&&Tb(c,d)?$b(x,v):(c.flags=c.flags&-4097|2,ar=!1,qs=c)}}else{if(Y2(c))throw Error(n(418));c.flags=c.flags&-4097|2,ar=!1,qs=c}}}function Db(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;qs=c}function O1(c){if(c!==qs)return!1;if(!ar)return Db(c),ar=!0,!1;var d;if((d=c.tag!==3)&&!(d=c.tag!==5)&&(d=c.type,d=d!=="head"&&d!=="body"&&!V2(c.type,c.memoizedProps)),d&&(d=Xs)){if(Y2(c))throw Hb(),Error(n(418));for(;d;)$b(c,d),d=Oi(d.nextSibling)}if(Db(c),c.tag===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));e:{for(c=c.nextSibling,d=0;c;){if(c.nodeType===8){var v=c.data;if(v==="/$"){if(d===0){Xs=Oi(c.nextSibling);break e}d--}else v!=="$"&&v!=="$!"&&v!=="$?"||d++}c=c.nextSibling}Xs=null}}else Xs=qs?Oi(c.stateNode.nextSibling):null;return!0}function Hb(){for(var c=Xs;c;)c=Oi(c.nextSibling)}function gu(){Xs=qs=null,ar=!1}function X2(c){_a===null?_a=[c]:_a.push(c)}var dT=A.ReactCurrentBatchConfig;function Jd(c,d,v){if(c=v.ref,c!==null&&typeof c!="function"&&typeof c!="object"){if(v._owner){if(v=v._owner,v){if(v.tag!==1)throw Error(n(309));var x=v.stateNode}if(!x)throw Error(n(147,c));var N=x,$=""+c;return d!==null&&d.ref!==null&&typeof d.ref=="function"&&d.ref._stringRef===$?d.ref:(d=function(W){var he=N.refs;W===null?delete he[$]:he[$]=W},d._stringRef=$,d)}if(typeof c!="string")throw Error(n(284));if(!v._owner)throw Error(n(290,c))}return c}function I1(c,d){throw c=Object.prototype.toString.call(d),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":c))}function Ob(c){var d=c._init;return d(c._payload)}function Ib(c){function d(Te,Ce){if(c){var Oe=Te.deletions;Oe===null?(Te.deletions=[Ce],Te.flags|=16):Oe.push(Ce)}}function v(Te,Ce){if(!c)return null;for(;Ce!==null;)d(Te,Ce),Ce=Ce.sibling;return null}function x(Te,Ce){for(Te=new Map;Ce!==null;)Ce.key!==null?Te.set(Ce.key,Ce):Te.set(Ce.index,Ce),Ce=Ce.sibling;return Te}function N(Te,Ce){return Te=Gi(Te,Ce),Te.index=0,Te.sibling=null,Te}function $(Te,Ce,Oe){return Te.index=Oe,c?(Oe=Te.alternate,Oe!==null?(Oe=Oe.index,Oe<Ce?(Te.flags|=2,Ce):Oe):(Te.flags|=2,Ce)):(Te.flags|=1048576,Ce)}function W(Te){return c&&Te.alternate===null&&(Te.flags|=2),Te}function he(Te,Ce,Oe,St){return Ce===null||Ce.tag!==6?(Ce=Zg(Oe,Te.mode,St),Ce.return=Te,Ce):(Ce=N(Ce,Oe),Ce.return=Te,Ce)}function ye(Te,Ce,Oe,St){var Vt=Oe.type;return Vt===M?dt(Te,Ce,Oe.props.children,St,Oe.key):Ce!==null&&(Ce.elementType===Vt||typeof Vt=="object"&&Vt!==null&&Vt.$$typeof===K&&Ob(Vt)===Ce.type)?(St=N(Ce,Oe.props),St.ref=Jd(Te,Ce,Oe),St.return=Te,St):(St=lh(Oe.type,Oe.key,Oe.props,null,Te.mode,St),St.ref=Jd(Te,Ce,Oe),St.return=Te,St)}function Be(Te,Ce,Oe,St){return Ce===null||Ce.tag!==4||Ce.stateNode.containerInfo!==Oe.containerInfo||Ce.stateNode.implementation!==Oe.implementation?(Ce=zg(Oe,Te.mode,St),Ce.return=Te,Ce):(Ce=N(Ce,Oe.children||[]),Ce.return=Te,Ce)}function dt(Te,Ce,Oe,St,Vt){return Ce===null||Ce.tag!==7?(Ce=rc(Oe,Te.mode,St,Vt),Ce.return=Te,Ce):(Ce=N(Ce,Oe),Ce.return=Te,Ce)}function vt(Te,Ce,Oe){if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number")return Ce=Zg(""+Ce,Te.mode,Oe),Ce.return=Te,Ce;if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case L:return Oe=lh(Ce.type,Ce.key,Ce.props,null,Te.mode,Oe),Oe.ref=Jd(Te,null,Ce),Oe.return=Te,Oe;case T:return Ce=zg(Ce,Te.mode,Oe),Ce.return=Te,Ce;case K:var St=Ce._init;return vt(Te,St(Ce._payload),Oe)}if(ne(Ce)||I(Ce))return Ce=rc(Ce,Te.mode,Oe,null),Ce.return=Te,Ce;I1(Te,Ce)}return null}function ut(Te,Ce,Oe,St){var Vt=Ce!==null?Ce.key:null;if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number")return Vt!==null?null:he(Te,Ce,""+Oe,St);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case L:return Oe.key===Vt?ye(Te,Ce,Oe,St):null;case T:return Oe.key===Vt?Be(Te,Ce,Oe,St):null;case K:return Vt=Oe._init,ut(Te,Ce,Vt(Oe._payload),St)}if(ne(Oe)||I(Oe))return Vt!==null?null:dt(Te,Ce,Oe,St,null);I1(Te,Oe)}return null}function $t(Te,Ce,Oe,St,Vt){if(typeof St=="string"&&St!==""||typeof St=="number")return Te=Te.get(Oe)||null,he(Ce,Te,""+St,Vt);if(typeof St=="object"&&St!==null){switch(St.$$typeof){case L:return Te=Te.get(St.key===null?Oe:St.key)||null,ye(Ce,Te,St,Vt);case T:return Te=Te.get(St.key===null?Oe:St.key)||null,Be(Ce,Te,St,Vt);case K:var Xt=St._init;return $t(Te,Ce,Oe,Xt(St._payload),Vt)}if(ne(St)||I(St))return Te=Te.get(Oe)||null,dt(Ce,Te,St,Vt,null);I1(Ce,St)}return null}function Ht(Te,Ce,Oe,St){for(var Vt=null,Xt=null,Qt=Ce,sn=Ce=0,_r=null;Qt!==null&&sn<Oe.length;sn++){Qt.index>sn?(_r=Qt,Qt=null):_r=Qt.sibling;var In=ut(Te,Qt,Oe[sn],St);if(In===null){Qt===null&&(Qt=_r);break}c&&Qt&&In.alternate===null&&d(Te,Qt),Ce=$(In,Ce,sn),Xt===null?Vt=In:Xt.sibling=In,Xt=In,Qt=_r}if(sn===Oe.length)return v(Te,Qt),ar&&Yl(Te,sn),Vt;if(Qt===null){for(;sn<Oe.length;sn++)Qt=vt(Te,Oe[sn],St),Qt!==null&&(Ce=$(Qt,Ce,sn),Xt===null?Vt=Qt:Xt.sibling=Qt,Xt=Qt);return ar&&Yl(Te,sn),Vt}for(Qt=x(Te,Qt);sn<Oe.length;sn++)_r=$t(Qt,Te,sn,Oe[sn],St),_r!==null&&(c&&_r.alternate!==null&&Qt.delete(_r.key===null?sn:_r.key),Ce=$(_r,Ce,sn),Xt===null?Vt=_r:Xt.sibling=_r,Xt=_r);return c&&Qt.forEach(function(Yi){return d(Te,Yi)}),ar&&Yl(Te,sn),Vt}function It(Te,Ce,Oe,St){var Vt=I(Oe);if(typeof Vt!="function")throw Error(n(150));if(Oe=Vt.call(Oe),Oe==null)throw Error(n(151));for(var Xt=Vt=null,Qt=Ce,sn=Ce=0,_r=null,In=Oe.next();Qt!==null&&!In.done;sn++,In=Oe.next()){Qt.index>sn?(_r=Qt,Qt=null):_r=Qt.sibling;var Yi=ut(Te,Qt,In.value,St);if(Yi===null){Qt===null&&(Qt=_r);break}c&&Qt&&Yi.alternate===null&&d(Te,Qt),Ce=$(Yi,Ce,sn),Xt===null?Vt=Yi:Xt.sibling=Yi,Xt=Yi,Qt=_r}if(In.done)return v(Te,Qt),ar&&Yl(Te,sn),Vt;if(Qt===null){for(;!In.done;sn++,In=Oe.next())In=vt(Te,In.value,St),In!==null&&(Ce=$(In,Ce,sn),Xt===null?Vt=In:Xt.sibling=In,Xt=In);return ar&&Yl(Te,sn),Vt}for(Qt=x(Te,Qt);!In.done;sn++,In=Oe.next())In=$t(Qt,Te,sn,In.value,St),In!==null&&(c&&In.alternate!==null&&Qt.delete(In.key===null?sn:In.key),Ce=$(In,Ce,sn),Xt===null?Vt=In:Xt.sibling=In,Xt=In);return c&&Qt.forEach(function(BT){return d(Te,BT)}),ar&&Yl(Te,sn),Vt}function vr(Te,Ce,Oe,St){if(typeof Oe=="object"&&Oe!==null&&Oe.type===M&&Oe.key===null&&(Oe=Oe.props.children),typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case L:e:{for(var Vt=Oe.key,Xt=Ce;Xt!==null;){if(Xt.key===Vt){if(Vt=Oe.type,Vt===M){if(Xt.tag===7){v(Te,Xt.sibling),Ce=N(Xt,Oe.props.children),Ce.return=Te,Te=Ce;break e}}else if(Xt.elementType===Vt||typeof Vt=="object"&&Vt!==null&&Vt.$$typeof===K&&Ob(Vt)===Xt.type){v(Te,Xt.sibling),Ce=N(Xt,Oe.props),Ce.ref=Jd(Te,Xt,Oe),Ce.return=Te,Te=Ce;break e}v(Te,Xt);break}else d(Te,Xt);Xt=Xt.sibling}Oe.type===M?(Ce=rc(Oe.props.children,Te.mode,St,Oe.key),Ce.return=Te,Te=Ce):(St=lh(Oe.type,Oe.key,Oe.props,null,Te.mode,St),St.ref=Jd(Te,Ce,Oe),St.return=Te,Te=St)}return W(Te);case T:e:{for(Xt=Oe.key;Ce!==null;){if(Ce.key===Xt)if(Ce.tag===4&&Ce.stateNode.containerInfo===Oe.containerInfo&&Ce.stateNode.implementation===Oe.implementation){v(Te,Ce.sibling),Ce=N(Ce,Oe.children||[]),Ce.return=Te,Te=Ce;break e}else{v(Te,Ce);break}else d(Te,Ce);Ce=Ce.sibling}Ce=zg(Oe,Te.mode,St),Ce.return=Te,Te=Ce}return W(Te);case K:return Xt=Oe._init,vr(Te,Ce,Xt(Oe._payload),St)}if(ne(Oe))return Ht(Te,Ce,Oe,St);if(I(Oe))return It(Te,Ce,Oe,St);I1(Te,Oe)}return typeof Oe=="string"&&Oe!==""||typeof Oe=="number"?(Oe=""+Oe,Ce!==null&&Ce.tag===6?(v(Te,Ce.sibling),Ce=N(Ce,Oe),Ce.return=Te,Te=Ce):(v(Te,Ce),Ce=Zg(Oe,Te.mode,St),Ce.return=Te,Te=Ce),W(Te)):v(Te,Ce)}return vr}var vu=Ib(!0),Fb=Ib(!1),F1=Ii(null),_1=null,wu=null,Q2=null;function J2(){Q2=wu=_1=null}function eg(c){var d=F1.current;tr(F1),c._currentValue=d}function tg(c,d,v){for(;c!==null;){var x=c.alternate;if((c.childLanes&d)!==d?(c.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),c===v)break;c=c.return}}function yu(c,d){_1=c,Q2=wu=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&d)!==0&&(Ts=!0),c.firstContext=null)}function ha(c){var d=c._currentValue;if(Q2!==c)if(c={context:c,memoizedValue:d,next:null},wu===null){if(_1===null)throw Error(n(308));wu=c,_1.dependencies={lanes:0,firstContext:c}}else wu=wu.next=c;return d}var ql=null;function ng(c){ql===null?ql=[c]:ql.push(c)}function _b(c,d,v,x){var N=d.interleaved;return N===null?(v.next=v,ng(d)):(v.next=N.next,N.next=v),d.interleaved=v,Ko(c,x)}function Ko(c,d){c.lanes|=d;var v=c.alternate;for(v!==null&&(v.lanes|=d),v=c,c=c.return;c!==null;)c.childLanes|=d,v=c.alternate,v!==null&&(v.childLanes|=d),v=c,c=c.return;return v.tag===3?v.stateNode:null}var Vi=!1;function rg(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vb(c,d){c=c.updateQueue,d.updateQueue===c&&(d.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,effects:c.effects})}function Go(c,d){return{eventTime:c,lane:d,tag:0,payload:null,callback:null,next:null}}function Zi(c,d,v){var x=c.updateQueue;if(x===null)return null;if(x=x.shared,(Hn&2)!==0){var N=x.pending;return N===null?d.next=d:(d.next=N.next,N.next=d),x.pending=d,Ko(c,v)}return N=x.interleaved,N===null?(d.next=d,ng(x)):(d.next=N.next,N.next=d),x.interleaved=d,Ko(c,v)}function V1(c,d,v){if(d=d.updateQueue,d!==null&&(d=d.shared,(v&4194240)!==0)){var x=d.lanes;x&=c.pendingLanes,v|=x,d.lanes=v,Hr(c,v)}}function Zb(c,d){var v=c.updateQueue,x=c.alternate;if(x!==null&&(x=x.updateQueue,v===x)){var N=null,$=null;if(v=v.firstBaseUpdate,v!==null){do{var W={eventTime:v.eventTime,lane:v.lane,tag:v.tag,payload:v.payload,callback:v.callback,next:null};$===null?N=$=W:$=$.next=W,v=v.next}while(v!==null);$===null?N=$=d:$=$.next=d}else N=$=d;v={baseState:x.baseState,firstBaseUpdate:N,lastBaseUpdate:$,shared:x.shared,effects:x.effects},c.updateQueue=v;return}c=v.lastBaseUpdate,c===null?v.firstBaseUpdate=d:c.next=d,v.lastBaseUpdate=d}function Z1(c,d,v,x){var N=c.updateQueue;Vi=!1;var $=N.firstBaseUpdate,W=N.lastBaseUpdate,he=N.shared.pending;if(he!==null){N.shared.pending=null;var ye=he,Be=ye.next;ye.next=null,W===null?$=Be:W.next=Be,W=ye;var dt=c.alternate;dt!==null&&(dt=dt.updateQueue,he=dt.lastBaseUpdate,he!==W&&(he===null?dt.firstBaseUpdate=Be:he.next=Be,dt.lastBaseUpdate=ye))}if($!==null){var vt=N.baseState;W=0,dt=Be=ye=null,he=$;do{var ut=he.lane,$t=he.eventTime;if((x&ut)===ut){dt!==null&&(dt=dt.next={eventTime:$t,lane:0,tag:he.tag,payload:he.payload,callback:he.callback,next:null});e:{var Ht=c,It=he;switch(ut=d,$t=v,It.tag){case 1:if(Ht=It.payload,typeof Ht=="function"){vt=Ht.call($t,vt,ut);break e}vt=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=It.payload,ut=typeof Ht=="function"?Ht.call($t,vt,ut):Ht,ut==null)break e;vt=G({},vt,ut);break e;case 2:Vi=!0}}he.callback!==null&&he.lane!==0&&(c.flags|=64,ut=N.effects,ut===null?N.effects=[he]:ut.push(he))}else $t={eventTime:$t,lane:ut,tag:he.tag,payload:he.payload,callback:he.callback,next:null},dt===null?(Be=dt=$t,ye=vt):dt=dt.next=$t,W|=ut;if(he=he.next,he===null){if(he=N.shared.pending,he===null)break;ut=he,he=ut.next,ut.next=null,N.lastBaseUpdate=ut,N.shared.pending=null}}while(!0);if(dt===null&&(ye=vt),N.baseState=ye,N.firstBaseUpdate=Be,N.lastBaseUpdate=dt,d=N.shared.interleaved,d!==null){N=d;do W|=N.lane,N=N.next;while(N!==d)}else $===null&&(N.shared.lanes=0);Jl|=W,c.lanes=W,c.memoizedState=vt}}function zb(c,d,v){if(c=d.effects,d.effects=null,c!==null)for(d=0;d<c.length;d++){var x=c[d],N=x.callback;if(N!==null){if(x.callback=null,x=v,typeof N!="function")throw Error(n(191,N));N.call(x)}}}var e0={},mo=Ii(e0),t0=Ii(e0),n0=Ii(e0);function Xl(c){if(c===e0)throw Error(n(174));return c}function sg(c,d){switch(Gn(n0,d),Gn(t0,c),Gn(mo,e0),c=d.nodeType,c){case 9:case 11:d=(d=d.documentElement)?d.namespaceURI:Re(null,"");break;default:c=c===8?d.parentNode:d,d=c.namespaceURI||null,c=c.tagName,d=Re(d,c)}tr(mo),Gn(mo,d)}function bu(){tr(mo),tr(t0),tr(n0)}function Bb(c){Xl(n0.current);var d=Xl(mo.current),v=Re(d,c.type);d!==v&&(Gn(t0,c),Gn(mo,v))}function ag(c){t0.current===c&&(tr(mo),tr(t0))}var ir=Ii(0);function z1(c){for(var d=c;d!==null;){if(d.tag===13){var v=d.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||v.data==="$?"||v.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var og=[];function ig(){for(var c=0;c<og.length;c++)og[c]._workInProgressVersionPrimary=null;og.length=0}var B1=A.ReactCurrentDispatcher,lg=A.ReactCurrentBatchConfig,Ql=0,lr=null,Mr=null,Ir=null,U1=!1,r0=!1,s0=0,fT=0;function rs(){throw Error(n(321))}function cg(c,d){if(d===null)return!1;for(var v=0;v<d.length&&v<c.length;v++)if(!Fa(c[v],d[v]))return!1;return!0}function ug(c,d,v,x,N,$){if(Ql=$,lr=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,B1.current=c===null||c.memoizedState===null?gT:vT,c=v(x,N),r0){$=0;do{if(r0=!1,s0=0,25<=$)throw Error(n(301));$+=1,Ir=Mr=null,d.updateQueue=null,B1.current=wT,c=v(x,N)}while(r0)}if(B1.current=G1,d=Mr!==null&&Mr.next!==null,Ql=0,Ir=Mr=lr=null,U1=!1,d)throw Error(n(300));return c}function dg(){var c=s0!==0;return s0=0,c}function go(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ir===null?lr.memoizedState=Ir=c:Ir=Ir.next=c,Ir}function pa(){if(Mr===null){var c=lr.alternate;c=c!==null?c.memoizedState:null}else c=Mr.next;var d=Ir===null?lr.memoizedState:Ir.next;if(d!==null)Ir=d,Mr=c;else{if(c===null)throw Error(n(310));Mr=c,c={memoizedState:Mr.memoizedState,baseState:Mr.baseState,baseQueue:Mr.baseQueue,queue:Mr.queue,next:null},Ir===null?lr.memoizedState=Ir=c:Ir=Ir.next=c}return Ir}function a0(c,d){return typeof d=="function"?d(c):d}function fg(c){var d=pa(),v=d.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=c;var x=Mr,N=x.baseQueue,$=v.pending;if($!==null){if(N!==null){var W=N.next;N.next=$.next,$.next=W}x.baseQueue=N=$,v.pending=null}if(N!==null){$=N.next,x=x.baseState;var he=W=null,ye=null,Be=$;do{var dt=Be.lane;if((Ql&dt)===dt)ye!==null&&(ye=ye.next={lane:0,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null}),x=Be.hasEagerState?Be.eagerState:c(x,Be.action);else{var vt={lane:dt,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null};ye===null?(he=ye=vt,W=x):ye=ye.next=vt,lr.lanes|=dt,Jl|=dt}Be=Be.next}while(Be!==null&&Be!==$);ye===null?W=x:ye.next=he,Fa(x,d.memoizedState)||(Ts=!0),d.memoizedState=x,d.baseState=W,d.baseQueue=ye,v.lastRenderedState=x}if(c=v.interleaved,c!==null){N=c;do $=N.lane,lr.lanes|=$,Jl|=$,N=N.next;while(N!==c)}else N===null&&(v.lanes=0);return[d.memoizedState,v.dispatch]}function hg(c){var d=pa(),v=d.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=c;var x=v.dispatch,N=v.pending,$=d.memoizedState;if(N!==null){v.pending=null;var W=N=N.next;do $=c($,W.action),W=W.next;while(W!==N);Fa($,d.memoizedState)||(Ts=!0),d.memoizedState=$,d.baseQueue===null&&(d.baseState=$),v.lastRenderedState=$}return[$,x]}function Ub(){}function Wb(c,d){var v=lr,x=pa(),N=d(),$=!Fa(x.memoizedState,N);if($&&(x.memoizedState=N,Ts=!0),x=x.queue,pg(Yb.bind(null,v,x,c),[c]),x.getSnapshot!==d||$||Ir!==null&&Ir.memoizedState.tag&1){if(v.flags|=2048,o0(9,Gb.bind(null,v,x,N,d),void 0,null),Fr===null)throw Error(n(349));(Ql&30)!==0||Kb(v,d,N)}return N}function Kb(c,d,v){c.flags|=16384,c={getSnapshot:d,value:v},d=lr.updateQueue,d===null?(d={lastEffect:null,stores:null},lr.updateQueue=d,d.stores=[c]):(v=d.stores,v===null?d.stores=[c]:v.push(c))}function Gb(c,d,v,x){d.value=v,d.getSnapshot=x,qb(d)&&Xb(c)}function Yb(c,d,v){return v(function(){qb(d)&&Xb(c)})}function qb(c){var d=c.getSnapshot;c=c.value;try{var v=d();return!Fa(c,v)}catch{return!0}}function Xb(c){var d=Ko(c,1);d!==null&&Ba(d,c,1,-1)}function Qb(c){var d=go();return typeof c=="function"&&(c=c()),d.memoizedState=d.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a0,lastRenderedState:c},d.queue=c,c=c.dispatch=mT.bind(null,lr,c),[d.memoizedState,c]}function o0(c,d,v,x){return c={tag:c,create:d,destroy:v,deps:x,next:null},d=lr.updateQueue,d===null?(d={lastEffect:null,stores:null},lr.updateQueue=d,d.lastEffect=c.next=c):(v=d.lastEffect,v===null?d.lastEffect=c.next=c:(x=v.next,v.next=c,c.next=x,d.lastEffect=c)),c}function Jb(){return pa().memoizedState}function W1(c,d,v,x){var N=go();lr.flags|=c,N.memoizedState=o0(1|d,v,void 0,x===void 0?null:x)}function K1(c,d,v,x){var N=pa();x=x===void 0?null:x;var $=void 0;if(Mr!==null){var W=Mr.memoizedState;if($=W.destroy,x!==null&&cg(x,W.deps)){N.memoizedState=o0(d,v,$,x);return}}lr.flags|=c,N.memoizedState=o0(1|d,v,$,x)}function e3(c,d){return W1(8390656,8,c,d)}function pg(c,d){return K1(2048,8,c,d)}function t3(c,d){return K1(4,2,c,d)}function n3(c,d){return K1(4,4,c,d)}function r3(c,d){if(typeof d=="function")return c=c(),d(c),function(){d(null)};if(d!=null)return c=c(),d.current=c,function(){d.current=null}}function s3(c,d,v){return v=v!=null?v.concat([c]):null,K1(4,4,r3.bind(null,d,c),v)}function mg(){}function a3(c,d){var v=pa();d=d===void 0?null:d;var x=v.memoizedState;return x!==null&&d!==null&&cg(d,x[1])?x[0]:(v.memoizedState=[c,d],c)}function o3(c,d){var v=pa();d=d===void 0?null:d;var x=v.memoizedState;return x!==null&&d!==null&&cg(d,x[1])?x[0]:(c=c(),v.memoizedState=[c,d],c)}function i3(c,d,v){return(Ql&21)===0?(c.baseState&&(c.baseState=!1,Ts=!0),c.memoizedState=v):(Fa(v,d)||(v=dn(),lr.lanes|=v,Jl|=v,c.baseState=!0),d)}function hT(c,d){var v=wn;wn=v!==0&&4>v?v:4,c(!0);var x=lg.transition;lg.transition={};try{c(!1),d()}finally{wn=v,lg.transition=x}}function l3(){return pa().memoizedState}function pT(c,d,v){var x=Wi(c);if(v={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null},c3(c))u3(d,v);else if(v=_b(c,d,v,x),v!==null){var N=bs();Ba(v,c,x,N),d3(v,d,x)}}function mT(c,d,v){var x=Wi(c),N={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null};if(c3(c))u3(d,N);else{var $=c.alternate;if(c.lanes===0&&($===null||$.lanes===0)&&($=d.lastRenderedReducer,$!==null))try{var W=d.lastRenderedState,he=$(W,v);if(N.hasEagerState=!0,N.eagerState=he,Fa(he,W)){var ye=d.interleaved;ye===null?(N.next=N,ng(d)):(N.next=ye.next,ye.next=N),d.interleaved=N;return}}catch{}finally{}v=_b(c,d,N,x),v!==null&&(N=bs(),Ba(v,c,x,N),d3(v,d,x))}}function c3(c){var d=c.alternate;return c===lr||d!==null&&d===lr}function u3(c,d){r0=U1=!0;var v=c.pending;v===null?d.next=d:(d.next=v.next,v.next=d),c.pending=d}function d3(c,d,v){if((v&4194240)!==0){var x=d.lanes;x&=c.pendingLanes,v|=x,d.lanes=v,Hr(c,v)}}var G1={readContext:ha,useCallback:rs,useContext:rs,useEffect:rs,useImperativeHandle:rs,useInsertionEffect:rs,useLayoutEffect:rs,useMemo:rs,useReducer:rs,useRef:rs,useState:rs,useDebugValue:rs,useDeferredValue:rs,useTransition:rs,useMutableSource:rs,useSyncExternalStore:rs,useId:rs,unstable_isNewReconciler:!1},gT={readContext:ha,useCallback:function(c,d){return go().memoizedState=[c,d===void 0?null:d],c},useContext:ha,useEffect:e3,useImperativeHandle:function(c,d,v){return v=v!=null?v.concat([c]):null,W1(4194308,4,r3.bind(null,d,c),v)},useLayoutEffect:function(c,d){return W1(4194308,4,c,d)},useInsertionEffect:function(c,d){return W1(4,2,c,d)},useMemo:function(c,d){var v=go();return d=d===void 0?null:d,c=c(),v.memoizedState=[c,d],c},useReducer:function(c,d,v){var x=go();return d=v!==void 0?v(d):d,x.memoizedState=x.baseState=d,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:d},x.queue=c,c=c.dispatch=pT.bind(null,lr,c),[x.memoizedState,c]},useRef:function(c){var d=go();return c={current:c},d.memoizedState=c},useState:Qb,useDebugValue:mg,useDeferredValue:function(c){return go().memoizedState=c},useTransition:function(){var c=Qb(!1),d=c[0];return c=hT.bind(null,c[1]),go().memoizedState=c,[d,c]},useMutableSource:function(){},useSyncExternalStore:function(c,d,v){var x=lr,N=go();if(ar){if(v===void 0)throw Error(n(407));v=v()}else{if(v=d(),Fr===null)throw Error(n(349));(Ql&30)!==0||Kb(x,d,v)}N.memoizedState=v;var $={value:v,getSnapshot:d};return N.queue=$,e3(Yb.bind(null,x,$,c),[c]),x.flags|=2048,o0(9,Gb.bind(null,x,$,v,d),void 0,null),v},useId:function(){var c=go(),d=Fr.identifierPrefix;if(ar){var v=Wo,x=Uo;v=(x&~(1<<32-we(x)-1)).toString(32)+v,d=":"+d+"R"+v,v=s0++,0<v&&(d+="H"+v.toString(32)),d+=":"}else v=fT++,d=":"+d+"r"+v.toString(32)+":";return c.memoizedState=d},unstable_isNewReconciler:!1},vT={readContext:ha,useCallback:a3,useContext:ha,useEffect:pg,useImperativeHandle:s3,useInsertionEffect:t3,useLayoutEffect:n3,useMemo:o3,useReducer:fg,useRef:Jb,useState:function(){return fg(a0)},useDebugValue:mg,useDeferredValue:function(c){var d=pa();return i3(d,Mr.memoizedState,c)},useTransition:function(){var c=fg(a0)[0],d=pa().memoizedState;return[c,d]},useMutableSource:Ub,useSyncExternalStore:Wb,useId:l3,unstable_isNewReconciler:!1},wT={readContext:ha,useCallback:a3,useContext:ha,useEffect:pg,useImperativeHandle:s3,useInsertionEffect:t3,useLayoutEffect:n3,useMemo:o3,useReducer:hg,useRef:Jb,useState:function(){return hg(a0)},useDebugValue:mg,useDeferredValue:function(c){var d=pa();return Mr===null?d.memoizedState=c:i3(d,Mr.memoizedState,c)},useTransition:function(){var c=hg(a0)[0],d=pa().memoizedState;return[c,d]},useMutableSource:Ub,useSyncExternalStore:Wb,useId:l3,unstable_isNewReconciler:!1};function Va(c,d){if(c&&c.defaultProps){d=G({},d),c=c.defaultProps;for(var v in c)d[v]===void 0&&(d[v]=c[v]);return d}return d}function gg(c,d,v,x){d=c.memoizedState,v=v(x,d),v=v==null?d:G({},d,v),c.memoizedState=v,c.lanes===0&&(c.updateQueue.baseState=v)}var Y1={isMounted:function(c){return(c=c._reactInternals)?ot(c)===c:!1},enqueueSetState:function(c,d,v){c=c._reactInternals;var x=bs(),N=Wi(c),$=Go(x,N);$.payload=d,v!=null&&($.callback=v),d=Zi(c,$,N),d!==null&&(Ba(d,c,N,x),V1(d,c,N))},enqueueReplaceState:function(c,d,v){c=c._reactInternals;var x=bs(),N=Wi(c),$=Go(x,N);$.tag=1,$.payload=d,v!=null&&($.callback=v),d=Zi(c,$,N),d!==null&&(Ba(d,c,N,x),V1(d,c,N))},enqueueForceUpdate:function(c,d){c=c._reactInternals;var v=bs(),x=Wi(c),N=Go(v,x);N.tag=2,d!=null&&(N.callback=d),d=Zi(c,N,x),d!==null&&(Ba(d,c,x,v),V1(d,c,x))}};function f3(c,d,v,x,N,$,W){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(x,$,W):d.prototype&&d.prototype.isPureReactComponent?!Wd(v,x)||!Wd(N,$):!0}function h3(c,d,v){var x=!1,N=Fi,$=d.contextType;return typeof $=="object"&&$!==null?$=ha($):(N=$s(d)?Kl:ns.current,x=d.contextTypes,$=(x=x!=null)?hu(c,N):Fi),d=new d(v,$),c.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Y1,c.stateNode=d,d._reactInternals=c,x&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=N,c.__reactInternalMemoizedMaskedChildContext=$),d}function p3(c,d,v,x){c=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(v,x),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(v,x),d.state!==c&&Y1.enqueueReplaceState(d,d.state,null)}function vg(c,d,v,x){var N=c.stateNode;N.props=v,N.state=c.memoizedState,N.refs={},rg(c);var $=d.contextType;typeof $=="object"&&$!==null?N.context=ha($):($=$s(d)?Kl:ns.current,N.context=hu(c,$)),N.state=c.memoizedState,$=d.getDerivedStateFromProps,typeof $=="function"&&(gg(c,d,$,v),N.state=c.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(d=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),d!==N.state&&Y1.enqueueReplaceState(N,N.state,null),Z1(c,v,N,x),N.state=c.memoizedState),typeof N.componentDidMount=="function"&&(c.flags|=4194308)}function xu(c,d){try{var v="",x=d;do v+=pe(x),x=x.return;while(x);var N=v}catch($){N=`
39
+ Error generating stack: `+$.message+`
40
+ `+$.stack}return{value:c,source:d,stack:N,digest:null}}function wg(c,d,v){return{value:c,source:null,stack:v??null,digest:d??null}}function yg(c,d){try{console.error(d.value)}catch(v){setTimeout(function(){throw v})}}var yT=typeof WeakMap=="function"?WeakMap:Map;function m3(c,d,v){v=Go(-1,v),v.tag=3,v.payload={element:null};var x=d.value;return v.callback=function(){nh||(nh=!0,Tg=x),yg(c,d)},v}function g3(c,d,v){v=Go(-1,v),v.tag=3;var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var N=d.value;v.payload=function(){return x(N)},v.callback=function(){yg(c,d)}}var $=c.stateNode;return $!==null&&typeof $.componentDidCatch=="function"&&(v.callback=function(){yg(c,d),typeof x!="function"&&(Bi===null?Bi=new Set([this]):Bi.add(this));var W=d.stack;this.componentDidCatch(d.value,{componentStack:W!==null?W:""})}),v}function v3(c,d,v){var x=c.pingCache;if(x===null){x=c.pingCache=new yT;var N=new Set;x.set(d,N)}else N=x.get(d),N===void 0&&(N=new Set,x.set(d,N));N.has(v)||(N.add(v),c=$T.bind(null,c,d,v),d.then(c,c))}function w3(c){do{var d;if((d=c.tag===13)&&(d=c.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return c;c=c.return}while(c!==null);return null}function y3(c,d,v,x,N){return(c.mode&1)===0?(c===d?c.flags|=65536:(c.flags|=128,v.flags|=131072,v.flags&=-52805,v.tag===1&&(v.alternate===null?v.tag=17:(d=Go(-1,1),d.tag=2,Zi(v,d,1))),v.lanes|=1),c):(c.flags|=65536,c.lanes=N,c)}var bT=A.ReactCurrentOwner,Ts=!1;function ys(c,d,v,x){d.child=c===null?Fb(d,null,v,x):vu(d,c.child,v,x)}function b3(c,d,v,x,N){v=v.render;var $=d.ref;return yu(d,N),x=ug(c,d,v,x,$,N),v=dg(),c!==null&&!Ts?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~N,Yo(c,d,N)):(ar&&v&&K2(d),d.flags|=1,ys(c,d,x,N),d.child)}function x3(c,d,v,x,N){if(c===null){var $=v.type;return typeof $=="function"&&!Vg($)&&$.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(d.tag=15,d.type=$,k3(c,d,$,x,N)):(c=lh(v.type,null,x,d,d.mode,N),c.ref=d.ref,c.return=d,d.child=c)}if($=c.child,(c.lanes&N)===0){var W=$.memoizedProps;if(v=v.compare,v=v!==null?v:Wd,v(W,x)&&c.ref===d.ref)return Yo(c,d,N)}return d.flags|=1,c=Gi($,x),c.ref=d.ref,c.return=d,d.child=c}function k3(c,d,v,x,N){if(c!==null){var $=c.memoizedProps;if(Wd($,x)&&c.ref===d.ref)if(Ts=!1,d.pendingProps=x=$,(c.lanes&N)!==0)(c.flags&131072)!==0&&(Ts=!0);else return d.lanes=c.lanes,Yo(c,d,N)}return bg(c,d,v,x,N)}function S3(c,d,v){var x=d.pendingProps,N=x.children,$=c!==null?c.memoizedState:null;if(x.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gn(Su,Qs),Qs|=v;else{if((v&1073741824)===0)return c=$!==null?$.baseLanes|v:v,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:c,cachePool:null,transitions:null},d.updateQueue=null,Gn(Su,Qs),Qs|=c,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=$!==null?$.baseLanes:v,Gn(Su,Qs),Qs|=x}else $!==null?(x=$.baseLanes|v,d.memoizedState=null):x=v,Gn(Su,Qs),Qs|=x;return ys(c,d,N,v),d.child}function E3(c,d){var v=d.ref;(c===null&&v!==null||c!==null&&c.ref!==v)&&(d.flags|=512,d.flags|=2097152)}function bg(c,d,v,x,N){var $=$s(v)?Kl:ns.current;return $=hu(d,$),yu(d,N),v=ug(c,d,v,x,$,N),x=dg(),c!==null&&!Ts?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~N,Yo(c,d,N)):(ar&&x&&K2(d),d.flags|=1,ys(c,d,v,N),d.child)}function C3(c,d,v,x,N){if($s(v)){var $=!0;$1(d)}else $=!1;if(yu(d,N),d.stateNode===null)X1(c,d),h3(d,v,x),vg(d,v,x,N),x=!0;else if(c===null){var W=d.stateNode,he=d.memoizedProps;W.props=he;var ye=W.context,Be=v.contextType;typeof Be=="object"&&Be!==null?Be=ha(Be):(Be=$s(v)?Kl:ns.current,Be=hu(d,Be));var dt=v.getDerivedStateFromProps,vt=typeof dt=="function"||typeof W.getSnapshotBeforeUpdate=="function";vt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(he!==x||ye!==Be)&&p3(d,W,x,Be),Vi=!1;var ut=d.memoizedState;W.state=ut,Z1(d,x,W,N),ye=d.memoizedState,he!==x||ut!==ye||Ls.current||Vi?(typeof dt=="function"&&(gg(d,v,dt,x),ye=d.memoizedState),(he=Vi||f3(d,v,he,x,ut,ye,Be))?(vt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(d.flags|=4194308)):(typeof W.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=x,d.memoizedState=ye),W.props=x,W.state=ye,W.context=Be,x=he):(typeof W.componentDidMount=="function"&&(d.flags|=4194308),x=!1)}else{W=d.stateNode,Vb(c,d),he=d.memoizedProps,Be=d.type===d.elementType?he:Va(d.type,he),W.props=Be,vt=d.pendingProps,ut=W.context,ye=v.contextType,typeof ye=="object"&&ye!==null?ye=ha(ye):(ye=$s(v)?Kl:ns.current,ye=hu(d,ye));var $t=v.getDerivedStateFromProps;(dt=typeof $t=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(he!==vt||ut!==ye)&&p3(d,W,x,ye),Vi=!1,ut=d.memoizedState,W.state=ut,Z1(d,x,W,N);var Ht=d.memoizedState;he!==vt||ut!==Ht||Ls.current||Vi?(typeof $t=="function"&&(gg(d,v,$t,x),Ht=d.memoizedState),(Be=Vi||f3(d,v,Be,x,ut,Ht,ye)||!1)?(dt||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(x,Ht,ye),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(x,Ht,ye)),typeof W.componentDidUpdate=="function"&&(d.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof W.componentDidUpdate!="function"||he===c.memoizedProps&&ut===c.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||he===c.memoizedProps&&ut===c.memoizedState||(d.flags|=1024),d.memoizedProps=x,d.memoizedState=Ht),W.props=x,W.state=Ht,W.context=ye,x=Be):(typeof W.componentDidUpdate!="function"||he===c.memoizedProps&&ut===c.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||he===c.memoizedProps&&ut===c.memoizedState||(d.flags|=1024),x=!1)}return xg(c,d,v,x,$,N)}function xg(c,d,v,x,N,$){E3(c,d);var W=(d.flags&128)!==0;if(!x&&!W)return N&&Rb(d,v,!1),Yo(c,d,$);x=d.stateNode,bT.current=d;var he=W&&typeof v.getDerivedStateFromError!="function"?null:x.render();return d.flags|=1,c!==null&&W?(d.child=vu(d,c.child,null,$),d.child=vu(d,null,he,$)):ys(c,d,he,$),d.memoizedState=x.state,N&&Rb(d,v,!0),d.child}function j3(c){var d=c.stateNode;d.pendingContext?Nb(c,d.pendingContext,d.pendingContext!==d.context):d.context&&Nb(c,d.context,!1),sg(c,d.containerInfo)}function A3(c,d,v,x,N){return gu(),X2(N),d.flags|=256,ys(c,d,v,x),d.child}var kg={dehydrated:null,treeContext:null,retryLane:0};function Sg(c){return{baseLanes:c,cachePool:null,transitions:null}}function N3(c,d,v){var x=d.pendingProps,N=ir.current,$=!1,W=(d.flags&128)!==0,he;if((he=W)||(he=c!==null&&c.memoizedState===null?!1:(N&2)!==0),he?($=!0,d.flags&=-129):(c===null||c.memoizedState!==null)&&(N|=1),Gn(ir,N&1),c===null)return q2(d),c=d.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?((d.mode&1)===0?d.lanes=1:c.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(W=x.children,c=x.fallback,$?(x=d.mode,$=d.child,W={mode:"hidden",children:W},(x&1)===0&&$!==null?($.childLanes=0,$.pendingProps=W):$=ch(W,x,0,null),c=rc(c,x,v,null),$.return=d,c.return=d,$.sibling=c,d.child=$,d.child.memoizedState=Sg(v),d.memoizedState=kg,c):Eg(d,W));if(N=c.memoizedState,N!==null&&(he=N.dehydrated,he!==null))return xT(c,d,W,x,he,N,v);if($){$=x.fallback,W=d.mode,N=c.child,he=N.sibling;var ye={mode:"hidden",children:x.children};return(W&1)===0&&d.child!==N?(x=d.child,x.childLanes=0,x.pendingProps=ye,d.deletions=null):(x=Gi(N,ye),x.subtreeFlags=N.subtreeFlags&14680064),he!==null?$=Gi(he,$):($=rc($,W,v,null),$.flags|=2),$.return=d,x.return=d,x.sibling=$,d.child=x,x=$,$=d.child,W=c.child.memoizedState,W=W===null?Sg(v):{baseLanes:W.baseLanes|v,cachePool:null,transitions:W.transitions},$.memoizedState=W,$.childLanes=c.childLanes&~v,d.memoizedState=kg,x}return $=c.child,c=$.sibling,x=Gi($,{mode:"visible",children:x.children}),(d.mode&1)===0&&(x.lanes=v),x.return=d,x.sibling=null,c!==null&&(v=d.deletions,v===null?(d.deletions=[c],d.flags|=16):v.push(c)),d.child=x,d.memoizedState=null,x}function Eg(c,d){return d=ch({mode:"visible",children:d},c.mode,0,null),d.return=c,c.child=d}function q1(c,d,v,x){return x!==null&&X2(x),vu(d,c.child,null,v),c=Eg(d,d.pendingProps.children),c.flags|=2,d.memoizedState=null,c}function xT(c,d,v,x,N,$,W){if(v)return d.flags&256?(d.flags&=-257,x=wg(Error(n(422))),q1(c,d,W,x)):d.memoizedState!==null?(d.child=c.child,d.flags|=128,null):($=x.fallback,N=d.mode,x=ch({mode:"visible",children:x.children},N,0,null),$=rc($,N,W,null),$.flags|=2,x.return=d,$.return=d,x.sibling=$,d.child=x,(d.mode&1)!==0&&vu(d,c.child,null,W),d.child.memoizedState=Sg(W),d.memoizedState=kg,$);if((d.mode&1)===0)return q1(c,d,W,null);if(N.data==="$!"){if(x=N.nextSibling&&N.nextSibling.dataset,x)var he=x.dgst;return x=he,$=Error(n(419)),x=wg($,x,void 0),q1(c,d,W,x)}if(he=(W&c.childLanes)!==0,Ts||he){if(x=Fr,x!==null){switch(W&-W){case 4:N=2;break;case 16:N=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:N=32;break;case 536870912:N=268435456;break;default:N=0}N=(N&(x.suspendedLanes|W))!==0?0:N,N!==0&&N!==$.retryLane&&($.retryLane=N,Ko(c,N),Ba(x,c,N,-1))}return _g(),x=wg(Error(n(421))),q1(c,d,W,x)}return N.data==="$?"?(d.flags|=128,d.child=c.child,d=TT.bind(null,c),N._reactRetry=d,null):(c=$.treeContext,Xs=Oi(N.nextSibling),qs=d,ar=!0,_a=null,c!==null&&(da[fa++]=Uo,da[fa++]=Wo,da[fa++]=Gl,Uo=c.id,Wo=c.overflow,Gl=d),d=Eg(d,x.children),d.flags|=4096,d)}function M3(c,d,v){c.lanes|=d;var x=c.alternate;x!==null&&(x.lanes|=d),tg(c.return,d,v)}function Cg(c,d,v,x,N){var $=c.memoizedState;$===null?c.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:x,tail:v,tailMode:N}:($.isBackwards=d,$.rendering=null,$.renderingStartTime=0,$.last=x,$.tail=v,$.tailMode=N)}function R3(c,d,v){var x=d.pendingProps,N=x.revealOrder,$=x.tail;if(ys(c,d,x.children,v),x=ir.current,(x&2)!==0)x=x&1|2,d.flags|=128;else{if(c!==null&&(c.flags&128)!==0)e:for(c=d.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&M3(c,v,d);else if(c.tag===19)M3(c,v,d);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===d)break e;for(;c.sibling===null;){if(c.return===null||c.return===d)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}x&=1}if(Gn(ir,x),(d.mode&1)===0)d.memoizedState=null;else switch(N){case"forwards":for(v=d.child,N=null;v!==null;)c=v.alternate,c!==null&&z1(c)===null&&(N=v),v=v.sibling;v=N,v===null?(N=d.child,d.child=null):(N=v.sibling,v.sibling=null),Cg(d,!1,N,v,$);break;case"backwards":for(v=null,N=d.child,d.child=null;N!==null;){if(c=N.alternate,c!==null&&z1(c)===null){d.child=N;break}c=N.sibling,N.sibling=v,v=N,N=c}Cg(d,!0,v,null,$);break;case"together":Cg(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function X1(c,d){(d.mode&1)===0&&c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2)}function Yo(c,d,v){if(c!==null&&(d.dependencies=c.dependencies),Jl|=d.lanes,(v&d.childLanes)===0)return null;if(c!==null&&d.child!==c.child)throw Error(n(153));if(d.child!==null){for(c=d.child,v=Gi(c,c.pendingProps),d.child=v,v.return=d;c.sibling!==null;)c=c.sibling,v=v.sibling=Gi(c,c.pendingProps),v.return=d;v.sibling=null}return d.child}function kT(c,d,v){switch(d.tag){case 3:j3(d),gu();break;case 5:Bb(d);break;case 1:$s(d.type)&&$1(d);break;case 4:sg(d,d.stateNode.containerInfo);break;case 10:var x=d.type._context,N=d.memoizedProps.value;Gn(F1,x._currentValue),x._currentValue=N;break;case 13:if(x=d.memoizedState,x!==null)return x.dehydrated!==null?(Gn(ir,ir.current&1),d.flags|=128,null):(v&d.child.childLanes)!==0?N3(c,d,v):(Gn(ir,ir.current&1),c=Yo(c,d,v),c!==null?c.sibling:null);Gn(ir,ir.current&1);break;case 19:if(x=(v&d.childLanes)!==0,(c.flags&128)!==0){if(x)return R3(c,d,v);d.flags|=128}if(N=d.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),Gn(ir,ir.current),x)break;return null;case 22:case 23:return d.lanes=0,S3(c,d,v)}return Yo(c,d,v)}var P3,jg,L3,$3;P3=function(c,d){for(var v=d.child;v!==null;){if(v.tag===5||v.tag===6)c.appendChild(v.stateNode);else if(v.tag!==4&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===d)break;for(;v.sibling===null;){if(v.return===null||v.return===d)return;v=v.return}v.sibling.return=v.return,v=v.sibling}},jg=function(){},L3=function(c,d,v,x){var N=c.memoizedProps;if(N!==x){c=d.stateNode,Xl(mo.current);var $=null;switch(v){case"input":N=Se(c,N),x=Se(c,x),$=[];break;case"select":N=G({},N,{value:void 0}),x=G({},x,{value:void 0}),$=[];break;case"textarea":N=We(c,N),x=We(c,x),$=[];break;default:typeof N.onClick!="function"&&typeof x.onClick=="function"&&(c.onclick=R1)}Zt(v,x);var W;v=null;for(Be in N)if(!x.hasOwnProperty(Be)&&N.hasOwnProperty(Be)&&N[Be]!=null)if(Be==="style"){var he=N[Be];for(W in he)he.hasOwnProperty(W)&&(v||(v={}),v[W]="")}else Be!=="dangerouslySetInnerHTML"&&Be!=="children"&&Be!=="suppressContentEditableWarning"&&Be!=="suppressHydrationWarning"&&Be!=="autoFocus"&&(a.hasOwnProperty(Be)?$||($=[]):($=$||[]).push(Be,null));for(Be in x){var ye=x[Be];if(he=N!=null?N[Be]:void 0,x.hasOwnProperty(Be)&&ye!==he&&(ye!=null||he!=null))if(Be==="style")if(he){for(W in he)!he.hasOwnProperty(W)||ye&&ye.hasOwnProperty(W)||(v||(v={}),v[W]="");for(W in ye)ye.hasOwnProperty(W)&&he[W]!==ye[W]&&(v||(v={}),v[W]=ye[W])}else v||($||($=[]),$.push(Be,v)),v=ye;else Be==="dangerouslySetInnerHTML"?(ye=ye?ye.__html:void 0,he=he?he.__html:void 0,ye!=null&&he!==ye&&($=$||[]).push(Be,ye)):Be==="children"?typeof ye!="string"&&typeof ye!="number"||($=$||[]).push(Be,""+ye):Be!=="suppressContentEditableWarning"&&Be!=="suppressHydrationWarning"&&(a.hasOwnProperty(Be)?(ye!=null&&Be==="onScroll"&&er("scroll",c),$||he===ye||($=[])):($=$||[]).push(Be,ye))}v&&($=$||[]).push("style",v);var Be=$;(d.updateQueue=Be)&&(d.flags|=4)}},$3=function(c,d,v,x){v!==x&&(d.flags|=4)};function i0(c,d){if(!ar)switch(c.tailMode){case"hidden":d=c.tail;for(var v=null;d!==null;)d.alternate!==null&&(v=d),d=d.sibling;v===null?c.tail=null:v.sibling=null;break;case"collapsed":v=c.tail;for(var x=null;v!==null;)v.alternate!==null&&(x=v),v=v.sibling;x===null?d||c.tail===null?c.tail=null:c.tail.sibling=null:x.sibling=null}}function ss(c){var d=c.alternate!==null&&c.alternate.child===c.child,v=0,x=0;if(d)for(var N=c.child;N!==null;)v|=N.lanes|N.childLanes,x|=N.subtreeFlags&14680064,x|=N.flags&14680064,N.return=c,N=N.sibling;else for(N=c.child;N!==null;)v|=N.lanes|N.childLanes,x|=N.subtreeFlags,x|=N.flags,N.return=c,N=N.sibling;return c.subtreeFlags|=x,c.childLanes=v,d}function ST(c,d,v){var x=d.pendingProps;switch(G2(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ss(d),null;case 1:return $s(d.type)&&L1(),ss(d),null;case 3:return x=d.stateNode,bu(),tr(Ls),tr(ns),ig(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(c===null||c.child===null)&&(O1(d)?d.flags|=4:c===null||c.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,_a!==null&&(Og(_a),_a=null))),jg(c,d),ss(d),null;case 5:ag(d);var N=Xl(n0.current);if(v=d.type,c!==null&&d.stateNode!=null)L3(c,d,v,x,N),c.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!x){if(d.stateNode===null)throw Error(n(166));return ss(d),null}if(c=Xl(mo.current),O1(d)){x=d.stateNode,v=d.type;var $=d.memoizedProps;switch(x[po]=d,x[Xd]=$,c=(d.mode&1)!==0,v){case"dialog":er("cancel",x),er("close",x);break;case"iframe":case"object":case"embed":er("load",x);break;case"video":case"audio":for(N=0;N<Gd.length;N++)er(Gd[N],x);break;case"source":er("error",x);break;case"img":case"image":case"link":er("error",x),er("load",x);break;case"details":er("toggle",x);break;case"input":Ze(x,$),er("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!$.multiple},er("invalid",x);break;case"textarea":Ne(x,$),er("invalid",x)}Zt(v,$),N=null;for(var W in $)if($.hasOwnProperty(W)){var he=$[W];W==="children"?typeof he=="string"?x.textContent!==he&&($.suppressHydrationWarning!==!0&&M1(x.textContent,he,c),N=["children",he]):typeof he=="number"&&x.textContent!==""+he&&($.suppressHydrationWarning!==!0&&M1(x.textContent,he,c),N=["children",""+he]):a.hasOwnProperty(W)&&he!=null&&W==="onScroll"&&er("scroll",x)}switch(v){case"input":ae(x),nt(x,$,!0);break;case"textarea":ae(x),q(x);break;case"select":case"option":break;default:typeof $.onClick=="function"&&(x.onclick=R1)}x=N,d.updateQueue=x,x!==null&&(d.flags|=4)}else{W=N.nodeType===9?N:N.ownerDocument,c==="http://www.w3.org/1999/xhtml"&&(c=oe(v)),c==="http://www.w3.org/1999/xhtml"?v==="script"?(c=W.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild)):typeof x.is=="string"?c=W.createElement(v,{is:x.is}):(c=W.createElement(v),v==="select"&&(W=c,x.multiple?W.multiple=!0:x.size&&(W.size=x.size))):c=W.createElementNS(c,v),c[po]=d,c[Xd]=x,P3(c,d,!1,!1),d.stateNode=c;e:{switch(W=jt(v,x),v){case"dialog":er("cancel",c),er("close",c),N=x;break;case"iframe":case"object":case"embed":er("load",c),N=x;break;case"video":case"audio":for(N=0;N<Gd.length;N++)er(Gd[N],c);N=x;break;case"source":er("error",c),N=x;break;case"img":case"image":case"link":er("error",c),er("load",c),N=x;break;case"details":er("toggle",c),N=x;break;case"input":Ze(c,x),N=Se(c,x),er("invalid",c);break;case"option":N=x;break;case"select":c._wrapperState={wasMultiple:!!x.multiple},N=G({},x,{value:void 0}),er("invalid",c);break;case"textarea":Ne(c,x),N=We(c,x),er("invalid",c);break;default:N=x}Zt(v,N),he=N;for($ in he)if(he.hasOwnProperty($)){var ye=he[$];$==="style"?bt(c,ye):$==="dangerouslySetInnerHTML"?(ye=ye?ye.__html:void 0,ye!=null&&Ye(c,ye)):$==="children"?typeof ye=="string"?(v!=="textarea"||ye!=="")&&Ie(c,ye):typeof ye=="number"&&Ie(c,""+ye):$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&$!=="autoFocus"&&(a.hasOwnProperty($)?ye!=null&&$==="onScroll"&&er("scroll",c):ye!=null&&C(c,$,ye,W))}switch(v){case"input":ae(c),nt(c,x,!1);break;case"textarea":ae(c),q(c);break;case"option":x.value!=null&&c.setAttribute("value",""+J(x.value));break;case"select":c.multiple=!!x.multiple,$=x.value,$!=null?Q(c,!!x.multiple,$,!1):x.defaultValue!=null&&Q(c,!!x.multiple,x.defaultValue,!0);break;default:typeof N.onClick=="function"&&(c.onclick=R1)}switch(v){case"button":case"input":case"select":case"textarea":x=!!x.autoFocus;break e;case"img":x=!0;break e;default:x=!1}}x&&(d.flags|=4)}d.ref!==null&&(d.flags|=512,d.flags|=2097152)}return ss(d),null;case 6:if(c&&d.stateNode!=null)$3(c,d,c.memoizedProps,x);else{if(typeof x!="string"&&d.stateNode===null)throw Error(n(166));if(v=Xl(n0.current),Xl(mo.current),O1(d)){if(x=d.stateNode,v=d.memoizedProps,x[po]=d,($=x.nodeValue!==v)&&(c=qs,c!==null))switch(c.tag){case 3:M1(x.nodeValue,v,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&M1(x.nodeValue,v,(c.mode&1)!==0)}$&&(d.flags|=4)}else x=(v.nodeType===9?v:v.ownerDocument).createTextNode(x),x[po]=d,d.stateNode=x}return ss(d),null;case 13:if(tr(ir),x=d.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(ar&&Xs!==null&&(d.mode&1)!==0&&(d.flags&128)===0)Hb(),gu(),d.flags|=98560,$=!1;else if($=O1(d),x!==null&&x.dehydrated!==null){if(c===null){if(!$)throw Error(n(318));if($=d.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(n(317));$[po]=d}else gu(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;ss(d),$=!1}else _a!==null&&(Og(_a),_a=null),$=!0;if(!$)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=v,d):(x=x!==null,x!==(c!==null&&c.memoizedState!==null)&&x&&(d.child.flags|=8192,(d.mode&1)!==0&&(c===null||(ir.current&1)!==0?Rr===0&&(Rr=3):_g())),d.updateQueue!==null&&(d.flags|=4),ss(d),null);case 4:return bu(),jg(c,d),c===null&&Yd(d.stateNode.containerInfo),ss(d),null;case 10:return eg(d.type._context),ss(d),null;case 17:return $s(d.type)&&L1(),ss(d),null;case 19:if(tr(ir),$=d.memoizedState,$===null)return ss(d),null;if(x=(d.flags&128)!==0,W=$.rendering,W===null)if(x)i0($,!1);else{if(Rr!==0||c!==null&&(c.flags&128)!==0)for(c=d.child;c!==null;){if(W=z1(c),W!==null){for(d.flags|=128,i0($,!1),x=W.updateQueue,x!==null&&(d.updateQueue=x,d.flags|=4),d.subtreeFlags=0,x=v,v=d.child;v!==null;)$=v,c=x,$.flags&=14680066,W=$.alternate,W===null?($.childLanes=0,$.lanes=c,$.child=null,$.subtreeFlags=0,$.memoizedProps=null,$.memoizedState=null,$.updateQueue=null,$.dependencies=null,$.stateNode=null):($.childLanes=W.childLanes,$.lanes=W.lanes,$.child=W.child,$.subtreeFlags=0,$.deletions=null,$.memoizedProps=W.memoizedProps,$.memoizedState=W.memoizedState,$.updateQueue=W.updateQueue,$.type=W.type,c=W.dependencies,$.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),v=v.sibling;return Gn(ir,ir.current&1|2),d.child}c=c.sibling}$.tail!==null&&Xe()>Eu&&(d.flags|=128,x=!0,i0($,!1),d.lanes=4194304)}else{if(!x)if(c=z1(W),c!==null){if(d.flags|=128,x=!0,v=c.updateQueue,v!==null&&(d.updateQueue=v,d.flags|=4),i0($,!0),$.tail===null&&$.tailMode==="hidden"&&!W.alternate&&!ar)return ss(d),null}else 2*Xe()-$.renderingStartTime>Eu&&v!==1073741824&&(d.flags|=128,x=!0,i0($,!1),d.lanes=4194304);$.isBackwards?(W.sibling=d.child,d.child=W):(v=$.last,v!==null?v.sibling=W:d.child=W,$.last=W)}return $.tail!==null?(d=$.tail,$.rendering=d,$.tail=d.sibling,$.renderingStartTime=Xe(),d.sibling=null,v=ir.current,Gn(ir,x?v&1|2:v&1),d):(ss(d),null);case 22:case 23:return Fg(),x=d.memoizedState!==null,c!==null&&c.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Qs&1073741824)!==0&&(ss(d),d.subtreeFlags&6&&(d.flags|=8192)):ss(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function ET(c,d){switch(G2(d),d.tag){case 1:return $s(d.type)&&L1(),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return bu(),tr(Ls),tr(ns),ig(),c=d.flags,(c&65536)!==0&&(c&128)===0?(d.flags=c&-65537|128,d):null;case 5:return ag(d),null;case 13:if(tr(ir),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(n(340));gu()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return tr(ir),null;case 4:return bu(),null;case 10:return eg(d.type._context),null;case 22:case 23:return Fg(),null;case 24:return null;default:return null}}var Q1=!1,as=!1,CT=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function ku(c,d){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(x){hr(c,d,x)}else v.current=null}function Ag(c,d,v){try{v()}catch(x){hr(c,d,x)}}var T3=!1;function jT(c,d){if(F2=Pn,c=fb(),P2(c)){if("selectionStart"in c)var v={start:c.selectionStart,end:c.selectionEnd};else e:{v=(v=c.ownerDocument)&&v.defaultView||window;var x=v.getSelection&&v.getSelection();if(x&&x.rangeCount!==0){v=x.anchorNode;var N=x.anchorOffset,$=x.focusNode;x=x.focusOffset;try{v.nodeType,$.nodeType}catch{v=null;break e}var W=0,he=-1,ye=-1,Be=0,dt=0,vt=c,ut=null;t:for(;;){for(var $t;vt!==v||N!==0&&vt.nodeType!==3||(he=W+N),vt!==$||x!==0&&vt.nodeType!==3||(ye=W+x),vt.nodeType===3&&(W+=vt.nodeValue.length),($t=vt.firstChild)!==null;)ut=vt,vt=$t;for(;;){if(vt===c)break t;if(ut===v&&++Be===N&&(he=W),ut===$&&++dt===x&&(ye=W),($t=vt.nextSibling)!==null)break;vt=ut,ut=vt.parentNode}vt=$t}v=he===-1||ye===-1?null:{start:he,end:ye}}else v=null}v=v||{start:0,end:0}}else v=null;for(_2={focusedElem:c,selectionRange:v},Pn=!1,Dt=d;Dt!==null;)if(d=Dt,c=d.child,(d.subtreeFlags&1028)!==0&&c!==null)c.return=d,Dt=c;else for(;Dt!==null;){d=Dt;try{var Ht=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Ht!==null){var It=Ht.memoizedProps,vr=Ht.memoizedState,Te=d.stateNode,Ce=Te.getSnapshotBeforeUpdate(d.elementType===d.type?It:Va(d.type,It),vr);Te.__reactInternalSnapshotBeforeUpdate=Ce}break;case 3:var Oe=d.stateNode.containerInfo;Oe.nodeType===1?Oe.textContent="":Oe.nodeType===9&&Oe.documentElement&&Oe.removeChild(Oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(St){hr(d,d.return,St)}if(c=d.sibling,c!==null){c.return=d.return,Dt=c;break}Dt=d.return}return Ht=T3,T3=!1,Ht}function l0(c,d,v){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var N=x=x.next;do{if((N.tag&c)===c){var $=N.destroy;N.destroy=void 0,$!==void 0&&Ag(d,v,$)}N=N.next}while(N!==x)}}function J1(c,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var v=d=d.next;do{if((v.tag&c)===c){var x=v.create;v.destroy=x()}v=v.next}while(v!==d)}}function Ng(c){var d=c.ref;if(d!==null){var v=c.stateNode;switch(c.tag){case 5:c=v;break;default:c=v}typeof d=="function"?d(c):d.current=c}}function D3(c){var d=c.alternate;d!==null&&(c.alternate=null,D3(d)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(d=c.stateNode,d!==null&&(delete d[po],delete d[Xd],delete d[B2],delete d[lT],delete d[cT])),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function H3(c){return c.tag===5||c.tag===3||c.tag===4}function O3(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||H3(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function Mg(c,d,v){var x=c.tag;if(x===5||x===6)c=c.stateNode,d?v.nodeType===8?v.parentNode.insertBefore(c,d):v.insertBefore(c,d):(v.nodeType===8?(d=v.parentNode,d.insertBefore(c,v)):(d=v,d.appendChild(c)),v=v._reactRootContainer,v!=null||d.onclick!==null||(d.onclick=R1));else if(x!==4&&(c=c.child,c!==null))for(Mg(c,d,v),c=c.sibling;c!==null;)Mg(c,d,v),c=c.sibling}function Rg(c,d,v){var x=c.tag;if(x===5||x===6)c=c.stateNode,d?v.insertBefore(c,d):v.appendChild(c);else if(x!==4&&(c=c.child,c!==null))for(Rg(c,d,v),c=c.sibling;c!==null;)Rg(c,d,v),c=c.sibling}var Kr=null,Za=!1;function zi(c,d,v){for(v=v.child;v!==null;)I3(c,d,v),v=v.sibling}function I3(c,d,v){if(_&&typeof _.onCommitFiberUnmount=="function")try{_.onCommitFiberUnmount(Je,v)}catch{}switch(v.tag){case 5:as||ku(v,d);case 6:var x=Kr,N=Za;Kr=null,zi(c,d,v),Kr=x,Za=N,Kr!==null&&(Za?(c=Kr,v=v.stateNode,c.nodeType===8?c.parentNode.removeChild(v):c.removeChild(v)):Kr.removeChild(v.stateNode));break;case 18:Kr!==null&&(Za?(c=Kr,v=v.stateNode,c.nodeType===8?z2(c.parentNode,v):c.nodeType===1&&z2(c,v),Zn(c)):z2(Kr,v.stateNode));break;case 4:x=Kr,N=Za,Kr=v.stateNode.containerInfo,Za=!0,zi(c,d,v),Kr=x,Za=N;break;case 0:case 11:case 14:case 15:if(!as&&(x=v.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){N=x=x.next;do{var $=N,W=$.destroy;$=$.tag,W!==void 0&&(($&2)!==0||($&4)!==0)&&Ag(v,d,W),N=N.next}while(N!==x)}zi(c,d,v);break;case 1:if(!as&&(ku(v,d),x=v.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=v.memoizedProps,x.state=v.memoizedState,x.componentWillUnmount()}catch(he){hr(v,d,he)}zi(c,d,v);break;case 21:zi(c,d,v);break;case 22:v.mode&1?(as=(x=as)||v.memoizedState!==null,zi(c,d,v),as=x):zi(c,d,v);break;default:zi(c,d,v)}}function F3(c){var d=c.updateQueue;if(d!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new CT),d.forEach(function(x){var N=DT.bind(null,c,x);v.has(x)||(v.add(x),x.then(N,N))})}}function za(c,d){var v=d.deletions;if(v!==null)for(var x=0;x<v.length;x++){var N=v[x];try{var $=c,W=d,he=W;e:for(;he!==null;){switch(he.tag){case 5:Kr=he.stateNode,Za=!1;break e;case 3:Kr=he.stateNode.containerInfo,Za=!0;break e;case 4:Kr=he.stateNode.containerInfo,Za=!0;break e}he=he.return}if(Kr===null)throw Error(n(160));I3($,W,N),Kr=null,Za=!1;var ye=N.alternate;ye!==null&&(ye.return=null),N.return=null}catch(Be){hr(N,d,Be)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)_3(d,c),d=d.sibling}function _3(c,d){var v=c.alternate,x=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(za(d,c),vo(c),x&4){try{l0(3,c,c.return),J1(3,c)}catch(It){hr(c,c.return,It)}try{l0(5,c,c.return)}catch(It){hr(c,c.return,It)}}break;case 1:za(d,c),vo(c),x&512&&v!==null&&ku(v,v.return);break;case 5:if(za(d,c),vo(c),x&512&&v!==null&&ku(v,v.return),c.flags&32){var N=c.stateNode;try{Ie(N,"")}catch(It){hr(c,c.return,It)}}if(x&4&&(N=c.stateNode,N!=null)){var $=c.memoizedProps,W=v!==null?v.memoizedProps:$,he=c.type,ye=c.updateQueue;if(c.updateQueue=null,ye!==null)try{he==="input"&&$.type==="radio"&&$.name!=null&&gt(N,$),jt(he,W);var Be=jt(he,$);for(W=0;W<ye.length;W+=2){var dt=ye[W],vt=ye[W+1];dt==="style"?bt(N,vt):dt==="dangerouslySetInnerHTML"?Ye(N,vt):dt==="children"?Ie(N,vt):C(N,dt,vt,Be)}switch(he){case"input":Ke(N,$);break;case"textarea":ie(N,$);break;case"select":var ut=N._wrapperState.wasMultiple;N._wrapperState.wasMultiple=!!$.multiple;var $t=$.value;$t!=null?Q(N,!!$.multiple,$t,!1):ut!==!!$.multiple&&($.defaultValue!=null?Q(N,!!$.multiple,$.defaultValue,!0):Q(N,!!$.multiple,$.multiple?[]:"",!1))}N[Xd]=$}catch(It){hr(c,c.return,It)}}break;case 6:if(za(d,c),vo(c),x&4){if(c.stateNode===null)throw Error(n(162));N=c.stateNode,$=c.memoizedProps;try{N.nodeValue=$}catch(It){hr(c,c.return,It)}}break;case 3:if(za(d,c),vo(c),x&4&&v!==null&&v.memoizedState.isDehydrated)try{Zn(d.containerInfo)}catch(It){hr(c,c.return,It)}break;case 4:za(d,c),vo(c);break;case 13:za(d,c),vo(c),N=c.child,N.flags&8192&&($=N.memoizedState!==null,N.stateNode.isHidden=$,!$||N.alternate!==null&&N.alternate.memoizedState!==null||($g=Xe())),x&4&&F3(c);break;case 22:if(dt=v!==null&&v.memoizedState!==null,c.mode&1?(as=(Be=as)||dt,za(d,c),as=Be):za(d,c),vo(c),x&8192){if(Be=c.memoizedState!==null,(c.stateNode.isHidden=Be)&&!dt&&(c.mode&1)!==0)for(Dt=c,dt=c.child;dt!==null;){for(vt=Dt=dt;Dt!==null;){switch(ut=Dt,$t=ut.child,ut.tag){case 0:case 11:case 14:case 15:l0(4,ut,ut.return);break;case 1:ku(ut,ut.return);var Ht=ut.stateNode;if(typeof Ht.componentWillUnmount=="function"){x=ut,v=ut.return;try{d=x,Ht.props=d.memoizedProps,Ht.state=d.memoizedState,Ht.componentWillUnmount()}catch(It){hr(x,v,It)}}break;case 5:ku(ut,ut.return);break;case 22:if(ut.memoizedState!==null){z3(vt);continue}}$t!==null?($t.return=ut,Dt=$t):z3(vt)}dt=dt.sibling}e:for(dt=null,vt=c;;){if(vt.tag===5){if(dt===null){dt=vt;try{N=vt.stateNode,Be?($=N.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none"):(he=vt.stateNode,ye=vt.memoizedProps.style,W=ye!=null&&ye.hasOwnProperty("display")?ye.display:null,he.style.display=ft("display",W))}catch(It){hr(c,c.return,It)}}}else if(vt.tag===6){if(dt===null)try{vt.stateNode.nodeValue=Be?"":vt.memoizedProps}catch(It){hr(c,c.return,It)}}else if((vt.tag!==22&&vt.tag!==23||vt.memoizedState===null||vt===c)&&vt.child!==null){vt.child.return=vt,vt=vt.child;continue}if(vt===c)break e;for(;vt.sibling===null;){if(vt.return===null||vt.return===c)break e;dt===vt&&(dt=null),vt=vt.return}dt===vt&&(dt=null),vt.sibling.return=vt.return,vt=vt.sibling}}break;case 19:za(d,c),vo(c),x&4&&F3(c);break;case 21:break;default:za(d,c),vo(c)}}function vo(c){var d=c.flags;if(d&2){try{e:{for(var v=c.return;v!==null;){if(H3(v)){var x=v;break e}v=v.return}throw Error(n(160))}switch(x.tag){case 5:var N=x.stateNode;x.flags&32&&(Ie(N,""),x.flags&=-33);var $=O3(c);Rg(c,$,N);break;case 3:case 4:var W=x.stateNode.containerInfo,he=O3(c);Mg(c,he,W);break;default:throw Error(n(161))}}catch(ye){hr(c,c.return,ye)}c.flags&=-3}d&4096&&(c.flags&=-4097)}function AT(c,d,v){Dt=c,V3(c)}function V3(c,d,v){for(var x=(c.mode&1)!==0;Dt!==null;){var N=Dt,$=N.child;if(N.tag===22&&x){var W=N.memoizedState!==null||Q1;if(!W){var he=N.alternate,ye=he!==null&&he.memoizedState!==null||as;he=Q1;var Be=as;if(Q1=W,(as=ye)&&!Be)for(Dt=N;Dt!==null;)W=Dt,ye=W.child,W.tag===22&&W.memoizedState!==null?B3(N):ye!==null?(ye.return=W,Dt=ye):B3(N);for(;$!==null;)Dt=$,V3($),$=$.sibling;Dt=N,Q1=he,as=Be}Z3(c)}else(N.subtreeFlags&8772)!==0&&$!==null?($.return=N,Dt=$):Z3(c)}}function Z3(c){for(;Dt!==null;){var d=Dt;if((d.flags&8772)!==0){var v=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:as||J1(5,d);break;case 1:var x=d.stateNode;if(d.flags&4&&!as)if(v===null)x.componentDidMount();else{var N=d.elementType===d.type?v.memoizedProps:Va(d.type,v.memoizedProps);x.componentDidUpdate(N,v.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var $=d.updateQueue;$!==null&&zb(d,$,x);break;case 3:var W=d.updateQueue;if(W!==null){if(v=null,d.child!==null)switch(d.child.tag){case 5:v=d.child.stateNode;break;case 1:v=d.child.stateNode}zb(d,W,v)}break;case 5:var he=d.stateNode;if(v===null&&d.flags&4){v=he;var ye=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":ye.autoFocus&&v.focus();break;case"img":ye.src&&(v.src=ye.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var Be=d.alternate;if(Be!==null){var dt=Be.memoizedState;if(dt!==null){var vt=dt.dehydrated;vt!==null&&Zn(vt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}as||d.flags&512&&Ng(d)}catch(ut){hr(d,d.return,ut)}}if(d===c){Dt=null;break}if(v=d.sibling,v!==null){v.return=d.return,Dt=v;break}Dt=d.return}}function z3(c){for(;Dt!==null;){var d=Dt;if(d===c){Dt=null;break}var v=d.sibling;if(v!==null){v.return=d.return,Dt=v;break}Dt=d.return}}function B3(c){for(;Dt!==null;){var d=Dt;try{switch(d.tag){case 0:case 11:case 15:var v=d.return;try{J1(4,d)}catch(ye){hr(d,v,ye)}break;case 1:var x=d.stateNode;if(typeof x.componentDidMount=="function"){var N=d.return;try{x.componentDidMount()}catch(ye){hr(d,N,ye)}}var $=d.return;try{Ng(d)}catch(ye){hr(d,$,ye)}break;case 5:var W=d.return;try{Ng(d)}catch(ye){hr(d,W,ye)}}}catch(ye){hr(d,d.return,ye)}if(d===c){Dt=null;break}var he=d.sibling;if(he!==null){he.return=d.return,Dt=he;break}Dt=d.return}}var NT=Math.ceil,eh=A.ReactCurrentDispatcher,Pg=A.ReactCurrentOwner,ma=A.ReactCurrentBatchConfig,Hn=0,Fr=null,yr=null,Gr=0,Qs=0,Su=Ii(0),Rr=0,c0=null,Jl=0,th=0,Lg=0,u0=null,Ds=null,$g=0,Eu=1/0,qo=null,nh=!1,Tg=null,Bi=null,rh=!1,Ui=null,sh=0,d0=0,Dg=null,ah=-1,oh=0;function bs(){return(Hn&6)!==0?Xe():ah!==-1?ah:ah=Xe()}function Wi(c){return(c.mode&1)===0?1:(Hn&2)!==0&&Gr!==0?Gr&-Gr:dT.transition!==null?(oh===0&&(oh=dn()),oh):(c=wn,c!==0||(c=window.event,c=c===void 0?16:gs(c.type)),c)}function Ba(c,d,v,x){if(50<d0)throw d0=0,Dg=null,Error(n(185));Kt(c,v,x),((Hn&2)===0||c!==Fr)&&(c===Fr&&((Hn&2)===0&&(th|=v),Rr===4&&Ki(c,Gr)),Hs(c,x),v===1&&Hn===0&&(d.mode&1)===0&&(Eu=Xe()+500,T1&&_i()))}function Hs(c,d){var v=c.callbackNode;Sn(c,d);var x=kn(c,c===Fr?Gr:0);if(x===0)v!==null&&it(v),c.callbackNode=null,c.callbackPriority=0;else if(d=x&-x,c.callbackPriority!==d){if(v!=null&&it(v),d===1)c.tag===0?uT(W3.bind(null,c)):Pb(W3.bind(null,c)),oT(function(){(Hn&6)===0&&_i()}),v=null;else{switch(_o(x)){case 1:v=Ut;break;case 4:v=At;break;case 16:v=_t;break;case 536870912:v=Ve;break;default:v=_t}v=ex(v,U3.bind(null,c))}c.callbackPriority=d,c.callbackNode=v}}function U3(c,d){if(ah=-1,oh=0,(Hn&6)!==0)throw Error(n(327));var v=c.callbackNode;if(Cu()&&c.callbackNode!==v)return null;var x=kn(c,c===Fr?Gr:0);if(x===0)return null;if((x&30)!==0||(x&c.expiredLanes)!==0||d)d=ih(c,x);else{d=x;var N=Hn;Hn|=2;var $=G3();(Fr!==c||Gr!==d)&&(qo=null,Eu=Xe()+500,tc(c,d));do try{PT();break}catch(he){K3(c,he)}while(!0);J2(),eh.current=$,Hn=N,yr!==null?d=0:(Fr=null,Gr=0,d=Rr)}if(d!==0){if(d===2&&(N=Qn(c),N!==0&&(x=N,d=Hg(c,N))),d===1)throw v=c0,tc(c,0),Ki(c,x),Hs(c,Xe()),v;if(d===6)Ki(c,x);else{if(N=c.current.alternate,(x&30)===0&&!MT(N)&&(d=ih(c,x),d===2&&($=Qn(c),$!==0&&(x=$,d=Hg(c,$))),d===1))throw v=c0,tc(c,0),Ki(c,x),Hs(c,Xe()),v;switch(c.finishedWork=N,c.finishedLanes=x,d){case 0:case 1:throw Error(n(345));case 2:nc(c,Ds,qo);break;case 3:if(Ki(c,x),(x&130023424)===x&&(d=$g+500-Xe(),10<d)){if(kn(c,0)!==0)break;if(N=c.suspendedLanes,(N&x)!==x){bs(),c.pingedLanes|=c.suspendedLanes&N;break}c.timeoutHandle=Z2(nc.bind(null,c,Ds,qo),d);break}nc(c,Ds,qo);break;case 4:if(Ki(c,x),(x&4194240)===x)break;for(d=c.eventTimes,N=-1;0<x;){var W=31-we(x);$=1<<W,W=d[W],W>N&&(N=W),x&=~$}if(x=N,x=Xe()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*NT(x/1960))-x,10<x){c.timeoutHandle=Z2(nc.bind(null,c,Ds,qo),x);break}nc(c,Ds,qo);break;case 5:nc(c,Ds,qo);break;default:throw Error(n(329))}}}return Hs(c,Xe()),c.callbackNode===v?U3.bind(null,c):null}function Hg(c,d){var v=u0;return c.current.memoizedState.isDehydrated&&(tc(c,d).flags|=256),c=ih(c,d),c!==2&&(d=Ds,Ds=v,d!==null&&Og(d)),c}function Og(c){Ds===null?Ds=c:Ds.push.apply(Ds,c)}function MT(c){for(var d=c;;){if(d.flags&16384){var v=d.updateQueue;if(v!==null&&(v=v.stores,v!==null))for(var x=0;x<v.length;x++){var N=v[x],$=N.getSnapshot;N=N.value;try{if(!Fa($(),N))return!1}catch{return!1}}}if(v=d.child,d.subtreeFlags&16384&&v!==null)v.return=d,d=v;else{if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function Ki(c,d){for(d&=~Lg,d&=~th,c.suspendedLanes|=d,c.pingedLanes&=~d,c=c.expirationTimes;0<d;){var v=31-we(d),x=1<<v;c[v]=-1,d&=~x}}function W3(c){if((Hn&6)!==0)throw Error(n(327));Cu();var d=kn(c,0);if((d&1)===0)return Hs(c,Xe()),null;var v=ih(c,d);if(c.tag!==0&&v===2){var x=Qn(c);x!==0&&(d=x,v=Hg(c,x))}if(v===1)throw v=c0,tc(c,0),Ki(c,d),Hs(c,Xe()),v;if(v===6)throw Error(n(345));return c.finishedWork=c.current.alternate,c.finishedLanes=d,nc(c,Ds,qo),Hs(c,Xe()),null}function Ig(c,d){var v=Hn;Hn|=1;try{return c(d)}finally{Hn=v,Hn===0&&(Eu=Xe()+500,T1&&_i())}}function ec(c){Ui!==null&&Ui.tag===0&&(Hn&6)===0&&Cu();var d=Hn;Hn|=1;var v=ma.transition,x=wn;try{if(ma.transition=null,wn=1,c)return c()}finally{wn=x,ma.transition=v,Hn=d,(Hn&6)===0&&_i()}}function Fg(){Qs=Su.current,tr(Su)}function tc(c,d){c.finishedWork=null,c.finishedLanes=0;var v=c.timeoutHandle;if(v!==-1&&(c.timeoutHandle=-1,aT(v)),yr!==null)for(v=yr.return;v!==null;){var x=v;switch(G2(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&L1();break;case 3:bu(),tr(Ls),tr(ns),ig();break;case 5:ag(x);break;case 4:bu();break;case 13:tr(ir);break;case 19:tr(ir);break;case 10:eg(x.type._context);break;case 22:case 23:Fg()}v=v.return}if(Fr=c,yr=c=Gi(c.current,null),Gr=Qs=d,Rr=0,c0=null,Lg=th=Jl=0,Ds=u0=null,ql!==null){for(d=0;d<ql.length;d++)if(v=ql[d],x=v.interleaved,x!==null){v.interleaved=null;var N=x.next,$=v.pending;if($!==null){var W=$.next;$.next=N,x.next=W}v.pending=x}ql=null}return c}function K3(c,d){do{var v=yr;try{if(J2(),B1.current=G1,U1){for(var x=lr.memoizedState;x!==null;){var N=x.queue;N!==null&&(N.pending=null),x=x.next}U1=!1}if(Ql=0,Ir=Mr=lr=null,r0=!1,s0=0,Pg.current=null,v===null||v.return===null){Rr=1,c0=d,yr=null;break}e:{var $=c,W=v.return,he=v,ye=d;if(d=Gr,he.flags|=32768,ye!==null&&typeof ye=="object"&&typeof ye.then=="function"){var Be=ye,dt=he,vt=dt.tag;if((dt.mode&1)===0&&(vt===0||vt===11||vt===15)){var ut=dt.alternate;ut?(dt.updateQueue=ut.updateQueue,dt.memoizedState=ut.memoizedState,dt.lanes=ut.lanes):(dt.updateQueue=null,dt.memoizedState=null)}var $t=w3(W);if($t!==null){$t.flags&=-257,y3($t,W,he,$,d),$t.mode&1&&v3($,Be,d),d=$t,ye=Be;var Ht=d.updateQueue;if(Ht===null){var It=new Set;It.add(ye),d.updateQueue=It}else Ht.add(ye);break e}else{if((d&1)===0){v3($,Be,d),_g();break e}ye=Error(n(426))}}else if(ar&&he.mode&1){var vr=w3(W);if(vr!==null){(vr.flags&65536)===0&&(vr.flags|=256),y3(vr,W,he,$,d),X2(xu(ye,he));break e}}$=ye=xu(ye,he),Rr!==4&&(Rr=2),u0===null?u0=[$]:u0.push($),$=W;do{switch($.tag){case 3:$.flags|=65536,d&=-d,$.lanes|=d;var Te=m3($,ye,d);Zb($,Te);break e;case 1:he=ye;var Ce=$.type,Oe=$.stateNode;if(($.flags&128)===0&&(typeof Ce.getDerivedStateFromError=="function"||Oe!==null&&typeof Oe.componentDidCatch=="function"&&(Bi===null||!Bi.has(Oe)))){$.flags|=65536,d&=-d,$.lanes|=d;var St=g3($,he,d);Zb($,St);break e}}$=$.return}while($!==null)}q3(v)}catch(Vt){d=Vt,yr===v&&v!==null&&(yr=v=v.return);continue}break}while(!0)}function G3(){var c=eh.current;return eh.current=G1,c===null?G1:c}function _g(){(Rr===0||Rr===3||Rr===2)&&(Rr=4),Fr===null||(Jl&268435455)===0&&(th&268435455)===0||Ki(Fr,Gr)}function ih(c,d){var v=Hn;Hn|=2;var x=G3();(Fr!==c||Gr!==d)&&(qo=null,tc(c,d));do try{RT();break}catch(N){K3(c,N)}while(!0);if(J2(),Hn=v,eh.current=x,yr!==null)throw Error(n(261));return Fr=null,Gr=0,Rr}function RT(){for(;yr!==null;)Y3(yr)}function PT(){for(;yr!==null&&!wt();)Y3(yr)}function Y3(c){var d=J3(c.alternate,c,Qs);c.memoizedProps=c.pendingProps,d===null?q3(c):yr=d,Pg.current=null}function q3(c){var d=c;do{var v=d.alternate;if(c=d.return,(d.flags&32768)===0){if(v=ST(v,d,Qs),v!==null){yr=v;return}}else{if(v=ET(v,d),v!==null){v.flags&=32767,yr=v;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{Rr=6,yr=null;return}}if(d=d.sibling,d!==null){yr=d;return}yr=d=c}while(d!==null);Rr===0&&(Rr=5)}function nc(c,d,v){var x=wn,N=ma.transition;try{ma.transition=null,wn=1,LT(c,d,v,x)}finally{ma.transition=N,wn=x}return null}function LT(c,d,v,x){do Cu();while(Ui!==null);if((Hn&6)!==0)throw Error(n(327));v=c.finishedWork;var N=c.finishedLanes;if(v===null)return null;if(c.finishedWork=null,c.finishedLanes=0,v===c.current)throw Error(n(177));c.callbackNode=null,c.callbackPriority=0;var $=v.lanes|v.childLanes;if(wr(c,$),c===Fr&&(yr=Fr=null,Gr=0),(v.subtreeFlags&2064)===0&&(v.flags&2064)===0||rh||(rh=!0,ex(_t,function(){return Cu(),null})),$=(v.flags&15990)!==0,(v.subtreeFlags&15990)!==0||$){$=ma.transition,ma.transition=null;var W=wn;wn=1;var he=Hn;Hn|=4,Pg.current=null,jT(c,v),_3(v,c),Q$(_2),Pn=!!F2,_2=F2=null,c.current=v,AT(v),Pe(),Hn=he,wn=W,ma.transition=$}else c.current=v;if(rh&&(rh=!1,Ui=c,sh=N),$=c.pendingLanes,$===0&&(Bi=null),fe(v.stateNode),Hs(c,Xe()),d!==null)for(x=c.onRecoverableError,v=0;v<d.length;v++)N=d[v],x(N.value,{componentStack:N.stack,digest:N.digest});if(nh)throw nh=!1,c=Tg,Tg=null,c;return(sh&1)!==0&&c.tag!==0&&Cu(),$=c.pendingLanes,($&1)!==0?c===Dg?d0++:(d0=0,Dg=c):d0=0,_i(),null}function Cu(){if(Ui!==null){var c=_o(sh),d=ma.transition,v=wn;try{if(ma.transition=null,wn=16>c?16:c,Ui===null)var x=!1;else{if(c=Ui,Ui=null,sh=0,(Hn&6)!==0)throw Error(n(331));var N=Hn;for(Hn|=4,Dt=c.current;Dt!==null;){var $=Dt,W=$.child;if((Dt.flags&16)!==0){var he=$.deletions;if(he!==null){for(var ye=0;ye<he.length;ye++){var Be=he[ye];for(Dt=Be;Dt!==null;){var dt=Dt;switch(dt.tag){case 0:case 11:case 15:l0(8,dt,$)}var vt=dt.child;if(vt!==null)vt.return=dt,Dt=vt;else for(;Dt!==null;){dt=Dt;var ut=dt.sibling,$t=dt.return;if(D3(dt),dt===Be){Dt=null;break}if(ut!==null){ut.return=$t,Dt=ut;break}Dt=$t}}}var Ht=$.alternate;if(Ht!==null){var It=Ht.child;if(It!==null){Ht.child=null;do{var vr=It.sibling;It.sibling=null,It=vr}while(It!==null)}}Dt=$}}if(($.subtreeFlags&2064)!==0&&W!==null)W.return=$,Dt=W;else e:for(;Dt!==null;){if($=Dt,($.flags&2048)!==0)switch($.tag){case 0:case 11:case 15:l0(9,$,$.return)}var Te=$.sibling;if(Te!==null){Te.return=$.return,Dt=Te;break e}Dt=$.return}}var Ce=c.current;for(Dt=Ce;Dt!==null;){W=Dt;var Oe=W.child;if((W.subtreeFlags&2064)!==0&&Oe!==null)Oe.return=W,Dt=Oe;else e:for(W=Ce;Dt!==null;){if(he=Dt,(he.flags&2048)!==0)try{switch(he.tag){case 0:case 11:case 15:J1(9,he)}}catch(Vt){hr(he,he.return,Vt)}if(he===W){Dt=null;break e}var St=he.sibling;if(St!==null){St.return=he.return,Dt=St;break e}Dt=he.return}}if(Hn=N,_i(),_&&typeof _.onPostCommitFiberRoot=="function")try{_.onPostCommitFiberRoot(Je,c)}catch{}x=!0}return x}finally{wn=v,ma.transition=d}}return!1}function X3(c,d,v){d=xu(v,d),d=m3(c,d,1),c=Zi(c,d,1),d=bs(),c!==null&&(Kt(c,1,d),Hs(c,d))}function hr(c,d,v){if(c.tag===3)X3(c,c,v);else for(;d!==null;){if(d.tag===3){X3(d,c,v);break}else if(d.tag===1){var x=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(Bi===null||!Bi.has(x))){c=xu(v,c),c=g3(d,c,1),d=Zi(d,c,1),c=bs(),d!==null&&(Kt(d,1,c),Hs(d,c));break}}d=d.return}}function $T(c,d,v){var x=c.pingCache;x!==null&&x.delete(d),d=bs(),c.pingedLanes|=c.suspendedLanes&v,Fr===c&&(Gr&v)===v&&(Rr===4||Rr===3&&(Gr&130023424)===Gr&&500>Xe()-$g?tc(c,0):Lg|=v),Hs(c,d)}function Q3(c,d){d===0&&((c.mode&1)===0?d=1:(d=zt,zt<<=1,(zt&130023424)===0&&(zt=4194304)));var v=bs();c=Ko(c,d),c!==null&&(Kt(c,d,v),Hs(c,v))}function TT(c){var d=c.memoizedState,v=0;d!==null&&(v=d.retryLane),Q3(c,v)}function DT(c,d){var v=0;switch(c.tag){case 13:var x=c.stateNode,N=c.memoizedState;N!==null&&(v=N.retryLane);break;case 19:x=c.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),Q3(c,v)}var J3;J3=function(c,d,v){if(c!==null)if(c.memoizedProps!==d.pendingProps||Ls.current)Ts=!0;else{if((c.lanes&v)===0&&(d.flags&128)===0)return Ts=!1,kT(c,d,v);Ts=(c.flags&131072)!==0}else Ts=!1,ar&&(d.flags&1048576)!==0&&Lb(d,H1,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;X1(c,d),c=d.pendingProps;var N=hu(d,ns.current);yu(d,v),N=ug(null,d,x,c,N,v);var $=dg();return d.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,$s(x)?($=!0,$1(d)):$=!1,d.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,rg(d),N.updater=Y1,d.stateNode=N,N._reactInternals=d,vg(d,x,c,v),d=xg(null,d,x,!0,$,v)):(d.tag=0,ar&&$&&K2(d),ys(null,d,N,v),d=d.child),d;case 16:x=d.elementType;e:{switch(X1(c,d),c=d.pendingProps,N=x._init,x=N(x._payload),d.type=x,N=d.tag=OT(x),c=Va(x,c),N){case 0:d=bg(null,d,x,c,v);break e;case 1:d=C3(null,d,x,c,v);break e;case 11:d=b3(null,d,x,c,v);break e;case 14:d=x3(null,d,x,Va(x.type,c),v);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Va(x,N),bg(c,d,x,N,v);case 1:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Va(x,N),C3(c,d,x,N,v);case 3:e:{if(j3(d),c===null)throw Error(n(387));x=d.pendingProps,$=d.memoizedState,N=$.element,Vb(c,d),Z1(d,x,null,v);var W=d.memoizedState;if(x=W.element,$.isDehydrated)if($={element:x,isDehydrated:!1,cache:W.cache,pendingSuspenseBoundaries:W.pendingSuspenseBoundaries,transitions:W.transitions},d.updateQueue.baseState=$,d.memoizedState=$,d.flags&256){N=xu(Error(n(423)),d),d=A3(c,d,x,v,N);break e}else if(x!==N){N=xu(Error(n(424)),d),d=A3(c,d,x,v,N);break e}else for(Xs=Oi(d.stateNode.containerInfo.firstChild),qs=d,ar=!0,_a=null,v=Fb(d,null,x,v),d.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(gu(),x===N){d=Yo(c,d,v);break e}ys(c,d,x,v)}d=d.child}return d;case 5:return Bb(d),c===null&&q2(d),x=d.type,N=d.pendingProps,$=c!==null?c.memoizedProps:null,W=N.children,V2(x,N)?W=null:$!==null&&V2(x,$)&&(d.flags|=32),E3(c,d),ys(c,d,W,v),d.child;case 6:return c===null&&q2(d),null;case 13:return N3(c,d,v);case 4:return sg(d,d.stateNode.containerInfo),x=d.pendingProps,c===null?d.child=vu(d,null,x,v):ys(c,d,x,v),d.child;case 11:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Va(x,N),b3(c,d,x,N,v);case 7:return ys(c,d,d.pendingProps,v),d.child;case 8:return ys(c,d,d.pendingProps.children,v),d.child;case 12:return ys(c,d,d.pendingProps.children,v),d.child;case 10:e:{if(x=d.type._context,N=d.pendingProps,$=d.memoizedProps,W=N.value,Gn(F1,x._currentValue),x._currentValue=W,$!==null)if(Fa($.value,W)){if($.children===N.children&&!Ls.current){d=Yo(c,d,v);break e}}else for($=d.child,$!==null&&($.return=d);$!==null;){var he=$.dependencies;if(he!==null){W=$.child;for(var ye=he.firstContext;ye!==null;){if(ye.context===x){if($.tag===1){ye=Go(-1,v&-v),ye.tag=2;var Be=$.updateQueue;if(Be!==null){Be=Be.shared;var dt=Be.pending;dt===null?ye.next=ye:(ye.next=dt.next,dt.next=ye),Be.pending=ye}}$.lanes|=v,ye=$.alternate,ye!==null&&(ye.lanes|=v),tg($.return,v,d),he.lanes|=v;break}ye=ye.next}}else if($.tag===10)W=$.type===d.type?null:$.child;else if($.tag===18){if(W=$.return,W===null)throw Error(n(341));W.lanes|=v,he=W.alternate,he!==null&&(he.lanes|=v),tg(W,v,d),W=$.sibling}else W=$.child;if(W!==null)W.return=$;else for(W=$;W!==null;){if(W===d){W=null;break}if($=W.sibling,$!==null){$.return=W.return,W=$;break}W=W.return}$=W}ys(c,d,N.children,v),d=d.child}return d;case 9:return N=d.type,x=d.pendingProps.children,yu(d,v),N=ha(N),x=x(N),d.flags|=1,ys(c,d,x,v),d.child;case 14:return x=d.type,N=Va(x,d.pendingProps),N=Va(x.type,N),x3(c,d,x,N,v);case 15:return k3(c,d,d.type,d.pendingProps,v);case 17:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Va(x,N),X1(c,d),d.tag=1,$s(x)?(c=!0,$1(d)):c=!1,yu(d,v),h3(d,x,N),vg(d,x,N,v),xg(null,d,x,!0,c,v);case 19:return R3(c,d,v);case 22:return S3(c,d,v)}throw Error(n(156,d.tag))};function ex(c,d){return be(c,d)}function HT(c,d,v,x){this.tag=c,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ga(c,d,v,x){return new HT(c,d,v,x)}function Vg(c){return c=c.prototype,!(!c||!c.isReactComponent)}function OT(c){if(typeof c=="function")return Vg(c)?1:0;if(c!=null){if(c=c.$$typeof,c===D)return 11;if(c===U)return 14}return 2}function Gi(c,d){var v=c.alternate;return v===null?(v=ga(c.tag,d,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=d,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,d=c.dependencies,v.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function lh(c,d,v,x,N,$){var W=2;if(x=c,typeof c=="function")Vg(c)&&(W=1);else if(typeof c=="string")W=5;else e:switch(c){case M:return rc(v.children,N,$,d);case j:W=8,N|=8;break;case P:return c=ga(12,v,d,N|2),c.elementType=P,c.lanes=$,c;case B:return c=ga(13,v,d,N),c.elementType=B,c.lanes=$,c;case V:return c=ga(19,v,d,N),c.elementType=V,c.lanes=$,c;case O:return ch(v,N,$,d);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case R:W=10;break e;case H:W=9;break e;case D:W=11;break e;case U:W=14;break e;case K:W=16,x=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return d=ga(W,v,d,N),d.elementType=c,d.type=x,d.lanes=$,d}function rc(c,d,v,x){return c=ga(7,c,x,d),c.lanes=v,c}function ch(c,d,v,x){return c=ga(22,c,x,d),c.elementType=O,c.lanes=v,c.stateNode={isHidden:!1},c}function Zg(c,d,v){return c=ga(6,c,null,d),c.lanes=v,c}function zg(c,d,v){return d=ga(4,c.children!==null?c.children:[],c.key,d),d.lanes=v,d.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},d}function IT(c,d,v,x,N){this.tag=d,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mr(0),this.expirationTimes=mr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mr(0),this.identifierPrefix=x,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function Bg(c,d,v,x,N,$,W,he,ye){return c=new IT(c,d,v,he,ye),d===1?(d=1,$===!0&&(d|=8)):d=0,$=ga(3,null,null,d),c.current=$,$.stateNode=c,$.memoizedState={element:x,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},rg($),c}function FT(c,d,v){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:x==null?null:""+x,children:c,containerInfo:d,implementation:v}}function tx(c){if(!c)return Fi;c=c._reactInternals;e:{if(ot(c)!==c||c.tag!==1)throw Error(n(170));var d=c;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if($s(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(n(171))}if(c.tag===1){var v=c.type;if($s(v))return Mb(c,v,d)}return d}function nx(c,d,v,x,N,$,W,he,ye){return c=Bg(v,x,!0,c,N,$,W,he,ye),c.context=tx(null),v=c.current,x=bs(),N=Wi(v),$=Go(x,N),$.callback=d??null,Zi(v,$,N),c.current.lanes=N,Kt(c,N,x),Hs(c,x),c}function uh(c,d,v,x){var N=d.current,$=bs(),W=Wi(N);return v=tx(v),d.context===null?d.context=v:d.pendingContext=v,d=Go($,W),d.payload={element:c},x=x===void 0?null:x,x!==null&&(d.callback=x),c=Zi(N,d,W),c!==null&&(Ba(c,N,W,$),V1(c,N,W)),W}function dh(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return c.child.stateNode;default:return c.child.stateNode}}function rx(c,d){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v<d?v:d}}function Ug(c,d){rx(c,d),(c=c.alternate)&&rx(c,d)}function _T(){return null}var sx=typeof reportError=="function"?reportError:function(c){console.error(c)};function Wg(c){this._internalRoot=c}fh.prototype.render=Wg.prototype.render=function(c){var d=this._internalRoot;if(d===null)throw Error(n(409));uh(c,d,null,null)},fh.prototype.unmount=Wg.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var d=c.containerInfo;ec(function(){uh(null,c,null,null)}),d[zo]=null}};function fh(c){this._internalRoot=c}fh.prototype.unstable_scheduleHydration=function(c){if(c){var d=on();c={blockedOn:null,target:c,priority:d};for(var v=0;v<ms.length&&d!==0&&d<ms[v].priority;v++);ms.splice(v,0,c),v===0&&le(c)}};function Kg(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function hh(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function ax(){}function VT(c,d,v,x,N){if(N){if(typeof x=="function"){var $=x;x=function(){var Be=dh(W);$.call(Be)}}var W=nx(d,x,c,0,null,!1,!1,"",ax);return c._reactRootContainer=W,c[zo]=W.current,Yd(c.nodeType===8?c.parentNode:c),ec(),W}for(;N=c.lastChild;)c.removeChild(N);if(typeof x=="function"){var he=x;x=function(){var Be=dh(ye);he.call(Be)}}var ye=Bg(c,0,!1,null,null,!1,!1,"",ax);return c._reactRootContainer=ye,c[zo]=ye.current,Yd(c.nodeType===8?c.parentNode:c),ec(function(){uh(d,ye,v,x)}),ye}function ph(c,d,v,x,N){var $=v._reactRootContainer;if($){var W=$;if(typeof N=="function"){var he=N;N=function(){var ye=dh(W);he.call(ye)}}uh(d,W,c,N)}else W=VT(v,d,c,N,x);return dh(W)}Rn=function(c){switch(c.tag){case 3:var d=c.stateNode;if(d.current.memoizedState.isDehydrated){var v=Rt(d.pendingLanes);v!==0&&(Hr(d,v|1),Hs(d,Xe()),(Hn&6)===0&&(Eu=Xe()+500,_i()))}break;case 13:ec(function(){var x=Ko(c,1);if(x!==null){var N=bs();Ba(x,c,1,N)}}),Ug(c,1)}},Ks=function(c){if(c.tag===13){var d=Ko(c,134217728);if(d!==null){var v=bs();Ba(d,c,134217728,v)}Ug(c,134217728)}},Ps=function(c){if(c.tag===13){var d=Wi(c),v=Ko(c,d);if(v!==null){var x=bs();Ba(v,c,d,x)}Ug(c,d)}},on=function(){return wn},yn=function(c,d){var v=wn;try{return wn=c,d()}finally{wn=v}},Tt=function(c,d,v){switch(d){case"input":if(Ke(c,v),d=v.name,v.type==="radio"&&d!=null){for(v=c;v.parentNode;)v=v.parentNode;for(v=v.querySelectorAll("input[name="+JSON.stringify(""+d)+'][type="radio"]'),d=0;d<v.length;d++){var x=v[d];if(x!==c&&x.form===c.form){var N=P1(x);if(!N)throw Error(n(90));Le(x),Ke(x,N)}}}break;case"textarea":ie(c,v);break;case"select":d=v.value,d!=null&&Q(c,!!v.multiple,d,!1)}},rt=Ig,qt=ec;var ZT={usingClientEntryPoint:!1,Events:[Qd,du,P1,Qe,st,Ig]},f0={findFiberByHostInstance:Wl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},zT={bundleType:f0.bundleType,version:f0.version,rendererPackageName:f0.rendererPackageName,rendererConfig:f0.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:A.ReactCurrentDispatcher,findHostInstanceByFiber:function(c){return c=tt(c),c===null?null:c.stateNode},findFiberByHostInstance:f0.findFiberByHostInstance||_T,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mh.isDisabled&&mh.supportsFiber)try{Je=mh.inject(zT),_=mh}catch{}}return Os.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ZT,Os.createPortal=function(c,d){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Kg(d))throw Error(n(200));return FT(c,d,null,v)},Os.createRoot=function(c,d){if(!Kg(c))throw Error(n(299));var v=!1,x="",N=sx;return d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(x=d.identifierPrefix),d.onRecoverableError!==void 0&&(N=d.onRecoverableError)),d=Bg(c,1,!1,null,null,v,!1,x,N),c[zo]=d.current,Yd(c.nodeType===8?c.parentNode:c),new Wg(d)},Os.findDOMNode=function(c){if(c==null)return null;if(c.nodeType===1)return c;var d=c._reactInternals;if(d===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=tt(d),c=c===null?null:c.stateNode,c},Os.flushSync=function(c){return ec(c)},Os.hydrate=function(c,d,v){if(!hh(d))throw Error(n(200));return ph(null,c,d,!0,v)},Os.hydrateRoot=function(c,d,v){if(!Kg(c))throw Error(n(405));var x=v!=null&&v.hydratedSources||null,N=!1,$="",W=sx;if(v!=null&&(v.unstable_strictMode===!0&&(N=!0),v.identifierPrefix!==void 0&&($=v.identifierPrefix),v.onRecoverableError!==void 0&&(W=v.onRecoverableError)),d=nx(d,null,c,1,v??null,N,!1,$,W),c[zo]=d.current,Yd(c),x)for(c=0;c<x.length;c++)v=x[c],N=v._getVersion,N=N(v._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[v,N]:d.mutableSourceEagerHydrationData.push(v,N);return new fh(d)},Os.render=function(c,d,v){if(!hh(d))throw Error(n(200));return ph(null,c,d,!1,v)},Os.unmountComponentAtNode=function(c){if(!hh(c))throw Error(n(40));return c._reactRootContainer?(ec(function(){ph(null,null,c,!1,function(){c._reactRootContainer=null,c[zo]=null})}),!0):!1},Os.unstable_batchedUpdates=Ig,Os.unstable_renderSubtreeIntoContainer=function(c,d,v,x){if(!hh(v))throw Error(n(200));if(c==null||c._reactInternals===void 0)throw Error(n(38));return ph(c,d,v,!1,x)},Os.version="18.3.1-next-f1338f8080-20240426",Os}var gx;function Q9(){if(gx)return Xg.exports;gx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Xg.exports=XT(),Xg.exports}var vx;function QT(){if(vx)return gh;vx=1;var e=Q9();return gh.createRoot=e.createRoot,gh.hydrateRoot=e.hydrateRoot,gh}var JT=QT();/**
41
+ * react-router v7.18.3
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */var J9=e=>{throw TypeError(e)},e7=(e,t,n)=>t.has(e)||J9("Cannot "+n),wa=(e,t,n)=>(e7(e,t,"read from private field"),n?n.call(e):t.get(e)),M0=(e,t,n)=>t.has(e)?J9("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),wo=(e,t,n,r)=>(e7(e,t,"write to private field"),t.set(e,n),n),sm=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,am=/^[\\/]{2}/;function t7(e,t){return t+e.replace(/\\/g,"/")}var wx="popstate";function yx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function eD(e={}){function t(r,a){var h;let i=(h=a.state)==null?void 0:h.masked,{pathname:l,search:u,hash:f}=i||r.location;return X0("",{pathname:l,search:u,hash:f},a.state&&a.state.usr||null,a.state&&a.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:Es(a)}return nD(t,n,null,e)}function fn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function nr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function tD(){return Math.random().toString(36).substring(2,10)}function bx(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function X0(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Oo(t):t,state:n,key:t&&t.key||r||tD(),mask:a}}function Es({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Oo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function nD(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,l=a.history,u="POP",f=null,h=p();h==null&&(h=0,l.replaceState({...l.state,idx:h},""));function p(){return(l.state||{idx:null}).idx}function g(){u="POP";let k=p(),S=k==null?null:k-h;h=k,f&&f({action:u,location:b.location,delta:S})}function m(k,S){u="PUSH";let E=yx(k)?k:X0(b.location,k,S);h=p()+1;let C=bx(E,h),A=b.createHref(E.mask||E);try{l.pushState(C,"",A)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;a.location.assign(A)}i&&f&&f({action:u,location:b.location,delta:1})}function w(k,S){u="REPLACE";let E=yx(k)?k:X0(b.location,k,S);h=p();let C=bx(E,h),A=b.createHref(E.mask||E);l.replaceState(C,"",A),i&&f&&f({action:u,location:b.location,delta:0})}function y(k){return n7(a,k)}let b={get action(){return u},get location(){return e(a,l)},listen(k){if(f)throw new Error("A history only accepts one active listener");return a.addEventListener(wx,g),f=k,()=>{a.removeEventListener(wx,g),f=null}},createHref(k){return t(a,k)},createURL:y,encodeLocation(k){let S=y(k);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:m,replace:w,go(k){return l.go(k)}};return b}function n7(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),fn(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:Es(t);return a=a.replace(/ $/,"%20"),!n&&am.test(a)&&(a=r+a),new URL(a,r)}var R0,xx=class{constructor(e){if(M0(this,R0,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(wa(this,R0).has(e))return wa(this,R0).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){wa(this,R0).set(e,t)}};R0=new WeakMap;var rD=new Set(["lazy","caseSensitive","path","id","index","children"]);function sD(e){return rD.has(e)}var aD=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function oD(e){return aD.has(e)}function iD(e){return e.index===!0}function Q0(e,t,n=[],r={},a=!1){return e.map((i,l)=>{let u=[...n,String(l)],f=typeof i.id=="string"?i.id:u.join("-");if(fn(i.index!==!0||!i.children,"Cannot specify children on an index route"),fn(a||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),iD(i)){let h={...i,id:f};return r[f]=kx(h,t(h)),h}else{let h={...i,id:f,children:void 0};return r[f]=kx(h,t(h)),i.children&&(h.children=Q0(i.children,t,u,r,a)),h}})}function kx(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function r7(e,t,n="/"){return Ua(e,t,n,!1)}function Ua(e,t,n,r,a){let i=typeof t=="string"?Oo(t):t,l=sa(i.pathname||"/",n);if(l==null)return null;let u=a??Yh(e),f=null,h=c7(l);for(let p=0;f==null&&p<u.length;++p)f=vD(u[p],h,r);return f}function s7(e,t){let{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Yh(e){let t=a7(e);return lD(t),t}function a7(e,t=[],n=[],r="",a=!1){let i=(l,u,f=a,h)=>{let p={relativePath:h===void 0?l.path||"":h,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&f)return;fn(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let g=Aa([r,p.relativePath]),m=n.concat(p);l.children&&l.children.length>0&&(fn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),a7(l.children,t,m,g,f)),!(l.path==null&&!l.index)&&t.push({path:g,score:mD(g,l.index),routesMeta:m.map((w,y)=>{let[b,k]=l7(w.relativePath,w.caseSensitive,y===m.length-1);return{...w,matcher:b,compiledParams:k}})})};return e.forEach((l,u)=>{var f;if(l.path===""||!((f=l.path)!=null&&f.includes("?")))i(l,u);else for(let h of o7(l.path))i(l,u,!0,h)}),t}function o7(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let l=o7(r.join("/")),u=[];return u.push(...l.map(f=>f===""?i:[i,f].join("/"))),a&&u.push(...l),u.map(f=>e.startsWith("/")&&f===""?"/":f)}function lD(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:gD(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var cD=/^:[\w-]+$/,uD=3,dD=2,fD=1,hD=10,pD=-2,Sx=e=>e==="*";function mD(e,t){let n=e.split("/"),r=n.length;return n.some(Sx)&&(r+=pD),t&&(r+=dD),n.filter(a=>!Sx(a)).reduce((a,i)=>a+(cD.test(i)?uD:i===""?fD:hD),r)}function gD(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function vD(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",l=[];for(let u=0;u<r.length;++u){let f=r[u],h=u===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",g={path:f.relativePath,caseSensitive:f.caseSensitive,end:h},m=f.matcher&&f.compiledParams?i7(g,p,f.matcher,f.compiledParams):yl(g,p),w=f.route;if(!m&&h&&n&&!r[r.length-1].route.index&&(m=yl({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},p)),!m)return null;Object.assign(a,m.params),l.push({params:a,pathname:Aa([i,m.pathname]),pathnameBase:bD(Aa([i,m.pathnameBase])),route:w}),m.pathnameBase!=="/"&&(i=Aa([i,m.pathnameBase]))}return l}function hs(e,t={}){let n=e;n.endsWith("*")&&n!=="*"&&!n.endsWith("/*")&&(nr(!1,`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`),n=n.replace(/\*$/,"/*"));const r=n.startsWith("/")?"/":"",a=l=>l==null?"":typeof l=="string"?l:String(l),i=n.split(/\/+/).map((l,u,f)=>{if(u===f.length-1&&l==="*")return a(t["*"]);const p=l.match(/^:([\w-]+)(\??)(.*)/);if(p){const[,g,m,w]=p;let y=t[g];return fn(m==="?"||y!=null,`Missing ":${g}" param`),encodeURIComponent(a(y))+w}return l.replace(/\?$/g,"")}).filter(l=>!!l);return r+i.join("/")}function yl(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=l7(e.path,e.caseSensitive,e.end);return i7(e,t,n,r)}function i7(e,t,n,r){let a=t.match(n);if(!a)return null;let i=a[0],l=fd(i,1),u=a.slice(1);return{params:r.reduce((h,{paramName:p,isOptional:g},m)=>{if(p==="*"){let y=u[m]||"";l=fd(i.slice(0,i.length-y.length),1)}const w=u[m];return g&&!w?h[p]=void 0:h[p]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:l,pattern:e}}function l7(e,t=!1,n=!0){nr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,f,h,p)=>{if(r.push({paramName:u,isOptional:f!=null}),f){let g=p.charAt(h+l.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function c7(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return nr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function sa(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function wD({basename:e,pathname:t}){return t==="/"?e:Aa([e,t])}var gv=e=>sm.test(e);function yD(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Oo(e):e,i;return n?(n=vv(n),n.startsWith("/")||n.startsWith("\\")?i=Ex(n.substring(1),"/"):i=Ex(n,t)):i=t,{pathname:i,search:xD(r),hash:kD(a)}}function Ex(e,t){let n=fd(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function e8(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function u7(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function om(e){let t=u7(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Nf(e,t,n,r=!1){let a;typeof e=="string"?a=Oo(e):(a={...e},fn(!a.pathname||!a.pathname.includes("?"),e8("?","pathname","search",a)),fn(!a.pathname||!a.pathname.includes("#"),e8("#","pathname","hash",a)),fn(!a.search||!a.search.includes("#"),e8("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,u;if(l==null)u=n;else{let g=t.length-1;if(!r&&l.startsWith("..")){let m=l.split("/");for(;m[0]==="..";)m.shift(),g-=1;a.pathname=m.join("/")}u=g>=0?t[g]:"/"}let f=yD(a,u),h=l&&l!=="/"&&l.endsWith("/"),p=(i||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||p)&&(f.pathname+="/"),f}var vv=e=>e.replace(/[\\/]{2,}/g,"/"),Aa=e=>vv(e.join("/"));function fd(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var bD=e=>fd(e).replace(/^\/*/,"/"),xD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,kD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,SD=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Mf=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function J0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Rf(e){let t=e.map(n=>n.route.path).filter(Boolean);return Aa(t)||"/"}var d7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function f7(e,t){let n=e;if(typeof n!="string"||!sm.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(d7)try{let i=new URL(window.location.href),l=am.test(n)?new URL(t7(n,i.protocol)):new URL(n),u=sa(l.pathname,t);l.origin===i.origin&&u!=null?n=u+l.search+l.hash:a=!0}catch{nr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}var ul=Symbol("Uninstrumented");function ED(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(a=>a({id:t.id,index:t.index,path:t.path,instrument(i){let l=Object.keys(n);for(let u of l)i[u]&&n[u].push(i[u])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let a=Uu(n.lazy,t.lazy,()=>{});a&&(r.lazy=a)}if(typeof t.lazy=="object"){let a=t.lazy;["middleware","loader","action"].forEach(i=>{let l=a[i],u=n[`lazy.${i}`];if(typeof l=="function"&&u.length>0){let f=Uu(u,l,()=>{});f&&(r.lazy=Object.assign(r.lazy||{},{[i]:f}))}})}return["loader","action"].forEach(a=>{let i=t[a];if(typeof i=="function"&&n[a].length>0){let l=i[ul]??i,u=Uu(n[a],l,(...f)=>Cx(f[0]));u&&(a==="loader"&&l.hydrate===!0&&(u.hydrate=!0),u[ul]=l,r[a]=u)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let i=a[ul]??a,l=Uu(n.middleware,i,(...u)=>Cx(u[0]));return l?(l[ul]=i,l):a})),r}function CD(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(a){let i=Object.keys(a);for(let l of i)a[l]&&n[l].push(a[l])}})),n.navigate.length>0){let r=e.navigate[ul]??e.navigate,a=Uu(n.navigate,r,(...i)=>{let[l,u]=i;return{to:typeof l=="number"||typeof l=="string"?l:l?Es(l):".",...jx(e,u??{})}});a&&(a[ul]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[ul]??e.fetch,a=Uu(n.fetch,r,(...i)=>{let[l,,u,f]=i;return{href:u??".",fetcherKey:l,...jx(e,f??{})}});a&&(a[ul]=r,e.fetch=a)}return e}function Uu(e,t,n){return e.length===0?null:async(...r)=>{let a=await h7(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function h7(e,t,n,r){let a=e[r],i;if(a){let l,u=async()=>(l?console.error("You cannot call instrumented handlers more than once"):l=h7(e,t,n,r-1),i=await l,fn(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await a(u,t)}catch(f){console.error("An instrumentation function threw an error:",f)}l||await u(),await l}else try{i={type:"success",value:await n()}}catch(l){i={type:"error",value:l}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Cx(e){let{request:t,context:n,params:r,pattern:a}=e;return{request:jD(t),params:{...r},pattern:a,context:AD(n)}}function jx(e,t){return{currentUrl:Es(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function jD(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function AD(e){if(MD(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var ND=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function MD(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===ND}var Ax=new URL("http://localhost");function wv(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),Ax)}catch{return Ax}}function t8(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function RD(e,t){if(e.startsWith("//"))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===""||e.slice(n.length).startsWith("//"):!1}function Xu(e,t,n,r){let a=null;try{a=e==null?null:new URL(e,n)}catch{}let i=new URL(t,n),l=a!=null&&!t8(a,n),u=!t8(i,n);if(r==="reject"){if(l||u)throw new Error("External navigation is not allowed")}else if(u&&(a==null||!RD(e,a)||!t8(a,i)))throw new Error("External navigation is not allowed")}var p7=["POST","PUT","PATCH","DELETE"],PD=new Set(p7),LD=["GET",...p7],$D=new Set(LD),m7=new Set([301,302,303,307,308]),TD=new Set([307,308]),n8={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},DD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},p0={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},HD=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),g7="remix-router-transitions",v7=Symbol("ResetLoaderData"),uc,Ou,Ji,Iu,OD=class{constructor(e){M0(this,uc),M0(this,Ou),M0(this,Ji),M0(this,Iu),wo(this,uc,e),wo(this,Ou,Yh(e))}get stableRoutes(){return wa(this,uc)}get activeRoutes(){return wa(this,Ji)??wa(this,uc)}get branches(){return wa(this,Iu)??wa(this,Ou)}get hasHMRRoutes(){return wa(this,Ji)!=null}setRoutes(e){wo(this,uc,e),wo(this,Ou,Yh(e))}setHmrRoutes(e){wo(this,Ji,e),wo(this,Iu,Yh(e))}commitHmrRoutes(){wa(this,Ji)&&(wo(this,uc,wa(this,Ji)),wo(this,Ou,wa(this,Iu)),wo(this,Ji,void 0),wo(this,Iu,void 0))}};uc=new WeakMap;Ou=new WeakMap;Ji=new WeakMap;Iu=new WeakMap;function ID(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";fn(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||HD,i=a;if(e.instrumentations){let re=e.instrumentations;i=ue=>({...a(ue),...ED(re.map(de=>de.route).filter(Boolean),ue)})}let l={},u=new OD(Q0(e.routes,i,void 0,l)),f=e.basename||"/";f.startsWith("/")||(f=`/${f}`);let h=e.dataStrategy||zD,p={...e.future},g=null,m=new Set,w=null,y=null,b=null,k=null,S=e.hydrationData!=null,E=Ua(u.activeRoutes,e.history.location,f,!1,u.branches),C=!1,A=null,L,T;if(E==null&&!e.patchRoutesOnNavigation){let re=ba(404,{pathname:e.history.location.pathname}),{matches:ue,route:de}=vh(u.activeRoutes);L=!0,T=!L,E=ue,A={[de.id]:re}}else if(E&&!e.hydrationData&&Yt(E,u.activeRoutes,e.history.location.pathname).active&&(E=null),E)if(E.some(re=>re.route.lazy))L=!1,T=!L;else if(!E.some(re=>yv(re.route)))L=!0,T=!L;else{let re=e.hydrationData?e.hydrationData.loaderData:null,ue=e.hydrationData?e.hydrationData.errors:null,de=E;if(ue){let _e=E.findIndex(Fe=>ue[Fe.route.id]!==void 0);de=de.slice(0,_e+1)}T=!1,L=!0,de.forEach(_e=>{let Fe=w7(_e.route,re,ue);T=T||Fe.renderFallback,L=L&&!Fe.shouldLoad})}else{L=!1,T=!L,E=[];let re=Yt(null,u.activeRoutes,e.history.location.pathname);re.active&&re.matches&&(C=!0,E=re.matches)}let M,j={historyAction:e.history.action,location:e.history.location,matches:E,initialized:L,renderFallback:T,navigation:n8,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||A,fetchers:new Map,blockers:new Map},P="POP",R=null,H=!1,D,B=!1,V=new Map,U=null,K=!1,O=!1,F=new Set,I=new Map,G=0,z=-1,Y=new Map,Z=new Set,ee=new Map,pe=new Map,se=new Set,xe=new Map,J,te=null;function X(){if(g=e.history.listen(({action:re,location:ue,delta:de})=>{if(J){J(),J=void 0;return}nr(xe.size===0||de!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let _e=et({currentLocation:j.location,nextLocation:ue,historyAction:re});if(_e&&de!=null){let Fe=new Promise(xt=>{J=xt});e.history.go(de*-1),ke(_e,{state:"blocked",location:ue,proceed(){ke(_e,{state:"proceeding",proceed:void 0,reset:void 0,location:ue}),Fe.then(()=>e.history.go(de))},reset(){let xt=new Map(j.blockers);xt.set(_e,p0),ce({blockers:xt})}}),R==null||R.resolve(),R=null;return}return Ke(re,ue)}),n){lH(t,V);let re=()=>cH(t,V);t.addEventListener("pagehide",re),U=()=>t.removeEventListener("pagehide",re)}return j.initialized||Ke("POP",j.location,{initialHydration:!0}),M}function ae(){g&&g(),U&&U(),m.clear(),D&&D.abort(),j.fetchers.forEach((re,ue)=>ft(j.fetchers,ue)),j.blockers.forEach((re,ue)=>Tt(ue))}function Le(re){if(m.add(re),w){let{newErrors:ue}=w;w=null,re(j,{deletedFetchers:[],newErrors:ue,viewTransitionOpts:void 0,flushSync:!1})}return()=>m.delete(re)}function ce(re,ue={}){re.matches&&(re.matches=re.matches.map(Fe=>{let xt=l[Fe.route.id],yt=Fe.route;return yt.element!==xt.element||yt.errorElement!==xt.errorElement||yt.hydrateFallbackElement!==xt.hydrateFallbackElement?{...Fe,route:xt}:Fe})),j={...j,...re};let de=[],_e=[];j.fetchers.forEach((Fe,xt)=>{Fe.state==="idle"&&(se.has(xt)?de.push(xt):_e.push(xt))}),se.forEach(Fe=>{!j.fetchers.has(Fe)&&!I.has(Fe)&&de.push(Fe)}),m.size===0&&(w={newErrors:re.errors??null}),[...m].forEach(Fe=>Fe(j,{deletedFetchers:de,newErrors:re.errors??null,viewTransitionOpts:ue.viewTransitionOpts,flushSync:ue.flushSync===!0})),de.forEach(Fe=>ft(j.fetchers,Fe)),_e.forEach(Fe=>j.fetchers.delete(Fe))}function Se(re,ue,{flushSync:de}={}){var je,me;let _e=j.actionData!=null&&j.navigation.formMethod!=null&&ls(j.navigation.formMethod)&&j.navigation.state==="loading"&&((je=re.state)==null?void 0:je._isRedirect)!==!0,Fe;ue.actionData?Object.keys(ue.actionData).length>0?Fe=ue.actionData:Fe=null:_e?Fe=j.actionData:Fe=null;let xt=ue.loaderData?Ox(j.loaderData,ue.loaderData,ue.matches||[],ue.errors):j.loaderData,yt=j.blockers;yt.size>0&&(yt=new Map(yt),yt.forEach((tt,Ct)=>yt.set(Ct,p0)));let kt=K?!1:qt(re,ue.matches||j.matches),ot=H===!0||j.navigation.formMethod!=null&&ls(j.navigation.formMethod)&&((me=re.state)==null?void 0:me._isRedirect)!==!0;u.commitHmrRoutes(),K||P==="POP"||(P==="PUSH"?e.history.push(re,re.state):P==="REPLACE"&&e.history.replace(re,re.state));let ht;if(P==="POP"){let tt=V.get(j.location.pathname);tt&&tt.has(re.pathname)?ht={currentLocation:j.location,nextLocation:re}:V.has(re.pathname)&&(ht={currentLocation:re,nextLocation:j.location})}else if(B){let tt=V.get(j.location.pathname);tt?tt.add(re.pathname):(tt=new Set([re.pathname]),V.set(j.location.pathname,tt)),ht={currentLocation:j.location,nextLocation:re}}ce({...ue,actionData:Fe,loaderData:xt,historyAction:P,location:re,initialized:!0,renderFallback:!1,navigation:n8,revalidation:"idle",restoreScrollPosition:kt,preventScrollReset:ot,blockers:yt},{viewTransitionOpts:ht,flushSync:de===!0}),P="POP",H=!1,B=!1,K=!1,O=!1,R==null||R.resolve(),R=null,te==null||te.resolve(),te=null}async function Ze(re,ue){if(R==null||R.resolve(),R=null,typeof re=="number"){R||(R=Vx());let be=R.promise;return e.history.go(re),be}let de=A6(j.location,j.matches,f,re,ue==null?void 0:ue.fromRouteId,ue==null?void 0:ue.relative),{path:_e,submission:Fe,error:xt}=Nx(!1,de,ue),yt;if(ue!=null&&ue.mask){let be=typeof ue.mask=="string"?Oo(ue.mask):{...j.location.mask,...ue.mask};if(yt={pathname:be.pathname??"",search:be.search??"",hash:be.hash??""},am.test(yt.pathname))throw new Error("External navigation is not allowed");yt.pathname.startsWith("\\")&&(yt.pathname=yt.pathname.replace(/^\\+/,"/")),Xu(typeof ue.mask=="string"?ue.mask:Es(ue.mask),Es(yt),e.history.createURL("/"),"reject")}let kt=j.location,ot=X0(kt,_e,ue&&ue.state,void 0,yt);ot={...ot,...e.history.encodeLocation(ot)},Xu(re==null?e.history.createHref(j.location):typeof re=="string"?re:Es(re),e.history.createHref(ot.mask||ot),e.history.createURL("/"),"reject");let ht=ue&&ue.replace!=null?ue.replace:void 0,je="PUSH";ht===!0?je="REPLACE":ht===!1||Fe!=null&&ls(Fe.formMethod)&&Fe.formAction===j.location.pathname+j.location.search&&(je="REPLACE");let me=ue&&"preventScrollReset"in ue?ue.preventScrollReset===!0:void 0,tt=(ue&&ue.flushSync)===!0,Ct=et({currentLocation:kt,nextLocation:ot,historyAction:je});if(Ct){ke(Ct,{state:"blocked",location:ot,proceed(){ke(Ct,{state:"proceeding",proceed:void 0,reset:void 0,location:ot}),Ze(re,ue)},reset(){let be=new Map(j.blockers);be.set(Ct,p0),ce({blockers:be})}});return}await Ke(je,ot,{submission:Fe,pendingError:xt,preventScrollReset:me,replace:ue&&ue.replace,enableViewTransition:ue&&ue.viewTransition,flushSync:tt,callSiteDefaultShouldRevalidate:ue&&ue.defaultShouldRevalidate})}function gt(){te||(te=Vx()),ze(),ce({revalidation:"loading"});let re=te.promise;return j.navigation.state==="submitting"?re:j.navigation.state==="idle"?(Ke(j.historyAction,j.location,{startUninterruptedRevalidation:!0}),re):(Ke(P||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation,enableViewTransition:B===!0}),re)}async function Ke(re,ue,de){D&&D.abort(),D=null,P=re,K=(de&&de.startUninterruptedRevalidation)===!0,rt(j.location,j.matches),H=(de&&de.preventScrollReset)===!0,B=(de&&de.enableViewTransition)===!0;let _e=u.activeRoutes,Fe=de!=null&&de.initialHydration&&j.matches&&j.matches.length>0&&!C?j.matches:Ua(_e,ue,f,!1,u.branches),xt=(de&&de.flushSync)===!0;if(Fe&&j.initialized&&!O&&QD(j.location,ue)&&!(de&&de.submission&&ls(de.submission.formMethod))){Se(ue,{matches:Fe},{flushSync:xt});return}let yt=Yt(Fe,_e,ue.pathname);if(yt.active&&yt.matches&&(Fe=yt.matches),!Fe){let{error:wt,notFoundMatches:Pe,route:Xe}=Et(ue.pathname);Se(ue,{matches:Pe,loaderData:{},errors:{[Xe.id]:wt}},{flushSync:xt});return}let kt=de&&de.overrideNavigation?{...de.overrideNavigation,matches:Fe,historyAction:re}:void 0;D=new AbortController;let ot=Fu(e.history,ue,D.signal,de&&de.submission),ht=e.getContext?await e.getContext():new xx,je;if(de&&de.pendingError)je=[al(Fe).route.id,{type:"error",error:de.pendingError}];else if(de&&de.submission&&ls(de.submission.formMethod)){let wt=await nt(ot,ue,de.submission,Fe,re,ht,yt.active,de&&de.initialHydration===!0,{replace:de.replace,flushSync:xt});if(wt.shortCircuited)return;if(wt.pendingActionResult){let[Pe,Xe]=wt.pendingActionResult;if(ea(Xe)&&J0(Xe.error)&&Xe.error.status===404){D=null,Se(ue,{matches:wt.matches,loaderData:{},errors:{[Pe]:Xe.error}});return}}Fe=wt.matches||Fe,je=wt.pendingActionResult,kt=r8(ue,Fe,re,de.submission),xt=!1,yt.active=!1,ot=Fu(e.history,ot.url,ot.signal)}let{shortCircuited:me,matches:tt,loaderData:Ct,errors:be,workingFetchers:it}=await $e(ot,ue,Fe,re,ht,yt.active,kt,de&&de.submission,de&&de.fetcherSubmission,de&&de.replace,de&&de.initialHydration===!0,xt,je,de&&de.callSiteDefaultShouldRevalidate);me||(D=null,Se(ue,{matches:tt||Fe,...Ix(je),loaderData:Ct,errors:be,...it?{fetchers:it}:{}}))}async function nt(re,ue,de,_e,Fe,xt,yt,kt,ot={}){ze();let ht=oH(ue,_e,Fe,de);if(ce({navigation:ht},{flushSync:ot.flushSync===!0}),yt){let tt=await an(_e,ue.pathname,re.signal);if(tt.type==="aborted")return{shortCircuited:!0};if(tt.type==="error"){if(tt.partialMatches.length===0){let{matches:be,route:it}=vh(u.activeRoutes);return{matches:be,pendingActionResult:[it.id,{type:"error",error:tt.error}]}}let Ct=al(tt.partialMatches).route.id;return{matches:tt.partialMatches,pendingActionResult:[Ct,{type:"error",error:tt.error}]}}else if(tt.matches)_e=tt.matches;else{let{notFoundMatches:Ct,error:be,route:it}=Et(ue.pathname);return{matches:Ct,pendingActionResult:[it.id,{type:"error",error:be}]}}}let je,me=qh(_e,ue);if(!me.route.action&&!me.route.lazy)je={type:"error",error:ba(405,{method:re.method,pathname:ue.pathname,routeId:me.route.id})};else{let tt=Qu(i,l,re,ue,_e,me,kt?[]:r,xt),Ct=await oe(re,ue,tt,xt,null);if(je=Ct[me.route.id],!je){for(let be of _e)if(Ct[be.route.id]){je=Ct[be.route.id];break}}if(re.signal.aborted)return{shortCircuited:!0}}if(wc(je)){let tt;return ot&&ot.replace!=null?tt=ot.replace:tt=Tx(je.response.headers.get("Location"),new URL(re.url),f,e.history)===j.location.pathname+j.location.search,await q(re,je,!0,{submission:de,replace:tt}),{shortCircuited:!0}}if(ea(je)){let tt=al(_e,me.route.id);return(ot&&ot.replace)!==!0&&(P="PUSH"),{matches:_e,pendingActionResult:[tt.route.id,je,me.route.id]}}return{matches:_e,pendingActionResult:[me.route.id,je]}}async function $e(re,ue,de,_e,Fe,xt,yt,kt,ot,ht,je,me,tt,Ct){let be=yt||r8(ue,de,_e,kt),it=kt||ot||_x(be),wt=!K&&!je;if(xt){if(wt){let ct=ne(tt);ce({navigation:be,...ct!==void 0?{actionData:ct}:{}},{flushSync:me})}let Me=await an(de,ue.pathname,re.signal);if(Me.type==="aborted")return{shortCircuited:!0};if(Me.type==="error"){if(Me.partialMatches.length===0){let{matches:Ot,route:zt}=vh(u.activeRoutes);return{matches:Ot,loaderData:{},errors:{[zt.id]:Me.error}}}let ct=al(Me.partialMatches).route.id;return{matches:Me.partialMatches,loaderData:{},errors:{[ct]:Me.error}}}else if(Me.matches)de=Me.matches;else{let{error:ct,notFoundMatches:Ot,route:zt}=Et(ue.pathname);return{matches:Ot,loaderData:{},errors:{[zt.id]:ct}}}}let Pe=u.activeRoutes,{dsMatches:Xe,revalidatingFetchers:Lt}=Mx(re,Fe,i,l,e.history,j,de,it,ue,je?[]:r,je===!0,O,F,se,ee,Z,Pe,f,e.patchRoutesOnNavigation!=null,u.branches,tt,Ct);if(z=++G,!e.dataStrategy&&!Xe.some(Me=>Me.shouldLoad)&&!Xe.some(Me=>Me.route.middleware&&Me.route.middleware.length>0)&&Lt.length===0){let Me=new Map(j.fetchers),ct=jt(Me);return Se(ue,{matches:de,loaderData:{},errors:tt&&ea(tt[1])?{[tt[0]]:tt[1].error}:null,...Ix(tt),...ct?{fetchers:Me}:{}},{flushSync:me}),{shortCircuited:!0}}if(wt){let Me={};if(!xt){Me.navigation=be;let ct=ne(tt);ct!==void 0&&(Me.actionData=ct)}Lt.length>0&&(Me.fetchers=Q(Lt)),ce(Me,{flushSync:me})}Lt.forEach(Me=>{at(Me.key),Me.controller&&I.set(Me.key,Me.controller)});let Ut=()=>Lt.forEach(Me=>at(Me.key));D&&D.signal.addEventListener("abort",Ut);let{loaderResults:At,fetcherResults:_t}=await Re(Xe,Lt,re,ue,Fe);if(re.signal.aborted)return{shortCircuited:!0};D&&D.signal.removeEventListener("abort",Ut),Lt.forEach(Me=>I.delete(Me.key));let Ae=wh(At);if(Ae)return await q(re,Ae.result,!0,{replace:ht}),{shortCircuited:!0};if(Ae=wh(_t),Ae)return Z.add(Ae.key),await q(re,Ae.result,!0,{replace:ht}),{shortCircuited:!0};let Ve=new Map(j.fetchers),{loaderData:Je,errors:_}=Hx(j,de,At,tt,Lt,_t,Ve);je&&j.errors&&(_={...j.errors,..._});let fe=jt(Ve),we=Ft(z,Ve),Ue=fe||we||Lt.length>0;return{matches:de,loaderData:Je,errors:_,...Ue?{workingFetchers:Ve}:{}}}function ne(re){if(re&&!ea(re[1]))return{[re[0]]:re[1].data};if(j.actionData)return Object.keys(j.actionData).length===0?null:j.actionData}function Q(re){let ue=new Map(j.fetchers);return re.forEach(de=>{let _e=ue.get(de.key),Fe=m0(void 0,_e?_e.data:void 0);ue.set(de.key,Fe)}),ue}async function We(re,ue,de,_e){at(re);let Fe=(_e&&_e.flushSync)===!0,xt=u.activeRoutes,yt=A6(j.location,j.matches,f,de,ue,_e==null?void 0:_e.relative),kt=Ua(xt,yt,f,!1,u.branches),ot=Yt(kt,xt,yt);if(ot.active&&ot.matches&&(kt=ot.matches),!kt){Ie(re,ue,ba(404,{pathname:yt}),{flushSync:Fe});return}let{path:ht,submission:je,error:me}=Nx(!0,yt,_e);if(me){Ie(re,ue,me,{flushSync:Fe});return}let tt=e.getContext?await e.getContext():new xx,Ct=(_e&&_e.preventScrollReset)===!0;if(je&&ls(je.formMethod)){await Ne(re,ue,ht,kt,tt,ot.active,Fe,Ct,je,_e&&_e.defaultShouldRevalidate);return}ee.set(re,{routeId:ue,path:ht}),await ie(re,ue,ht,kt,tt,ot.active,Fe,Ct,je)}async function Ne(re,ue,de,_e,Fe,xt,yt,kt,ot,ht){ze(),ee.delete(re);let je=j.fetchers.get(re);Ye(re,iH(ot,je),{flushSync:yt});let me=new AbortController,tt=Fu(e.history,de,me.signal,ot);if(xt){let Jt=await an(_e,new URL(tt.url).pathname,tt.signal,re);if(Jt.type==="aborted")return;if(Jt.type==="error"){Ie(re,ue,Jt.error,{flushSync:yt});return}else if(Jt.matches)_e=Jt.matches;else{Ie(re,ue,ba(404,{pathname:de}),{flushSync:yt});return}}let Ct=qh(_e,de);if(!Ct.route.action&&!Ct.route.lazy){let Jt=ba(405,{method:ot.formMethod,pathname:de,routeId:ue});Ie(re,ue,Jt,{flushSync:yt});return}I.set(re,me);let be=G,it=Qu(i,l,tt,de,_e,Ct,r,Fe),wt=await oe(tt,de,it,Fe,re),Pe=wt[Ct.route.id];if(!Pe){for(let Jt of it)if(wt[Jt.route.id]){Pe=wt[Jt.route.id];break}}if(tt.signal.aborted){I.get(re)===me&&I.delete(re);return}if(se.has(re)){if(wc(Pe)||ea(Pe)){Ye(re,xo(void 0));return}}else{if(wc(Pe))if(I.delete(re),z>be){Ye(re,xo(void 0));return}else return Z.add(re),Ye(re,m0(ot)),q(tt,Pe,!1,{fetcherSubmission:ot,preventScrollReset:kt});if(ea(Pe)){Ie(re,ue,Pe.error);return}}let Xe=j.navigation.location||j.location,Lt=Fu(e.history,Xe,me.signal),Ut=u.activeRoutes,At=j.navigation.state!=="idle"?Ua(Ut,j.navigation.location,f,!1,u.branches):j.matches;fn(At,"Didn't find any matches after fetcher action");let _t=++G;Y.set(re,_t);let{dsMatches:Ae,revalidatingFetchers:Ve}=Mx(Lt,Fe,i,l,e.history,j,At,ot,Xe,r,!1,O,F,se,ee,Z,Ut,f,e.patchRoutesOnNavigation!=null,u.branches,[Ct.route.id,Pe],ht),Je=m0(ot,Pe.data),_=new Map(j.fetchers);_.set(re,Je),Ve.filter(Jt=>Jt.key!==re).forEach(Jt=>{let Sn=Jt.key,Qn=_.get(Sn),dn=m0(void 0,Qn?Qn.data:void 0);_.set(Sn,dn),at(Sn),Jt.controller&&I.set(Sn,Jt.controller)}),ce({fetchers:_});let fe=()=>Ve.forEach(Jt=>at(Jt.key));me.signal.addEventListener("abort",fe);let{loaderResults:we,fetcherResults:Ue}=await Re(Ae,Ve,Lt,Xe,Fe);if(me.signal.aborted)return;me.signal.removeEventListener("abort",fe),Y.delete(re),I.delete(re),Ve.forEach(Jt=>I.delete(Jt.key));let Me=j.fetchers.has(re),ct=Jt=>{if(!Me)return Jt;let Sn=new Map(Jt.fetchers);return Sn.set(re,xo(Pe.data)),{...Jt,fetchers:Sn}},Ot=wh(we);if(Ot)return j=ct(j),q(Lt,Ot.result,!1,{preventScrollReset:kt});if(Ot=wh(Ue),Ot)return Z.add(Ot.key),j=ct(j),q(Lt,Ot.result,!1,{preventScrollReset:kt});let zt=new Map(j.fetchers);Me&&zt.set(re,xo(Pe.data));let{loaderData:Rt,errors:kn}=Hx(j,At,we,void 0,Ve,Ue,zt);Ft(_t,zt),j.navigation.state==="loading"&&_t>z?(fn(P,"Expected pending action"),D&&D.abort(),Se(j.navigation.location,{matches:At,loaderData:Rt,errors:kn,fetchers:zt})):(ce({errors:kn,loaderData:Ox(j.loaderData,Rt,At,kn),fetchers:zt}),O=!1)}async function ie(re,ue,de,_e,Fe,xt,yt,kt,ot){let ht=j.fetchers.get(re);Ye(re,m0(ot,ht?ht.data:void 0),{flushSync:yt});let je=new AbortController,me=Fu(e.history,de,je.signal);if(xt){let Pe=await an(_e,new URL(me.url).pathname,me.signal,re);if(Pe.type==="aborted")return;if(Pe.type==="error"){Ie(re,ue,Pe.error,{flushSync:yt});return}else if(Pe.matches)_e=Pe.matches;else{Ie(re,ue,ba(404,{pathname:de}),{flushSync:yt});return}}let tt=qh(_e,de);I.set(re,je);let Ct=G,be=Qu(i,l,me,de,_e,tt,r,Fe),it=await oe(me,de,be,Fe,re),wt=it[tt.route.id];if(!wt){for(let Pe of _e)if(it[Pe.route.id]){wt=it[Pe.route.id];break}}if(I.get(re)===je&&I.delete(re),!me.signal.aborted){if(se.has(re)){Ye(re,xo(void 0));return}if(wc(wt))if(z>Ct){Ye(re,xo(void 0));return}else{Z.add(re),await q(me,wt,!1,{preventScrollReset:kt});return}if(ea(wt)){Ie(re,ue,wt.error);return}Ye(re,xo(wt.data))}}async function q(re,ue,de,{submission:_e,fetcherSubmission:Fe,preventScrollReset:xt,replace:yt}={}){de||(R==null||R.resolve(),R=null),ue.response.headers.has("X-Remix-Revalidate")&&(O=!0);let kt=ue.response.headers.get("Location");fn(kt,"Expected a Location header on the redirect Response");let ot=kt,ht=new URL(re.url);kt=Tx(kt,ht,f,e.history),Xu(ot,kt,ht,"allow-explicit");let je=X0(j.location,kt,{_isRedirect:!0});if(n){let wt=!1;if(ue.response.headers.has("X-Remix-Reload-Document"))wt=!0;else if(gv(kt)){const Pe=n7(t,kt,!0);wt=Pe.origin!==t.location.origin||sa(Pe.pathname,f)==null}if(wt){yt?t.location.replace(kt):t.location.assign(kt);return}}D=null;let me=yt===!0||ue.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:tt,formAction:Ct,formEncType:be}=j.navigation;!_e&&!Fe&&tt&&Ct&&be&&(_e=_x(j.navigation));let it=_e||Fe;if(TD.has(ue.response.status)&&it&&ls(it.formMethod))await Ke(me,je,{submission:{...it,formAction:kt},preventScrollReset:xt||H,enableViewTransition:de?B:void 0});else{let wt=r8(je,[],me,_e);await Ke(me,je,{overrideNavigation:wt,fetcherSubmission:Fe,preventScrollReset:xt||H,enableViewTransition:de?B:void 0})}}async function oe(re,ue,de,_e,Fe){var kt;let xt,yt={};try{xt=await UD(h,re,ue,de,Fe,_e,!1)}catch(ot){return de.filter(ht=>ht.shouldLoad).forEach(ht=>{yt[ht.route.id]={type:"error",error:ot}}),yt}if(re.signal.aborted)return yt;if(!ls(re.method))for(let ot of de){if(((kt=xt[ot.route.id])==null?void 0:kt.type)==="error")break;!xt.hasOwnProperty(ot.route.id)&&!j.loaderData.hasOwnProperty(ot.route.id)&&(!j.errors||!j.errors.hasOwnProperty(ot.route.id))&&ot.shouldCallHandler()&&(xt[ot.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${ot.route.id}`)})}for(let[ot,ht]of Object.entries(xt))if(nH(ht)){let je=ht.result;yt[ot]={type:"redirect",response:YD(je,re,ot,de,f)}}else yt[ot]=await GD(ht);return yt}async function Re(re,ue,de,_e,Fe){let xt=oe(de,_e,re,Fe,null),yt=Promise.all(ue.map(async ht=>{if(ht.matches&&ht.match&&ht.request&&ht.controller){let me=(await oe(ht.request,ht.path,ht.matches,Fe,ht.key))[ht.match.route.id];return{[ht.key]:me}}else return Promise.resolve({[ht.key]:{type:"error",error:ba(404,{pathname:ht.path})}})})),kt=await xt,ot=(await yt).reduce((ht,je)=>Object.assign(ht,je),{});return{loaderResults:kt,fetcherResults:ot}}function ze(){O=!0,ee.forEach((re,ue)=>{I.has(ue)&&F.add(ue),at(ue)})}function Ye(re,ue,de={}){let _e=new Map(j.fetchers);_e.set(re,ue),ce({fetchers:_e},{flushSync:(de&&de.flushSync)===!0})}function Ie(re,ue,de,_e={}){let Fe=al(j.matches,ue),xt=new Map(j.fetchers);ft(xt,re),ce({errors:{[Fe.route.id]:de},fetchers:xt},{flushSync:(_e&&_e.flushSync)===!0})}function De(re){return pe.set(re,(pe.get(re)||0)+1),se.has(re)&&se.delete(re),j.fetchers.get(re)||DD}function Ge(re,ue){at(re,ue==null?void 0:ue.reason),Ye(re,xo(null))}function ft(re,ue){let de=j.fetchers.get(ue);I.has(ue)&&!(de&&de.state==="loading"&&Y.has(ue))&&at(ue),ee.delete(ue),Y.delete(ue),Z.delete(ue),se.delete(ue),F.delete(ue),re.delete(ue)}function bt(re){let ue=(pe.get(re)||0)-1;ue<=0?(pe.delete(re),se.add(re)):pe.set(re,ue),ce({fetchers:new Map(j.fetchers)})}function at(re,ue){let de=I.get(re);de&&(de.abort(ue),I.delete(re))}function Zt(re,ue){for(let de of re){let _e=ue.get(de);fn(_e,`Expected fetcher: ${de}`);let Fe=xo(_e.data);ue.set(de,Fe)}}function jt(re){let ue=[],de=!1;for(let _e of Z){let Fe=re.get(_e);fn(Fe,`Expected fetcher: ${_e}`),Fe.state==="loading"&&(Z.delete(_e),ue.push(_e),de=!0)}return Zt(ue,re),de}function Ft(re,ue){let de=[];for(let[_e,Fe]of Y)if(Fe<re){let xt=ue.get(_e);fn(xt,`Expected fetcher: ${_e}`),xt.state==="loading"&&(at(_e),Y.delete(_e),de.push(_e))}return Zt(de,ue),de.length>0}function Pt(re,ue){let de=j.blockers.get(re)||p0;return xe.get(re)!==ue&&xe.set(re,ue),de}function Tt(re){j.blockers.delete(re),xe.delete(re)}function ke(re,ue){let de=j.blockers.get(re)||p0;fn(de.state==="unblocked"&&ue.state==="blocked"||de.state==="blocked"&&ue.state==="blocked"||de.state==="blocked"&&ue.state==="proceeding"||de.state==="blocked"&&ue.state==="unblocked"||de.state==="proceeding"&&ue.state==="unblocked",`Invalid blocker state transition: ${de.state} -> ${ue.state}`);let _e=new Map(j.blockers);_e.set(re,ue),ce({blockers:_e})}function et({currentLocation:re,nextLocation:ue,historyAction:de}){if(xe.size===0)return;xe.size>1&&nr(!1,"A router only supports one blocker at a time");let _e=Array.from(xe.entries()),[Fe,xt]=_e[_e.length-1],yt=j.blockers.get(Fe);if(!(yt&&yt.state==="proceeding")&&xt({currentLocation:re,nextLocation:ue,historyAction:de}))return Fe}function Et(re){let ue=ba(404,{pathname:re}),de=u.activeRoutes,{matches:_e,route:Fe}=vh(de);return{notFoundMatches:_e,route:Fe,error:ue}}function Qe(re,ue,de){if(y=re,k=ue,b=de||null,!S&&j.navigation===n8){S=!0;let _e=qt(j.location,j.matches);_e!=null&&ce({restoreScrollPosition:_e})}return()=>{y=null,k=null,b=null}}function st(re,ue){return b&&b(re,ue.map(_e=>s7(_e,j.loaderData)))||re.key}function rt(re,ue){if(y&&k){let de=st(re,ue);y[de]=k()}}function qt(re,ue){if(y){let de=st(re,ue),_e=y[de];if(typeof _e=="number")return _e}return null}function Yt(re,ue,de){if(e.patchRoutesOnNavigation){let _e=u.branches;if(re){if(Object.keys(re[0].params).length>0)return{active:!0,matches:Ua(ue,de,f,!0,_e)}}else return{active:!0,matches:Ua(ue,de,f,!0,_e)||[]}}return{active:!1,matches:null}}async function an(re,ue,de,_e){if(!e.patchRoutesOnNavigation)return{type:"success",matches:re};let Fe=re;for(;;){let xt=l;try{await e.patchRoutesOnNavigation({signal:de,path:ue,matches:Fe,fetcherKey:_e,patch:(ht,je)=>{de.aborted||Rx(ht,je,u,xt,i,!1)}})}catch(ht){return{type:"error",error:ht,partialMatches:Fe}}if(de.aborted)return{type:"aborted"};let yt=u.branches,kt=Ua(u.activeRoutes,ue,f,!1,yt),ot=null;if(kt){if(Object.keys(kt[0].params).length===0)return{type:"success",matches:kt};if(ot=Ua(u.activeRoutes,ue,f,!0,yt),!(ot&&Fe.length<ot.length&&Wt(Fe,ot.slice(0,Fe.length))))return{type:"success",matches:kt}}if(ot||(ot=Ua(u.activeRoutes,ue,f,!0,yt)),!ot||Wt(Fe,ot))return{type:"success",matches:null};Fe=ot}}function Wt(re,ue){return re.length===ue.length&&re.every((de,_e)=>de.route.id===ue[_e].route.id)}function Mn(re){l={},u.setHmrRoutes(Q0(re,i,void 0,l))}function Bt(re,ue,de=!1){Rx(re,ue,u,l,i,de),u.hasHMRRoutes||ce({})}return M={get basename(){return f},get future(){return p},get state(){return j},get routes(){return u.stableRoutes},get branches(){return u.branches},get manifest(){return l},get window(){return t},initialize:X,subscribe:Le,enableScrollRestoration:Qe,navigate:Ze,fetch:We,revalidate:gt,createHref:re=>e.history.createHref(re),createURL:re=>e.history.createURL(re),encodeLocation:re=>e.history.encodeLocation(re),getFetcher:De,resetFetcher:Ge,deleteFetcher:bt,dispose:ae,getBlocker:Pt,deleteBlocker:Tt,patchRoutes:Bt,_internalFetchControllers:I,_internalSetRoutes:Mn,_internalSetStateDoNotUseOrYouWillBreakYourApp(re){ce(re)}},e.instrumentations&&(M=CD(M,e.instrumentations.map(re=>re.router).filter(Boolean))),M}function FD(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function A6(e,t,n,r,a,i){let l,u;if(a){l=[];for(let h of t)if(l.push(h),h.route.id===a){u=h;break}}else l=t,u=t[t.length-1];let f=Nf(r||".",om(l),sa(e.pathname,n)||e.pathname,i==="path");if(r==null&&(f.search=e.search,f.hash=e.hash),(r==null||r===""||r===".")&&u){let h=xv(f.search);if(u.route.index&&!h)f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&h){let p=new URLSearchParams(f.search),g=p.getAll("index");p.delete("index"),g.filter(w=>w).forEach(w=>p.append("index",w));let m=p.toString();f.search=m?`?${m}`:""}}return n!=="/"&&(f.pathname=wD({basename:n,pathname:f.pathname})),Es(f)}function Nx(e,t,n){if(!n||!FD(n))return{path:t};if(n.formMethod&&!aH(n.formMethod))return{path:t,error:ba(405,{method:n.formMethod})};let r=()=>({path:t,error:ba(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),l=C7(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!ls(i))return r();let g=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((m,[w,y])=>`${m}${w}=${y}
50
+ `,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:g}}}else if(n.formEncType==="application/json"){if(!ls(i))return r();try{let g=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:g,text:void 0}}}catch{return r()}}}fn(typeof FormData=="function","FormData is not available in this environment");let u,f;if(n.formData)u=R6(n.formData),f=n.formData;else if(n.body instanceof FormData)u=R6(n.body),f=n.body;else if(n.body instanceof URLSearchParams)u=n.body,f=Dx(u);else if(n.body==null)u=new URLSearchParams,f=new FormData;else try{u=new URLSearchParams(n.body),f=Dx(u)}catch{return r()}let h={formMethod:i,formAction:l,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(ls(h.formMethod))return{path:t,submission:h};let p=Oo(t);return e&&p.search&&xv(p.search)&&u.append("index",""),p.search=`?${u}`,{path:Es(p),submission:h}}function Mx(e,t,n,r,a,i,l,u,f,h,p,g,m,w,y,b,k,S,E,C,A,L){var K;let T=A?ea(A[1])?A[1].error:A[1].data:void 0,M=a.createURL(i.location),j=a.createURL(f),P;if(p&&i.errors){let O=Object.keys(i.errors)[0];P=l.findIndex(F=>F.route.id===O)}else if(A&&ea(A[1])){let O=A[0];P=l.findIndex(F=>F.route.id===O)-1}let R=A?A[1].statusCode:void 0,H=R&&R>=400,D={currentUrl:M,currentParams:((K=i.matches[0])==null?void 0:K.params)||{},nextUrl:j,nextParams:l[0].params,...u,actionResult:T,actionStatus:R},B=Rf(l),V=l.map((O,F)=>{let{route:I}=O,G=null;if(P!=null&&F>P)G=!1;else if(I.lazy)G=!0;else if(!yv(I))G=!1;else if(p){let{shouldLoad:ee}=w7(I,i.loaderData,i.errors);G=ee}else _D(i.loaderData,i.matches[F],O)&&(G=!0);if(G!==null)return N6(n,r,e,f,B,O,h,t,G);let z=!1;typeof L=="boolean"?z=L:H?z=!1:(g||M.pathname+M.search===j.pathname+j.search||M.search!==j.search||VD(i.matches[F],O))&&(z=!0);let Y={...D,defaultShouldRevalidate:z},Z=_0(O,Y);return N6(n,r,e,f,B,O,h,t,Z,Y,L)}),U=[];return y.forEach((O,F)=>{if(p||!l.some(se=>se.route.id===O.routeId)||w.has(F))return;let I=i.fetchers.get(F),G=I&&I.state!=="idle"&&I.data===void 0,z=Ua(k,O.path,S??"/",!1,C);if(!z){if(E&&G)return;U.push({key:F,routeId:O.routeId,path:O.path,matches:null,match:null,request:null,controller:null});return}if(b.has(F))return;let Y=qh(z,O.path),Z=new AbortController,ee=Fu(a,O.path,Z.signal),pe=null;if(m.has(F))m.delete(F),pe=Qu(n,r,ee,O.path,z,Y,h,t);else if(G)g&&(pe=Qu(n,r,ee,O.path,z,Y,h,t));else{let se;typeof L=="boolean"?se=L:H?se=!1:se=g;let xe={...D,defaultShouldRevalidate:se};_0(Y,xe)&&(pe=Qu(n,r,ee,O.path,z,Y,h,t,xe))}pe&&U.push({key:F,routeId:O.routeId,path:O.path,matches:pe,match:Y,request:ee,controller:Z})}),{dsMatches:V,revalidatingFetchers:U}}function yv(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function w7(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!yv(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,a=n!=null&&n[e.id]!==void 0;if(!r&&a)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let i=!r&&!a;return{shouldLoad:i,renderFallback:i}}function _D(e,t,n){let r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a}function VD(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function _0(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Rx(e,t,n,r,a,i){let l;if(e){let h=r[e];fn(h,`No route found to patch children into: routeId = ${e}`),h.children||(h.children=[]),l=h.children}else l=n.activeRoutes;let u=[],f=[];if(t.forEach(h=>{let p=l.find(g=>y7(h,g));p?f.push({existingRoute:p,newRoute:h}):u.push(h)}),u.length>0){let h=Q0(u,a,[e||"_","patch",String((l==null?void 0:l.length)||"0")],r);l.push(...h)}if(i&&f.length>0)for(let h=0;h<f.length;h++){let{existingRoute:p,newRoute:g}=f[h],m=p,[w]=Q0([g],a,[],{},!0);Object.assign(m,{element:w.element?w.element:m.element,errorElement:w.errorElement?w.errorElement:m.errorElement,hydrateFallbackElement:w.hydrateFallbackElement?w.hydrateFallbackElement:m.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function y7(e,t){var n;return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:((n=e.children)==null?void 0:n.every((r,a)=>{var i;return(i=t.children)==null?void 0:i.some(l=>y7(r,l))}))??!1:!1}var Px=new WeakMap,b7=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let a=n[t.id];if(fn(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let i=a.lazy[e];if(!i)return;let l=Px.get(a);l||(l={},Px.set(a,l));let u=l[e];if(u)return u;let f=(async()=>{let h=sD(e),g=a[e]!==void 0&&e!=="hasErrorBoundary";if(h)nr(!h,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),l[e]=Promise.resolve();else if(g)nr(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let m=await i();m!=null&&(Object.assign(a,{[e]:m}),Object.assign(a,r(a)))}typeof a.lazy=="object"&&(a.lazy[e]=void 0,Object.values(a.lazy).every(m=>m===void 0)&&(a.lazy=void 0))})();return l[e]=f,f},Lx=new WeakMap;function ZD(e,t,n,r,a){let i=n[e.id];if(fn(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=Lx.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let g=(async()=>{fn(typeof e.lazy=="function","No lazy route function found");let m=await e.lazy(),w={};for(let y in m){let b=m[y];if(b===void 0)continue;let k=oD(y),E=i[y]!==void 0&&y!=="hasErrorBoundary";k?nr(!k,"Route property "+y+" is not a supported property to be returned from a lazy route function. This property will be ignored."):E?nr(!E,`Route "${i.id}" has a static property "${y}" defined but its lazy function is also returning a value for this property. The lazy route property "${y}" will be ignored.`):w[y]=b}Object.assign(i,w),Object.assign(i,{...r(i),lazy:void 0})})();return Lx.set(i,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let l=Object.keys(e.lazy),u=[],f;for(let p of l){if(a&&a.includes(p))continue;let g=b7({key:p,route:e,manifest:n,mapRouteProperties:r});g&&(u.push(g),p===t&&(f=g))}let h=u.length>0?Promise.all(u).then(()=>{}):void 0;return h==null||h.catch(()=>{}),f==null||f.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:f}}async function $x(e){let t=e.matches.filter(a=>a.shouldLoad),n={};return(await Promise.all(t.map(a=>a.resolve()))).forEach((a,i)=>{n[t[i].route.id]=a}),n}async function zD(e){return e.matches.some(t=>t.route.middleware)?x7(e,()=>$x(e)):$x(e)}function x7(e,t){return BD(e,t,r=>{if(sH(r))throw r;return r},eH,n);function n(r,a,i){if(i)return Promise.resolve(Object.assign(i.value,{[a]:{type:"error",result:r}}));{let{matches:l}=e,u=Math.min(Math.max(l.findIndex(h=>h.route.id===a),0),Math.max(l.findIndex(h=>h.shouldCallHandler()),0)),f=al(l,l[u].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function BD(e,t,n,r,a){let{matches:i,...l}=e,u=i.flatMap(h=>h.route.middleware?h.route.middleware.map(p=>[h.route.id,p]):[]);return await k7(l,u,t,n,r,a)}async function k7(e,t,n,r,a,i,l=0){let{request:u}=e;if(u.signal.aborted)throw u.signal.reason??new Error(`Request aborted: ${u.method} ${u.url}`);let f=t[l];if(!f)return await n();let[h,p]=f,g,m=async()=>{if(g)throw new Error("You may only call `next()` once per middleware");try{return g={value:await k7(e,t,n,r,a,i,l+1)},g.value}catch(w){return g={value:await i(w,h,g)},g.value}};try{let w=await p(e,m),y=w!=null?r(w):void 0;return a(y)?y:g?y??g.value:(g={value:await m()},g.value)}catch(w){return await i(w,h,g)}}function S7(e,t,n,r,a){let i=b7({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),l=ZD(r.route,ls(n.method)?"action":"loader",t,e,a);return{middleware:i,route:l.lazyRoutePromise,handler:l.lazyHandlerPromise}}function N6(e,t,n,r,a,i,l,u,f,h=null,p){let g=!1,m=S7(e,t,n,i,l);return{...i,_lazyPromises:m,shouldLoad:f,shouldRevalidateArgs:h,shouldCallHandler(w){return g=!0,h?typeof p=="boolean"?_0(i,{...h,defaultShouldRevalidate:p}):typeof w=="boolean"?_0(i,{...h,defaultShouldRevalidate:w}):_0(i,h):f},resolve(w){let{lazy:y,loader:b,middleware:k}=i.route,S=g||f||w&&!ls(n.method)&&(y||b),E=k&&k.length>0&&!b&&!y;return S&&(ls(n.method)||!E)?WD({request:n,path:r,pattern:a,match:i,lazyHandlerPromise:m==null?void 0:m.handler,lazyRoutePromise:m==null?void 0:m.route,handlerOverride:w,scopedContext:u}):Promise.resolve({type:"data",result:void 0})}}}function Qu(e,t,n,r,a,i,l,u,f=null){return a.map(h=>h.route.id!==i.route.id?{...h,shouldLoad:!1,shouldRevalidateArgs:f,shouldCallHandler:()=>!1,_lazyPromises:S7(e,t,n,h,l),resolve:()=>Promise.resolve({type:"data",result:void 0})}:N6(e,t,n,r,Rf(a),h,l,u,!0,f))}async function UD(e,t,n,r,a,i,l){r.some(p=>{var g;return(g=p._lazyPromises)==null?void 0:g.middleware})&&await Promise.all(r.map(p=>{var g;return(g=p._lazyPromises)==null?void 0:g.middleware}));let u={request:t,url:E7(t,n),pattern:Rf(r),params:r[0].params,context:i,matches:r},h=await e({...u,fetcherKey:a,runClientMiddleware:p=>{let g=u;return x7(g,()=>p({...g,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(p=>{var g,m;return[(g=p._lazyPromises)==null?void 0:g.handler,(m=p._lazyPromises)==null?void 0:m.route]}))}catch{}return h}async function WD({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:i,handlerOverride:l,scopedContext:u}){let f,h,p=ls(e.method),g=p?"action":"loader",m=w=>{let y,b=new Promise((E,C)=>y=C);h=()=>y(),e.signal.addEventListener("abort",h);let k=E=>typeof w!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${g}" [routeId: ${r.route.id}]`)):w({request:e,url:E7(e,t),pattern:n,params:r.params,context:u},...E!==void 0?[E]:[]),S=(async()=>{try{return{type:"data",result:await(l?l(C=>k(C)):k())}}catch(E){return{type:"error",result:E}}})();return Promise.race([S,b])};try{let w=p?r.route.action:r.route.loader;if(a||i)if(w){let y,[b]=await Promise.all([m(w).catch(k=>{y=k}),a,i]);if(y!==void 0)throw y;f=b}else{await a;let y=p?r.route.action:r.route.loader;if(y)[f]=await Promise.all([m(y),i]);else if(g==="action"){let b=new URL(e.url),k=b.pathname+b.search;throw ba(405,{method:e.method,pathname:k,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(w)f=await m(w);else{let y=new URL(e.url),b=y.pathname+y.search;throw ba(404,{pathname:b})}}catch(w){return{type:"error",result:w}}finally{h&&e.signal.removeEventListener("abort",h)}return f}async function KD(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function GD(e){var r,a,i,l,u;let{result:t,type:n}=e;if(bv(t)){let f;try{f=await KD(t)}catch(h){return{type:"error",error:h}}return n==="error"?{type:"error",error:new Mf(t.status,t.statusText,f),statusCode:t.status,headers:t.headers}:{type:"data",data:f,statusCode:t.status,headers:t.headers}}return n==="error"?Fx(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:(r=t.init)==null?void 0:r.status,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}:{type:"error",error:JD(t),statusCode:J0(t)?t.status:void 0,headers:(i=t.init)!=null&&i.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:J0(t)?t.status:void 0}:Fx(t)?{type:"data",data:t.data,statusCode:(l=t.init)==null?void 0:l.status,headers:(u=t.init)!=null&&u.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function YD(e,t,n,r,a){let i=e.headers.get("Location");if(fn(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!gv(i)){let l=r.slice(0,r.findIndex(u=>u.route.id===n)+1);i=A6(new URL(t.url),l,a,i),e.headers.set("Location",i)}return e}var qD=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function M6(e){try{return qD.includes(new URL(e).protocol)}catch{return!1}}function Tx(e,t,n,r){if(gv(e)){let a=e,i=am.test(a)?new URL(t7(a,t.protocol)):new URL(a);if(M6(i.toString()))throw new Error("Invalid redirect location");let l=sa(i.pathname,n)!=null;if(i.origin===t.origin&&l)return vv(i.pathname)+i.search+i.hash}try{let a=r.createURL(e);if(M6(a.toString()))throw new Error("Invalid redirect location")}catch{}return e}function Fu(e,t,n,r){let a=e.createURL(C7(t)).toString(),i={signal:n};if(r&&ls(r.formMethod)){let{formMethod:l,formEncType:u}=r;i.method=l.toUpperCase(),u==="application/json"?(i.headers=new Headers({"Content-Type":u}),i.body=JSON.stringify(r.json)):u==="text/plain"?i.body=r.text:u==="application/x-www-form-urlencoded"&&r.formData?i.body=R6(r.formData):i.body=r.formData}return new Request(a,i)}function E7(e,t){let n=new URL(e.url),r=typeof t=="string"?Oo(t):t;if(n.pathname=r.pathname||"/",r.search){let a=new URLSearchParams(r.search),i=a.getAll("index");a.delete("index");for(let l of i.filter(Boolean))a.append("index",l);n.search=a.size?`?${a.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function R6(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Dx(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function XD(e,t,n,r=!1,a=!1){let i={},l=null,u,f=!1,h={},p=n&&ea(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let m=g.route.id,w=t[m];if(fn(!wc(w),"Cannot handle redirect results in processLoaderData"),ea(w)){let y=w.error;if(p!==void 0&&(y=p,p=void 0),l=l||{},a)l[m]=y;else{let b=al(e,m);l[b.route.id]==null&&(l[b.route.id]=y)}r||(i[m]=v7),f||(f=!0,u=J0(w.error)?w.error.status:500),w.headers&&(h[m]=w.headers)}else i[m]=w.data,w.statusCode&&w.statusCode!==200&&!f&&(u=w.statusCode),w.headers&&(h[m]=w.headers)}),p!==void 0&&n&&(l={[n[0]]:p},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:l,statusCode:u||200,loaderHeaders:h}}function Hx(e,t,n,r,a,i,l){let{loaderData:u,errors:f}=XD(t,n,r);return a.filter(h=>!h.matches||h.matches.some(p=>p.shouldLoad)).forEach(h=>{let{key:p,match:g,controller:m}=h;if(m&&m.signal.aborted)return;let w=i[p];if(fn(w,"Did not find corresponding fetcher result"),ea(w)){let y=al(e.matches,g==null?void 0:g.route.id);f&&f[y.route.id]||(f={...f,[y.route.id]:w.error}),l.delete(p)}else if(wc(w))fn(!1,"Unhandled fetcher revalidation redirect");else{let y=xo(w.data);l.set(p,y)}}),{loaderData:u,errors:f}}function Ox(e,t,n,r){let a=Object.entries(t).filter(([,i])=>i!==v7).reduce((i,[l,u])=>(i[l]=u,i),{});for(let i of n){let l=i.route.id;if(!t.hasOwnProperty(l)&&e.hasOwnProperty(l)&&i.route.loader&&(a[l]=e[l]),r&&r.hasOwnProperty(l))break}return a}function Ix(e){return e?ea(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function al(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function vh(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ba(e,{pathname:t,routeId:n,method:r,type:a,message:i}={}){let l="Unknown Server Error",u="Unknown @remix-run/router error";return e===400?(l="Bad Request",r&&t&&n?u=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:a==="invalid-body"&&(u="Unable to encode submission body")):e===403?(l="Forbidden",u=`Route "${n}" does not match URL "${t}"`):e===404?(l="Not Found",u=`No route matches URL "${t}"`):e===405&&(l="Method Not Allowed",r&&t&&n?u=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(u=`Invalid request method "${r.toUpperCase()}"`)),new Mf(e||500,l,new Error(u),!0)}function wh(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(wc(a))return{key:r,result:a}}}function C7(e){let t=typeof e=="string"?Oo(e):e;return Es({...t,hash:""})}function QD(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function JD(e){var t,n;return new Mf(((t=e.init)==null?void 0:t.status)??500,((n=e.init)==null?void 0:n.statusText)??"Internal Server Error",e.data)}function eH(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&tH(n))}function tH(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function nH(e){return bv(e.result)&&m7.has(e.result.status)}function ea(e){return e.type==="error"}function wc(e){return(e&&e.type)==="redirect"}function Fx(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function bv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function rH(e){return m7.has(e)}function sH(e){return bv(e)&&rH(e.status)&&e.headers.has("Location")}function aH(e){return $D.has(e.toUpperCase())}function ls(e){return PD.has(e.toUpperCase())}function xv(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function qh(e,t){let n=typeof t=="string"?Oo(t).search:t.search;if(e[e.length-1].route.index&&xv(n||""))return e[e.length-1];let r=u7(e);return r[r.length-1]}function _x(e){let{formMethod:t,formAction:n,formEncType:r,text:a,formData:i,json:l}=e;if(!(!t||!n||!r)){if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(l!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:l,text:void 0}}}function r8(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function oH(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function m0(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function iH(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function xo(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function lH(e,t){try{let n=e.sessionStorage.getItem(g7);if(n){let r=JSON.parse(n);for(let[a,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function cH(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(g7,JSON.stringify(n))}catch(r){nr(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function Vx(){let e,t,n=new Promise((r,a)=>{e=async i=>{r(i);try{await n}catch{}},t=async i=>{a(i);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var _c=s.createContext(null);_c.displayName="DataRouter";var Cd=s.createContext(null);Cd.displayName="DataRouterState";var j7=s.createContext(!1);function A7(){return s.useContext(j7)}var kv=s.createContext({isTransitioning:!1});kv.displayName="ViewTransition";var N7=s.createContext(new Map);N7.displayName="Fetchers";var uH=s.createContext(null);uH.displayName="Await";var Rs=s.createContext(null);Rs.displayName="Navigation";var im=s.createContext(null);im.displayName="Location";var La=s.createContext({outlet:null,matches:[],isDataRoute:!1});La.displayName="Route";var Sv=s.createContext(null);Sv.displayName="RouteError";var M7="REACT_ROUTER_ERROR",dH="REDIRECT",fH="ROUTE_ERROR_RESPONSE";function hH(e){if(e.startsWith(`${M7}:${dH}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function pH(e){if(e.startsWith(`${M7}:${fH}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Mf(t.status,t.statusText,t.data)}catch{}}function mH(e,{relative:t}={}){fn(Vc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=s.useContext(Rs),{hash:a,pathname:i,search:l}=Pf(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:Aa([n,i])),r.createHref({pathname:u,search:l,hash:a})}function Vc(){return s.useContext(im)!=null}function Un(){return fn(Vc(),"useLocation() may be used only in the context of a <Router> component."),s.useContext(im).location}function mn(e){fn(Vc(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Un();return s.useMemo(()=>yl(e,c7(t)),[t,e])}var R7="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function P7(e){s.useContext(Rs).static||s.useLayoutEffect(e)}function Bn(){let{isDataRoute:e}=s.useContext(La);return e?MH():gH()}function gH(){fn(Vc(),"useNavigate() may be used only in the context of a <Router> component.");let e=s.useContext(_c),{basename:t,navigator:n}=s.useContext(Rs),{matches:r}=s.useContext(La),{pathname:a}=Un(),i=JSON.stringify(om(r)),l=s.useRef(!1);return P7(()=>{l.current=!0}),s.useCallback((f,h={})=>{if(nr(l.current,R7),!l.current)return;if(typeof f=="number"){n.go(f);return}let p=Nf(f,JSON.parse(i),a,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Aa([t,p.pathname])),Xu(typeof f=="string"?f:Es(f),n.createHref(p),wv(n),"reject"),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,i,a,e])}var L7=s.createContext(null);function vH(){return s.useContext(L7)}function wH(e){let t=s.useContext(La).outlet;return s.useMemo(()=>t&&s.createElement(L7.Provider,{value:e},t),[t,e])}function aa(){let{matches:e}=s.useContext(La),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Pf(e,{relative:t}={}){let{matches:n}=s.useContext(La),{pathname:r}=Un(),a=JSON.stringify(om(n));return s.useMemo(()=>Nf(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function yH(e,t,n){fn(Vc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=s.useContext(Rs),{matches:a}=s.useContext(La),i=a[a.length-1],l=i?i.params:{},u=i?i.pathname:"/",f=i?i.pathnameBase:"/",h=i&&i.route;{let k=h&&h.path||"";H7(u,!h||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
51
+
52
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let p=Un(),g;g=p;let m=g.pathname||"/",w=m;if(f!=="/"){let k=f.replace(/^\//,"").split("/");w="/"+m.replace(/^\//,"").split("/").slice(k.length).join("/")}let y=n&&n.state.matches.length?n.state.matches.map(k=>Object.assign(k,{route:n.manifest[k.route.id]||k.route})):r7(e,{pathname:w});return nr(h||y!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),nr(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),EH(y&&y.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Aa([f,r.encodeLocation?r.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:Aa([f,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n)}function bH(){let e=D7(),t=J0(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=s.createElement(s.Fragment,null,s.createElement("p",null,"💿 Hey developer 👋"),s.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",s.createElement("code",{style:i},"ErrorBoundary")," or"," ",s.createElement("code",{style:i},"errorElement")," prop on your route.")),s.createElement(s.Fragment,null,s.createElement("h2",null,"Unexpected Application Error!"),s.createElement("h3",{style:{fontStyle:"italic"}},t),n?s.createElement("pre",{style:a},n):null,l)}var xH=s.createElement(bH,null),$7=class extends s.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=pH(e.digest);n&&(e=n)}let t=e!==void 0?s.createElement(La.Provider,{value:this.props.routeContext},s.createElement(Sv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?s.createElement(kH,{error:e},t):t}};$7.contextType=j7;var s8=new WeakMap;function kH({children:e,error:t}){let{basename:n,navigator:r}=s.useContext(Rs);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=hH(t.digest);if(a){let i=s8.get(t);if(i)throw i;let l=f7(a.location,n),u=l.absoluteURL||l.to;if(Xu(a.location,u,wv(r),"allow-explicit"),M6(u))throw new Error("Invalid redirect location");if(d7&&!s8.get(t))if(l.isExternal||a.reloadDocument)window.location.href=u;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:a.replace}));throw s8.set(t,f),f}return s.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function SH({routeContext:e,match:t,children:n}){let r=s.useContext(_c);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),s.createElement(La.Provider,{value:e},n)}function EH(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,i=r==null?void 0:r.errors;if(i!=null){let p=a.findIndex(g=>g.route.id&&(i==null?void 0:i[g.route.id])!==void 0);fn(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,p+1))}let l=!1,u=-1;if(n&&r){l=r.renderFallback;for(let p=0;p<a.length;p++){let g=a[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=p),g.route.id){let{loaderData:m,errors:w}=r,y=g.route.loader&&!m.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||y){n.isStatic&&(l=!0),u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}}let f=n==null?void 0:n.onError,h=r&&f?(p,g)=>{var m,w;f(p,{location:r.location,params:((w=(m=r.matches)==null?void 0:m[0])==null?void 0:w.params)??{},pattern:Rf(r.matches),errorInfo:g})}:void 0;return a.reduceRight((p,g,m)=>{let w,y=!1,b=null,k=null;r&&(w=i&&g.route.id?i[g.route.id]:void 0,b=g.route.errorElement||xH,l&&(u<0&&m===0?(H7("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,k=null):u===m&&(y=!0,k=g.route.hydrateFallbackElement||null)));let S=t.concat(a.slice(0,m+1)),E=()=>{let C;return w?C=b:y?C=k:g.route.Component?C=s.createElement(g.route.Component,null):g.route.element?C=g.route.element:C=p,s.createElement(SH,{match:g,routeContext:{outlet:p,matches:S,isDataRoute:r!=null},children:C})};return r&&(g.route.ErrorBoundary||g.route.errorElement||m===0)?s.createElement($7,{location:r.location,revalidation:r.revalidation,component:b,error:w,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):E()},null)}function Ev(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function CH(e){let t=s.useContext(_c);return fn(t,Ev(e)),t}function Cv(e){let t=s.useContext(Cd);return fn(t,Ev(e)),t}function jH(e){let t=s.useContext(La);return fn(t,Ev(e)),t}function jv(e){let t=jH(e),n=t.matches[t.matches.length-1];return fn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function AH(){return jv("useRouteId")}function NH(){let e=Cv("useNavigation");return s.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function T7(){let{matches:e,loaderData:t}=Cv("useMatches");return s.useMemo(()=>e.map(n=>s7(n,t)),[e,t])}function D7(){var r;let e=s.useContext(Sv),t=Cv("useRouteError"),n=jv("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function MH(){let{router:e}=CH("useNavigate"),t=jv("useNavigate"),n=s.useRef(!1);return P7(()=>{n.current=!0}),s.useCallback(async(a,i={})=>{nr(n.current,R7),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var Zx={};function H7(e,t,n){!t&&!Zx[e]&&(Zx[e]=!0,nr(!1,n))}var zx={};function Bx(e,t){!e&&!zx[t]&&(zx[t]=!0,console.warn(t))}var RH="useOptimistic",Ux=Fc[RH],PH=()=>{};function LH(e){return Ux?Ux(e):[e,PH]}function $H(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&nr(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:s.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&nr(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:s.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&nr(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:s.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var TH=["HydrateFallback","hydrateFallbackElement"],DH=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function HH({router:e,flushSync:t,onError:n,useTransitions:r}){r=A7()||r;let[i,l]=s.useState(e.state),[u,f]=LH(i),[h,p]=s.useState(),[g,m]=s.useState({isTransitioning:!1}),[w,y]=s.useState(),[b,k]=s.useState(),[S,E]=s.useState(),C=s.useRef(new Map),A=s.useCallback((j,{deletedFetchers:P,newErrors:R,flushSync:H,viewTransitionOpts:D})=>{R&&n&&Object.values(R).forEach(V=>{var U;return n(V,{location:j.location,params:((U=j.matches[0])==null?void 0:U.params)??{},pattern:Rf(j.matches)})}),j.fetchers.forEach((V,U)=>{V.data!==void 0&&C.current.set(U,V.data)}),P.forEach(V=>C.current.delete(V)),Bx(H===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let B=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(Bx(D==null||B,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!D||!B){t&&H?t(()=>l(j)):r===!1?l(j):s.startTransition(()=>{r===!0&&f(V=>Wx(V,j)),l(j)});return}if(t&&H){t(()=>{b&&(w==null||w.resolve(),b.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:D.currentLocation,nextLocation:D.nextLocation})});let V=e.window.document.startViewTransition(()=>{t(()=>l(j))});V.finished.finally(()=>{t(()=>{y(void 0),k(void 0),p(void 0),m({isTransitioning:!1})})}),t(()=>k(V));return}b?(w==null||w.resolve(),b.skipTransition(),E({state:j,currentLocation:D.currentLocation,nextLocation:D.nextLocation})):(p(j),m({isTransitioning:!0,flushSync:!1,currentLocation:D.currentLocation,nextLocation:D.nextLocation}))},[e.window,t,b,w,r,f,n]);s.useLayoutEffect(()=>e.subscribe(A),[e,A]),s.useEffect(()=>{g.isTransitioning&&!g.flushSync&&y(new DH)},[g]),s.useEffect(()=>{if(w&&h&&e.window){let j=h,P=w.promise,R=e.window.document.startViewTransition(async()=>{r===!1?l(j):s.startTransition(()=>{r===!0&&f(H=>Wx(H,j)),l(j)}),await P});R.finished.finally(()=>{y(void 0),k(void 0),p(void 0),m({isTransitioning:!1})}),k(R)}},[h,w,e.window,r,f]),s.useEffect(()=>{w&&h&&u.location.key===h.location.key&&w.resolve()},[w,b,u.location,h]),s.useEffect(()=>{!g.isTransitioning&&S&&(p(S.state),m({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),E(void 0))},[g.isTransitioning,S]);let L=s.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:j=>e.navigate(j),push:(j,P,R)=>e.navigate(j,{state:P,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(j,P,R)=>e.navigate(j,{replace:!0,state:P,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[e]),T=e.basename||"/",M=s.useMemo(()=>({router:e,navigator:L,static:!1,basename:T,onError:n}),[e,L,T,n]);return s.createElement(s.Fragment,null,s.createElement(_c.Provider,{value:M},s.createElement(Cd.Provider,{value:u},s.createElement(N7.Provider,{value:C.current},s.createElement(kv.Provider,{value:g},s.createElement(FH,{basename:T,location:u.location,navigationType:u.historyAction,navigator:L,useTransitions:r},s.createElement(OH,{routes:e.routes,manifest:e.manifest,future:e.future,state:u,isStatic:!1,onError:n})))))),null)}function Wx(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var OH=s.memo(IH);function IH({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:i}){return yH(e,void 0,{manifest:t,state:r,isStatic:a,onError:i})}function Ja({to:e,replace:t,state:n,relative:r}){fn(Vc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a,navigator:i}=s.useContext(Rs);nr(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=s.useContext(La),{pathname:u}=Un(),f=Bn(),h=Nf(e,om(l),u,r==="path");Xu(typeof e=="string"?e:Es(e),i.createHref(h),wv(i),"reject");let p=JSON.stringify(h);return s.useEffect(()=>{f(JSON.parse(p),{replace:t,state:n,relative:r})},[f,p,r,t,n]),null}function Zc(e){return wH(e.context)}function FH({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,useTransitions:l}){fn(!Vc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),f=s.useMemo(()=>({basename:u,navigator:a,static:i,useTransitions:l,future:{}}),[u,a,i,l]);typeof n=="string"&&(n=Oo(n));let{pathname:h="/",search:p="",hash:g="",state:m=null,key:w="default",mask:y}=n,b=s.useMemo(()=>{let k=sa(h,u);return k==null?null:{location:{pathname:k,search:p,hash:g,state:m,key:w,mask:y},navigationType:r}},[u,h,p,g,m,w,r,y]);return nr(b!=null,`<Router basename="${u}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),b==null?null:s.createElement(Rs.Provider,{value:f},s.createElement(im.Provider,{children:t,value:b}))}var Xh="get",Qh="application/x-www-form-urlencoded";function lm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function _H(e){return lm(e)&&e.tagName.toLowerCase()==="button"}function VH(e){return lm(e)&&e.tagName.toLowerCase()==="form"}function ZH(e){return lm(e)&&e.tagName.toLowerCase()==="input"}function zH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function BH(e,t){return e.button===0&&(!t||t==="_self")&&!zH(e)}function P6(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function UH(e,t){let n=P6(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}var yh=null;function WH(){if(yh===null)try{new FormData(document.createElement("form"),0),yh=!1}catch{yh=!0}return yh}var KH=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function a8(e){return e!=null&&!KH.has(e)?(nr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qh}"`),null):e}function GH(e,t){let n,r,a,i,l;if(VH(e)){let u=e.getAttribute("action");r=u?sa(u,t):null,n=e.getAttribute("method")||Xh,a=a8(e.getAttribute("enctype"))||Qh,i=new FormData(e)}else if(_H(e)||ZH(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||u.getAttribute("action");if(r=f?sa(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Xh,a=a8(e.getAttribute("formenctype"))||a8(u.getAttribute("enctype"))||Qh,i=new FormData(u,e),!WH()){let{name:h,type:p,value:g}=e;if(p==="image"){let m=h?`${h}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else h&&i.append(h,g)}}else{if(lm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Xh,r=null,a=Qh,l=e}return i&&a==="text/plain"&&(l=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var YH={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},qH=/[&><\u2028\u2029]/g;function Kx(e){return e.replace(qH,t=>YH[t])}function Av(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function O7(e,t,n,r){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:t&&sa(a.pathname,t)==="/"?a.pathname=`${fd(t)}/_root.${r}`:a.pathname=`${fd(a.pathname)}.${r}`,a}async function XH(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function QH(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function JH(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let l=await XH(i,n);return l.links?l.links():[]}return[]}));return rO(r.flat(1).filter(QH).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Gx(e,t,n,r,a,i){let l=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,u=(f,h)=>{var p;return n[h].pathname!==f.pathname||((p=n[h].route.path)==null?void 0:p.endsWith("*"))&&n[h].params["*"]!==f.params["*"]};return i==="assets"?t.filter((f,h)=>l(f,h)||u(f,h)):i==="data"?t.filter((f,h)=>{var g;let p=r.routes[f.route.id];if(!p||!p.hasLoader)return!1;if(l(f,h)||u(f,h))return!0;if(f.route.shouldRevalidate){let m=f.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function eO(e,t,{includeHydrateFallback:n}={}){return tO(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function tO(e){return[...new Set(e)]}function nO(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function rO(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(nO(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function Nv(){let e=s.useContext(_c);return Av(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function sO(){let e=s.useContext(Cd);return Av(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var cm=s.createContext(void 0);cm.displayName="FrameworkContext";function um(){let e=s.useContext(cm);return Av(e,"You must render this element inside a <HydratedRouter> element"),e}function aO(e,t){let n=s.useContext(cm),[r,a]=s.useState(!1),[i,l]=s.useState(!1),{onFocus:u,onBlur:f,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,m=s.useRef(null);s.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let b=S=>{S.forEach(E=>{l(E.isIntersecting)})},k=new IntersectionObserver(b,{threshold:.5});return m.current&&k.observe(m.current),()=>{k.disconnect()}}},[e]),s.useEffect(()=>{if(r){let b=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(b)}}},[r]);let w=()=>{a(!0)},y=()=>{a(!1),l(!1)};return n?e!=="intent"?[i,m,{}]:[i,m,{onFocus:g0(u,w),onBlur:g0(f,y),onMouseEnter:g0(h,w),onMouseLeave:g0(p,y),onTouchStart:g0(g,w)}]:[!1,m,{}]}function g0(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function oO({page:e,...t}){let n=A7(),{nonce:r}=um(),{router:a}=Nv(),i=s.useMemo(()=>r7(a.routes,e,a.basename),[a.routes,e,a.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?s.createElement(lO,{page:e,matches:i,...t}):s.createElement(cO,{page:e,matches:i,...t})):null}function iO(e){let{manifest:t,routeModules:n}=um(),[r,a]=s.useState([]);return s.useEffect(()=>{let i=!1;return JH(e,t,n).then(l=>{i||a(l)}),()=>{i=!0}},[e,t,n]),r}function lO({page:e,matches:t,...n}){let r=Un(),{future:a}=um(),{basename:i}=Nv(),l=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let u=O7(e,i,a.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,h=[];for(let p of t)typeof p.route.shouldRevalidate=="function"?f=!0:h.push(p.route.id);return f&&h.length>0&&u.searchParams.set("_routes",h.join(",")),[u.pathname+u.search]},[i,a.v8_trailingSlashAwareDataRequests,e,r,t]);return s.createElement(s.Fragment,null,l.map(u=>s.createElement("link",{key:u,rel:"prefetch",as:"fetch",href:u,...n})))}function cO({page:e,matches:t,...n}){let r=Un(),{future:a,manifest:i,routeModules:l}=um(),{basename:u}=Nv(),{loaderData:f,matches:h}=sO(),p=s.useMemo(()=>Gx(e,t,h,i,r,"data"),[e,t,h,i,r]),g=s.useMemo(()=>Gx(e,t,h,i,r,"assets"),[e,t,h,i,r]),m=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let b=new Set,k=!1;if(t.forEach(E=>{var A;let C=i.routes[E.route.id];!C||!C.hasLoader||(!p.some(L=>L.route.id===E.route.id)&&E.route.id in f&&((A=l[E.route.id])!=null&&A.shouldRevalidate)||C.hasClientLoader?k=!0:b.add(E.route.id))}),b.size===0)return[];let S=O7(e,u,a.v8_trailingSlashAwareDataRequests,"data");return k&&b.size>0&&S.searchParams.set("_routes",t.filter(E=>b.has(E.route.id)).map(E=>E.route.id).join(",")),[S.pathname+S.search]},[u,a.v8_trailingSlashAwareDataRequests,f,r,i,p,t,e,l]),w=s.useMemo(()=>eO(g,i),[g,i]),y=iO(g);return s.createElement(s.Fragment,null,m.map(b=>s.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),w.map(b=>s.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),y.map(({key:b,link:k})=>s.createElement("link",{key:b,nonce:n.nonce,...k,crossOrigin:k.crossOrigin??n.crossOrigin})))}function uO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var dO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{dO&&(window.__reactRouterVersion="7.18.3")}catch{}function fO(e,t){return ID({basename:t==null?void 0:t.basename,getContext:t==null?void 0:t.getContext,future:t==null?void 0:t.future,history:eD({window:t==null?void 0:t.window}),hydrationData:hO(),routes:e,mapRouteProperties:$H,hydrationRouteProperties:TH,dataStrategy:t==null?void 0:t.dataStrategy,patchRoutesOnNavigation:t==null?void 0:t.patchRoutesOnNavigation,window:t==null?void 0:t.window,instrumentations:t==null?void 0:t.instrumentations}).initialize()}function hO(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:pO(e.errors)}),e}function pO(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,a]of t)if(a&&a.__type==="RouteErrorResponse")n[r]=new Mf(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(typeof a.__subType=="string"&&SD.includes(a.__subType)){let i=window[a.__subType];if(typeof i=="function")try{let l=new i(a.message);l.stack="",n[r]=l}catch{}}if(n[r]==null){let i=new Error(a.message);i.stack="",n[r]=i}}else n[r]=a;return n}var Vn=s.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:i,replace:l,mask:u,state:f,target:h,to:p,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:w,...y},b){let{basename:k,navigator:S,useTransitions:E}=s.useContext(Rs),C=typeof p=="string"&&sm.test(p),A=f7(p,k);p=A.to;let L=mH(p,{relative:a}),T=Un(),M=null;if(u){let U=Nf(u,[],T.mask?T.mask.pathname:"/",!0);k!=="/"&&(U.pathname=U.pathname==="/"?k:Aa([k,U.pathname])),M=S.createHref(U)}let[j,P,R]=aO(r,y),H=wO(p,{replace:l,mask:u,state:f,target:h,preventScrollReset:g,relative:a,viewTransition:m,defaultShouldRevalidate:w,useTransitions:E});function D(U){t&&t(U),U.defaultPrevented||H(U)}let B=!(A.isExternal||i),V=s.createElement("a",{...y,...R,href:(B?M:void 0)||A.absoluteURL||L,onClick:B?D:t,ref:uO(b,P),target:h,"data-discover":!C&&n==="render"?"true":void 0});return j&&!C?s.createElement(s.Fragment,null,V,s.createElement(oO,{page:L})):V});Vn.displayName="Link";var mO=s.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:l,viewTransition:u,children:f,...h},p){let g=Pf(l,{relative:h.relative}),m=Un(),w=s.useContext(Cd),{navigator:y,basename:b}=s.useContext(Rs),k=w!=null&&CO(g)&&u===!0,S=y.encodeLocation?y.encodeLocation(g).pathname:g.pathname,E=m.pathname,C=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(E=E.toLowerCase(),C=C?C.toLowerCase():null,S=S.toLowerCase()),C&&b&&(C=sa(C,b)||C);const A=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let L=E===S||!a&&E.startsWith(S)&&E.charAt(A)==="/",T=C!=null&&(C===S||!a&&C.startsWith(S)&&C.charAt(S.length)==="/"),M={isActive:L,isPending:T,isTransitioning:k},j=L?t:void 0,P;typeof r=="function"?P=r(M):P=[r,L?"active":null,T?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let R=typeof i=="function"?i(M):i;return s.createElement(Vn,{...h,"aria-current":j,className:P,ref:p,style:R,to:l,viewTransition:u},typeof f=="function"?f(M):f)});mO.displayName="NavLink";var gO=s.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:l=Xh,action:u,onSubmit:f,relative:h,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:m,...w},y)=>{let{useTransitions:b}=s.useContext(Rs),k=xO(),S=kO(u,{relative:h}),E=l.toLowerCase()==="get"?"get":"post",C=typeof u=="string"&&sm.test(u),A=L=>{if(f&&f(L),L.defaultPrevented)return;L.preventDefault();let T=L.nativeEvent.submitter,M=(T==null?void 0:T.getAttribute("formmethod"))||l,j=()=>k(T||L.currentTarget,{fetcherKey:t,method:M,navigate:n,replace:a,state:i,relative:h,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:m});b&&n!==!1?s.startTransition(()=>j()):j()};return s.createElement("form",{ref:y,method:E,action:S,onSubmit:r?f:A,...w,"data-discover":!C&&e==="render"?"true":void 0})});gO.displayName="Form";function I7({getKey:e,storageKey:t,...n}){let r=s.useContext(cm),{basename:a}=s.useContext(Rs),i=Un(),l=T7();SO({getKey:e,storageKey:t});let u=s.useMemo(()=>{if(!r||!e)return null;let h=$6(i,l,a,e);return h!==i.key?h:null},[]);if(!r||r.isSpaMode)return null;let f=((h,p)=>{if(!window.history.state||!window.history.state.key){let g=Math.random().toString(32).slice(2);window.history.replaceState({key:g},"")}try{let m=JSON.parse(sessionStorage.getItem(h)||"{}")[p||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(g){console.error(g),sessionStorage.removeItem(h)}}).toString();return n.nonce==null&&(r!=null&&r.nonce)&&(n.nonce=r.nonce),s.createElement("script",{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${f})(${Kx(JSON.stringify(t||L6))}, ${Kx(JSON.stringify(u))})`}})}I7.displayName="ScrollRestoration";function F7(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mv(e){let t=s.useContext(_c);return fn(t,F7(e)),t}function vO(e){let t=s.useContext(Cd);return fn(t,F7(e)),t}function wO(e,{target:t,replace:n,mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:u,defaultShouldRevalidate:f,useTransitions:h}={}){let p=Bn(),g=Un(),m=Pf(e,{relative:l});return s.useCallback(w=>{if(BH(w,t)){w.preventDefault();let y=n!==void 0?n:Es(g)===Es(m),b=()=>p(e,{replace:y,mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:u,defaultShouldRevalidate:f});h?s.startTransition(()=>b()):b()}},[g,p,m,n,r,a,t,e,i,l,u,f,h])}function jl(e){nr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=s.useRef(P6(e)),n=s.useRef(!1),r=Un(),a=s.useMemo(()=>UH(r.search,n.current?null:t.current),[r.search]),i=Bn(),l=s.useCallback((u,f)=>{const h=P6(typeof u=="function"?u(new URLSearchParams(a)):u);n.current=!0,i("?"+h,f)},[i,a]);return[a,l]}var yO=0,bO=()=>`__${String(++yO)}__`;function xO(){let{router:e}=Mv("useSubmit"),{basename:t}=s.useContext(Rs),n=AH(),r=e.fetch,a=e.navigate;return s.useCallback(async(i,l={})=>{let{action:u,method:f,encType:h,formData:p,body:g}=GH(i,t);if(l.navigate===!1){let m=l.fetcherKey||bO();await r(m,n,l.action||u,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:p,body:g,formMethod:l.method||f,formEncType:l.encType||h,flushSync:l.flushSync})}else await a(l.action||u,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:p,body:g,formMethod:l.method||f,formEncType:l.encType||h,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[r,a,t,n])}function kO(e,{relative:t}={}){let{basename:n}=s.useContext(Rs),r=s.useContext(La);fn(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...Pf(e||".",{relative:t})},l=Un();if(e==null){i.search=l.search;let u=new URLSearchParams(i.search),f=u.getAll("index");if(f.some(p=>p==="")){u.delete("index"),f.filter(g=>g).forEach(g=>u.append("index",g));let p=u.toString();i.search=p?`?${p}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Aa([n,i.pathname])),Es(i)}var L6="react-router-scroll-positions",bh={};function $6(e,t,n,r){let a=null;return r&&(n!=="/"?a=r({...e,pathname:sa(e.pathname,n)||e.pathname},t):a=r(e,t)),a==null&&(a=e.key),a}function SO({getKey:e,storageKey:t}={}){let{router:n}=Mv("useScrollRestoration"),{restoreScrollPosition:r,preventScrollReset:a}=vO("useScrollRestoration"),{basename:i}=s.useContext(Rs),l=Un(),u=T7(),f=NH();s.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),EO(s.useCallback(()=>{if(f.state==="idle"){let h=$6(l,u,i,e);bh[h]=window.scrollY}try{sessionStorage.setItem(t||L6,JSON.stringify(bh))}catch(h){nr(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${h}).`)}window.history.scrollRestoration="auto"},[f.state,e,i,l,u,t])),typeof document<"u"&&(s.useLayoutEffect(()=>{try{let h=sessionStorage.getItem(t||L6);h&&(bh=JSON.parse(h))}catch{}},[t]),s.useLayoutEffect(()=>{let h=n==null?void 0:n.enableScrollRestoration(bh,()=>window.scrollY,e?(p,g)=>$6(p,g,i,e):void 0);return()=>h&&h()},[n,i,e]),s.useLayoutEffect(()=>{if(r!==!1){if(typeof r=="number"){window.scrollTo(0,r);return}try{if(l.hash){let h=document.getElementById(decodeURIComponent(l.hash.slice(1)));if(h){h.scrollIntoView();return}}}catch{nr(!1,`"${l.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[l,r,a]))}function EO(e,t){let{capture:n}={};s.useEffect(()=>{let r=n!=null?{capture:n}:void 0;return window.addEventListener("pagehide",e,r),()=>{window.removeEventListener("pagehide",e,r)}},[e,n])}function CO(e,{relative:t}={}){let n=s.useContext(kv);fn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Mv("useViewTransitionState"),a=Pf(e,{relative:t});if(!n.isTransitioning)return!1;let i=sa(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=sa(n.nextLocation.pathname,r)||n.nextLocation.pathname;return yl(a.pathname,l)!=null||yl(a.pathname,i)!=null}const jO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M204.41,51.63a108,108,0,1,0,0,152.74A107.38,107.38,0,0,0,204.41,51.63Zm-17,17A83.85,83.85,0,0,1,196.26,79L169,111.09l-23.3-65.21A83.52,83.52,0,0,1,187.43,68.6Zm-118.85,0a83.44,83.44,0,0,1,51.11-24.2l14.16,39.65L65.71,71.61C66.64,70.59,67.59,69.59,68.58,68.6ZM48,153.7a84.48,84.48,0,0,1,3.4-60.3L92.84,101Zm20.55,33.7A83.94,83.94,0,0,1,59.74,177L87,144.91l23.3,65.21A83.53,83.53,0,0,1,68.58,187.4Zm36.36-63.61,15.18-17.85,23.06,4.21,7.88,22.06-15.17,17.85-23.06-4.21Zm82.49,63.61a83.49,83.49,0,0,1-51.11,24.2L122.15,172l68.14,12.44C189.36,185.41,188.41,186.41,187.43,187.4ZM163.16,155,208,102.3a84.43,84.43,0,0,1-3.41,60.3Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M195.88,60.12a96,96,0,1,0,0,135.76A96,96,0,0,0,195.88,60.12Zm-55.34,103h0l-36.68-6.69h0L91.32,121.3l24.14-28.41h0l36.68,6.69,12.54,35.12Z",opacity:"0.2"}),s.createElement("path",{d:"M201.54,54.46A104,104,0,0,0,54.46,201.54,104,104,0,0,0,201.54,54.46ZM190.23,65.78a88.18,88.18,0,0,1,11,13.48L167.55,119,139.63,40.78A87.34,87.34,0,0,1,190.23,65.78ZM155.59,133l-18.16,21.37-27.59-5L100.41,123l18.16-21.37,27.59,5ZM65.77,65.78a87.34,87.34,0,0,1,56.66-25.59l17.51,49L58.3,74.32A88,88,0,0,1,65.77,65.78ZM46.65,161.54a88.41,88.41,0,0,1,2.53-72.62l51.21,9.35Zm19.12,28.68a88.18,88.18,0,0,1-11-13.48L88.45,137l27.92,78.18A87.34,87.34,0,0,1,65.77,190.22Zm124.46,0a87.34,87.34,0,0,1-56.66,25.59l-17.51-49,81.64,14.91A88,88,0,0,1,190.23,190.22Zm-34.62-32.49,53.74-63.27a88.41,88.41,0,0,1-2.53,72.62Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,128A104,104,0,0,0,54.46,54.46,104,104,0,0,0,128,232h.09A104,104,0,0,0,232,128ZM49.18,88.92l51.21,9.35L46.65,161.53A88.39,88.39,0,0,1,49.18,88.92Zm160.17,5.54a88.41,88.41,0,0,1-2.53,72.62l-51.21-9.35Zm-8.08-15.2L167.55,119,139.63,40.78a87.38,87.38,0,0,1,50.6,25A88.74,88.74,0,0,1,201.27,79.26ZM122.43,40.19l17.51,49L58.3,74.32a89.28,89.28,0,0,1,7.47-8.55A87.37,87.37,0,0,1,122.43,40.19ZM54.73,176.74,88.45,137l27.92,78.18a88,88,0,0,1-61.64-38.48Zm78.84,39.06-17.51-49L139.14,171h0l58.52,10.69a87.5,87.5,0,0,1-64.13,34.12Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200.12,55.88A102,102,0,0,0,55.87,200.12,102,102,0,1,0,200.12,55.88Zm-102,66.67,19.65-23.14,29.86,5.46,10.21,28.58-19.65,23.14-29.86-5.46ZM209.93,90.69a90.24,90.24,0,0,1-2,78.63l-56.14-10.24Zm-6.16-11.28-36.94,43.48L136.66,38.42a89.31,89.31,0,0,1,55,25.94A91.33,91.33,0,0,1,203.77,79.41Zm-139.41-15A89.37,89.37,0,0,1,123.81,38.1L143,91.82,54.75,75.71A91.2,91.2,0,0,1,64.36,64.36ZM48,86.68l56.14,10.24L46.07,165.31a90.24,90.24,0,0,1,2-78.63Zm4.21,89.91,36.94-43.48,30.17,84.47a89.31,89.31,0,0,1-55-25.94A91.33,91.33,0,0,1,52.23,176.59Zm139.41,15a89.32,89.32,0,0,1-59.45,26.26L113,164.18l88.24,16.11A91.2,91.2,0,0,1,191.64,191.64Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M201.54,54.46A104,104,0,0,0,54.46,201.54,104,104,0,0,0,201.54,54.46ZM190.23,65.78a88.18,88.18,0,0,1,11,13.48L167.55,119,139.63,40.78A87.34,87.34,0,0,1,190.23,65.78ZM155.59,133l-18.16,21.37-27.59-5L100.41,123l18.16-21.37,27.59,5ZM65.77,65.78a87.34,87.34,0,0,1,56.66-25.59l17.51,49L58.3,74.32A88,88,0,0,1,65.77,65.78ZM46.65,161.54a88.41,88.41,0,0,1,2.53-72.62l51.21,9.35Zm19.12,28.68a88.18,88.18,0,0,1-11-13.48L88.45,137l27.92,78.18A87.34,87.34,0,0,1,65.77,190.22Zm124.46,0a87.34,87.34,0,0,1-56.66,25.59l-17.51-49,81.64,14.91A88,88,0,0,1,190.23,190.22Zm-34.62-32.49,53.74-63.27a88.41,88.41,0,0,1-2.53,72.62Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M198.71,57.29A100,100,0,1,0,57.29,198.71,100,100,0,1,0,198.71,57.29Zm10.37,114.27-61-11.14L210.4,87a92.26,92.26,0,0,1-1.32,84.52ZM95.87,122.13,117,97.24l32.14,5.86,11,30.77L139,158.76l-32.14-5.86ZM206.24,79.58l-40.13,47.25L133.75,36.2a92.09,92.09,0,0,1,72.49,43.38ZM63,63a91.31,91.31,0,0,1,62.26-26.88L146,94.41,51.32,77.11A92.94,92.94,0,0,1,63,63Zm-16,21.49,61,11.14L45.6,169a92.26,92.26,0,0,1,1.32-84.52Zm2.84,92,40.13-47.25,32.36,90.63a92.09,92.09,0,0,1-72.49-43.38Zm143.29,16.63a91.31,91.31,0,0,1-62.26,26.88L110,161.59l94.72,17.3A92.94,92.94,0,0,1,193.05,193.05Z"}))]]),AO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,44H32A20,20,0,0,0,12,64V88a20,20,0,0,0,16,19.6V192a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V107.6A20,20,0,0,0,244,88V64A20,20,0,0,0,224,44ZM36,68H220V84H36ZM52,188V108H204v80Zm112-52a12,12,0,0,1-12,12H104a12,12,0,0,1,0-24h48A12,12,0,0,1,164,136Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,96v96a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96Z",opacity:"0.2"}),s.createElement("path",{d:"M224,48H32A16,16,0,0,0,16,64V88a16,16,0,0,0,16,16v88a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V104a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM208,192H48V104H208ZM224,88H32V64H224V88ZM96,136a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,136Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,48H32A16,16,0,0,0,16,64V88a16,16,0,0,0,16,16v88a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V104a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm-72,96H104a8,8,0,0,1,0-16h48a8,8,0,0,1,0,16Zm72-56H32V64H224V88Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,50H32A14,14,0,0,0,18,64V88a14,14,0,0,0,14,14h2v90a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V102h2a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50ZM210,192a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V102H210ZM226,88a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2ZM98,136a6,6,0,0,1,6-6h48a6,6,0,0,1,0,12H104A6,6,0,0,1,98,136Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,48H32A16,16,0,0,0,16,64V88a16,16,0,0,0,16,16v88a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V104a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM208,192H48V104H208ZM224,88H32V64H224V88ZM96,136a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,136Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,52H32A12,12,0,0,0,20,64V88a12,12,0,0,0,12,12h4v92a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V100h4a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52ZM212,192a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V100H212ZM228,88a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4ZM100,136a4,4,0,0,1,4-4h48a4,4,0,0,1,0,8H104A4,4,0,0,1,100,136Z"}))]]),NO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm40.49-100.49a12,12,0,0,1-17,17L140,117v51a12,12,0,0,1-24,0V117l-11.51,11.52a12,12,0,0,1-17-17l32-32a12,12,0,0,1,17,0Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm37.66-101.66a8,8,0,0,1-11.32,11.32L136,107.31V168a8,8,0,0,1-16,0V107.31l-18.34,18.35a8,8,0,0,1-11.32-11.32l32-32a8,8,0,0,1,11.32,0Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,101.66a8,8,0,0,1-11.32,0L136,107.31V168a8,8,0,0,1-16,0V107.31l-18.34,18.35a8,8,0,0,1-11.32-11.32l32-32a8,8,0,0,1,11.32,0l32,32A8,8,0,0,1,165.66,125.66Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm36.24-102.24a6,6,0,1,1-8.48,8.48L134,102.49V168a6,6,0,0,1-12,0V102.49l-21.76,21.75a6,6,0,0,1-8.48-8.48l32-32a6,6,0,0,1,8.48,0Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm37.66-101.66a8,8,0,0,1-11.32,11.32L136,107.31V168a8,8,0,0,1-16,0V107.31l-18.34,18.35a8,8,0,0,1-11.32-11.32l32-32a8,8,0,0,1,11.32,0Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm34.83-102.83a4,4,0,0,1-5.66,5.66L132,97.66V168a4,4,0,0,1-8,0V97.66L98.83,122.83a4,4,0,0,1-5.66-5.66l32-32a4,4,0,0,1,5.66,0Z"}))]]),MO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),s.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z"}))]]),RO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),s.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]),PO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),s.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),LO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208.49,143.51a12,12,0,0,1-17,17L140,109V224a12,12,0,0,1-24,0V109L64.49,160.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0ZM216,28H40a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,144H56l72-72Z",opacity:"0.2"}),s.createElement("path",{d:"M133.66,66.34a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,152h64v72a8,8,0,0,0,16,0V152h64a8,8,0,0,0,5.66-13.66ZM75.31,136,128,83.31,180.69,136ZM224,40a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M205.66,138.34A8,8,0,0,1,200,152H136v72a8,8,0,0,1-16,0V152H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0ZM216,32H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M204.24,139.76a6,6,0,1,1-8.48,8.48L134,86.49V224a6,6,0,0,1-12,0V86.49L60.24,148.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0ZM216,34H40a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M205.66,138.34a8,8,0,0,1-11.32,11.32L136,91.31V224a8,8,0,0,1-16,0V91.31L61.66,149.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0ZM216,32H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M202.83,141.17a4,4,0,0,1-5.66,5.66L132,81.66V224a4,4,0,0,1-8,0V81.66L58.83,146.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0ZM216,36H40a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Z"}))]]),$O=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,128l-72,72V56Z",opacity:"0.2"}),s.createElement("path",{d:"M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z"}))]]),TO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),s.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),DO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,112H56l72-72Z",opacity:"0.2"}),s.createElement("path",{d:"M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z"}))]]),HO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),s.createElement("path",{d:"M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z"}))]]),OO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M120.49,167.51a12,12,0,0,1,0,17l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,1,1,17-17L68,179V48a12,12,0,0,1,24,0V179l11.51-11.52A12,12,0,0,1,120.49,167.51Zm96-96-32-32a12,12,0,0,0-17,0l-32,32a12,12,0,0,0,17,17L164,77V208a12,12,0,0,0,24,0V77l11.51,11.52a12,12,0,0,0,17-17Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,48V208H80V48Z",opacity:"0.2"}),s.createElement("path",{d:"M117.66,170.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L72,188.69V48a8,8,0,0,1,16,0V188.69l18.34-18.35A8,8,0,0,1,117.66,170.34Zm96-96-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L168,67.31V208a8,8,0,0,0,16,0V67.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M119.39,172.94a8,8,0,0,1-1.73,8.72l-32,32a8,8,0,0,1-11.32,0l-32-32A8,8,0,0,1,48,168H72V48a8,8,0,0,1,16,0V168h24A8,8,0,0,1,119.39,172.94Zm94.27-98.6-32-32a8,8,0,0,0-11.32,0l-32,32A8,8,0,0,0,144,88h24V208a8,8,0,0,0,16,0V88h24a8,8,0,0,0,5.66-13.66Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M116.24,171.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48,0l-32-32a6,6,0,0,1,8.48-8.48L74,193.51V48a6,6,0,0,1,12,0V193.51l21.76-21.75A6,6,0,0,1,116.24,171.76Zm96-96-32-32a6,6,0,0,0-8.48,0l-32,32a6,6,0,0,0,8.48,8.48L170,62.49V208a6,6,0,0,0,12,0V62.49l21.76,21.75a6,6,0,0,0,8.48-8.48Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M117.66,170.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L72,188.69V48a8,8,0,0,1,16,0V188.69l18.34-18.35A8,8,0,0,1,117.66,170.34Zm96-96-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L168,67.31V208a8,8,0,0,0,16,0V67.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M114.83,173.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66,0l-32-32a4,4,0,0,1,5.66-5.66L76,198.34V48a4,4,0,0,1,8,0V198.34l25.17-25.17A4,4,0,0,1,114.83,173.17Zm96-96-32-32a4,4,0,0,0-5.66,0l-32,32a4,4,0,0,0,5.66,5.66L172,57.66V208a4,4,0,0,0,8,0V57.66l25.17,25.17a4,4,0,1,0,5.66-5.66Z"}))]]),IO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,48V96a12,12,0,0,1-24,0V77l-39.51,39.52a12,12,0,0,1-17-17L179,60H160a12,12,0,0,1,0-24h48A12,12,0,0,1,220,48ZM99.51,139.51,60,179V160a12,12,0,0,0-24,0v48a12,12,0,0,0,12,12H96a12,12,0,0,0,0-24H77l39.52-39.51a12,12,0,0,0-17-17Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z",opacity:"0.2"}),s.createElement("path",{d:"M216,48V96a8,8,0,0,1-16,0V67.31l-50.34,50.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM106.34,138.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l50.35-50.34a8,8,0,0,0-11.32-11.32Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M117.66,138.34a8,8,0,0,1,0,11.32L83.31,184l18.35,18.34A8,8,0,0,1,96,216H48a8,8,0,0,1-8-8V160a8,8,0,0,1,13.66-5.66L72,172.69l34.34-34.35A8,8,0,0,1,117.66,138.34ZM208,40H160a8,8,0,0,0-5.66,13.66L172.69,72l-34.35,34.34a8,8,0,0,0,11.32,11.32L184,83.31l18.34,18.35A8,8,0,0,0,216,96V48A8,8,0,0,0,208,40Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M214,48V96a6,6,0,0,1-12,0V62.48l-53.76,53.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM107.76,139.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l53.76-53.76a6,6,0,0,0-8.48-8.48Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48V96a8,8,0,0,1-16,0V67.31l-50.34,50.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM106.34,138.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l50.35-50.34a8,8,0,0,0-11.32-11.32Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M212,48V96a4,4,0,0,1-8,0V57.66l-57.17,57.17a4,4,0,0,1-5.66-5.66L198.34,52H160a4,4,0,0,1,0-8h48A4,4,0,0,1,212,48ZM109.17,141.17,52,198.34V160a4,4,0,0,0-8,0v48a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8H57.66l57.17-57.17a4,4,0,0,0-5.66-5.66Z"}))]]),FO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M225.29,165.93C216.61,151,212,129.57,212,104a84,84,0,0,0-168,0c0,25.58-4.59,47-13.27,61.93A20.08,20.08,0,0,0,30.66,186,19.77,19.77,0,0,0,48,196H84.18a44,44,0,0,0,87.64,0H208a19.77,19.77,0,0,0,17.31-10A20.08,20.08,0,0,0,225.29,165.93ZM128,212a20,20,0,0,1-19.6-16h39.2A20,20,0,0,1,128,212ZM54.66,172C63.51,154,68,131.14,68,104a60,60,0,0,1,120,0c0,27.13,4.48,50,13.33,68Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,192H48a8,8,0,0,1-6.88-12C47.71,168.6,56,139.81,56,104a72,72,0,0,1,144,0c0,35.82,8.3,64.6,14.9,76A8,8,0,0,1,208,192Z",opacity:"0.2"}),s.createElement("path",{d:"M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220.07,176.94C214.41,167.2,206,139.73,206,104a78,78,0,1,0-156,0c0,35.74-8.42,63.2-14.08,72.94A14,14,0,0,0,48,198H90.48a38,38,0,0,0,75,0H208a14,14,0,0,0,12.06-21.06ZM128,218a26,26,0,0,1-25.29-20h50.58A26,26,0,0,1,128,218Zm81.71-33a1.9,1.9,0,0,1-1.7,1H48a1.9,1.9,0,0,1-1.7-1,2,2,0,0,1,0-2C53.87,170,62,139.69,62,104a66,66,0,1,1,132,0c0,35.68,8.14,65.95,15.71,79A2,2,0,0,1,209.71,185Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M218.35,178C212.58,168,204,140.13,204,104a76,76,0,1,0-152,0c0,36.13-8.59,64-14.36,73.95A12,12,0,0,0,48,196H92.23a36,36,0,0,0,71.54,0H208A12,12,0,0,0,218.35,178ZM128,220a28,28,0,0,1-27.71-24h55.42A28,28,0,0,1,128,220Zm83.45-34a3.91,3.91,0,0,1-3.44,2H48a3.91,3.91,0,0,1-3.44-2,4,4,0,0,1,0-4C52,169.17,60,139.32,60,104a68,68,0,1,1,136,0c0,35.31,8,65.17,15.44,78A4,4,0,0,1,211.45,186Z"}))]]),_O=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),s.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),VO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M160,48V208L80,128Z",opacity:"0.2"}),s.createElement("path",{d:"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z"}))]]),ZO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),s.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),zO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),s.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),BO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,196h-4V40a12,12,0,0,0-12-12H152a12,12,0,0,0-12,12V76H96A12,12,0,0,0,84,88v36H48a12,12,0,0,0-12,12v60H32a12,12,0,0,0,0,24H224a12,12,0,0,0,0-24ZM164,52h32V196H164Zm-56,48h32v96H108ZM60,148H84v48H60Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,40V208H152V40Z",opacity:"0.2"}),s.createElement("path",{d:"M224,200h-8V40a8,8,0,0,0-8-8H152a8,8,0,0,0-8,8V80H96a8,8,0,0,0-8,8v40H48a8,8,0,0,0-8,8v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16ZM160,48h40V200H160ZM104,96h40V200H104ZM56,144H88v56H56Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1,0-16h8V136a8,8,0,0,1,8-8H72a8,8,0,0,1,8,8v64H96V88a8,8,0,0,1,8-8h32a8,8,0,0,1,8,8V200h16V40a8,8,0,0,1,8-8h40a8,8,0,0,1,8,8V200h8A8,8,0,0,1,232,208Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,202H214V40a6,6,0,0,0-6-6H152a6,6,0,0,0-6,6V82H96a6,6,0,0,0-6,6v42H48a6,6,0,0,0-6,6v66H32a6,6,0,0,0,0,12H224a6,6,0,0,0,0-12ZM158,46h44V202H158ZM102,94h44V202H102ZM54,142H90v60H54Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,200h-8V40a8,8,0,0,0-8-8H152a8,8,0,0,0-8,8V80H96a8,8,0,0,0-8,8v40H48a8,8,0,0,0-8,8v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16ZM160,48h40V200H160ZM104,96h40V200H104ZM56,144H88v56H56Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,204H212V40a4,4,0,0,0-4-4H152a4,4,0,0,0-4,4V84H96a4,4,0,0,0-4,4v44H48a4,4,0,0,0-4,4v68H32a4,4,0,0,0,0,8H224a4,4,0,0,0,0-8ZM156,44h48V204H156ZM100,92h48V204H100ZM52,140H92v64H52Z"}))]]),UO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),s.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),WO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z"}))]]),KO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm12,24.87a83.53,83.53,0,0,1,24,7.25V203.88a83.53,83.53,0,0,1-24,7.25ZM44,128a84.12,84.12,0,0,1,72-83.13V211.13A84.12,84.12,0,0,1,44,128Zm144,58.71V69.29a83.81,83.81,0,0,1,0,117.42Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,0,1-96,96V32A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24ZM40,128a88.11,88.11,0,0,1,80-87.63V215.63A88.11,88.11,0,0,1,40,128Zm96,87.63V40.37a88,88,0,0,1,0,175.26Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24ZM40,128a88.1,88.1,0,0,1,88-88V216A88.1,88.1,0,0,1,40,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm6,12.2a89.86,89.86,0,0,1,20,3.63V214.17a89.86,89.86,0,0,1-20,3.63Zm32,8.23a90.48,90.48,0,0,1,20,12.81V196.76a90.48,90.48,0,0,1-20,12.81ZM38,128a90.12,90.12,0,0,1,84-89.8V217.8A90.12,90.12,0,0,1,38,128Zm160,56.5V71.5a89.81,89.81,0,0,1,0,113Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm8,16.37a86.4,86.4,0,0,1,16,3V212.67a86.4,86.4,0,0,1-16,3Zm32,9.26a87.81,87.81,0,0,1,16,10.54V195.83a87.81,87.81,0,0,1-16,10.54ZM40,128a88.11,88.11,0,0,1,80-87.63V215.63A88.11,88.11,0,0,1,40,128Zm160,50.54V77.46a87.82,87.82,0,0,1,0,101.08Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm4,8.09a91.58,91.58,0,0,1,24,4.27V215.64a91.58,91.58,0,0,1-24,4.27Zm32,7.25a92.21,92.21,0,0,1,24,15V197.69a92.21,92.21,0,0,1-24,15ZM36,128a92.11,92.11,0,0,1,88-91.91V219.91A92.11,92.11,0,0,1,36,128Zm160,61.9V66.1a91.83,91.83,0,0,1,0,123.8Z"}))]]),GO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40V168H168V88H88V40Z",opacity:"0.2"}),s.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z"}))]]),YO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M180,64H40A12,12,0,0,0,28,76V216a12,12,0,0,0,12,12H180a12,12,0,0,0,12-12V76A12,12,0,0,0,180,64ZM168,204H52V88H168ZM228,40V180a12,12,0,0,1-24,0V52H76a12,12,0,0,1,0-24H216A12,12,0,0,1,228,40Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,72V216H40V72Z",opacity:"0.2"}),s.createElement("path",{d:"M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M192,72V216a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H184A8,8,0,0,1,192,72Zm24-40H72a8,8,0,0,0,0,16H208V184a8,8,0,0,0,16,0V40A8,8,0,0,0,216,32Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,66H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H184a6,6,0,0,0,6-6V72A6,6,0,0,0,184,66Zm-6,144H46V78H178ZM222,40V184a6,6,0,0,1-12,0V46H72a6,6,0,0,1,0-12H216A6,6,0,0,1,222,40Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,68H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H184a4,4,0,0,0,4-4V72A4,4,0,0,0,184,68Zm-4,144H44V76H180ZM220,40V184a4,4,0,0,1-8,0V44H72a4,4,0,0,1,0-8H216A4,4,0,0,1,220,40Z"}))]]),qO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,12H80A28,28,0,0,0,52,40V216a28,28,0,0,0,28,28h96a28,28,0,0,0,28-28V40A28,28,0,0,0,176,12ZM76,76H180V180H76Zm4-40h96a4,4,0,0,1,4,4V52H76V40A4,4,0,0,1,80,36Zm96,184H80a4,4,0,0,1-4-4V204H180v12A4,4,0,0,1,176,220Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M192,56V200H64V56Z",opacity:"0.2"}),s.createElement("path",{d:"M176,16H80A24,24,0,0,0,56,40V216a24,24,0,0,0,24,24h96a24,24,0,0,0,24-24V40A24,24,0,0,0,176,16ZM72,64H184V192H72Zm8-32h96a8,8,0,0,1,8,8v8H72V40A8,8,0,0,1,80,32Zm96,192H80a8,8,0,0,1-8-8v-8H184v8A8,8,0,0,1,176,224Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,16H80A24,24,0,0,0,56,40V216a24,24,0,0,0,24,24h96a24,24,0,0,0,24-24V40A24,24,0,0,0,176,16ZM80,32h96a8,8,0,0,1,8,8v8H72V40A8,8,0,0,1,80,32Zm96,192H80a8,8,0,0,1-8-8v-8H184v8A8,8,0,0,1,176,224Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,18H80A22,22,0,0,0,58,40V216a22,22,0,0,0,22,22h96a22,22,0,0,0,22-22V40A22,22,0,0,0,176,18ZM70,62H186V194H70ZM80,30h96a10,10,0,0,1,10,10V50H70V40A10,10,0,0,1,80,30Zm96,196H80a10,10,0,0,1-10-10V206H186v10A10,10,0,0,1,176,226Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,16H80A24,24,0,0,0,56,40V216a24,24,0,0,0,24,24h96a24,24,0,0,0,24-24V40A24,24,0,0,0,176,16ZM72,64H184V192H72Zm8-32h96a8,8,0,0,1,8,8v8H72V40A8,8,0,0,1,80,32Zm96,192H80a8,8,0,0,1-8-8v-8H184v8A8,8,0,0,1,176,224Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,20H80A20,20,0,0,0,60,40V216a20,20,0,0,0,20,20h96a20,20,0,0,0,20-20V40A20,20,0,0,0,176,20ZM68,60H188V196H68ZM80,28h96a12,12,0,0,1,12,12V52H68V40A12,12,0,0,1,80,28Zm96,200H80a12,12,0,0,1-12-12V204H188v12A12,12,0,0,1,176,228Z"}))]]),XO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z",opacity:"0.2"}),s.createElement("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z"}))]]),QO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,32V224a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16V32A16,16,0,0,1,96,16h64A16,16,0,0,1,176,32Z",opacity:"0.2"}),s.createElement("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M160,16H96A16,16,0,0,0,80,32V224a16,16,0,0,0,16,16h64a16,16,0,0,0,16-16V32A16,16,0,0,0,160,16ZM128,208a12,12,0,1,1,12-12A12,12,0,0,1,128,208Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,72Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M118,60a10,10,0,1,1,10,10A10,10,0,0,1,118,60Zm10,58a10,10,0,1,0,10,10A10,10,0,0,0,128,118Zm0,68a10,10,0,1,0,10,10A10,10,0,0,0,128,186Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M120,60a8,8,0,1,1,8,8A8,8,0,0,1,120,60Zm8,60a8,8,0,1,0,8,8A8,8,0,0,0,128,120Zm0,68a8,8,0,1,0,8,8A8,8,0,0,0,128,188Z"}))]]),JO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0Zm-108.49,8.49a12,12,0,0,0,17,0l40-40a12,12,0,0,0-17-17L140,115V32a12,12,0,0,0-24,0v83L96.49,95.51a12,12,0,0,0-17,17Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z",opacity:"0.2"}),s.createElement("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,168,96H136V32a8,8,0,0,0-16,0V96H88a8,8,0,0,0-5.66,13.66Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0Zm-98.24,4.24a6,6,0,0,0,8.48,0l40-40a6,6,0,0,0-8.48-8.48L134,129.51V32a6,6,0,0,0-12,0v97.51L92.24,99.76a6,6,0,0,0-8.48,8.48Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0Zm-94.83,2.83a4,4,0,0,0,5.66,0l40-40a4,4,0,1,0-5.66-5.66L132,134.34V32a4,4,0,0,0-8,0V134.34L90.83,101.17a4,4,0,0,0-5.66,5.66Z"}))]]),eI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,100H132.92l78.14-20.63a12,12,0,0,0,8.52-14.75l-8.16-30a19.94,19.94,0,0,0-24.3-13.95L34.79,60.87a19.74,19.74,0,0,0-12.14,9.27,19.48,19.48,0,0,0-1.95,15L28,112v88a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V112A12,12,0,0,0,216,100ZM124.89,61.91l18.29,10.56-25.95,6.85L98.94,68.76Zm64.45-17,3.91,14.35-17.13,4.52L157.83,53.21ZM66,77.46,84.29,88l-35.4,9.35L45,83ZM204,196H52V124H204Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M67.71,64.59l47.79,27.6L40.43,112,32.27,82a7.76,7.76,0,0,1,5.58-9.52ZM199.84,37.76a7.9,7.9,0,0,0-9.66-5.49L126.61,49.05,174.4,76.64,208,67.77Z",opacity:"0.2"}),s.createElement("path",{d:"M216,104H102.09L210,75.51a8,8,0,0,0,5.68-9.84l-8.16-30a15.93,15.93,0,0,0-19.42-11.13L35.81,64.74a15.75,15.75,0,0,0-9.7,7.4,15.51,15.51,0,0,0-1.55,12L32,111.56c0,.14,0,.29,0,.44v88a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V112A8,8,0,0,0,216,104ZM192.16,40l6,22.07-22.62,6L147.42,51.83Zm-66.69,17.6,28.12,16.24-36.94,9.75L88.53,67.37Zm-79.4,44.62-6-22.08,26.5-7L94.69,89.4ZM208,200H48V120H208v80Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,104H102.09L210,75.51a8,8,0,0,0,5.68-9.84l-8.16-30a15.93,15.93,0,0,0-19.42-11.13L35.81,64.74a15.75,15.75,0,0,0-9.7,7.4,15.51,15.51,0,0,0-1.55,12L32,111.56c0,.14,0,.29,0,.44v88a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V112A8,8,0,0,0,216,104ZM192.16,40l6,22.07L164.57,71,136.44,54.72ZM77.55,70.27l28.12,16.24-59.6,15.73-6-22.08Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,106H86.68L209.53,73.57a6,6,0,0,0,4.26-7.38l-8.16-30a13.94,13.94,0,0,0-17-9.72L36.32,66.67a13.77,13.77,0,0,0-8.48,6.47,13.57,13.57,0,0,0-1.36,10.42L34,111.34c0,.22,0,.44,0,.66v88a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V112A6,6,0,0,0,216,106ZM125.75,55.48l33,19.07-42.43,11.2-33-19.07Zm66-17.41a1.92,1.92,0,0,1,2.34,1.26l6.57,24.18L175.26,70.2l-33-19.07ZM38.23,79.14a1.85,1.85,0,0,1,1.15-.87L66.86,71l33,19.08L44.66,104.68l-6.6-24.27A1.63,1.63,0,0,1,38.23,79.14ZM210,200a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V118H210Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,104H102.09L210,75.51a8,8,0,0,0,5.68-9.84l-8.16-30a15.93,15.93,0,0,0-19.42-11.13L35.81,64.74a15.75,15.75,0,0,0-9.7,7.4,15.51,15.51,0,0,0-1.55,12L32,111.56c0,.14,0,.29,0,.44v88a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V112A8,8,0,0,0,216,104ZM192.16,40l6,22.07-22.62,6L147.42,51.83Zm-66.69,17.6,28.12,16.24-36.94,9.75L88.53,67.37Zm-79.4,44.62-6-22.08,26.5-7L94.69,89.4ZM208,200H48V120H208v80Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,108H71.26L209,71.64a4,4,0,0,0,2.84-4.92l-8.16-30a11.92,11.92,0,0,0-14.54-8.31L36.83,68.61a11.78,11.78,0,0,0-7.26,5.53A11.59,11.59,0,0,0,28.41,83l7.67,28.19A3.87,3.87,0,0,0,36,112v88a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V112A4,4,0,0,0,216,108ZM126,53.33l38,21.92L116.08,87.9,78.12,66Zm65.16-17.2a4,4,0,0,1,1-.13A3.88,3.88,0,0,1,196,38.81l7.1,26.12L175,72.35,137,50.43Zm-154.7,42a3.86,3.86,0,0,1,2.37-1.8l28.27-7.46,38,21.91L43.25,107.12,36.13,80.94A3.66,3.66,0,0,1,36.5,78.14ZM212,200a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V116H212Z"}))]]),tI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,68H132L105.33,48a20.12,20.12,0,0,0-12-4H40A20,20,0,0,0,20,64V200a20,20,0,0,0,20,20H216.89A19.13,19.13,0,0,0,236,200.89V88A20,20,0,0,0,216,68Zm-4,128H44V68H92l28.8,21.6A12,12,0,0,0,128,92h84Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,88V200.89a7.11,7.11,0,0,1-7.11,7.11H40a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H93.33a8,8,0,0,1,4.8,1.6L128,80h88A8,8,0,0,1,224,88Z",opacity:"0.2"}),s.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,88V200.89A15.13,15.13,0,0,1,216.89,216H40a16,16,0,0,1-16-16V64A16,16,0,0,1,40,48H93.33a16.12,16.12,0,0,1,9.6,3.2L130.67,72H216A16,16,0,0,1,232,88Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,74H130L101.73,52.8a14,14,0,0,0-8.4-2.8H40A14,14,0,0,0,26,64V200a14,14,0,0,0,14,14H216.89A13.12,13.12,0,0,0,230,200.89V88A14,14,0,0,0,216,74Zm2,126.89a1.11,1.11,0,0,1-1.11,1.11H40a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H93.33a2,2,0,0,1,1.2.4L124.4,84.8A6,6,0,0,0,128,86h88a2,2,0,0,1,2,2Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,76H129.33l-28.8-21.6a12.05,12.05,0,0,0-7.2-2.4H40A12,12,0,0,0,28,64V200a12,12,0,0,0,12,12H216.89A11.12,11.12,0,0,0,228,200.89V88A12,12,0,0,0,216,76Zm4,124.89a3.12,3.12,0,0,1-3.11,3.11H40a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H93.33a4,4,0,0,1,2.4.8L125.6,83.2a4,4,0,0,0,2.4.8h88a4,4,0,0,1,4,4Z"}))]]),nI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,68H132L105.33,48a20.12,20.12,0,0,0-12-4H40A20,20,0,0,0,20,64V200a20,20,0,0,0,20,20H216.89A19.13,19.13,0,0,0,236,200.89V88A20,20,0,0,0,216,68Zm-4,128H44V68H92l28.8,21.6A12,12,0,0,0,128,92h84ZM104,132h48a12,12,0,0,1,0,24H104a12,12,0,0,1,0-24Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,88V200.89a7.11,7.11,0,0,1-7.11,7.11H40a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H93.33a8,8,0,0,1,4.8,1.6L128,80h88A8,8,0,0,1,224,88Z",opacity:"0.2"}),s.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Zm-56-56a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16h48A8,8,0,0,1,160,144Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm-64,80H104a8,8,0,0,1,0-16h48a8,8,0,0,1,0,16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,74H130L101.73,52.8a14,14,0,0,0-8.4-2.8H40A14,14,0,0,0,26,64V200a14,14,0,0,0,14,14H216.89A13.12,13.12,0,0,0,230,200.89V88A14,14,0,0,0,216,74Zm2,126.89a1.11,1.11,0,0,1-1.11,1.11H40a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H93.33a2,2,0,0,1,1.2.4L124.4,84.8A6,6,0,0,0,128,86h88a2,2,0,0,1,2,2ZM158,144a6,6,0,0,1-6,6H104a6,6,0,0,1,0-12h48A6,6,0,0,1,158,144Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Zm-56-56a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16h48A8,8,0,0,1,160,144Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,76H129.33l-28.8-21.6a12.05,12.05,0,0,0-7.2-2.4H40A12,12,0,0,0,28,64V200a12,12,0,0,0,12,12H216.89A11.12,11.12,0,0,0,228,200.89V88A12,12,0,0,0,216,76Zm4,124.89a3.12,3.12,0,0,1-3.11,3.11H40a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H93.33a4,4,0,0,1,2.4.8L125.6,83.2a4,4,0,0,0,2.4.8h88a4,4,0,0,1,4,4ZM156,144a4,4,0,0,1-4,4H104a4,4,0,0,1,0-8h48A4,4,0,0,1,156,144Z"}))]]),rI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M140,88a12,12,0,0,1,12-12h32a12,12,0,0,1,12,12v32a12,12,0,0,1-24,0V100H152A12,12,0,0,1,140,88ZM72,180h32a12,12,0,0,0,0-24H84V136a12,12,0,0,0-24,0v32A12,12,0,0,0,72,180ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),s.createElement("path",{d:"M200,80v32a8,8,0,0,1-16,0V88H160a8,8,0,0,1,0-16h32A8,8,0,0,1,200,80ZM96,168H72V144a8,8,0,0,0-16,0v32a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM88,192H56a8,8,0,0,1-8-8V152a8,8,0,0,1,16,0v24H88a8,8,0,0,1,0,16Zm120-88a8,8,0,0,1-16,0V80H168a8,8,0,0,1,0-16h32a8,8,0,0,1,8,8Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M198,80v32a6,6,0,0,1-12,0V86H160a6,6,0,0,1,0-12h32A6,6,0,0,1,198,80ZM96,170H70V144a6,6,0,0,0-12,0v32a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12ZM230,56V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,80v32a8,8,0,0,1-16,0V88H160a8,8,0,0,1,0-16h32A8,8,0,0,1,200,80ZM96,168H72V144a8,8,0,0,0-16,0v32a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M196,80v32a4,4,0,0,1-8,0V84H160a4,4,0,0,1,0-8h32A4,4,0,0,1,196,80ZM96,172H68V144a4,4,0,0,0-8,0v32a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z"}))]]),sI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,76a52,52,0,1,0,52,52A52.06,52.06,0,0,0,128,76Zm0,80a28,28,0,1,1,28-28A28,28,0,0,1,128,156Zm113.86-49.57A12,12,0,0,0,236,98.34L208.21,82.49l-.11-31.31a12,12,0,0,0-4.25-9.12,116,116,0,0,0-38-21.41,12,12,0,0,0-9.68.89L128,37.27,99.83,21.53a12,12,0,0,0-9.7-.9,116.06,116.06,0,0,0-38,21.47,12,12,0,0,0-4.24,9.1l-.14,31.34L20,98.35a12,12,0,0,0-5.85,8.11,110.7,110.7,0,0,0,0,43.11A12,12,0,0,0,20,157.66l27.82,15.85.11,31.31a12,12,0,0,0,4.25,9.12,116,116,0,0,0,38,21.41,12,12,0,0,0,9.68-.89L128,218.73l28.14,15.74a12,12,0,0,0,9.7.9,116.06,116.06,0,0,0,38-21.47,12,12,0,0,0,4.24-9.1l.14-31.34,27.81-15.81a12,12,0,0,0,5.85-8.11A110.7,110.7,0,0,0,241.86,106.43Zm-22.63,33.18-26.88,15.28a11.94,11.94,0,0,0-4.55,4.59c-.54,1-1.11,1.93-1.7,2.88a12,12,0,0,0-1.83,6.31L184.13,199a91.83,91.83,0,0,1-21.07,11.87l-27.15-15.19a12,12,0,0,0-5.86-1.53h-.29c-1.14,0-2.3,0-3.44,0a12.08,12.08,0,0,0-6.14,1.51L93,210.82A92.27,92.27,0,0,1,71.88,199l-.11-30.24a12,12,0,0,0-1.83-6.32c-.58-.94-1.16-1.91-1.7-2.88A11.92,11.92,0,0,0,63.7,155L36.8,139.63a86.53,86.53,0,0,1,0-23.24l26.88-15.28a12,12,0,0,0,4.55-4.58c.54-1,1.11-1.94,1.7-2.89a12,12,0,0,0,1.83-6.31L71.87,57A91.83,91.83,0,0,1,92.94,45.17l27.15,15.19a11.92,11.92,0,0,0,6.15,1.52c1.14,0,2.3,0,3.44,0a12.08,12.08,0,0,0,6.14-1.51L163,45.18A92.27,92.27,0,0,1,184.12,57l.11,30.24a12,12,0,0,0,1.83,6.32c.58.94,1.16,1.91,1.7,2.88A11.92,11.92,0,0,0,192.3,101l26.9,15.33A86.53,86.53,0,0,1,219.23,139.61Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M230.1,108.76,198.25,90.62c-.64-1.16-1.31-2.29-2-3.41l-.12-36A104.61,104.61,0,0,0,162,32L130,49.89c-1.34,0-2.69,0-4,0L94,32A104.58,104.58,0,0,0,59.89,51.25l-.16,36c-.7,1.12-1.37,2.26-2,3.41l-31.84,18.1a99.15,99.15,0,0,0,0,38.46l31.85,18.14c.64,1.16,1.31,2.29,2,3.41l.12,36A104.61,104.61,0,0,0,94,224l32-17.87c1.34,0,2.69,0,4,0L162,224a104.58,104.58,0,0,0,34.08-19.25l.16-36c.7-1.12,1.37-2.26,2-3.41l31.84-18.1A99.15,99.15,0,0,0,230.1,108.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z",opacity:"0.2"}),s.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm109.94-52.79a8,8,0,0,0-3.89-5.4l-29.83-17-.12-33.62a8,8,0,0,0-2.83-6.08,111.91,111.91,0,0,0-36.72-20.67,8,8,0,0,0-6.46.59L128,41.85,97.88,25a8,8,0,0,0-6.47-.6A111.92,111.92,0,0,0,54.73,45.15a8,8,0,0,0-2.83,6.07l-.15,33.65-29.83,17a8,8,0,0,0-3.89,5.4,106.47,106.47,0,0,0,0,41.56,8,8,0,0,0,3.89,5.4l29.83,17,.12,33.63a8,8,0,0,0,2.83,6.08,111.91,111.91,0,0,0,36.72,20.67,8,8,0,0,0,6.46-.59L128,214.15,158.12,231a7.91,7.91,0,0,0,3.9,1,8.09,8.09,0,0,0,2.57-.42,112.1,112.1,0,0,0,36.68-20.73,8,8,0,0,0,2.83-6.07l.15-33.65,29.83-17a8,8,0,0,0,3.89-5.4A106.47,106.47,0,0,0,237.94,107.21Zm-15,34.91-28.57,16.25a8,8,0,0,0-3,3c-.58,1-1.19,2.06-1.81,3.06a7.94,7.94,0,0,0-1.22,4.21l-.15,32.25a95.89,95.89,0,0,1-25.37,14.3L134,199.13a8,8,0,0,0-3.91-1h-.19c-1.21,0-2.43,0-3.64,0a8.1,8.1,0,0,0-4.1,1l-28.84,16.1A96,96,0,0,1,67.88,201l-.11-32.2a8,8,0,0,0-1.22-4.22c-.62-1-1.23-2-1.8-3.06a8.09,8.09,0,0,0-3-3.06l-28.6-16.29a90.49,90.49,0,0,1,0-28.26L61.67,97.63a8,8,0,0,0,3-3c.58-1,1.19-2.06,1.81-3.06a7.94,7.94,0,0,0,1.22-4.21l.15-32.25a95.89,95.89,0,0,1,25.37-14.3L122,56.87a8,8,0,0,0,4.1,1c1.21,0,2.43,0,3.64,0a8,8,0,0,0,4.1-1l28.84-16.1A96,96,0,0,1,188.12,55l.11,32.2a8,8,0,0,0,1.22,4.22c.62,1,1.23,2,1.8,3.06a8.09,8.09,0,0,0,3,3.06l28.6,16.29A90.49,90.49,0,0,1,222.9,142.12Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M237.94,107.21a8,8,0,0,0-3.89-5.4l-29.83-17-.12-33.62a8,8,0,0,0-2.83-6.08,111.91,111.91,0,0,0-36.72-20.67,8,8,0,0,0-6.46.59L128,41.85,97.88,25a8,8,0,0,0-6.47-.6A111.92,111.92,0,0,0,54.73,45.15a8,8,0,0,0-2.83,6.07l-.15,33.65-29.83,17a8,8,0,0,0-3.89,5.4,106.47,106.47,0,0,0,0,41.56,8,8,0,0,0,3.89,5.4l29.83,17,.12,33.63a8,8,0,0,0,2.83,6.08,111.91,111.91,0,0,0,36.72,20.67,8,8,0,0,0,6.46-.59L128,214.15,158.12,231a7.91,7.91,0,0,0,3.9,1,8.09,8.09,0,0,0,2.57-.42,112.1,112.1,0,0,0,36.68-20.73,8,8,0,0,0,2.83-6.07l.15-33.65,29.83-17a8,8,0,0,0,3.89-5.4A106.47,106.47,0,0,0,237.94,107.21ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,82a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Zm108-54.4a6,6,0,0,0-2.92-4L202.64,86.22l-.42-.71L202.1,51.2A6,6,0,0,0,200,46.64a110.12,110.12,0,0,0-36.07-20.31,6,6,0,0,0-4.84.45L128.46,43.86h-1L96.91,26.76a6,6,0,0,0-4.86-.44A109.92,109.92,0,0,0,56,46.68a6,6,0,0,0-2.12,4.55l-.16,34.34c-.14.23-.28.47-.41.71L22.91,103.57A6,6,0,0,0,20,107.62a104.81,104.81,0,0,0,0,40.78,6,6,0,0,0,2.92,4l30.42,17.33.42.71.12,34.31A6,6,0,0,0,56,209.36a110.12,110.12,0,0,0,36.07,20.31,6,6,0,0,0,4.84-.45l30.61-17.08h1l30.56,17.1A6.09,6.09,0,0,0,162,230a5.83,5.83,0,0,0,1.93-.32,109.92,109.92,0,0,0,36-20.36,6,6,0,0,0,2.12-4.55l.16-34.34c.14-.23.28-.47.41-.71l30.42-17.29a6,6,0,0,0,2.92-4.05A104.81,104.81,0,0,0,236,107.6Zm-11.25,35.79L195.32,160.1a6.07,6.07,0,0,0-2.28,2.3c-.59,1-1.21,2.11-1.86,3.14a6,6,0,0,0-.91,3.16l-.16,33.21a98.15,98.15,0,0,1-27.52,15.53L133,200.88a6,6,0,0,0-2.93-.77h-.14c-1.24,0-2.5,0-3.74,0a6,6,0,0,0-3.07.76L93.45,217.43a98,98,0,0,1-27.56-15.49l-.12-33.17a6,6,0,0,0-.91-3.16c-.64-1-1.27-2.08-1.86-3.14a6,6,0,0,0-2.27-2.3L31.3,143.4a93,93,0,0,1,0-30.79L60.68,95.9A6.07,6.07,0,0,0,63,93.6c.59-1,1.21-2.11,1.86-3.14a6,6,0,0,0,.91-3.16l.16-33.21A98.15,98.15,0,0,1,93.41,38.56L123,55.12a5.81,5.81,0,0,0,3.07.76c1.24,0,2.5,0,3.74,0a6,6,0,0,0,3.07-.76l29.65-16.56a98,98,0,0,1,27.56,15.49l.12,33.17a6,6,0,0,0,.91,3.16c.64,1,1.27,2.08,1.86,3.14a6,6,0,0,0,2.27,2.3L224.7,112.6A93,93,0,0,1,224.73,143.39Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm109.94-52.79a8,8,0,0,0-3.89-5.4l-29.83-17-.12-33.62a8,8,0,0,0-2.83-6.08,111.91,111.91,0,0,0-36.72-20.67,8,8,0,0,0-6.46.59L128,41.85,97.88,25a8,8,0,0,0-6.47-.6A112.1,112.1,0,0,0,54.73,45.15a8,8,0,0,0-2.83,6.07l-.15,33.65-29.83,17a8,8,0,0,0-3.89,5.4,106.47,106.47,0,0,0,0,41.56,8,8,0,0,0,3.89,5.4l29.83,17,.12,33.62a8,8,0,0,0,2.83,6.08,111.91,111.91,0,0,0,36.72,20.67,8,8,0,0,0,6.46-.59L128,214.15,158.12,231a7.91,7.91,0,0,0,3.9,1,8.09,8.09,0,0,0,2.57-.42,112.1,112.1,0,0,0,36.68-20.73,8,8,0,0,0,2.83-6.07l.15-33.65,29.83-17a8,8,0,0,0,3.89-5.4A106.47,106.47,0,0,0,237.94,107.21Zm-15,34.91-28.57,16.25a8,8,0,0,0-3,3c-.58,1-1.19,2.06-1.81,3.06a7.94,7.94,0,0,0-1.22,4.21l-.15,32.25a95.89,95.89,0,0,1-25.37,14.3L134,199.13a8,8,0,0,0-3.91-1h-.19c-1.21,0-2.43,0-3.64,0a8.08,8.08,0,0,0-4.1,1l-28.84,16.1A96,96,0,0,1,67.88,201l-.11-32.2a8,8,0,0,0-1.22-4.22c-.62-1-1.23-2-1.8-3.06a8.09,8.09,0,0,0-3-3.06l-28.6-16.29a90.49,90.49,0,0,1,0-28.26L61.67,97.63a8,8,0,0,0,3-3c.58-1,1.19-2.06,1.81-3.06a7.94,7.94,0,0,0,1.22-4.21l.15-32.25a95.89,95.89,0,0,1,25.37-14.3L122,56.87a8,8,0,0,0,4.1,1c1.21,0,2.43,0,3.64,0a8.08,8.08,0,0,0,4.1-1l28.84-16.1A96,96,0,0,1,188.12,55l.11,32.2a8,8,0,0,0,1.22,4.22c.62,1,1.23,2,1.8,3.06a8.09,8.09,0,0,0,3,3.06l28.6,16.29A90.49,90.49,0,0,1,222.9,142.12Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Zm106-56a4,4,0,0,0-2-2.7l-30.89-17.6q-.47-.82-1-1.62L200.1,51.2a3.94,3.94,0,0,0-1.42-3,107.8,107.8,0,0,0-35.41-19.94,4,4,0,0,0-3.23.29L129,45.87h-2l-31-17.36a4,4,0,0,0-3.23-.3,108.05,108.05,0,0,0-35.39,20,4,4,0,0,0-1.41,3l-.16,34.9-1,1.62L23.9,105.3A4,4,0,0,0,22,108a102.76,102.76,0,0,0,0,40,4,4,0,0,0,1.95,2.7l30.89,17.6q.47.83,1,1.62l.12,34.87a3.94,3.94,0,0,0,1.42,3,107.8,107.8,0,0,0,35.41,19.94,4,4,0,0,0,3.23-.29L127,210.13h2l31,17.36a4,4,0,0,0,3.23.3,108.05,108.05,0,0,0,35.39-20,4,4,0,0,0,1.41-3l.16-34.9,1-1.62L232.1,150.7a4,4,0,0,0,2-2.71A102.76,102.76,0,0,0,234,108Zm-7.48,36.67L196.3,161.84a4,4,0,0,0-1.51,1.53c-.61,1.09-1.25,2.17-1.91,3.24a3.92,3.92,0,0,0-.61,2.1l-.16,34.15a99.8,99.8,0,0,1-29.7,16.77l-30.4-17a4.06,4.06,0,0,0-2-.51H130c-1.28,0-2.57,0-3.84,0a4.1,4.1,0,0,0-2.05.51l-30.45,17A100.23,100.23,0,0,1,63.89,202.9l-.12-34.12a3.93,3.93,0,0,0-.61-2.11c-.66-1-1.3-2.14-1.91-3.23a4,4,0,0,0-1.51-1.53L29.49,144.68a94.78,94.78,0,0,1,0-33.34L59.7,94.16a4,4,0,0,0,1.51-1.53c.61-1.09,1.25-2.17,1.91-3.23a4,4,0,0,0,.61-2.11l.16-34.15a99.8,99.8,0,0,1,29.7-16.77l30.4,17a4.1,4.1,0,0,0,2.05.51c1.28,0,2.57,0,3.84,0a4,4,0,0,0,2.05-.51l30.45-17A100.23,100.23,0,0,1,192.11,53.1l.12,34.12a3.93,3.93,0,0,0,.61,2.11c.66,1,1.3,2.14,1.91,3.23a4,4,0,0,0,1.51,1.53l30.25,17.23A94.78,94.78,0,0,1,226.54,144.66Z"}))]]),aI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,68H190.06A33.82,33.82,0,0,0,196,49.69,36.62,36.62,0,0,0,158.31,12,33.44,33.44,0,0,0,134,23.25a54.65,54.65,0,0,0-6,8.3,54.65,54.65,0,0,0-6-8.3A33.44,33.44,0,0,0,97.69,12,36.62,36.62,0,0,0,60,49.69,33.82,33.82,0,0,0,65.94,68H40A20,20,0,0,0,20,88v32a20,20,0,0,0,16,19.6V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V139.6A20,20,0,0,0,236,120V88A20,20,0,0,0,216,68Zm-4,48H140V92h72ZM152,39.17A9.59,9.59,0,0,1,159,36h.35A12.62,12.62,0,0,1,172,49,9.59,9.59,0,0,1,168.83,56c-6.9,6.12-18.25,9.26-27.63,10.76C142.7,57.42,145.84,46.07,152,39.17ZM87.7,39.7A12.8,12.8,0,0,1,96.61,36H97A9.59,9.59,0,0,1,104,39.17c6.12,6.9,9.26,18.24,10.75,27.61C105.45,65.27,94,62.13,87.17,56A9.59,9.59,0,0,1,84,49,12.72,12.72,0,0,1,87.7,39.7ZM44,92h72v24H44Zm16,48h56v56H60Zm80,56V140h56v56Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,128v72a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V128Z",opacity:"0.2"}),s.createElement("path",{d:"M216,72H180.92c.39-.33.79-.65,1.17-1A29.53,29.53,0,0,0,192,49.57,32.62,32.62,0,0,0,158.44,16,29.53,29.53,0,0,0,137,25.91a54.94,54.94,0,0,0-9,14.48,54.94,54.94,0,0,0-9-14.48A29.53,29.53,0,0,0,97.56,16,32.62,32.62,0,0,0,64,49.57,29.53,29.53,0,0,0,73.91,71c.38.33.78.65,1.17,1H40A16,16,0,0,0,24,88v32a16,16,0,0,0,16,16v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V136a16,16,0,0,0,16-16V88A16,16,0,0,0,216,72ZM149,36.51a13.69,13.69,0,0,1,10-4.5h.49A16.62,16.62,0,0,1,176,49.08a13.69,13.69,0,0,1-4.5,10c-9.49,8.4-25.24,11.36-35,12.4C137.7,60.89,141,45.5,149,36.51Zm-64.09.36A16.63,16.63,0,0,1,96.59,32h.49a13.69,13.69,0,0,1,10,4.5c8.39,9.48,11.35,25.2,12.39,34.92-9.72-1-25.44-4-34.92-12.39a13.69,13.69,0,0,1-4.5-10A16.6,16.6,0,0,1,84.87,36.87ZM40,88h80v32H40Zm16,48h64v64H56Zm144,64H136V136h64Zm16-80H136V88h80v32Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,72H180.92c.39-.33.79-.65,1.17-1A29.53,29.53,0,0,0,192,49.57,32.62,32.62,0,0,0,158.44,16,29.53,29.53,0,0,0,137,25.91a54.94,54.94,0,0,0-9,14.48,54.94,54.94,0,0,0-9-14.48A29.53,29.53,0,0,0,97.56,16,32.62,32.62,0,0,0,64,49.57,29.53,29.53,0,0,0,73.91,71c.38.33.78.65,1.17,1H40A16,16,0,0,0,24,88v32a16,16,0,0,0,16,16v64a16,16,0,0,0,16,16h60a4,4,0,0,0,4-4V120H40V88h80v32h16V88h80v32H136v92a4,4,0,0,0,4,4h60a16,16,0,0,0,16-16V136a16,16,0,0,0,16-16V88A16,16,0,0,0,216,72ZM84.51,59a13.69,13.69,0,0,1-4.5-10A16.62,16.62,0,0,1,96.59,32h.49a13.69,13.69,0,0,1,10,4.5c8.39,9.48,11.35,25.2,12.39,34.92C109.71,70.39,94,67.43,84.51,59Zm87,0c-9.49,8.4-25.24,11.36-35,12.4C137.7,60.89,141,45.5,149,36.51a13.69,13.69,0,0,1,10-4.5h.49A16.62,16.62,0,0,1,176,49.08,13.69,13.69,0,0,1,171.49,59Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,74H174.74a46.41,46.41,0,0,0,6-4.48,27.56,27.56,0,0,0,9.22-20A30.63,30.63,0,0,0,158.5,18a27.56,27.56,0,0,0-20,9.22A57.1,57.1,0,0,0,128,45.76a57.1,57.1,0,0,0-10.48-18.53A27.56,27.56,0,0,0,97.5,18,30.63,30.63,0,0,0,66,49.51a27.56,27.56,0,0,0,9.22,20,45.74,45.74,0,0,0,6,4.48H40A14,14,0,0,0,26,88v32a14,14,0,0,0,14,14h2v66a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V134h2a14,14,0,0,0,14-14V88A14,14,0,0,0,216,74ZM135.77,63c2.25-12.12,6.29-21.75,11.69-27.85A15.68,15.68,0,0,1,158.86,30h.55A18.6,18.6,0,0,1,178,49.14a15.68,15.68,0,0,1-5.18,11.4C162.1,70,143.92,72.83,134.34,73.65,134.59,70.76,135,67.08,135.77,63ZM83.45,35.45A18.69,18.69,0,0,1,96.59,30h.55a15.68,15.68,0,0,1,11.4,5.18C118,45.9,120.83,64.08,121.65,73.66c-2.89-.25-6.57-.68-10.61-1.43C98.92,70,89.29,65.94,83.19,60.53A15.64,15.64,0,0,1,78,49.14,18.65,18.65,0,0,1,83.45,35.45ZM38,120V88a2,2,0,0,1,2-2h82v36H40A2,2,0,0,1,38,120Zm16,80V134h68v68H56A2,2,0,0,1,54,200Zm148,0a2,2,0,0,1-2,2H134V134h68Zm16-80a2,2,0,0,1-2,2H134V86h82a2,2,0,0,1,2,2Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,72H180.92c.39-.33.79-.65,1.17-1A29.53,29.53,0,0,0,192,49.57,32.62,32.62,0,0,0,158.44,16,29.53,29.53,0,0,0,137,25.91a54.94,54.94,0,0,0-9,14.48,54.94,54.94,0,0,0-9-14.48A29.53,29.53,0,0,0,97.56,16,32.62,32.62,0,0,0,64,49.57,29.53,29.53,0,0,0,73.91,71c.38.33.78.65,1.17,1H40A16,16,0,0,0,24,88v32a16,16,0,0,0,16,16v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V136a16,16,0,0,0,16-16V88A16,16,0,0,0,216,72ZM149,36.51a13.69,13.69,0,0,1,10-4.5h.49A16.62,16.62,0,0,1,176,49.08a13.69,13.69,0,0,1-4.5,10c-9.49,8.4-25.24,11.36-35,12.4C137.7,60.89,141,45.5,149,36.51Zm-64.09.36A16.63,16.63,0,0,1,96.59,32h.49a13.69,13.69,0,0,1,10,4.5c8.39,9.48,11.35,25.2,12.39,34.92-9.72-1-25.44-4-34.92-12.39a13.69,13.69,0,0,1-4.5-10A16.6,16.6,0,0,1,84.87,36.87ZM40,88h80v32H40Zm16,48h64v64H56Zm144,64H136V136h64Zm16-80H136V88h80v32Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,76H166.81a50.54,50.54,0,0,0,12.63-8A25.53,25.53,0,0,0,188,49.44,28.62,28.62,0,0,0,158.56,20,25.53,25.53,0,0,0,140,28.56c-5.91,6.67-9.63,15.36-12,23.69-2.35-8.33-6.07-17-12-23.69A25.53,25.53,0,0,0,97.44,20,28.62,28.62,0,0,0,68,49.44,25.53,25.53,0,0,0,76.56,68a50.54,50.54,0,0,0,12.63,8H40A12,12,0,0,0,28,88v32a12,12,0,0,0,12,12h4v68a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V132h4a12,12,0,0,0,12-12V88A12,12,0,0,0,216,76ZM146,33.86A17.59,17.59,0,0,1,158.8,28h.61A20.62,20.62,0,0,1,180,49.2,17.6,17.6,0,0,1,174.14,62c-12.09,10.7-33.07,13.21-42,13.79C132.76,66.93,135.26,46,146,33.86ZM76,49.2A20.62,20.62,0,0,1,96.59,28h.61A17.59,17.59,0,0,1,110,33.86c10.71,12.09,13.21,33.07,13.79,42-8.89-.58-29.87-3.09-42-13.79A17.6,17.6,0,0,1,76,49.2ZM36,120V88a4,4,0,0,1,4-4h84v40H40A4,4,0,0,1,36,120Zm16,80V132h72v72H56A4,4,0,0,1,52,200Zm152,0a4,4,0,0,1-4,4H132V132h72Zm16-80a4,4,0,0,1-4,4H132V84h84a4,4,0,0,1,4,4Z"}))]]),oI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M212.62,75.17A63.7,63.7,0,0,0,206.39,26,12,12,0,0,0,196,20a63.71,63.71,0,0,0-50,24H126A63.71,63.71,0,0,0,76,20a12,12,0,0,0-10.39,6,63.7,63.7,0,0,0-6.23,49.17A61.5,61.5,0,0,0,52,104v8a60.1,60.1,0,0,0,45.76,58.28A43.66,43.66,0,0,0,92,192v4H76a20,20,0,0,1-20-20,44.05,44.05,0,0,0-44-44,12,12,0,0,0,0,24,20,20,0,0,1,20,20,44.05,44.05,0,0,0,44,44H92v12a12,12,0,0,0,24,0V192a20,20,0,0,1,40,0v40a12,12,0,0,0,24,0V192a43.66,43.66,0,0,0-5.76-21.72A60.1,60.1,0,0,0,220,112v-8A61.5,61.5,0,0,0,212.62,75.17ZM196,112a36,36,0,0,1-36,36H112a36,36,0,0,1-36-36v-8a37.87,37.87,0,0,1,6.13-20.12,11.65,11.65,0,0,0,1.58-11.49,39.9,39.9,0,0,1-.4-27.72,39.87,39.87,0,0,1,26.41,17.8A12,12,0,0,0,119.82,68h32.35a12,12,0,0,0,10.11-5.53,39.84,39.84,0,0,1,26.41-17.8,39.9,39.9,0,0,1-.4,27.72,12,12,0,0,0,1.61,11.53A37.85,37.85,0,0,1,196,104Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,104v8a48,48,0,0,1-48,48H136a32,32,0,0,1,32,32v40H104V192a32,32,0,0,1,32-32H112a48,48,0,0,1-48-48v-8a49.28,49.28,0,0,1,8.51-27.3A51.92,51.92,0,0,1,76,32a52,52,0,0,1,43.83,24h32.34A52,52,0,0,1,196,32a51.92,51.92,0,0,1,3.49,44.7A49.28,49.28,0,0,1,208,104Z",opacity:"0.2"}),s.createElement("path",{d:"M208.3,75.68A59.74,59.74,0,0,0,202.93,28,8,8,0,0,0,196,24a59.75,59.75,0,0,0-48,24H124A59.75,59.75,0,0,0,76,24a8,8,0,0,0-6.93,4,59.78,59.78,0,0,0-5.38,47.68A58.14,58.14,0,0,0,56,104v8a56.06,56.06,0,0,0,48.44,55.47A39.8,39.8,0,0,0,96,192v8H72a24,24,0,0,1-24-24A40,40,0,0,0,8,136a8,8,0,0,0,0,16,24,24,0,0,1,24,24,40,40,0,0,0,40,40H96v16a8,8,0,0,0,16,0V192a24,24,0,0,1,48,0v40a8,8,0,0,0,16,0V192a39.8,39.8,0,0,0-8.44-24.53A56.06,56.06,0,0,0,216,112v-8A58,58,0,0,0,208.3,75.68ZM200,112a40,40,0,0,1-40,40H112a40,40,0,0,1-40-40v-8a41.74,41.74,0,0,1,6.9-22.48A8,8,0,0,0,80,73.83a43.81,43.81,0,0,1,.79-33.58,43.88,43.88,0,0,1,32.32,20.06A8,8,0,0,0,119.82,64h32.35a8,8,0,0,0,6.74-3.69,43.87,43.87,0,0,1,32.32-20.06A43.81,43.81,0,0,1,192,73.83a8.09,8.09,0,0,0,1,7.65A41.76,41.76,0,0,1,200,104Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,104v8a56.06,56.06,0,0,1-48.44,55.47A39.8,39.8,0,0,1,176,192v40a8,8,0,0,1-8,8H104a8,8,0,0,1-8-8V216H72a40,40,0,0,1-40-40A24,24,0,0,0,8,152a8,8,0,0,1,0-16,40,40,0,0,1,40,40,24,24,0,0,0,24,24H96v-8a39.8,39.8,0,0,1,8.44-24.53A56.06,56.06,0,0,1,56,112v-8a58.14,58.14,0,0,1,7.69-28.32A59.78,59.78,0,0,1,69.07,28,8,8,0,0,1,76,24a59.75,59.75,0,0,1,48,24h24a59.75,59.75,0,0,1,48-24,8,8,0,0,1,6.93,4,59.74,59.74,0,0,1,5.37,47.68A58,58,0,0,1,216,104Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M206.13,75.92A57.79,57.79,0,0,0,201.2,29a6,6,0,0,0-5.2-3,57.77,57.77,0,0,0-47,24H123A57.77,57.77,0,0,0,76,26a6,6,0,0,0-5.2,3,57.79,57.79,0,0,0-4.93,46.92A55.88,55.88,0,0,0,58,104v8a54.06,54.06,0,0,0,50.45,53.87A37.85,37.85,0,0,0,98,192v10H72a26,26,0,0,1-26-26A38,38,0,0,0,8,138a6,6,0,0,0,0,12,26,26,0,0,1,26,26,38,38,0,0,0,38,38H98v18a6,6,0,0,0,12,0V192a26,26,0,0,1,52,0v40a6,6,0,0,0,12,0V192a37.85,37.85,0,0,0-10.45-26.13A54.06,54.06,0,0,0,214,112v-8A55.88,55.88,0,0,0,206.13,75.92ZM202,112a42,42,0,0,1-42,42H112a42,42,0,0,1-42-42v-8a43.86,43.86,0,0,1,7.3-23.69,6,6,0,0,0,.81-5.76,45.85,45.85,0,0,1,1.43-36.42,45.85,45.85,0,0,1,35.23,21.1A6,6,0,0,0,119.83,62h32.34a6,6,0,0,0,5.06-2.76,45.83,45.83,0,0,1,35.23-21.11,45.85,45.85,0,0,1,1.43,36.42,6,6,0,0,0,.79,5.74A43.78,43.78,0,0,1,202,104Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208.31,75.68A59.78,59.78,0,0,0,202.93,28,8,8,0,0,0,196,24a59.75,59.75,0,0,0-48,24H124A59.75,59.75,0,0,0,76,24a8,8,0,0,0-6.93,4,59.78,59.78,0,0,0-5.38,47.68A58.14,58.14,0,0,0,56,104v8a56.06,56.06,0,0,0,48.44,55.47A39.8,39.8,0,0,0,96,192v8H72a24,24,0,0,1-24-24A40,40,0,0,0,8,136a8,8,0,0,0,0,16,24,24,0,0,1,24,24,40,40,0,0,0,40,40H96v16a8,8,0,0,0,16,0V192a24,24,0,0,1,48,0v40a8,8,0,0,0,16,0V192a39.8,39.8,0,0,0-8.44-24.53A56.06,56.06,0,0,0,216,112v-8A58.14,58.14,0,0,0,208.31,75.68ZM200,112a40,40,0,0,1-40,40H112a40,40,0,0,1-40-40v-8a41.74,41.74,0,0,1,6.9-22.48A8,8,0,0,0,80,73.83a43.81,43.81,0,0,1,.79-33.58,43.88,43.88,0,0,1,32.32,20.06A8,8,0,0,0,119.82,64h32.35a8,8,0,0,0,6.74-3.69,43.87,43.87,0,0,1,32.32-20.06A43.81,43.81,0,0,1,192,73.83a8.09,8.09,0,0,0,1,7.65A41.72,41.72,0,0,1,200,104Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M203.94,76.16A55.73,55.73,0,0,0,199.46,30,4,4,0,0,0,196,28a55.78,55.78,0,0,0-46,24H122A55.78,55.78,0,0,0,76,28a4,4,0,0,0-3.46,2,55.73,55.73,0,0,0-4.48,46.16A53.78,53.78,0,0,0,60,104v8a52.06,52.06,0,0,0,52,52h1.41A36,36,0,0,0,100,192v12H72a28,28,0,0,1-28-28A36,36,0,0,0,8,140a4,4,0,0,0,0,8,28,28,0,0,1,28,28,36,36,0,0,0,36,36h28v20a4,4,0,0,0,8,0V192a28,28,0,0,1,56,0v40a4,4,0,0,0,8,0V192a36,36,0,0,0-13.41-28H160a52.06,52.06,0,0,0,52-52v-8A53.78,53.78,0,0,0,203.94,76.16ZM204,112a44.05,44.05,0,0,1-44,44H112a44.05,44.05,0,0,1-44-44v-8a45.76,45.76,0,0,1,7.71-24.89,4,4,0,0,0,.53-3.84,47.82,47.82,0,0,1,2.1-39.21,47.8,47.8,0,0,1,38.12,22.1A4,4,0,0,0,119.83,60h32.34a4,4,0,0,0,3.37-1.84,47.8,47.8,0,0,1,38.12-22.1,47.82,47.82,0,0,1,2.1,39.21,4,4,0,0,0,.53,3.83A45.85,45.85,0,0,1,204,104Z"}))]]),iI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M249.8,85.49l-116-64a12,12,0,0,0-11.6,0l-116,64a12,12,0,0,0,0,21l21.8,12v47.76a19.89,19.89,0,0,0,5.09,13.32C46.63,194.7,77,220,128,220a136.88,136.88,0,0,0,40-5.75V240a12,12,0,0,0,24,0V204.12a119.53,119.53,0,0,0,30.91-24.51A19.89,19.89,0,0,0,228,166.29V118.53l21.8-12a12,12,0,0,0,0-21ZM128,45.71,219.16,96,186,114.3a1.88,1.88,0,0,1-.18-.12l-52-28.69a12,12,0,0,0-11.6,21l39,21.49L128,146.3,36.84,96ZM128,196c-40.42,0-64.65-19.07-76-31.27v-33l70.2,38.74a12,12,0,0,0,11.6,0L168,151.64v37.23A110.46,110.46,0,0,1,128,196Zm76-31.27a93.21,93.21,0,0,1-12,10.81V138.39l12-6.62Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,113.07v53.22a8,8,0,0,1-2,5.31c-11.3,12.59-38.9,36.4-86,36.4s-74.68-23.81-86-36.4a8,8,0,0,1-2-5.31V113.07L128,160Z",opacity:"0.2"}),s.createElement("path",{d:"M251.76,88.94l-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V240a8,8,0,0,0,16,0V199.51a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12ZM128,200c-43.27,0-68.72-21.14-80-33.71V126.4l76.24,40.66a8,8,0,0,0,7.52,0L176,143.47v46.34C163.4,195.69,147.52,200,128,200Zm80-33.75a97.83,97.83,0,0,1-16,14.25V134.93l16-8.53ZM188,118.94l-.22-.13-56-29.87a8,8,0,0,0-7.52,14.12L171,128l-43,22.93L25,96,128,41.07,231,96Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,207.24a119,119,0,0,0,16-7.73V240a8,8,0,0,1-16,0Zm11.76-88.43-56-29.87a8,8,0,0,0-7.52,14.12L171,128l17-9.06Zm64-29.87-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V130.67L171,128l-43,22.93L43.83,106l0,0L25,96,128,41.07,231,96l-18.78,10-.06,0L188,118.94a8,8,0,0,1,4,6.93v73.64a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M250.82,90.71l-120-64a5.94,5.94,0,0,0-5.64,0l-120,64a6,6,0,0,0,0,10.58L34,116.67v49.62a14,14,0,0,0,3.55,9.32C50.42,189.94,79.29,214,128,214a127.21,127.21,0,0,0,50-9.73V240a6,6,0,0,0,12,0V198.35a113.18,113.18,0,0,0,28.45-22.75,13.91,13.91,0,0,0,3.55-9.31V116.67l28.82-15.38a6,6,0,0,0,0-10.58ZM128,202c-44,0-70-21.56-81.52-34.41a2,2,0,0,1-.48-1.3V123.07l79.18,42.22a6,6,0,0,0,5.64,0L178,140.13v51C165,197.35,148.45,202,128,202Zm82-35.71a2,2,0,0,1-.48,1.3A100.25,100.25,0,0,1,190,184.3V133.73l20-10.66Zm-22.15-45a6.27,6.27,0,0,0-1-.71l-56-29.86a6,6,0,0,0-5.64,10.58L175.25,128,128,153.2,20.75,96,128,38.8,235.25,96Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M251.76,88.94l-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V240a8,8,0,0,0,16,0V199.51a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12ZM128,200c-43.27,0-68.72-21.14-80-33.71V126.4l76.24,40.66a8,8,0,0,0,7.52,0L176,143.47v46.34C163.4,195.69,147.52,200,128,200Zm80-33.75a97.83,97.83,0,0,1-16,14.25V134.93l16-8.53ZM188,118.94l-.22-.13-56-29.87a8,8,0,0,0-7.52,14.12L171,128l-43,22.93L25,96,128,41.07,231,96Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M249.88,92.47l-120-64a4,4,0,0,0-3.76,0l-120,64a4,4,0,0,0,0,7.06L36,115.47v50.82a11.92,11.92,0,0,0,3,8c12.65,14.09,41,37.73,89,37.73,21,0,38.2-4.52,52-10.79V240a4,4,0,0,0,8,0V197.18a111.64,111.64,0,0,0,29-22.91,11.94,11.94,0,0,0,3-8V115.47l29.88-15.94a4,4,0,0,0,0-7.06ZM128,204c-44.83,0-71.25-22-83-35.08a3.92,3.92,0,0,1-1-2.63V119.73l82.12,43.8a4,4,0,0,0,3.76,0L180,136.8v55.53C166.58,199,149.39,204,128,204Zm84-37.71a4,4,0,0,1-1,2.64,103.32,103.32,0,0,1-23,19v-55.4l24-12.8Zm-24.59-42.51a4,4,0,0,0-1.53-1.44l-56-29.87a4,4,0,0,0-3.76,7.06L179.5,128,128,155.47,16.5,96,128,36.53,239.5,96Z"}))]]),lI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184.63,23.14a12,12,0,0,1,15-8A72.34,72.34,0,0,1,228.4,32a12,12,0,0,1-16.58,17.35,48.31,48.31,0,0,0-19.2-11.2A12,12,0,0,1,184.63,23.14ZM232.85,167.8A92,92,0,0,1,64.31,190l-40-69.32A32,32,0,0,1,36,77a31.72,31.72,0,0,1,7.54-3.14A32,32,0,0,1,88.65,32.45a32,32,0,0,1,53,3.55l14.53,25.17A32,32,0,0,1,206.35,68l17.31,30A91.38,91.38,0,0,1,232.85,167.8Zm-30-57.81L185.57,80a8,8,0,0,0-13.86,8h0l6.68,11.57a12,12,0,0,1-3.18,15.59,28,28,0,0,0-6.41,38.1,12,12,0,1,1-19.86,13.46,52.05,52.05,0,0,1,3.9-63.4L120.9,48A8,8,0,0,0,107,56l24.25,42a12,12,0,1,1-20.78,12L79.33,56a8,8,0,0,0-13.85,8L99,122a12,12,0,0,1-20.78,12L58.93,100.67a8,8,0,1,0-13.85,8L85.1,178a68,68,0,0,0,117.78-68ZM50.46,198a12,12,0,1,0-20.78,12,132.79,132.79,0,0,0,20,26.38,12,12,0,1,0,17.17-16.76A109.2,109.2,0,0,1,50.46,198Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,213.27A80,80,0,0,1,74.7,184l-40-69.32a20,20,0,0,1,34.64-20L55.08,70A20,20,0,0,1,89.73,50l6.92,12h0a20,20,0,0,1,34.64-20l30,52A20,20,0,0,1,196,74l17.31,30A80,80,0,0,1,184,213.27Z",opacity:"0.2"}),s.createElement("path",{d:"M220.17,100,202.86,70a28,28,0,0,0-38.24-10.25,27.69,27.69,0,0,0-9,8.34L138.2,38a28,28,0,0,0-48.48,0A28,28,0,0,0,48.15,74l1.59,2.76A27.67,27.67,0,0,0,38,80.41a28,28,0,0,0-10.24,38.25l40,69.32a87.47,87.47,0,0,0,53.43,41,88.56,88.56,0,0,0,22.92,3,88,88,0,0,0,76.06-132Zm-6.66,62.64A72,72,0,0,1,81.62,180l-40-69.32a12,12,0,0,1,20.78-12L81.63,132a8,8,0,1,0,13.85-8L62,66A12,12,0,1,1,82.78,54L114,108a8,8,0,1,0,13.85-8L103.57,58h0a12,12,0,1,1,20.78-12l33.42,57.9a48,48,0,0,0-5.54,60.6,8,8,0,0,0,13.24-9A32,32,0,0,1,172.78,112a8,8,0,0,0,2.13-10.4L168.23,90A12,12,0,1,1,189,78l17.31,30A71.56,71.56,0,0,1,213.51,162.62ZM184.25,31.71A8,8,0,0,1,194,26a59.62,59.62,0,0,1,36.53,28l.33.57a8,8,0,1,1-13.85,8l-.33-.57a43.67,43.67,0,0,0-26.8-20.5A8,8,0,0,1,184.25,31.71ZM80.89,237a8,8,0,0,1-11.23,1.33A119.56,119.56,0,0,1,40.06,204a8,8,0,0,1,13.86-8,103.67,103.67,0,0,0,25.64,29.72A8,8,0,0,1,80.89,237Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M219.31,98.46A88,88,0,1,1,67.08,186.77h0L26.15,115.88a16,16,0,0,1,27.69-16L72.4,132a8,8,0,0,0,13.86-8L47,56A16,16,0,0,1,74.69,40L114,108a8,8,0,1,0,13.85-8l-30-52a16,16,0,0,1,27.71-16L166,102.12A48.25,48.25,0,0,0,152,136a47.59,47.59,0,0,0,9.6,28.8,8,8,0,1,0,12.79-9.61A32,32,0,0,1,181,110.26a8,8,0,0,0,2.17-10.43L171.71,80a16,16,0,0,1,27.71-16l19.89,34.46Zm-29.37-57A43.74,43.74,0,0,1,216.74,62l.33.57a8,8,0,0,0,13.86-8L230.6,54a59.64,59.64,0,0,0-36.54-28,8,8,0,0,0-4.12,15.46ZM79.58,225.72A103.58,103.58,0,0,1,53.93,196a8,8,0,0,0-13.86,8,119.56,119.56,0,0,0,29.6,34.28,8,8,0,0,0,9.91-12.56Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M218.44,101,201.13,71a26,26,0,0,0-45.58,1L136.47,39a26,26,0,0,0-46.14,2.19A26,26,0,0,0,49.88,73l3.29,5.7a26,26,0,0,0-23.69,39L69.5,187a85.44,85.44,0,0,0,52.21,40.08,86.71,86.71,0,0,0,22.4,3,86,86,0,0,0,74.33-129Zm-3,62.16A74,74,0,0,1,79.89,181l-40-69.32a14,14,0,0,1,24.25-14L83.36,131a6,6,0,0,0,10.39-6L60.27,67A14,14,0,1,1,84.52,53l31.17,54a6,6,0,0,0,5.2,3,5.9,5.9,0,0,0,3-.81,6,6,0,0,0,2.2-8.2L101.83,59a14,14,0,0,1,24.25-14l34.2,59.23a46,46,0,0,0-6.4,59.13,6,6,0,0,0,9.94-6.73,34,34,0,0,1,7.76-46.26,6,6,0,0,0,1.6-7.8L166.49,91a14,14,0,1,1,24.25-14l17.31,30A73.53,73.53,0,0,1,215.44,163.14ZM186.18,32.22A6,6,0,0,1,193.52,28a57.59,57.59,0,0,1,35.32,27l.33.57a6,6,0,1,1-10.39,6l-.33-.57a45.69,45.69,0,0,0-28-21.43A6,6,0,0,1,186.18,32.22ZM79.32,235.71a6,6,0,0,1-8.42,1A117.79,117.79,0,0,1,41.79,203a6,6,0,0,1,10.4-6,105.48,105.48,0,0,0,26.14,30.29A6,6,0,0,1,79.32,235.71Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220.17,100,202.86,70a28,28,0,0,0-38.24-10.25,27.69,27.69,0,0,0-9,8.34L138.2,38a28,28,0,0,0-48.48,0A28,28,0,0,0,48.15,74l1.59,2.76A27.67,27.67,0,0,0,38,80.41a28,28,0,0,0-10.24,38.25l40,69.32a87.47,87.47,0,0,0,53.43,41,88.56,88.56,0,0,0,22.92,3,88,88,0,0,0,76.06-132Zm-6.66,62.64A72,72,0,0,1,81.62,180l-40-69.32a12,12,0,0,1,20.78-12L81.63,132a8,8,0,1,0,13.85-8L62,66A12,12,0,1,1,82.78,54L114,108a8,8,0,1,0,13.85-8L103.57,58h0a12,12,0,1,1,20.78-12l33.42,57.9a48,48,0,0,0-5.54,60.6,8,8,0,0,0,13.24-9A32,32,0,0,1,172.78,112a8,8,0,0,0,2.13-10.4L168.23,90A12,12,0,1,1,189,78l17.31,30A71.56,71.56,0,0,1,213.51,162.62ZM184.25,31.71A8,8,0,0,1,194,26a59.62,59.62,0,0,1,36.53,28l.33.57a8,8,0,1,1-13.85,8l-.33-.57a43.67,43.67,0,0,0-26.8-20.5A8,8,0,0,1,184.25,31.71ZM80.89,237a8,8,0,0,1-11.23,1.33A119.56,119.56,0,0,1,40.06,204a8,8,0,0,1,13.86-8,103.67,103.67,0,0,0,25.64,29.72A8,8,0,0,1,80.89,237Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216.71,102,199.4,72a24,24,0,0,0-43.57,4.52L134.74,40a24,24,0,0,0-43.69,4.9A24,24,0,0,0,51.61,72l5.31,9.19a24,24,0,0,0-25.71,35.47l40,69.32a83.4,83.4,0,0,0,51,39.14,84.45,84.45,0,0,0,21.88,2.9,84,84,0,0,0,72.6-126Zm.67,61.67A76,76,0,0,1,78.16,182l-40-69.32a16,16,0,0,1,27.71-16L85.09,130A4,4,0,0,0,92,126L58.54,68A16,16,0,1,1,86.25,52l31.17,54a4,4,0,1,0,6.93-4L100.1,60a16,16,0,0,1,27.72-16l35,60.63a44,44,0,0,0-7.28,57.61,4,4,0,1,0,6.62-4.49,36,36,0,0,1,8.22-49,4,4,0,0,0,1.07-5.2L164.76,92a16,16,0,1,1,27.71-16l17.31,30A75.52,75.52,0,0,1,217.38,163.65ZM188.12,32.74A4,4,0,0,1,193,29.9,55.65,55.65,0,0,1,227.11,56l.33.58A4,4,0,0,1,226,62a4,4,0,0,1-5.47-1.46l-.33-.57A47.62,47.62,0,0,0,191,37.63,4,4,0,0,1,188.12,32.74ZM77.75,234.48A4,4,0,0,1,74.61,236a4,4,0,0,1-2.47-.86A115.55,115.55,0,0,1,43.53,202a4,4,0,1,1,6.92-4,107.72,107.72,0,0,0,26.64,30.86A4,4,0,0,1,77.75,234.48Z"}))]]),cI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,120v96H152V152H104v64H40V120a8,8,0,0,1,2.34-5.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,216,120Z",opacity:"0.2"}),s.createElement("path",{d:"M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M217.9,110.1l-80-80a14,14,0,0,0-19.8,0l-80,80A13.92,13.92,0,0,0,34,120v96a6,6,0,0,0,6,6h64a6,6,0,0,0,6-6V158h36v58a6,6,0,0,0,6,6h64a6,6,0,0,0,6-6V120A13.92,13.92,0,0,0,217.9,110.1ZM210,210H158V152a6,6,0,0,0-6-6H104a6,6,0,0,0-6,6v58H46V120a2,2,0,0,1,.58-1.42l80-80a2,2,0,0,1,2.84,0l80,80A2,2,0,0,1,210,120Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216.49,111.51l-80-80a12,12,0,0,0-17,0l-80,80A12,12,0,0,0,36,120v96a4,4,0,0,0,4,4h64a4,4,0,0,0,4-4V156h40v60a4,4,0,0,0,4,4h64a4,4,0,0,0,4-4V120A12,12,0,0,0,216.49,111.51ZM212,212H156V152a4,4,0,0,0-4-4H104a4,4,0,0,0-4,4v60H44V120a4,4,0,0,1,1.17-2.83l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,212,120Z"}))]]),uI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V40A20,20,0,0,0,200,20Zm-4,192H60V44H196ZM84,68A12,12,0,0,1,96,56h64a12,12,0,0,1,0,24H96A12,12,0,0,1,84,68Zm8.8,127.37a48,48,0,0,1,70.4,0,12,12,0,0,0,17.6-16.32,72,72,0,0,0-19.21-14.68,44,44,0,1,0-67.19,0,72.12,72.12,0,0,0-19.2,14.68,12,12,0,0,0,17.6,16.32ZM128,116a20,20,0,1,1-20,20A20,20,0,0,1,128,116Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,32H56a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H200a8,8,0,0,0,8-8V40A8,8,0,0,0,200,32ZM128,168a32,32,0,1,1,32-32A32,32,0,0,1,128,168Z",opacity:"0.2"}),s.createElement("path",{d:"M75.19,198.4a8,8,0,0,0,11.21-1.6,52,52,0,0,1,83.2,0,8,8,0,1,0,12.8-9.6A67.88,67.88,0,0,0,155,165.51a40,40,0,1,0-53.94,0A67.88,67.88,0,0,0,73.6,187.2,8,8,0,0,0,75.19,198.4ZM128,112a24,24,0,1,1-24,24A24,24,0,0,1,128,112Zm72-88H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V40A16,16,0,0,0,200,24Zm0,192H56V40H200ZM88,64a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V40A16,16,0,0,0,200,24ZM96,48h64a8,8,0,0,1,0,16H96a8,8,0,0,1,0-16Zm84.81,150.4a8,8,0,0,1-11.21-1.6,52,52,0,0,0-83.2,0,8,8,0,1,1-12.8-9.6A67.88,67.88,0,0,1,101,165.51a40,40,0,1,1,53.94,0A67.88,67.88,0,0,1,182.4,187.2,8,8,0,0,1,180.81,198.4ZM152,136a24,24,0,1,1-24-24A24,24,0,0,1,152,136Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M151.11,166.13a38,38,0,1,0-46.22,0A65.75,65.75,0,0,0,75.2,188.4a6,6,0,0,0,9.6,7.2,54,54,0,0,1,86.4,0,6,6,0,0,0,9.6-7.2A65.75,65.75,0,0,0,151.11,166.13ZM128,110a26,26,0,1,1-26,26A26,26,0,0,1,128,110Zm72-84H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V40A14,14,0,0,0,200,26Zm2,190a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2ZM90,64a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H96A6,6,0,0,1,90,64Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M75.19,198.4a8,8,0,0,0,11.21-1.6,52,52,0,0,1,83.2,0,8,8,0,1,0,12.8-9.6A67.88,67.88,0,0,0,155,165.51a40,40,0,1,0-53.94,0A67.88,67.88,0,0,0,73.6,187.2,8,8,0,0,0,75.19,198.4ZM128,112a24,24,0,1,1-24,24A24,24,0,0,1,128,112Zm72-88H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V40A16,16,0,0,0,200,24Zm0,192H56V40H200ZM88,64a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M146.7,166.75a36,36,0,1,0-37.4,0A63.61,63.61,0,0,0,76.8,189.6a4,4,0,0,0,6.4,4.8,56,56,0,0,1,89.6,0,4,4,0,0,0,6.4-4.8A63.65,63.65,0,0,0,146.7,166.75ZM100,136a28,28,0,1,1,28,28A28,28,0,0,1,100,136ZM200,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V40A12,12,0,0,0,200,28Zm4,188a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4ZM92,64a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H96A4,4,0,0,1,92,64Z"}))]]),dI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M144,96a16,16,0,1,1,16,16A16,16,0,0,1,144,96Zm92-40V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56ZM44,60v79.72l33.86-33.86a20,20,0,0,1,28.28,0L147.31,147l17.18-17.17a20,20,0,0,1,28.28,0L212,149.09V60Zm0,136H162.34L92,125.66l-48,48Zm168,0V183l-33.37-33.37L164.28,164l32,32Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,56V178.06l-39.72-39.72a8,8,0,0,0-11.31,0L147.31,164,97.66,114.34a8,8,0,0,0-11.32,0L32,168.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM156,88a12,12,0,1,1-12,12A12,12,0,0,1,156,88Zm60,112H40V160.69l46.34-46.35a8,8,0,0,1,11.32,0h0L165,181.66a8,8,0,0,0,11.32-11.32l-17.66-17.65L173,138.34a8,8,0,0,1,11.31,0L216,170.07V200Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM40,54H216a2,2,0,0,1,2,2V163.57L188.53,134.1a14,14,0,0,0-19.8,0l-21.42,21.42L101.9,110.1a14,14,0,0,0-19.8,0L38,154.2V56A2,2,0,0,1,40,54ZM38,200V171.17l52.58-52.58a2,2,0,0,1,2.84,0L176.83,202H40A2,2,0,0,1,38,200Zm178,2H193.8l-38-38,21.41-21.42a2,2,0,0,1,2.83,0l38,38V200A2,2,0,0,1,216,202ZM146,100a10,10,0,1,1,10,10A10,10,0,0,1,146,100Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM40,52H216a4,4,0,0,1,4,4V168.4l-32.89-32.89a12,12,0,0,0-17,0l-22.83,22.83-46.82-46.83a12,12,0,0,0-17,0L36,159V56A4,4,0,0,1,40,52ZM36,200V170.34l53.17-53.17a4,4,0,0,1,5.66,0L181.66,204H40A4,4,0,0,1,36,200Zm180,4H193l-40-40,22.83-22.83a4,4,0,0,1,5.66,0L220,179.71V200A4,4,0,0,1,216,204ZM148,100a8,8,0,1,1,8,8A8,8,0,0,1,148,100Z"}))]]),fI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,24v63.72L186.14,97.86a20,20,0,0,0-28.28,0L52,203.72V52ZM85.66,204,172,117.66l32,32V204ZM76,96a20,20,0,1,1,20,20A20,20,0,0,1,76,96Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,40H48a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8h8.69L166.34,106.34a8,8,0,0,1,11.32,0L216,144.69V48A8,8,0,0,0,208,40ZM96,112a16,16,0,1,1,16-16A16,16,0,0,1,96,112Z",opacity:"0.2"}),s.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM48,48H208v77.38l-24.69-24.7a16,16,0,0,0-22.62,0L53.37,208H48ZM208,208H76l96-96,36,36v60ZM96,120A24,24,0,1,0,72,96,24,24,0,0,0,96,120Zm0-32a8,8,0,1,1-8,8A8,8,0,0,1,96,88Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM48,48H208v77.38l-24.69-24.7a16,16,0,0,0-22.62,0L53.37,208H48ZM80,96a16,16,0,1,1,16,16A16,16,0,0,1,80,96Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM46,208V48a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2v82.2l-28.1-28.1a14,14,0,0,0-19.8,0L54.2,210H48A2,2,0,0,1,46,208Zm162,2H71.17l99.41-99.41a2,2,0,0,1,2.83,0L210,147.17V208A2,2,0,0,1,208,210ZM96,118A22,22,0,1,0,74,96,22,22,0,0,0,96,118Zm0-32A10,10,0,1,1,86,96,10,10,0,0,1,96,86Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM48,48H208v77.38l-24.69-24.7a16,16,0,0,0-22.62,0L53.37,208H48ZM208,208H76l96-96,36,36v60ZM96,120A24,24,0,1,0,72,96,24,24,0,0,0,96,120Zm0-32a8,8,0,1,1-8,8A8,8,0,0,1,96,88Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM44,208V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4v87l-31.51-31.52a12,12,0,0,0-17,0L55,212H48A4,4,0,0,1,44,208Zm164,4H66.34L169.17,109.17a4,4,0,0,1,5.66,0L212,146.34V208A4,4,0,0,1,208,212ZM96,116A20,20,0,1,0,76,96,20,20,0,0,0,96,116Zm0-32A12,12,0,1,1,84,96,12,12,0,0,1,96,84Z"}))]]),hI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M160,88a16,16,0,1,1,16,16A16,16,0,0,1,160,88Zm76-32V160a20,20,0,0,1-20,20H204v20a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V88A20,20,0,0,1,40,68H60V56A20,20,0,0,1,80,36H216A20,20,0,0,1,236,56ZM180,180H80a20,20,0,0,1-20-20V92H44V196H180Zm-21.66-24L124,121.66,89.66,156ZM212,60H84v67.72l25.86-25.86a20,20,0,0,1,28.28,0L192.28,156H212Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,56v82.06l-23.72-23.72a8,8,0,0,0-11.31,0L163.31,140,113.66,90.34a8,8,0,0,0-11.32,0L64,128.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),s.createElement("path",{d:"M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM72,56H216v62.75l-10.07-10.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L72,109.37ZM184,200H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V132l36-36,49.66,49.66a8,8,0,0,0,11.31,0L194.63,120,216,141.38V168ZM160,84a12,12,0,1,1,12,12A12,12,0,0,1,160,84Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM172,72a12,12,0,1,1-12,12A12,12,0,0,1,172,72Zm12,128H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V120.69l30.34-30.35a8,8,0,0,1,11.32,0L163.31,140,189,114.34a8,8,0,0,1,11.31,0L216,130.07V168Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,42H72A14,14,0,0,0,58,56V74H40A14,14,0,0,0,26,88V200a14,14,0,0,0,14,14H184a14,14,0,0,0,14-14V182h18a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM70,56a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2v67.57L204.53,110.1a14,14,0,0,0-19.8,0l-21.42,21.41L117.9,86.1a14,14,0,0,0-19.8,0L70,114.2ZM186,200a2,2,0,0,1-2,2H40a2,2,0,0,1-2-2V88a2,2,0,0,1,2-2H58v82a14,14,0,0,0,14,14H186Zm30-30H72a2,2,0,0,1-2-2V131.17l36.58-36.58a2,2,0,0,1,2.83,0l49.66,49.66a6,6,0,0,0,8.49,0l25.65-25.66a2,2,0,0,1,2.83,0l22,22V168A2,2,0,0,1,216,170ZM162,84a10,10,0,1,1,10,10A10,10,0,0,1,162,84Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM72,56H216v62.75l-10.07-10.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L72,109.37ZM184,200H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V132l36-36,49.66,49.66a8,8,0,0,0,11.31,0L194.63,120,216,141.38V168ZM160,84a12,12,0,1,1,12,12A12,12,0,0,1,160,84Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,44H72A12,12,0,0,0,60,56V76H40A12,12,0,0,0,28,88V200a12,12,0,0,0,12,12H184a12,12,0,0,0,12-12V180h20a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM68,56a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4v72.4l-16.89-16.89a12,12,0,0,0-17,0l-22.83,22.83L116.49,87.51a12,12,0,0,0-17,0L68,119ZM188,200a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V88a4,4,0,0,1,4-4H60v84a12,12,0,0,0,12,12H188Zm28-28H72a4,4,0,0,1-4-4V130.34l37.17-37.17a4,4,0,0,1,5.66,0l49.66,49.66a4,4,0,0,0,5.65,0l25.66-25.66a4,4,0,0,1,5.66,0L220,139.71V168A4,4,0,0,1,216,172ZM164,84a8,8,0,1,1,8,8A8,8,0,0,1,164,84Z"}))]]),pI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M252,128a60,60,0,0,1-102.43,42.43l-.49-.53L89.22,102.31a36,36,0,1,0,0,51.38l3.08-3.48a12,12,0,1,1,18,15.91l-3.35,3.78-.49.53a60,60,0,1,1,0-84.86l.49.53,59.86,67.59a36,36,0,1,0,0-51.38l-3.08,3.48a12,12,0,1,1-18-15.91l3.35-3.78.49-.53A60,60,0,0,1,252,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M225.94,161.94a48,48,0,0,1-67.88,0L128,128l30.06-33.94a48,48,0,0,1,67.88,67.88ZM30.06,94.06a48,48,0,0,0,67.88,67.88L128,128,97.94,94.06A48,48,0,0,0,30.06,94.06Z",opacity:"0.2"}),s.createElement("path",{d:"M248,128a56,56,0,0,1-95.6,39.6l-.33-.35L92.12,99.55a40,40,0,1,0,0,56.9l8.52-9.62a8,8,0,1,1,12,10.61l-8.69,9.81-.33.35a56,56,0,1,1,0-79.2l.33.35,59.95,67.7a40,40,0,1,0,0-56.9l-8.52,9.62a8,8,0,1,1-12-10.61l8.69-9.81.33-.35A56,56,0,0,1,248,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM204.28,156.28a40,40,0,0,1-56.4.17L97.29,111.34,97,111A24,24,0,1,0,97,145c.36-.36.71-.73,1-1.1a8,8,0,1,1,12,10.6c-.55.62-1.13,1.23-1.71,1.81a40,40,0,1,1-.17-56.73l50.58,45.11.33.31A24,24,0,1,0,159,111c-.36.36-.7.72-1,1.1a8,8,0,0,1-12-10.59c.54-.62,1.12-1.24,1.71-1.82a40,40,0,0,1,56.57,56.56Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M246,128a54,54,0,0,1-92.18,38.18,3.07,3.07,0,0,1-.25-.26l-60-67.74a42,42,0,1,0,0,59.64l8.57-9.67a6,6,0,1,1,9,8l-8.69,9.81a3.07,3.07,0,0,1-.25.26,54,54,0,1,1,0-76.36,3.07,3.07,0,0,1,.25.26l60,67.74a42,42,0,1,0,0-59.64l-8.57,9.67a6,6,0,1,1-9-8l8.69-9.81a3.07,3.07,0,0,1,.25-.26A54,54,0,0,1,246,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M248,128a56,56,0,0,1-95.6,39.6l-.33-.35L92.12,99.55a40,40,0,1,0,0,56.9l8.52-9.62a8,8,0,1,1,12,10.61l-8.69,9.81-.33.35a56,56,0,1,1,0-79.2l.33.35,59.95,67.7a40,40,0,1,0,0-56.9l-8.52,9.62a8,8,0,1,1-12-10.61l8.69-9.81.33-.35A56,56,0,0,1,248,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M244,128a52,52,0,0,1-88.77,36.77l-.17-.18L95,96.8a44,44,0,1,0,0,62.4l8.6-9.72a4,4,0,0,1,6,5.3l-8.68,9.81-.17.18a52,52,0,1,1,0-73.54l.17.18,60,67.79a44,44,0,1,0,0-62.4l-8.6,9.72a4,4,0,0,1-6-5.3l8.68-9.81.17-.18A52,52,0,0,1,244,128Z"}))]]),mI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),gI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M196,76a16,16,0,1,1-16-16A16,16,0,0,1,196,76Zm48,22.74A84.3,84.3,0,0,1,160.11,180H160a83.52,83.52,0,0,1-23.65-3.38l-7.86,7.87A12,12,0,0,1,120,188H108v12a12,12,0,0,1-12,12H84v12a12,12,0,0,1-12,12H40a20,20,0,0,1-20-20V187.31a19.86,19.86,0,0,1,5.86-14.14l53.52-53.52A84,84,0,1,1,244,98.74ZM202.43,53.57A59.48,59.48,0,0,0,158,36c-32,1-58,27.89-58,59.89a59.69,59.69,0,0,0,4.2,22.19,12,12,0,0,1-2.55,13.21L44,189v23H60V200a12,12,0,0,1,12-12H84V176a12,12,0,0,1,12-12h19l9.65-9.65a12,12,0,0,1,13.22-2.55A59.58,59.58,0,0,0,160,156h.08c32,0,58.87-26.07,59.89-58A59.55,59.55,0,0,0,202.43,53.57Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,98.36C230.73,136.92,198.67,168,160.09,168a71.68,71.68,0,0,1-26.92-5.17h0L120,176H96v24H72v24H40a8,8,0,0,1-8-8V187.31a8,8,0,0,1,2.34-5.65l58.83-58.83h0A71.68,71.68,0,0,1,88,95.91c0-38.58,31.08-70.64,69.64-71.87A72,72,0,0,1,232,98.36Z",opacity:"0.2"}),s.createElement("path",{d:"M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM180,92a16,16,0,1,1,16-16A16,16,0,0,1,180,92Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M215.15,40.85A78,78,0,0,0,86.2,121.31l-56.1,56.1a13.94,13.94,0,0,0-4.1,9.9V216a14,14,0,0,0,14,14H72a6,6,0,0,0,6-6V206H96a6,6,0,0,0,6-6V182h18a6,6,0,0,0,4.24-1.76l10.45-10.44A77.59,77.59,0,0,0,160,174h.1A78,78,0,0,0,215.15,40.85ZM226,98.16c-1.12,35.16-30.67,63.8-65.88,63.84a65.93,65.93,0,0,1-24.51-4.67,6,6,0,0,0-6.64,1.26L117.51,170H96a6,6,0,0,0-6,6v18H72a6,6,0,0,0-6,6v18H40a2,2,0,0,1-2-2V187.31a2,2,0,0,1,.58-1.41l58.83-58.83a6,6,0,0,0,1.26-6.64A65.61,65.61,0,0,1,94,95.92C94,60.71,122.68,31.16,157.83,30A66,66,0,0,1,226,98.16ZM190,76a10,10,0,1,1-10-10A10,10,0,0,1,190,76Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M213.74,42.26A76,76,0,0,0,88.51,121.84l-57,57A11.93,11.93,0,0,0,28,187.31V216a12,12,0,0,0,12,12H72a4,4,0,0,0,4-4V204H96a4,4,0,0,0,4-4V180h20a4,4,0,0,0,2.83-1.17l11.33-11.34A75.72,75.72,0,0,0,160,172h.1A76,76,0,0,0,213.74,42.26Zm14.22,56c-1.15,36.22-31.6,65.72-67.87,65.77H160a67.52,67.52,0,0,1-25.21-4.83,4,4,0,0,0-4.45.83l-12,12H96a4,4,0,0,0-4,4v20H72a4,4,0,0,0-4,4v20H40a4,4,0,0,1-4-4V187.31a4.06,4.06,0,0,1,1.17-2.83L96,125.66a4,4,0,0,0,.83-4.45A67.51,67.51,0,0,1,92,95.91C92,59.64,121.55,29.19,157.77,28A68,68,0,0,1,228,98.23ZM188,76a8,8,0,1,1-8-8A8,8,0,0,1,188,76Z"}))]]),vI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,44H32A20,20,0,0,0,12,64V192a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V64A20,20,0,0,0,224,44Zm-4,144H36V68H220ZM52,128a12,12,0,0,1,12-12H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,128Zm0-36A12,12,0,0,1,64,80H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,92Zm0,72a12,12,0,0,1,12-12h8a12,12,0,0,1,0,24H64A12,12,0,0,1,52,164Zm108,0a12,12,0,0,1-12,12H108a12,12,0,0,1,0-24h40A12,12,0,0,1,160,164Zm44,0a12,12,0,0,1-12,12h-8a12,12,0,0,1,0-24h8A12,12,0,0,1,204,164Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,64V192a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H224A8,8,0,0,1,232,64Z",opacity:"0.2"}),s.createElement("path",{d:"M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM64,168H48a8,8,0,0,1,0-16H64a8,8,0,0,1,0,16Zm96,0H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm48,0H192a8,8,0,0,1,0-16h16a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,50H32A14,14,0,0,0,18,64V192a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50Zm2,142a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2Zm-20-64a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,128Zm0-32a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,96ZM70,160a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12h8A6,6,0,0,1,70,160Zm96,0a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,160Zm40,0a6,6,0,0,1-6,6h-8a6,6,0,0,1,0-12h8A6,6,0,0,1,206,160Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,52H32A12,12,0,0,0,20,64V192a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52Zm4,140a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4Zm-24-64a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,128Zm0-32a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,96ZM68,160a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8h8A4,4,0,0,1,68,160Zm96,0a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,160Zm40,0a4,4,0,0,1-4,4h-8a4,4,0,0,1,0-8h8A4,4,0,0,1,204,160Z"}))]]),wI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),s.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]),yI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),s.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),bI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M252,120a52.06,52.06,0,0,0-52-52H160.32c-3.44-.21-52.6-4-99.46-43.3A20,20,0,0,0,28,40V200a19.8,19.8,0,0,0,11.54,18.12,19.86,19.86,0,0,0,21.32-2.81A192.92,192.92,0,0,1,144,174.47v26.2a20,20,0,0,0,8.9,16.64,11.35,11.35,0,0,0,1.39.8l14.44,7.06A20,20,0,0,0,198.37,213l11.09-41.82A52.07,52.07,0,0,0,252,120ZM52,191.63V48.4c36.17,28.07,72.17,38.1,92,41.66V150C124.17,153.52,88.17,163.55,52,191.63ZM176.39,202.2,168,198.1V172h16.4ZM200,148H168V92h32a28,28,0,1,1,0,56Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,120a40,40,0,0,1-40,40H160V80h40A40,40,0,0,1,240,120Z",opacity:"0.2"}),s.createElement("path",{d:"M248,120a48.05,48.05,0,0,0-48-48H160.2c-2.91-.17-53.62-3.74-101.91-44.24A16,16,0,0,0,32,40V200a16,16,0,0,0,26.29,12.25c37.77-31.68,77-40.76,93.71-43.3v31.72A16,16,0,0,0,159.12,214l11,7.33A16,16,0,0,0,194.5,212l11.77-44.36A48.07,48.07,0,0,0,248,120ZM48,199.93V40h0c42.81,35.91,86.63,45,104,47.24v65.48C134.65,155,90.84,164.07,48,199.93Zm131,8,0,.11-11-7.33V168h21.6ZM200,152H168V88h32a32,32,0,1,1,0,64Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,72H160.2c-2.91-.17-53.62-3.74-101.91-44.24A16,16,0,0,0,32,40V200a16,16,0,0,0,26.29,12.25c37.77-31.68,77-40.76,93.71-43.3v31.72A16,16,0,0,0,159.12,214l11,7.33A16,16,0,0,0,194.5,212l11.77-44.36A48,48,0,0,0,200,72ZM179,207.89l0,.11-11-7.33V168h21.6ZM200,152H168V88h32a32,32,0,1,1,0,64Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M246,120a46.05,46.05,0,0,0-46-46H160.15c-2.58-.15-54.1-3.57-103.15-44.71A14,14,0,0,0,34,40V200a13.85,13.85,0,0,0,8.07,12.68A14.16,14.16,0,0,0,48,214a13.9,13.9,0,0,0,9-3.3c40-33.52,81.57-42,97-44.07v34a14,14,0,0,0,6.23,11.65l11,7.33a14,14,0,0,0,21.32-8.17l12.13-45.71A46.07,46.07,0,0,0,246,120ZM49.29,201.52A2,2,0,0,1,46,200V40a1.9,1.9,0,0,1,1.15-1.8A2.08,2.08,0,0,1,48,38a1.91,1.91,0,0,1,1.26.48c44,36.92,89,45.19,104.71,47v69C138.29,156.33,93.3,164.61,49.29,201.52Zm131.64,7a2,2,0,0,1-3.05,1.18l-11-7.33a2,2,0,0,1-.89-1.67V166h26.2ZM200,154H166V86h34a34,34,0,1,1,0,68Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M248,120a48.05,48.05,0,0,0-48-48H160.2c-2.91-.17-53.62-3.74-101.91-44.24A16,16,0,0,0,32,40V200a16,16,0,0,0,26.29,12.25c37.77-31.68,77-40.76,93.71-43.3v31.72A16,16,0,0,0,159.12,214l11,7.33A16,16,0,0,0,194.5,212l11.77-44.36A48.07,48.07,0,0,0,248,120ZM48,199.93V40h0c42.81,35.91,86.63,45,104,47.24v65.48C134.65,155,90.84,164.07,48,199.93Zm131,8,0,.11-11-7.33V168h21.6ZM200,152H168V88h32a32,32,0,1,1,0,64Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,76H160.1c-2.19-.11-54.55-3.38-104.38-45.17A12,12,0,0,0,36,40V200a11.88,11.88,0,0,0,6.92,10.87A12.18,12.18,0,0,0,48,212a11.93,11.93,0,0,0,7.69-2.83c42.46-35.62,86.76-43.25,100.28-44.8v36.29a12,12,0,0,0,5.34,10l11,7.33a12,12,0,0,0,18.28-7l12.49-47.09A44,44,0,0,0,200,76Zm-44,80.3c-13.53,1.35-60,8.62-105.42,46.75A4,4,0,0,1,44,200V40a4,4,0,0,1,2.3-3.62A4.32,4.32,0,0,1,48.05,36a3.88,3.88,0,0,1,2.53,1C96,75.09,142.47,82.36,156,83.71ZM182.87,209a4,4,0,0,1-6.1,2.36l-11-7.33a4,4,0,0,1-1.78-3.33V164h30.8ZM200,156H164V84h36a36,36,0,0,1,0,72Z"}))]]),xI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H72a8,8,0,0,1,0-16H184a8,8,0,0,1,0,16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128Z"}))]]),kI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M160,80a32,32,0,1,0-32-32A32,32,0,0,0,160,80Zm0-40a8,8,0,1,1-8,8A8,8,0,0,1,160,40Zm94.32,153.88L199.76,101.8A19.85,19.85,0,0,0,182.55,92h0a19.83,19.83,0,0,0-17.2,9.8l-18.7,31.55-37.42-63.5a20,20,0,0,0-34.46,0L1.66,193.91A12,12,0,0,0,12,212H244a12,12,0,0,0,10.32-18.12ZM92,87.87,108.57,116H75.43ZM33,188l28.28-48h61.44L151,188Zm145.86,0L160.56,157l22-37.1L222.94,188Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M144,52a20,20,0,1,1,20,20A20,20,0,0,1,144,52Zm49.44,55.92a8,8,0,0,0-13.77,0l-33,55.75-21-35.67H50.35L8,200H248Z",opacity:"0.2"}),s.createElement("path",{d:"M164,80a28,28,0,1,0-28-28A28,28,0,0,0,164,80Zm0-40a12,12,0,1,1-12,12A12,12,0,0,1,164,40Zm90.88,155.92-54.56-92.08A15.87,15.87,0,0,0,186.55,96h0a15.85,15.85,0,0,0-13.76,7.84L146.63,148l-44.84-76.1a16,16,0,0,0-27.58,0L1.11,195.94A8,8,0,0,0,8,208H248a8,8,0,0,0,6.88-12.08ZM88,80l23.57,40H64.43ZM22,192l33-56h66l33,56Zm150.57,0-16.66-28.28L186.55,112,234,192Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M254.88,195.92l-54.56-92.08A15.87,15.87,0,0,0,186.55,96h0a15.85,15.85,0,0,0-13.76,7.84l-15.64,26.39a4,4,0,0,0,0,4.07l26.8,45.47a8.13,8.13,0,0,1-1.89,10.55,8,8,0,0,1-11.8-2.26L101.79,71.88a16,16,0,0,0-27.58,0L1.11,195.94a8,8,0,0,0,1,9.52A8.23,8.23,0,0,0,8.23,208H247.77a8.29,8.29,0,0,0,6.09-2.55A8,8,0,0,0,254.88,195.92ZM64.43,120,88,80l23.57,40ZM140,52a24,24,0,1,1,24,24A24,24,0,0,1,140,52Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164,78a26,26,0,1,0-26-26A26,26,0,0,0,164,78Zm0-40a14,14,0,1,1-14,14A14,14,0,0,1,164,38Zm89.16,158.94L198.6,104.86a13.9,13.9,0,0,0-12-6.86h0a13.88,13.88,0,0,0-12,6.86l-27.88,47.05-46.56-79a14,14,0,0,0-24.13,0L2.83,197A6,6,0,0,0,8,206H248a6,6,0,0,0,5.16-9.06ZM86.27,79a2,2,0,0,1,3.46,0l25.34,43H60.93ZM18.5,194l35.36-60h68.29l19.3,32.77,0,0,16,27.2Zm152.93,0-17.85-30.29L184.83,111a2,2,0,0,1,1.72-1,1.93,1.93,0,0,1,1.72,1l49.2,83Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164,80a28,28,0,1,0-28-28A28,28,0,0,0,164,80Zm0-40a12,12,0,1,1-12,12A12,12,0,0,1,164,40Zm90.88,155.92-54.56-92.08A15.87,15.87,0,0,0,186.55,96h0a15.85,15.85,0,0,0-13.76,7.84L146.63,148l-44.84-76.1a16,16,0,0,0-27.58,0L1.11,195.94A8,8,0,0,0,8,208H248a8,8,0,0,0,6.88-12.08ZM88,80l23.57,40H64.43ZM22,192l33-56h66l18.74,31.8,0,0L154,192Zm150.57,0-16.66-28.28L186.55,112,234,192Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164,76a24,24,0,1,0-24-24A24,24,0,0,0,164,76Zm0-40a16,16,0,1,1-16,16A16,16,0,0,1,164,36Zm87.44,162-54.56-92.08A11.91,11.91,0,0,0,186.55,100h0a11.89,11.89,0,0,0-10.32,5.88l-29.61,50L98.34,73.91a12,12,0,0,0-20.68,0L4.55,198A4,4,0,0,0,8,204H248a4,4,0,0,0,3.44-6ZM84.55,78a4,4,0,0,1,6.9,0l27.12,46H57.43ZM15,196l37.71-64h70.58L161,196Zm155.29,0-19-32.29L183.11,110a4,4,0,0,1,6.88,0l51,86Z"}))]]),SI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M225.6,62.64l-88-48.17a19.91,19.91,0,0,0-19.2,0l-88,48.17A20,20,0,0,0,20,80.19v95.62a20,20,0,0,0,10.4,17.55l88,48.17a19.89,19.89,0,0,0,19.2,0l88-48.17A20,20,0,0,0,236,175.81V80.19A20,20,0,0,0,225.6,62.64ZM128,36.57,200,76,178.57,87.73l-72-39.42Zm0,78.83L56,76,81.56,62l72,39.41ZM44,96.79l72,39.4v76.67L44,173.44Zm96,116.07V136.19l24-13.13V152a12,12,0,0,0,24,0V109.92l24-13.13v76.65Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,129.09V232a8,8,0,0,1-3.84-1l-88-48.18a8,8,0,0,1-4.16-7V80.18a8,8,0,0,1,.7-3.25Z",opacity:"0.2"}),s.createElement("path",{d:"M223.68,66.15,135.68,18a15.88,15.88,0,0,0-15.36,0l-88,48.17a16,16,0,0,0-8.32,14v95.64a16,16,0,0,0,8.32,14l88,48.17a15.88,15.88,0,0,0,15.36,0l88-48.17a16,16,0,0,0,8.32-14V80.18A16,16,0,0,0,223.68,66.15ZM128,32l80.34,44-29.77,16.3-80.35-44ZM128,120,47.66,76l33.9-18.56,80.34,44ZM40,90l80,43.78v85.79L40,175.82Zm176,85.78h0l-80,43.79V133.82l32-17.51V152a8,8,0,0,0,16,0V107.55L216,90v85.77Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M223.68,66.15,135.68,18a15.88,15.88,0,0,0-15.36,0l-88,48.17a16,16,0,0,0-8.32,14v95.64a16,16,0,0,0,8.32,14l88,48.17a15.88,15.88,0,0,0,15.36,0l88-48.17a16,16,0,0,0,8.32-14V80.18A16,16,0,0,0,223.68,66.15ZM128,32l80.35,44L178.57,92.29l-80.35-44Zm0,88L47.65,76,81.56,57.43l80.35,44Zm88,55.85h0l-80,43.79V133.83l32-17.51V152a8,8,0,0,0,16,0V107.56l32-17.51v85.76Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222.72,67.91l-88-48.18a13.9,13.9,0,0,0-13.44,0l-88,48.18A14,14,0,0,0,26,80.18v95.64a14,14,0,0,0,7.28,12.27l88,48.18a13.92,13.92,0,0,0,13.44,0l88-48.18A14,14,0,0,0,230,175.82V80.18A14,14,0,0,0,222.72,67.91ZM127,30.25a2,2,0,0,1,1.92,0L212.51,76,178.57,94.57,94.05,48.31ZM122,223,39,177.57a2,2,0,0,1-1-1.75V86.66l84,46ZM43.49,76,81.56,55.15l84.51,46.26L128,122.24ZM218,175.82a2,2,0,0,1-1,1.75h0L134,223V132.64l36-19.71V152a6,6,0,0,0,12,0V106.37l36-19.71Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M223.68,66.15,135.68,18a15.88,15.88,0,0,0-15.36,0l-88,48.17a16,16,0,0,0-8.32,14v95.64a16,16,0,0,0,8.32,14l88,48.17a15.88,15.88,0,0,0,15.36,0l88-48.17a16,16,0,0,0,8.32-14V80.18A16,16,0,0,0,223.68,66.15ZM128,32l80.34,44-29.77,16.3-80.35-44ZM128,120,47.66,76l33.9-18.56,80.34,44ZM40,90l80,43.78v85.79L40,175.82Zm176,85.78h0l-80,43.79V133.82l32-17.51V152a8,8,0,0,0,16,0V107.55L216,90v85.77Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M221.76,69.66l-88-48.18a12,12,0,0,0-11.52,0l-88,48.18A12,12,0,0,0,28,80.18v95.64a12,12,0,0,0,6.24,10.52l88,48.18a11.95,11.95,0,0,0,11.52,0l88-48.18A12,12,0,0,0,228,175.82V80.18A12,12,0,0,0,221.76,69.66ZM126.08,28.5a3.94,3.94,0,0,1,3.84,0L216.67,76,178.5,96.89a4,4,0,0,0-.58-.4l-88-48.18Zm1.92,96L39.33,76,81.56,52.87l88.67,48.54Zm-89.92,54.8a4,4,0,0,1-2.08-3.5V83.29l88,48.16v94.91Zm179.84,0h0l-85.92,47V131.45l40-21.89V152a4,4,0,0,0,8,0V105.18l40-21.89v92.53A4,4,0,0,1,217.92,179.32Z"}))]]),EI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M203.57,51A107.9,107.9,0,0,0,20,128c0,44.72,27.6,82.25,72,97.94A36,36,0,0,0,140,192a12,12,0,0,1,12-12h46.21a35.79,35.79,0,0,0,35.1-28A108.6,108.6,0,0,0,236,127.09,107.23,107.23,0,0,0,203.57,51Zm6.34,95.67a11.91,11.91,0,0,1-11.7,9.3H152a36,36,0,0,0-36,36,12,12,0,0,1-16,11.3c-16.65-5.88-30.65-15.76-40.48-28.56A76,76,0,0,1,44,128a84,84,0,0,1,83.13-84H128a84.35,84.35,0,0,1,84,83.29A84.72,84.72,0,0,1,209.91,146.71ZM144,76a16,16,0,1,1-16-16A16,16,0,0,1,144,76Zm-44,24A16,16,0,1,1,84,84,16,16,0,0,1,100,100Zm0,56a16,16,0,1,1-16-16A16,16,0,0,1,100,156Zm88-56a16,16,0,1,1-16-16A16,16,0,0,1,188,100Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,127.17a96.48,96.48,0,0,1-2.39,22.18A24,24,0,0,1,198.21,168H152a24,24,0,0,0-24,24,24,24,0,0,1-32,22.61C58.73,201.44,32,169.81,32,128a96,96,0,0,1,95-96C179.84,31.47,223.55,74.35,224,127.17Z",opacity:"0.2"}),s.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89ZM84,168a12,12,0,1,1,12-12A12,12,0,0,1,84,168Zm0-56a12,12,0,1,1,12-12A12,12,0,0,1,84,112Zm44-24a12,12,0,1,1,12-12A12,12,0,0,1,128,88Zm44,24a12,12,0,1,1,12-12A12,12,0,0,1,172,112Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M199.37,55.31A101.32,101.32,0,0,0,128,26h-1A102,102,0,0,0,26,128c0,42.09,26.07,77.44,68,92.26A30.21,30.21,0,0,0,104.11,222,30.06,30.06,0,0,0,134,192a18,18,0,0,1,18-18h46.21a29.82,29.82,0,0,0,29.25-23.31A102.71,102.71,0,0,0,230,127.11,101.25,101.25,0,0,0,199.37,55.31ZM215.76,148a17.89,17.89,0,0,1-17.55,14H152a30,30,0,0,0-30,30,18,18,0,0,1-24,17C61,195.86,38,164.85,38,128a90,90,0,0,1,89.07-90H128a90.34,90.34,0,0,1,90,89.22A90.46,90.46,0,0,1,215.76,148ZM138,76a10,10,0,1,1-10-10A10,10,0,0,1,138,76ZM94,100A10,10,0,1,1,84,90,10,10,0,0,1,94,100Zm0,56a10,10,0,1,1-10-10A10,10,0,0,1,94,156Zm88-56a10,10,0,1,1-10-10A10,10,0,0,1,182,100Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M198,56.74A99.31,99.31,0,0,0,128,28h-1A100,100,0,0,0,28,128c0,41.22,25.55,75.85,66.69,90.38a28.34,28.34,0,0,0,9.42,1.63A28,28,0,0,0,132,192a20,20,0,0,1,20-20h46.21a27.84,27.84,0,0,0,27.3-21.76,100.37,100.37,0,0,0,2.49-23.1A99.26,99.26,0,0,0,198,56.74Zm19.74,91.72A19.89,19.89,0,0,1,198.21,164H152a28,28,0,0,0-28,28,20,20,0,0,1-26.64,18.83C59.51,197.46,36,165.72,36,128a92,92,0,0,1,91.05-92H128a92,92,0,0,1,89.72,112.46ZM136,76a8,8,0,1,1-8-8A8,8,0,0,1,136,76ZM92,100a8,8,0,1,1-8-8A8,8,0,0,1,92,100Zm0,56a8,8,0,1,1-8-8A8,8,0,0,1,92,156Zm88-56a8,8,0,1,1-8-8A8,8,0,0,1,180,100Z"}))]]),CI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M212.48,136.49l-82.06,82a60,60,0,0,1-84.85-84.88l98.16-97.89a40,40,0,0,1,56.56,56.59l-.17.16-95.8,92.22a12,12,0,1,1-16.64-17.3l95.71-92.12a16,16,0,0,0-22.7-22.56L62.53,150.57a36,36,0,0,0,50.93,50.91l82.06-82a12,12,0,0,1,17,17Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M180.75,104.75,204,128l-82.06,81.94a48,48,0,0,1-67.88-67.88L153.37,41.37a32,32,0,0,1,45.26,45.26Z",opacity:"0.2"}),s.createElement("path",{d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,50.34a8,8,0,0,0-11.32,0L87.09,143A24,24,0,1,0,121,177l49.32-50.32a8,8,0,1,1,11.42,11.2l-49.37,50.38a40,40,0,1,1-56.62-56.51L143,63.09A24,24,0,1,1,177,97L109.71,165.6a8,8,0,1,1-11.42-11.2L165.6,85.71a8,8,0,0,0,.06-11.37Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208.25,123.76a6,6,0,0,1,0,8.49l-82.06,82a54,54,0,0,1-76.36-76.39L149.1,37.14a38,38,0,1,1,53.77,53.72L103.59,191.54a22,22,0,1,1-31.15-31.09l83.28-84.67a6,6,0,0,1,8.56,8.42L81,168.91a10,10,0,1,0,14.11,14.18L194.35,82.4a26,26,0,1,0-36.74-36.8L58.33,146.28a42,42,0,1,0,59.37,59.44l82.06-82A6,6,0,0,1,208.25,123.76Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M206.83,125.17a4,4,0,0,1,0,5.66l-82.06,82a52,52,0,0,1-73.54-73.55L150.52,38.55a36,36,0,1,1,50.94,50.9l-99.3,100.69a20,20,0,1,1-28.3-28.27l83.29-84.68a4,4,0,1,1,5.7,5.61L79.54,167.5a12,12,0,1,0,16.95,17L195.78,83.81A28,28,0,1,0,156.2,44.18L56.91,144.87a44,44,0,1,0,62.21,62.26l82-82A4,4,0,0,1,206.83,125.17Z"}))]]),jI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),s.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),AI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M230.15,70.54,185.46,25.86a20,20,0,0,0-28.28,0L33.86,149.17A19.86,19.86,0,0,0,28,163.31V208a20,20,0,0,0,20,20H216a12,12,0,0,0,0-24H125L230.15,98.83A20,20,0,0,0,230.15,70.54ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),s.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM48,163.31l88-88L180.69,120l-88,88H48Zm144-54.62L147.32,64l24-24L216,84.69Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM192,108.69,147.32,64l24-24L216,84.69Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M225.91,74.79,181.22,30.1a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H216a6,6,0,0,0,0-12H110.49L225.91,94.59A14,14,0,0,0,225.91,74.79ZM93.52,210H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.49,183.52,120ZM217.42,86.1,192,111.52,144.49,64,169.9,38.59a2,2,0,0,1,2.83,0l44.69,44.68A2,2,0,0,1,217.42,86.1Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M227.32,73.37,182.63,28.69a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H216a8,8,0,0,0,0-16H115.32l112-112A16,16,0,0,0,227.32,73.37ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.69,147.32,64l24-24L216,84.69Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L39.51,154.83A12,12,0,0,0,36,163.31V208a12,12,0,0,0,12,12H216a4,4,0,0,0,0-8H105.66L224.49,93.17A12,12,0,0,0,224.49,76.2ZM94.34,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.82L136,69.66,186.35,120ZM218.83,87.51,192,114.34,141.66,64l26.83-26.83a4,4,0,0,1,5.66,0l44.68,44.69A4,4,0,0,1,218.83,87.51Z"}))]]),NI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),MI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm52-84a12,12,0,0,1-12,12H140v28a12,12,0,0,1-24,0V140H88a12,12,0,0,1,0-24h28V88a12,12,0,0,1,24,0v28h28A12,12,0,0,1,180,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32A8,8,0,0,1,176,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.13,104.13,0,0,0,128,24Zm40,112H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32a8,8,0,0,1,0,16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm46-90a6,6,0,0,1-6,6H134v34a6,6,0,0,1-12,0V134H88a6,6,0,0,1,0-12h34V88a6,6,0,0,1,12,0v34h34A6,6,0,0,1,174,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32A8,8,0,0,1,176,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm44-92a4,4,0,0,1-4,4H132v36a4,4,0,0,1-8,0V132H88a4,4,0,0,1,0-8h36V88a4,4,0,0,1,8,0v36h36A4,4,0,0,1,172,128Z"}))]]),RI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M116,128V48a12,12,0,0,1,24,0v80a12,12,0,0,1-24,0Zm66.55-82a12,12,0,0,0-13.1,20.1C191.41,80.37,204,103,204,128a76,76,0,0,1-152,0c0-25,12.59-47.63,34.55-61.95A12,12,0,0,0,73.45,46C44.56,64.78,28,94.69,28,128a100,100,0,0,0,200,0C228,94.69,211.44,64.78,182.55,46Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),s.createElement("path",{d:"M120,128V48a8,8,0,0,1,16,0v80a8,8,0,0,1-16,0Zm60.37-78.7a8,8,0,0,0-8.74,13.4C194.74,77.77,208,101.57,208,128a80,80,0,0,1-160,0c0-26.43,13.26-50.23,36.37-65.3a8,8,0,0,0-8.74-13.4C47.9,67.38,32,96.06,32,128a96,96,0,0,0,192,0C224,96.06,208.1,67.38,180.37,49.3Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104,104,0,0,0,128,24Zm-8,40a8,8,0,0,1,16,0v64a8,8,0,0,1-16,0Zm8,144A80,80,0,0,1,83.55,61.48a8,8,0,1,1,8.9,13.29,64,64,0,1,0,71.1,0,8,8,0,1,1,8.9-13.29A80,80,0,0,1,128,208Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M122,128V48a6,6,0,0,1,12,0v80a6,6,0,0,1-12,0Zm57.28-77A6,6,0,0,0,172.72,61C196.41,76.47,210,100.88,210,128a82,82,0,0,1-164,0c0-27.12,13.59-51.53,37.28-67A6,6,0,0,0,76.72,51C49.57,68.68,34,96.75,34,128a94,94,0,0,0,188,0C222,96.75,206.43,68.68,179.28,51Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M120,128V48a8,8,0,0,1,16,0v80a8,8,0,0,1-16,0Zm60.37-78.7a8,8,0,0,0-8.74,13.4C194.74,77.77,208,101.57,208,128a80,80,0,0,1-160,0c0-26.43,13.26-50.23,36.37-65.3a8,8,0,0,0-8.74-13.4C47.9,67.38,32,96.06,32,128a96,96,0,0,0,192,0C224,96.06,208.1,67.38,180.37,49.3Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M124,128V48a4,4,0,0,1,8,0v80a4,4,0,0,1-8,0Zm54.18-75.35a4,4,0,1,0-4.36,6.7C198.08,75.17,212,100.2,212,128a84,84,0,0,1-168,0c0-27.8,13.92-52.83,38.18-68.65a4,4,0,0,0-4.36-6.7C51.24,70,36,97.44,36,128a92,92,0,0,0,184,0C220,97.44,204.76,70,178.18,52.65Z"}))]]),PI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M144,180a16,16,0,1,1-16-16A16,16,0,0,1,144,180Zm92-52A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128ZM128,64c-24.26,0-44,17.94-44,40v4a12,12,0,0,0,24,0v-4c0-8.82,9-16,20-16s20,7.18,20,16-9,16-20,16a12,12,0,0,0-12,12v8a12,12,0,0,0,23.73,2.56C158.31,137.88,172,122.37,172,104,172,81.94,152.26,64,128,64Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,168a12,12,0,1,1,12-12A12,12,0,0,1,128,192Zm8-48.72V144a8,8,0,0,1-16,0v-8a8,8,0,0,1,8-8c13.23,0,24-9,24-20s-10.77-20-24-20-24,9-24,20v4a8,8,0,0,1-16,0v-4c0-19.85,17.94-36,40-36s40,16.15,40,36C168,125.38,154.24,139.93,136,143.28Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M138,180a10,10,0,1,1-10-10A10,10,0,0,1,138,180ZM128,74c-21,0-38,15.25-38,34v4a6,6,0,0,0,12,0v-4c0-12.13,11.66-22,26-22s26,9.87,26,22-11.66,22-26,22a6,6,0,0,0-6,6v8a6,6,0,0,0,12,0v-2.42c18.11-2.58,32-16.66,32-33.58C166,89.25,149,74,128,74Zm102,54A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M136,180a8,8,0,1,1-8-8A8,8,0,0,1,136,180ZM128,76c-19.85,0-36,14.36-36,32v4a4,4,0,0,0,8,0v-4c0-13.23,12.56-24,28-24s28,10.77,28,24-12.56,24-28,24a4,4,0,0,0-4,4v8a4,4,0,0,0,8,0v-4.2c18-1.77,32-15.36,32-31.8C164,90.36,147.85,76,128,76Zm100,52A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),LI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36ZM44,60H76V196H44ZM212,196H100V60H212Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M88,48V208H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8Z",opacity:"0.2"}),s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H88V56H216V200Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM38,200V56a2,2,0,0,1,2-2H82V202H40A2,2,0,0,1,38,200Zm180,0a2,2,0,0,1-2,2H94V54H216a2,2,0,0,1,2,2Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM36,200V56a4,4,0,0,1,4-4H84V204H40A4,4,0,0,1,36,200Zm184,0a4,4,0,0,1-4,4H92V52H216a4,4,0,0,1,4,4Z"}))]]),$I=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z",opacity:"0.2"}),s.createElement("path",{d:"M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z"}))]]),TI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,80l-96,56L32,80l96-56Z",opacity:"0.2"}),s.createElement("path",{d:"M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,169.09l-92,53.65L36,169.09A8,8,0,0,0,28,182.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,169.09Z"}),s.createElement("path",{d:"M220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09Z"}),s.createElement("path",{d:"M28,86.91l96,56a8,8,0,0,0,8.06,0l96-56a8,8,0,0,0,0-13.82l-96-56a8,8,0,0,0-8.06,0l-96,56a8,8,0,0,0,0,13.82Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M229.18,173a6,6,0,0,1-2.16,8.2l-96,56a6,6,0,0,1-6,0l-96-56a6,6,0,0,1,6-10.36l93,54.23,93-54.23A6,6,0,0,1,229.18,173ZM221,122.82l-93,54.23L35,122.82a6,6,0,0,0-6,10.36l96,56a6,6,0,0,0,6,0l96-56a6,6,0,0,0-6-10.36ZM26,80a6,6,0,0,1,3-5.18l96-56a6,6,0,0,1,6,0l96,56a6,6,0,0,1,0,10.36l-96,56a6,6,0,0,1-6,0l-96-56A6,6,0,0,1,26,80Zm17.91,0L128,129.05,212.09,80,128,31Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M227.45,174a4,4,0,0,1-1.44,5.48l-96,56a4,4,0,0,1-4,0l-96-56a4,4,0,0,1,4-6.92l94,54.83,94-54.83A4,4,0,0,1,227.45,174ZM222,124.54l-94,54.83L34,124.54a4,4,0,0,0-4,6.92l96,56a4,4,0,0,0,4,0l96-56a4,4,0,0,0-4-6.92ZM28,80a4,4,0,0,1,2-3.46l96-56a4,4,0,0,1,4,0l96,56a4,4,0,0,1,0,6.92l-96,56a4,4,0,0,1-4,0l-96-56A4,4,0,0,1,28,80Zm11.94,0L128,131.37,216.06,80,128,28.63Z"}))]]),DI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M229.06,108.79l-48.7,42,14.88,62.79a8.4,8.4,0,0,1-12.52,9.17L128,189.09,73.28,222.74a8.4,8.4,0,0,1-12.52-9.17l14.88-62.79-48.7-42A8.46,8.46,0,0,1,31.73,94L95.64,88.8l24.62-59.6a8.36,8.36,0,0,1,15.48,0l24.62,59.6L224.27,94A8.46,8.46,0,0,1,229.06,108.79Z",opacity:"0.2"}),s.createElement("path",{d:"M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M237.28,97.87A14.18,14.18,0,0,0,224.76,88l-60.25-4.87-23.22-56.2a14.37,14.37,0,0,0-26.58,0L91.49,83.11,31.24,88a14.18,14.18,0,0,0-12.52,9.89A14.43,14.43,0,0,0,23,113.32L69,152.93l-14,59.25a14.4,14.4,0,0,0,5.59,15,14.1,14.1,0,0,0,15.91.6L128,196.12l51.58,31.71a14.1,14.1,0,0,0,15.91-.6,14.4,14.4,0,0,0,5.59-15l-14-59.25L233,113.32A14.43,14.43,0,0,0,237.28,97.87Zm-12.14,6.37-48.69,42a6,6,0,0,0-1.92,5.92l14.88,62.79a2.35,2.35,0,0,1-.95,2.57,2.24,2.24,0,0,1-2.6.1L131.14,184a6,6,0,0,0-6.28,0L70.14,217.61a2.24,2.24,0,0,1-2.6-.1,2.35,2.35,0,0,1-1-2.57l14.88-62.79a6,6,0,0,0-1.92-5.92l-48.69-42a2.37,2.37,0,0,1-.73-2.65,2.28,2.28,0,0,1,2.07-1.65l63.92-5.16a6,6,0,0,0,5.06-3.69l24.63-59.6a2.35,2.35,0,0,1,4.38,0l24.63,59.6a6,6,0,0,0,5.06,3.69l63.92,5.16a2.28,2.28,0,0,1,2.07,1.65A2.37,2.37,0,0,1,225.14,104.24Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M235.36,98.49A12.21,12.21,0,0,0,224.59,90l-61.47-5L139.44,27.67a12.37,12.37,0,0,0-22.88,0L92.88,85,31.41,90a12.45,12.45,0,0,0-7.07,21.84l46.85,40.41L56.87,212.64a12.35,12.35,0,0,0,18.51,13.49L128,193.77l52.62,32.36a12.12,12.12,0,0,0,13.69-.51,12.28,12.28,0,0,0,4.82-13l-14.32-60.42,46.85-40.41A12.29,12.29,0,0,0,235.36,98.49Zm-8.93,7.26-48.68,42a4,4,0,0,0-1.28,3.95l14.87,62.79a4.37,4.37,0,0,1-1.72,4.65,4.24,4.24,0,0,1-4.81.18L130.1,185.67a4,4,0,0,0-4.2,0L71.19,219.32a4.24,4.24,0,0,1-4.81-.18,4.37,4.37,0,0,1-1.72-4.65L79.53,151.7a4,4,0,0,0-1.28-3.95l-48.68-42A4.37,4.37,0,0,1,28.25,101a4.31,4.31,0,0,1,3.81-3L96,92.79a4,4,0,0,0,3.38-2.46L124,30.73a4.35,4.35,0,0,1,8.08,0l24.62,59.6A4,4,0,0,0,160,92.79l63.9,5.15a4.31,4.31,0,0,1,3.81,3A4.37,4.37,0,0,1,226.43,105.75Z"}))]]),HI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M236,96a12,12,0,0,0-.44-3.3L221.2,42.51A20.08,20.08,0,0,0,202,28H54A20.08,20.08,0,0,0,34.8,42.51L20.46,92.7A12,12,0,0,0,20,96h0v16a43.94,43.94,0,0,0,16,33.92V216a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V145.92A43.94,43.94,0,0,0,236,112V96ZM57.05,52H199l9.14,32H47.91Zm91,56v4a20,20,0,0,1-40,0v-4ZM53,128.71A20,20,0,0,1,44,112v-4H84v4a20,20,0,0,1-20,20,19.76,19.76,0,0,1-9.07-2.2A11.54,11.54,0,0,0,53,128.71ZM196,204H60V155.81c1.32.12,2.65.19,4,.19a43.86,43.86,0,0,0,32-13.85,43.89,43.89,0,0,0,64,0A43.86,43.86,0,0,0,192,156c1.35,0,2.68-.07,4-.19Zm16-92a20,20,0,0,1-9,16.71,11.66,11.66,0,0,0-1.88,1.09A20,20,0,0,1,172,112v-4h40Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,96v16a32,32,0,0,1-64,0V96H96v16a32,32,0,0,1-64,0V96L46.34,45.8A8,8,0,0,1,54,40H202a8,8,0,0,1,7.69,5.8Z",opacity:"0.2"}),s.createElement("path",{d:"M231.69,93.81,217.35,43.6A16.07,16.07,0,0,0,202,32H54A16.07,16.07,0,0,0,38.65,43.6L24.31,93.81A7.94,7.94,0,0,0,24,96v16a40,40,0,0,0,16,32v72a8,8,0,0,0,8,8H208a8,8,0,0,0,8-8V144a40,40,0,0,0,16-32V96A7.94,7.94,0,0,0,231.69,93.81ZM54,48H202l11.42,40H42.61Zm98,56v8a24,24,0,0,1-48,0v-8ZM51.06,132.2A24,24,0,0,1,40,112v-8H88v8a24,24,0,0,1-35.12,21.26A7.88,7.88,0,0,0,51.06,132.2ZM200,208H56V151.2a40.57,40.57,0,0,0,8,.8,40,40,0,0,0,32-16,40,40,0,0,0,64,0,40,40,0,0,0,32,16,40.57,40.57,0,0,0,8-.8Zm16-96a24,24,0,0,1-11.07,20.2,8.08,8.08,0,0,0-1.8,1.05A24,24,0,0,1,168,112v-8h48Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M231.69,93.81,217.35,43.6A16.07,16.07,0,0,0,202,32H54A16.07,16.07,0,0,0,38.65,43.6L24.31,93.81A7.94,7.94,0,0,0,24,96v16a40,40,0,0,0,16,32v72a8,8,0,0,0,8,8H208a8,8,0,0,0,8-8V144a40,40,0,0,0,16-32V96A7.94,7.94,0,0,0,231.69,93.81ZM88,112a24,24,0,0,1-35.12,21.26,7.88,7.88,0,0,0-1.82-1.06A24,24,0,0,1,40,112v-8H88Zm64,0a24,24,0,0,1-48,0v-8h48Zm64,0a24,24,0,0,1-11.07,20.2,8.08,8.08,0,0,0-1.8,1.05A24,24,0,0,1,168,112v-8h48Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M26.22,94.41A6,6,0,0,0,26,96v16A38,38,0,0,0,42,143V216a6,6,0,0,0,6,6H208a6,6,0,0,0,6-6V143A38,38,0,0,0,230,112V96a5.91,5.91,0,0,0-.23-1.64L215.43,44.15A14.07,14.07,0,0,0,202,34H54A14.07,14.07,0,0,0,40.57,44.15Zm25.89-47A2,2,0,0,1,54,46H202a2,2,0,0,1,1.92,1.45L216.05,90H40ZM102,102h52v10a26,26,0,0,1-52,0Zm-64,0H90v10a26,26,0,0,1-38.18,23,6,6,0,0,0-1.65-1A26,26,0,0,1,38,112ZM202,210H54V148.66a38,38,0,0,0,42-16.21,37.95,37.95,0,0,0,64,0,38,38,0,0,0,42,16.21Zm3.83-76a6,6,0,0,0-1.65,1A26,26,0,0,1,166,112V102h52v10A26,26,0,0,1,205.83,134Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M232,96a7.89,7.89,0,0,0-.3-2.2L217.35,43.6A16.07,16.07,0,0,0,202,32H54A16.07,16.07,0,0,0,38.65,43.6L24.31,93.8A7.89,7.89,0,0,0,24,96h0v16a40,40,0,0,0,16,32v72a8,8,0,0,0,8,8H208a8,8,0,0,0,8-8V144a40,40,0,0,0,16-32V96ZM54,48H202l11.42,40H42.61Zm50,56h48v8a24,24,0,0,1-48,0Zm-16,0v8a24,24,0,0,1-35.12,21.26,7.88,7.88,0,0,0-1.82-1.06A24,24,0,0,1,40,112v-8ZM200,208H56V151.2a40.57,40.57,0,0,0,8,.8,40,40,0,0,0,32-16,40,40,0,0,0,64,0,40,40,0,0,0,32,16,40.57,40.57,0,0,0,8-.8Zm4.93-75.8a8.08,8.08,0,0,0-1.8,1.05A24,24,0,0,1,168,112v-8h48v8A24,24,0,0,1,204.93,132.2Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M28.15,95A3.81,3.81,0,0,0,28,96v16a36,36,0,0,0,16,29.92V216a4,4,0,0,0,4,4H208a4,4,0,0,0,4-4V141.92A36,36,0,0,0,228,112V96a3.81,3.81,0,0,0-.17-1.08L213.5,44.7A12,12,0,0,0,202,36H54A12,12,0,0,0,42.5,44.7Zm22-48.08A4,4,0,0,1,54,44H202a4,4,0,0,1,3.84,2.9L218.7,92H37.3ZM100,100h56v12a28,28,0,0,1-56,0ZM36,112V100H92v12a28,28,0,0,1-41.37,24.59,4,4,0,0,0-1.31-.76A28,28,0,0,1,36,112ZM204,212H52V145.94a36,36,0,0,0,44-17.48,36,36,0,0,0,64,0,36,36,0,0,0,44,17.48Zm2.68-76.17a3.94,3.94,0,0,0-1.3.76A28,28,0,0,1,164,112V100h56v12A28,28,0,0,1,206.68,135.83Z"}))]]),OI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,148H203.89c.07-1.33.11-2.66.11-4a76,76,0,0,0-152,0c0,1.34,0,2.67.11,4H16a12,12,0,0,0,0,24H240a12,12,0,0,0,0-24ZM76,144a52,52,0,0,1,104,0c0,1.34-.07,2.67-.17,4H76.17C76.07,146.67,76,145.34,76,144Zm144,56a12,12,0,0,1-12,12H48a12,12,0,0,1,0-24H208A12,12,0,0,1,220,200ZM12.62,92.21a12,12,0,0,1,15.17-7.59l12,4a12,12,0,1,1-7.58,22.77l-12-4A12,12,0,0,1,12.62,92.21Zm56-48.41a12,12,0,1,1,22.76-7.59l4,12A12,12,0,1,1,72.62,55.8Zm140,60a12,12,0,0,1,7.59-15.18l12-4a12,12,0,0,1,7.58,22.77l-12,4a12,12,0,0,1-15.17-7.59Zm-48-55.59,4-12a12,12,0,1,1,22.76,7.59l-4,12a12,12,0,1,1-22.76-7.59Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M192,144a64.33,64.33,0,0,1-2,16H66a64,64,0,1,1,126-16Z",opacity:"0.2"}),s.createElement("path",{d:"M240,152H199.55a73.54,73.54,0,0,0,.45-8,72,72,0,0,0-144,0,73.54,73.54,0,0,0,.45,8H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM72,144a56,56,0,1,1,111.41,8H72.59A56.13,56.13,0,0,1,72,144Zm144,56a8,8,0,0,1-8,8H48a8,8,0,0,1,0-16H208A8,8,0,0,1,216,200ZM72.84,43.58a8,8,0,0,1,14.32-7.16l8,16a8,8,0,0,1-14.32,7.16Zm-56,48.84a8,8,0,0,1,10.74-3.57l16,8a8,8,0,0,1-7.16,14.31l-16-8A8,8,0,0,1,16.84,92.42Zm192,15.16a8,8,0,0,1,3.58-10.73l16-8a8,8,0,1,1,7.16,14.31l-16,8a8,8,0,0,1-10.74-3.58Zm-48-55.16,8-16a8,8,0,0,1,14.32,7.16l-8,16a8,8,0,1,1-14.32-7.16Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M248,160a8,8,0,0,1-8,8H16a8,8,0,0,1,0-16H56.45a73.54,73.54,0,0,1-.45-8,72,72,0,0,1,144,0,73.54,73.54,0,0,1-.45,8H240A8,8,0,0,1,248,160Zm-40,32H48a8,8,0,0,0,0,16H208a8,8,0,0,0,0-16ZM80.84,59.58a8,8,0,0,0,14.32-7.16l-8-16a8,8,0,0,0-14.32,7.16ZM20.42,103.16l16,8a8,8,0,1,0,7.16-14.31l-16-8a8,8,0,1,0-7.16,14.31ZM216,112a8,8,0,0,0,3.57-.84l16-8a8,8,0,1,0-7.16-14.31l-16,8A8,8,0,0,0,216,112ZM164.42,63.16a8,8,0,0,0,10.74-3.58l8-16a8,8,0,0,0-14.32-7.16l-8,16A8,8,0,0,0,164.42,63.16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,154H197.28a70.91,70.91,0,0,0,.72-10,70,70,0,0,0-140,0,70.91,70.91,0,0,0,.72,10H16a6,6,0,0,0,0,12H240a6,6,0,0,0,0-12ZM70,144a58,58,0,1,1,115.13,10H70.87A58.63,58.63,0,0,1,70,144Zm144,56a6,6,0,0,1-6,6H48a6,6,0,0,1,0-12H208A6,6,0,0,1,214,200ZM74.63,42.69a6,6,0,0,1,10.74-5.37l8,16a6,6,0,0,1-10.74,5.36Zm-56,50.63a6,6,0,0,1,8.05-2.69l16,8a6,6,0,0,1-5.36,10.74l-16-8A6,6,0,0,1,18.63,93.32Zm192,13.36a6,6,0,0,1,2.69-8.05l16-8a6,6,0,1,1,5.36,10.74l-16,8a6,6,0,0,1-8.05-2.69Zm-48-53.36,8-16a6,6,0,0,1,10.74,5.37l-8,16a6,6,0,1,1-10.74-5.36Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,152H199.55a73.54,73.54,0,0,0,.45-8,72,72,0,0,0-144,0,73.54,73.54,0,0,0,.45,8H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM72,144a56,56,0,1,1,111.41,8H72.59A56.13,56.13,0,0,1,72,144Zm144,56a8,8,0,0,1-8,8H48a8,8,0,0,1,0-16H208A8,8,0,0,1,216,200ZM72.84,43.58a8,8,0,0,1,14.32-7.16l8,16a8,8,0,0,1-14.32,7.16Zm-56,48.84a8,8,0,0,1,10.74-3.57l16,8a8,8,0,0,1-7.16,14.31l-16-8A8,8,0,0,1,16.84,92.42Zm192,15.16a8,8,0,0,1,3.58-10.73l16-8a8,8,0,1,1,7.16,14.31l-16,8a8,8,0,0,1-10.74-3.58Zm-48-55.16,8-16a8,8,0,0,1,14.32,7.16l-8,16a8,8,0,1,1-14.32-7.16Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,156H194.94A68,68,0,1,0,60,144a68.73,68.73,0,0,0,1.06,12H16a4,4,0,0,0,0,8H240a4,4,0,0,0,0-8ZM68,144a60,60,0,1,1,118.79,12H69.21A60.16,60.16,0,0,1,68,144Zm144,56a4,4,0,0,1-4,4H48a4,4,0,0,1,0-8H208A4,4,0,0,1,212,200ZM76.42,41.79a4,4,0,0,1,7.16-3.58l8,16a4,4,0,0,1-7.16,3.58Zm-56,52.42a4,4,0,0,1,5.37-1.79l16,8a4,4,0,0,1-3.58,7.16l-16-8A4,4,0,0,1,20.42,94.21Zm192,11.58a4,4,0,0,1,1.79-5.37l16-8a4,4,0,1,1,3.58,7.16l-16,8a4,4,0,0,1-5.37-1.79Zm-48-51.58,8-16a4,4,0,1,1,7.16,3.58l-8,16a4,4,0,0,1-7.16-3.58Z"}))]]),II=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),s.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),FI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM188,204H68V72H188ZM76,20A12,12,0,0,1,88,8h80a12,12,0,0,1,0,24H88A12,12,0,0,1,76,20Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),s.createElement("path",{d:"M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,56a8,8,0,0,1-8,8h-8V208a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,56ZM88,32h80a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM82,24a6,6,0,0,1,6-6h80a6,6,0,0,1,0,12H88A6,6,0,0,1,82,24Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM84,24a4,4,0,0,1,4-4h80a4,4,0,0,1,0,8H88A4,4,0,0,1,84,24Z"}))]]),_I=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0ZM96.49,80.49,116,61v83a12,12,0,0,0,24,0V61l19.51,19.52a12,12,0,1,0,17-17l-40-40a12,12,0,0,0-17,0l-40,40a12,12,0,1,0,17,17Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z",opacity:"0.2"}),s.createElement("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM88,80h32v64a8,8,0,0,0,16,0V80h32a8,8,0,0,0,5.66-13.66l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,88,80Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0ZM92.24,76.24,122,46.49V144a6,6,0,0,0,12,0V46.49l29.76,29.75a6,6,0,0,0,8.48-8.48l-40-40a6,6,0,0,0-8.48,0l-40,40a6,6,0,0,0,8.48,8.48Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0ZM90.83,74.83,124,41.66V144a4,4,0,0,0,8,0V41.66l33.17,33.17a4,4,0,1,0,5.66-5.66l-40-40a4,4,0,0,0-5.66,0l-40,40a4,4,0,0,0,5.66,5.66Z"}))]]),VI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M234.38,210a123.36,123.36,0,0,0-60.78-53.23,76,76,0,1,0-91.2,0A123.36,123.36,0,0,0,21.62,210a12,12,0,1,0,20.77,12c18.12-31.32,50.12-50,85.61-50s67.49,18.69,85.61,50a12,12,0,0,0,20.77-12ZM76,96a52,52,0,1,1,52,52A52.06,52.06,0,0,1,76,96Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M192,96a64,64,0,1,1-64-64A64,64,0,0,1,192,96Z",opacity:"0.2"}),s.createElement("path",{d:"M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M230.93,220a8,8,0,0,1-6.93,4H32a8,8,0,0,1-6.92-12c15.23-26.33,38.7-45.21,66.09-54.16a72,72,0,1,1,73.66,0c27.39,8.95,50.86,27.83,66.09,54.16A8,8,0,0,1,230.93,220Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M229.19,213c-15.81-27.32-40.63-46.49-69.47-54.62a70,70,0,1,0-63.44,0C67.44,166.5,42.62,185.67,26.81,213a6,6,0,1,0,10.38,6C56.4,185.81,90.34,166,128,166s71.6,19.81,90.81,53a6,6,0,1,0,10.38-6ZM70,96a58,58,0,1,1,58,58A58.07,58.07,0,0,1,70,96Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M227.46,214c-16.52-28.56-43-48.06-73.68-55.09a68,68,0,1,0-51.56,0c-30.64,7-57.16,26.53-73.68,55.09a4,4,0,0,0,6.92,4C55,184.19,89.62,164,128,164s73,20.19,92.54,54a4,4,0,0,0,3.46,2,3.93,3.93,0,0,0,2-.54A4,4,0,0,0,227.46,214ZM68,96a60,60,0,1,1,60,60A60.07,60.07,0,0,1,68,96Z"}))]]),ZI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20ZM79.57,196.57a60,60,0,0,1,96.86,0,83.72,83.72,0,0,1-96.86,0ZM100,120a28,28,0,1,1,28,28A28,28,0,0,1,100,120ZM194,179.94a83.48,83.48,0,0,0-29-23.42,52,52,0,1,0-74,0,83.48,83.48,0,0,0-29,23.42,84,84,0,1,1,131.9,0Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a95.76,95.76,0,0,1-31.8,71.37A72,72,0,0,0,128,160a40,40,0,1,0-40-40,40,40,0,0,0,40,40,72,72,0,0,0-64.2,39.37h0A96,96,0,1,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24ZM74.08,197.5a64,64,0,0,1,107.84,0,87.83,87.83,0,0,1-107.84,0ZM96,120a32,32,0,1,1,32,32A32,32,0,0,1,96,120Zm97.76,66.41a79.66,79.66,0,0,0-36.06-28.75,48,48,0,1,0-59.4,0,79.66,79.66,0,0,0-36.06,28.75,88,88,0,1,1,131.52,0Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M172,120a44,44,0,1,1-44-44A44.05,44.05,0,0,1,172,120Zm60,8A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88.09,88.09,0,0,0-91.47-87.93C77.43,41.89,39.87,81.12,40,128.25a87.65,87.65,0,0,0,22.24,58.16A79.71,79.71,0,0,1,84,165.1a4,4,0,0,1,4.83.32,59.83,59.83,0,0,0,78.28,0,4,4,0,0,1,4.83-.32,79.71,79.71,0,0,1,21.79,21.31A87.62,87.62,0,0,0,216,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26ZM71.44,198a66,66,0,0,1,113.12,0,89.8,89.8,0,0,1-113.12,0ZM94,120a34,34,0,1,1,34,34A34,34,0,0,1,94,120Zm99.51,69.64a77.53,77.53,0,0,0-40-31.38,46,46,0,1,0-51,0,77.53,77.53,0,0,0-40,31.38,90,90,0,1,1,131,0Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24ZM74.08,197.5a64,64,0,0,1,107.84,0,87.83,87.83,0,0,1-107.84,0ZM96,120a32,32,0,1,1,32,32A32,32,0,0,1,96,120Zm97.76,66.41a79.66,79.66,0,0,0-36.06-28.75,48,48,0,1,0-59.4,0,79.66,79.66,0,0,0-36.06,28.75,88,88,0,1,1,131.52,0Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28ZM68.87,198.42a68,68,0,0,1,118.26,0,91.8,91.8,0,0,1-118.26,0Zm124.3-5.55a75.61,75.61,0,0,0-44.51-34,44,44,0,1,0-41.32,0,75.61,75.61,0,0,0-44.51,34,92,92,0,1,1,130.34,0ZM128,156a36,36,0,1,1,36-36A36,36,0,0,1,128,156Z"}))]]),zI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z",opacity:"0.2"}),s.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z"}))]]),BI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),s.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),UI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z"}))]]),WI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),s.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),KI=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),_7=s.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),Mt=s.forwardRef((e,t)=>{const{alt:n,color:r,size:a,weight:i,mirrored:l,children:u,weights:f,...h}=e,{color:p="currentColor",size:g,weight:m="regular",mirrored:w=!1,...y}=s.useContext(_7);return s.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:a??g,height:a??g,fill:r??p,viewBox:"0 0 256 256",transform:l||w?"scale(-1, 1)":void 0,...y,...h},!!n&&s.createElement("title",null,n),u,f.get(i??m))});Mt.displayName="IconBase";const V7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:jO}));V7.displayName="ApertureIcon";const Z7=V7,z7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:AO}));z7.displayName="ArchiveIcon";const dm=z7,B7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:NO}));B7.displayName="ArrowCircleUpIcon";const U7=B7,W7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:MO}));W7.displayName="ArrowClockwiseIcon";const K7=W7,G7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:RO}));G7.displayName="ArrowCounterClockwiseIcon";const ef=G7,Y7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:PO}));Y7.displayName="ArrowLeftIcon";const Rv=Y7,q7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:LO}));q7.displayName="ArrowLineUpIcon";const GI=q7,X7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:$O}));X7.displayName="ArrowRightIcon";const xa=X7,Q7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:TO}));Q7.displayName="ArrowSquareOutIcon";const Ac=Q7,J7=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:DO}));J7.displayName="ArrowUpIcon";const eE=J7,tE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:HO}));tE.displayName="ArrowsClockwiseIcon";const pp=tE,nE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:OO}));nE.displayName="ArrowsDownUpIcon";const YI=nE,rE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:IO}));rE.displayName="ArrowsOutSimpleIcon";const qI=rE,sE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:FO}));sE.displayName="BellIcon";const o8=sE,aE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:_O}));aE.displayName="CaretDownIcon";const bl=aE,oE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:VO}));oE.displayName="CaretLeftIcon";const $a=oE,iE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:ZO}));iE.displayName="CaretRightIcon";const Al=iE,lE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:zO}));lE.displayName="CaretUpIcon";const XI=lE,cE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:BO}));cE.displayName="ChartBarIcon";const QI=cE,uE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:UO}));uE.displayName="CheckIcon";const Kn=uE,dE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:WO}));dE.displayName="CircleIcon";const JI=dE,fE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:KO}));fE.displayName="CircleHalfIcon";const eF=fE,hE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:GO}));hE.displayName="CopyIcon";const mp=hE,pE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:YO}));pE.displayName="CopySimpleIcon";const Yx=pE,mE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:qO}));mE.displayName="DeviceMobileIcon";const tF=mE,gE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:XO}));gE.displayName="DotsThreeIcon";const Pv=gE,vE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:QO}));vE.displayName="DotsThreeVerticalIcon";const Lv=vE,wE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:JO}));wE.displayName="DownloadSimpleIcon";const yE=wE,bE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:eI}));bE.displayName="FilmSlateIcon";const fm=bE,xE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:tI}));xE.displayName="FolderSimpleIcon";const $v=xE,kE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:nI}));kE.displayName="FolderSimpleMinusIcon";const SE=kE,EE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:rI}));EE.displayName="FrameCornersIcon";const CE=EE,jE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:sI}));jE.displayName="GearSixIcon";const nF=jE,AE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:aI}));AE.displayName="GiftIcon";const rF=AE,NE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:oI}));NE.displayName="GithubLogoIcon";const sF=NE,ME=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:iI}));ME.displayName="GraduationCapIcon";const aF=ME,RE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:lI}));RE.displayName="HandWavingIcon";const oF=RE,PE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:cI}));PE.displayName="HouseIcon";const iF=PE,LE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:uI}));LE.displayName="IdentificationBadgeIcon";const hm=LE,$E=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:dI}));$E.displayName="ImageIcon";const lF=$E,TE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:fI}));TE.displayName="ImageSquareIcon";const Ta=TE,DE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:hI}));DE.displayName="ImagesIcon";const cF=DE,HE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:pI}));HE.displayName="InfinityIcon";const OE=HE,IE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:mI}));IE.displayName="InfoIcon";const pm=IE,FE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:gI}));FE.displayName="KeyIcon";const _E=FE,VE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:vI}));VE.displayName="KeyboardIcon";const uF=VE,ZE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:wI}));ZE.displayName="LightningIcon";const tf=ZE,zE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:yI}));zE.displayName="MagnifyingGlassIcon";const hd=zE,BE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:bI}));BE.displayName="MegaphoneIcon";const dF=BE,UE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:xI}));UE.displayName="MinusIcon";const fF=UE,WE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:kI}));WE.displayName="MountainsIcon";const hF=WE,KE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:SI}));KE.displayName="PackageIcon";const mm=KE,GE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:EI}));GE.displayName="PaletteIcon";const pF=GE,YE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:CI}));YE.displayName="PaperclipIcon";const mF=YE,qE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:jI}));qE.displayName="PencilSimpleIcon";const jd=qE,XE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:AI}));XE.displayName="PencilSimpleLineIcon";const gF=XE,QE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:NI}));QE.displayName="PlusIcon";const pr=QE,JE=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:MI}));JE.displayName="PlusCircleIcon";const vF=JE,eC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:RI}));eC.displayName="PowerIcon";const tC=eC,nC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:PI}));nC.displayName="QuestionIcon";const wF=nC,rC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:LI}));rC.displayName="SidebarSimpleIcon";const yF=rC,sC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:$I}));sC.displayName="SlidersHorizontalIcon";const Tv=sC,aC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:TI}));aC.displayName="StackIcon";const oC=aC,iC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:DI}));iC.displayName="StarIcon";const eo=iC,lC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:HI}));lC.displayName="StorefrontIcon";const cC=lC,uC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:OI}));uC.displayName="SunHorizonIcon";const dC=uC,fC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:II}));fC.displayName="TrashIcon";const Nl=fC,hC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:FI}));hC.displayName="TrashSimpleIcon";const gm=hC,pC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:_I}));pC.displayName="UploadSimpleIcon";const Dv=pC,mC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:VI}));mC.displayName="UserIcon";const bF=mC,gC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:ZI}));gC.displayName="UserCircleIcon";const xF=gC,vC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:zI}));vC.displayName="UserPlusIcon";const kF=vC,wC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:BI}));wC.displayName="WarningIcon";const vm=wC,yC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:UI}));yC.displayName="WarningCircleIcon";const zc=yC,bC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:WI}));bC.displayName="XIcon";const jn=bC,xC=s.forwardRef((e,t)=>s.createElement(Mt,{ref:t,...e,weights:KI}));xC.displayName="XCircleIcon";const SF=xC;var Br=Q9(),EF=Object.defineProperty,Hv=(e,t)=>EF(e,"name",{value:t,configurable:!0});function T6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Hv(T6,"setRef");function kC(...e){return t=>{let n=!1;const r=e.map(a=>{const i=T6(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():T6(e[a],null)}}}}Hv(kC,"composeRefs");function hn(...e){return s.useCallback(kC(...e),e)}Hv(hn,"useComposedRefs");var CF=Object.defineProperty,ao=(e,t)=>CF(e,"name",{value:t,configurable:!0});function to(e){const t=s.forwardRef((n,r)=>{let{children:a,...i}=n,l=null,u=!1;const f=[];D6(a)&&typeof xh=="function"&&(a=xh(a._payload)),s.Children.forEach(a,m=>{var w;if(jC(m)){u=!0;const y=m;let b="child"in y.props?y.props.child:y.props.children;D6(b)&&typeof xh=="function"&&(b=xh(b._payload)),l=jF(y,b),f.push((w=l==null?void 0:l.props)==null?void 0:w.children)}else f.push(m)}),l?l=s.cloneElement(l,void 0,f):!u&&s.Children.count(a)===1&&s.isValidElement(a)&&(l=a);const h=l?CC(l):void 0,p=hn(r,h);if(!l){if(a||a===0)throw new Error(u?MF(e):NF(e));return a}const g=EC(i,l.props??{});return l.type!==s.Fragment&&(g.ref=r?p:h),s.cloneElement(l,g)});return t.displayName=`${e}.Slot`,t}ao(to,"createSlot");var Bc=to("Slot"),SC=Symbol.for("radix.slottable");function Ov(e){const t=ao(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=SC,t}ao(Ov,"createSlottable");var wm=Ov("Slottable"),jF=ao((e,t)=>{if("child"in e.props){const n=e.props.child;return s.isValidElement(n)?s.cloneElement(n,void 0,e.props.children(n.props.children)):null}return s.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function EC(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...u)=>{const f=i(...u);return a(...u),f}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}ao(EC,"mergeProps");function CC(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ao(CC,"getElementRef");function jC(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===SC}ao(jC,"isSlottable");var AF=Symbol.for("react.lazy");function D6(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===AF&&"_payload"in e&&AC(e._payload)}ao(D6,"isLazyComponent");function AC(e){return typeof e=="object"&&e!==null&&"then"in e}ao(AC,"isPromiseLike");var NF=ao(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),MF=ao(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),xh=Fc[" use ".trim().toString()],RF=Object.defineProperty,PF=(e,t)=>RF(e,"name",{value:t,configurable:!0}),LF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=LF.reduce((e,t)=>{const n=to(`Primitive.${t}`),r=s.forwardRef((a,i)=>{const{asChild:l,...u}=a,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(f,{...u,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Iv(e,t){e&&Br.flushSync(()=>e.dispatchEvent(t))}PF(Iv,"dispatchDiscreteCustomEvent");var $F=Object.defineProperty,TF=(e,t)=>$F(e,"name",{value:t,configurable:!0}),NC=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),DF=s.forwardRef(TF(function(t,n){return o.jsx(vn.span,{...t,ref:n,style:{...NC,...t.style}})},"VisuallyHidden")),MC=DF,HF=Object.defineProperty,ka=(e,t)=>HF(e,"name",{value:t,configurable:!0});function OF(e,t){const n=s.createContext(t);n.displayName=e+"Context";const r=ka(i=>{const{children:l,...u}=i,f=s.useMemo(()=>u,Object.values(u));return o.jsx(n.Provider,{value:f,children:l})},"Provider");r.displayName=e+"Provider";function a(i,l={}){const{optional:u=!1}=l,f=s.useContext(n);if(f)return f;if(t!==void 0)return t;if(!u)throw new Error(`\`${i}\` must be used within \`${e}\``)}return ka(a,"useContext"),[r,a]}ka(OF,"createContext");function Zs(e,t=[]){let n=[];function r(i,l){const u=s.createContext(l);u.displayName=i+"Context";const f=n.length;n=[...n,l];const h=ka(g=>{var S;const{scope:m,children:w,...y}=g,b=((S=m==null?void 0:m[e])==null?void 0:S[f])||u,k=s.useMemo(()=>y,Object.values(y));return o.jsx(b.Provider,{value:k,children:w})},"Provider");h.displayName=i+"Provider";function p(g,m,w={}){var S;const{optional:y=!1}=w,b=((S=m==null?void 0:m[e])==null?void 0:S[f])||u,k=s.useContext(b);if(k)return k;if(l!==void 0)return l;if(!y)throw new Error(`\`${g}\` must be used within \`${i}\``)}return ka(p,"useContext"),[h,p]}ka(r,"createContext");const a=ka(()=>{const i=n.map(l=>s.createContext(l));return ka(function(u){const f=(u==null?void 0:u[e])||i;return s.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])},"useScope")},"createScope");return a.scopeName=e,[r,RC(a,...t)]}ka(Zs,"createContextScope");function RC(...e){const t=e[0];if(e.length===1)return t;const n=ka(()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return ka(function(i){const l=r.reduce((u,{useScope:f,scopeName:h})=>{const g=f(i)[`__scope${h}`];return{...u,...g}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}ka(RC,"composeContextScopes");var IF=Object.defineProperty,Zr=(e,t)=>IF(e,"name",{value:t,configurable:!0});function ym(e){const t=e+"CollectionProvider",[n,r]=Zs(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=Zr(b=>{const{scope:k,children:S}=b,E=s.useRef(null),C=s.useRef(new Map).current;return o.jsx(a,{scope:k,itemMap:C,collectionRef:E,children:S})},"CollectionProvider");l.displayName=t;const u=e+"CollectionSlot",f=to(u),h=s.forwardRef((b,k)=>{const{scope:S,children:E}=b,C=i(u,S),A=hn(k,C.collectionRef);return o.jsx(f,{ref:A,children:E})});h.displayName=u;const p=e+"CollectionItemSlot",g="data-radix-collection-item",m=to(p),w=s.forwardRef((b,k)=>{const{scope:S,children:E,...C}=b,A=s.useRef(null),L=hn(k,A),T=i(p,S);return s.useEffect(()=>(T.itemMap.set(A,{ref:A,...C}),()=>void T.itemMap.delete(A))),o.jsx(m,{[g]:"",ref:L,children:E})});w.displayName=p;function y(b){const k=i(e+"CollectionConsumer",b);return s.useCallback(()=>{const E=k.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(k.itemMap.values()).sort((T,M)=>C.indexOf(T.ref.current)-C.indexOf(M.ref.current))},[k.collectionRef,k.itemMap])}return Zr(y,"useCollection"),[{Provider:l,Slot:h,ItemSlot:w},y,r]}Zr(ym,"createCollection");var qx=new WeakMap,br,Js,i8=(Js=class extends Map{constructor(n){super(n);lx(this,br);Gg(this,br,[...super.keys()]),qx.set(this,!0)}set(n,r){return qx.get(this)&&(this.has(n)?os(this,br)[os(this,br).indexOf(n)]=n:os(this,br).push(n)),super.set(n,r),this}insert(n,r,a){const i=this.has(r),l=os(this,br).length,u=Fv(n);let f=u>=0?u:l+u;const h=f<0||f>=l?-1:f;if(h===this.size||i&&h===this.size-1||h===-1)return this.set(r,a),this;const p=this.size+(i?0:1);u<0&&f++;const g=[...os(this,br)];let m,w=!1;for(let y=f;y<p;y++)if(f===y){let b=g[y];g[y]===r&&(b=g[y+1]),i&&this.delete(r),m=this.get(b),this.set(r,a)}else{!w&&g[y-1]===r&&(w=!0);const b=g[w?y:y-1],k=m;m=this.get(b),this.delete(b),this.set(b,k)}return this}with(n,r,a){const i=new Js(this);return i.insert(n,r,a),i}before(n){const r=os(this,br).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,a){const i=os(this,br).indexOf(n);return i===-1?this:this.insert(i,r,a)}after(n){let r=os(this,br).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,a){const i=os(this,br).indexOf(n);return i===-1?this:this.insert(i+1,r,a)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Gg(this,br,[]),super.clear()}delete(n){const r=super.delete(n);return r&&os(this,br).splice(os(this,br).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Jh(os(this,br),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Jh(os(this,br),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return os(this,br).indexOf(n)}keyAt(n){return Jh(os(this,br),n)}from(n,r){const a=this.indexOf(n);if(a===-1)return;let i=a+r;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(n,r){const a=this.indexOf(n);if(a===-1)return;let i=a+r;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(n,r){let a=0;for(const i of this){if(Reflect.apply(n,r,[i,a,this]))return i;a++}}findIndex(n,r){let a=0;for(const i of this){if(Reflect.apply(n,r,[i,a,this]))return a;a++}return-1}filter(n,r){const a=[];let i=0;for(const l of this)Reflect.apply(n,r,[l,i,this])&&a.push(l),i++;return new Js(a)}map(n,r){const a=[];let i=0;for(const l of this)a.push([l[0],Reflect.apply(n,r,[l,i,this])]),i++;return new Js(a)}reduce(...n){const[r,a]=n;let i=0,l=a??this.at(0);for(const u of this)i===0&&n.length===1?l=u:l=Reflect.apply(r,this,[l,u,i,this]),i++;return l}reduceRight(...n){const[r,a]=n;let i=a??this.at(-1);for(let l=this.size-1;l>=0;l--){const u=this.at(l);l===this.size-1&&n.length===1?i=u:i=Reflect.apply(r,this,[i,u,l,this])}return i}toSorted(n){const r=[...this.entries()].sort(n);return new Js(r)}toReversed(){const n=new Js;for(let r=this.size-1;r>=0;r--){const a=this.keyAt(r),i=this.get(a);n.set(a,i)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new Js(r)}slice(n,r){const a=new Js;let i=this.size-1;if(n===void 0)return a;n<0&&(n=n+this.size),r!==void 0&&r>0&&(i=r-1);for(let l=n;l<=i;l++){const u=this.keyAt(l),f=this.get(u);a.set(u,f)}return a}every(n,r){let a=0;for(const i of this){if(!Reflect.apply(n,r,[i,a,this]))return!1;a++}return!0}some(n,r){let a=0;for(const i of this){if(Reflect.apply(n,r,[i,a,this]))return!0;a++}return!1}},br=new WeakMap,Zr(Js,"OrderedDict"),Js);function Jh(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=PC(e,t);return n===-1?void 0:e[n]}Zr(Jh,"at");function PC(e,t){const n=e.length,r=Fv(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}Zr(PC,"toSafeIndex");function Fv(e){return e!==e||e===0?0:Math.trunc(e)}Zr(Fv,"toSafeInteger");function FF(e){const t=e+"CollectionProvider",[n,r]=Zs(t),[a,i]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new i8,setItemMap:Zr(()=>{},"setItemMap")}),l=Zr(({state:C,...A})=>C?o.jsx(f,{...A,state:C}):o.jsx(u,{...A}),"CollectionProvider");l.displayName=t;const u=Zr(C=>{const A=k();return o.jsx(f,{...C,state:A})},"CollectionInit");u.displayName=t+"Init";const f=Zr(C=>{const{scope:A,children:L,state:T}=C,M=s.useRef(null),[j,P]=s.useState(null),R=hn(M,P),[H,D]=T;return s.useEffect(()=>{if(!j)return;const B=TC(()=>{});return B.observe(j,{childList:!0,subtree:!0}),()=>{B.disconnect()}},[j]),o.jsx(a,{scope:A,itemMap:H,setItemMap:D,collectionRef:R,collectionRefObject:M,collectionElement:j,children:L})},"CollectionProviderImpl");f.displayName=t+"Impl";const h=e+"CollectionSlot",p=to(h),g=s.forwardRef((C,A)=>{const{scope:L,children:T}=C,M=i(h,L),j=hn(A,M.collectionRef);return o.jsx(p,{ref:j,children:T})});g.displayName=h;const m=e+"CollectionItemSlot",w="data-radix-collection-item",y=to(m),b=s.forwardRef((C,A)=>{const{scope:L,children:T,...M}=C,j=s.useRef(null),[P,R]=s.useState(null),H=hn(A,j,R),D=i(m,L),{setItemMap:B}=D,V=s.useRef(M);LC(V.current,M)||(V.current=M);const U=V.current;return s.useEffect(()=>{const K=U;return B(O=>P?O.has(P)?O.set(P,{...K,element:P}).toSorted(H6):(O.set(P,{...K,element:P}),O.toSorted(H6)):O),()=>{B(O=>!P||!O.has(P)?O:(O.delete(P),new i8(O)))}},[P,U,B]),o.jsx(y,{[w]:"",ref:H,children:T})});b.displayName=m;function k(){return s.useState(new i8)}Zr(k,"useInitCollection");function S(C){const{itemMap:A}=i(e+"CollectionConsumer",C);return A}return Zr(S,"useCollection"),[{Provider:l,Slot:g,ItemSlot:b},{createCollectionScope:r,useCollection:S,useInitCollection:k}]}Zr(FF,"createCollection");function LC(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const a of n)if(!Object.prototype.hasOwnProperty.call(t,a)||e[a]!==t[a])return!1;return!0}Zr(LC,"shallowEqual");function $C(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Zr($C,"isElementPreceding");function H6(e,t){return!e[1].element||!t[1].element?0:$C(e[1].element,t[1].element)?-1:1}Zr(H6,"sortByDocumentPosition");function TC(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Zr(TC,"getChildListObserver");var _F=Object.defineProperty,Ad=(e,t)=>_F(e,"name",{value:t,configurable:!0}),DC=!!(typeof window<"u"&&window.document&&window.document.createElement);function Nt(e,t,{checkForDefaultPrevented:n=!0}={}){return Ad(function(a){if(e==null||e(a),n===!1||!a||!a.defaultPrevented)return t==null?void 0:t(a)},"handleEvent")}Ad(Nt,"composeEventHandlers");function VF(e){var t;if(!DC)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Ad(VF,"getOwnerWindow");function O6(e){if(!DC)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Ad(O6,"getOwnerDocument");function HC(e,t=!1){const{activeElement:n}=O6(e);if(!(n!=null&&n.nodeName))return null;if(OC(n)&&n.contentDocument)return HC(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const a=O6(n).getElementById(r);if(a)return a}}return n}Ad(HC,"getActiveElement");function OC(e){return e.tagName==="IFRAME"}Ad(OC,"isFrame");var Er=globalThis!=null&&globalThis.document?s.useLayoutEffect:()=>{},ZF=Object.defineProperty,zF=(e,t)=>ZF(e,"name",{value:t,configurable:!0}),Xx=Fc[" useEffectEvent ".trim().toString()],Qx=Fc[" useInsertionEffect ".trim().toString()];function IC(e){if(typeof Xx=="function")return Xx(e);const t=s.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Qx=="function"?Qx(()=>{t.current=e}):Er(()=>{t.current=e}),s.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}zF(IC,"useEffectEvent");var BF=Object.defineProperty,Lf=(e,t)=>BF(e,"name",{value:t,configurable:!0}),UF=Fc[" useInsertionEffect ".trim().toString()]||Er;function wi({prop:e,defaultProp:t,onChange:n=Lf(()=>{},"onChange"),caller:r}){const[a,i,l]=FC({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:a,h=s.useCallback(p=>{var g;if(u){const m=_C(p)?p(e):p;m!==e&&((g=l.current)==null||g.call(l,m))}else i(p)},[u,e,i,l]);return[f,h]}Lf(wi,"useControllableState");function FC({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),a=s.useRef(n),i=s.useRef(t);return UF(()=>{i.current=t},[t]),s.useEffect(()=>{var l;a.current!==n&&((l=i.current)==null||l.call(i,n),a.current=n)},[n,a]),[n,r,i]}Lf(FC,"useUncontrolledState");function _C(e){return typeof e=="function"}Lf(_C,"isFunction");var Jx=Symbol("RADIX:SYNC_STATE");function WF(e,t,n,r){const{prop:a,defaultProp:i,onChange:l,caller:u}=t,f=a!==void 0,h=IC(l),p=[{...n,state:i}];r&&p.push(r);const[g,m]=s.useReducer((k,S)=>{if(S.type===Jx)return{...k,state:S.state};const E=e(k,S);return f&&!Object.is(E.state,k.state)&&h(E.state),E},...p),w=g.state,y=s.useRef(w);s.useEffect(()=>{y.current!==w&&(y.current=w,f||h(w))},[w,y,f]);const b=s.useMemo(()=>a!==void 0?{...g,state:a}:g,[g,a]);return s.useEffect(()=>{f&&!Object.is(a,g.state)&&m({type:Jx,state:a})},[a,g.state,f]),[b,m]}Lf(WF,"useControllableStateReducer");var KF=Object.defineProperty,yi=(e,t)=>KF(e,"name",{value:t,configurable:!0});function VC(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}yi(VC,"useStateMachine");var ps=yi(e=>{const{present:t,children:n}=e,r=ZC(t),a=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),i=zC(r.ref,BC(a));return typeof n=="function"||r.isPresent?s.cloneElement(a,{ref:i}):null},"Presence");function ZC(e){const[t,n]=s.useState(),r=s.useRef(null),a=s.useRef(e),i=s.useRef("none"),l=s.useRef(void 0),u=e?"mounted":"unmounted",[f,h]=VC(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{f==="mounted"?(i.current=l.current??_u(r.current),l.current=void 0):i.current="none"},[f]),Er(()=>{const p=r.current,g=a.current;if(g!==e){const w=i.current,y=_u(p);e?(l.current=y,h("MOUNT")):y==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(g&&w!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),Er(()=>{if(t){let p;const g=t.ownerDocument.defaultView??window,m=yi(y=>{const k=_u(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&k&&(h("ANIMATION_END"),!a.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",p=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),w=yi(y=>{y.target===t&&(i.current=_u(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.clearTimeout(p),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:s.useCallback(p=>{if(p){const g=getComputedStyle(p);r.current=g,l.current=_u(g)}else r.current=null;n(p)},[])}}yi(ZC,"usePresence");function I6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}yi(I6,"setRef");function zC(...e){const t=s.useRef(e);return t.current=e,s.useCallback(n=>{const r=t.current;let a=!1;const i=r.map(l=>{const u=I6(l,n);return!a&&typeof u=="function"&&(a=!0),u});if(a)return()=>{for(let l=0;l<i.length;l++){const u=i[l];typeof u=="function"?u():I6(r[l],null)}}},[])}yi(zC,"useStableComposedRefs");function _u(e){return(e==null?void 0:e.animationName)||"none"}yi(_u,"getAnimationName");function BC(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}yi(BC,"getElementRef");var GF=Object.defineProperty,YF=(e,t)=>GF(e,"name",{value:t,configurable:!0}),qF=Fc[" useId ".trim().toString()]||(()=>{}),XF=0;function Na(e){const[t,n]=s.useState(qF());return Er(()=>{e||n(r=>r??String(XF++))},[e]),e||(t?`radix-${t}`:"")}YF(Na,"useId");var QF=Object.defineProperty,UC=(e,t)=>QF(e,"name",{value:t,configurable:!0}),WC=s.createContext(void 0),JF=UC(e=>{const{dir:t,children:n}=e;return o.jsx(WC.Provider,{value:t,children:n})},"DirectionProvider");function $f(e){const t=s.useContext(WC);return e||t||"ltr"}UC($f,"useDirection");var e_=JF,t_=Object.defineProperty,n_=(e,t)=>t_(e,"name",{value:t,configurable:!0});function kr(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}n_(kr,"useCallbackRef");var r_=Object.defineProperty,Vr=(e,t)=>r_(e,"name",{value:t,configurable:!0}),F6="dismissableLayer.update",s_="dismissableLayer.pointerDownOutside",a_="dismissableLayer.focusOutside",e5,KC=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Tf=s.forwardRef(Vr(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:a=!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,onDismiss:h,...p}=t,g=s.useContext(KC),[m,w]=s.useState(null),y=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=s.useState({}),k=hn(n,w),S=Array.from(g.layers),[E]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),C=E?S.indexOf(E):-1,A=m?S.indexOf(m):-1,L=g.layersWithOutsidePointerEventsDisabled.size>0,T=A>=C,M=s.useRef(!1),j=YC(D=>{l==null||l(D),f==null||f(D),D.defaultPrevented||h==null||h()},{ownerDocument:y,deferPointerDownOutside:a,isDeferredPointerDownOutsideRef:M,dismissableSurfaces:g.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(D=>{if(!(D instanceof Node))return!1;const B=[...g.branches].some(V=>V.contains(D));return T&&!B},[g.branches,T])}),P=qC(D=>{if(a&&M.current)return;const B=D.target;[...g.branches].some(U=>U.contains(B))||(u==null||u(D),f==null||f(D),D.defaultPrevented||h==null||h())},y),R=m?A===S.length-1:!1,H=kr(D=>{D.key==="Escape"&&(i==null||i(D),!D.defaultPrevented&&h&&(D.preventDefault(),h()))});return s.useEffect(()=>{if(R)return y.addEventListener("keydown",H,{capture:!0}),()=>y.removeEventListener("keydown",H,{capture:!0})},[y,R,H]),s.useEffect(()=>{if(m)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(e5=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(m)),g.layers.add(m),_6(),()=>{r&&(g.layersWithOutsidePointerEventsDisabled.delete(m),g.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=e5))}},[m,y,r,g]),s.useEffect(()=>()=>{m&&(g.layers.delete(m),g.layersWithOutsidePointerEventsDisabled.delete(m),_6())},[m,g]),s.useEffect(()=>{const D=Vr(()=>b({}),"handleUpdate");return document.addEventListener(F6,D),()=>document.removeEventListener(F6,D)},[]),o.jsx(vn.div,{...p,ref:k,style:{pointerEvents:L?T?"auto":"none":void 0,...t.style},onFocusCapture:Nt(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Nt(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Nt(t.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function GC(){const e=s.useContext(KC),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Vr(GC,"useDismissableLayerSurface");var o_=Vr(()=>!0,"IS_TRUE");function YC(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:i,shouldHandlePointerDownOutside:l=o_}=t,u=kr(e),f=s.useRef(!1),h=s.useRef(!1),p=s.useRef(new Map),g=s.useRef(()=>{});return s.useEffect(()=>{function m(){h.current=!1,a.current=!1,p.current.clear()}Vr(m,"resetOutsideInteraction");function w(){return Array.from(p.current.values()).some(Boolean)}Vr(w,"isOutsideInteractionIntercepted");function y(C){if(!h.current)return;const A=C.target;A instanceof Node&&[...i].some(T=>T.contains(A))||p.current.set(C.type,!0),C.type==="click"&&window.setTimeout(()=>{h.current&&g.current()},0)}Vr(y,"handleInteractionCapture");function b(C){h.current&&p.current.set(C.type,!1)}Vr(b,"handleInteractionBubble");const k=Vr(C=>{if(C.target&&!f.current){let A=function(){n.removeEventListener("click",g.current);const T=w();m(),T||_v(s_,u,L,{discrete:!0})};if(Vr(A,"handleAndDispatchPointerDownOutsideEvent"),!l(C.target)){n.removeEventListener("click",g.current),m(),f.current=!1;return}const L={originalEvent:C};h.current=!0,a.current=r&&C.button===0,p.current.clear(),!r||C.button!==0?A():(n.removeEventListener("click",g.current),g.current=A,n.addEventListener("click",g.current,{once:!0}))}else n.removeEventListener("click",g.current),m();f.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const C of S)n.addEventListener(C,y,!0),n.addEventListener(C,b);const E=window.setTimeout(()=>{n.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(E),n.removeEventListener("pointerdown",k),n.removeEventListener("click",g.current);for(const C of S)n.removeEventListener(C,y,!0),n.removeEventListener(C,b)}},[n,u,r,a,i,l]),{onPointerDownCapture:Vr(()=>f.current=!0,"onPointerDownCapture")}}Vr(YC,"usePointerDownOutside");function qC(e,t=globalThis==null?void 0:globalThis.document){const n=kr(e),r=s.useRef(!1);return s.useEffect(()=>{const a=Vr(i=>{i.target&&!r.current&&_v(a_,n,{originalEvent:i},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:Vr(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Vr(()=>r.current=!1,"onBlurCapture")}}Vr(qC,"useFocusOutside");function _6(){const e=new CustomEvent(F6);document.dispatchEvent(e)}Vr(_6,"dispatchUpdate");function _v(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Iv(a,i):a.dispatchEvent(i)}Vr(_v,"handleAndDispatchCustomEvent");var i_=Object.defineProperty,Ss=(e,t)=>i_(e,"name",{value:t,configurable:!0}),l8="focusScope.autoFocusOnMount",c8="focusScope.autoFocusOnUnmount",t5={bubbles:!1,cancelable:!0},Nd=s.forwardRef(Ss(function(t,n){const{loop:r=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=t,[f,h]=s.useState(null),p=kr(i),g=kr(l),m=s.useRef(null),w=hn(n,h),y=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(a){let k=function(A){if(y.paused||!f)return;const L=A.target;f.contains(L)?m.current=L:Jo(m.current,{select:!0})},S=function(A){if(y.paused||!f)return;const L=A.relatedTarget;L!==null&&(f.contains(L)||Jo(m.current,{select:!0}))},E=function(A){if(document.activeElement===document.body)for(const T of A)T.removedNodes.length>0&&Jo(f)};Ss(k,"handleFocusIn"),Ss(S,"handleFocusOut"),Ss(E,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",S);const C=new MutationObserver(E);return f&&C.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",S),C.disconnect()}}},[a,f,y.paused]),s.useEffect(()=>{if(f){n5.add(y);const k=document.activeElement;if(!f.contains(k)){const E=new CustomEvent(l8,t5);f.addEventListener(l8,p),f.dispatchEvent(E),E.defaultPrevented||(XC(nj(Vv(f)),{select:!0}),document.activeElement===k&&Jo(f))}return()=>{f.removeEventListener(l8,p),setTimeout(()=>{const E=new CustomEvent(c8,t5);f.addEventListener(c8,g),f.dispatchEvent(E),E.defaultPrevented||Jo(k??document.body,{select:!0}),f.removeEventListener(c8,g),n5.remove(y)},0)}}},[f,p,g,y]);const b=s.useCallback(k=>{if(!r&&!a||y.paused)return;const S=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,E=document.activeElement;if(S&&E){const C=k.currentTarget,[A,L]=QC(C);A&&L?!k.shiftKey&&E===L?(k.preventDefault(),r&&Jo(A,{select:!0})):k.shiftKey&&E===A&&(k.preventDefault(),r&&Jo(L,{select:!0})):E===C&&k.preventDefault()}},[r,a,y.paused]);return o.jsx(vn.div,{tabIndex:-1,...u,ref:w,onKeyDown:b})},"FocusScope"));function XC(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Jo(r,{select:t}),document.activeElement!==n)return}Ss(XC,"focusFirst");function QC(e){const t=Vv(e),n=V6(t,e),r=V6(t.reverse(),e);return[n,r]}Ss(QC,"getTabbableEdges");function Vv(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Ss(r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Ss(Vv,"getTabbableCandidates");function V6(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):JC(r,{upTo:t})))return r}Ss(V6,"findVisible");function JC(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Ss(JC,"isHidden");function ej(e){return e instanceof HTMLInputElement&&"select"in e}Ss(ej,"isSelectableInput");function Jo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ej(e)&&t&&e.select()}}Ss(Jo,"focus");var n5=tj();function tj(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Z6(e,t),e.unshift(t)},remove(t){var n;e=Z6(e,t),(n=e[0])==null||n.resume()}}}Ss(tj,"createFocusScopesStack");function Z6(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ss(Z6,"arrayRemove");function nj(e){return e.filter(t=>t.tagName!=="A")}Ss(nj,"removeLinks");var l_=Object.defineProperty,c_=(e,t)=>l_(e,"name",{value:t,configurable:!0}),Df=s.forwardRef(c_(function(t,n){var f;const{container:r,...a}=t,[i,l]=s.useState(!1);Er(()=>l(!0),[]);const u=r||i&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return u?Br.createPortal(o.jsx(vn.div,{...a,ref:n}),u):null},"Portal")),u_=Object.defineProperty,Zv=(e,t)=>u_(e,"name",{value:t,configurable:!0}),kh=0,yo=null;function d_(e){return Md(),e.children}Zv(d_,"FocusGuards");function Md(){s.useEffect(()=>{yo||(yo={start:z6(),end:z6()});const{start:e,end:t}=yo;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),kh++,()=>{kh===1&&(yo==null||yo.start.remove(),yo==null||yo.end.remove(),yo=null),kh=Math.max(0,kh-1)}},[])}Zv(Md,"useFocusGuards");function z6(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Zv(z6,"createFocusGuard");var So=function(){return So=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},So.apply(this,arguments)};function rj(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function f_(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var ep="right-scroll-bar-position",tp="width-before-scroll-bar",h_="with-scroll-bars-hidden",p_="--removed-body-scroll-bar-size";function u8(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function m_(e,t){var n=s.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var g_=typeof window<"u"?s.useLayoutEffect:s.useEffect,r5=new WeakMap;function v_(e,t){var n=m_(null,function(r){return e.forEach(function(a){return u8(a,r)})});return g_(function(){var r=r5.get(n);if(r){var a=new Set(r),i=new Set(e),l=n.current;a.forEach(function(u){i.has(u)||u8(u,null)}),i.forEach(function(u){a.has(u)||u8(u,l)})}r5.set(n,e)},[e]),n}function w_(e){return e}function y_(e,t){t===void 0&&(t=w_);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(u){return i(u)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(i),l=n}var f=function(){var p=l;l=[],p.forEach(i)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(p){l.push(p),h()},filter:function(p){return l=l.filter(p),n}}}};return a}function b_(e){e===void 0&&(e={});var t=y_(null);return t.options=So({async:!0,ssr:!1},e),t}var sj=function(e){var t=e.sideCar,n=rj(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return s.createElement(r,So({},n))};sj.isSideCarExport=!0;function x_(e,t){return e.useMedium(t),sj}var aj=b_(),d8=function(){},bm=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:d8,onWheelCapture:d8,onTouchMoveCapture:d8}),a=r[0],i=r[1],l=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,m=e.sideCar,w=e.noRelative,y=e.noIsolation,b=e.inert,k=e.allowPinchZoom,S=e.as,E=S===void 0?"div":S,C=e.gapMode,A=rj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=m,T=v_([n,t]),M=So(So({},A),a);return s.createElement(s.Fragment,null,p&&s.createElement(L,{sideCar:aj,removeScrollBar:h,shards:g,noRelative:w,noIsolation:y,inert:b,setCallbacks:i,allowPinchZoom:!!k,lockRef:n,gapMode:C}),l?s.cloneElement(s.Children.only(u),So(So({},M),{ref:T})):s.createElement(E,So({},M,{className:f,ref:T}),u))});bm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bm.classNames={fullWidth:tp,zeroRight:ep};var k_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function S_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=k_();return t&&e.setAttribute("nonce",t),e}function E_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function C_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var j_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=S_())&&(E_(t,n),C_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},A_=function(){var e=j_();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},oj=function(){var e=A_(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},N_={left:0,top:0,right:0,gap:0},f8=function(e){return parseInt(e||"",10)||0},M_=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[f8(n),f8(r),f8(a)]},R_=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return N_;var t=M_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},P_=oj(),Ju="data-scroll-locked",L_=function(e,t,n,r){var a=e.left,i=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
53
+ .`.concat(h_,` {
54
+ overflow: hidden `).concat(r,`;
55
+ padding-right: `).concat(u,"px ").concat(r,`;
56
+ }
57
+ body[`).concat(Ju,`] {
58
+ overflow: hidden `).concat(r,`;
59
+ overscroll-behavior: contain;
60
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
61
+ padding-left: `.concat(a,`px;
62
+ padding-top: `).concat(i,`px;
63
+ padding-right: `).concat(l,`px;
64
+ margin-left:0;
65
+ margin-top:0;
66
+ margin-right: `).concat(u,"px ").concat(r,`;
67
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
68
+ }
69
+
70
+ .`).concat(ep,` {
71
+ right: `).concat(u,"px ").concat(r,`;
72
+ }
73
+
74
+ .`).concat(tp,` {
75
+ margin-right: `).concat(u,"px ").concat(r,`;
76
+ }
77
+
78
+ .`).concat(ep," .").concat(ep,` {
79
+ right: 0 `).concat(r,`;
80
+ }
81
+
82
+ .`).concat(tp," .").concat(tp,` {
83
+ margin-right: 0 `).concat(r,`;
84
+ }
85
+
86
+ body[`).concat(Ju,`] {
87
+ `).concat(p_,": ").concat(u,`px;
88
+ }
89
+ `)},s5=function(){var e=parseInt(document.body.getAttribute(Ju)||"0",10);return isFinite(e)?e:0},$_=function(){s.useEffect(function(){return document.body.setAttribute(Ju,(s5()+1).toString()),function(){var e=s5()-1;e<=0?document.body.removeAttribute(Ju):document.body.setAttribute(Ju,e.toString())}},[])},T_=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;$_();var i=s.useMemo(function(){return R_(a)},[a]);return s.createElement(P_,{styles:L_(i,!t,a,n?"":"!important")})},B6=!1;if(typeof window<"u")try{var Sh=Object.defineProperty({},"passive",{get:function(){return B6=!0,!0}});window.addEventListener("test",Sh,Sh),window.removeEventListener("test",Sh,Sh)}catch{B6=!1}var ju=B6?{passive:!1}:!1,D_=function(e){return e.tagName==="TEXTAREA"},ij=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!D_(e)&&n[t]==="visible")},H_=function(e){return ij(e,"overflowY")},O_=function(e){return ij(e,"overflowX")},a5=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=lj(e,r);if(a){var i=cj(e,r),l=i[1],u=i[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},I_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},F_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},lj=function(e,t){return e==="v"?H_(t):O_(t)},cj=function(e,t){return e==="v"?I_(t):F_(t)},__=function(e,t){return e==="h"&&t==="rtl"?-1:1},V_=function(e,t,n,r,a){var i=__(e,window.getComputedStyle(t).direction),l=i*r,u=n.target,f=t.contains(u),h=!1,p=l>0,g=0,m=0;do{if(!u)break;var w=cj(e,u),y=w[0],b=w[1],k=w[2],S=b-k-i*y;(y||S)&&lj(e,u)&&(g+=S,m+=y);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(p&&Math.abs(g)<1||!p&&Math.abs(m)<1)&&(h=!0),h},Eh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},o5=function(e){return[e.deltaX,e.deltaY]},i5=function(e){return e&&"current"in e?e.current:e},Z_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},z_=function(e){return`
90
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
91
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
92
+ `)},B_=0,Au=[];function U_(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),a=s.useState(B_++)[0],i=s.useState(oj)[0],l=s.useRef(e);s.useEffect(function(){l.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=f_([e.lockRef.current],(e.shards||[]).map(i5),!0).filter(Boolean);return b.forEach(function(k){return k.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=s.useCallback(function(b,k){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!l.current.allowPinchZoom;var S=Eh(b),E=n.current,C="deltaX"in b?b.deltaX:E[0]-S[0],A="deltaY"in b?b.deltaY:E[1]-S[1],L,T=b.target,M=Math.abs(C)>Math.abs(A)?"h":"v";if("touches"in b&&M==="h"&&T.type==="range")return!1;var j=window.getSelection(),P=j&&j.anchorNode,R=P?P===T||P.contains(T):!1;if(R)return!1;var H=a5(M,T);if(!H)return!0;if(H?L=M:(L=M==="v"?"h":"v",H=a5(M,T)),!H)return!1;if(!r.current&&"changedTouches"in b&&(C||A)&&(r.current=L),!L)return!0;var D=r.current||L;return V_(D,k,b,D==="h"?C:A)},[]),f=s.useCallback(function(b){var k=b;if(!(!Au.length||Au[Au.length-1]!==i)){var S="deltaY"in k?o5(k):Eh(k),E=t.current.filter(function(L){return L.name===k.type&&(L.target===k.target||k.target===L.shadowParent)&&Z_(L.delta,S)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var C=(l.current.shards||[]).map(i5).filter(Boolean).filter(function(L){return L.contains(k.target)}),A=C.length>0?u(k,C[0]):!l.current.noIsolation;A&&k.cancelable&&k.preventDefault()}}},[]),h=s.useCallback(function(b,k,S,E){var C={name:b,delta:k,target:S,should:E,shadowParent:W_(S)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(A){return A!==C})},1)},[]),p=s.useCallback(function(b){n.current=Eh(b),r.current=void 0},[]),g=s.useCallback(function(b){h(b.type,o5(b),b.target,u(b,e.lockRef.current))},[]),m=s.useCallback(function(b){h(b.type,Eh(b),b.target,u(b,e.lockRef.current))},[]);s.useEffect(function(){return Au.push(i),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",f,ju),document.addEventListener("touchmove",f,ju),document.addEventListener("touchstart",p,ju),function(){Au=Au.filter(function(b){return b!==i}),document.removeEventListener("wheel",f,ju),document.removeEventListener("touchmove",f,ju),document.removeEventListener("touchstart",p,ju)}},[]);var w=e.removeScrollBar,y=e.inert;return s.createElement(s.Fragment,null,y?s.createElement(i,{styles:z_(a)}):null,w?s.createElement(T_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function W_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const K_=x_(aj,U_);var Hf=s.forwardRef(function(e,t){return s.createElement(bm,So({},e,{ref:t,sideCar:K_}))});Hf.classNames=bm.classNames;var G_=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nu=new WeakMap,Ch=new WeakMap,jh={},h8=0,uj=function(e){return e&&(e.host||uj(e.parentNode))},Y_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=uj(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},q_=function(e,t,n,r){var a=Y_(t,Array.isArray(e)?e:[e]);jh[n]||(jh[n]=new WeakMap);var i=jh[n],l=[],u=new Set,f=new Set(a),h=function(g){!g||u.has(g)||(u.add(g),h(g.parentNode))};a.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(m){if(u.has(m))p(m);else try{var w=m.getAttribute(r),y=w!==null&&w!=="false",b=(Nu.get(m)||0)+1,k=(i.get(m)||0)+1;Nu.set(m,b),i.set(m,k),l.push(m),b===1&&y&&Ch.set(m,!0),k===1&&m.setAttribute(n,"true"),y||m.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",m,S)}})};return p(t),u.clear(),h8++,function(){l.forEach(function(g){var m=Nu.get(g)-1,w=i.get(g)-1;Nu.set(g,m),i.set(g,w),m||(Ch.has(g)||g.removeAttribute(r),Ch.delete(g)),w||g.removeAttribute(n)}),h8--,h8||(Nu=new WeakMap,Nu=new WeakMap,Ch=new WeakMap,jh={})}},xm=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=G_(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),q_(r,a,n,"aria-hidden")):function(){return null}},X_=Object.defineProperty,oa=(e,t)=>X_(e,"name",{value:t,configurable:!0}),zv="Dialog",[dj,fj]=Zs(zv),[Q_,oo]=dj(zv),Ml=oa(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!0}=e,u=s.useRef(null),f=s.useRef(null),[h,p]=wi({prop:r,defaultProp:a??!1,onChange:i,caller:zv}),[g,m]=s.useState(0),[w,y]=s.useState(0);return o.jsx(Q_,{scope:t,triggerRef:u,contentRef:f,contentId:Na(),titleId:Na(),descriptionId:Na(),titlePresent:g>0,descriptionPresent:w>0,setTitleCount:m,setDescriptionCount:y,open:h,onOpenChange:p,onOpenToggle:s.useCallback(()=>p(b=>!b),[p]),modal:l,children:n})},"Dialog"),J_="DialogTrigger",Bv=s.forwardRef(oa(function(t,n){const{__scopeDialog:r,...a}=t,i=oo(J_,r),l=hn(n,i.triggerRef);return o.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":km(i.open),...a,ref:l,onClick:Nt(t.onClick,i.onOpenToggle)})},"DialogTrigger")),hj="DialogPortal",[eV,pj]=dj(hj,{forceMount:void 0}),Rl=oa(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=oo(hj,t);return o.jsx(eV,{scope:t,forceMount:n,children:s.Children.map(r,l=>o.jsx(ps,{present:n||i.open,children:o.jsx(Df,{asChild:!0,container:a,children:l})}))})},"DialogPortal"),U6="DialogOverlay",Pl=s.forwardRef(oa(function(t,n){const r=pj(U6,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,l=oo(U6,t.__scopeDialog);return l.modal?o.jsx(ps,{present:a||l.open,children:o.jsx(nV,{...i,ref:n})}):null},"DialogOverlay")),tV=to("DialogOverlay.RemoveScroll"),nV=s.forwardRef(oa(function(t,n){const{__scopeDialog:r,...a}=t,i=oo(U6,r),l=GC(),u=hn(n,l);return o.jsx(Hf,{as:tV,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(vn.div,{"data-state":km(i.open),...a,ref:u,style:{pointerEvents:"auto",...a.style}})})},"DialogOverlayImpl")),nf="DialogContent",Ll=s.forwardRef(oa(function(t,n){const r=pj(nf,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,l=oo(nf,t.__scopeDialog);return o.jsx(ps,{present:a||l.open,children:l.modal?o.jsx(rV,{...i,ref:n}):o.jsx(sV,{...i,ref:n})})},"DialogContent")),rV=s.forwardRef(oa(function(t,n){const r=oo(nf,t.__scopeDialog),a=s.useRef(null),i=hn(n,r.contentRef,a);return s.useEffect(()=>{const l=a.current;if(l)return xm(l)},[]),o.jsx(mj,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Nt(t.onCloseAutoFocus,l=>{var u;l.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Nt(t.onPointerDownOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&l.preventDefault()}),onFocusOutside:Nt(t.onFocusOutside,l=>l.preventDefault())})},"DialogContentModal")),sV=s.forwardRef(oa(function(t,n){const r=oo(nf,t.__scopeDialog),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(mj,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var u,f;(u=t.onCloseAutoFocus)==null||u.call(t,l),l.defaultPrevented||(a.current||(f=r.triggerRef.current)==null||f.focus(),l.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:l=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;((p=r.triggerRef.current)==null?void 0:p.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})},"DialogContentNonModal")),mj=s.forwardRef(oa(function(t,n){const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=t,f=oo(nf,r);return Md(),o.jsx(o.Fragment,{children:o.jsx(Nd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Tf,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionPresent?f.descriptionId:void 0,"aria-labelledby":f.titlePresent?f.titleId:void 0,"data-state":km(f.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>f.onOpenChange(!1)})})})},"DialogContentImpl")),aV="DialogTitle",$l=s.forwardRef(oa(function(t,n){const{__scopeDialog:r,...a}=t,i=oo(aV,r),{setTitleCount:l}=i;return Er(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),o.jsx(vn.h2,{id:i.titleId,...a,ref:n})},"DialogTitle")),oV="DialogDescription",Uv=s.forwardRef(oa(function(t,n){const{__scopeDialog:r,...a}=t,i=oo(oV,r),{setDescriptionCount:l}=i;return Er(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),o.jsx(vn.p,{id:i.descriptionId,...a,ref:n})},"DialogDescription")),iV="DialogClose",Of=s.forwardRef(oa(function(t,n){const{__scopeDialog:r,...a}=t,i=oo(iV,r);return o.jsx(vn.button,{type:"button",...a,ref:n,onClick:Nt(t.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function km(e){return e?"open":"closed"}oa(km,"getState");var lV=Object.defineProperty,Ai=(e,t)=>lV(e,"name",{value:t,configurable:!0}),cV="AlertDialog",[uV,g0e]=Zs(cV,[fj]),Ni=fj(),dV=Ai(e=>{const{__scopeAlertDialog:t,...n}=e,r=Ni(t);return o.jsx(Ml,{...r,...n,modal:!0})},"AlertDialog"),fV=s.forwardRef(Ai(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ni(r);return o.jsx(Bv,{...i,...a,ref:n})},"AlertDialogTrigger")),hV=Ai(e=>{const{__scopeAlertDialog:t,...n}=e,r=Ni(t);return o.jsx(Rl,{...r,...n})},"AlertDialogPortal"),pV=s.forwardRef(Ai(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ni(r);return o.jsx(Pl,{...i,...a,ref:n})},"AlertDialogOverlay")),mV="AlertDialogContent",[gV,vV]=uV(mV),wV=s.forwardRef(Ai(function(t,n){const{__scopeAlertDialog:r,children:a,...i}=t,l=Ni(r),u=s.useRef(null),f=hn(n,u),h=s.useRef(null);return o.jsx(gV,{scope:r,cancelRef:h,children:o.jsx(Ll,{role:"alertdialog",...l,...i,ref:f,onOpenAutoFocus:Nt(i.onOpenAutoFocus,p=>{var g;p.preventDefault(),(g=h.current)==null||g.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:a})})},"AlertDialogContent")),yV=s.forwardRef(Ai(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ni(r);return o.jsx($l,{...i,...a,ref:n})},"AlertDialogTitle")),bV=s.forwardRef(Ai(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ni(r);return o.jsx(Uv,{...i,...a,ref:n})},"AlertDialogDescription")),xV=s.forwardRef(Ai(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ni(r);return o.jsx(Of,{...i,...a,ref:n})},"AlertDialogAction")),kV="AlertDialogCancel",SV=s.forwardRef(Ai(function(t,n){const{__scopeAlertDialog:r,...a}=t,{cancelRef:i}=vV(kV,r),l=Ni(r),u=hn(n,i);return o.jsx(Of,{...l,...a,ref:u})},"AlertDialogCancel")),EV=dV,CV=fV,jV=hV,AV=pV,NV=wV,MV=xV,RV=SV,PV=yV,LV=bV,$V=Object.defineProperty,TV=(e,t)=>$V(e,"name",{value:t,configurable:!0});function gj(e){const[t,n]=s.useState(void 0);return Er(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let l,u;if("borderBoxSize"in i){const f=i.borderBoxSize,h=Array.isArray(f)?f[0]:f;l=h.inlineSize,u=h.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}TV(gj,"useSize");const DV=["top","right","bottom","left"],xl=Math.min,ii=Math.max,gp=Math.round,Ah=Math.floor,li=e=>({x:e,y:e}),HV={left:"right",right:"left",bottom:"top",top:"bottom"};function vj(e,t,n){return ii(e,xl(t,n))}function bi(e,t){return typeof e=="function"?e(t):e}function kl(e){return e.split("-")[0]}function Rd(e){return e.split("-")[1]}function Wv(e){return e==="x"?"y":"x"}function Kv(e){return e==="y"?"height":"width"}function Co(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Gv(e){return Wv(Co(e))}function OV(e,t,n){n===void 0&&(n=!1);const r=Rd(e),a=Gv(e),i=Kv(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=vp(l)),[l,vp(l)]}function IV(e){const t=vp(e);return[W6(e),t,W6(t)]}function W6(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const l5=["left","right"],c5=["right","left"],FV=["top","bottom"],_V=["bottom","top"];function VV(e,t,n){switch(e){case"top":case"bottom":return n?t?c5:l5:t?l5:c5;case"left":case"right":return t?FV:_V;default:return[]}}function ZV(e,t,n,r){const a=Rd(e);let i=VV(kl(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map(W6)))),i}function vp(e){const t=kl(e);return HV[t]+e.slice(t.length)}function zV(e){var t,n,r,a;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(a=e.left)!=null?a:0}}function wj(e){return typeof e!="number"?zV(e):{top:e,right:e,bottom:e,left:e}}function wp(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function u5(e,t,n){let{reference:r,floating:a}=e;const i=Co(t),l=Gv(t),u=Kv(l),f=kl(t),h=i==="y",p=r.x+r.width/2-a.width/2,g=r.y+r.height/2-a.height/2,m=r[u]/2-a[u]/2;let w;switch(f){case"top":w={x:p,y:r.y-a.height};break;case"bottom":w={x:p,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:g};break;case"left":w={x:r.x-a.width,y:g};break;default:w={x:r.x,y:r.y}}const y=Rd(t);return y&&(w[l]+=m*(y==="end"?1:-1)*(n&&h?-1:1)),w}async function BV(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:l,elements:u,strategy:f}=e,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:m=!1,padding:w=0}=bi(t,e),y=wj(w),k=u[m?g==="floating"?"reference":"floating":g],S=wp(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(k)))==null||n?k:k.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:h,rootBoundary:p,strategy:f})),E=g==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),A=await(i.isElement==null?void 0:i.isElement(C))&&await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1},L=wp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:C,strategy:f}):E);return{top:(S.top-L.top+y.top)/A.y,bottom:(L.bottom-S.bottom+y.bottom)/A.y,left:(S.left-L.left+y.left)/A.x,right:(L.right-S.right+y.right)/A.x}}const UV=50,WV=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:BV},f=await(l.isRTL==null?void 0:l.isRTL(t));let h=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:g}=u5(h,r,f),m=r,w=0;const y={};for(let b=0;b<i.length;b++){const k=i[b];if(!k)continue;const{name:S,fn:E}=k,{x:C,y:A,data:L,reset:T}=await E({x:p,y:g,initialPlacement:r,placement:m,strategy:a,middlewareData:y,rects:h,platform:u,elements:{reference:e,floating:t}});p=C??p,g=A??g,y[S]={...y[S],...L},T&&w<UV&&(w++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(h=T.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:p,y:g}=u5(h,m,f)),b=-1)}return{x:p,y:g,placement:m,strategy:a,middlewareData:y}},KV=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:l,elements:u,middlewareData:f}=t,{element:h,padding:p=0}=bi(e,t)||{};if(h==null)return{};const g=wj(p),m={x:n,y:r},w=Gv(a),y=Kv(w),b=await l.getDimensions(h),k=w==="y",S=k?"top":"left",E=k?"bottom":"right",C=k?"clientHeight":"clientWidth",A=i.reference[y]+i.reference[w]-m[w]-i.floating[y],L=m[w]-i.reference[w],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let M=T?T[C]:0;(!M||!await(l.isElement==null?void 0:l.isElement(T)))&&(M=u.floating[C]||i.floating[y]);const j=A/2-L/2,P=M/2-b[y]/2-1,R=xl(g[S],P),H=xl(g[E],P),D=M-b[y]-H,B=M/2-b[y]/2+j,V=vj(R,B,D),U=!f.arrow&&Rd(a)!=null&&B!==V&&i.reference[y]/2-(B<R?R:H)-b[y]/2<0,K=U?B<R?B-R:B-D:0;return{[w]:m[w]+K,data:{[w]:V,centerOffset:B-V-K,...U&&{alignmentOffset:K}},reset:U}}}),GV=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:l,initialPlacement:u,platform:f,elements:h}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...k}=bi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=kl(a),E=Co(u),C=kl(u)===u,A=await(f.isRTL==null?void 0:f.isRTL(h.floating)),L=m||(C||!b?[vp(u)]:IV(u)),T=y!=="none";!m&&T&&L.push(...ZV(u,b,y,A));const M=[u,...L],j=await f.detectOverflow(t,k),P=[];let R=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&P.push(j[S]),g){const V=OV(a,l,A);P.push(j[V[0]],j[V[1]])}if(R=[...R,{placement:a,overflows:P}],!P.every(V=>V<=0)){var H,D;const V=(((H=i.flip)==null?void 0:H.index)||0)+1,U=M[V];if(U&&(!(g==="alignment"?E!==Co(U):!1)||R.every(F=>Co(F.placement)===E?F.overflows[0]>0:!0)))return{data:{index:V,overflows:R},reset:{placement:U}};let K=(D=R.filter(O=>O.overflows[0]<=0).sort((O,F)=>O.overflows[1]-F.overflows[1])[0])==null?void 0:D.placement;if(!K)switch(w){case"bestFit":{var B;const O=(B=R.filter(F=>{if(T){const I=Co(F.placement);return I===E||I==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(I=>I>0).reduce((I,G)=>I+G,0)]).sort((F,I)=>F[1]-I[1])[0])==null?void 0:B[0];O&&(K=O);break}case"initialPlacement":K=u;break}if(a!==K)return{reset:{placement:K}}}return{}}}};function d5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function f5(e){return DV.some(t=>e[t]>=0)}const YV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=bi(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),u=d5(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:f5(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),u=d5(l,n.floating);return{data:{escapedOffsets:u,escaped:f5(u)}}}default:return{}}}}},yj=new Set(["left","top"]);async function qV(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=kl(n),u=Rd(n),f=Co(n)==="y",h=yj.has(l)?-1:1,p=i&&f?-1:1,g=bi(t,e);let{mainAxis:m,crossAxis:w,alignmentAxis:y}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof y=="number"&&(w=u==="end"?y*-1:y),f?{x:w*p,y:m*h}:{x:m*h,y:w*p}}const XV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:l,middlewareData:u}=t,f=await qV(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:a+f.x,y:i+f.y,data:{...f,placement:l}}}}},QV=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:i}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:f={fn:E=>{let{x:C,y:A}=E;return{x:C,y:A}}},...h}=bi(e,t),p={x:n,y:r},g=await i.detectOverflow(t,h),m=Co(a),w=Wv(m);let y=p[w],b=p[m];const k=(E,C)=>vj(C+g[E==="y"?"top":"left"],C,C-g[E==="y"?"bottom":"right"]);l&&(y=k(w,y)),u&&(b=k(m,b));const S=f.fn({...t,[w]:y,[m]:b});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[w]:l,[m]:u}}}}}},JV=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:a,y:i,placement:l,rects:u,middlewareData:f}=t,{offset:h=0,mainAxis:p=!0,crossAxis:g=!0}=bi(e,t),m={x:a,y:i},w=Co(l),y=Wv(w);let b=m[y],k=m[w];const S=bi(h,t),E=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:(n=S.mainAxis)!=null?n:0,crossAxis:(r=S.crossAxis)!=null?r:0};if(p){const L=y==="y"?"height":"width",T=u.reference[y]-u.floating[L]+E.mainAxis,M=u.reference[y]+u.reference[L]-E.mainAxis;b<T?b=T:b>M&&(b=M)}if(g){var C,A;const L=y==="y"?"width":"height",T=yj.has(kl(l)),M=u.reference[w]-u.floating[L]+(T&&((C=f.offset)==null?void 0:C[w])||0)+(T?0:E.crossAxis),j=u.reference[w]+u.reference[L]+(T?0:((A=f.offset)==null?void 0:A[w])||0)-(T?E.crossAxis:0);k<M?k=M:k>j&&(k=j)}return{[y]:b,[w]:k}}}},eZ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:a,elements:i}=t,{apply:l=()=>{},...u}=bi(e,t),f=await a.detectOverflow(t,u),h=kl(n),p=Rd(n),g=Co(n)==="y",{width:m,height:w}=r.floating;let y,b;h==="top"||h==="bottom"?(y=h,b=p===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=h,y=p==="end"?"top":"bottom");const k=w-f.top-f.bottom,S=m-f.left-f.right,E=xl(w-f[y],k),C=xl(m-f[b],S),A=t.middlewareData.shift,L=!A;let T=E,M=C;A!=null&&A.enabled.x&&(M=S),A!=null&&A.enabled.y&&(T=k),L&&!p&&(g?M=m-2*ii(f.left,f.right):T=w-2*ii(f.top,f.bottom)),await l({...t,availableWidth:M,availableHeight:T});const j=await a.getDimensions(i.floating);return m!==j.width||w!==j.height?{reset:{rects:!0}}:{}}}};function Sm(){return typeof window<"u"}function Pd(e){return bj(e)?(e.nodeName||"").toLowerCase():"#document"}function Fs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mi(e){var t;return(t=(bj(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bj(e){return Sm()?e instanceof Node||e instanceof Fs(e).Node:!1}function Lo(e){return Sm()?e instanceof Element||e instanceof Fs(e).Element:!1}function Tl(e){return Sm()?e instanceof HTMLElement||e instanceof Fs(e).HTMLElement:!1}function h5(e){return!Sm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fs(e).ShadowRoot}function Em(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function tZ(e){return/^(table|td|th)$/.test(Pd(e))}function Cm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const nZ=/transform|translate|scale|rotate|perspective|filter/,rZ=/paint|layout|strict|content/,sc=e=>!!e&&e!=="none";let p8;function Yv(e){const t=Lo(e)?$o(e):e;return sc(t.transform)||sc(t.translate)||sc(t.scale)||sc(t.rotate)||sc(t.perspective)||!qv()&&(sc(t.backdropFilter)||sc(t.filter))||nZ.test(t.willChange||"")||rZ.test(t.contain||"")}function sZ(e){let t=Nc(e);for(;Tl(t)&&!rf(t);){if(Yv(t))return t;if(Cm(t))return null;t=Nc(t)}return null}function qv(){return p8==null&&(p8=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),p8}function rf(e){return/^(html|body|#document)$/.test(Pd(e))}function $o(e){return Fs(e).getComputedStyle(e)}function jm(e){return Lo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Nc(e){if(Pd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||h5(e)&&e.host||Mi(e);return h5(t)?t.host:t}function xj(e){const t=Nc(e);return rf(t)?(e.ownerDocument||e).body:Tl(t)&&Em(t)?t:xj(t)}function sf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=xj(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=Fs(a);if(i){const u=K6(l);return t.concat(l,l.visualViewport||[],Em(a)?a:[],u&&n?sf(u):[])}else return t.concat(a,sf(a,[],n))}function K6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function kj(e){const t=$o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Tl(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=gp(n)!==i||gp(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function Xv(e){return Lo(e)?e:e.contextElement}function ed(e){const t=Xv(e);if(!Tl(t))return li(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=kj(t);let l=(i?gp(n.width):n.width)/r,u=(i?gp(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const aZ=li(0);function Sj(e){const t=Fs(e);return!qv()||!t.visualViewport?aZ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oZ(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Fs(e)}function Mc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=Xv(e);let l=li(1);t&&(r?Lo(r)&&(l=ed(r)):l=ed(e));const u=oZ(i,n,r)?Sj(i):li(0);let f=(a.left+u.x)/l.x,h=(a.top+u.y)/l.y,p=a.width/l.x,g=a.height/l.y;if(i&&r){const m=Fs(i),w=Lo(r)?Fs(r):r;let y=m,b=K6(y);for(;b&&w!==y;){const k=ed(b),S=b.getBoundingClientRect(),E=$o(b),C=S.left+(b.clientLeft+parseFloat(E.paddingLeft))*k.x,A=S.top+(b.clientTop+parseFloat(E.paddingTop))*k.y;f*=k.x,h*=k.y,p*=k.x,g*=k.y,f+=C,h+=A,y=Fs(b),b=K6(y)}}return wp({width:p,height:g,x:f,y:h})}function Am(e,t){const n=jm(e).scrollLeft;return t?t.left+n:Mc(Mi(e)).left+n}function Ej(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Am(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function iZ(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=Mi(r),u=t?Cm(t.floating):!1;if(r===l||u&&i)return n;let f={scrollLeft:0,scrollTop:0},h=li(1);const p=li(0),g=Tl(r);if((g||!i)&&((Pd(r)!=="body"||Em(l))&&(f=jm(r)),g)){const w=Mc(r);h=ed(r),p.x=w.x+r.clientLeft,p.y=w.y+r.clientTop}const m=l&&!g&&!i?Ej(l,f):li(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+p.x+m.x,y:n.y*h.y-f.scrollTop*h.y+p.y+m.y}}function lZ(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function cZ(e){const t=jm(e),n=e.ownerDocument.body,r=ii(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=ii(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+Am(e);const l=-t.scrollTop;return $o(n).direction==="rtl"&&(i+=ii(e.clientWidth,n.clientWidth)-r),{width:r,height:a,x:i,y:l}}const uZ=25;function dZ(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",a=Fs(e),i=Mi(e),l=a.visualViewport;let u=i.clientWidth,f=i.clientHeight,h=0,p=0;if(l){const m=!qv()||t==="fixed";r?m||(h=-l.offsetLeft,p=-l.offsetTop):(u=l.width,f=l.height,m&&(h=l.offsetLeft,p=l.offsetTop))}if(Am(i)<=0){const m=i.ownerDocument,w=m.body,y=getComputedStyle(w),b=m.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,k=Math.abs(i.clientWidth-w.clientWidth-b),S=getComputedStyle(i).scrollbarGutter==="stable both-edges"?k/2:k;S<=uZ&&(u-=S)}return{width:u,height:f,x:h,y:p}}function fZ(e,t){const n=Mc(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=ed(e),l=e.clientWidth*i.x,u=e.clientHeight*i.y,f=a*i.x,h=r*i.y;return{width:l,height:u,x:f,y:h}}function p5(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=dZ(e,n,t);else if(t==="document")r=cZ(Mi(e));else if(Lo(t))r=fZ(t,n);else{const a=Sj(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return wp(r)}function hZ(e,t){const n=t.get(e);if(n)return n;let r=sf(e,[],!1).filter(u=>Lo(u)&&Pd(u)!=="body"),a=null;const i=$o(e).position==="fixed";let l=i?Nc(e):e;for(;Lo(l)&&!rf(l);){const u=$o(l),f=Yv(l),h=a?a.position:i?"fixed":"";!f&&(h==="fixed"||h==="absolute"&&u.position==="static")?r=r.filter(g=>g!==l):a=u,l=Nc(l)}return t.set(e,r),r}function pZ(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Cm(t)?[]:hZ(t,this._c):[].concat(n),r],u=p5(t,l[0],a);let f=u.top,h=u.right,p=u.bottom,g=u.left;for(let m=1;m<l.length;m++){const w=p5(t,l[m],a);f=ii(w.top,f),h=xl(w.right,h),p=xl(w.bottom,p),g=ii(w.left,g)}return{width:h-g,height:p-f,x:g,y:f}}function mZ(e){const{width:t,height:n}=kj(e);return{width:t,height:n}}function gZ(e,t,n){const r=Tl(t),a=Mi(t),i=n==="fixed",l=Mc(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const f=li(0);if((r||!i)&&((Pd(t)!=="body"||Em(a))&&(u=jm(t)),r)){const m=Mc(t,!0,i,t);f.x=m.x+t.clientLeft,f.y=m.y+t.clientTop}!r&&a&&(f.x=Am(a));const h=a&&!r&&!i?Ej(a,u):li(0),p=l.left+u.scrollLeft-f.x-h.x,g=l.top+u.scrollTop-f.y-h.y;return{x:p,y:g,width:l.width,height:l.height}}function m8(e){return $o(e).position==="static"}function m5(e,t){if(!Tl(e)||$o(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Mi(e)===n&&(n=n.ownerDocument.body),n}function Cj(e,t){const n=Fs(e);if(Cm(e))return n;if(!Tl(e)){let a=Nc(e);for(;a&&!rf(a);){if(Lo(a)&&!m8(a))return a;a=Nc(a)}return n}let r=m5(e,t);for(;r&&tZ(r)&&m8(r);)r=m5(r,t);return r&&rf(r)&&m8(r)&&!Yv(r)?n:r||sZ(e)||n}const vZ=async function(e){const t=this.getOffsetParent||Cj,n=this.getDimensions,r=await n(e.floating);return{reference:gZ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wZ(e){return $o(e).direction==="rtl"}const yZ={convertOffsetParentRelativeRectToViewportRelativeRect:iZ,getDocumentElement:Mi,getClippingRect:pZ,getOffsetParent:Cj,getElementRects:vZ,getClientRects:lZ,getDimensions:mZ,getScale:ed,isElement:Lo,isRTL:wZ};function jj(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bZ(e,t,n){let r=null,a;const i=Mi(e);function l(){var p;clearTimeout(a),(p=r)==null||p.disconnect(),r=null}function u(p,g){p===void 0&&(p=!1),g===void 0&&(g=1),l();const m=e.getBoundingClientRect(),{left:w,top:y,width:b,height:k}=m;if(p||t(),!b||!k)return;const S=Ah(y),E=Ah(i.clientWidth-(w+b)),C=Ah(i.clientHeight-(y+k)),A=Ah(w),T={rootMargin:-S+"px "+-E+"px "+-C+"px "+-A+"px",threshold:ii(0,xl(1,g))||1};let M=!0;function j(P){const R=P[0].intersectionRatio;if(!jj(m,e.getBoundingClientRect()))return u();if(R!==g){if(!M)return u();R?u(!1,R):a=setTimeout(()=>{u(!1,1e-7)},1e3)}M=!1}try{r=new IntersectionObserver(j,{...T,root:i.ownerDocument})}catch{r=new IntersectionObserver(j,T)}r.observe(e)}const f=Fs(e),h=()=>u(n);return f.addEventListener("resize",h),u(!0),()=>{f.removeEventListener("resize",h),l()}}function Aj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,h=Xv(e),p=a||i?[...h?sf(h):[],...t?sf(t):[]]:[];p.forEach(S=>{a&&S.addEventListener("scroll",n),i&&S.addEventListener("resize",n)});const g=h&&u?bZ(h,n,i):null;let m=-1,w=null;l&&(w=new ResizeObserver(S=>{let[E]=S;E&&E.target===h&&w&&t&&(w.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=w)==null||C.observe(t)})),n()}),h&&!f&&w.observe(h),t&&w.observe(t));let y,b=f?Mc(e):null;f&&k();function k(){const S=Mc(e);b&&!jj(b,S)&&n(),b=S,y=requestAnimationFrame(k)}return n(),()=>{var S;p.forEach(E=>{a&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),g==null||g(),(S=w)==null||S.disconnect(),w=null,f&&cancelAnimationFrame(y)}}const Nj=XV,Mj=QV,Rj=GV,xZ=eZ,kZ=YV,G6=KV,SZ=JV,Pj=(e,t,n)=>{const r=new Map,a=n??{},i={...yZ,...a.platform,_c:r};return WV(e,t,{...a,platform:i})};var EZ=typeof document<"u",CZ=function(){},np=EZ?s.useLayoutEffect:CZ;function yp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!yp(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!yp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Lj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function g5(e,t){const n=Lj(e);return Math.round(t*n)/n}function g8(e){const t=s.useRef(e);return np(()=>{t.current=e}),t}function jZ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:f,open:h}=e,[p,g]=s.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,w]=s.useState(r);yp(m,r)||w(r);const[y,b]=s.useState(null),[k,S]=s.useState(null),E=s.useCallback(F=>{F!==T.current&&(T.current=F,b(F))},[]),C=s.useCallback(F=>{F!==M.current&&(M.current=F,S(F))},[]),A=i||y,L=l||k,T=s.useRef(null),M=s.useRef(null),j=s.useRef(p),P=f!=null,R=g8(f),H=g8(a),D=g8(h),B=s.useCallback(()=>{if(!T.current||!M.current)return;const F={placement:t,strategy:n,middleware:m};H.current&&(F.platform=H.current),Pj(T.current,M.current,F).then(I=>{const G={...I,isPositioned:D.current!==!1};V.current&&!yp(j.current,G)&&(j.current=G,Br.flushSync(()=>{g(G)}))})},[m,t,n,H,D]);np(()=>{h===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,g(F=>({...F,isPositioned:!1})))},[h]);const V=s.useRef(!1);np(()=>(V.current=!0,()=>{V.current=!1}),[]),np(()=>{if(A&&(T.current=A),L&&(M.current=L),A&&L){if(R.current)return R.current(A,L,B);B()}},[A,L,B,R,P]);const U=s.useMemo(()=>({reference:T,floating:M,setReference:E,setFloating:C}),[E,C]),K=s.useMemo(()=>({reference:A,floating:L}),[A,L]),O=s.useMemo(()=>{const F={position:n,left:0,top:0};if(!K.floating)return F;const I=g5(K.floating,p.x),G=g5(K.floating,p.y);return u?{...F,transform:"translate("+I+"px, "+G+"px)",...Lj(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:G}},[n,u,K.floating,p.x,p.y]);return s.useMemo(()=>({...p,update:B,refs:U,elements:K,floatingStyles:O}),[p,B,U,K,O])}const AZ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?G6({element:r.current,padding:a}).fn(n):{}:r?G6({element:r,padding:a}).fn(n):{}}}},NZ=(e,t)=>{const n=Nj(e);return{name:n.name,fn:n.fn,options:[e,t]}},MZ=(e,t)=>{const n=Mj(e);return{name:n.name,fn:n.fn,options:[e,t]}},RZ=(e,t)=>({fn:SZ(e).fn,options:[e,t]}),PZ=(e,t)=>{const n=Rj(e);return{name:n.name,fn:n.fn,options:[e,t]}},LZ=(e,t)=>{const n=xZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},$Z=(e,t)=>{const n=kZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},TZ=(e,t)=>{const n=AZ(e);return{name:n.name,fn:n.fn,options:[e,t]}};var DZ=Object.defineProperty,HZ=(e,t)=>DZ(e,"name",{value:t,configurable:!0}),OZ=s.forwardRef(HZ(function(t,n){const{children:r,width:a=10,height:i=5,...l}=t;return o.jsx(vn.svg,{...l,ref:n,width:a,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),IZ=OZ,FZ=Object.defineProperty,ci=(e,t)=>FZ(e,"name",{value:t,configurable:!0}),$j="Popper",[Tj,Dl]=Zs($j),[_Z,Dj]=Tj($j),VZ=ci(e=>{const{__scopePopper:t,children:n}=e,[r,a]=s.useState(null),[i,l]=s.useState(void 0);return o.jsx(_Z,{scope:t,anchor:r,onAnchorChange:a,placementState:i,setPlacementState:l,children:n})},"Popper"),ZZ="PopperAnchor",zZ=s.forwardRef(ci(function(t,n){const{__scopePopper:r,virtualRef:a,...i}=t,l=Dj(ZZ,r),u=s.useRef(null),f=l.onAnchorChange,h=s.useCallback(b=>{u.current=b,b&&f(b)},[f]),p=hn(n,h),g=s.useRef(null);s.useEffect(()=>{if(!a)return;const b=g.current;g.current=a.current,b!==g.current&&f(g.current)});const m=l.placementState&&Nm(l.placementState),w=m==null?void 0:m[0],y=m==null?void 0:m[1];return a?null:o.jsx(vn.div,{"data-radix-popper-side":w,"data-radix-popper-align":y,...i,ref:p})},"PopperAnchor")),Hj="PopperContent",[BZ,UZ]=Tj(Hj),WZ=s.forwardRef(ci(function(t,n){var te,X,ae,Le,ce,Se,Ze;const{__scopePopper:r,side:a="bottom",sideOffset:i=0,align:l="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:g=0,sticky:m="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:b,...k}=t,S=Dj(Hj,r),[E,C]=s.useState(null),A=hn(n,C),[L,T]=s.useState(null),M=gj(L),j=(M==null?void 0:M.width)??0,P=(M==null?void 0:M.height)??0,R=a+(l!=="center"?"-"+l:""),H=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},D=Array.isArray(p)?p:[p],B=D.length>0,V={padding:H,boundary:D.filter(Oj),altBoundary:B},{refs:U,floatingStyles:K,placement:O,isPositioned:F,middlewareData:I}=jZ({strategy:"fixed",placement:R,whileElementsMounted:ci((...gt)=>Aj(...gt,{animationFrame:y==="always"}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[NZ({mainAxis:i+P,alignmentAxis:u}),h&&MZ({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?RZ():void 0,...V}),h&&PZ({...V}),LZ({...V,apply:ci(({elements:gt,rects:Ke,availableWidth:nt,availableHeight:$e})=>{const{width:ne,height:Q}=Ke.reference,We=gt.floating.style;We.setProperty("--radix-popper-available-width",`${nt}px`),We.setProperty("--radix-popper-available-height",`${$e}px`),We.setProperty("--radix-popper-anchor-width",`${ne}px`),We.setProperty("--radix-popper-anchor-height",`${Q}px`)},"apply")}),L&&TZ({element:L,padding:f}),qZ({arrowWidth:j,arrowHeight:P}),w&&$Z({strategy:"referenceHidden",...V,boundary:B?V.boundary:void 0})]}),G=S.setPlacementState;Er(()=>(G(O),()=>{G(void 0)}),[O,G]);const[z,Y]=Nm(O),Z=kr(b);Er(()=>{F&&(Z==null||Z())},[F,Z]);const ee=(te=I.arrow)==null?void 0:te.x,pe=(X=I.arrow)==null?void 0:X.y,se=((ae=I.arrow)==null?void 0:ae.centerOffset)!==0,[xe,J]=s.useState();return Er(()=>{E&&J(window.getComputedStyle(E).zIndex)},[E]),o.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:F?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[(Le=I.transformOrigin)==null?void 0:Le.x,(ce=I.transformOrigin)==null?void 0:ce.y].join(" "),...((Se=I.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(BZ,{scope:r,placedSide:z,placedAlign:Y,onArrowChange:T,arrowX:ee,arrowY:pe,shouldHideArrow:se,children:o.jsx(vn.div,{"data-side":z,"data-align":Y,...k,ref:A,style:{...k.style,animation:F?(Ze=k.style)==null?void 0:Ze.animation:"none"}})})})},"PopperContent")),KZ="PopperArrow",GZ={top:"bottom",right:"left",bottom:"top",left:"right"},YZ=s.forwardRef(ci(function(t,n){const{__scopePopper:r,...a}=t,i=UZ(KZ,r),l=GZ[i.placedSide];return o.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:o.jsx(IZ,{...a,ref:n,style:{...a.style,display:"block"}})})},"PopperArrow"));function Oj(e){return e!==null}ci(Oj,"isNotNull");var qZ=ci(e=>({name:"transformOrigin",options:e,fn(t){var k,S,E;const{placement:n,rects:r,middlewareData:a}=t,l=((k=a.arrow)==null?void 0:k.centerOffset)!==0,u=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[h,p]=Nm(n),g={start:"0%",center:"50%",end:"100%"}[p],m=(((S=a.arrow)==null?void 0:S.x)??0)+u/2,w=(((E=a.arrow)==null?void 0:E.y)??0)+f/2;let y="",b="";return h==="bottom"?(y=l?g:`${m}px`,b=`${-f}px`):h==="top"?(y=l?g:`${m}px`,b=`${r.floating.height+f}px`):h==="right"?(y=`${-f}px`,b=l?g:`${w}px`):h==="left"&&(y=`${r.floating.width+f}px`,b=l?g:`${w}px`),{data:{x:y,y:b}}}}),"transformOrigin");function Nm(e){const[t,n="center"]=e.split("-");return[t,n]}ci(Nm,"getSideAndAlignFromPlacement");var Mm=VZ,If=zZ,Rm=WZ,XZ=YZ,QZ=Object.defineProperty,Qv=(e,t)=>QZ(e,"name",{value:t,configurable:!0}),v8=!1;function Ij(){const[e,t]=s.useState(v8);return s.useEffect(()=>{v8||(v8=!0,t(!0))},[]),e}Qv(Ij,"useIsHydrated");var Fj=Fc[" useSyncExternalStore ".trim().toString()];function _j(){return()=>{}}Qv(_j,"subscribe");function Vj(){return Fj(_j,()=>!0,()=>!1)}Qv(Vj,"useIsHydratedModern");var JZ=typeof Fj=="function"?Vj:Ij,ez=Object.defineProperty,Uc=(e,t)=>ez(e,"name",{value:t,configurable:!0}),w8="rovingFocusGroup.onEntryFocus",tz={bubbles:!1,cancelable:!0},Pm="RovingFocusGroup",[Y6,Zj,nz]=ym(Pm),[rz,zj]=Zs(Pm,[nz]),[sz,az]=rz(Pm),oz=s.forwardRef(Uc(function(t,n){return o.jsx(Y6.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(Y6.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(iz,{...t,ref:n})})})},"RovingFocusGroup")),iz=s.forwardRef(Uc(function(t,n){const{__scopeRovingFocusGroup:r,orientation:a,loop:i=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:g=!1,...m}=t,w=s.useRef(null),y=hn(n,w),b=$f(l),[k,S]=wi({prop:u,defaultProp:f??null,onChange:h,caller:Pm}),[E,C]=s.useState(!1),A=kr(p),L=Zj(r),T=s.useRef(!1),[M,j]=s.useState(0);return s.useEffect(()=>{const P=w.current;if(P)return P.addEventListener(w8,A),()=>P.removeEventListener(w8,A)},[A]),o.jsx(sz,{scope:r,orientation:a,dir:b,loop:i,currentTabStopId:k,onItemFocus:s.useCallback(P=>S(P),[S]),onItemShiftTab:s.useCallback(()=>C(!0),[]),onFocusableItemAdd:s.useCallback(()=>j(P=>P+1),[]),onFocusableItemRemove:s.useCallback(()=>j(P=>P-1),[]),children:o.jsx(vn.div,{tabIndex:E||M===0?-1:0,"data-orientation":a,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:Nt(t.onMouseDown,()=>{T.current=!0}),onFocus:Nt(t.onFocus,P=>{const R=!T.current;if(P.target===P.currentTarget&&R&&!E){const H=new CustomEvent(w8,tz);if(P.currentTarget.dispatchEvent(H),!H.defaultPrevented){const D=L().filter(O=>O.focusable),B=D.find(O=>O.active),V=D.find(O=>O.id===k),K=[B,V,...D].filter(Boolean).map(O=>O.ref.current);Jv(K,g)}}T.current=!1}),onBlur:Nt(t.onBlur,()=>C(!1))})})},"RovingFocusGroupImpl")),lz="RovingFocusGroupItem",cz=s.forwardRef(Uc(function(t,n){const{__scopeRovingFocusGroup:r,focusable:a=!0,active:i=!1,tabStopId:l,children:u,...f}=t,h=Na(),p=l||h,g=az(lz,r),m=g.currentTabStopId===p,w=Zj(r),{onFocusableItemAdd:y,onFocusableItemRemove:b,currentTabStopId:k}=g,S=JZ();return Er(()=>{if(!(!S||!a))return y(),()=>b()},[S,a,y,b]),s.useEffect(()=>{if(!(S||!a))return y(),()=>b()},[S,a,y,b]),o.jsx(Y6.ItemSlot,{scope:r,id:p,focusable:a,active:i,children:o.jsx(vn.span,{tabIndex:m?0:-1,"data-orientation":g.orientation,...f,ref:n,onMouseDown:Nt(t.onMouseDown,E=>{a?g.onItemFocus(p):E.preventDefault()}),onFocus:Nt(t.onFocus,()=>g.onItemFocus(p)),onKeyDown:Nt(t.onKeyDown,E=>{if(E.key==="Tab"&&E.shiftKey){g.onItemShiftTab();return}if(E.target!==E.currentTarget)return;const C=Uj(E,g.orientation,g.dir);if(C!==void 0){if(E.metaKey||E.ctrlKey||E.altKey||E.shiftKey)return;E.preventDefault();let L=w().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")L.reverse();else if(C==="prev"||C==="next"){C==="prev"&&L.reverse();const T=L.indexOf(E.currentTarget);L=g.loop?Wj(L,T+1):L.slice(T+1)}setTimeout(()=>Jv(L))}}),children:typeof u=="function"?u({isCurrentTabStop:m,hasTabStop:k!=null}):u})})},"RovingFocusGroupItem")),uz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Bj(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Uc(Bj,"getDirectionAwareKey");function Uj(e,t,n){const r=Bj(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return uz[r]}Uc(Uj,"getFocusIntent");function Jv(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Uc(Jv,"focusFirst");function Wj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Uc(Wj,"wrapArray");var dz=oz,fz=cz,hz=Object.defineProperty,Ln=(e,t)=>hz(e,"name",{value:t,configurable:!0}),q6=["Enter"," "],pz=["ArrowDown","PageUp","Home"],Kj=["ArrowUp","PageDown","End"],mz=[...pz,...Kj],gz={ltr:[...q6,"ArrowRight"],rtl:[...q6,"ArrowLeft"]},vz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Lm="Menu",[af,wz,yz]=ym(Lm),[Wc,$m]=Zs(Lm,[yz,Dl,zj]),ew=Dl(),Gj=zj(),[bz,Kc]=Wc(Lm),[xz,Ff]=Wc(Lm),kz=Ln(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:l=!0}=e,u=ew(t),[f,h]=s.useState(null),p=s.useRef(!1),g=kr(i),m=$f(a);return s.useEffect(()=>{const w=Ln(()=>{p.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},"handleKeyDown"),y=Ln(()=>p.current=!1,"handlePointer");return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),s.useEffect(()=>{if(!n)return;const w=Ln(()=>g(!1),"handleBlur");return window.addEventListener("blur",w),()=>window.removeEventListener("blur",w)},[n,g]),o.jsx(Mm,{...u,children:o.jsx(bz,{scope:t,open:n,onOpenChange:g,content:f,onContentChange:h,children:o.jsx(xz,{scope:t,onClose:s.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:p,dir:m,modal:l,children:r})})})},"Menu"),Yj=s.forwardRef(Ln(function(t,n){const{__scopeMenu:r,...a}=t,i=ew(r);return o.jsx(If,{...i,...a,ref:n})},"MenuAnchor")),qj="MenuPortal",[Sz,Xj]=Wc(qj,{forceMount:void 0}),Ez=Ln(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=Kc(qj,t);return o.jsx(Sz,{scope:t,forceMount:n,children:o.jsx(ps,{present:n||i.open,children:o.jsx(Df,{asChild:!0,container:a,children:r})})})},"MenuPortal"),qa="MenuContent",[Cz,tw]=Wc(qa),jz=s.forwardRef(Ln(function(t,n){const r=Xj(qa,t.__scopeMenu),{forceMount:a=r.forceMount,...i}=t,l=Kc(qa,t.__scopeMenu),u=Ff(qa,t.__scopeMenu);return o.jsx(af.Provider,{scope:t.__scopeMenu,children:o.jsx(ps,{present:a||l.open,children:o.jsx(af.Slot,{scope:t.__scopeMenu,children:u.modal?o.jsx(Az,{...i,ref:n}):o.jsx(Nz,{...i,ref:n})})})})},"MenuContent")),Az=s.forwardRef(Ln(function(t,n){const r=Kc(qa,t.__scopeMenu),a=s.useRef(null),i=hn(n,a);return s.useEffect(()=>{const l=a.current;if(l)return xm(l)},[]),o.jsx(nw,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Nt(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),Nz=s.forwardRef(Ln(function(t,n){const r=Kc(qa,t.__scopeMenu);return o.jsx(nw,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),Mz=to("MenuContent.ScrollLock"),nw=s.forwardRef(Ln(function(t,n){const{__scopeMenu:r,loop:a=!1,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:g,onFocusOutside:m,onInteractOutside:w,onDismiss:y,disableOutsideScroll:b,...k}=t,S=Kc(qa,r),E=Ff(qa,r),C=ew(r),A=Gj(r),L=wz(r),[T,M]=s.useState(null),j=s.useRef(null),P=hn(n,j,S.onContentChange),R=s.useRef(0),H=s.useRef(""),D=s.useRef(0),B=s.useRef(null),V=s.useRef("right"),U=s.useRef(0),K=b?Hf:s.Fragment,O=b?{as:Mz,allowPinchZoom:!0}:void 0,F=Ln(G=>{var J,te;const z=H.current+G,Y=L().filter(X=>!X.disabled),Z=document.activeElement,ee=(J=Y.find(X=>X.ref.current===Z))==null?void 0:J.textValue,pe=Y.map(X=>X.textValue),se=aA(pe,z,ee),xe=(te=Y.find(X=>X.textValue===se))==null?void 0:te.ref.current;Ln((function X(ae){H.current=ae,window.clearTimeout(R.current),ae!==""&&(R.current=window.setTimeout(()=>X(""),1e3))}),"updateSearch")(z),xe&&setTimeout(()=>xe.focus())},"handleTypeaheadSearch");s.useEffect(()=>()=>window.clearTimeout(R.current),[]),Md();const I=s.useCallback(G=>{var Y,Z;return V.current===((Y=B.current)==null?void 0:Y.side)&&iA(G,(Z=B.current)==null?void 0:Z.area)},[]);return o.jsx(Cz,{scope:r,searchRef:H,onItemEnter:s.useCallback(G=>{I(G)&&G.preventDefault()},[I]),onItemLeave:s.useCallback(G=>{var z;I(G)||((z=j.current)==null||z.focus(),M(null))},[I]),onTriggerLeave:s.useCallback(G=>{I(G)&&G.preventDefault()},[I]),pointerGraceTimerRef:D,onPointerGraceIntentChange:s.useCallback(G=>{B.current=G},[]),children:o.jsx(K,{...O,children:o.jsx(Nd,{asChild:!0,trapped:i,onMountAutoFocus:Nt(l,G=>{var z;G.preventDefault(),(z=j.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:o.jsx(Tf,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:g,onFocusOutside:m,onInteractOutside:w,onDismiss:y,children:o.jsx(dz,{asChild:!0,...A,dir:E.dir,orientation:"vertical",loop:a,currentTabStopId:T,onCurrentTabStopIdChange:M,onEntryFocus:Nt(h,G=>{E.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Rm,{role:"menu","aria-orientation":"vertical","data-state":sw(S.open),"data-radix-menu-content":"",dir:E.dir,...C,...k,ref:P,style:{outline:"none",...k.style},onKeyDown:Nt(k.onKeyDown,G=>{const Y=G.target.closest("[data-radix-menu-content]")===G.currentTarget,Z=G.ctrlKey||G.altKey||G.metaKey,ee=G.key.length===1;Y&&(G.key==="Tab"&&G.preventDefault(),!Z&&ee&&F(G.key));const pe=j.current;if(G.target!==pe||!mz.includes(G.key))return;G.preventDefault();const xe=L().filter(J=>!J.disabled).map(J=>J.ref.current);Kj.includes(G.key)&&xe.reverse(),rA(xe)}),onBlur:Nt(t.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(R.current),H.current="")}),onPointerMove:Nt(t.onPointerMove,pd(G=>{const z=G.target,Y=U.current!==G.clientX;if(G.currentTarget.contains(z)&&Y){const Z=G.clientX>U.current?"right":"left";V.current=Z,U.current=G.clientX}}))})})})})})})},"MenuContentImpl")),Qj=s.forwardRef(Ln(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(vn.div,{role:"group",...a,ref:n})},"MenuGroup")),Rz=s.forwardRef(Ln(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(vn.div,{...a,ref:n})},"MenuLabel")),X6="MenuItem",v5="menu.itemSelect",rw=s.forwardRef(Ln(function(t,n){const{disabled:r=!1,onSelect:a,...i}=t,l=s.useRef(null),u=Ff(X6,t.__scopeMenu),f=tw(X6,t.__scopeMenu),h=hn(n,l),p=s.useRef(!1),g=Ln(()=>{const m=l.current;if(!r&&m){const w=new CustomEvent(v5,{bubbles:!0,cancelable:!0});m.addEventListener(v5,y=>a==null?void 0:a(y),{once:!0}),Iv(m,w),w.defaultPrevented?p.current=!1:u.onClose()}},"handleSelect");return o.jsx(Jj,{...i,ref:h,disabled:r,onClick:Nt(t.onClick,g),onPointerDown:m=>{var w;(w=t.onPointerDown)==null||w.call(t,m),p.current=!0},onPointerUp:Nt(t.onPointerUp,m=>{var w;p.current||(w=m.currentTarget)==null||w.click()}),onKeyDown:Nt(t.onKeyDown,m=>{r||m.target!==m.currentTarget||f.searchRef.current!==""&&m.key===" "||q6.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})},"MenuItem")),Jj=s.forwardRef(Ln(function(t,n){const{__scopeMenu:r,disabled:a=!1,textValue:i,...l}=t,u=tw(X6,r),f=Gj(r),h=s.useRef(null),p=hn(n,h),[g,m]=s.useState(!1),[w,y]=s.useState("");return s.useEffect(()=>{const b=h.current;b&&y((b.textContent??"").trim())},[l.children]),o.jsx(af.ItemSlot,{scope:r,disabled:a,textValue:i??w,children:o.jsx(fz,{asChild:!0,...f,focusable:!a,children:o.jsx(vn.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:p,onPointerMove:Nt(t.onPointerMove,pd(b=>{a?u.onItemLeave(b):(u.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Nt(t.onPointerLeave,pd(b=>u.onItemLeave(b))),onFocus:Nt(t.onFocus,()=>m(!0)),onBlur:Nt(t.onBlur,()=>m(!1))})})})},"MenuItemImpl")),Pz=s.forwardRef(Ln(function(t,n){const{checked:r=!1,onCheckedChange:a,...i}=t;return o.jsx(tA,{scope:t.__scopeMenu,checked:r,children:o.jsx(rw,{role:"menuitemcheckbox","aria-checked":of(r)?"mixed":r,...i,ref:n,"data-state":Tm(r),onSelect:Nt(i.onSelect,()=>a==null?void 0:a(of(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Lz="MenuRadioGroup",[$z,Tz]=Wc(Lz,{value:void 0,onValueChange:Ln(()=>{},"onValueChange")}),Dz=s.forwardRef(Ln(function(t,n){const{value:r,onValueChange:a,...i}=t,l=kr(a);return o.jsx($z,{scope:t.__scopeMenu,value:r,onValueChange:l,children:o.jsx(Qj,{...i,ref:n})})},"MenuRadioGroup")),Hz="MenuRadioItem",Oz=s.forwardRef(Ln(function(t,n){const{value:r,...a}=t,i=Tz(Hz,t.__scopeMenu),l=r===i.value;return o.jsx(tA,{scope:t.__scopeMenu,checked:l,children:o.jsx(rw,{role:"menuitemradio","aria-checked":l,...a,ref:n,"data-state":Tm(l),onSelect:Nt(a.onSelect,()=>{var u;return(u=i.onValueChange)==null?void 0:u.call(i,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),eA="MenuItemIndicator",[tA,Iz]=Wc(eA,{checked:!1}),Fz=s.forwardRef(Ln(function(t,n){const{__scopeMenu:r,forceMount:a,...i}=t,l=Iz(eA,r);return o.jsx(ps,{present:a||of(l.checked)||l.checked===!0,children:o.jsx(vn.span,{...i,ref:n,"data-state":Tm(l.checked)})})},"MenuItemIndicator")),_z=s.forwardRef(Ln(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(vn.div,{role:"separator","aria-orientation":"horizontal",...a,ref:n})},"MenuSeparator")),Vz="MenuSub",[v0e,nA]=Wc(Vz),Nh="MenuSubTrigger",Zz=s.forwardRef(Ln(function(t,n){const r=Kc(Nh,t.__scopeMenu),a=Ff(Nh,t.__scopeMenu),i=nA(Nh,t.__scopeMenu),l=tw(Nh,t.__scopeMenu),u=s.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=l,p={__scopeMenu:t.__scopeMenu},g=s.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);s.useEffect(()=>g,[g]),s.useEffect(()=>{const w=f.current;return()=>{window.clearTimeout(w),h(null)}},[f,h]);const m=hn(n,i.onTriggerChange);return o.jsx(Yj,{asChild:!0,...p,children:o.jsx(Jj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?i.contentId:void 0,"data-state":sw(r.open),...t,ref:m,onClick:w=>{var y;(y=t.onClick)==null||y.call(t,w),!(t.disabled||w.defaultPrevented)&&(w.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Nt(t.onPointerMove,pd(w=>{l.onItemEnter(w),!w.defaultPrevented&&!t.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),g()},100))})),onPointerLeave:Nt(t.onPointerLeave,pd(w=>{var b,k;g();const y=(b=r.content)==null?void 0:b.getBoundingClientRect();if(y){const S=(k=r.content)==null?void 0:k.dataset.side,E=S==="right",C=E?-5:5,A=y[E?"left":"right"],L=y[E?"right":"left"];l.onPointerGraceIntentChange({area:[{x:w.clientX+C,y:w.clientY},{x:A,y:y.top},{x:L,y:y.top},{x:L,y:y.bottom},{x:A,y:y.bottom}],side:S}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(w),w.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Nt(t.onKeyDown,w=>{var b;t.disabled||w.target!==w.currentTarget||l.searchRef.current!==""&&w.key===" "||gz[a.dir].includes(w.key)&&(r.onOpenChange(!0),(b=r.content)==null||b.focus(),w.preventDefault())})})})},"MenuSubTrigger")),zz="MenuSubContent",Bz=s.forwardRef(Ln(function(t,n){const r=Xj(qa,t.__scopeMenu),{forceMount:a=r.forceMount,align:i="start",...l}=t,u=Kc(qa,t.__scopeMenu),f=Ff(qa,t.__scopeMenu),h=nA(zz,t.__scopeMenu),p=s.useRef(null),g=hn(n,p);return o.jsx(af.Provider,{scope:t.__scopeMenu,children:o.jsx(ps,{present:a||u.open,children:o.jsx(af.Slot,{scope:t.__scopeMenu,children:o.jsx(nw,{id:h.contentId,"aria-labelledby":h.triggerId,...l,ref:g,align:i,side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{var w;f.isUsingKeyboardRef.current&&((w=p.current)==null||w.focus()),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Nt(t.onFocusOutside,m=>{m.target!==h.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Nt(t.onEscapeKeyDown,m=>{f.onClose(),m.preventDefault()}),onKeyDown:Nt(t.onKeyDown,m=>{var b;const w=m.currentTarget.contains(m.target),y=vz[f.dir].includes(m.key);w&&y&&(u.onOpenChange(!1),(b=h.trigger)==null||b.focus(),m.preventDefault())})})})})})},"MenuSubContent"));function sw(e){return e?"open":"closed"}Ln(sw,"getOpenState");function of(e){return e==="indeterminate"}Ln(of,"isIndeterminate");function Tm(e){return of(e)?"indeterminate":e?"checked":"unchecked"}Ln(Tm,"getCheckedState");function rA(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Ln(rA,"focusFirst");function sA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ln(sA,"wrapArray");function aA(e,t,n){const a=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=sA(e,Math.max(i,0));a.length===1&&(l=l.filter(h=>h!==n));const f=l.find(h=>h.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}Ln(aA,"getNextMatch");function oA(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,l=t.length-1;i<t.length;l=i++){const u=t[i],f=t[l],h=u.x,p=u.y,g=f.x,m=f.y;p>r!=m>r&&n<(g-h)*(r-p)/(m-p)+h&&(a=!a)}return a}Ln(oA,"isPointInPolygon");function iA(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return oA(n,t)}Ln(iA,"isPointerInGraceArea");function pd(e){return t=>t.pointerType==="mouse"?e(t):void 0}Ln(pd,"whenMouse");var lA=kz,cA=Yj,uA=Ez,dA=jz,fA=Qj,hA=Rz,pA=rw,mA=Pz,gA=Dz,vA=Oz,wA=Fz,yA=_z,bA=Zz,xA=Bz,Uz=Object.defineProperty,Qr=(e,t)=>Uz(e,"name",{value:t,configurable:!0}),aw="ContextMenu",[Wz,w0e]=Zs(aw,[$m]),zs=$m(),[Kz,kA]=Wz(aw),Gz=Qr(e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,dir:i,modal:l=!0}=e,u=s.useRef(!1),[f,h]=wi({prop:a,defaultProp:!1,onChange:r,caller:aw}),p=zs(t);return o.jsx(Kz,{scope:t,open:f,onOpenChange:h,modal:l,hasInteractedRef:u,children:o.jsx(lA,{...p,dir:i,open:f,onOpenChange:h,modal:l,children:n})})},"ContextMenu"),Yz="ContextMenuTrigger",qz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,disabled:a=!1,...i}=t,l=kA(Yz,r),u=zs(r),[f,h]=s.useState({x:0,y:0}),p=s.useMemo(()=>({current:{getBoundingClientRect:Qr(()=>DOMRect.fromRect({width:0,height:0,...f}),"getBoundingClientRect")}}),[f]),g=s.useRef(0),m=s.useCallback(()=>window.clearTimeout(g.current),[]),w=Qr(y=>{l.hasInteractedRef.current=!0,h({x:y.clientX,y:y.clientY}),l.onOpenChange(!0)},"handleOpen");return s.useEffect(()=>m,[m]),s.useEffect(()=>void(a&&m()),[a,m]),o.jsxs(o.Fragment,{children:[o.jsx(cA,{...u,virtualRef:p}),o.jsx(vn.span,{"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,...i,ref:n,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:a?t.onContextMenu:Nt(t.onContextMenu,y=>{m(),w(y),y.preventDefault()}),onPointerDown:a?t.onPointerDown:Nt(t.onPointerDown,P0(y=>{m(),l.open&&l.onOpenChange(!1),g.current=window.setTimeout(()=>w(y),700)})),onPointerMove:a?t.onPointerMove:Nt(t.onPointerMove,P0(m)),onPointerCancel:a?t.onPointerCancel:Nt(t.onPointerCancel,P0(m)),onPointerUp:a?t.onPointerUp:Nt(t.onPointerUp,P0(m))})]})},"ContextMenuTrigger")),Xz=Qr(e=>{const{__scopeContextMenu:t,...n}=e,r=zs(t);return o.jsx(uA,{...r,...n})},"ContextMenuPortal"),Qz="ContextMenuContent",Jz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=kA(Qz,r),l=zs(r),u=s.useRef(!1);return o.jsx(dA,{...l,...a,ref:n,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:f=>{var h;(h=t.onCloseAutoFocus)==null||h.call(t,f),!f.defaultPrevented&&u.current&&f.preventDefault(),u.current=!1},onInteractOutside:f=>{var h;(h=t.onInteractOutside)==null||h.call(t,f),!f.defaultPrevented&&!i.modal&&(u.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuContent")),eB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(fA,{...i,...a,ref:n})},"ContextMenuGroup")),tB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(hA,{...i,...a,ref:n})},"ContextMenuLabel")),nB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(pA,{...i,...a,ref:n})},"ContextMenuItem")),rB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(mA,{...i,...a,ref:n})},"ContextMenuCheckboxItem")),sB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(gA,{...i,...a,ref:n})},"ContextMenuRadioGroup")),aB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(vA,{...i,...a,ref:n})},"ContextMenuRadioItem")),oB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(wA,{...i,...a,ref:n})},"ContextMenuItemIndicator")),iB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(yA,{...i,...a,ref:n})},"ContextMenuSeparator")),lB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(bA,{...i,...a,ref:n})},"ContextMenuSubTrigger")),cB=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=zs(r);return o.jsx(xA,{...i,...a,ref:n,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"ContextMenuSubContent"));function P0(e){return t=>t.pointerType!=="mouse"?e(t):void 0}Qr(P0,"whenTouchOrPen");var uB=Gz,dB=qz,SA=Xz,fB=Jz,hB=eB,pB=tB,mB=nB,gB=rB,vB=sB,wB=aB,EA=oB,yB=iB,bB=lB,xB=cB,kB=Object.defineProperty,Bs=(e,t)=>kB(e,"name",{value:t,configurable:!0}),ow="DropdownMenu",[SB,y0e]=Zs(ow,[$m]),Us=$m(),[EB,CA]=SB(ow),CB=Bs(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,f=Us(t),h=s.useRef(null),[p,g]=wi({prop:a,defaultProp:i??!1,onChange:l,caller:ow});return o.jsx(EB,{scope:t,triggerId:Na(),triggerRef:h,contentId:Na(),open:p,onOpenChange:g,onOpenToggle:s.useCallback(()=>g(m=>!m),[g]),modal:u,children:o.jsx(lA,{...f,open:p,onOpenChange:g,dir:r,modal:u,children:n})})},"DropdownMenu"),jB="DropdownMenuTrigger",AB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,disabled:a=!1,...i}=t,l=CA(jB,r),u=Us(r),f=hn(n,l.triggerRef);return o.jsx(cA,{asChild:!0,...u,children:o.jsx(vn.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...i,ref:f,onPointerDown:Nt(t.onPointerDown,h=>{!a&&h.button===0&&h.ctrlKey===!1&&(l.onOpenToggle(),l.open||h.preventDefault())}),onKeyDown:Nt(t.onKeyDown,h=>{a||(["Enter"," "].includes(h.key)&&l.onOpenToggle(),h.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})},"DropdownMenuTrigger")),NB=Bs(e=>{const{__scopeDropdownMenu:t,...n}=e,r=Us(t);return o.jsx(uA,{...r,...n})},"DropdownMenuPortal"),MB="DropdownMenuContent",RB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=CA(MB,r),l=Us(r),u=s.useRef(!1);return o.jsx(dA,{id:i.contentId,"aria-labelledby":i.triggerId,...l,...a,ref:n,onCloseAutoFocus:Nt(t.onCloseAutoFocus,f=>{var h;u.current||(h=i.triggerRef.current)==null||h.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:Nt(t.onInteractOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,g=h.button===2||p;(!i.modal||g)&&(u.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),PB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(fA,{...i,...a,ref:n})},"DropdownMenuGroup")),LB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(hA,{...i,...a,ref:n})},"DropdownMenuLabel")),$B=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(pA,{...i,...a,ref:n})},"DropdownMenuItem")),TB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(mA,{...i,...a,ref:n})},"DropdownMenuCheckboxItem")),DB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(gA,{...i,...a,ref:n})},"DropdownMenuRadioGroup")),HB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(vA,{...i,...a,ref:n})},"DropdownMenuRadioItem")),OB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(wA,{...i,...a,ref:n})},"DropdownMenuItemIndicator")),IB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(yA,{...i,...a,ref:n})},"DropdownMenuSeparator")),FB=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(bA,{...i,...a,ref:n})},"DropdownMenuSubTrigger")),_B=s.forwardRef(Bs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Us(r);return o.jsx(xA,{...i,...a,ref:n,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),VB=CB,ZB=AB,jA=NB,zB=RB,BB=PB,UB=LB,WB=$B,KB=TB,GB=DB,YB=HB,AA=OB,qB=IB,XB=FB,QB=_B,JB=Object.defineProperty,eU=(e,t)=>JB(e,"name",{value:t,configurable:!0});function NA(e){const t=s.useRef({value:e,previous:e});return s.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}eU(NA,"usePrevious");var tU=Object.defineProperty,nU=(e,t)=>tU(e,"name",{value:t,configurable:!0});function bp(e,[t,n]){return Math.min(n,Math.max(t,e))}nU(bp,"clamp");var rU=Object.defineProperty,Io=(e,t)=>rU(e,"name",{value:t,configurable:!0}),iw="Popover",[MA,b0e]=Zs(iw,[Dl]),Dm=Dl(),[sU,Hl]=MA(iw),aU=Io(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!1}=e,u=Dm(t),f=s.useRef(null),[h,p]=s.useState(!1),[g,m]=wi({prop:r,defaultProp:a??!1,onChange:i,caller:iw});return o.jsx(Mm,{...u,children:o.jsx(sU,{scope:t,contentId:Na(),triggerRef:f,open:g,onOpenChange:m,onOpenToggle:s.useCallback(()=>m(w=>!w),[m]),hasCustomAnchor:h,onCustomAnchorAdd:s.useCallback(()=>p(!0),[]),onCustomAnchorRemove:s.useCallback(()=>p(!1),[]),modal:l,children:n})})},"Popover"),oU="PopoverAnchor",iU=s.forwardRef(Io(function(t,n){const{__scopePopover:r,...a}=t,i=Hl(oU,r),l=Dm(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=i;return s.useEffect(()=>(u(),()=>f()),[u,f]),o.jsx(If,{...l,...a,ref:n})},"PopoverAnchor")),lU="PopoverTrigger",cU=s.forwardRef(Io(function(t,n){const{__scopePopover:r,...a}=t,i=Hl(lU,r),l=Dm(r),u=hn(n,i.triggerRef),f=o.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":lw(i.open),...a,ref:u,onClick:Nt(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?f:o.jsx(If,{asChild:!0,...l,children:f})},"PopoverTrigger")),RA="PopoverPortal",[uU,dU]=MA(RA,{forceMount:void 0}),fU=Io(e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=Hl(RA,t);return o.jsx(uU,{scope:t,forceMount:n,children:o.jsx(ps,{present:n||i.open,children:o.jsx(Df,{asChild:!0,container:a,children:r})})})},"PopoverPortal"),lf="PopoverContent",hU=s.forwardRef(Io(function(t,n){const r=dU(lf,t.__scopePopover),{forceMount:a=r.forceMount,...i}=t,l=Hl(lf,t.__scopePopover);return o.jsx(ps,{present:a||l.open,children:l.modal?o.jsx(mU,{...i,ref:n}):o.jsx(gU,{...i,ref:n})})},"PopoverContent")),pU=to("PopoverContent.RemoveScroll"),mU=s.forwardRef(Io(function(t,n){const r=Hl(lf,t.__scopePopover),a=s.useRef(null),i=hn(n,a),l=s.useRef(!1);return s.useEffect(()=>{const u=a.current;if(u)return xm(u)},[]),o.jsx(Hf,{as:pU,allowPinchZoom:!0,children:o.jsx(PA,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Nt(t.onCloseAutoFocus,u=>{var f;u.preventDefault(),l.current||(f=r.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Nt(t.onPointerDownOutside,u=>{const f=u.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0,p=f.button===2||h;l.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:Nt(t.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),gU=s.forwardRef(Io(function(t,n){const r=Hl(lf,t.__scopePopover),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(PA,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var u,f;(u=t.onCloseAutoFocus)==null||u.call(t,l),l.defaultPrevented||(a.current||(f=r.triggerRef.current)==null||f.focus(),l.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:l=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;((p=r.triggerRef.current)==null?void 0:p.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})},"PopoverContentNonModal")),PA=s.forwardRef(Io(function(t,n){const{__scopePopover:r,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:g,...m}=t,w=Hl(lf,r),y=Dm(r);return Md(),o.jsx(Nd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Tf,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:g,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>w.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(Rm,{"data-state":lw(w.open),role:"dialog",id:w.contentId,...y,...m,ref:n,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl")),vU="PopoverClose",wU=s.forwardRef(Io(function(t,n){const{__scopePopover:r,...a}=t,i=Hl(vU,r);return o.jsx(vn.button,{type:"button",...a,ref:n,onClick:Nt(t.onClick,()=>i.onOpenChange(!1))})},"PopoverClose"));function lw(e){return e?"open":"closed"}Io(lw,"getState");var yU=aU,bU=iU,xU=cU,kU=fU,SU=hU,EU=wU,CU=Object.defineProperty,Cn=(e,t)=>CU(e,"name",{value:t,configurable:!0});function LA(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}Cn(LA,"useStateMachine");var $A="ScrollArea",[TA,x0e]=Zs($A),[jU,Da]=TA($A),AU=s.forwardRef(Cn(function(t,n){const{__scopeScrollArea:r,type:a="hover",dir:i,scrollHideDelay:l=600,...u}=t,[f,h]=s.useState(null),[p,g]=s.useState(null),[m,w]=s.useState(null),[y,b]=s.useState(null),[k,S]=s.useState(null),[E,C]=s.useState(0),[A,L]=s.useState(0),[T,M]=s.useState(!1),[j,P]=s.useState(!1),R=hn(n,h),H=$f(i);return o.jsx(jU,{scope:r,type:a,dir:H,scrollHideDelay:l,scrollArea:f,viewport:p,onViewportChange:g,content:m,onContentChange:w,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:T,onScrollbarXEnabledChange:M,scrollbarY:k,onScrollbarYChange:S,scrollbarYEnabled:j,onScrollbarYEnabledChange:P,onCornerWidthChange:C,onCornerHeightChange:L,children:o.jsx(vn.div,{dir:H,...u,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})},"ScrollArea")),NU="ScrollAreaViewport",MU=s.forwardRef(Cn(function(t,n){const{__scopeScrollArea:r,children:a,nonce:i,...l}=t,u=Da(NU,r),f=s.useRef(null),h=hn(n,f,u.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx(RU,{nonce:i}),o.jsx(vn.div,{"data-radix-scroll-area-viewport":"",...l,ref:h,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})},"ScrollAreaViewport")),RU=s.memo(Cn(function({nonce:t}){return o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),Ri="ScrollAreaScrollbar",PU=s.forwardRef(Cn(function(t,n){const{forceMount:r,...a}=t,i=Da(Ri,t.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:u}=i,f=t.orientation==="horizontal";return s.useEffect(()=>(f?l(!0):u(!0),()=>{f?l(!1):u(!1)}),[f,l,u]),i.type==="hover"?o.jsx(LU,{...a,ref:n,forceMount:r}):i.type==="scroll"?o.jsx($U,{...a,ref:n,forceMount:r}):i.type==="auto"?o.jsx(DA,{...a,ref:n,forceMount:r}):i.type==="always"?o.jsx(cw,{...a,ref:n,"data-state":"visible"}):null},"ScrollAreaScrollbar")),LU=s.forwardRef(Cn(function(t,n){const{forceMount:r,...a}=t,i=Da(Ri,t.__scopeScrollArea),[l,u]=s.useState(!1);return s.useEffect(()=>{const f=i.scrollArea;let h=0;if(f){const p=Cn(()=>{window.clearTimeout(h),u(!0)},"handlePointerEnter"),g=Cn(()=>{h=window.setTimeout(()=>u(!1),i.scrollHideDelay)},"handlePointerLeave");return f.addEventListener("pointerenter",p),f.addEventListener("pointerleave",g),()=>{window.clearTimeout(h),f.removeEventListener("pointerenter",p),f.removeEventListener("pointerleave",g)}}},[i.scrollArea,i.scrollHideDelay]),o.jsx(ps,{present:r||l,children:o.jsx(DA,{"data-state":l?"visible":"hidden",...a,ref:n})})},"ScrollAreaScrollbarHover")),$U=s.forwardRef(Cn(function(t,n){const{forceMount:r,...a}=t,i=Da(Ri,t.__scopeScrollArea),l=t.orientation==="horizontal",u=Vf(()=>h("SCROLL_END"),100),[f,h]=LA("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(f==="idle"){const p=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(p)}},[f,i.scrollHideDelay,h]),s.useEffect(()=>{const p=i.viewport,g=l?"scrollLeft":"scrollTop";if(p){let m=p[g];const w=Cn(()=>{const y=p[g];m!==y&&(h("SCROLL"),u()),m=y},"handleScroll");return p.addEventListener("scroll",w),()=>p.removeEventListener("scroll",w)}},[i.viewport,l,h,u]),o.jsx(ps,{present:r||f!=="hidden",children:o.jsx(cw,{"data-state":f==="hidden"?"hidden":"visible",...a,ref:n,onPointerEnter:Nt(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Nt(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),DA=s.forwardRef(Cn(function(t,n){const r=Da(Ri,t.__scopeScrollArea),{forceMount:a,...i}=t,[l,u]=s.useState(!1),f=t.orientation==="horizontal",h=Vf(()=>{if(r.viewport){const p=r.viewport.offsetWidth<r.viewport.scrollWidth,g=r.viewport.offsetHeight<r.viewport.scrollHeight;u(f?p:g)}},10);return Rc(r.viewport,h),Rc(r.content,h),o.jsx(ps,{present:a||l,children:o.jsx(cw,{"data-state":l?"visible":"hidden",...i,ref:n})})},"ScrollAreaScrollbarAuto")),cw=s.forwardRef(Cn(function(t,n){const{orientation:r="vertical",...a}=t,i=Da(Ri,t.__scopeScrollArea),l=s.useRef(null),u=s.useRef(0),[f,h]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=uw(f.viewport,f.content),g={...a,sizes:f,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:Cn(w=>l.current=w,"onThumbChange"),onThumbPointerUp:Cn(()=>u.current=0,"onThumbPointerUp"),onThumbPointerDown:Cn(w=>u.current=w,"onThumbPointerDown")};function m(w,y){return FA(w,u.current,f,y)}return Cn(m,"getScrollPosition"),r==="horizontal"?o.jsx(TU,{...g,ref:n,onThumbPositionChange:()=>{if(i.viewport&&l.current){const w=i.viewport.scrollLeft,y=J6(w,f,i.dir);l.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollLeft=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollLeft=m(w,i.dir))}}):r==="vertical"?o.jsx(DU,{...g,ref:n,onThumbPositionChange:()=>{if(i.viewport&&l.current){const w=i.viewport.scrollTop,y=J6(w,f);l.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollTop=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollTop=m(w))}}):null},"ScrollAreaScrollbarVisible")),TU=s.forwardRef(Cn(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,l=Da(Ri,t.__scopeScrollArea),[u,f]=s.useState(),h=s.useRef(null),p=hn(n,h,l.onScrollbarXChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(OA,{"data-orientation":"horizontal",...i,ref:p,sizes:r,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":_f(r)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.x),onDragScroll:g=>t.onDragScroll(g.x),onWheelScroll:(g,m)=>{if(l.viewport){const w=l.viewport.scrollLeft+g.deltaX;t.onWheelScroll(w),fw(w,m)&&g.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&a({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:cf(u.paddingLeft),paddingEnd:cf(u.paddingRight)}})}})},"ScrollAreaScrollbarX")),DU=s.forwardRef(Cn(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,l=Da(Ri,t.__scopeScrollArea),[u,f]=s.useState(),h=s.useRef(null),p=hn(n,h,l.onScrollbarYChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(OA,{"data-orientation":"vertical",...i,ref:p,sizes:r,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":_f(r)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.y),onDragScroll:g=>t.onDragScroll(g.y),onWheelScroll:(g,m)=>{if(l.viewport){const w=l.viewport.scrollTop+g.deltaY;t.onWheelScroll(w),fw(w,m)&&g.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&a({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:cf(u.paddingTop),paddingEnd:cf(u.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[HU,HA]=TA(Ri),OA=s.forwardRef(Cn(function(t,n){const{__scopeScrollArea:r,sizes:a,hasThumb:i,onThumbChange:l,onThumbPointerUp:u,onThumbPointerDown:f,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:g,onResize:m,...w}=t,y=Da(Ri,r),[b,k]=s.useState(null),S=hn(n,k),E=s.useRef(null),C=s.useRef(""),A=y.viewport,L=a.content-a.viewport,T=kr(g),M=kr(h),j=Vf(m,10);function P(R){if(E.current){const H=R.clientX-E.current.left,D=R.clientY-E.current.top;p({x:H,y:D})}}return Cn(P,"handleDragScroll"),s.useEffect(()=>{const R=Cn(H=>{const D=H.target;(b==null?void 0:b.contains(D))&&T(H,L)},"handleWheel");return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[A,b,L,T]),s.useEffect(M,[a,M]),Rc(b,j),Rc(y.content,j),o.jsx(HU,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:kr(l),onThumbPointerUp:kr(u),onThumbPositionChange:M,onThumbPointerDown:kr(f),children:o.jsx(vn.div,{...w,ref:S,style:{position:"absolute",...w.style},onPointerDown:Nt(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),E.current=b.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(R))}),onPointerMove:Nt(t.onPointerMove,P),onPointerUp:Nt(t.onPointerUp,R=>{const H=R.target;H.hasPointerCapture(R.pointerId)&&H.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=C.current,y.viewport&&(y.viewport.style.scrollBehavior=""),E.current=null})})})},"ScrollAreaScrollbarImpl")),Q6="ScrollAreaThumb",OU=s.forwardRef(Cn(function(t,n){const{forceMount:r,...a}=t,i=HA(Q6,t.__scopeScrollArea);return o.jsx(ps,{present:r||i.hasThumb,children:o.jsx(IU,{ref:n,...a})})},"ScrollAreaThumb")),IU=s.forwardRef(Cn(function(t,n){const{__scopeScrollArea:r,style:a,...i}=t,l=Da(Q6,r),u=HA(Q6,r),{onThumbPositionChange:f}=u,h=hn(n,u.onThumbChange),p=s.useRef(void 0),g=Vf(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const m=l.viewport;if(m){const w=Cn(()=>{if(g(),!p.current){const y=VU(m,f);p.current=y,f()}},"handleScroll");return f(),m.addEventListener("scroll",w),()=>m.removeEventListener("scroll",w)}},[l.viewport,g,f]),o.jsx(vn.div,{"data-state":u.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:Nt(t.onPointerDownCapture,m=>{const y=m.target.getBoundingClientRect(),b=m.clientX-y.left,k=m.clientY-y.top;u.onThumbPointerDown({x:b,y:k})}),onPointerUp:Nt(t.onPointerUp,u.onThumbPointerUp)})},"ScrollAreaThumbImpl")),IA="ScrollAreaCorner",FU=s.forwardRef(Cn(function(t,n){const r=Da(IA,t.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(_U,{...t,ref:n}):null},"ScrollAreaCorner")),_U=s.forwardRef(Cn(function(t,n){const{__scopeScrollArea:r,...a}=t,i=Da(IA,r),[l,u]=s.useState(0),[f,h]=s.useState(0),p=!!(l&&f),{onCornerWidthChange:g,onCornerHeightChange:m}=i;return Rc(i.scrollbarX,()=>{var y;const w=((y=i.scrollbarX)==null?void 0:y.offsetHeight)||0;i.onCornerHeightChange(w),h(w)}),Rc(i.scrollbarY,()=>{var y;const w=((y=i.scrollbarY)==null?void 0:y.offsetWidth)||0;i.onCornerWidthChange(w),u(w)}),s.useEffect(()=>()=>{g(0),m(0)},[g,m]),p?o.jsx(vn.div,{...a,ref:n,style:{width:l,height:f,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function cf(e){return e?parseInt(e,10):0}Cn(cf,"toInt");function uw(e,t){const n=e/t;return isNaN(n)?0:n}Cn(uw,"getThumbRatio");function _f(e){const t=uw(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}Cn(_f,"getThumbSize");function FA(e,t,n,r="ltr"){const a=_f(n),i=a/2,l=t||i,u=a-l,f=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-u,p=n.content-n.viewport,g=r==="ltr"?[0,p]:[p*-1,0];return dw([f,h],g)(e)}Cn(FA,"getScrollPositionFromPointer");function J6(e,t,n="ltr"){const r=_f(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,l=t.content-t.viewport,u=i-r,f=n==="ltr"?[0,l]:[l*-1,0],h=bp(e,f);return dw([0,l],[0,u])(h)}Cn(J6,"getThumbOffsetFromScroll");function dw(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}Cn(dw,"linearScale");function fw(e,t){return e>0&&e<t}Cn(fw,"isScrollingWithinScrollbarBounds");var VU=Cn((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return Cn((function a(){const i={left:e.scrollLeft,top:e.scrollTop},l=n.left!==i.left,u=n.top!==i.top;(l||u)&&t(),n=i,r=window.requestAnimationFrame(a)}),"loop")(),()=>window.cancelAnimationFrame(r)},"addUnlinkedScrollListener");function Vf(e,t){const n=kr(e),r=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),s.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}Cn(Vf,"useDebounceCallback");function Rc(e,t){const n=kr(t);Er(()=>{let r=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(r),a.unobserve(e)}}},[e,n])}Cn(Rc,"useResizeObserver");var _A=AU,VA=MU,e4=PU,t4=OU,ZU=FU,zU=Object.defineProperty,_n=(e,t)=>zU(e,"name",{value:t,configurable:!0}),BU=[" ","Enter","ArrowUp","ArrowDown"],UU=[" ","Enter"],md="Select",[Hm,hw,WU]=ym(md),[Gc,k0e]=Zs(md,[WU,Dl]),pw=Dl(),[KU,Ol]=Gc(md),[GU,YU]=Gc(md);function ZA(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:l,defaultValue:u,onValueChange:f,dir:h,name:p,autoComplete:g,disabled:m,required:w,form:y,internal_do_not_use_render:b}=e,k=pw(t),[S,E]=s.useState(null),[C,A]=s.useState(null),[L,T]=s.useState(!1),M=$f(h),[j,P]=wi({prop:r,defaultProp:a??!1,onChange:i,caller:md}),[R,H]=wi({prop:l,defaultProp:u,onChange:f,caller:md}),D=s.useRef(null),B=s.useRef(R);s.useEffect(()=>{const Y=y?S==null?void 0:S.ownerDocument.getElementById(y):S==null?void 0:S.form;if(Y instanceof HTMLFormElement){const Z=_n(()=>H(B.current),"reset");return Y.addEventListener("reset",Z),()=>Y.removeEventListener("reset",Z)}},[y,S,H]);const V=S?!!y||!!S.closest("form"):!0,[U,K]=s.useState(new Set),O=Na(),F=Array.from(U).map(Y=>Y.props.value).join(";"),I=s.useCallback(Y=>{K(Z=>new Set(Z).add(Y))},[]),G=s.useCallback(Y=>{K(Z=>{const ee=new Set(Z);return ee.delete(Y),ee})},[]),z={required:w,trigger:S,onTriggerChange:E,valueNode:C,onValueNodeChange:A,valueNodeHasChildren:L,onValueNodeHasChildrenChange:T,contentId:O,value:R,onValueChange:H,open:j,onOpenChange:P,dir:M,triggerPointerDownPosRef:D,disabled:m,name:p,autoComplete:g,form:y,nativeOptions:U,nativeSelectKey:F,isFormControl:V};return o.jsx(Mm,{...k,children:o.jsx(KU,{scope:t,...z,children:o.jsx(Hm.Provider,{scope:t,children:o.jsx(GU,{scope:t,onNativeOptionAdd:I,onNativeOptionRemove:G,children:UA(b)?b(z):n})})})})}_n(ZA,"SelectProvider");var qU=_n(e=>{const{__scopeSelect:t,children:n,...r}=e;return o.jsx(ZA,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:a})=>o.jsxs(o.Fragment,{children:[n,a?o.jsx(AW,{__scopeSelect:t}):null]})})},"Select"),XU="SelectTrigger",QU=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,disabled:a=!1,...i}=t,l=pw(r),u=Ol(XU,r),f=u.disabled||a,h=hn(n,u.onTriggerChange),p=hw(r),g=s.useRef("touch"),[m,w,y]=mw(k=>{const S=p().filter(A=>!A.disabled),E=S.find(A=>A.value===u.value),C=gw(S,k,E);C!==void 0&&u.onValueChange(C.value)}),b=_n(k=>{f||(u.onOpenChange(!0),y()),k&&(u.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})},"handleOpen");return o.jsx(If,{asChild:!0,...l,children:o.jsx(vn.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":Zf(u.value)?"":void 0,...i,ref:h,onClick:Nt(i.onClick,k=>{k.currentTarget.focus(),g.current!=="mouse"&&b(k)}),onPointerDown:Nt(i.onPointerDown,k=>{g.current=k.pointerType;const S=k.target;S.hasPointerCapture(k.pointerId)&&S.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(b(k),k.preventDefault())}),onKeyDown:Nt(i.onKeyDown,k=>{const S=m.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&w(k.key),!(S&&k.key===" ")&&BU.includes(k.key)&&(b(),k.preventDefault())})})})},"SelectTrigger")),JU="SelectValue",eW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,className:a,style:i,children:l,placeholder:u="",...f}=t,h=Ol(JU,r),{onValueNodeHasChildrenChange:p}=h,g=l!==void 0,m=hn(n,h.onValueNodeChange);Er(()=>{p(g)},[p,g]);const w=Zf(h.value);return o.jsx(vn.span,{...f,asChild:w?!1:f.asChild,ref:m,style:{pointerEvents:"none"},children:o.jsx(s.Fragment,{children:w?u:l},w?"placeholder":"value")})},"SelectValue")),tW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,children:a,...i}=t;return o.jsx(vn.span,{"aria-hidden":!0,...i,ref:n,children:a||"▼"})},"SelectIcon")),nW="SelectPortal",[rW,sW]=Gc(nW,{forceMount:void 0}),aW=_n(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return o.jsx(rW,{scope:e.__scopeSelect,forceMount:n,children:o.jsx(Df,{asChild:!0,...r})})},"SelectPortal"),Pc="SelectContent",oW=s.forwardRef(_n(function(t,n){const r=sW(Pc,t.__scopeSelect),{forceMount:a=r.forceMount,...i}=t,l=Ol(Pc,t.__scopeSelect),[u,f]=s.useState();return Er(()=>{f(new DocumentFragment)},[]),o.jsx(ps,{present:a||l.open,children:({present:h})=>h?o.jsx(cW,{...i,ref:n}):o.jsx(iW,{...i,fragment:u})})},"SelectContent")),iW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,children:a,fragment:i}=t;return i?Br.createPortal(o.jsx(zA,{scope:r,children:o.jsx(Hm.Slot,{scope:r,children:o.jsx("div",{ref:n,children:a})})}),i):null},"SelectContentFragment")),Wa=10,[zA,Om]=Gc(Pc),lW=to("SelectContent.RemoveScroll"),cW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r}=t,{position:a="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:u,side:f,sideOffset:h,align:p,alignOffset:g,arrowPadding:m,collisionBoundary:w,collisionPadding:y,sticky:b,hideWhenDetached:k,avoidCollisions:S,...E}=t,C=Ol(Pc,r),[A,L]=s.useState(null),[T,M]=s.useState(null),j=hn(n,L),[P,R]=s.useState(null),[H,D]=s.useState(null),B=hw(r),[V,U]=s.useState(!1),K=s.useRef(!1);s.useEffect(()=>{if(A)return xm(A)},[A]),Md();const O=s.useCallback(J=>{const[te,...X]=B().map(ce=>ce.ref.current),[ae]=X.slice(-1),Le=document.activeElement;for(const ce of J)if(ce===Le||(ce==null||ce.scrollIntoView({block:"nearest"}),ce===te&&T&&(T.scrollTop=0),ce===ae&&T&&(T.scrollTop=T.scrollHeight),ce==null||ce.focus(),document.activeElement!==Le))return},[B,T]),F=s.useCallback(()=>O([P,A]),[O,P,A]);s.useEffect(()=>{V&&F()},[V,F]);const{onOpenChange:I,triggerPointerDownPosRef:G}=C;s.useEffect(()=>{if(A){let J={x:0,y:0};const te=_n(ae=>{var Le,ce;J={x:Math.abs(Math.round(ae.pageX)-(((Le=G.current)==null?void 0:Le.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((ce=G.current)==null?void 0:ce.y)??0))}},"handlePointerMove"),X=_n(ae=>{J.x<=10&&J.y<=10?ae.preventDefault():ae.composedPath().includes(A)||I(!1),document.removeEventListener("pointermove",te),G.current=null},"handlePointerUp");return G.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",X,{capture:!0})}}},[A,I,G]),s.useEffect(()=>{const J=_n(()=>I(!1),"close");return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[I]);const[z,Y]=mw(J=>{const te=B().filter(Le=>!Le.disabled),X=te.find(Le=>Le.ref.current===document.activeElement),ae=gw(te,J,X);ae&&setTimeout(()=>{var Le;return(Le=ae.ref.current)==null?void 0:Le.focus()})}),Z=s.useCallback((J,te,X)=>{const ae=!K.current&&!X;(C.value!==void 0&&C.value===te||ae)&&(R(J),ae&&(K.current=!0))},[C.value]),ee=s.useCallback(()=>A==null?void 0:A.focus(),[A]),pe=s.useCallback((J,te,X)=>{const ae=!K.current&&!X;(C.value!==void 0&&C.value===te||ae)&&D(J)},[C.value]),se=a==="popper"?w5:uW,xe=se===w5?{side:f,sideOffset:h,align:p,alignOffset:g,arrowPadding:m,collisionBoundary:w,collisionPadding:y,sticky:b,hideWhenDetached:k,avoidCollisions:S}:{};return o.jsx(zA,{scope:r,content:A,viewport:T,onViewportChange:M,itemRefCallback:Z,selectedItem:P,onItemLeave:ee,itemTextRefCallback:pe,focusSelectedItem:F,selectedItemText:H,position:a,isPositioned:V,searchRef:z,children:o.jsx(Hf,{as:lW,allowPinchZoom:!0,children:o.jsx(Nd,{asChild:!0,trapped:C.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Nt(i,J=>{var te;(te=C.trigger)==null||te.focus({preventScroll:!0}),J.preventDefault()}),children:o.jsx(Tf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:o.jsx(se,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:J=>J.preventDefault(),...E,...xe,onPlaced:()=>U(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:Nt(E.onKeyDown,J=>{const te=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!te&&J.key.length===1&&Y(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let ae=B().filter(Le=>!Le.disabled).map(Le=>Le.ref.current);if(["ArrowUp","End"].includes(J.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const Le=J.target,ce=ae.indexOf(Le);ae=ae.slice(ce+1)}setTimeout(()=>O(ae)),J.preventDefault()}})})})})})})},"SelectContentImpl")),uW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,onPlaced:a,...i}=t,l=Ol(Pc,r),u=Om(Pc,r),[f,h]=s.useState(null),[p,g]=s.useState(null),m=hn(n,g),w=hw(r),y=s.useRef(!1),b=s.useRef(!0),{viewport:k,selectedItem:S,selectedItemText:E,focusSelectedItem:C}=u,A=s.useCallback(()=>{if(l.trigger&&l.valueNode&&f&&p&&k&&S&&E){const j=l.trigger.getBoundingClientRect(),P=p.getBoundingClientRect(),R=l.valueNode.getBoundingClientRect(),H=E.getBoundingClientRect();if(l.dir!=="rtl"){const Le=H.left-P.left,ce=R.left-Le,Se=j.left-ce,Ze=j.width+Se,gt=Math.max(Ze,P.width),Ke=window.innerWidth-Wa,nt=bp(ce,[Wa,Math.max(Wa,Ke-gt)]);f.style.minWidth=Ze+"px",f.style.left=nt+"px"}else{const Le=P.right-H.right,ce=window.innerWidth-R.right-Le,Se=window.innerWidth-j.right-ce,Ze=j.width+Se,gt=Math.max(Ze,P.width),Ke=window.innerWidth-Wa,nt=bp(ce,[Wa,Math.max(Wa,Ke-gt)]);f.style.minWidth=Ze+"px",f.style.right=nt+"px"}const D=w(),B=window.innerHeight-Wa*2,V=k.scrollHeight,U=window.getComputedStyle(p),K=parseInt(U.borderTopWidth,10),O=parseInt(U.paddingTop,10),F=parseInt(U.borderBottomWidth,10),I=parseInt(U.paddingBottom,10),G=K+O+V+I+F,z=Math.min(S.offsetHeight*5,G),Y=window.getComputedStyle(k),Z=parseInt(Y.paddingTop,10),ee=parseInt(Y.paddingBottom,10),pe=j.top+j.height/2-Wa,se=B-pe,xe=S.offsetHeight/2,J=S.offsetTop+xe,te=K+O+J,X=G-te;if(te<=pe){const Le=D.length>0&&S===D[D.length-1].ref.current;f.style.bottom="0px";const ce=p.clientHeight-k.offsetTop-k.offsetHeight,Se=Math.max(se,xe+(Le?ee:0)+ce+F),Ze=te+Se;f.style.height=Ze+"px"}else{const Le=D.length>0&&S===D[0].ref.current;f.style.top="0px";const Se=Math.max(pe,K+k.offsetTop+(Le?Z:0)+xe)+X;f.style.height=Se+"px",k.scrollTop=te-pe+k.offsetTop}f.style.margin=`${Wa}px 0`,f.style.minHeight=z+"px",f.style.maxHeight=B+"px",a==null||a(),requestAnimationFrame(()=>y.current=!0)}},[w,l.trigger,l.valueNode,f,p,k,S,E,l.dir,a]);Er(()=>A(),[A]);const[L,T]=s.useState();Er(()=>{p&&T(window.getComputedStyle(p).zIndex)},[p]);const M=s.useCallback(j=>{j&&b.current===!0&&(A(),C==null||C(),b.current=!1)},[A,C]);return o.jsx(dW,{scope:r,contentWrapper:f,shouldExpandOnScrollRef:y,onScrollButtonChange:M,children:o.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:L},children:o.jsx(vn.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),w5=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,align:a="start",collisionPadding:i=Wa,...l}=t,u=pw(r);return o.jsx(Rm,{...u,...l,ref:n,align:a,collisionPadding:i,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[dW,fW]=Gc(Pc,{}),y5="SelectViewport",hW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,nonce:a,...i}=t,l=Om(y5,r),u=fW(y5,r),f=hn(n,l.onViewportChange),h=s.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(Hm.Slot,{scope:r,children:o.jsx(vn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Nt(i.onScroll,p=>{const g=p.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:w}=u;if(w!=null&&w.current&&m){const y=Math.abs(h.current-g.scrollTop);if(y>0){const b=window.innerHeight-Wa*2,k=parseFloat(m.style.minHeight),S=parseFloat(m.style.height),E=Math.max(k,S);if(E<b){const C=E+y,A=Math.min(b,C),L=C-A;m.style.height=A+"px",m.style.bottom==="0px"&&(g.scrollTop=L>0?L:0,m.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})},"SelectViewport")),pW="SelectGroup",[mW,gW]=Gc(pW),vW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,...a}=t,i=Na();return o.jsx(mW,{scope:r,id:i,children:o.jsx(vn.div,{role:"group","aria-labelledby":i,...a,ref:n})})},"SelectGroup")),wW="SelectLabel",yW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,...a}=t,i=gW(wW,r);return o.jsx(vn.div,{id:i.id,...a,ref:n})},"SelectLabel")),n4="SelectItem",[bW,BA]=Gc(n4),xW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,value:a,disabled:i=!1,textValue:l,...u}=t,f=Ol(n4,r),h=Om(n4,r),p=f.value===a,[g,m]=s.useState(l??""),[w,y]=s.useState(!1),b=kr(A=>{var L;return(L=h.itemRefCallback)==null?void 0:L.call(h,A,a,i)}),k=hn(n,b),S=Na(),E=s.useRef("touch"),C=_n(()=>{i||(f.onValueChange(a),f.onOpenChange(!1))},"handleSelect");return o.jsx(bW,{scope:r,value:a,disabled:i,textId:S,isSelected:p,onItemTextChange:s.useCallback(A=>{m(L=>L||((A==null?void 0:A.textContent)??"").trim())},[]),children:o.jsx(Hm.ItemSlot,{scope:r,value:a,disabled:i,textValue:g,children:o.jsx(vn.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:k,onFocus:Nt(u.onFocus,()=>y(!0)),onBlur:Nt(u.onBlur,()=>y(!1)),onClick:Nt(u.onClick,()=>{E.current!=="mouse"&&C()}),onPointerUp:Nt(u.onPointerUp,()=>{E.current==="mouse"&&C()}),onPointerDown:Nt(u.onPointerDown,A=>{E.current=A.pointerType}),onPointerMove:Nt(u.onPointerMove,A=>{var L;E.current=A.pointerType,i?(L=h.onItemLeave)==null||L.call(h):E.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Nt(u.onPointerLeave,A=>{var L;A.currentTarget===document.activeElement&&((L=h.onItemLeave)==null||L.call(h))}),onKeyDown:Nt(u.onKeyDown,A=>{var T;i||A.target!==A.currentTarget||((T=h.searchRef)==null?void 0:T.current)!==""&&A.key===" "||(UU.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})},"SelectItem")),Mh="SelectItemText",kW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,className:a,style:i,...l}=t,u=Ol(Mh,r),f=Om(Mh,r),h=BA(Mh,r),p=YU(Mh,r),[g,m]=s.useState(null),w=kr(C=>{var A;return(A=f.itemTextRefCallback)==null?void 0:A.call(f,C,h.value,h.disabled)}),y=hn(n,m,h.onItemTextChange,w),b=g==null?void 0:g.textContent,k=s.useMemo(()=>o.jsx("option",{value:h.value,disabled:h.disabled,children:b},h.value),[h.disabled,h.value,b]),{onNativeOptionAdd:S,onNativeOptionRemove:E}=p;return Er(()=>(S(k),()=>E(k)),[S,E,k]),o.jsxs(o.Fragment,{children:[o.jsx(vn.span,{id:h.textId,...l,ref:y}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Zf(u.value)?Br.createPortal(l.children,u.valueNode):null]})},"SelectItemText")),SW="SelectItemIndicator",EW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,...a}=t;return BA(SW,r).isSelected?o.jsx(vn.span,{"aria-hidden":!0,...a,ref:n}):null},"SelectItemIndicator")),CW=s.forwardRef(_n(function(t,n){const{__scopeSelect:r,...a}=t;return o.jsx(vn.div,{"aria-hidden":!0,...a,ref:n})},"SelectSeparator")),jW="SelectBubbleInput",AW=s.forwardRef(_n(function({__scopeSelect:t,...n},r){const a=Ol(jW,t),{value:i,onValueChange:l,required:u,disabled:f,name:h,autoComplete:p,form:g}=a,{nativeOptions:m,nativeSelectKey:w}=a,y=s.useRef(null),b=hn(r,y),k=i??"",S=NA(k),E=Array.from(m).some(C=>(C.props.value??"")==="");return s.useEffect(()=>{const C=y.current;if(!C)return;const A=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(A,"value").set;if(S!==k&&T){const M=new Event("change",{bubbles:!0});T.call(C,k),C.dispatchEvent(M)}},[S,k]),o.jsxs(vn.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:h,autoComplete:p,disabled:f,form:g,onChange:C=>l(C.target.value),...n,style:{...NC,...n.style},ref:b,defaultValue:k,children:[Zf(i)&&!E?o.jsx("option",{value:""}):null,Array.from(m)]},w)},"SelectBubbleInput"));function UA(e){return typeof e=="function"}_n(UA,"isFunction");function Zf(e){return e===""||e===void 0}_n(Zf,"shouldShowPlaceholder");function mw(e){const t=kr(e),n=s.useRef(""),r=s.useRef(0),a=s.useCallback(l=>{const u=n.current+l;t(u),_n((function f(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>f(""),1e3))}),"updateSearch")(u)},[t]),i=s.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}_n(mw,"useTypeaheadSearch");function gw(e,t,n){const a=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=WA(e,Math.max(i,0));a.length===1&&(l=l.filter(h=>h!==n));const f=l.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}_n(gw,"findNextItem");function WA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}_n(WA,"wrapArray");var NW=Object.defineProperty,Lr=(e,t)=>NW(e,"name",{value:t,configurable:!0}),[vw,S0e]=Zs("Tooltip",[Dl]),Im=Dl(),MW="TooltipProvider",RW=700,r4="tooltip.open",[PW,ww]=vw(MW),LW=Lr(e=>{const{__scopeTooltip:t,delayDuration:n=RW,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,l=s.useRef(!0),u=s.useRef(!1),f=s.useRef(0);return s.useEffect(()=>{const h=f.current;return()=>window.clearTimeout(h)},[]),o.jsx(PW,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:s.useCallback(()=>{r<=0||(window.clearTimeout(f.current),l.current=!1)},[r]),onClose:s.useCallback(()=>{r<=0||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>l.current=!0,r))},[r]),isPointerInTransitRef:u,onPointerInTransitChange:s.useCallback(h=>{u.current=h},[]),disableHoverableContent:a,children:i})},"TooltipProvider"),s4="Tooltip",[$W,zf]=vw(s4),TW=Lr(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:l,delayDuration:u}=e,f=ww(s4,e.__scopeTooltip),h=Im(t),[p,g]=s.useState(null),[m,w]=s.useState(void 0),y=Na(),b=s.useRef(0),k=l??f.disableHoverableContent,S=u??f.delayDuration,E=s.useRef(!1),[C,A]=wi({prop:r,defaultProp:a??!1,onChange:Lr(R=>{R?(f.onOpen(),document.dispatchEvent(new CustomEvent(r4))):f.onClose(),i==null||i(R)},"onChange"),caller:s4}),L=s.useMemo(()=>C?E.current?"delayed-open":"instant-open":"closed",[C]),T=s.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E.current=!1,A(!0)},[A]),M=s.useCallback(()=>{window.clearTimeout(b.current),b.current=0,A(!1)},[A]),j=s.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{E.current=!0,A(!0),b.current=0},S)},[S,A]);s.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]);const P=m??y;return o.jsx(Mm,{...h,children:o.jsx($W,{scope:t,contentId:P,setContentId:w,open:C,stateAttribute:L,trigger:p,onTriggerChange:g,onTriggerEnter:s.useCallback(()=>{f.isOpenDelayedRef.current?j():T()},[f.isOpenDelayedRef,j,T]),onTriggerLeave:s.useCallback(()=>{k?M():(window.clearTimeout(b.current),b.current=0)},[M,k]),onOpen:T,onClose:M,disableHoverableContent:k,children:n})})},"Tooltip"),b5="TooltipTrigger",DW=s.forwardRef(Lr(function(t,n){const{__scopeTooltip:r,...a}=t,i=zf(b5,r),l=ww(b5,r),u=Im(r),f=s.useRef(null),h=hn(n,f,i.onTriggerChange),p=s.useRef(!1),g=s.useRef(!1),m=s.useCallback(()=>p.current=!1,[]);return s.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(If,{asChild:!0,...u,children:o.jsx(vn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...a,ref:h,onPointerMove:Nt(t.onPointerMove,w=>{w.pointerType!=="touch"&&!g.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),g.current=!0)}),onPointerLeave:Nt(t.onPointerLeave,()=>{i.onTriggerLeave(),g.current=!1}),onPointerDown:Nt(t.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Nt(t.onFocus,()=>{p.current||i.onOpen()}),onBlur:Nt(t.onBlur,i.onClose),onClick:Nt(t.onClick,i.onClose)})})},"TooltipTrigger")),KA="TooltipPortal",[HW,OW]=vw(KA,{forceMount:void 0}),IW=Lr(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,i=zf(KA,t);return o.jsx(HW,{scope:t,forceMount:n,children:o.jsx(ps,{present:n||i.open,children:o.jsx(Df,{asChild:!0,container:a,children:r})})})},"TooltipPortal"),uf="TooltipContent",FW=s.forwardRef(Lr(function(t,n){const r=OW(uf,t.__scopeTooltip),{forceMount:a=r.forceMount,side:i="top",...l}=t,u=zf(uf,t.__scopeTooltip);return o.jsx(ps,{present:a||u.open,children:u.disableHoverableContent?o.jsx(GA,{side:i,...l,ref:n}):o.jsx(_W,{side:i,...l,ref:n})})},"TooltipContent")),_W=s.forwardRef(Lr(function(t,n){const r=zf(uf,t.__scopeTooltip),a=ww(uf,t.__scopeTooltip),i=s.useRef(null),l=hn(n,i),[u,f]=s.useState(null),{trigger:h,onClose:p}=r,g=i.current,{onPointerInTransitChange:m}=a,w=s.useCallback(()=>{f(null),m(!1)},[m]),y=s.useCallback((b,k)=>{const S=b.currentTarget,E={x:b.clientX,y:b.clientY},C=YA(E,S.getBoundingClientRect()),A=qA(E,C),L=XA(k.getBoundingClientRect()),T=JA([...A,...L]);f(T),m(!0)},[m]);return s.useEffect(()=>()=>w(),[w]),s.useEffect(()=>{if(h&&g){const b=Lr(S=>y(S,g),"handleTriggerLeave"),k=Lr(S=>y(S,h),"handleContentLeave");return h.addEventListener("pointerleave",b),g.addEventListener("pointerleave",k),()=>{h.removeEventListener("pointerleave",b),g.removeEventListener("pointerleave",k)}}},[h,g,y,w]),s.useEffect(()=>{if(u){const b=Lr(k=>{const S=k.target,E={x:k.clientX,y:k.clientY},C=(h==null?void 0:h.contains(S))||(g==null?void 0:g.contains(S)),A=!QA(E,u);C?w():A&&(w(),p())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[h,g,u,p,w]),o.jsx(GA,{...t,ref:l})},"TooltipContentHoverable")),VW=Ov("TooltipContent"),GA=s.forwardRef(Lr(function(t,n){const{__scopeTooltip:r,children:a,"aria-label":i,id:l,onEscapeKeyDown:u,onPointerDownOutside:f,...h}=t,p=zf(uf,r),g=Im(r),{onClose:m}=p;s.useEffect(()=>(document.addEventListener(r4,m),()=>document.removeEventListener(r4,m)),[m]),s.useEffect(()=>{if(p.trigger){const y=Lr(b=>{b.target instanceof Node&&b.target.contains(p.trigger)&&m()},"handleScroll");return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[p.trigger,m]);const{setContentId:w}=p;return Er(()=>(w(l),()=>{w(void 0)}),[l,w]),o.jsx(Tf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:y=>y.preventDefault(),onDismiss:m,children:o.jsxs(Rm,{"data-state":p.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:p.contentId,...g,...h,ref:n,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(VW,{children:a}),i?o.jsx(MC,{id:p.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl")),ZW=s.forwardRef(Lr(function(t,n){const{__scopeTooltip:r,...a}=t,i=Im(r);return o.jsx(XZ,{...i,...a,ref:n})},"TooltipArrow"));function YA(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Lr(YA,"getExitSideFromRect");function qA(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}Lr(qA,"getPaddedExitPoints");function XA(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}Lr(XA,"getPointsFromRect");function QA(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,l=t.length-1;i<t.length;l=i++){const u=t[i],f=t[l],h=u.x,p=u.y,g=f.x,m=f.y;p>r!=m>r&&n<(g-h)*(r-p)/(m-p)+h&&(a=!a)}return a}Lr(QA,"isPointInPolygon");function JA(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),eN(t)}Lr(JA,"getHull");function eN(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const i=t[t.length-1],l=t[t.length-2];if((i.x-l.x)*(a.y-l.y)>=(i.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(a.y-l.y)>=(i.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}Lr(eN,"getHullPresorted");var zW=LW,BW=TW,UW=DW,WW=IW,KW=FW,GW=ZW,y8={exports:{}};/*!
93
+ Copyright (c) 2018 Jed Watson.
94
+ Licensed under the MIT License (MIT), see
95
+ http://jedwatson.github.io/classnames
96
+ */var x5;function YW(){return x5||(x5=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",l=0;l<arguments.length;l++){var u=arguments[l];u&&(i=a(i,r(u)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var l="";for(var u in i)t.call(i,u)&&i[u]&&(l=a(l,u));return l}function a(i,l){return l?i?i+" "+l:i+l:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(y8)),y8.exports}var qW=YW();const Gt=X9(qW),io={asChild:{type:"boolean"}},Mo={width:{type:"string",className:"rt-r-w",customProperties:["--width"],responsive:!0},minWidth:{type:"string",className:"rt-r-min-w",customProperties:["--min-width"],responsive:!0},maxWidth:{type:"string",className:"rt-r-max-w",customProperties:["--max-width"],responsive:!0}},yw={height:{type:"string",className:"rt-r-h",customProperties:["--height"],responsive:!0},minHeight:{type:"string",className:"rt-r-min-h",customProperties:["--min-height"],responsive:!0},maxHeight:{type:"string",className:"rt-r-max-h",customProperties:["--max-height"],responsive:!0}},XW=["1","2","3","4"],tN={...io,align:{type:"enum",className:"rt-r-align",values:["start","center"],default:"center"},size:{type:"enum",className:"rt-r-size",values:XW,default:"3",responsive:!0},width:Mo.width,minWidth:Mo.minWidth,maxWidth:{...Mo.maxWidth,default:"600px"},...yw},nN=["gray","gold","bronze","brown","yellow","amber","orange","tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","lime","mint","sky"],Il={color:{type:"enum",values:nN,default:void 0}},bw={color:{type:"enum",values:nN,default:""}},Yc={highContrast:{type:"boolean",className:"rt-high-contrast",default:void 0}},QW=["normal","start","end","both"],rN={trim:{type:"enum",className:"rt-r-lt",values:QW,responsive:!0}},JW=["left","center","right"],sN={align:{type:"enum",className:"rt-r-ta",values:JW,responsive:!0}},eK=["wrap","nowrap","pretty","balance"],aN={wrap:{type:"enum",className:"rt-r-tw",values:eK,responsive:!0}},oN={truncate:{type:"boolean",className:"rt-truncate"}},tK=["light","regular","medium","bold"],iN={weight:{type:"enum",className:"rt-r-weight",values:tK,responsive:!0}},nK=["h1","h2","h3","h4","h5","h6"],rK=["1","2","3","4","5","6","7","8","9"],sK={as:{type:"enum",values:nK,default:"h1"},...io,size:{type:"enum",className:"rt-r-size",values:rK,default:"6",responsive:!0},...iN,...sN,...rN,...oN,...aN,...Il,...Yc},aK=["initial","xs","sm","md","lg","xl"],xw=new Set(aK);function lN(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function V0(e){return typeof e=="object"&&e!==null&&Object.keys(e).some(t=>xw.has(t))}function el({className:e,customProperties:t,...n}){const r=xp({allowArbitraryValues:!0,className:e,...n}),a=oK({customProperties:t,...n});return[r,a]}function xp({allowArbitraryValues:e,value:t,className:n,propValues:r,parseValue:a=i=>i}){const i=[];if(t){if(typeof t=="string"&&r.includes(t))return k5(n,t,a);if(V0(t)){const l=t;for(const u in l){if(!lN(l,u)||!xw.has(u))continue;const f=l[u];if(f!==void 0){if(r.includes(f)){const h=k5(n,f,a),p=u==="initial"?h:`${u}:${h}`;i.push(p)}else if(e){const h=u==="initial"?n:`${u}:${n}`;i.push(h)}}}return i.join(" ")}if(e)return n}}function k5(e,t,n){const r=e?"-":"",a=n(t),i=a==null?void 0:a.startsWith("-"),l=i?"-":"",u=i?a==null?void 0:a.substring(1):a;return`${l}${e}${r}${u}`}function oK({customProperties:e,value:t,propValues:n,parseValue:r=a=>a}){let a={};if(!(!t||typeof t=="string"&&n.includes(t))){if(typeof t=="string"&&(a=Object.fromEntries(e.map(i=>[i,t]))),V0(t)){const i=t;for(const l in i){if(!lN(i,l)||!xw.has(l))continue;const u=i[l];if(!n.includes(u))for(const f of e)a={[l==="initial"?f:`${f}-${l}`]:u,...a}}}for(const i in a){const l=a[i];l!==void 0&&(a[i]=r(l))}return a}}function kp(...e){let t={};for(const n of e)n&&(t={...t,...n});return Object.keys(t).length?t:void 0}function iK(...e){return Object.assign({},...e)}function Ar(e,...t){let n,r;const a={...e},i=iK(...t);for(const l in i){let u=a[l];const f=i[l];if(f.default!==void 0&&u===void 0&&(u=f.default),f.type==="enum"&&![f.default,...f.values].includes(u)&&!V0(u)&&(u=f.default),a[l]=u,"className"in f&&f.className){delete a[l];const h="responsive"in f;if(!u||V0(u)&&!h)continue;if(V0(u)&&(f.default!==void 0&&u.initial===void 0&&(u.initial=f.default),f.type==="enum"&&([f.default,...f.values].includes(u.initial)||(u.initial=f.default))),f.type==="enum"){const p=xp({allowArbitraryValues:!1,value:u,className:f.className,propValues:f.values,parseValue:f.parseValue});n=Gt(n,p);continue}if(f.type==="string"||f.type==="enum | string"){const p=f.type==="string"?[]:f.values,[g,m]=el({className:f.className,customProperties:f.customProperties,propValues:p,parseValue:f.parseValue,value:u});r=kp(r,m),n=Gt(n,g);continue}if(f.type==="boolean"&&u){n=Gt(n,f.className);continue}}}return a.className=Gt(n,e.className),a.style=kp(r,e.style),a}const ac=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Fo={m:{type:"enum | string",values:ac,responsive:!0,className:"rt-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:ac,responsive:!0,className:"rt-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:ac,responsive:!0,className:"rt-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:ac,responsive:!0,className:"rt-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:ac,responsive:!0,className:"rt-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:ac,responsive:!0,className:"rt-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:ac,responsive:!0,className:"rt-r-ml",customProperties:["--ml"]}},kw=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="h1",color:l,...u}=Ar(e,sK,Fo);return s.createElement(Bc,{"data-accent-color":l,...u,ref:t,className:Gt("rt-Heading",r)},a?n:s.createElement(i,null,n))});kw.displayName="Heading";const lK=["span","div","label","p"],cK=["1","2","3","4","5","6","7","8","9"],uK={as:{type:"enum",values:lK,default:"span"},...io,size:{type:"enum",className:"rt-r-size",values:cK,responsive:!0},...iN,...sN,...rN,...oN,...aN,...Il,...Yc},Lc=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="span",color:l,...u}=Ar(e,uK,Fo);return s.createElement(Bc,{"data-accent-color":l,...u,ref:t,className:Gt("rt-Text",r)},a?n:s.createElement(i,null,n))});Lc.displayName="Text";function dK(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand";case"gray":return"gray"}}const fK=["none","small","medium","large","full"],Fm={radius:{type:"enum",values:fK,default:void 0}},ta={hasBackground:{default:!0},appearance:{default:"inherit"},accentColor:{default:"indigo"},grayColor:{default:"auto"},panelBackground:{default:"translucent"},radius:{default:"medium"},scaling:{default:"100%"}},Mu=()=>{},Sp=s.createContext(void 0);function Sw(){const e=s.useContext(Sp);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const lo=s.forwardRef((e,t)=>s.useContext(Sp)===void 0?s.createElement(zW,{delayDuration:200},s.createElement(e_,{dir:"ltr"},s.createElement(cN,{...e,ref:t}))):s.createElement(Ew,{...e,ref:t}));lo.displayName="Theme";const cN=s.forwardRef((e,t)=>{const{appearance:n=ta.appearance.default,accentColor:r=ta.accentColor.default,grayColor:a=ta.grayColor.default,panelBackground:i=ta.panelBackground.default,radius:l=ta.radius.default,scaling:u=ta.scaling.default,hasBackground:f=ta.hasBackground.default,...h}=e,[p,g]=s.useState(n);s.useEffect(()=>g(n),[n]);const[m,w]=s.useState(r);s.useEffect(()=>w(r),[r]);const[y,b]=s.useState(a);s.useEffect(()=>b(a),[a]);const[k,S]=s.useState(i);s.useEffect(()=>S(i),[i]);const[E,C]=s.useState(l);s.useEffect(()=>C(l),[l]);const[A,L]=s.useState(u);return s.useEffect(()=>L(u),[u]),s.createElement(Ew,{...h,ref:t,isRoot:!0,hasBackground:f,appearance:p,accentColor:m,grayColor:y,panelBackground:k,radius:E,scaling:A,onAppearanceChange:g,onAccentColorChange:w,onGrayColorChange:b,onPanelBackgroundChange:S,onRadiusChange:C,onScalingChange:L})});cN.displayName="ThemeRoot";const Ew=s.forwardRef((e,t)=>{const n=s.useContext(Sp),{asChild:r,isRoot:a,hasBackground:i,appearance:l=(n==null?void 0:n.appearance)??ta.appearance.default,accentColor:u=(n==null?void 0:n.accentColor)??ta.accentColor.default,grayColor:f=(n==null?void 0:n.resolvedGrayColor)??ta.grayColor.default,panelBackground:h=(n==null?void 0:n.panelBackground)??ta.panelBackground.default,radius:p=(n==null?void 0:n.radius)??ta.radius.default,scaling:g=(n==null?void 0:n.scaling)??ta.scaling.default,onAppearanceChange:m=Mu,onAccentColorChange:w=Mu,onGrayColorChange:y=Mu,onPanelBackgroundChange:b=Mu,onRadiusChange:k=Mu,onScalingChange:S=Mu,...E}=e,C=r?Bc:"div",A=f==="auto"?dK(u):f,L=e.appearance==="light"||e.appearance==="dark",T=i===void 0?a||L:i;return s.createElement(Sp.Provider,{value:s.useMemo(()=>({appearance:l,accentColor:u,grayColor:f,resolvedGrayColor:A,panelBackground:h,radius:p,scaling:g,onAppearanceChange:m,onAccentColorChange:w,onGrayColorChange:y,onPanelBackgroundChange:b,onRadiusChange:k,onScalingChange:S}),[l,u,f,A,h,p,g,m,w,y,b,k,S])},s.createElement(C,{"data-is-root-theme":a?"true":"false","data-accent-color":u,"data-gray-color":A,"data-has-background":T?"true":"false","data-panel-background":h,"data-radius":p,"data-scaling":g,ref:t,...E,className:Gt("radix-themes",{light:l==="light",dark:l==="dark"},E.className)}))});Ew.displayName="ThemeImpl";const Pi=e=>{if(!s.isValidElement(e))throw Error(`Expected a single React Element child, but got: ${s.Children.toArray(e).map(t=>typeof t=="object"&&"type"in t&&typeof t.type=="string"?t.type:typeof t).join(", ")}`);return e},Bf=e=>s.createElement(EV,{...e});Bf.displayName="AlertDialog.Root";const uN=s.forwardRef(({children:e,...t},n)=>s.createElement(CV,{...t,ref:n,asChild:!0},Pi(e)));uN.displayName="AlertDialog.Trigger";const Uf=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=tN,{className:i}=Ar({align:e},{align:r}),{className:l,forceMount:u,container:f,...h}=Ar(t,a);return s.createElement(jV,{container:f,forceMount:u},s.createElement(lo,{asChild:!0},s.createElement(AV,{className:"rt-BaseDialogOverlay rt-AlertDialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-AlertDialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${i}`},s.createElement(NV,{...h,ref:n,className:Gt("rt-BaseDialogContent","rt-AlertDialogContent",l)}))))))});Uf.displayName="AlertDialog.Content";const Wf=s.forwardRef((e,t)=>s.createElement(PV,{asChild:!0},s.createElement(kw,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));Wf.displayName="AlertDialog.Title";const Kf=s.forwardRef((e,t)=>s.createElement(LV,{asChild:!0},s.createElement(Lc,{as:"p",size:"3",...e,asChild:!1,ref:t})));Kf.displayName="AlertDialog.Description";const Gf=s.forwardRef(({children:e,...t},n)=>s.createElement(MV,{...t,ref:n,asChild:!0},Pi(e)));Gf.displayName="AlertDialog.Action";const Yf=s.forwardRef(({children:e,...t},n)=>s.createElement(RV,{...t,ref:n,asChild:!0},Pi(e)));Yf.displayName="AlertDialog.Cancel";function hK(e,t){const{asChild:n,children:r}=e;if(!n)return typeof t=="function"?t(r):t;const a=s.Children.only(r);return s.cloneElement(a,{children:typeof t=="function"?t(a.props.children):t})}const pK=["1","2","3"],mK=["solid","soft","surface","outline"],gK={...io,size:{type:"enum",className:"rt-r-size",values:pK,default:"1",responsive:!0},variant:{type:"enum",className:"rt-variant",values:mK,default:"soft"},...bw,...Yc,...Fm},dN=s.forwardRef((e,t)=>{const{asChild:n,className:r,color:a,radius:i,...l}=Ar(e,gK,Fo),u=n?Bc:"span";return s.createElement(u,{"data-accent-color":a,"data-radius":i,...l,ref:t,className:Gt("rt-reset","rt-Badge",r)})});dN.displayName="Badge";const fN=Bc,vK=["div","span"],wK=["none","inline","inline-block","block","contents"],yK={as:{type:"enum",values:vK,default:"div"},...io,display:{type:"enum",className:"rt-r-display",values:wK,responsive:!0}},oc=["0","1","2","3","4","5","6","7","8","9"],bK={p:{type:"enum | string",className:"rt-r-p",customProperties:["--p"],values:oc,responsive:!0},px:{type:"enum | string",className:"rt-r-px",customProperties:["--pl","--pr"],values:oc,responsive:!0},py:{type:"enum | string",className:"rt-r-py",customProperties:["--pt","--pb"],values:oc,responsive:!0},pt:{type:"enum | string",className:"rt-r-pt",customProperties:["--pt"],values:oc,responsive:!0},pr:{type:"enum | string",className:"rt-r-pr",customProperties:["--pr"],values:oc,responsive:!0},pb:{type:"enum | string",className:"rt-r-pb",customProperties:["--pb"],values:oc,responsive:!0},pl:{type:"enum | string",className:"rt-r-pl",customProperties:["--pl"],values:oc,responsive:!0}},b8=["visible","hidden","clip","scroll","auto"],xK=["static","relative","absolute","fixed","sticky"],v0=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],kK=["0","1"],SK=["0","1"],EK=["start","center","end","baseline","stretch"],CK=["start","center","end","baseline","stretch"],hN={...bK,...Mo,...yw,position:{type:"enum",className:"rt-r-position",values:xK,responsive:!0},inset:{type:"enum | string",className:"rt-r-inset",customProperties:["--inset"],values:v0,responsive:!0},top:{type:"enum | string",className:"rt-r-top",customProperties:["--top"],values:v0,responsive:!0},right:{type:"enum | string",className:"rt-r-right",customProperties:["--right"],values:v0,responsive:!0},bottom:{type:"enum | string",className:"rt-r-bottom",customProperties:["--bottom"],values:v0,responsive:!0},left:{type:"enum | string",className:"rt-r-left",customProperties:["--left"],values:v0,responsive:!0},overflow:{type:"enum",className:"rt-r-overflow",values:b8,responsive:!0},overflowX:{type:"enum",className:"rt-r-ox",values:b8,responsive:!0},overflowY:{type:"enum",className:"rt-r-oy",values:b8,responsive:!0},flexBasis:{type:"string",className:"rt-r-fb",customProperties:["--flex-basis"],responsive:!0},flexShrink:{type:"enum | string",className:"rt-r-fs",customProperties:["--flex-shrink"],values:kK,responsive:!0},flexGrow:{type:"enum | string",className:"rt-r-fg",customProperties:["--flex-grow"],values:SK,responsive:!0},gridArea:{type:"string",className:"rt-r-ga",customProperties:["--grid-area"],responsive:!0},gridColumn:{type:"string",className:"rt-r-gc",customProperties:["--grid-column"],responsive:!0},gridColumnStart:{type:"string",className:"rt-r-gcs",customProperties:["--grid-column-start"],responsive:!0},gridColumnEnd:{type:"string",className:"rt-r-gce",customProperties:["--grid-column-end"],responsive:!0},gridRow:{type:"string",className:"rt-r-gr",customProperties:["--grid-row"],responsive:!0},gridRowStart:{type:"string",className:"rt-r-grs",customProperties:["--grid-row-start"],responsive:!0},gridRowEnd:{type:"string",className:"rt-r-gre",customProperties:["--grid-row-end"],responsive:!0},alignSelf:{type:"enum",className:"rt-r-as",values:EK,responsive:!0},justifySelf:{type:"enum",className:"rt-r-js",values:CK,responsive:!0}},Z0=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=Ar(e,yK,hN,Fo);return s.createElement(r?fN:a,{...i,ref:t,className:Gt("rt-Box",n)})});Z0.displayName="Box";const jK=["1","2","3","4"],AK=["classic","solid","soft","surface","outline","ghost"],S5={...io,size:{type:"enum",className:"rt-r-size",values:jK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:AK,default:"solid"},...bw,...Yc,...Fm,loading:{type:"boolean",className:"rt-loading",default:!1}},x8=["0","1","2","3","4","5","6","7","8","9"],NK={gap:{type:"enum | string",className:"rt-r-gap",customProperties:["--gap"],values:x8,responsive:!0},gapX:{type:"enum | string",className:"rt-r-cg",customProperties:["--column-gap"],values:x8,responsive:!0},gapY:{type:"enum | string",className:"rt-r-rg",customProperties:["--row-gap"],values:x8,responsive:!0}},MK=["div","span"],RK=["none","inline-flex","flex"],PK=["row","column","row-reverse","column-reverse"],LK=["start","center","end","baseline","stretch"],$K=["start","center","end","between"],TK=["nowrap","wrap","wrap-reverse"],DK={as:{type:"enum",values:MK,default:"div"},...io,display:{type:"enum",className:"rt-r-display",values:RK,responsive:!0},direction:{type:"enum",className:"rt-r-fd",values:PK,responsive:!0},align:{type:"enum",className:"rt-r-ai",values:LK,responsive:!0},justify:{type:"enum",className:"rt-r-jc",values:$K,parseValue:HK,responsive:!0},wrap:{type:"enum",className:"rt-r-fw",values:TK,responsive:!0},...NK};function HK(e){return e==="between"?"space-between":e}const Vs=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=Ar(e,DK,hN,Fo);return s.createElement(r?fN:a,{...i,ref:t,className:Gt("rt-Flex",n)})});Vs.displayName="Flex";const OK=["1","2","3"],IK={size:{type:"enum",className:"rt-r-size",values:OK,default:"2",responsive:!0},loading:{type:"boolean",default:!0}},Pr=s.forwardRef((e,t)=>{const{className:n,children:r,loading:a,...i}=Ar(e,IK,Fo);if(!a)return r;const l=s.createElement("span",{...i,ref:t,className:Gt("rt-Spinner",n)},s.createElement("span",{className:"rt-SpinnerLeaf"}),s.createElement("span",{className:"rt-SpinnerLeaf"}),s.createElement("span",{className:"rt-SpinnerLeaf"}),s.createElement("span",{className:"rt-SpinnerLeaf"}),s.createElement("span",{className:"rt-SpinnerLeaf"}),s.createElement("span",{className:"rt-SpinnerLeaf"}),s.createElement("span",{className:"rt-SpinnerLeaf"}),s.createElement("span",{className:"rt-SpinnerLeaf"}));return r===void 0?l:s.createElement(Vs,{asChild:!0,position:"relative",align:"center",justify:"center"},s.createElement("span",null,s.createElement("span",{"aria-hidden":!0,style:{display:"contents",visibility:"hidden"},inert:void 0},r),s.createElement(Vs,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,l))))});Pr.displayName="Spinner";const FK=MC;function pN(e,t){if(e!==void 0)return typeof e=="string"?t(e):Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r)]))}function _K(e){return e==="3"?"3":"2"}function VK(e){switch(e){case"1":return"1";case"2":case"3":return"2";case"4":return"3"}}const mN=s.forwardRef((e,t)=>{const{size:n=S5.size.default}=e,{className:r,children:a,asChild:i,color:l,radius:u,disabled:f=e.loading,...h}=Ar(e,S5,Fo),p=i?Bc:"button";return s.createElement(p,{"data-disabled":f||void 0,"data-accent-color":l,"data-radius":u,...h,ref:t,className:Gt("rt-reset","rt-BaseButton",r),disabled:f},e.loading?s.createElement(s.Fragment,null,s.createElement("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0},a),s.createElement(FK,null,a),s.createElement(Vs,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,s.createElement(Pr,{size:pN(n,VK)})))):a)});mN.displayName="BaseButton";const Sa=s.forwardRef(({className:e,...t},n)=>s.createElement(mN,{...t,ref:n,className:Gt("rt-Button",e)}));Sa.displayName="Button";const ZK=["1","2","3"],zK=["soft","surface","outline"],E5={...io,size:{type:"enum",className:"rt-r-size",values:ZK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:zK,default:"soft"},...bw,...Yc},gN=s.createContext({}),a4=s.forwardRef((e,t)=>{const{size:n=E5.size.default}=e,{asChild:r,children:a,className:i,color:l,...u}=Ar(e,E5,Fo),f=r?Bc:"div";return s.createElement(f,{"data-accent-color":l,...u,className:Gt("rt-CalloutRoot",i),ref:t},s.createElement(gN.Provider,{value:s.useMemo(()=>({size:n}),[n])},a))});a4.displayName="Callout.Root";const BK=s.forwardRef(({className:e,...t},n)=>s.createElement("div",{...t,className:Gt("rt-CalloutIcon",e),ref:n}));BK.displayName="Callout.Icon";const o4=s.forwardRef(({className:e,...t},n)=>{const{size:r}=s.useContext(gN);return s.createElement(Lc,{as:"p",size:pN(r,_K),...t,asChild:!1,ref:n,className:Gt("rt-CalloutText",e)})});o4.displayName="Callout.Text";const UK=zn.forwardRef((e,t)=>zn.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},zn.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"})));UK.displayName="ThickDividerHorizontalIcon";const Ld=zn.forwardRef((e,t)=>zn.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},zn.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));Ld.displayName="ThickCheckIcon";const vN=zn.forwardRef((e,t)=>zn.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},zn.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));vN.displayName="ChevronDownIcon";const Cw=zn.forwardRef((e,t)=>zn.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},zn.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));Cw.displayName="ThickChevronRightIcon";const WK=["1","2","3"],w0={...io,size:{values:WK,default:"1"},...Fm,scrollbars:{default:"both"}};function KK(e){const{m:t,mx:n,my:r,mt:a,mr:i,mb:l,ml:u,...f}=e;return{m:t,mx:n,my:r,mt:a,mr:i,mb:l,ml:u,rest:f}}const ic=Fo.m.values;function GK(e){const[t,n]=el({className:"rt-r-m",customProperties:["--margin"],propValues:ic,value:e.m}),[r,a]=el({className:"rt-r-mx",customProperties:["--margin-left","--margin-right"],propValues:ic,value:e.mx}),[i,l]=el({className:"rt-r-my",customProperties:["--margin-top","--margin-bottom"],propValues:ic,value:e.my}),[u,f]=el({className:"rt-r-mt",customProperties:["--margin-top"],propValues:ic,value:e.mt}),[h,p]=el({className:"rt-r-mr",customProperties:["--margin-right"],propValues:ic,value:e.mr}),[g,m]=el({className:"rt-r-mb",customProperties:["--margin-bottom"],propValues:ic,value:e.mb}),[w,y]=el({className:"rt-r-ml",customProperties:["--margin-left"],propValues:ic,value:e.ml});return[Gt(t,r,i,u,h,g,w),kp(n,a,l,f,p,m,y)]}const qf=s.forwardRef((e,t)=>{const{rest:n,...r}=KK(e),[a,i]=GK(r),{asChild:l,children:u,className:f,style:h,type:p,scrollHideDelay:g=p!=="scroll"?0:void 0,dir:m,size:w=w0.size.default,radius:y=w0.radius.default,scrollbars:b=w0.scrollbars.default,...k}=n;return s.createElement(_A,{type:p,scrollHideDelay:g,className:Gt("rt-ScrollAreaRoot",a,f),style:kp(i,h),asChild:l},hK({asChild:l,children:u},S=>s.createElement(s.Fragment,null,s.createElement(VA,{...k,ref:t,className:"rt-ScrollAreaViewport"},S),s.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),b!=="vertical"?s.createElement(e4,{"data-radius":y,orientation:"horizontal",className:Gt("rt-ScrollAreaScrollbar",xp({className:"rt-r-size",value:w,propValues:w0.size.values}))},s.createElement(t4,{className:"rt-ScrollAreaThumb"})):null,b!=="horizontal"?s.createElement(e4,{"data-radius":y,orientation:"vertical",className:Gt("rt-ScrollAreaScrollbar",xp({className:"rt-r-size",value:w,propValues:w0.size.values}))},s.createElement(t4,{className:"rt-ScrollAreaThumb"})):null,b==="both"?s.createElement(ZU,{className:"rt-ScrollAreaCorner"}):null)))});qf.displayName="ScrollArea";const YK=["1","2"],qK=["solid","soft"],jo={size:{type:"enum",className:"rt-r-size",values:YK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:qK,default:"solid"},...Il,...Yc},wN={...io,...Il},yN={...Il},bN={...Il},Xf=e=>s.createElement(uB,{...e});Xf.displayName="ContextMenu.Root";const Qf=s.forwardRef(({children:e,...t},n)=>s.createElement(dB,{...t,ref:n,asChild:!0},Pi(e)));Qf.displayName="ContextMenu.Trigger";const xN=s.createContext({}),Jf=s.forwardRef((e,t)=>{const n=Sw(),{size:r=jo.size.default,variant:a=jo.variant.default,highContrast:i=jo.highContrast.default}=e,{className:l,children:u,color:f,container:h,forceMount:p,...g}=Ar(e,jo),m=f||n.accentColor;return s.createElement(SA,{container:h,forceMount:p},s.createElement(lo,{asChild:!0},s.createElement(fB,{"data-accent-color":m,alignOffset:-Number(r)*4,collisionPadding:10,...g,asChild:!1,ref:t,className:Gt("rt-PopperContent","rt-BaseMenuContent","rt-ContextMenuContent",l)},s.createElement(qf,{type:"auto"},s.createElement("div",{className:Gt("rt-BaseMenuViewport","rt-ContextMenuViewport")},s.createElement(xN.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:m,highContrast:i}),[r,a,m,i])},u))))))});Jf.displayName="ContextMenu.Content";const XK=s.forwardRef(({className:e,...t},n)=>s.createElement(pB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuLabel","rt-ContextMenuLabel",e)}));XK.displayName="ContextMenu.Label";const e1=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=wN.color.default,shortcut:i,...l}=e;return s.createElement(mB,{"data-accent-color":a,...l,ref:t,className:Gt("rt-reset","rt-BaseMenuItem","rt-ContextMenuItem",n)},s.createElement(wm,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},i))});e1.displayName="ContextMenu.Item";const QK=s.forwardRef(({className:e,...t},n)=>s.createElement(hB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuGroup","rt-ContextMenuGroup",e)}));QK.displayName="ContextMenu.Group";const JK=s.forwardRef(({className:e,...t},n)=>s.createElement(vB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuRadioGroup","rt-ContextMenuRadioGroup",e)}));JK.displayName="ContextMenu.RadioGroup";const eG=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=bN.color.default,...i}=e;return s.createElement(wB,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Gt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-ContextMenuItem","rt-ContextMenuRadioItem",r)},s.createElement(wm,null,n),s.createElement(EA,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(Ld,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})))});eG.displayName="ContextMenu.RadioItem";const tG=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=yN.color.default,...l}=e;return s.createElement(gB,{...l,asChild:!1,ref:t,"data-accent-color":i,className:Gt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-ContextMenuItem","rt-ContextMenuCheckboxItem",r)},s.createElement(wm,null,n),s.createElement(EA,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(Ld,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},a))});tG.displayName="ContextMenu.CheckboxItem";const nG=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(bB,{...a,asChild:!1,ref:t,className:Gt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-ContextMenuItem","rt-ContextMenuSubTrigger",n)},r,s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},s.createElement(Cw,{className:"rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon"})))});nG.displayName="ContextMenu.SubTrigger";const rG=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(xN),{className:l,children:u,container:f,forceMount:h,...p}=Ar({size:n,variant:r,color:a,highContrast:i,...e},jo);return s.createElement(SA,{container:f,forceMount:h},s.createElement(lo,{asChild:!0},s.createElement(xB,{"data-accent-color":a,alignOffset:-Number(n)*4,sideOffset:1,collisionPadding:10,...p,asChild:!1,ref:t,className:Gt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-ContextMenuContent","rt-ContextMenuSubContent",l)},s.createElement(qf,{type:"auto"},s.createElement("div",{className:Gt("rt-BaseMenuViewport","rt-ContextMenuViewport")},u)))))});rG.displayName="ContextMenu.SubContent";const _m=s.forwardRef(({className:e,...t},n)=>s.createElement(yB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuSeparator","rt-ContextMenuSeparator",e)}));_m.displayName="ContextMenu.Separator";const jw=e=>s.createElement(Ml,{...e,modal:!0});jw.displayName="Dialog.Root";const sG=s.forwardRef(({children:e,...t},n)=>s.createElement(Bv,{...t,ref:n,asChild:!0},Pi(e)));sG.displayName="Dialog.Trigger";const Aw=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=tN,{className:i}=Ar({align:e},{align:r}),{className:l,forceMount:u,container:f,...h}=Ar(t,a);return s.createElement(Rl,{container:f,forceMount:u},s.createElement(lo,{asChild:!0},s.createElement(Pl,{className:"rt-BaseDialogOverlay rt-DialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-DialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${i}`},s.createElement(Ll,{...h,ref:n,className:Gt("rt-BaseDialogContent","rt-DialogContent",l)}))))))});Aw.displayName="Dialog.Content";const Nw=s.forwardRef((e,t)=>s.createElement($l,{asChild:!0},s.createElement(kw,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));Nw.displayName="Dialog.Title";const aG=s.forwardRef((e,t)=>s.createElement(Uv,{asChild:!0},s.createElement(Lc,{as:"p",size:"3",...e,asChild:!1,ref:t})));aG.displayName="Dialog.Description";const oG=s.forwardRef(({children:e,...t},n)=>s.createElement(Of,{...t,ref:n,asChild:!0},Pi(e)));oG.displayName="Dialog.Close";const Cs=e=>s.createElement(VB,{...e});Cs.displayName="DropdownMenu.Root";const js=s.forwardRef(({children:e,...t},n)=>s.createElement(ZB,{...t,ref:n,asChild:!0},Pi(e)));js.displayName="DropdownMenu.Trigger";const kN=s.createContext({}),As=s.forwardRef((e,t)=>{const n=Sw(),{size:r=jo.size.default,variant:a=jo.variant.default,highContrast:i=jo.highContrast.default}=e,{className:l,children:u,color:f,container:h,forceMount:p,...g}=Ar(e,jo),m=f||n.accentColor;return s.createElement(jA,{container:h,forceMount:p},s.createElement(lo,{asChild:!0},s.createElement(zB,{"data-accent-color":m,align:"start",sideOffset:4,collisionPadding:10,...g,asChild:!1,ref:t,className:Gt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",l)},s.createElement(qf,{type:"auto"},s.createElement("div",{className:Gt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},s.createElement(kN.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:m,highContrast:i}),[r,a,m,i])},u))))))});As.displayName="DropdownMenu.Content";const i4=s.forwardRef(({className:e,...t},n)=>s.createElement(UB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e)}));i4.displayName="DropdownMenu.Label";const qn=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=wN.color.default,shortcut:i,...l}=e;return s.createElement(WB,{"data-accent-color":a,...l,ref:t,className:Gt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",n)},s.createElement(wm,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});qn.displayName="DropdownMenu.Item";const iG=s.forwardRef(({className:e,...t},n)=>s.createElement(BB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e)}));iG.displayName="DropdownMenu.Group";const Ep=s.forwardRef(({className:e,...t},n)=>s.createElement(GB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e)}));Ep.displayName="DropdownMenu.RadioGroup";const Wu=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=bN.color.default,...i}=e;return s.createElement(YB,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Gt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",r)},n,s.createElement(AA,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(Ld,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Wu.displayName="DropdownMenu.RadioItem";const lG=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=yN.color.default,...l}=e;return s.createElement(KB,{...l,asChild:!1,ref:t,"data-accent-color":i,className:Gt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",r)},n,s.createElement(AA,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(Ld,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},a))});lG.displayName="DropdownMenu.CheckboxItem";const cG=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(XB,{...a,asChild:!1,ref:t,className:Gt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",n)},r,s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s.createElement(Cw,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});cG.displayName="DropdownMenu.SubTrigger";const uG=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(kN),{className:l,children:u,container:f,forceMount:h,...p}=Ar({size:n,variant:r,color:a,highContrast:i,...e},jo);return s.createElement(jA,{container:f,forceMount:h},s.createElement(lo,{asChild:!0},s.createElement(QB,{"data-accent-color":a,alignOffset:-Number(n)*4,sideOffset:1,collisionPadding:10,...p,asChild:!1,ref:t,className:Gt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",l)},s.createElement(qf,{type:"auto"},s.createElement("div",{className:Gt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},u)))))});uG.displayName="DropdownMenu.SubContent";const kc=s.forwardRef(({className:e,...t},n)=>s.createElement(qB,{...t,asChild:!1,ref:n,className:Gt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e)}));kc.displayName="DropdownMenu.Separator";const dG=["1","2","3","4"],fG={...io,size:{type:"enum",className:"rt-r-size",values:dG,default:"2",responsive:!0},width:Mo.width,minWidth:Mo.minWidth,maxWidth:{...Mo.maxWidth,default:"480px"},...yw},gd=e=>s.createElement(yU,{...e});gd.displayName="Popover.Root";const vd=s.forwardRef(({children:e,...t},n)=>s.createElement(xU,{...t,ref:n,asChild:!0},Pi(e)));vd.displayName="Popover.Trigger";const wd=s.forwardRef((e,t)=>{const{className:n,forceMount:r,container:a,...i}=Ar(e,fG);return s.createElement(kU,{container:a,forceMount:r},s.createElement(lo,{asChild:!0},s.createElement(SU,{align:"start",sideOffset:8,collisionPadding:10,...i,ref:t,className:Gt("rt-PopperContent","rt-PopoverContent",n)})))});wd.displayName="Popover.Content";const hG=s.forwardRef(({children:e,...t},n)=>s.createElement(EU,{...t,ref:n,asChild:!0},Pi(e)));hG.displayName="Popover.Close";const pG=s.forwardRef(({children:e,...t},n)=>s.createElement(bU,{...t,ref:n}));pG.displayName="Popover.Anchor";const mG=["1","2","3"],Mw={size:{type:"enum",className:"rt-r-size",values:mG,default:"2",responsive:!0}},gG=["classic","surface","soft","ghost"],vG={variant:{type:"enum",className:"rt-variant",values:gG,default:"surface"},...Il,...Fm,placeholder:{type:"string"}},wG=["solid","soft"],yG={variant:{type:"enum",className:"rt-variant",values:wG,default:"solid"},...Il,...Yc},Rw=s.createContext({}),SN=e=>{const{children:t,size:n=Mw.size.default,...r}=e;return s.createElement(qU,{...r},s.createElement(Rw.Provider,{value:s.useMemo(()=>({size:n}),[n])},t))};SN.displayName="Select.Root";const EN=s.forwardRef((e,t)=>{const n=s.useContext(Rw),{children:r,className:a,color:i,radius:l,placeholder:u,...f}=Ar({size:n==null?void 0:n.size,...e},{size:Mw.size},vG,Fo);return s.createElement(QU,{asChild:!0},s.createElement("button",{"data-accent-color":i,"data-radius":l,...f,ref:t,className:Gt("rt-reset","rt-SelectTrigger",a)},s.createElement("span",{className:"rt-SelectTriggerInner"},s.createElement(eW,{placeholder:u},r)),s.createElement(tW,{asChild:!0},s.createElement(vN,{className:"rt-SelectIcon"}))))});EN.displayName="Select.Trigger";const CN=s.forwardRef((e,t)=>{const n=s.useContext(Rw),{className:r,children:a,color:i,container:l,...u}=Ar({size:n==null?void 0:n.size,...e},{size:Mw.size},yG),f=Sw(),h=i||f.accentColor;return s.createElement(aW,{container:l},s.createElement(lo,{asChild:!0},s.createElement(oW,{"data-accent-color":h,sideOffset:4,...u,asChild:!1,ref:t,className:Gt({"rt-PopperContent":u.position==="popper"},"rt-SelectContent",r)},s.createElement(_A,{type:"auto",className:"rt-ScrollAreaRoot"},s.createElement(hW,{asChild:!0,className:"rt-SelectViewport"},s.createElement(VA,{className:"rt-ScrollAreaViewport",style:{overflowY:void 0}},a)),s.createElement(e4,{className:"rt-ScrollAreaScrollbar rt-r-size-1",orientation:"vertical"},s.createElement(t4,{className:"rt-ScrollAreaThumb"}))))))});CN.displayName="Select.Content";const jN=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(xW,{...a,asChild:!1,ref:t,className:Gt("rt-SelectItem",n)},s.createElement(EW,{className:"rt-SelectItemIndicator"},s.createElement(Ld,{className:"rt-SelectItemIndicatorIcon"})),s.createElement(kW,null,r))});jN.displayName="Select.Item";const bG=s.forwardRef(({className:e,...t},n)=>s.createElement(vW,{...t,asChild:!1,ref:n,className:Gt("rt-SelectGroup",e)}));bG.displayName="Select.Group";const xG=s.forwardRef(({className:e,...t},n)=>s.createElement(yW,{...t,asChild:!1,ref:n,className:Gt("rt-SelectLabel",e)}));xG.displayName="Select.Label";const kG=s.forwardRef(({className:e,...t},n)=>s.createElement(CW,{...t,asChild:!1,ref:n,className:Gt("rt-SelectSeparator",e)}));kG.displayName="Select.Separator";const SG={content:{type:"ReactNode",required:!0},width:Mo.width,minWidth:Mo.minWidth,maxWidth:{...Mo.maxWidth,default:"360px"}},Pw=s.forwardRef((e,t)=>{const{children:n,className:r,open:a,defaultOpen:i,onOpenChange:l,delayDuration:u,disableHoverableContent:f,content:h,container:p,forceMount:g,...m}=Ar(e,SG),w={open:a,defaultOpen:i,onOpenChange:l,delayDuration:u,disableHoverableContent:f};return s.createElement(BW,{...w},s.createElement(UW,{asChild:!0},n),s.createElement(WW,{container:p,forceMount:g},s.createElement(lo,{asChild:!0},s.createElement(KW,{sideOffset:4,collisionPadding:10,...m,asChild:!1,ref:t,className:Gt("rt-TooltipContent",r)},s.createElement(Lc,{as:"p",className:"rt-TooltipText",size:"1"},h),s.createElement(GW,{className:"rt-TooltipArrow"})))))});Pw.displayName="Tooltip";const qr={lastBrand:"scenri:last-brand",engine:"scenri:engine",quality:"scenri:quality",count:"scenri:count",format:"scenri:format",assetsOpen:"scenri:assets-open",ovlPanelW:"scenri:ovl-panel-w",pstudioRailW:"scenri:pstudio-rail-w",assetsExpanded:"scenri:assets-expanded",tileSize:"scenri:tile-size",wallDensity:"scenri:wall-density",feedSort:"scenri:feed-sort",feedCounts:"scenri:feed-counts"};function AN(e,t){try{const n=localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}}const l4="scenri:pref-changed";function NN(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}try{window.dispatchEvent(new CustomEvent(l4,{detail:{key:e,value:t}}))}catch{}}function c4(e,t){try{const n=localStorage.getItem(e);return n===null?null:(localStorage.setItem(t,n),localStorage.removeItem(e),n)}catch{return null}}function Ma(e,t){const[n,r]=s.useState(()=>AN(e,t)),a=s.useRef(n);return s.useEffect(()=>{Object.is(a.current,n)||(a.current=n,NN(e,n))},[e,n]),s.useEffect(()=>{const i=l=>{const u=l.detail;(u==null?void 0:u.key)===e&&r(f=>Object.is(f,u.value)?f:u.value)};return window.addEventListener(l4,i),()=>window.removeEventListener(l4,i)},[e]),[n,r]}function EG(e,t){const[n,r]=s.useState(()=>{try{const a=sessionStorage.getItem(e);return a===null?t:JSON.parse(a)}catch{return t}});return s.useEffect(()=>{try{sessionStorage.setItem(e,JSON.stringify(n))}catch{}},[e,n]),[n,r]}function k8(e,t){const[n,r]=Ma(e,t),[a,i]=s.useState(null);return[a??n,u=>{i(null),r(u)},i,a]}const CG=()=>AN(qr.lastBrand,null),jG=e=>NN(qr.lastBrand,e),u4="sc-theme",AG="bt-theme",NG=()=>window.matchMedia("(prefers-color-scheme: light)").matches,MN=s.createContext({choice:"system",mode:"dark",setChoice:()=>{},toggle:()=>{}}),MG=()=>s.useContext(MN);function RG(){const e=localStorage.getItem(u4)??c4(AG,u4);return e==="light"||e==="dark"||e==="system"?e:"system"}function PG({children:e}){const[t,n]=s.useState(RG),[r,a]=s.useState(()=>NG()?"light":"dark");s.useEffect(()=>{const u=window.matchMedia("(prefers-color-scheme: light)"),f=()=>a(u.matches?"light":"dark");return u.addEventListener("change",f),()=>u.removeEventListener("change",f)},[]);const i=t==="system"?r:t;s.useEffect(()=>{document.documentElement.dataset.theme=i,localStorage.setItem(u4,t)},[i,t]);const l=s.useMemo(()=>({choice:t,mode:i,setChoice:n,toggle:()=>n(i==="dark"?"light":"dark")}),[t,i]);return o.jsx(MN.Provider,{value:l,children:o.jsx(lo,{appearance:i,accentColor:"gray",grayColor:"gray",radius:"large",scaling:"100%",children:e})})}const RN=s.createContext({push:()=>{}}),rr=()=>s.useContext(RN),LG=3,$G=140,z0=e=>{var t;return!!(e.action||(t=e.actions)!=null&&t.length)},TG=e=>{var t;return((t=e.actions)!=null&&t.length?e.actions:e.action?[e.action]:[]).slice(0,2)};function S8(e){var a;if(e.kind==="error")return 1/0;const t=e.title.length+(((a=e.detail)==null?void 0:a.length)??0),n=z0(e)?9e3:4e3,r=z0(e)?14e3:8e3;return Math.min(n+Math.max(0,t-40)*45,r)}function DG(e,t,n){const r=n>1?` (${n} times)`:"";return`${e}${r}${t?` ${t}`:""}`}const HG=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function OG({kind:e}){if(e==="info")return null;const t=e==="success"?Kn:e==="warning"?vm:zc;return o.jsx(t,{className:"sc-toast-ic",size:16,weight:"regular","aria-hidden":"true"})}function IG({children:e}){const[t,n]=s.useState([]),r=s.useRef(1),a=s.useRef([]),i=s.useRef(new Map),l=s.useRef(null),u=s.useRef(null),f=s.useRef(null),h=s.useRef(new Map),p=s.useCallback(E=>{a.current=E,n(E)},[]),g=s.useCallback(E=>{const C=E.kind==="error"?u.current:l.current;if(!C)return;const A=DG(E.title,E.detail,E.count);C.textContent=A,window.setTimeout(()=>{C.textContent===A&&(C.textContent="")},1e3)},[]),m=s.useCallback(E=>{const C=i.current.get(E);(C==null?void 0:C.handle)!=null&&window.clearTimeout(C.handle),i.current.delete(E),p(a.current.map(A=>A.id===E&&!A.leaving?{...A,leaving:!0}:A)),window.setTimeout(()=>p(a.current.filter(A=>A.id!==E)),$G+40)},[p]),w=s.useCallback((E,C)=>{if(!Number.isFinite(C))return;const A=i.current.get(E)??{remaining:C,since:0,handle:null};A.handle!=null&&window.clearTimeout(A.handle),A.remaining=C,A.since=Date.now(),A.handle=window.setTimeout(()=>m(E),C),i.current.set(E,A)},[m]),y=s.useCallback(E=>{const C=i.current.get(E);!C||C.handle==null||(window.clearTimeout(C.handle),C.handle=null,C.remaining=Math.max(0,C.remaining-(Date.now()-C.since)))},[]),b=s.useCallback(E=>{const C=i.current.get(E);!C||C.handle!=null||w(E,C.remaining)},[w]);s.useEffect(()=>{const E=()=>{const C=[...i.current.keys()];document.hidden?C.forEach(y):C.forEach(b)};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},[y,b]),s.useLayoutEffect(()=>{const E=f.current;if(!E)return;const C=new Map,A=!HG();for(const L of E.querySelectorAll("[data-toast-id]")){const T=Number(L.dataset.toastId),M=L.getBoundingClientRect().top;C.set(T,M);const j=h.current.get(T);if(!A||j===void 0||L.hasAttribute("data-leaving"))continue;const P=j-M;P&&(L.style.transition="none",L.style.transform=`translateY(${P}px)`,L.getBoundingClientRect(),L.style.transition="transform 160ms cubic-bezier(.2, .7, .3, 1)",L.style.transform="")}h.current=C},[t]),s.useLayoutEffect(()=>{const E=f.current;if(!E)return;const C=()=>{const T=document.querySelector(".sc-canvas-dock");if(!T||!t.length){delete E.dataset.overDock;return}const M=E.getBoundingClientRect(),j=T.getBoundingClientRect();M.left<j.right&&j.left<M.right?(E.style.setProperty("--sc-toasts-over-dock",`${Math.round(window.innerHeight-j.top+10)}px`),E.dataset.overDock=""):delete E.dataset.overDock};C(),window.addEventListener("resize",C);const A=document.querySelector(".sc-canvas-dock"),L=typeof ResizeObserver>"u"||!A?null:new ResizeObserver(C);return L==null||L.observe(A),()=>{window.removeEventListener("resize",C),L==null||L.disconnect()}},[t]);const k=s.useCallback(E=>{const C=a.current.filter(j=>!j.leaving),A=z0(E)?void 0:C.find(j=>j.kind===E.kind&&j.title===E.title&&j.detail===E.detail&&!z0(j));if(A){const j={...A,count:A.count+1};p(a.current.map(R=>R.id===A.id?j:R));const P=i.current.get(A.id);P&&P.handle==null?P.remaining=S8(j):w(A.id,S8(j)),j.quiet||g(j);return}const L={...E,id:r.current++,count:1},T=[...a.current,L],M=j=>!j.leaving;for(;T.filter(M).length>LG;){let j=T.findIndex(H=>M(H)&&H.kind!=="error"&&!z0(H));j===-1&&(j=T.findIndex(H=>M(H)&&H.kind!=="error")),j===-1&&(j=T.findIndex(M));const P=T.splice(j,1)[0],R=i.current.get(P.id);(R==null?void 0:R.handle)!=null&&window.clearTimeout(R.handle),i.current.delete(P.id)}p(T),w(L.id,S8(L)),L.quiet||g(L)},[g,w,p]),S=s.useMemo(()=>({push:k}),[k]);return s.useEffect(()=>{if(typeof localStorage<"u"&&localStorage.getItem("scenri:toast-probe"))return window.__scenriToast=k,()=>{delete window.__scenriToast}},[k]),o.jsxs(RN.Provider,{value:S,children:[e,Br.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:l,className:"sc-vh",role:"status","aria-live":"polite"}),o.jsx("div",{ref:u,className:"sc-vh","aria-live":"assertive","aria-atomic":"true"}),o.jsx("section",{className:"sc-toasts","aria-label":"Alerts",ref:f,onPointerDown:C5,onMouseDown:C5,children:t.map(E=>{const C=TG(E);return o.jsx("div",{className:"sc-toast-wrap","data-toast-id":E.id,"data-leaving":E.leaving||void 0,children:o.jsxs("article",{className:"sc-toast","data-kind":E.kind,onPointerEnter:()=>y(E.id),onPointerLeave:()=>b(E.id),onFocus:()=>y(E.id),onBlur:A=>{A.currentTarget.contains(A.relatedTarget)||b(E.id)},children:[o.jsx(OG,{kind:E.kind}),o.jsxs("div",{className:"sc-toast-body",children:[o.jsxs("div",{className:"sc-toast-top",children:[o.jsxs("div",{className:"sc-toast-txt",children:[o.jsxs("b",{children:[E.title,E.count>1?o.jsxs("span",{className:"sc-toast-n",children:["×",E.count]}):null]}),E.detail?o.jsx("small",{children:E.detail.slice(0,160)}):null]}),o.jsx("button",{type:"button",className:"sc-toast-x",onClick:()=>m(E.id),"aria-label":"Dismiss",children:o.jsx(jn,{size:14,weight:"regular"})})]}),C.length?o.jsx("div",{className:"sc-toast-acts",children:C.map(A=>o.jsx("button",{type:"button",className:"sc-toast-act",onClick:()=>{A.onClick(),m(E.id)},children:A.label},A.label))}):null]})]})},E.id)})})]}),document.body)]})}function C5(e){e.stopPropagation(),e.type==="mousedown"&&e.target instanceof Element&&e.target.closest("button")&&e.preventDefault()}async function qe(e,t,n,r,a){const i=await fetch(t,{method:e,signal:r,keepalive:a==null?void 0:a.keepalive,headers:n!==void 0?{"content-type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!i.ok){let l=`HTTP ${i.status}`;try{const u=await i.json();l=u.error??l,u.details&&(l+=`: ${u.details.join("; ")}`)}catch{}throw Object.assign(new Error(l),{status:i.status,method:e,url:t})}return i.json()}const FG=(e,t,n)=>qe("DELETE",`/api/brands/${e}/${t}/${n}`),d4=(e,t)=>FG(e,"products",t);async function PN(e,t,n={}){const r=new FormData;n.role&&r.append("role",n.role),n.background&&r.append("background",n.background),r.append("file",t);const a=await fetch(`/api/brands/${e}/logos`,{method:"POST",body:r});if(!a.ok)throw new Error((await a.json().catch(()=>({}))).error??`HTTP ${a.status}`);return a.json()}const _G=e=>`/api/brands/${e}/export`;async function VG(e,t,n,r){const a=new FormData;a.append("file",n);const i=await fetch(`/api/brands/${e}/products/${t}/shots`,{method:"POST",body:a});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error??`HTTP ${i.status}`);return i.json()}async function df(e){const t=new FormData;t.append("file",e);const n=await fetch("/api/images",{method:"POST",body:t});if(!n.ok)throw new Error((await n.json().catch(()=>({}))).error??`HTTP ${n.status}`);return(await n.json()).hash}function Cp(e){if(!e||typeof e!="object")return e;const{products:t,scenes:n,characters:r,...a}=e;return a}function ZG(e,t,n){try{return fetch(`/api/brands/${e}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({brand:Cp(t),keepAssets:!0,base:Cp(n)}),keepalive:!0}).then(r=>r.ok?r.json():null).catch(()=>null)}catch{return Promise.resolve(null)}}const Tr=e=>`/api/images/${e}`,Jr=e=>e!=null&&e.startsWith("asset:")?Tr(e.slice(6)):null,LN={large:960,tile:640,small:320,micro:160},gn=(e,t)=>`${Tr(e)}/thumb?w=${LN[t]}`,Vm=(e,t)=>e!=null&&e.startsWith("asset:")?gn(e.slice(6),t):null,zG=/^\/api\/images\/([a-f0-9]{32})(?:\/thumb\?w=\d+)?$/,BG=/^(\/api\/(?:(?:presenter-avatars|presenter-thumbnails|scene-thumbnails|demo-product-thumbnails|showcase-previews)\/[a-z0-9-]+|scene-previews\/[a-z0-9-]+\/ref-[0-9]{2})\.jpg)(?:\?v=(\d+))?(?:[?&]w=\d+)?$/;function $n(e,t){if(!e)return e;const n=zG.exec(e);if(n)return t==="full"?Tr(n[1]):gn(n[1],t);const r=BG.exec(e);if(!r)return e;const a=r[2]?`${r[1]}?v=${r[2]}`:r[1];return t==="full"?a:`${a}${r[2]?"&":"?"}w=${LN[t]}`}function yc(e){const t=$n(e,"tile"),n=$n(e,"large");if(!(!t||!n||t===n))return`${t} 640w, ${n} 960w`}const $N={large:"(max-width: 720px) 50vw, 360px",compact:"(max-width: 720px) 50vw, 240px"};function j5(e){return e.every(t=>t.kind==="root")}let TN=new Map;function UG(e){const t=new Map;for(const n of e)for(const r of n.legacyNames??[])r!==n.name&&t.set(r,n.name);TN=t}function WG(e){var r;const t=e.promptHead??"",n=(r=/^\[([^\]]+)\]/.exec(t))==null?void 0:r[1];if(n)return TN.get(n)??n;if(t.startsWith("Remove all overlaid marketing text")||t.startsWith("Remove ALL text"))return"Text lift"}function Dr(e){const t=WG(e);return t||(e.promptHead??"").trim().split(/\s+/).slice(0,6).join(" ")||(e.kind==="edit"?"Edit":"Generation")}const DN=[{id:"newest",label:"Newest first"},{id:"oldest",label:"Oldest first"},{id:"cost",label:"Highest cost"},{id:"keepers",label:"Keepers first"}];function KG(e){return DN.some(t=>t.id===e)}const HN=[{id:"all",label:"All"},{id:"keepers",label:"Keepers"},{id:"archived",label:"Archived"}];function GG(e){return HN.some(t=>t.id===e)}function YG(e){var r;const t=new URLSearchParams;e.lens&&e.lens!=="all"&&t.set("lens",e.lens),e.set&&t.set("set",e.set),e.ungrouped&&t.set("ungrouped","1"),e.lineage&&t.set("lineage",e.lineage),e.token&&t.set("token",e.token),(r=e.q)!=null&&r.trim()&&t.set("q",e.q.trim()),e.sort&&e.sort!=="newest"&&t.set("sort",e.sort),e.limit&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return n?`?${n}`:""}function f4(e,t){const n=e.findIndex(r=>r.id===t);return n<0?{at:n,prev:null,next:null}:{at:n,prev:e[n-1]??null,next:e[n+1]??null}}const Ku=(e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id),Ee={brands:()=>qe("GET","/api/brands"),createBrand:e=>qe("POST","/api/brands",{brand:e}),brandFromUrl:e=>qe("POST","/api/brands/from-url",{url:e}),updateBrand:(e,t,n)=>qe("PUT",`/api/brands/${e}`,{brand:Cp(t),keepAssets:!0,base:Cp(n)}),deleteBrand:e=>qe("DELETE",`/api/brands/${e}`),guide:()=>qe("GET","/api/guide"),guideIntent:e=>qe("POST","/api/guide",e,void 0,{keepalive:!0}),refreshBrandFromUrl:(e,t)=>qe("POST",`/api/brands/${e}/refresh-from-url`,t?{url:t}:{}),updateLogo:(e,t,n)=>qe("PATCH",`/api/brands/${e}/logos/${t}`,n),deleteLogo:(e,t)=>qe("DELETE",`/api/brands/${e}/logos/${t}`),projects:e=>qe("GET",`/api/projects?brandId=${encodeURIComponent(e)}`),createProject:(e,t)=>qe("POST","/api/projects",{brandId:e,name:t}),tree:e=>qe("GET",`/api/projects/${e}/tree`),activity:e=>qe("GET",`/api/brands/${e}/activity`),workspace:e=>qe("GET",`/api/brands/${e}/workspace`),feed:(e,t,n)=>qe("GET",`/api/brands/${e}/feed${YG(t)}`,void 0,n),node:e=>qe("GET",`/api/nodes/${e}`),lineage:e=>qe("GET",`/api/nodes/${e}/lineage`),usage:e=>qe("GET",`/api/brands/${e}/usage`),sets:e=>qe("GET",`/api/brands/${e}/sets`),createSet:(e,t)=>qe("POST",`/api/brands/${e}/sets`,{name:t}),renameSet:(e,t)=>qe("PATCH",`/api/sets/${e}`,{name:t}),deleteSet:e=>qe("DELETE",`/api/sets/${e}`),addToSet:(e,t)=>qe("POST",`/api/sets/${e}/nodes`,{nodeIds:t}),removeFromSet:(e,t)=>qe("POST",`/api/sets/${e}/nodes/remove`,{nodeIds:t}),engines:()=>qe("GET","/api/engines"),codexStatus:(e={})=>qe("GET",`/api/engines/codex/status${e.force?"?force=1":""}`),repairCodexEnv:e=>qe("POST","/api/engines/codex/repair-env",{keys:e}),restoreCodexEnv:()=>qe("POST","/api/engines/codex/restore-env"),installCodex:()=>qe("POST","/api/engines/codex/install"),loginCodex:()=>qe("POST","/api/engines/codex/login"),setCap:(e,t)=>qe("PUT","/api/caps",{engineId:e,capUsd:t}),addNode:e=>qe("POST","/api/nodes",e),cancelNode:e=>qe("POST",`/api/nodes/${e}/cancel`),retryNode:e=>qe("POST",`/api/nodes/${e}/retry`),scenes:()=>qe("GET","/api/scenes"),presenters:()=>qe("GET","/api/presenters"),presenterFrames:e=>qe("GET",`/api/presenter-previews/${e}`),demoProducts:()=>qe("GET","/api/demo-products"),demoProductFrames:e=>qe("GET",`/api/demo-product-previews/${e}`),showcase:()=>qe("GET","/api/showcase"),previewBrief:(e,t,n,r)=>qe("POST","/api/brief/preview",{brief:e,engineId:t,brandId:n,...r?{parentId:r}:{}}),keep:(e,t)=>qe("POST",`/api/nodes/${e}/keep`,{kept:t}),archiveNode:(e,t)=>qe("POST",`/api/nodes/${e}/archive`,{archived:t}),deleteNode:e=>qe("DELETE",`/api/nodes/${e}`),deleteNodesBatch:e=>qe("POST","/api/nodes/delete-batch",{nodeIds:e}),settings:()=>qe("GET","/api/settings"),saveSettings:e=>qe("PUT","/api/settings",e),costs:()=>qe("GET","/api/costs/summary"),home:()=>qe("GET","/api/home"),reveal:()=>qe("POST","/api/system/reveal"),version:()=>qe("GET","/api/version"),updateStatus:()=>qe("GET","/api/update/status"),updateCheck:()=>qe("POST","/api/update/check"),updateApply:()=>qe("POST","/api/update/apply"),updateRestart:()=>qe("POST","/api/update/restart"),desktop:()=>qe("GET","/api/desktop"),phone:(e=!1)=>qe("GET",e?"/api/phone?fresh=1":"/api/phone"),phoneNewCode:()=>qe("POST","/api/phone/code"),phoneHelp:()=>qe("GET","/api/phone/help"),phoneAllow:()=>qe("POST","/api/phone/allow"),desktopInstall:()=>qe("POST","/api/desktop/install"),quit:()=>qe("POST","/api/system/quit"),releaseNotes:()=>qe("GET","/api/release/notes"),releaseSeen:e=>qe("POST","/api/release/seen",{version:e}),releaseUsed:e=>qe("POST","/api/release/used",{feature:e}),sceneFrames:e=>qe("GET",`/api/scene-previews/${e}`),pickSceneView:(e,t)=>qe("POST",`/api/scenes/${e}/views/${t}/pick`),deleteData:e=>qe("DELETE",`/api/data?scope=${e}`),libraryProduct:(e,t)=>qe("GET",`/api/brands/${e}/products-library/${encodeURIComponent(t)}`),productsLibrary:e=>qe("GET",`/api/brands/${e}/products-library`),catalogImport:(e,t,n)=>qe("POST",`/api/brands/${e}/catalog/import`,n?{url:t,urls:n}:{url:t}),catalogScan:(e,t)=>qe("POST",`/api/brands/${e}/catalog/scan`,t?{url:t}:{}),catalogDetails:(e,t)=>qe("POST",`/api/brands/${e}/catalog/details`,{urls:t}),catalogScanState:(e,t,n)=>qe("GET",`/api/brands/${e}/catalog/scans/${t}`,void 0,n),cancelCatalogScan:(e,t)=>qe("POST",`/api/brands/${e}/catalog/scans/${t}/cancel`),catalogJob:(e,t)=>qe("GET",`/api/brands/${e}/catalog/jobs/${t}`),catalogJobs:e=>qe("GET",`/api/brands/${e}/catalog/jobs`),cancelCatalogJob:(e,t)=>qe("POST",`/api/brands/${e}/catalog/jobs/${t}/cancel`),deleteCatalogProduct:(e,t)=>qe("DELETE",`/api/brands/${e}/catalog/products/${t}`),updateProduct:(e,t,n)=>qe("PATCH",`/api/brands/${e}/products/${t}`,n),updateCatalogProduct:(e,t,n)=>qe("PATCH",`/api/brands/${e}/catalog/products/${t}`,n),productSize:(e,t)=>qe("GET",`/api/brands/${e}/products/${t}/size`),setProductSize:(e,t,n)=>qe("PUT",`/api/brands/${e}/products/${t}/size`,{size:n}),setProductShots:(e,t,n)=>qe("PUT",`/api/brands/${e}/products/${t}/shots`,{files:n}),assetBuildCapabilities:()=>qe("GET","/api/asset-builds/capabilities"),startAssetBuild:(e,t)=>qe("POST",`/api/brands/${e}/asset-builds`,t),assetBuild:(e,t)=>qe("GET",`/api/brands/${e}/asset-builds/${t}`),assetBuilds:e=>qe("GET",`/api/brands/${e}/asset-builds`),cancelAssetBuild:(e,t)=>qe("POST",`/api/brands/${e}/asset-builds/${t}/cancel`),deleteAssetBuild:(e,t)=>qe("DELETE",`/api/brands/${e}/asset-builds/${t}`),createProduct:(e,t)=>qe("POST",`/api/brands/${e}/products`,t),createPresenterDraft:(e,t)=>qe("POST",`/api/brands/${e}/presenter-drafts`,t),presenterDrafts:e=>qe("GET",`/api/brands/${e}/presenter-drafts`),presenterDraft:(e,t)=>qe("GET",`/api/brands/${e}/presenter-drafts/${t}`),updatePresenterDraft:(e,t,n)=>qe("PATCH",`/api/brands/${e}/presenter-drafts/${t}`,n),generateDraftView:(e,t,n,r={})=>qe("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/generate`,r),approveDraftView:(e,t,n)=>qe("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/approve`),redoDraftView:(e,t,n)=>qe("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/redo`),revertDraftView:(e,t,n)=>qe("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/revert`),stopDraft:(e,t)=>qe("POST",`/api/brands/${e}/presenter-drafts/${t}/stop`),restoreDraftView:(e,t,n,r)=>qe("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/restore`,{hash:r}),savePresenterDraft:(e,t)=>qe("POST",`/api/brands/${e}/presenter-drafts/${t}/save`),deletePresenterDraft:(e,t)=>qe("DELETE",`/api/brands/${e}/presenter-drafts/${t}`),createPresenter:(e,t)=>qe("POST",`/api/brands/${e}/presenters`,t),updatePresenter:(e,t,n)=>qe("PATCH",`/api/brands/${e}/presenters/${t}`,n),deletePresenter:(e,t)=>qe("DELETE",`/api/brands/${e}/presenters/${t}`),duplicatePresenter:(e,t,n)=>qe("POST",`/api/brands/${e}/presenters/${t}/duplicate`,{name:n}),editPresenter:(e,t)=>qe("POST",`/api/brands/${e}/presenters/${t}/edit`),revertPresenter:(e,t)=>qe("POST",`/api/brands/${e}/presenters/${t}/revert`),createScene:(e,t)=>qe("POST",`/api/brands/${e}/scenes`,t),updateScene:(e,t,n)=>qe("PATCH",`/api/brands/${e}/scenes/${t}`,n),deleteScene:(e,t)=>qe("DELETE",`/api/brands/${e}/scenes/${t}`),sceneExamples:(e,t)=>qe("GET",`/api/brands/${e}/scenes/${t}/examples`),drawSceneExamples:(e,t,n)=>qe("POST",`/api/brands/${e}/scenes/${t}/examples`,n),stopSceneExamples:(e,t)=>qe("POST",`/api/brands/${e}/scenes/${t}/examples/stop`),removeSceneExample:(e,t,n)=>qe("DELETE",`/api/brands/${e}/scenes/${t}/examples/${n}`),generateScenePreview:(e,t)=>qe("POST",`/api/brands/${e}/scenes/${t}/preview`),rereadScene:(e,t,n)=>qe("POST",`/api/brands/${e}/scenes/${t}/reread`,{correction:n}),startSceneStudioJob:(e,t)=>qe("POST",`/api/brands/${e}/scene-studio/jobs`,t),sceneStudioJob:(e,t)=>qe("GET",`/api/brands/${e}/scene-studio/jobs/${t}`),cancelSceneStudioJob:(e,t)=>qe("POST",`/api/brands/${e}/scene-studio/jobs/${t}/cancel`),labelSceneStudioJob:(e,t,n)=>qe("POST",`/api/brands/${e}/scene-studio/jobs/${t}/label`,{label:n}),attachSceneStudioJob:(e,t,n)=>qe("POST",`/api/brands/${e}/scene-studio/jobs/${t}/attach`,{sceneId:n})},h4="scenri:guide-heading",qG=["first-shot","refine","product","presenter","scene","reuse"],XG=e=>qG.includes(e);function QG(){try{const e=typeof window>"u"?null:window.sessionStorage.getItem(h4);if(!e)return null;if(e.startsWith("{")){const t=JSON.parse(e);return typeof t.brandId=="string"&&XG(t.task)?{brandId:t.brandId,task:t.task}:null}return{brandId:e,task:"first-shot"}}catch{return null}}function ON(e){try{e?window.sessionStorage.setItem(h4,JSON.stringify(e)):window.sessionStorage.removeItem(h4)}catch{}}const JG={loaded:!1,heading:null,eligible:!1,welcome:null,hidden:!0,done:{},lessons:{},progress:{},dismissed:[],active:null,activeNodes:[],activeDraftId:null,counts:null};let no={...JG,heading:QG()},A5=null,E8=null,N5=!1;const p4=new Set;function Sc(e){no=e;for(const t of p4)t()}function IN(e){const t=e;return{...t,lessons:t.lessons??{},progress:t.progress??{},loaded:!0,heading:no.heading}}function jp(){return E8??(E8=Ee.guide().then(e=>Sc(IN(e))).catch(()=>{no.loaded||Sc({...no,loaded:!0})}).finally(()=>{E8=null})),E8}function eY(){return!N5&&typeof document<"u"&&(N5=!0,document.addEventListener("visibilitychange",()=>{!document.hidden&&no.loaded&&jp()})),A5??(A5=jp()),A5}function C8(){return jp()}function tY(e,t){var n,r;return"welcome"in t?{...e,welcome:t.welcome}:"hidden"in t?{...e,hidden:t.hidden}:"finish"in t?{...e,lessons:e.lessons[t.finish]?e.lessons:{...e.lessons,[t.finish]:new Date().toISOString()},...((n=e.active)==null?void 0:n.task)===t.finish?{active:null,activeNodes:[],activeDraftId:null}:{}}:"dismiss"in t?{...e,dismissed:e.dismissed.includes(t.dismiss)?e.dismissed:[...e.dismissed,t.dismiss],...((r=e.active)==null?void 0:r.task)===t.dismiss?{active:{...e.active,paused:!0}}:{}}:e}function dc(e){const t=no;return Sc(tY(no,e)),Ee.guideIntent(e).then(n=>Sc(IN(n))).catch(()=>{Sc(t),jp()})}function nY(e){return p4.add(e),()=>p4.delete(e)}const FN=e=>`scenri:guide-via-bar:${e}`,m4=(e,t)=>t==="first-shot"||t==="reuse"?FN(e):`scenri:guide-via:${e}:${t}`;function _N(e,t){const n={brandId:e,task:t};ON(n),Sc({...no,heading:n})}function g4(){ON(null),no.heading&&Sc({...no,heading:null})}function rp(){return no}function Lw(){return s.useSyncExternalStore(nY,rp)}const mt={root:"/",setup:"/setup",brand:"/:brandSlug",kit:"/:brandSlug/kit",products:"/:brandSlug/products",product:"/:brandSlug/products/:productId",scenes:"/:brandSlug/scenes",sceneStudio:"/:brandSlug/scenes/new/:convoId?",scene:"/:brandSlug/scenes/:sceneId",sceneEdit:"/:brandSlug/scenes/:sceneId/edit/:convoId?",presenters:"/:brandSlug/presenters",presenterStudio:"/:brandSlug/presenters/new/:draftId?",presenter:"/:brandSlug/presenters/:presenterId",presenterEdit:"/:brandSlug/presenters/:presenterId/edit",hub:"/:brandSlug/create",hubShot:"/:brandSlug/create/shots/:shotId",set:"/:brandSlug/sets/:setSlug",setShot:"/:brandSlug/sets/:setSlug/shots/:shotId",whatsNew:"/:brandSlug/whats-new",legacy:"/b/*",notFound:"*"},To=e=>hs(mt.brand,{brandSlug:e.slug}),td=e=>hs(mt.products,{brandSlug:e.slug}),Ea=(e,t)=>hs(mt.product,{brandSlug:e.slug,productId:t}),pl=e=>hs(mt.scenes,{brandSlug:e.slug}),zr=(e,t)=>hs(mt.scene,{brandSlug:e.slug,sceneId:t}),ml=(e,t)=>hs(mt.sceneStudio,{brandSlug:e.slug,convoId:t??void 0}),$w=(e,t,n)=>hs(mt.sceneEdit,{brandSlug:e.slug,sceneId:t,convoId:n??void 0}),ui=e=>hs(mt.presenters,{brandSlug:e.slug}),Ra=(e,t)=>hs(mt.presenter,{brandSlug:e.slug,presenterId:t}),gl=(e,t)=>hs(mt.presenterStudio,{brandSlug:e.slug,draftId:t??void 0}),Zm=(e,t)=>hs(mt.presenterEdit,{brandSlug:e.slug,presenterId:t}),Sr=e=>hs(mt.hub,{brandSlug:e.slug}),L0=(e,t)=>hs(mt.set,{brandSlug:e.slug,setSlug:t.slug}),Ap=e=>hs(mt.whatsNew,{brandSlug:e.slug}),zm=(e,t,n)=>t?hs(mt.setShot,{brandSlug:e.slug,setSlug:t.slug,shotId:n}):hs(mt.hubShot,{brandSlug:e.slug,shotId:n});function rY(e,t=""){const[,,n,...r]=e.split("/");if(!n)return mt.root;const a=`/${n}${sY(r)}`;return t?a+t:a}function sY(e){const[t,n,r,a]=e;return t==="create"?r&&n==="n"?`/create/shots/${r}`:"/create":t==="s"&&n?a&&r==="n"?`/sets/${n}/shots/${a}`:`/sets/${n}`:t==="brand"?"/kit":t==="p"?"/create":t==="n"&&n?`/create/shots/${n}`:e.length?`/${e.join("/")}`:""}const j8="Scenri",M5=" - ",R5=40,aY=[["whatsnew","What's new"],["setup","Providers"],["settings","Settings"]],oY=[[mt.setup,"Set up",!1],[mt.hubShot,"Shot",!1],[mt.setShot,"Shot",!1],[mt.hub,"Create",!1],[mt.set,"Create",!0],[mt.kit,"Brand kit",!1],[mt.whatsNew,"What's new",!1],[mt.product,"Products",!0],[mt.products,"Products",!1],[mt.scene,"Scenes",!0],[mt.scenes,"Scenes",!1],[mt.presenter,"Presenters",!0],[mt.presenters,"Presenters",!1],[mt.brand,"Home",!1]];function iY(e){if(!e)return null;const t=e.replace(/[\u0000-\u001F\u007F-\u009F]/g," ").replace(/\s+/g," ").trim();return t?t.length>R5?`${t.slice(0,R5-1).trimEnd()}…`:t:null}function lY(e,t="",n=null){const r=new URLSearchParams(t);for(const[a,i]of aY)if(r.has(a))return i+M5+j8;for(const[a,i,l]of oY)if(yl(a,e))return((l?iY(n):null)??i)+M5+j8;return j8}const VN=s.createContext(null);function cY(){const{pathname:e,search:t}=Un(),[n,r]=s.useState(null);return s.useEffect(()=>{document.title=lY(e,t,n)},[e,t,n]),r}function qc(e){const t=s.useContext(VN);s.useEffect(()=>{if(t)return t(e??null),()=>t(null)},[t,e])}function xi(e,t){return JSON.stringify(e)===JSON.stringify(t)?e:t}function Bm(e){const t=e.current;e.current=[];for(const n of t)n()}const uY={scenes:[],collections:[],verticals:[],loaded:!1,error:!1};function dY(){const[e,t]=s.useState(uY),[n,r]=s.useState(0),a=s.useRef(!1),i=s.useRef([]);s.useEffect(()=>{let u=!0;return Ee.scenes().then(f=>{UG(f.scenes),u&&t(h=>xi(h,{scenes:f.scenes,collections:f.collections,verticals:f.verticals,loaded:!0,error:!1}))}).catch(()=>{u&&!a.current&&t(f=>({...f,loaded:!0,error:!0}))}).finally(()=>{u&&Bm(i)}),()=>{u=!1}},[n]);const l=s.useCallback(u=>new Promise(f=>{i.current.push(f),a.current=!!(u!=null&&u.quiet),a.current||t(h=>({...h,loaded:!1,error:!1})),r(h=>h+1)}),[]);return{...e,refetch:l}}const fY={presenters:[],categories:[],styles:[],loaded:!1,error:!1};function hY(){const[e,t]=s.useState(fY),[n,r]=s.useState(0),a=s.useRef(!1),i=s.useRef([]);s.useEffect(()=>{let u=!0;return Ee.presenters().then(f=>{u&&t(h=>xi(h,{presenters:f.presenters,categories:f.categories,styles:f.styles,loaded:!0,error:!1}))}).catch(()=>{u&&!a.current&&t(f=>({...f,loaded:!0,error:!0}))}).finally(()=>{u&&Bm(i)}),()=>{u=!1}},[n]);const l=s.useCallback(u=>new Promise(f=>{i.current.push(f),a.current=!!(u!=null&&u.quiet),a.current||t(h=>({...h,loaded:!1,error:!1})),r(h=>h+1)}),[]);return{...e,refetch:l}}const pY={demoProducts:[],categories:[],loaded:!1,error:!1};function mY(){const[e,t]=s.useState(pY),[n,r]=s.useState(0),a=s.useRef(!1),i=s.useRef([]);s.useEffect(()=>{let u=!0;return Ee.demoProducts().then(f=>{u&&t(h=>xi(h,{demoProducts:f.demoProducts,categories:f.categories,loaded:!0,error:!1}))}).catch(()=>{u&&!a.current&&t(f=>({...f,loaded:!0,error:!0}))}).finally(()=>{u&&Bm(i)}),()=>{u=!1}},[n]);const l=s.useCallback(u=>new Promise(f=>{i.current.push(f),a.current=!!(u!=null&&u.quiet),a.current||t(h=>({...h,loaded:!1,error:!1})),r(h=>h+1)}),[]);return{...e,refetch:l}}const gY={showcase:[],categories:[],loaded:!1,error:!1};function vY(){const[e,t]=s.useState(gY),[n,r]=s.useState(0),a=s.useRef(!1),i=s.useRef([]);s.useEffect(()=>{let u=!0;return Ee.showcase().then(f=>{u&&t(h=>xi(h,{showcase:f.showcase,categories:f.categories,loaded:!0,error:!1}))}).catch(()=>{u&&!a.current&&t(f=>({...f,loaded:!0,error:!0}))}).finally(()=>{u&&Bm(i)}),()=>{u=!1}},[n]);const l=s.useCallback(u=>new Promise(f=>{i.current.push(f),a.current=!!(u!=null&&u.quiet),a.current||t(h=>({...h,loaded:!1,error:!1})),r(h=>h+1)}),[]);return{...e,refetch:l}}const Rh=[{id:"brand",label:"Brand kit",Icon:pF,scope:"brand",sub:e=>`What every shot for ${e} can draw on.`},{id:"usage",label:"Usage",Icon:QI,scope:"brand",sub:e=>`What ${e} has made, one square per day.`},{id:"engines",label:"Providers",Icon:tf,scope:"studio",sub:()=>"Where your images are made, and what each may spend."},{id:"appearance",label:"Appearance",Icon:eF,scope:"studio",sub:()=>"How Scenri looks on this device."},{id:"library",label:"Library",Icon:$v,scope:"studio",sub:()=>"Your work, as plain files on this computer. Back them up like anything else."},{id:"phone",label:"Local access",Icon:tF,scope:"studio",sub:()=>"Open Scenri on your phone, tablet or another computer, or from your desktop.",feature:"local-access"},{id:"updates",label:"Updates",Icon:pp,scope:"studio",sub:()=>"How this copy of Scenri stays current."},{id:"about",label:"About",Icon:pm,scope:"studio",sub:()=>"The copy of Scenri you are running."},{id:"danger",label:"Danger zone",Icon:gm,scope:"apart",sub:()=>"These do not come back. Export from Library first if you are not certain."}],ZN={brand:"brand",usage:"usage",engines:"engines",budget:"engines",general:"appearance",appearance:"appearance",library:"library",phone:"phone",updates:"updates",about:"about",danger:"danger"},wY="index",zN=e=>e!==null&&Object.prototype.hasOwnProperty.call(ZN,e),yY=e=>zN(e)?ZN[e]:"brand",bY=e=>!zN(e),BN=["settings","setup","new","whatsnew","learn","welcome"];function Fl(){const{open:e}=jr("settings");return s.useCallback(t=>e(t??wY),[e])}function xY(){const{open:e}=jr("welcome");return s.useCallback(()=>e("1"),[e])}const v4={current:null};function UN(){const{open:e}=jr("learn");return s.useCallback((t="lessons")=>e(t),[e])}const P5="codex-cli";function _l(){const{open:e}=jr("setup");return s.useCallback((t=P5)=>{e(typeof t=="string"?t:P5)},[e])}function WN(e){var t;e.preventDefault(),(t=e.currentTarget)==null||t.focus({preventScroll:!0})}function KN({failure:e,density:t,onRetry:n,dismiss:r}){const a=Fl(),i=_l(),{remedy:l}=e,u=t==="tile",f=()=>{l&&(l.opens==="setup"?i("codex-cli"):a(l.opens))},h=n&&e.retryable,p=w=>u?`sc-s${w?" sc-s-primary":""}`:`sc-btn ${w?"sc-btn-primary":"sc-btn-ghost"}`,g=!u&&!!e.fix,m=!u&&!!e.raw;return o.jsxs("div",{className:"sc-fail","data-density":t,"data-kind":e.kind,"data-long":e.title.length>90||void 0,role:u?void 0:"alert",children:[o.jsx("span",{className:"sc-fail-ic","aria-hidden":!0,children:o.jsx(zc,{size:u?15:21,weight:"fill"})}),o.jsxs("div",{className:"sc-fail-txt",children:[o.jsx("b",{children:e.title}),g&&o.jsx("small",{children:e.fix})]}),(l||h||r)&&o.jsxs("div",{className:"sc-fail-acts",children:[l&&o.jsx("button",{type:"button",className:p(!0),onClick:f,children:l.label}),h&&o.jsxs("button",{type:"button",className:p(!l),onClick:n,children:[o.jsx(ef,{size:u?12:14})," Try again"]}),r&&o.jsx("button",{type:"button",className:"sc-fail-alt",onClick:r.onClick,children:r.label})]}),m&&o.jsxs("details",{className:"sc-fail-raw",children:[o.jsx("summary",{children:"Details"}),o.jsx("pre",{children:e.raw})]})]})}function Tw({failure:e,action:t,tone:n="error"}){return o.jsx("div",{className:"sc-failrow","data-tone":n,role:n==="error"?"alert":"status",children:o.jsxs("div",{className:"sc-banner","data-tone":n==="error"?"error":void 0,children:[o.jsx("span",{className:"sc-banner-ic",children:n==="error"?o.jsx(zc,{size:16,weight:"fill"}):o.jsx(pm,{size:16,weight:"fill"})}),o.jsxs("span",{className:"sc-banner-txt",children:[o.jsx("b",{children:e.title}),e.fix&&o.jsx("small",{children:e.fix})]}),t]})})}function GN(e){return{get(t){try{return e().getItem(t)}catch{return null}},set(t,n){try{e().setItem(t,n)}catch{}},del(t){try{e().removeItem(t)}catch{}},keys(t){try{const n=e(),r=[];for(let a=0;a<n.length;a++){const i=n.key(a);i!=null&&i.startsWith(t)&&r.push(i)}return r}catch{return[]}}}}const Cr=GN(()=>localStorage),Xc=GN(()=>sessionStorage),YN=720*60*60*1e3;function qN(e){return e?e.phase==="ready"?e.blockReason!=="dev"&&e.blockReason!=="unsupervised"&&e.blockReason!=="launcher-too-old":e.canApply:!1}function kY(e){return!!(e!=null&&e.available)&&e.blockReason!=="dev"}function SY(e){return e.phase==="staging"?{kind:"downloading"}:e.phase==="ready"?{kind:"ready",version:e.stagedVersion??e.latest??e.current}:e.phase==="error"&&e.available?{kind:"stage-error"}:{kind:"announce",oneClick:qN(e)}}const EY=e=>e!==200;async function CY(e,t){const n=t.sleep??(r=>new Promise(a=>setTimeout(a,r)));for(let r=0;r<=t.boundMs;r+=t.stepMs){if(EY(await e()))return!0;await n(t.stepMs)}return!1}const jY=1800*1e3,L5=300*1e3,A8=e=>new Promise(t=>setTimeout(t,e)),XN="scenri:update-dismissed",AY=()=>Xc.get(XN),NY=e=>Xc.set(XN,e),QN=s.createContext(null);function Um(){const e=s.useContext(QN);if(!e)throw new Error("useUpdateCenter must be used inside UpdateCenterProvider");return e}function MY({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState(!1),[i,l]=s.useState(AY),u=s.useRef(void 0),f=s.useRef(!1),[h,p]=s.useState(!1);s.useEffect(()=>{let R=!0;return Ee.version().then(H=>R&&p(H.thisComputer===!0)).catch(()=>{}),()=>{R=!1}},[]),s.useEffect(()=>{let R=!0;const H=async()=>{if(!(!R||f.current)){if(!document.hidden)try{const B=await Ee.updateStatus();R&&n(B)}catch{}R&&(u.current=window.setTimeout(H,jY))}};H();const D=()=>{document.hidden||!R||(window.clearTimeout(u.current),H())};return document.addEventListener("visibilitychange",D),window.addEventListener("focus",D),()=>{R=!1,window.clearTimeout(u.current),document.removeEventListener("visibilitychange",D),window.removeEventListener("focus",D)}},[]);const[g,m]=s.useState(null),w=s.useCallback(async()=>{a(!0);try{n(await Ee.updateCheck()),m(null)}catch(R){m(String((R==null?void 0:R.message)??R))}finally{a(!1)}},[]),y=s.useCallback(()=>{const R=t==null?void 0:t.latest;R&&(NY(R),l(R))},[t]),b=(t==null?void 0:t.latest)!=null&&t.latest===i,[k,S]=s.useState("idle"),[E,C]=s.useState(null),A=s.useCallback(async R=>{S("restarting");try{await Ee.updateRestart()}catch(D){if(typeof D.status=="number"){S("idle"),C(String((D==null?void 0:D.message)??D));return}}const H=Date.now()+3e4;for(;Date.now()<H;){await A8(800);try{if((await Ee.version()).version!==R){location.reload();return}}catch{}}S("idle"),C("The restart did not complete. Check the terminal Scenri runs in.")},[]),L=s.useCallback(async()=>{if(k!=="idle")return{kind:"still-running"};S("stopping");try{await Ee.quit()}catch(H){if(typeof H.status=="number")return S("idle"),{kind:"refused",reason:String((H==null?void 0:H.message)??H)}}return await CY(()=>fetch("/api/version",{cache:"no-store"}).then(H=>H.status,()=>null),{boundMs:8e3,stepMs:250})?(f.current=!0,S("stopped"),{kind:"stopped"}):(S("idle"),{kind:"still-running"})},[k]);s.useEffect(()=>{k==="stopped"&&window.close()},[k]);const T=s.useCallback(async()=>{if(k!=="idle")return;C(null);const R=t==null?void 0:t.current;try{if((t==null?void 0:t.phase)!=="ready"){S("applying"),await Ee.updateApply();const H=Date.now()+L5;let D=!1;for(;Date.now()<H;){await A8(1500);const B=await Ee.updateStatus();if(n(B),B.phase==="ready"){D=!0;break}if(B.phase==="error"){C(B.error??"The update could not be staged."),S("idle");return}}if(!D){C("Couldn't download the update. Try again."),S("idle");return}}await A(R)}catch(H){C(String((H==null?void 0:H.message)??H)),S("idle")}},[k,t,A]),M=s.useRef(!1);s.useEffect(()=>{if((t==null?void 0:t.phase)!=="staging"||k!=="idle"||M.current)return;M.current=!0;let R=!0;const H=Date.now()+L5;return(async()=>{for(;R&&Date.now()<H;){if(await A8(1500),!R)return;try{const B=await Ee.updateStatus();if(!R||(n(B),B.phase!=="staging"))return}catch{}}})().finally(()=>{M.current=!1}),()=>{R=!1}},[t==null?void 0:t.phase,k]);const{pathname:j}=Un(),P=j===mt.setup;return o.jsxs(QN.Provider,{value:{status:t,checking:r,checkNow:w,checkError:g,dismissed:b,dismiss:y,apply:T,quit:L,thisComputer:h,busy:k,applyError:E},children:[k==="stopped"?o.jsx(PY,{}):e,k!=="restarting"&&k!=="stopped"&&h&&kY(t)&&!b&&!P&&o.jsx(LY,{}),k==="restarting"&&o.jsx(RY,{version:(t==null?void 0:t.stagedVersion)??(t==null?void 0:t.latest)??null})]})}function RY({version:e}){return o.jsxs(JN,{children:[o.jsx(U7,{size:22}),o.jsx("b",{children:e?`Updating to Scenri ${e}`:"Updating Scenri"}),o.jsx("small",{children:"Restarting. This page reconnects by itself."})]})}function PY(){return o.jsxs(JN,{className:"sc-upd-stopped",children:[o.jsx(tC,{size:22}),o.jsx("b",{children:"Scenri is shut down"}),o.jsx("small",{children:"You can close this tab. Start it again from your desktop icon or with npx scenri."})]})}function JN({children:e,className:t}){return Br.createPortal(o.jsx("div",{className:t?`sc-upd-overlay ${t}`:"sc-upd-overlay",role:"status","aria-live":"polite",children:o.jsx("div",{className:"sc-upd-overlay-card",children:e})}),document.body)}function LY(){const{status:e,dismiss:t,apply:n,busy:r,applyError:a}=Um(),i=Fl();if(!e)return null;const l=SY(e),u=l.kind==="downloading"?"Downloading update…":l.kind==="ready"?`Scenri ${l.version} is ready`:l.kind==="stage-error"?"Couldn't download the update":"A new update is available",f=r==="applying"?"Updating…":l.kind==="stage-error"?"Try again":"Update",h=l.kind!=="announce"||l.oneClick;return o.jsxs("div",{className:"sc-upd-float",role:"status",children:[o.jsx(rF,{className:"sc-upd-float-dot",size:16,weight:"fill","aria-hidden":"true"}),o.jsxs("span",{className:"sc-upd-float-txt",children:[u,a&&l.kind!=="downloading"&&o.jsx("small",{children:a})]}),o.jsx("button",{type:"button",className:"sc-upd-float-later",onClick:t,children:l.kind==="ready"?"Later":"Not now"}),l.kind!=="downloading"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:r!=="idle",onClick:()=>h?void n():i("updates"),children:f})]})}function $Y(e,t){return!e||t.updatedAt>=e.updatedAt}function TY(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0||e[n]===t||!$Y(e[n],t))return e;const r=e.slice();return r[n]=t,r}function DY(e,t,n){if(!e)return t;const r=new Map(e.map(l=>[l.id,l]));let a=e.length===t.length;const i=t.map((l,u)=>{const f=r.get(l.id),h=f&&n.has(l.id)&&!(l.updatedAt>f.updatedAt)?f:l;return h!==e[u]&&(a=!1),h});return a?e:i}const Dw=(e,t)=>`scenri:new-${e}-${t}`,HY=e=>Xc.get(e),OY=(e,t)=>Xc.set(e,t);function $0(e){Xc.del(e),Cr.del(e)}function N8(e){var t,n,r;return!!((t=e.name)!=null&&t.trim())||!!((n=e.instruction)!=null&&n.trim())||!!((r=e.importUrl)!=null&&r.trim())||(e.facets??[]).length>0||(e.imageHashes??[]).length>0}const $5=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function eM(e,t){const n=Dw(e,t),r=HY(n);if(!r)return null;let a;try{a=JSON.parse(r)}catch{return $0(n),null}if(typeof a!="object"||a===null)return $0(n),null;const i=a;if(i.v!==1||i.brandId!==e||i.kind!==t)return $0(n),null;const l=Date.now()-Date.parse(i.updatedAt??"");return!Number.isFinite(l)||l>YN?($0(n),null):{v:1,brandId:e,kind:t,updatedAt:i.updatedAt,name:typeof i.name=="string"?i.name:"",instruction:typeof i.instruction=="string"?i.instruction:"",facets:$5(i.facets),imageHashes:$5(i.imageHashes),importUrl:typeof i.importUrl=="string"?i.importUrl:"",pending:typeof i.pending=="string"?i.pending:null}}function M8(e,t,n){const r={v:1,brandId:e,kind:t,updatedAt:new Date().toISOString(),name:n.name??"",instruction:n.instruction??"",facets:n.facets??[],imageHashes:n.imageHashes??[],importUrl:n.importUrl??"",pending:n.pending??null};OY(Dw(e,t),JSON.stringify(r))}function Vu(e,t){$0(Dw(e,t))}function IY(e,t,n){const r=eM(e,t);(r==null?void 0:r.pending)===n&&Vu(e,t)}function FY(e,t){if(!e)return!1;if(e.pending===null)return!0;const n=t??"unknown";return n==="failed"||n==="cancelled"||n==="unknown"}const Gu=e=>`scenri:draft-${e}`;let w4=0;function _Y(){return w4+=1,()=>{w4-=1}}const Ec=()=>w4>0?"":"&fresh=1",VY=e=>Cr.get(e),ZY=(e,t)=>Cr.set(e,t),sp=e=>Cr.del(e);function R8(e,t){return e.some(n=>n.t==="text"?!!n.v.trim():n.t!=="template")||Object.values(t).some(n=>!!n.trim())}function T5(e){const t=VY(Gu(e));if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;if(r.v!==1||r.brandId!==e||!Array.isArray(r.tokens)||typeof r.tplFields!="object"||!r.tplFields||r.branchId)return sp(Gu(e)),null;const a=Date.now()-Date.parse(r.updatedAt??"");return!Number.isFinite(a)||a>YN?(sp(Gu(e)),null):{v:1,brandId:e,updatedAt:r.updatedAt,tokens:r.tokens,tplFields:r.tplFields,setSlug:r.setSlug??null,...y4(r.lent)?{lent:y4(r.lent)}:{}}}function y4(e){if(typeof e!="object"||e===null)return;const t=e,n={...typeof t.format=="string"?{format:t.format}:{},...typeof t.count=="number"&&Number.isInteger(t.count)&&t.count>0?{count:t.count}:{},...typeof t.quality=="string"?{quality:t.quality}:{}};return Object.keys(n).length?n:void 0}function Hw(e,t){const n=y4(t.lent),r={v:1,brandId:e,updatedAt:new Date().toISOString(),tokens:t.tokens,tplFields:t.tplFields,setSlug:t.setSlug??null,...n?{lent:n}:{}};ZY(Gu(e),JSON.stringify(r))}function D5(e){sp(Gu(e))}const b4="scenri:draft-returned";function zY(e,t){Hw(e,t),window.dispatchEvent(new CustomEvent(b4,{detail:e}))}const tM="the engine",nM=/no engine here can draw/i,BY=[{re:/Codex plan's usage limit is used up/i,kind:"credit",title:()=>"",remedy:{label:"Use a provider key instead",opens:"engines"},retryable:!1},{re:/environment is overriding that sign-in/i,kind:"auth",title:()=>"An API key on this computer is overriding your Codex sign-in.",fix:"Tell Scenri to ignore it, then run this again.",remedy:{label:"Fix this",opens:"setup"},retryable:!0},{re:/codex.*(not logged in|login required|\b401\b|unauthorized|token.*expired)/i,kind:"auth",title:()=>"Codex is signed out on this machine.",fix:"Sign in with your ChatGPT account, then run this again.",remedy:{label:"Sign in",opens:"setup"},retryable:!1},{re:/HTTP 401\b|missing authentication|no auth credentials|invalid api key|unauthorized/i,kind:"auth",title:e=>`${bo(e)} did not accept your API key.`,fix:"Add or replace the key, then run this again.",remedy:{label:"Add key",opens:"engines"},retryable:!1},{re:/HTTP 403\b|forbidden/i,kind:"auth",title:e=>`${bo(e)} refused this key.`,fix:"It may not cover the model this shot asked for.",remedy:{label:"Check key",opens:"engines"},retryable:!1},{re:/spend cap for .*would exceed it|spend cap for/i,kind:"budget",title:e=>`This would go past your monthly cap for ${e}.`,fix:"Raise the cap, or wait for the month to roll over.",remedy:{label:"Open budget",opens:"budget"},retryable:!1},{re:/HTTP 402\b|insufficient (credit|funds|balance)|out of credit|billing|payment required/i,kind:"credit",title:e=>`${bo(e)} is out of credit.`,fix:"Top up with the provider, then run this again.",retryable:!0},{re:/HTTP 429\b|rate.?limit|too many requests/i,kind:"rate",title:e=>`${bo(e)} is rate limiting this key.`,fix:"Give it a minute, then try again.",retryable:!0},{re:/moderation|content policy|safety system|flagged|violat(es|ion)|blocked by/i,kind:"policy",title:e=>`${bo(e)} declined this brief.`,fix:"Reword what you asked for and run it again.",retryable:!1},{re:/cannot carry enough reference images/i,kind:"references",title:()=>"",remedy:{label:"Choose engine",opens:"engines"},retryable:!1},{re:/no usable photo/i,kind:"references",title:()=>"",retryable:!1},{re:/cannot produce the requested aspect ratio|engine returned \d+x\d+ for a \d+x\d+ request/i,kind:"format",title:e=>`${bo(e)} cannot make this shape.`,fix:"Pick another format, or an engine that can.",remedy:{label:"Choose engine",opens:"engines"},retryable:!1},{re:/HTTP 404\b|model not found|no endpoints found|no allowed providers/i,kind:"model",title:e=>`${bo(e)} has no model for this shot.`,fix:"Pick another engine in the composer, or connect one in Providers.",remedy:{label:"Providers",opens:"engines"},retryable:!1},{re:nM,kind:"setup",title:()=>"Image generation is not set up yet.",fix:"Set it up, and this goes on from where it stopped.",remedy:{label:"Set up",opens:"setup"},retryable:!1},{re:/reading pictures needs codex/i,kind:"setup",title:()=>"Reading pictures needs Codex, which is not set up yet.",fix:"Set it up, and the pictures are read from where they are.",remedy:{label:"Set up",opens:"setup"},retryable:!1},{re:/failed to spawn codex|codex.*enoent|command not found/i,kind:"setup",title:()=>"Codex is not installed on this machine.",fix:"Run setup once and this works from then on.",remedy:{label:"Set up Codex",opens:"setup"},retryable:!1},{re:/code-mode host/i,kind:"setup",title:()=>"Codex could not start its tool host.",fix:"A Windows setting is blocking it. Set SafeDllSearchMode to 1 and restart Windows.",retryable:!1},{re:/could not verify codex/i,kind:"setup",title:()=>"Scenri could not verify Codex.",fix:"Open setup and check again. If Codex was just installed, restart Scenri.",remedy:{label:"Check Codex",opens:"setup"},retryable:!0},{re:/codex cli .* is too old|Scenri needs \d+\.\d+\.\d+ or newer/i,kind:"setup",title:()=>"Codex CLI needs an update.",fix:"Update Codex, then run this again.",remedy:{label:"Update Codex",opens:"setup"},retryable:!1},{re:/\brun aborted\b/i,kind:"cancelled",title:()=>"You stopped this shot.",fix:"The prompt is kept. Run it again whenever.",retryable:!0},{re:/produced no output for \d+s/i,kind:"timeout",title:()=>"Codex never started answering.",fix:"Try again. If it keeps happening, run Codex once in a terminal to check it still works.",retryable:!0},{re:/Codex CLI timed out after/i,kind:"timeout",title:()=>"Codex ran out of time on this shot.",fix:"Try again. Fewer variants or fewer reference photos finish faster.",retryable:!0},{re:/generation timed out after \d+ minutes?/i,kind:"timeout",title:()=>"This run hit the overall time limit.",fix:"Try again, with fewer variants if it repeats.",retryable:!0},{re:/timed out|ETIMEDOUT/i,kind:"timeout",title:e=>`${bo(e)} took too long to answer.`,fix:"Try again.",retryable:!0},{re:/ENOTFOUND|ECONNREFUSED|ECONNRESET|EAI_AGAIN|fetch failed|network error/i,kind:"network",title:e=>`Could not reach ${e}.`,fix:"Check your connection, then try again.",retryable:!0},{re:/interrupted\W+server restarted/i,kind:"restarted",title:()=>"Scenri restarted while this was rendering.",fix:"The shot was lost, not the brief. Run it again.",retryable:!0},{re:/HTTP 5\d\d\b|internal server error|bad gateway|service unavailable|overloaded|upstream/i,kind:"server",title:e=>`${bo(e)} had a problem on its end.`,fix:"Nothing wrong on your side. Try again shortly.",retryable:!0},{re:/produced no images|returned no image|no images returned|finished but produced no/i,kind:"empty",title:e=>`${bo(e)} finished without making a picture.`,fix:"Run it again. This usually clears on a second try.",retryable:!0}];function bo(e){return e===tM?"The engine":e}function co(e,t){const n=(e??"").trim(),r=(t??"").replace(/\s*\(BYOK\)\s*$/i,"").trim()||tM;if(!n)return{kind:"unknown",title:"This shot did not finish.",raw:"",retryable:!0};for(const a of BY){if(!a.re.test(n))continue;const i=a.title(r)||UY(n);return{kind:a.kind,title:i,fix:a.fix,raw:n,remedy:a.remedy,retryable:a.retryable}}return{kind:"unknown",title:"This shot did not finish.",raw:n,retryable:!0}}function rM(){return{kind:"cancelled",title:"You stopped this shot.",fix:"The prompt is kept. Run it again whenever.",raw:"",retryable:!0}}function ln(e,t,n){const r=e instanceof Error?e.message:typeof e=="string"?e:String((e==null?void 0:e.message)??e),a=co(r,n),i=a.kind==="unknown"?a.raw||void 0:[a.title,a.fix].filter(Boolean).join(" ");return{kind:"error",title:t,detail:i}}function UY(e){const t=e.trim();if(!t)return t;const n=t[0].toUpperCase()+t.slice(1);return/[.!?]$/.test(n)?n:`${n}.`}const Wm=[{id:"portrait",tier:"core",gate:!0,from:[],strip:"Face",name:"face"},{id:"front",tier:"core",gate:!0,from:["portrait"],strip:"Full body",name:"full body"},{id:"three-quarter",tier:"core",from:["portrait","front"],strip:"Three-quarter",name:"three-quarter view"},{id:"back",tier:"supplementary",from:["portrait","front"],strip:"Back",name:"back view"},{id:"left",tier:"supplementary",from:["portrait","front"],strip:"Left",name:"left view"},{id:"right",tier:"supplementary",from:["portrait","front"],strip:"Right",name:"right view"}],t1=e=>Wm.filter(e).map(t=>t.id),sM=t1(()=>!0),WY=t1(e=>e.tier==="core"),aM=t1(e=>e.tier==="supplementary"),$c=Object.fromEntries(Wm.map(e=>[e.id,e.strip])),xn=Object.fromEntries(Wm.map(e=>[e.id,e.name])),Cc=e=>xn[e],oM=Object.fromEntries(Wm.map(e=>[e.id,e.from])),x4=new Set(t1(e=>e.gate===!0)),ei=e=>x4.has(e)?void 0:"auto",B0=4,H5=25*1024*1024,di=e=>t1(t=>{var n;return t.tier==="core"||!!e.extras||((n=e.views[t.id])==null?void 0:n.status)!=="empty"});function Km(e){return di(e).find(t=>e.views[t].status!=="approved")??null}const KY=e=>Km(e)===null,fi=e=>e.views.portrait.status==="approved"||!!e.views.portrait.prior,Tc=e=>e.stage!=="idle"||!!e.activeView;function Ow(e){if(Tc(e))return null;const t=Km(e);if(!t)return null;const n=e.views[t];return n.status!=="empty"&&n.status!=="stale"||n.error?null:oM[t].every(r=>e.views[r].status==="approved")?t:null}function iM(e,t){return t??(Tc(e)?e.activeView:null)??Km(e)??"portrait"}function lM(e,t){return di(e).map(n=>{const r=e.views[n],a=n===t?"current":r.status==="approved"?"approved":r.status==="stale"?"stale":"todo";return{view:n,label:$c[n],state:a,hash:r.hash,photo:r.origin==="photo",drawing:e.activeView===n,approved:r.status==="approved",error:!!r.error}})}const GY={woman:"a woman",man:"a man",androgynous:"an androgynous person"},YY={woman:"her",man:"his",androgynous:"their"},Np=/\b(wom[ae]n|m[ae]n|male|female|lady|ladies|girl|boy|guy|gentlem[ae]n|nonbinary|non-binary|androgynous|masculine|feminine|transgender|trans|mother|father|mum|mom|dad|sister|brother|daughter|son|grandmother|grandfather|she|he|her|his)\b/i,qY=/^(my|a|an|the|this|that|is|it|its|their|there|hey|hi|hello|yo|ok|okay|please|thanks|thank|you|your|dear|bro|bruh|dude|mate|sir|maam|madam|just|like|some)$/i;function XY(e){const t=e.trim().split(/[^\p{L}\p{N}']+/u).filter(Boolean);return t.some(n=>Np.test(n))?t.every(n=>qY.test(n)||Np.test(n)):!1}const Iw=/\b(\d0s|\d{2}\s*(years|yo)|teen|twenties|thirties|forties|fifties|sixties|seventies|elderly|young|old(er)?|middle-aged|adult)\b/i,QY=120,JY=18;function eq(e){const t=e.match(/\d+/g);return t!=null&&t.length?t.every(n=>{const r=Number(n);return r>=JY&&r<=QY}):!1}const tq=/\b(hair|bald|shaved|buzz|blonde?|brunette|redhead|ginger|greying|silver|auburn|platinum)\b/i,nq=/\b(skin|complexion|fair|pale|light|olive|tan|tanned|brown|deep|dark|ebony|black|white|freckled|golden)\b/i,rq=/\b(wom[ae]n|m[ae]n|male|female|lady|ladies|girl|boy|guy|guys|gentlem[ae]n|nonbinary|non-binary|androgynous|masculine|feminine|transgender|trans|mother|father|mum|mom|dad|sister|brother|daughter|son|grandmother|grandfather|person|people|someone|somebody|model|teen|teenager|kid|child|adult|senior)\b/i,sq=/\b(hair|haired|curly|wavy|straight|braids?|bob|ponytail|bun|fringe|bangs|beard|beardless|moustache|mustache|stubble|goatee|clean-shaven|freckles?|glasses|spectacles|tattoos?|piercings?|eyes?|eyebrows?|brows|jaw|jawline|cheekbones|nose|lips|mouth|smile|smiling|face|features|forehead|dimples|scar|wrinkles|build|figure|frame|body|tall|short|slim|slender|athletic|average|fuller|curvy|broad|lean|muscular|petite|stocky|heavy|thin|plus.size|height|weight|presence|vibe|energy|look|looks|looking|calm|warm|confident|elegant|composed|friendly|serious|intense|soft|gentle|bright|energetic|quiet|poised|relaxed|playful|stern|kind|charming|handsome|beautiful|pretty|striking|rugged|graceful|sporty|nerdy|bookish|professional|corporate|casual|older|younger|taller|shorter|longer|slimmer|leaner|heavier|broader|bigger|smaller|thinner|thicker|softer|sharper|lighter|darker|natural|makeup|make-up|lipstick|jewelry|earrings)\b/i,aq=/\b(mediterranean|asian|indian|chinese|japanese|korean|african|nordic|scandinavian|latin[ao]?|hispanic|arab|arabic|middle eastern|european|caucasian|israeli|jewish|irish|italian|french|spanish|greek|turkish|persian|brazilian|mexican|american|british|german|dutch|russian|polish|thai|vietnamese|filipin[ao]|nigerian|ethiopian|moroccan|egyptian|australian|canadian|swedish|norwegian|danish|finnish|portuguese|indonesian|pakistani|iranian|lebanese|slavic|celtic|mixed|biracial)\b/i,ya=e=>rq.test(e)||Iw.test(e)||tq.test(e)||nq.test(e)||sq.test(e)||aq.test(e);function oq(e,t){const n=t.trim();if(!n)return"";const r=[],a=e.steer&&!Np.test(n)?GY[e.steer]:"";if(a&&r.push(a),e.age&&!Iw.test(n)){const l=e.steer?YY[e.steer]:"their",u=e.age==="60+"?`in ${l} 60s or older`:`in ${l} ${e.age}`;r.push(a?u:`someone ${u}`)}const i=[];return i.length&&r.push(`with ${i.join(" and ")}`),r.length?`${r.join(" ")}, ${n}`:n}function iq(e,t){var r;const n=((r=e.analysis)==null?void 0:r.suitableCategories)??[];return!n.length||t.length?null:n}function cM(e){return sM.some(t=>{const n=e.views[t];return!!n.hash&&n.origin!=="photo"&&n.status!=="empty"})}function lq(e,t){if(Tc(e))return"Still drawing";for(const n of di(e)){const r=e.views[n];if(r.status==="candidate")return`Decide on the ${Cc(n)} first`;if(r.status==="stale")return`Redo the ${Cc(n)} first`;if(r.status!=="approved")return`Use the ${Cc(n)} first`}return t.trim()?null:"Give them a name"}const uM=/\b(hair|bald|fringe|bangs|beard|moustache|mustache|stubble|skin|freckles?|complexion|age|older|younger|\d0s|face|facial|jaw|chin|cheek(bone)?s?|nose|eyes?|brows?|eyebrows?|lips?|mouth|teeth|wrinkles?|build|weight|heavier|slimmer|thinner|leaner|broader|muscular|athletic|curvier|taller|shorter|height|gender|woman|man|feminine|masculine|glasses|tattoo|scar)\b/i;function dM(e,t,n){if(!e.trim())return{blocked:"Say what should change."};if(!fi(n))return n.views.portrait.status!=="candidate"?{blocked:"Nothing to adjust yet."}:{view:"portrait",scope:"identity"};if(t==="portrait"||uM.test(e))return n.source==="photos"?{blocked:"Their photos define who they are. Change a drawn view instead."}:{view:"portrait",scope:"identity"};const a=n.views[t];return a.origin==="photo"?{blocked:"Your photo stands as it is. Pick a drawn view to change."}:a.status!=="approved"&&a.status!=="candidate"?{blocked:`Nothing drawn for the ${Cc(t)} yet.`}:{view:t,scope:"view"}}function O5(e,t){return fi(t)?t.source==="photos"?"Changes this view only. Their photos define who they are.":e==="portrait"?"Changes the person. The other views are redrawn after you use it.":"Changes this view only. Hair, skin, age or build change the person.":"An adjustment keeps this person. Try again rolls a new one."}function cq(e,t,n){const r=e.trim(),a=dM(r||"this",t,n);if("blocked"in a)return r?{chip:null,hint:a.blocked,tone:"alert"}:{chip:null,hint:O5(t,n)};const i=fi(n)?a.scope==="identity"?"Changing the person":`Refining the ${xn[a.view]}`:"Adjusting the face";return{chip:{view:a.view,label:i},hint:O5(t,n)}}const I5=e=>e.charAt(0).toUpperCase()+e.slice(1);function uq(e){var p,g,m,w;if(e.source!=="photos"||e.stage==="analyzing")return null;const t=(p=e.readError)==null?void 0:p.trim();if(t){const y=co(t);return{text:`The photos could not be read${y.kind!=="unknown"?`. ${y.title}`:`: ${/[.!?]$/.test(t)?t:`${t}.`}`} Their face is drawn from them anyway.`,tone:"warn"}}const n=(m=(g=e.analysis)==null?void 0:g.conflict)==null?void 0:m.trim();if(n)return{text:`These photos may show more than one person: ${n}`,tone:"warn"};const r=((w=e.analysis)==null?void 0:w.photos)??[];if(r.length&&r.every(y=>y.usable===!1))return null;const a=di(e),i=a.filter(y=>e.views[y].origin==="photo"),l=a.filter(y=>e.views[y].origin!=="photo"),u=y=>y.length<=2?y.map(Cc).join(" and "):`${y.slice(0,-1).map(Cc).join(", ")} and ${Cc(y[y.length-1])}`,f=i.length?`${I5(u(i))} from your ${i.length===1?"photo":"photos"}.`:"";if(!l.length)return{text:f};const h=l.length>=3&&i.length?"The rest are drawn from them.":`${I5(u(l))} ${l.length===1?"is":"are"} drawn from them.`;return{text:[f,h].filter(Boolean).join(" ")}}const fM=e=>{var t;return(e.activeView?(t=e.views[e.activeView])==null?void 0:t.startedAt:void 0)??e.updatedAt};function hM(e){var r;if(e.stage==="analyzing")return`Reading ${e.source==="photos"?"the photos":"the face"}`;const t=e.activeView;if(!t)return;const n=!!((r=e.views[t])!=null&&r.hash);return t==="portrait"?n?"Adjusting the face":"Drawing the face":`${n?"Redrawing":"Drawing"} the ${xn[t]}`}function Fw(e,t){return pM(t).some(n=>!!e.views[n].hash)}function pM(e){const t=new Set;for(let n=!0;n;){n=!1;for(const r of sM)r===e||t.has(r)||oM[r].some(a=>a===e||t.has(a))&&(t.add(r),n=!0)}return[...t]}function dq(e,t){const n=e.views[t].hash;return n?pM(t).some(r=>{const a=e.views[r];return!!a.hash&&!(a.conditionedOn??[]).includes(n)}):!1}function mM(e,t){const n=new Set,r=[];for(const a of e.results??[])a.view!==t||a.how==="restored"||n.has(a.hash)||(n.add(a.hash),r.push({n:r.length+1,hash:a.hash,current:e.views[t].hash===a.hash}));return r.length>1?r:[]}const fq=["hero","close","hands","angle","bold"],Xa={hero:"Hero",close:"Close-up",hands:"Hands",angle:"Another angle",bold:"A bold one"},bc={place:"Place",hero:"Hero",close:"Close-up",hands:"Hands",angle:"Angle",bold:"Bold"},F5={hero:"hero",close:"close-up",hands:"hands",angle:"other angle",bold:"bold one"},gM=(e,t)=>!!e&&e.status==="running"&&e.roles.includes(t)&&!e.done.includes(t)&&!e.failed.some(n=>n.role===t);function vM(e=[],t){const n=[];for(const r of fq){const a=e.find(l=>l.role===r);if(gM(t,r)||(t==null?void 0:t.status)==="running"&&t.done.includes(r)&&!a){n.push({role:r,state:"drawing",...a?{url:a.url,hash:a.hash}:{}});continue}if(a){n.push({role:r,state:"shown",url:a.url,hash:a.hash,earlier:a.earlier,...a.setup?{setup:a.setup}:{}});continue}const i=t==null?void 0:t.failed.find(l=>l.role===r);i&&n.push({role:r,state:"failed",error:i.error})}return n}function hq(e,t=[],n){return e.filter(r=>!t.some(a=>a.role===r)&&!gM(n,r))}function pq(e=[]){return e.filter(t=>t.earlier).map(t=>t.role)}function _w(e){if(e.status==="failed")return e.error??"The examples did not draw";if(e.status==="cancelled")return"Stopped";const t=e.total?` · ${e.done??0} of ${e.total}`:"";if(e.status==="running"){const n=e.step&&e.step in F5?F5[e.step]:null;return`${n?`Drawing the ${n}`:"Drawing examples"}${t}`}return e.done===1?"One example drawn":`${e.done??0} examples drawn`}function ff(e){const t=co(e);return t.kind==="unknown"?null:[t.title,t.fix].filter(Boolean).join(" ")}const wM=50;function Ga(e){return Date.parse(e.includes("T")?e:`${e.replace(" ","T")}Z`)}function Ya(e){return e.startedAt||e.createdAt}function Gm(e,t=Date.now()){const n=Ga(e);return Number.isNaN(n)?0:Math.max(0,Math.round((t-n)/1e3))}function Vw(e,t=Date.now()){const n=Gm(e,t);return n<20?"generating":n<60?"still generating":"taking longer than usual"}function Dc(e,t=Date.now()){const n=Gm(e,t),r=u=>String(u).padStart(2,"0"),a=Math.floor(n/3600),i=Math.floor(n%3600/60),l=n%60;return a>0?`${a}:${r(i)}:${r(l)}`:`${i}:${r(l)}`}function yM(e,t=Date.now()){const n=Gm(e,t);if(n<45)return"just now";if(n<3600)return`${Math.round(n/60)}m ago`;if(n<86400)return`${Math.floor(n/3600)}h ago`;const r=Math.floor(n/86400);return r===1?"Yesterday":`${r}d ago`}function bM(e){if(!e)return 0;if(e.stage==="discovering")return e.discovered?15:8;if(e.stage==="fetching_products"){const t=Math.max(e.discovered,e.fetched,1);return 15+Math.min(45,Math.round(e.fetched/t*45))}if(e.stage==="processing_assets"){const t=Math.max(e.imagesTotal,1);return 60+Math.min(35,Math.round(e.imagesDone/t*35))}return e.stage==="completed"||e.stage==="no_catalog"?100:e.stage==="partial"?95:5}const xM=e=>e.setNames.length>0?`${e.setNames.join(", ")} · `:"";function mq(e){const t=co(e);return t.kind==="restarted"?t.title:e??"failed"}function k4(e,t,n=Date.now(),r=1){const a=xM(e),i=r>1?`${r} shots`:"ready",l=e.status==="running"?`${a}${Vw(Ya(e),n)}`:e.status==="error"?`${a}${mq(e.error)}`:e.status==="cancelled"?`${a}cancelled`:`${a}${i}`;return{id:`node:${e.id}`,kind:e.kind==="edit"?"edit":"generation",state:e.status,title:e.kind==="edit"?`Edit · ${Dr(e)}`:Dr(e),subtitle:l,thumb:e.images[0]??null,percent:null,startedAt:e.status==="running"?Ya(e):e.createdAt,href:zm(t,null,e.id)}}function gq(e,t,n=Date.now()){var f,h;const r=[...e].sort((p,g)=>(p.batchIndex??0)-(g.batchIndex??0)),a=r[0];if(r.length===1)return k4(a,t,n);const i=r.filter(p=>p.status==="done"&&p.images.length>0),l=r.some(p=>p.status==="running")?"running":i.length?"done":r.some(p=>p.status==="error")?"error":"cancelled",u=k4({...a,status:l,images:((f=i[0])==null?void 0:f.images)??[],error:l==="error"?((h=r.find(p=>p.status==="error"))==null?void 0:h.error)??null:a.error},t,n,r.length);return l==="done"&&i.length<r.length?{...u,subtitle:`${xM(a)}${i.length} of ${r.length} shots`}:u}function vq(e){var t,n;return e.stage==="no_catalog"||e.stage==="failed"&&((n=(t=e.errors)==null?void 0:t[0])==null?void 0:n.code)==="empty_catalog"}const S4="content:library";function wq(e,t){const n={id:S4,kind:"library",thumb:null,startedAt:e.startedAt??t,href:null},r=e.total??0;if(e.arriving)return{...n,state:"running",title:"Downloading the Scenri library",subtitle:r?`${e.landed??0} of ${r} pictures`:"Pictures for the examples, products and presenters",percent:e.totalBytes?Math.min(99,Math.floor((e.bytes??0)/e.totalBytes*100)):null};if(e.outcome==="complete")return{...n,state:"done",title:"Scenri library downloaded",subtitle:r?`${r} pictures for the examples, products and presenters`:"Pictures for the examples",percent:100};if(e.outcome==="partial"){const a=e.failed??0;return{...n,state:"partial",title:"Scenri library partly downloaded",subtitle:`${a} ${a===1?"picture":"pictures"} did not download. Scenri tries again when it next starts.`,percent:null}}return null}function yq(e){return e==="library"?"Downloading the library":e==="catalog"?"Importing":"Rendering"}function bq(e){const t=e.filter(n=>n.state==="running");return t.find(n=>n.kind!=="library")??t[0]??null}function xq(e,t){const n=vq(e),r=n||e.stage==="completed"?"done":e.stage==="partial"?"partial":e.stage==="cancelled"?"cancelled":e.stage==="failed"?"error":"running";let a=e.url;try{a=new URL(e.url).hostname.replace(/^www\./,"")}catch{}const i=e.stage==="discovering"?e.discovered?`Found ${e.discovered.toLocaleString()} products`:"Looking for products":e.stage==="processing_assets"&&e.imagesTotal?`${e.imagesDone.toLocaleString()} of ${e.imagesTotal.toLocaleString()} pictures`:e.stage==="fetching_products"&&e.fetched>e.upserted&&e.discovered?`Reading ${e.fetched.toLocaleString()} of ${e.discovered.toLocaleString()} products`:e.discovered?`${e.upserted.toLocaleString()} of ${e.discovered.toLocaleString()} products`:`${e.upserted.toLocaleString()} products`;return{id:`catalog:${e.id}`,kind:"catalog",state:r,title:a,subtitle:n?"No shop on this site":r==="error"||r==="cancelled"||r==="partial"?e.message??"Import failed":i,thumb:null,percent:n?100:bM(e),startedAt:e.createdAt,href:td(t)}}function kq(e,t){const n=e.stage==="done"?"done":e.stage==="failed"?"error":e.stage==="cancelled"?"cancelled":"running",r=n==="error"?e.error??"failed":n==="cancelled"?"stopped":n==="done"?e.warnings[0]??e.coverage[0]??(e.kind==="presenter"?"Ready to cast":"Ready to use"):e.message??(e.kind==="presenter"?"Building the studio views":"Reading the references");return{id:`build:${e.id}`,kind:e.kind,state:n,title:e.name,subtitle:r,thumb:e.previewHash,percent:e.steps>0?Math.min(100,Math.round(e.step/e.steps*100)):null,startedAt:e.startedAt,href:e.assetId?e.kind==="presenter"?Ra(t,e.assetId):zr(t,e.assetId):null}}function Sq(e){if(e.kind==="examples"){const n=_w(e);return e.status==="done"&&e.error?`${n} · ${Math.max(1,(e.total??0)-(e.done??0))} did not draw`:n}if(e.status==="failed")return e.error??"It did not finish";if(e.status==="cancelled")return"Stopped";if(e.kind==="scene")return e.status==="running"?e.step==="reading"?"Reading the place":e.step==="changing"?"Changing the words":"Drawing the picture":e.job==="change"&&!e.thumb?"The words are changed":e.attachTo?"On its scene now":"The picture is drawn";const t=e.step&&e.step in xn?xn[e.step]:null;return e.status==="running"?t?`Drawing the ${t}`:"Reading the photos":e.awaiting&&t?`The ${t} is ready to look at`:e.total&&e.done===e.total?"Every view is drawn":e.total?`${e.done??0} of ${e.total} views`:"Drawn"}function Eq(e,t){const n=e.status==="failed"?"error":e.status==="done"&&e.error?"partial":e.status,r=e.kind==="examples"?e.sceneId?zr(t,e.sceneId):null:e.kind==="scene"?e.conversation?e.sceneId?$w(t,e.sceneId,e.conversation):ml(t,e.conversation):e.attachTo?zr(t,e.attachTo):null:e.presenterId?Zm(t,e.presenterId):e.draftId?gl(t,e.draftId):null;return{id:e.id,kind:e.kind==="examples"?"scene":e.kind,state:n,title:e.name.trim()||(e.kind==="presenter"?"New presenter":"New scene"),subtitle:Sq(e),thumb:e.thumb,percent:e.kind!=="scene"&&e.total?Math.round((e.done??0)/e.total*100):null,startedAt:e.startedAt,href:r}}const E4=e=>e.startsWith("scene:")||e.startsWith("presenter:")||e.startsWith("examples:");function _5(e,t){return e?e.split("?")[0].replace(/\/$/,"")===t.replace(/\/$/,""):!1}function V5(e,t,n){var l;if(!e.id.startsWith("examples:")||!e.href)return!1;const r=e.href.split("?")[0].split("/").pop(),a=t.match(/\/scenes\/([^/]+)\/edit(?:\/|$)/);if(a)return a[1]===r;const i=t.match(/\/scenes\/new\/([^/]+)/);if(!i)return!1;try{return((l=JSON.parse(Cr.get(`scenri:scene-studio:${n}:${i[1]}`)??"null"))==null?void 0:l.sceneId)===r}catch{return!1}}function Cq(e,t=12){const n=e.filter(a=>a.state==="running"),r=e.filter(a=>a.state!=="running").sort((a,i)=>Ga(i.startedAt)-Ga(a.startedAt)).slice(0,t);return n.sort((a,i)=>Ga(a.startedAt)-Ga(i.startedAt)),[...n,...r]}function jq(e,t,n=new Date){if(!e)return[];const r=[];for(const a of t){if(a.state==="running")continue;const i=e.get(a.id);i&&i.state!=="running"||r.push({id:a.id,kind:a.kind,state:a.state,title:a.title,subtitle:a.subtitle,thumb:a.thumb,at:n.toISOString(),href:a.href})}return r}function Aq(e,t){if(!e)return[];const n=new Set(t.map(r=>r.id));return[...e.values()].filter(r=>r.state==="running"&&!n.has(r.id)&&(E4(r.id)||r.id.startsWith("build:"))).map(r=>({...r,state:"error",subtitle:"Lost when Scenri restarted. Start it again."}))}function Nq(e,t){return e.length===0?null:new Map([...t.map(n=>[n.id,n]),...e.map(n=>[n.id,n])])}function Mq(e,t,n=wM){if(t.length===0)return e;const r=new Set(t.map(a=>a.id));return[...t,...e.filter(a=>!r.has(a.id))].sort((a,i)=>Ga(i.at)-Ga(a.at)).slice(0,n)}function Rq(e,t){const n=e.filter(a=>!a.watched);if(!t)return n.length;const r=Ga(t);return n.filter(a=>Ga(a.at)>r).length}const kM=e=>`scenri:notifications-${e}`,SM=e=>`scenri:notifications-seen-${e}`,EM=e=>Cr.get(e),CM=(e,t)=>Cr.set(e,t);function Z5(e){const t=EM(kM(e));if(!t)return[];try{const n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}}const z5=(e,t)=>CM(kM(e),JSON.stringify(t.slice(0,wM))),B5=e=>EM(SM(e)),Pq=(e,t)=>CM(SM(e),t),jM=e=>`scenri:activity-running-${e}`;function Lq(e){const t=Xc.get(jM(e));if(!t)return[];try{const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>(r==null?void 0:r.state)==="running"):[]}catch{return[]}}const $q=(e,t)=>Xc.set(jM(e),JSON.stringify(t.filter(n=>n.state==="running")));function P8(e,t){return e===t?!0:e.length!==t.length?!1:JSON.stringify(e)===JSON.stringify(t)}const Tq=1500,Dq=5e3,AM=s.createContext(null);function ia(){const e=s.useContext(AM);if(!e)throw new Error("useTaskCenter must be used inside TaskCenterProvider");return e}let U5=null,W5=!1;function Hq({brand:e,onActivity:t,children:n}){const r=Bn(),{push:a}=rr(),{refreshBrands:i,noteContent:l}=Nn(),u=e.id,[f,h]=s.useState([]),[p,g]=s.useState([]),[m,w]=s.useState([]),y=s.useRef(e);y.current=e;const b=s.useRef([]);b.current=p;const[k,S]=s.useState(()=>Z5(u)),[E,C]=s.useState(()=>B5(u)),[A,L]=s.useState(!1),T=s.useRef(null),M=s.useRef(!1),j=s.useRef(null),P=s.useRef(new Set),R=s.useRef(0),H=s.useRef(new Set),D=s.useRef(i);D.current=i;const B=s.useRef(l);B.current=l;const V=s.useRef(null),U=s.useRef(A);U.current=A;const K=s.useRef(r);K.current=r;const{pathname:O}=Un(),F=s.useRef(!1);F.current=/\/(create|sets)(\/|$)/.test(O);const I=s.useRef(a);I.current=a;const G=s.useRef(t);G.current=t,s.useEffect(()=>{T.current=null,P.current=new Set,R.current=0,H.current=new Set,h([]),g([]),w([]),S(Z5(u)),C(B5(u))},[u]);const z=s.useCallback(async()=>{var nt,$e;let se,xe,J;try{const[{nodes:ne,jobs:Q,studio:We=[],boot:Ne,content:ie},{builds:q}]=await Promise.all([Ee.activity(u),Ee.assetBuilds(u)]);if(y.current.id!==u)return;xe=q,J=We,Ne&&j.current&&Ne!==j.current&&(M.current=!0),Ne&&(j.current=Ne),(nt=G.current)==null||nt.call(G,u,ne),B.current(ie),ie!=null&&ie.arriving&&(U5??(U5=new Date().toISOString()));const oe=new Map,Re=[];for(const Ye of ne)Ye.batchId?oe.set(Ye.batchId,[...oe.get(Ye.batchId)??[],Ye]):Re.push(Ye);const ze=Date.now();se=[...Re.map(Ye=>k4(Ye,y.current,ze)),...[...oe.values()].map(Ye=>gq(Ye,y.current,ze)),...Q.map(Ye=>xq(Ye,y.current)),...q.map(Ye=>kq(Ye,y.current)),...We.map(Ye=>Eq(Ye,y.current)),...ie?[wq(ie,U5??new Date().toISOString())].filter(Ye=>Ye!==null):[]]}catch{M.current=!0;return}const te=xe.filter(ne=>ne.finished&&ne.assetId&&!H.current.has(ne.id)),X=new Set(xe.map(ne=>ne.id)),ae=b.current.some(ne=>!ne.finished&&!X.has(ne.id)),Le=J.filter(ne=>ne.kind==="scene"&&ne.status==="done"&&!!ne.attachTo&&!H.current.has(ne.id));for(const ne of Le)H.current.add(ne.id);const ce=J.filter(ne=>ne.kind==="examples"&&(ne.done??0)>0).map(ne=>`${ne.id}:${ne.done}`).filter(ne=>!H.current.has(ne));for(const ne of ce)H.current.add(ne);if(te.length||ae||Le.length||ce.length){for(const ne of te)H.current.add(ne.id),IY(u,ne.kind,ne.id);if(await D.current(),y.current.id!==u)return}g(ne=>P8(ne,xe)?ne:xe),w(ne=>P8(ne,J)?ne:J);const Se=T.current??Nq(Lq(u),se),Ze=M.current?Aq(Se,se):[];M.current=!1;const gt=jq(Se,[...se,...Ze]).filter(ne=>ne.id!==S4?!0:W5?!1:(W5=!0,!0));T.current=new Map(se.map(ne=>[ne.id,ne])),$q(u,se.filter(ne=>ne.id!==S4)),R.current=se.filter(ne=>ne.state==="running").length;const Ke=Cq(se);if(h(ne=>P8(ne,Ke)?ne:Ke),gt.length!==0&&(S(ne=>{const Q=window.location.pathname,We=gt.map(ie=>ie.kind==="library"?ie.state==="done"?{...ie,watched:!0}:ie:E4(ie.id)&&(_5(ie.href,Q)||V5(ie,Q,u))?{...ie,watched:!0}:F.current&&ie.state!=="error"?{...ie,watched:!0}:ie),Ne=Mq(ne,We);return z5(u,Ne),Ne}),!U.current))for(const ne of gt){if(ne.kind==="library"||P.current.has(ne.id)||(P.current.add(ne.id),ne.state==="cancelled"))continue;if(E4(ne.id)){const Ne=window.location.pathname;if(_5(ne.href,Ne)||V5(ne,Ne,u))continue;const ie=ne.href,q=ie?[{label:"Open",onClick:()=>K.current(ie)}]:void 0;if(ne.state==="error"){I.current({kind:"error",title:`${ne.title} did not finish`,detail:ne.subtitle,actions:q});continue}if(ne.state==="partial"){I.current({kind:"warning",title:ne.id.startsWith("examples:")?`Some ${ne.title} examples did not draw`:`${ne.title} did not fully finish`,detail:ne.subtitle,actions:q});continue}I.current({kind:"success",title:ne.id.startsWith("examples:")?`${ne.title} examples are ready`:ne.kind==="scene"&&!ne.thumb?`${ne.title} is changed`:`${ne.title} is drawn`,detail:ne.kind==="presenter"?ne.subtitle:void 0,actions:q});continue}if(ne.state!=="error"&&F.current&&ne.kind!=="presenter"&&ne.kind!=="scene")continue;const Q=ne.href,We=Q?{label:"View",onClick:()=>K.current(Q)}:void 0;if(ne.state==="error"){const Ne=F.current&&(ne.kind==="generation"||ne.kind==="edit");I.current({kind:"error",title:`${ne.title} failed`,detail:ne.subtitle,action:We,quiet:Ne});continue}if(ne.kind==="presenter"||ne.kind==="scene"){const Ne=ne.id.startsWith("build:")?(($e=xe.find(q=>`build:${q.id}`===ne.id))==null?void 0:$e.assetId)??null:null,ie=Sr(y.current);I.current({kind:"success",title:`${ne.title} is ready`,detail:ne.subtitle,actions:Q?[{label:ne.kind==="presenter"?"View presenter":"View scene",onClick:()=>K.current(Q)},{label:"Use in a shot",onClick:()=>K.current(`${ie}?${ne.kind==="presenter"?"presenter":"scene"}=${Ne}&compose=1${Ec()}`)}]:void 0});continue}if(ne.kind==="catalog"&&ne.state==="partial"){I.current({kind:"warning",title:"Some products did not import",detail:ne.subtitle,action:We});continue}I.current({kind:"success",title:ne.kind==="catalog"?"Import finished":"Generation finished",detail:ne.kind==="catalog"?ne.title:void 0,action:We})}},[u]);s.useEffect(()=>{let se=null,xe=!0,J=0;const te=async ae=>{if(!xe||ae!==J||(document.hidden||await z(),!xe||ae!==J))return;const Le=!document.hidden&&R.current>0;se=setTimeout(()=>void te(ae),Le?Tq:Dq)},X=()=>{se&&clearTimeout(se),se=null,J+=1,document.hidden||te(J)};return V.current=X,te(J),document.addEventListener("visibilitychange",X),window.addEventListener("focus",X),()=>{xe=!1,V.current=null,se&&clearTimeout(se),document.removeEventListener("visibilitychange",X),window.removeEventListener("focus",X)}},[z]);const Y=s.useCallback(()=>{var se;return(se=V.current)==null?void 0:se.call(V)},[]),Z=s.useCallback(()=>{const se=new Date().toISOString();C(se),Pq(u,se)},[u]),ee=s.useCallback(()=>{S([]),z5(u,[]),Z()},[u,Z]),pe=s.useMemo(()=>({tasks:f,running:f.filter(se=>se.state==="running").length,builds:p,studio:m,feed:k,unread:Rq(k,E),markSeen:Z,clearFeed:ee,panelOpen:A,setPanelOpen:L,poke:Y}),[f,p,m,k,E,Z,ee,A,Y]);return o.jsx(AM.Provider,{value:pe,children:n})}const NM=["primary","mark","wordmark","monochrome","alternate"],Zw=["light","dark","any"],Ph={primary:"Primary logo",mark:"Mark",wordmark:"Wordmark",monochrome:"Monochrome",alternate:"Alternate"},Oq=/^[a-f0-9]{32}$/,Iq=e=>{const t=String(e??"");if(!t.startsWith("asset:"))return null;const n=t.slice(6);return Oq.test(n)?n:null},Fq=e=>NM.includes(e)?e:"primary",_q=e=>Zw.includes(e)?e:"any";function n1(e){return(Array.isArray(e==null?void 0:e.logos)?e.logos:[]).filter(n=>n&&String(n.file??"").trim()).map(n=>{const r=Iq(n.file),a=String(n.clearSpace??"").trim();return{hash:r,file:String(n.file),role:Fq(n.role),background:_q(n.background),...a?{clearSpace:a}:{},attachable:r!==null}})}function r1(e){return n1(e).filter(t=>t.attachable)}function Ym(e){return e.find(t=>t.role==="primary")??e[0]??null}function Vq(e){return Ym(n1(e))}function Zq(e){const t=n1(e);return t.find(n=>n.role==="mark")??Ym(t)}function zq(e){const t=n1(e).filter(a=>a.hash),n=t.find(a=>a.role==="mark");if(n)return{mark:n,square:!0};const r=Ym(t);return!r||r.role==="wordmark"?null:{mark:r,square:!1}}const Bq=1.6,Uq=(e,t)=>t>0&&e/t<=Bq;function Wq(e,t){const n=(i,l)=>Math.min(l-1,Math.max(0,Math.round(i*(l-1))));return[[n(.5,e),n(.03,t)],[n(.5,e),n(1-.03,t)],[n(.03,e),n(.5,t)],[n(1-.03,e),n(.5,t)],[n(.12,e),n(.12,t)],[n(1-.12,e),n(.12,t)],[n(.12,e),n(1-.12,t)],[n(1-.12,e),n(1-.12,t)]]}const Kq=e=>e.length>0&&e.every(t=>t>=200);function qm(e,t){var a;const n={primary:"logo",mark:"mark",wordmark:"wordmark",monochrome:"monochrome logo",alternate:"alternate logo"},r=String(((a=e==null?void 0:e.meta)==null?void 0:a.name)??"").trim();return r?`${r} ${n[t.role]}`:`Brand ${n[t.role]}`}function zw(e){const{brand:t}=cn(),{pathname:n}=Un(),r=!!mn(mt.brand),a=!!mn({path:mt.hub,end:!1}),i=!!mn({path:mt.set,end:!1}),l=a||i,u=!!mn({path:mt.products,end:!1}),f=!!mn({path:mt.scenes,end:!1}),h=!!mn({path:mt.presenters,end:!1}),p=g=>g?"fill":"regular";return[{key:"home",label:"Home",icon:o.jsx(iF,{size:e,weight:p(r)}),active:r,to:To(t)},{key:"create",label:"Create",icon:o.jsx(vF,{size:e,weight:p(l)}),active:l,to:l?`${n}?compose=1`:`${Sr(t)}?compose=1`},{key:"products",label:"Products",icon:o.jsx(mm,{size:e,weight:p(u)}),active:u,to:td(t)},{key:"presenters",label:"Presenters",icon:o.jsx(hm,{size:e,weight:p(h)}),active:h,to:ui(t)},{key:"scenes",label:"Scenes",icon:o.jsx(fm,{size:e,weight:p(f)}),active:f,to:pl(t)}]}const Ca=e=>{var t,n;return((n=(t=e.json)==null?void 0:t.meta)==null?void 0:n.name)??e.slug};function Gq(e){return([...e.trim()].find(n=>new RegExp("\\p{L}|\\p{N}","u").test(n))??"?").toUpperCase()}function Yq(e){const t=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!t)return"#ffffff";const[n,r,a]=[0,2,4].map(l=>Number.parseInt(t[1].slice(l,l+2),16)/255),i=l=>l<=.03928?l/12.92:((l+.055)/1.055)**2.4;return .2126*i(n)+.7152*i(r)+.0722*i(a)>.42?"#0a0a0a":"#ffffff"}const K5=new Map;function qq(e,t){const n=e.naturalWidth,r=e.naturalHeight,a=t||Uq(n,r);let i=!1;try{const l=document.createElement("canvas");l.width=n,l.height=r;const u=l.getContext("2d",{willReadFrequently:!0});u&&(u.drawImage(e,0,0),i=Kq(Wq(n,r).map(([f,h])=>u.getImageData(f,h,1,1).data[3])))}catch{}return{fits:a,bleed:i}}function MM({brand:e,size:t=20,round:n=!1}){var h,p,g;const[,r]=s.useReducer(m=>m+1,0),a=zq(e.json),i=a?Vm(a.mark.file,"micro"):null,l=i?K5.get(i):void 0,u=i&&(l!=null&&l.fits)?i:null,f=((g=(p=(h=e.json)==null?void 0:h.palette)==null?void 0:p.primary)==null?void 0:g.hex)??"#6b6b6b";return o.jsxs("span",{className:"sc-brand-av","data-logo":u?"":void 0,"data-bleed":u&&(l!=null&&l.bleed)?"":void 0,"data-round":n||void 0,style:{width:t,height:t,fontSize:Math.round(t*.5),...u?{}:{background:f,color:Yq(f)}},"aria-hidden":!0,children:[u?o.jsx("img",{src:u,alt:""}):Gq(Ca(e)),i&&!l&&o.jsx("img",{src:i,alt:"",hidden:!0,onLoad:m=>{K5.set(i,qq(m.currentTarget,!!(a!=null&&a.square))),r()}})]})}function Xq(){const e=zw(22);return o.jsx("nav",{className:"sc-tabbar","aria-label":"Main",children:o.jsx("ul",{children:e.map(t=>o.jsx("li",{children:o.jsxs(Vn,{to:t.to,"data-on":t.active||void 0,"data-guide":`nav.${t.key}`,"aria-current":t.active?"page":void 0,children:[o.jsx("span",{className:"sc-tab-ic",children:t.icon}),o.jsx("span",{className:"sc-tab-lb",children:t.label})]})},t.key))})})}function Qq({value:e,size:t,stroke:n=1.5,indeterminate:r=!1}){const a=(t-n)/2,i=2*Math.PI*a,l=Math.max(0,Math.min(1,e)),u=f=>o.jsx("circle",{className:"sc-ring-arc",cx:t/2,cy:t/2,r:a,fill:"none",strokeWidth:n,strokeLinecap:"round",strokeDasharray:f,strokeDashoffset:r?0:i*(1-l),transform:`rotate(-90 ${t/2} ${t/2})`});return o.jsxs("svg",{className:"sc-ring",width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:[!r&&o.jsx("circle",{className:"sc-ring-track",cx:t/2,cy:t/2,r:a,fill:"none",strokeWidth:n}),r?o.jsx("g",{className:"sc-ring-spin",children:u(`${i*.28} ${i}`)}):null,!r&&l>0?u(String(i)):null]})}function Jq({mode:e,lead:t,running:n,unread:r,animate:a}){const i=eX(a);if(e==="busy"&&t){const l=t.percent!==null;return o.jsx("span",{className:"sc-act-face","data-swap":i||void 0,"aria-hidden":"true",children:o.jsxs("span",{className:"sc-act-ring","data-bare":t.thumb?void 0:"",children:[o.jsx(Qq,{value:l?(t.percent??0)/100:0,indeterminate:!l,size:32}),t.thumb?o.jsx("img",{src:gn(t.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):o.jsx(o8,{size:16}),n>1&&o.jsx("span",{className:"sc-act-n",children:n})]})})}return e==="new"?o.jsx("span",{className:"sc-act-face","data-swap":i||void 0,"aria-hidden":"true",children:o.jsxs("span",{className:"sc-act-bell",children:[o.jsx(o8,{size:18}),o.jsx("span",{className:"sc-act-n",children:r>9?"9+":r})]})}):o.jsx("span",{className:"sc-act-face","data-swap":i||void 0,"aria-hidden":"true",children:o.jsx(o8,{size:18})})}function eX(e){return s.useRef(e).current}const Mp=new Set;let nd=0;const RM=e=>{nd=requestAnimationFrame(RM);for(const t of Mp)t(e/1e3)};function PM(e){Mp.add(e),nd||(nd=requestAnimationFrame(RM))}function LM(e){Mp.delete(e),!Mp.size&&nd&&(cancelAnimationFrame(nd),nd=0)}function tX(e){let t=[0],n=1;for(;n<e;){const r=n*2,a=new Array(r*r);for(let i=0;i<r;i++)for(let l=0;l<r;l++)a[i*r+l]=4*t[i%n*n+l%n]+[0,2,3,1][Math.floor(i/n)*2+Math.floor(l/n)];t=a,n=r}return t}function nX(e,t,n){const r=tX(e).map(i=>(i+.5)/(e*e)),a=new Float32Array(t*n);for(let i=0,l=0;i<n;i++)for(let u=0;u<t;u++,l++)a[l]=r[i%e*e+u%e];return a}function U0(e){const t=getComputedStyle(e),n=G5(t.getPropertyValue("--sc-fg").trim()||"#f5f5f5"),r=G5(t.getPropertyValue("--sc-raised").trim()||"#1a1a1a");return{ink:[0,1,2].map(a=>Math.round(n[a]*.22+r[a]*.78)),ground:r}}const C4=e=>(255<<24|e[2]<<16|e[1]<<8|e[0])>>>0,L8=(e,t,n)=>(.2126*e+.7152*t+.0722*n)/255,hf=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function rX(e){const t=new MutationObserver(e);t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});const n=window.matchMedia("(prefers-color-scheme: dark)");return n.addEventListener("change",e),()=>{t.disconnect(),n.removeEventListener("change",e)}}function G5(e){const t=document.createElement("canvas");t.width=t.height=1;const n=t.getContext("2d");if(!n)return[110,110,110];n.fillStyle=e,n.fillRect(0,0,1,1);const r=n.getImageData(0,0,1,1).data;return[r[0],r[1],r[2]]}const Ru=2,sX=8,$M=.55,TM=Math.PI*2,aX=e=>e<0?0:e>1?1:e,DM=e=>e-Math.floor(e),Bw=e=>{const t=aX(e);return t*t*(3-2*t)},Rp=(e,t,n)=>Bw((e-t)/(n-t)),Uw=(e,t)=>4*(.35*e+.8*t)/TM;function oX(e){const t=Math.min(1,Math.max(.3,e/240));return{short:e*t,gain:1+(1-t)*.6}}function HM(e,t){const n=Math.max(4,Math.round(e/Ru)),r=Math.max(4,Math.round(t/Ru)),a=n*Ru,i=r*Ru,{short:l,gain:u}=oX(Math.min(a,i)),f=new Float32Array(n*r),h=new Float64Array(n*r),p=new Float64Array(n*r);for(let g=0,m=0;g<r;g++)for(let w=0;w<n;w++,m++){const y=((w+.5)*Ru-a/2)/l,b=-((g+.5)*Ru-i/2)/l,k=Math.hypot(y,b);f[m]=u*$M*Bw(k**1.2),h[m]=1/Math.max(k,1e-6)**1.2,p[m]=6*Math.atan2(b,y)/TM}return{w:n,h:r,shape:f,curl:h,arm:p,thr:nX(sX,n,r)}}const iX=.6,lX=(e,t)=>t===null?1:Bw((e-t)/iX);function j4(e,t,n,r){const a=e.getContext("2d"),i=C4(t.ink);let l=null,u=null,f=new Uint32Array(0);return{size(h,p){a&&(l=HM(h,p),e.width=l.w,e.height=l.h,u=a.createImageData(l.w,l.h),f=new Uint32Array(u.data.buffer))},draw(h){if(!a||!l||!u)return;const p=lX(h,r),g=Uw(h,n),{shape:m,curl:w,arm:y,thr:b}=l;for(let k=0;k<f.length;k++)f[k]=m[k]*p*DM(w[k]+y[k]+g)>b[k]?i:0;a.putImageData(u,0,0)}}}function OM(e,t,n,r,a){const i=e.getContext("2d"),{w:l,h:u,shape:f,curl:h,arm:p,thr:g}=HM(r,a);e.width=l,e.height=u;const m=document.createElement("canvas");m.width=l,m.height=u;const w=m.getContext("2d",{willReadFrequently:!0});if(!i||!w)return null;w.imageSmoothingQuality="high";const y=Math.max(l/t.naturalWidth,u/t.naturalHeight),b=l/y,k=u/y;w.drawImage(t,(t.naturalWidth-b)/2,(t.naturalHeight-k)/2,b,k,0,0,l,u);const S=w.getImageData(0,0,l,u).data,E=L8(...n.ink)>L8(...n.ground),C=new Float32Array(l*u),A=new Float32Array(l*u);for(let R=0;R<C.length;R++){const H=R*4,D=L8(S[H],S[H+1],S[H+2]);C[R]=$M*(E?D:1-D);const B=C[R]>g[R]?n.ink:n.ground,V=(Math.abs(B[0]-S[H])+Math.abs(B[1]-S[H+1])+Math.abs(B[2]-S[H+2]))/765;A[R]=(1-V+g[R])/2}const L=dX(A),T=C4(n.ink),M=C4(n.ground),j=i.createImageData(l,u),P=new Uint32Array(j.data.buffer);return(R,H,D)=>{for(let B=0;B<P.length;B++){if(L[B]<H){P[B]=0;continue}const V=f[B]*DM(h[B]+p[B]+D);P[B]=V+(C[B]-V)*R>g[B]?T:M}i.putImageData(j,0,0)}}const Pp=900;function cX(e,t,n,r,a,i,l){const u=OM(e,t,n,a,i),f=Pp/1e3;return{ms:Pp,draw(h){const p=Math.min(h,.6);u==null||u(Rp(h,0,.6),Rp(h,.35,1),Uw(l+f*(p-p*p/1.2),r))}}}function uX(e,t,n,r,a,i,l){const u=OM(e,t,n,a,i),f=Pp/1e3;return{ms:Pp,draw(h){const p=Math.max(0,h-.4);u==null||u(1-Rp(h,.4,1),1-Rp(h,0,.65),Uw(l+f-f*(.36-p*p)/1.2,r))}}}function dX(e){const n=l=>Math.min(1023,Math.floor(l*1024)),r=new Uint32Array(1024);for(let l=0;l<e.length;l++)r[n(e[l])]++;const a=new Float64Array(1024);for(let l=1;l<1024;l++)a[l]=a[l-1]+r[l-1];const i=new Float32Array(e.length);for(let l=0;l<e.length;l++){const u=n(e[l]);i[l]=(a[u]+r[u]/2)/e.length}return i}const fX=4;let qi=null;function hX(e,t){var l;const n=performance.now()/1e3,r=qi&&Date.now()-qi.epoch<2500?qi:null;if(e)return r||(qi={perf:n,epoch:Date.now()}),((l=r??qi)==null?void 0:l.perf)??n;if(!t)return null;const a=Ga(t);if(Number.isNaN(a))return null;const i=(Date.now()-a)/1e3;return i>fX?null:qi&&Math.abs(a-qi.epoch)<2500?qi.perf:n-Math.max(0,i)}const Lh=new Map;function Pa({index:e=0,appear:t,since:n,from:r}){const a=s.useRef(null),i=s.useRef(null),[l]=s.useState(()=>hX(t,n)),[u]=s.useState(r),[f,h]=s.useState(()=>!!u&&!hf());return s.useLayoutEffect(()=>{const p=a.current;if(!(p!=null&&p.getContext("2d")))return;const g=hf(),m=i.current,w=u&&(m!=null&&m.complete)&&m.naturalWidth?u:null,y=g||w?null:l;let b=j4(p,U0(p),e,y),k=!0;const S=()=>{const R=p.getBoundingClientRect();R.width<2||R.height<2||(b.size(R.width,R.height),b.draw(performance.now()/1e3))};let E=null,C=0,A=0;const L=()=>{E=null,m&&(m.style.visibility="hidden"),h(!1),S()};if(w&&m){const R=p.getBoundingClientRect(),H=performance.now();for(const[B,V]of Lh)H-V>1e4&&Lh.delete(B);const D=Lh.get(w.at)??H;Lh.set(w.at,D),E=uX(p,m,U0(p),e,R.width,R.height,D/1e3),C=H-D,A=H,C<E.ms?E.draw(C/E.ms):L()}else m?L():S();const T=R=>{if(E){const H=R*1e3;C+=Math.min(50,Math.max(0,H-A)),A=H,C<E.ms?E.draw(C/E.ms):L()}else k&&b.draw(R)},M=new ResizeObserver(()=>{E||S()});M.observe(p);const j=new IntersectionObserver(([R])=>{k=R.isIntersecting});j.observe(p);const P=rX(()=>{b=j4(p,U0(p),e,y),E||S()});return g||PM(T),()=>{LM(T),M.disconnect(),j.disconnect(),P()}},[e,l,u]),o.jsxs("span",{className:"sc-rendering","aria-hidden":!0,children:[f&&u&&o.jsx("img",{ref:i,className:"sc-rendering-from",src:u.src,alt:"",decoding:"sync"}),o.jsx("canvas",{ref:a,className:"sc-swirl"})]})}function Y5({onClose:e,onSeen:t,onOpenDetail:n}){const{tasks:r,feed:a,unread:i,clearFeed:l}=ia(),u=r.filter(S=>S.state==="running"),{brand:f}=cn(),{push:h}=rr(),p=gX(1e3),g=s.useRef(null),m=s.useRef(null),w=s.useRef(!1);s.useEffect(()=>{var S;!w.current||a.length>0||(w.current=!1,(S=g.current)==null||S.focus({preventScroll:!0}))},[a.length]);const y=()=>{w.current=!0,l()},b=S=>{var E;S.detail===0&&((E=m.current)==null||E.focus({preventScroll:!0})),t()},k=S=>{if(S.startsWith("node:")){Ee.cancelNode(S.slice(5)).catch(E=>h(ln(E,"Could not cancel this shot")));return}if(S.startsWith("build:")){Ee.cancelAssetBuild(f.id,S.slice(6)).catch(E=>h(ln(E,"Could not stop this build")));return}if(S.startsWith("scene:")){Ee.cancelSceneStudioJob(f.id,S.slice(6)).catch(E=>h(ln(E,"Could not stop this scene")));return}if(S.startsWith("presenter:")){const E=S.split(":")[1]??"";Ee.stopDraft(f.id,E).catch(C=>h(ln(C,"Could not stop this presenter")));return}S.startsWith("catalog:")&&Ee.cancelCatalogJob(f.id,S.slice(8)).catch(E=>h(ln(E,"Could not stop this import")))};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-menu-head",children:"Activity"}),u.length>0&&o.jsxs("section",{"aria-label":"In progress",children:[o.jsx("h3",{className:"sc-notif-label",children:"In progress"}),u.map(S=>o.jsx(pX,{task:S,now:p,onNavigate:e,onCancel:k,onOpenDetail:n},S.id))]}),a.length===0&&u.length===0?o.jsx("p",{ref:g,tabIndex:-1,className:"sc-notif-empty",children:"Work that finishes shows up here."}):o.jsxs("section",{"aria-label":"Notifications",children:[o.jsxs("div",{className:"sc-notif-label",children:[o.jsx("h3",{children:"Notifications"}),a.length>0&&o.jsxs("span",{className:"sc-notif-acts",children:[i>0&&o.jsx("button",{type:"button",className:"sc-notif-seen",onClick:b,children:"Mark all read"}),o.jsx("button",{ref:m,type:"button",className:"sc-notif-clear",onClick:y,children:"Clear all"})]})]}),a.length===0?o.jsx("p",{ref:g,tabIndex:-1,className:"sc-notif-empty",children:"Work that finishes shows up here."}):o.jsx("div",{className:"sc-notif-scroll",children:a.map(S=>o.jsx(mX,{item:S,now:p,onNavigate:e,onSeen:t},S.id))})]})]})}function IM({task:e}){return e.thumb?o.jsx("img",{src:gn(e.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):e.state==="running"?e.kind==="catalog"||e.kind==="library"?o.jsx("span",{className:"sc-placeholder"}):o.jsx(Pa,{}):e.state==="error"?o.jsx(zc,{size:17,weight:"fill"}):e.state==="cancelled"?o.jsx(SF,{size:17,color:"var(--sc-fg3)"}):e.kind==="catalog"?o.jsx(cC,{size:17}):e.kind==="library"?o.jsx(cF,{size:17}):e.kind==="presenter"?o.jsx(hm,{size:17}):e.kind==="scene"?o.jsx(fm,{size:17}):o.jsx(Ta,{size:17})}function pX({task:e,now:t,onNavigate:n,onCancel:r,onOpenDetail:a}){const i=e.state==="running",l=e.id.startsWith("node:")||e.id.startsWith("build:")||e.id.startsWith("catalog:"),u=i&&e.id.startsWith("catalog:")?e.id.slice(8):null,f=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-notif-thumb",children:o.jsx(IM,{task:e})}),o.jsxs("span",{className:"sc-notif-txt",children:[o.jsx("b",{dir:"auto",children:e.title}),o.jsx("small",{dir:"auto",children:e.subtitle}),i&&e.percent!==null?o.jsx("span",{className:"sc-notif-meter",role:"progressbar","aria-label":e.title,"aria-valuenow":e.percent,"aria-valuemin":0,"aria-valuemax":100,children:o.jsx("div",{style:{width:`${e.percent}%`}})}):null]}),o.jsx("span",{className:"sc-notif-time",children:i?Dc(e.startedAt,t):yM(e.startedAt,t)})]});return o.jsxs("div",{className:"sc-notif-row-wrap",children:[u?o.jsx("button",{type:"button",className:"sc-notif-row","data-state":e.state,"data-running":i||void 0,onClick:()=>a(u),children:f}):e.href?o.jsx(Vn,{className:"sc-notif-row","data-state":e.state,"data-running":i||void 0,to:e.href,onClick:n,children:f}):o.jsx("button",{type:"button",className:"sc-notif-row","data-state":e.state,"data-running":i||void 0,disabled:!0,children:f}),i&&l&&o.jsx("button",{type:"button",className:"sc-notif-row-cancel",onClick:h=>{h.stopPropagation(),r(e.id)},children:"Cancel"})]})}function mX({item:e,now:t,onNavigate:n,onSeen:r}){const a=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-notif-thumb",children:o.jsx(IM,{task:e})}),o.jsxs("span",{className:"sc-notif-txt",children:[o.jsx("b",{dir:"auto",children:e.title}),o.jsx("small",{dir:"auto",children:e.subtitle})]}),o.jsx("span",{className:"sc-notif-time",children:yM(e.at,t)})]});return e.href?o.jsx(Vn,{className:"sc-notif-row","data-state":e.state,to:e.href,onClick:()=>{r(),n()},children:a}):o.jsx("button",{type:"button",className:"sc-notif-row","data-state":e.state,disabled:!0,children:a})}function gX(e){const[t,n]=s.useState(()=>Date.now());return s.useEffect(()=>{const r=setInterval(()=>n(Date.now()),e);return()=>clearInterval(r)},[e]),t}function $d(e){const t=s.useRef(null),n=s.useRef(null),r=s.useRef(0),a=u=>{u.pointerType==="mouse"&&u.button!==0||(n.current={y:u.clientY,t:u.timeStamp},r.current=0,t.current&&(t.current.style.transition="none"),u.currentTarget.setPointerCapture(u.pointerId))},i=u=>{!n.current||!t.current||(r.current=Math.max(0,u.clientY-n.current.y),t.current.style.transform=`translateY(${r.current}px)`)},l=u=>{const f=n.current;if(n.current=null,!f||!t.current)return;t.current.style.transition="";const h=r.current/Math.max(1,u.timeStamp-f.t);if(r.current>96||h>.45){e();return}t.current.style.transform=""};return{sheet:t,grip:{onPointerDown:a,onPointerMove:i,onPointerUp:l,onPointerCancel:l}}}function FM({label:e,onClose:t,children:n}){const{sheet:r,grip:a}=$d(t);return s.useEffect(()=>{const i=l=>{l.key==="Escape"&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]),Br.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-notif-scrim",onClick:t,"aria-hidden":!0}),o.jsxs("div",{ref:r,className:"sc-notif-sheet",role:"dialog","aria-modal":"true","aria-label":e,children:[o.jsx("div",{className:"sc-shotsheet-grip",...a,children:o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0})}),n]})]}),document.body)}function _M(e,t){const{pathname:n}=Un(),r=s.useRef(t);r.current=t,s.useEffect(()=>{r.current()},[n]),s.useEffect(()=>{if(!e)return;const a=()=>r.current();return window.addEventListener("scenri:modal-open",a),()=>window.removeEventListener("scenri:modal-open",a)},[e])}const vX=new Set(["Shift","Control","Alt","AltGraph","Meta","CapsLock","Fn","FnLock","Hyper","Super","OS"]);let Lp=null;function q5(e){Lp!==e&&(Lp=e,document.documentElement.dataset.input=e)}function wX(){const e=n=>{n.isComposing||n.key==="Unidentified"||vX.has(n.key)||q5("keyboard")},t=()=>q5("pointer");return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",t,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",t,!0)}}function yX(){return Lp}function Xm(e){return Lp!=="pointer"&&e.matches(":focus-visible")}function fr({label:e,open:t,children:n}){return o.jsx(Pw,{content:e,className:"sc-tip",maxWidth:"220px",...t?{open:!0}:{},children:ZM(n)})}function VM(e,t,n){return n?t:o.jsx(fr,{label:e,children:t})}function ZM(e){const t=e.props.onFocus;return s.cloneElement(e,{onFocus:n=>{t==null||t(n),yX()==="pointer"&&n.preventDefault()}})}function Ws({open:e=!0,className:t,maxWidth:n,described:r,children:a,onDismiss:i,onOpenAutoFocus:l,onCloseAutoFocus:u,onPaste:f,tone:h}){const{sheet:p,grip:g}=$d(i);s.useEffect(()=>{e&&window.dispatchEvent(new CustomEvent("scenri:modal-open"))},[e]);const m=l??WN,w=u;return o.jsx(Ml,{open:e,onOpenChange:y=>!y&&i(),children:o.jsxs(Rl,{children:[o.jsx(Pl,{className:"sc-newdlg-scrim","data-tone":h}),o.jsx(Ll,{className:"sc-newdlg-layer",...r?{}:{"aria-describedby":void 0},onOpenAutoFocus:m,onCloseAutoFocus:w,onPaste:f,onPointerDown:y=>{y.target===y.currentTarget&&i()},children:o.jsxs("div",{ref:p,className:["sc-newdlg",t].filter(Boolean).join(" "),style:n?{"--sc-newdlg-max":n}:void 0,children:[o.jsx("div",{className:"sc-shotsheet-grip",...g,children:o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0})}),a]})})]})})}function Ns({className:e,children:t}){return o.jsx($l,{className:e,children:t})}const Ms=s.forwardRef(function({children:t,...n},r){return o.jsx(Of,{asChild:!0,ref:r,...n,children:t})});function Hc({className:e,asChild:t,children:n}){return o.jsx(Uv,{className:e,asChild:t,children:n})}const X5=300,bX={queued:"Waiting to start",discovering:"Looking through the site",fetching_products:"Reading products",processing_assets:"Saving pictures",completed:"Finished",partial:"Finished, with some gaps",no_catalog:"No shop on this site",cancelled:"Stopped",failed:"Could not finish"};function A4({brandId:e,jobId:t,onDismiss:n}){const[r,a]=s.useState(null),[i,l]=s.useState(!1);s.useEffect(()=>{let g=!1,m;const w=async()=>{try{const y=await Ee.catalogJob(e,t);if(g)return;a(y),y.finishedAt||(m=setTimeout(w,X5))}catch{g||(m=setTimeout(w,X5*3))}};return w(),()=>{g=!0,m&&clearTimeout(m)}},[e,t]);const u=!!r&&!r.finishedAt,f=r?bM(r):0,h=(r==null?void 0:r.errors)??[],p=async()=>{l(!0);try{await Ee.cancelCatalogJob(e,t)}catch{l(!1)}};return o.jsxs(Ws,{open:!0,className:"sc-imp",maxWidth:"440px",described:!0,onDismiss:n,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Importing products"}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})]}),o.jsx(Hc,{className:"sc-imp-sub",children:o.jsxs("span",{role:"status",children:[r?bX[r.stage]??"Working":"Getting the details",r!=null&&r.message?` · ${r.message}`:""]})}),u&&o.jsx("span",{className:"sc-imp-meter",role:"progressbar","aria-label":"Import progress","aria-valuenow":f,"aria-valuemin":0,"aria-valuemax":100,children:o.jsx("div",{style:{width:`${f}%`}})}),o.jsxs("ul",{className:"sc-imp-lines",children:[o.jsxs("li",{children:[o.jsx("span",{children:"Found on the site"}),o.jsx("b",{children:((r==null?void 0:r.discovered)??0).toLocaleString()})]}),o.jsxs("li",{children:[o.jsx("span",{children:"Read"}),o.jsx("b",{children:((r==null?void 0:r.fetched)??0).toLocaleString()})]}),o.jsxs("li",{children:[o.jsx("span",{children:"Saved"}),o.jsx("b",{children:((r==null?void 0:r.upserted)??0).toLocaleString()})]}),o.jsxs("li",{children:[o.jsx("span",{children:"Pictures"}),o.jsxs("b",{children:[((r==null?void 0:r.imagesDone)??0).toLocaleString(),r!=null&&r.imagesTotal?` of ${r.imagesTotal.toLocaleString()}`:""]})]})]}),h.length>0&&o.jsxs("details",{className:"sc-imp-errs",children:[o.jsx("summary",{children:h.length===1?"1 thing went wrong":`${h.length} things went wrong`}),o.jsx("ul",{children:h.slice(0,8).map((g,m)=>o.jsx("li",{children:g.message},m))})]}),o.jsxs("div",{className:"sc-imp-foot",children:[u?o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void p(),disabled:i,children:i?"Stopping":"Stop importing"}):o.jsx("span",{className:"sc-imp-done",children:(r==null?void 0:r.stage)==="cancelled"?"Stopped. What was already imported is kept.":"Nothing left to do."}),o.jsx("button",{type:"button",className:"sc-wiz-cta",onClick:n,children:u?"Leave it running":"Close"})]})]})}const la="(max-width: 767px)";function Nr(e){const[t,n]=s.useState(()=>window.matchMedia(e).matches);return s.useEffect(()=>{const r=window.matchMedia(e),a=()=>n(r.matches);return a(),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),t}const Q5=new Map;function xX(e){let t=Q5.get(e);if(!t){const n=window.matchMedia(e);t={mq:n,subscribe:r=>(n.addEventListener("change",r),()=>n.removeEventListener("change",r))},Q5.set(e,t)}return t}function Ww(){const e=xX("(hover: none)");return s.useSyncExternalStore(e.subscribe,()=>e.mq.matches,()=>!1)}function kX(){const{tasks:e,running:t,unread:n,panelOpen:r,setPanelOpen:a,markSeen:i}=ia(),{brand:l}=cn(),u=Nr(la),f=SX(),[h,p]=s.useState(null);s.useEffect(()=>p(null),[l.id]),_M(r,()=>a(!1));const g=bq(e),m=t>0?"busy":n>0?"new":"quiet",w="Activity"+(n?`, ${n} unread`:"")+(t?`, ${t} task${t===1?"":"s"} running`:""),y=m==="busy"&&g?`${yq(g.kind)}, ${Dc(g.startedAt,Date.now())}`:"Activity",b=o.jsx(Jq,{mode:m,lead:g,running:t,unread:n,animate:f});return u?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"sc-act-btn sc-notif-btn","data-mode":m,"data-on":r||void 0,"aria-label":w,"aria-expanded":r,onClick:()=>a(!r),children:b}),r?o.jsx(FM,{label:"Activity",onClose:()=>a(!1),children:o.jsx(Y5,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})}):null,h?o.jsx(A4,{brandId:l.id,jobId:h,onDismiss:()=>p(null)}):null]}):o.jsxs(o.Fragment,{children:[o.jsxs(gd,{open:r,onOpenChange:a,children:[o.jsx(fr,{label:y,children:o.jsx(vd,{children:o.jsx("button",{type:"button",className:"sc-act-btn sc-notif-btn","data-mode":m,"aria-label":w,children:b})})}),o.jsx(wd,{align:"end",sideOffset:20,className:"sc-notif-pop","aria-label":"Activity",children:o.jsx(Y5,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})})]}),h?o.jsx(A4,{brandId:l.id,jobId:h,onDismiss:()=>p(null)}):null]})}function SX(){const[e,t]=s.useState(!1),n=s.useRef(!1);return s.useEffect(()=>{n.current||(n.current=!0,t(!0))},[]),e}function EX(){const e=zw(16);return o.jsx("nav",{className:"sc-nav sc-desktop-only","aria-label":"Main",children:o.jsx("ul",{children:e.map(t=>o.jsx("li",{children:o.jsx(Vn,{to:t.to,"data-active":t.active||void 0,"data-guide":`nav.${t.key}`,"aria-current":t.active?"page":void 0,children:t.label})},t.key))})})}const N4=s.createContext(null);function zM({label:e,className:t,offset:n=22,trigger:r,children:a}){const i=Nr(la),[l,u]=s.useState(!1),f=s.useRef(null),h=()=>u(!1),p=s.useCallback(()=>{var g;return(g=f.current)==null?void 0:g.focus({preventScroll:!0})},[]);return _M(l,h),i?o.jsxs(o.Fragment,{children:[s.cloneElement(r,{ref:f,onClick:()=>u(!l),"aria-haspopup":"dialog","aria-expanded":l,"data-on":l||void 0}),l&&o.jsx(FM,{label:e,onClose:h,children:o.jsxs("div",{className:"sc-menu-sheet",children:[o.jsx("div",{className:"sc-menu-head",children:e}),o.jsx(N4.Provider,{value:{close:h,focusTrigger:p},children:a})]})})]}):o.jsxs(Cs,{open:l,onOpenChange:u,modal:!1,children:[o.jsx(js,{children:s.cloneElement(r,{ref:f})}),o.jsxs(As,{align:"end",sideOffset:n,className:`sc-menu ${t??""}`,onPointerDownOutside:g=>{var m;(m=f.current)!=null&&m.contains(g.target)&&g.preventDefault()},onCloseAutoFocus:g=>{g.preventDefault();const m=document.activeElement;(!m||m===document.body)&&p()},children:[o.jsx("div",{className:"sc-menu-head",children:e}),o.jsx(N4.Provider,{value:{close:null,focusTrigger:p},children:a})]})]})}function rd({className:e="sc-menu-item",to:t,onSelect:n,disabled:r,children:a,...i}){const l=s.useContext(N4),u=l==null?void 0:l.close,f=n?()=>{l==null||l.focusTrigger(),setTimeout(()=>{l==null||l.focusTrigger(),n()},0)}:void 0;if(u){const h=()=>{u(),f==null||f()};return t?o.jsx(Vn,{className:e,to:t,onClick:u,...i,children:a}):o.jsx("button",{type:"button",className:e,onClick:h,disabled:r,...i,children:a})}return t?o.jsx(qn,{asChild:!0,className:e,...i,children:o.jsx(Vn,{to:t,children:a})}):o.jsx(qn,{className:e,onSelect:f,disabled:r,...i,children:a})}function BM(e,t){return[...e].sort((n,r)=>t(n).localeCompare(t(r),void 0,{sensitivity:"base"})||n.slug.localeCompare(r.slug))}function CX(e,t,n){const r=t.trim().toLowerCase(),a=r?e.filter(i=>n(i).toLowerCase().includes(r)||i.slug.toLowerCase().includes(r)):e;return BM(a,n)}function Xn({label:e,title:t,body:n,busy:r,onConfirm:a,fullWidth:i,open:l,onOpenChange:u,tone:f="red"}){const h=s.useRef(!1);s.useEffect(()=>{h.current=!1},[l]);const p=()=>{h.current||(h.current=!0,a())},g=s.useRef(null),m=l!==void 0;return o.jsxs(Bf,{open:l,onOpenChange:w=>{w&&(h.current=!1),u==null||u(w)},children:[l===void 0&&o.jsx(uN,{children:o.jsx("button",{type:"button",className:f==="red"?"sc-btn sc-btn-ghost sc-btn-red":"sc-btn sc-btn-ghost",disabled:r,style:i?{width:"100%"}:void 0,children:e})}),o.jsxs(Uf,{maxWidth:"420px",onOpenAutoFocus:()=>{m&&(g.current=document.activeElement)},onCloseAutoFocus:w=>{var y;!m||!((y=g.current)!=null&&y.isConnected)||(w.preventDefault(),g.current.focus())},children:[o.jsx(Wf,{children:t}),o.jsx(Kf,{size:"2",children:n}),o.jsxs(Vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Yf,{children:o.jsx(Sa,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Gf,{children:o.jsx(Sa,{color:"red",onClick:p,disabled:r,children:e})})]})]})]})}function jX(){const{brand:e}=cn(),t=Fl(),n=Bn(),r=Um(),{push:a}=rr(),[i,l]=s.useState(!1),u=async()=>{const f=await r.quit();f.kind==="refused"&&a({kind:"warning",title:"Scenri is still working",detail:f.reason}),f.kind==="still-running"&&a({kind:"error",title:"Scenri did not shut down",detail:"It is still running. Try again in a moment."})};return o.jsxs(o.Fragment,{children:[o.jsxs(zM,{label:"Brands",className:"sc-menu-brand",trigger:o.jsx("button",{type:"button",className:"sc-org-btn","aria-label":`${Ca(e)}, brand and settings`,children:o.jsx(MM,{brand:e,size:32,round:!0})}),children:[o.jsx(NX,{}),o.jsx("div",{className:"sc-menu-rule"}),o.jsxs(rd,{onSelect:()=>n("/setup"),children:[o.jsx(pr,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Set up a brand"})]}),o.jsxs(rd,{onSelect:()=>t(),children:[o.jsx(nF,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Settings"})]}),r.thisComputer&&o.jsxs(rd,{"data-quit":"",onSelect:()=>l(!0),children:[o.jsx(tC,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Shut down Scenri"})]})]}),o.jsx(Xn,{open:i,onOpenChange:l,label:"Shut down Scenri",title:"Shut down Scenri?",body:"This stops the Scenri server on this machine. Every open tab loses the studio until you start it again, from your desktop icon or with npx scenri.",busy:r.busy!=="idle",onConfirm:()=>void u()})]})}const AX=7;function NX(){const{brands:e}=Nn(),{brand:t}=cn(),n=Bn(),[r,a]=s.useState(""),i=m=>Ca(m).trim().toLowerCase(),l=new Map;for(const m of e)l.set(i(m),(l.get(i(m))??0)+1);const u=e.length>=AX,f=r.trim(),h=u&&f?CX(e,f,Ca):[],p=m=>{const w=m.id===t.id,y=(l.get(i(m))??0)>1;return o.jsxs(rd,{"data-current":w||void 0,"data-two-line":y||void 0,onSelect:w?void 0:()=>n(To(m)),children:[o.jsx(MM,{brand:m,size:20,round:!0}),o.jsxs("span",{className:"sc-menu-brand-lb",children:[o.jsx("span",{dir:"auto",children:Ca(m)}),y&&o.jsxs("span",{className:"sc-menu-brand-sub",children:["/",m.slug]})]}),w&&o.jsxs(o.Fragment,{children:[o.jsx(Kn,{size:14,className:"sc-menu-check","aria-hidden":"true"}),o.jsx("span",{className:"sc-vh",children:", current brand"})]})]},m.id)},g=BM(e.filter(m=>m.id!==t.id),Ca);return u?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"sc-menu-find",children:[o.jsx(hd,{size:16,"aria-hidden":"true"}),o.jsx("input",{type:"search",value:r,placeholder:"Find a brand","aria-label":"Find a brand",onChange:m=>a(m.target.value),onKeyDown:m=>{const w=h.find(y=>y.id!==t.id);m.key!=="Enter"||!w||(m.preventDefault(),n(To(w)))}})]}),o.jsx("div",{className:"sc-menu-brands",children:f?h.length>0?h.map(p):o.jsx("p",{className:"sc-menu-none",children:"No brand by that name."}):o.jsxs(o.Fragment,{children:[p(t),g.map(p)]})})]}):o.jsxs(o.Fragment,{children:[p(t),g.map(p)]})}function MX(){const e=Nr("(min-width: 1024px)"),t=UN(),[n]=jl();return e?o.jsx("button",{type:"button",className:"sc-learn-btn","aria-haspopup":"dialog","data-on":n.has("learn")||void 0,onClick:()=>t(),children:"Learn"}):null}function ki(e){var n;if(e.avatarUrl)return{src:e.avatarUrl};const t=e.previewUrl??((n=e.shots)==null?void 0:n[0])??null;return t?{src:t,crop:"top"}:{src:null}}function Kw(e){const t=Jr(e.avatar);if(t)return{src:t};const n=a=>{var i;return Array.isArray(a)?Jr((i=a[0])==null?void 0:i.file):null},r=Jr(e.preview)??n(e.shots)??n(e.sourceRefs);return r?{src:r,crop:"top"}:{src:null}}const UM=["hero","close","hands","angle","bold"],M4=e=>Array.isArray(e)?e.map(t=>Jr(t==null?void 0:t.file)).filter(t=>!!t):[],Gw=e=>{var t;return(((t=e==null?void 0:e.json)==null?void 0:t.characters)??[]).filter(n=>(n==null?void 0:n.origin)==="custom")};function pf(e){return e.length<2?[...e]:e.slice().reverse()}function WM(e){const t=e.filter(n=>n.origin!=="catalog");return t.length===e.length?pf(e):[...pf(t),...e.filter(n=>n.origin==="catalog")]}function s1(e){return pf(Gw(e).filter(t=>!t.supersededBy).map(KM))}function RX(e,t){const n=Gw(e).find(r=>r.id===t);return n?KM(n):void 0}function Yw(e,t){var i;const n=Gw(e),r=new Set([t]);let a=t;for(;;){const l=(i=n.find(u=>u.id===a))==null?void 0:i.supersededBy;if(typeof l!="string"||!l||r.has(l)||!n.some(u=>u.id===l))return a;r.add(l),a=l}}function KM(e){var a;const t=M4(e.shots),n=M4(e.sourceRefs),r=Jr(e.preview)??t[0]??n[0]??null;return{id:String(e.id),name:String(e.name??""),promptName:e.promptName,presentation:e.presentation==="man"?"man":"woman",descriptor:String(e.descriptor??""),ageRange:String(e.ageRange??""),hair:String(e.hair??""),identityNotes:String(e.identityNotes??""),negativeConstraints:Array.isArray(e.negativeConstraints)?e.negativeConstraints.map(String):[],facial:String(e.facial??""),skin:String(e.skin??""),build:String(e.build??""),wardrobeDefault:"",suitableCategories:Array.isArray(e.suitableCategories)?e.suitableCategories.map(String):[],suitableStyles:[],width:1024,height:1280,previewUrl:r,avatarUrl:Jr(e.avatar),custom:!0,shots:t,sourceRefs:n,identityEdits:Array.isArray(e.identityEdits)?e.identityEdits.map(String):[],...e.revisionOf?{revisionOf:String(e.revisionOf)}:{},...e.supersededBy?{supersededBy:String(e.supersededBy)}:{},...e.source==="synthetic"||e.source==="photos"?{source:e.source}:{},...(a=e.likeness)!=null&&a.attestedAt?{likeness:{attestedAt:String(e.likeness.attestedAt),version:String(e.likeness.version??"v1")}}:{}}}function Qc(e){var n;const t=((n=e==null?void 0:e.json)==null?void 0:n.scenes)??[];return pf(t.map(LX))}function mf(e,t){return Qc(e).find(n=>n.id===t)}const PX=["place",...UM];function LX(e){var l;const t=M4(e.refs),n=Jr(e.preview)??null,r=Array.isArray(e.examples)?e.examples.filter(u=>UM.includes(u==null?void 0:u.role)&&Jr(u==null?void 0:u.file)).map(u=>({role:u.role,url:Jr(u.file),hash:String(u.file).slice(6),earlier:u.from!==e.preview,with:u.presenter?"presenter":"product",...u.setup?{setup:String(u.setup)}:{}})):void 0,a=PX.includes(e.cover)?e.cover:void 0,i=a&&a!=="place"?(l=r==null?void 0:r.find(u=>u.role===a&&!u.earlier))==null?void 0:l.url:void 0;return{id:String(e.id),name:String(e.name??""),promptName:e.promptName,description:String(e.description??""),lighting:String(e.lighting??""),subject:e.subject==="product"||e.subject==="person"?e.subject:"either",collections:Array.isArray(e.collections)?e.collections.map(String):[],verticals:Array.isArray(e.verticals)?e.verticals.map(String):[],keywords:Array.isArray(e.keywords)?e.keywords.map(String):void 0,prompt:String(e.prompt??""),width:Number(e.width)||1024,height:Number(e.height)||1280,previewUrl:i??n,placeUrl:n,...a?{cover:a}:{},previewColor:null,custom:!0,refs:t,previewHash:/^asset:[a-f0-9]{32}$/.test(String(e.preview??""))?String(e.preview).slice(6):null,...e.anchor===!0?{anchor:!0}:{},instruction:e.instruction?String(e.instruction):void 0,camera:e.camera?String(e.camera):void 0,figure:e.figure?String(e.figure):void 0,figureTreatment:e.figureTreatment?String(e.figureTreatment):void 0,setups:Array.isArray(e.setups)?e.setups.filter(u=>(u==null?void 0:u.id)&&(u==null?void 0:u.label)&&(u==null?void 0:u.camera)).map(u=>({id:String(u.id),label:String(u.label),camera:String(u.camera)})):void 0,examples:r}}function $X(e){const t=e.cover;return!t||t==="place"?"place":!e.examples||e.examples.some(n=>n.role===t&&!n.earlier)?t:"place"}function $p(e,t){const n=new Set(e.map(r=>r.id));return[...e,...t.filter(r=>!n.has(r.id))]}function ap(e,t){return t.map(n=>n.t==="character"&&n.id?{...n,id:Yw(e,n.id)}:n)}function GM(){const{brand:e,products:t}=cn(),{scenes:n,presenters:r,demoProducts:a,showcase:i}=Nn();return s.useMemo(()=>{const l={presenters:s1(e),scenes:Qc(e)},u=new Set,f=y=>!y||u.has(y)?null:(u.add(y),y),h=(y,b)=>{for(const k of y){const S=f(b(k));if(S)return $n(S,"tile")}return null},p=y=>h(i.filter(b=>{var k;return(((k=b.brief)==null?void 0:k.tokens)??[]).some(S=>(S==null?void 0:S.t)===y)}),b=>b.previewUrl),g=h([...t].reverse(),y=>{var b,k;return Jr((k=(b=y==null?void 0:y.shots)==null?void 0:b[0])==null?void 0:k.file)}),m=h(l.presenters,y=>y.previewUrl??ki(y).src),w=h(l.scenes,y=>y.previewUrl);return{product:{url:g??p("product")??h(a,y=>y.previewUrl)??null,count:t.length,own:!!g},presenter:{url:m??p("character")??h(r,y=>y.previewUrl??ki(y).src)??null,count:l.presenters.length,own:!!m},scene:{url:w??h(n,y=>y.previewUrl)??p("template")??null,count:l.scenes.length,own:!!w}}},[e,t,n,r,a,i])}const TX=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:mm},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:hm},{kind:"scene",label:"Scene",line:"Where it takes place",noun:"scene",icon:fm}],J5=(e,t)=>e===0?"None yet":`${e} ${t}${e===1?"":"s"}`;function DX({suggest:e,onPick:t}){const n=s.useRef(null),{close:r}=jr("new"),a=GM(),i=()=>{var l,u;(u=(l=n.current)==null?void 0:l.querySelector(e?`[data-kind="${e}"]`:"[data-kind]"))==null||u.focus()};return s.useEffect(i,[e]),o.jsxs(Ws,{className:"sc-newpick",maxWidth:"620px",onDismiss:r,onOpenAutoFocus:l=>{l.preventDefault(),i()},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Add to this brand"}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})]}),o.jsx("p",{className:"sc-newdlg-sub",children:"The three things every shot is made from."}),o.jsx("div",{className:"sc-newdlg-body",children:o.jsx("div",{className:"sc-pickgrid",ref:n,children:TX.map(({kind:l,label:u,line:f,noun:h,icon:p})=>{const{url:g,count:m,own:w}=a[l];return o.jsxs("button",{type:"button",className:"sc-pick","data-kind":l,onClick:()=>t(l),"aria-label":`${u}. ${f}. ${J5(m,h)}.`,children:[o.jsxs("span",{className:"sc-pick-media",children:[g?o.jsx("img",{src:g,alt:"",loading:"lazy"}):o.jsx("span",{className:"sc-pick-blank",children:o.jsx(p,{size:22})}),w&&o.jsx("span",{className:"sc-pick-mine",children:"Yours"})]}),o.jsxs("span",{className:"sc-pick-cap",children:[o.jsx("b",{children:u}),o.jsx("small",{children:f})]}),o.jsx("span",{className:"sc-pick-count",children:J5(m,h)})]},l)})})})]})}const sd=14,HX=768,Si=[{px:190,label:"Compact",cells:3,cols:6,min:200},{px:320,label:"Large",cells:2,cols:5,min:280}];function OX(e){let t=Si[0];for(const n of Si)Math.abs(n.px-e)<Math.abs(t.px-e)&&(t=n);return t}const YM=320;function qM(e){const t=typeof e=="number"&&Number.isFinite(e)?e:YM;let n=Si[0].px;for(const r of Si)Math.abs(r.px-t)<Math.abs(n-t)&&(n=r.px);return n}const yd=5;function Jc(e){const t=typeof e=="number"?e:yd;return t===7||t===5?t:t===6?5:yd}const IX={5:8,7:14};function FX(e){const[t,n]=s.useState(0);return s.useLayoutEffect(()=>{if(!e)return;const r=e.clientWidth;n(a=>a===r?a:r)}),s.useLayoutEffect(()=>{if(!e)return;const r=()=>{const i=e.clientWidth;n(l=>l===i?l:i)};r();const a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e]),t}function _X(){const[e,t]=s.useState(()=>window.innerWidth);return s.useEffect(()=>{let n=0;const r=()=>{cancelAnimationFrame(n),n=requestAnimationFrame(()=>t(window.innerWidth))};return window.addEventListener("resize",r),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",r)}},[]),e}function $8(e,t){return Math.max(1,Math.floor((e-sd*(t-1))/t))}function VX(e,t,n){if(e<=0)return{tile:t,cols:1};if(n)return{tile:Math.floor((e-sd)/2),cols:2};const r=Si[1],a=Si[0],i=Math.min(r.cols,Math.max(1,Math.floor((e+sd)/(r.min+sd))));if(OX(t).px===r.px)return{tile:$8(e,i),cols:i};let l=Math.min(a.cols,i+1);return l>1&&$8(e,l)<a.min&&(l=i),{tile:$8(e,l),cols:l}}function ek(e){return Math.max(1,e)}function Qm(e){return Jc(e)===5?"large":"compact"}const a1=s.createContext("large");function XM(){return s.useContext(a1)}const ZX=[{value:7,label:"Compact",hint:"More cards per row",cells:3},{value:5,label:"Large",hint:"Fewer, larger cards",cells:2}],zX=Si.map(e=>({value:e.px,label:e.label,hint:e.label==="Compact"?"More shots per row":"Fewer, larger shots",cells:e.cells}));function Jm({value:e,onChange:t}){return o.jsx(QM,{label:"Grid size",value:Jc(e),options:ZX,onChange:n=>t(n)})}function BX({value:e,onChange:t}){return o.jsx(QM,{label:"Shot size",value:qM(e),options:zX,onChange:t})}function QM({label:e,value:t,options:n,onChange:r}){const a=s.useRef(null);return s.useLayoutEffect(()=>{const i=a.current;if(!i)return;const l=()=>{const f=i.querySelector(":scope > button[data-on]");if(!f){i.style.setProperty("--sc-density-x","0px"),i.style.setProperty("--sc-density-w","0px");return}i.style.setProperty("--sc-density-x",`${f.offsetLeft}px`),i.style.setProperty("--sc-density-w",`${f.offsetWidth}px`)};l(),i.dataset.inkReady||requestAnimationFrame(()=>{i.dataset.inkReady=""});const u=new ResizeObserver(l);return u.observe(i),()=>u.disconnect()},[t]),o.jsxs("div",{ref:a,className:"sc-density",role:"radiogroup","aria-label":e,children:[o.jsx("span",{className:"sc-density-ink","aria-hidden":!0}),n.map(i=>{const l=t===i.value;return o.jsx("button",{type:"button",role:"radio",className:"sc-density-opt","aria-checked":l,"aria-label":i.label,title:i.hint,"data-on":l||void 0,onClick:()=>{l||r(i.value)},children:o.jsx(UX,{cells:i.cells})},i.value)})]})}function UX({cells:e}){const t=e,n=16,r=1.5,a=1.5,l=(n-r*2-a*(t-1))/t,u=Math.max(.6,l*.22),f=[];for(let h=0;h<t;h++)for(let p=0;p<t;p++)f.push({x:r+p*(l+a),y:r+h*(l+a)});return o.jsx("svg",{className:"sc-density-icon",width:n,height:n,viewBox:`0 0 ${n} ${n}`,"aria-hidden":!0,children:f.map(h=>o.jsx("rect",{x:h.x,y:h.y,width:l,height:l,rx:u,ry:u,fill:"currentColor"},`${h.x}-${h.y}`))})}function e2(e){const t=Jc(e),n=(t===5?Si[1]:Si[0]).min;return{"--sc-wall-cols":String(t),"--sc-tile-min":`${n}px`}}function ad({name:e}){const t={size:14,"aria-hidden":!0};switch(e){case"open":return o.jsx(CE,{...t});case"continue":return o.jsx(xa,{...t});case"open-tab":return o.jsx(Ac,{...t});case"refine":return o.jsx(OE,{...t});case"select":return o.jsx(Kn,{...t,weight:"bold"});case"keep":return o.jsx(eo,{...t});case"kept":return o.jsx(eo,{...t,weight:"fill"});case"unset":return o.jsx(SE,{...t});case"versions":return o.jsx(oC,{...t});case"archive":return o.jsx(dm,{...t});case"restore":return o.jsx(ef,{...t});case"delete":case"discard":return o.jsx(Nl,{...t});case"use":return o.jsx(pr,{...t});case"duplicate":return o.jsx(mp,{...t});case"rename":return o.jsx(gF,{...t});case"edit":return o.jsx(jd,{...t});case"cover":return o.jsx(lF,{...t})}}const JM=new Set;function R4(e){return JM.has(e)}function P4(e){e&&JM.add(e)}function ja({src:e,srcSet:t,sizes:n=$N.large,crop:r,wait:a,blank:i="sc-lookpage-ref-blank",keep:l}){const[u,f]=s.useState({src:e,srcSet:t}),h=!!l&&u.src!==e&&R4(u.src);s.useEffect(()=>{if(!h){f(M=>M.src===e&&M.srcSet===t?M:{src:e,srcSet:t});return}let L=!0;const T=new Image;return t&&(T.sizes=n,T.srcset=t),T.src=e,T.decode().catch(()=>{}).then(()=>{L&&(P4(e),f({src:e,srcSet:t}))}),()=>{L=!1}},[h,e,t,n]);const p=h?u.src:e,g=h?u.srcSet:t,[m,w]=s.useState(null),[y,b]=s.useState(null),k=s.useRef(null),S=s.useCallback(()=>{P4(p),b(p)},[p]),E=s.useCallback(L=>{k.current=L,L!=null&&L.complete&&L.naturalWidth&&S()},[S]);if(s.useLayoutEffect(()=>{const L=k.current;L!=null&&L.complete&&L.naturalWidth&&S()},[S]),m===p)return o.jsx("span",{className:i,"aria-hidden":!0,children:o.jsx(Ta,{size:20})});const C=R4(p),A=C||y===p;return o.jsxs(o.Fragment,{children:[a&&!A&&o.jsx("span",{className:"sc-placeholder"}),o.jsx("img",{ref:E,src:p,...g?{srcSet:g,sizes:n}:{},alt:"",loading:C?"eager":"lazy",decoding:C?"sync":"async","data-reveal":"","data-ready":A||void 0,"data-cached":C||void 0,...r?{"data-crop":r}:{},onLoad:S,onError:()=>w(p)})]})}function qw(){return o.jsx("div",{className:"sc-lookpage-refs",children:o.jsx("div",{className:"sc-lookpage-ref",children:o.jsx("span",{className:"sc-lookpage-ref-blank",children:o.jsx(Ta,{size:20})})})})}function Xw({node:e,to:t}){return o.jsx(Vn,{className:"sc-lookcard","aria-label":`Open ${Dr(e)}`,to:t,children:o.jsx(ja,{src:gn(e.images[0],"tile"),blank:"sc-lookcard-blank"})})}function od({label:e,children:t}){const n=s.useRef(null),r=s.useRef(null),a=s.useRef(!1),i=s.useRef(()=>{});s.useLayoutEffect(()=>{const u=n.current,f=r.current;if(!u||!f)return;let h=0;const p=()=>{const w=f.scrollWidth-f.clientWidth;if(w<=1){delete u.dataset.overflowLeft,delete u.dataset.overflowRight;return}f.scrollLeft>2?u.dataset.overflowLeft="":delete u.dataset.overflowLeft,f.scrollLeft<w-2?u.dataset.overflowRight="":delete u.dataset.overflowRight};i.current=p,p();const g=()=>{h||(h=requestAnimationFrame(()=>{h=0,p()}))},m=new ResizeObserver(()=>p());return m.observe(f),f.addEventListener("scroll",g,{passive:!0}),()=>{h&&cancelAnimationFrame(h),i.current=()=>{},m.disconnect(),f.removeEventListener("scroll",g)}},[]);const l=u=>{const f=r.current;if(!(f!=null&&f.firstElementChild)||a.current)return;const h=f.firstElementChild.getBoundingClientRect().width+16,p=f.scrollWidth/2;u<0&&f.scrollLeft<h&&(f.scrollLeft+=p);const g=f.scrollLeft,m=u*h,w=performance.now();a.current=!0;const y=b=>{const k=Math.min(1,(b-w)/420);f.scrollLeft=g+m*(1-(1-k)**3),i.current(),k<1?requestAnimationFrame(y):(a.current=!1,f.scrollLeft>=p&&(f.scrollLeft-=p),i.current())};requestAnimationFrame(y)};return o.jsxs("section",{className:"sc-lookpage-band",children:[o.jsx("p",{className:"sc-bandhead",children:e}),o.jsxs("div",{className:"sc-slider",ref:n,children:[o.jsx("button",{type:"button",className:"sc-slider-arrow prev","aria-label":"Previous",onClick:()=>l(-1),children:o.jsx($a,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-slider-arrow next","aria-label":"Next",onClick:()=>l(1),children:o.jsx(Al,{size:13,weight:"bold"})}),o.jsxs("div",{className:"sc-slider-track",ref:r,children:[t,t]})]})]})}function tk(e,t,n){return e.map(r=>o.jsxs("span",{style:{display:"contents"},children:[r.separated&&o.jsx(n,{}),o.jsxs(t,{color:r.danger?"red":void 0,onSelect:r.onSelect,children:[o.jsx(ad,{name:r.icon}),r.label]})]},r.key))}function WX({id:e,previewUrl:t,pending:n,title:r,primary:a,secondary:i,useLabel:l,variant:u,onOpen:f,onUse:h,href:p,selected:g,onToggle:m,bookmarked:w,onBookmark:y,menu:b,fresh:k,size:S="grid",chosen:E,batching:C,onPick:A}){const[L,T]=s.useState(!1),M=s.useRef(null),j=Ww(),P=XM(),R=(ee,pe)=>VM(ee,pe,j),H=u==="use"&&!!f&&!!h&&!C,D=b??[],B=D.find(ee=>ee.key==="delete"),V=D.length>0,U=ee=>{ee.preventDefault(),ee.stopPropagation(),A==null||A(e)};s.useEffect(()=>{if(!L)return;const ee=pe=>{var se;(se=M.current)!=null&&se.contains(pe.target)||T(!1)};return document.addEventListener("pointerdown",ee),()=>document.removeEventListener("pointerdown",ee)},[L]);const K=t?o.jsx(ja,{src:$n(t,"tile"),srcSet:yc(t),sizes:$N[P],wait:!0,keep:!0,blank:"sc-lookcard-blank"}):n?o.jsx("span",{className:"sc-lookcard-blank","data-waiting":!0,children:o.jsx("span",{className:"sc-placeholder"})}):o.jsx("span",{className:"sc-lookcard-blank",children:o.jsx(Ta,{size:20})}),O=ee=>{ee.preventDefault(),ee.stopPropagation()},F=V?o.jsxs(Cs,{children:[R("More",o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-cell-ctl sc-lookcard-more","aria-label":`More for ${a}`,onClick:ee=>ee.stopPropagation(),onContextMenu:ee=>ee.stopPropagation(),children:[o.jsx(Lv,{className:"sc-lookcard-more-vert",size:16,weight:"bold"}),o.jsx(Pv,{className:"sc-lookcard-more-horiz",size:16,weight:"bold"})]})})),o.jsx(As,{side:"top",align:"end",sideOffset:4,collisionPadding:12,children:tk(D,qn,kc)})]}):null,I=F||B||y?o.jsxs("div",{className:"sc-corner",children:[F,B&&R(B.label,o.jsx("button",{type:"button",className:"sc-cell-ctl sc-lookcard-remove sc-cell-danger","aria-label":B.label,onClick:ee=>{O(ee),B.onSelect()},children:o.jsx(Nl,{size:15})})),y&&R(w?"Remove from Keepers":"Add to Keepers",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-lookcard-keep","data-on":w||void 0,"aria-pressed":!!w,"aria-label":w?`Remove ${a} from Keepers`:`Add ${a} to Keepers`,onClick:ee=>{O(ee),y(e)},children:o.jsx(eo,{size:15,weight:w?"fill":"regular"})}))]}):null,G=o.jsx("span",{className:"sc-lookcard-cap",title:r,children:o.jsxs("span",{className:"sc-lookcard-copy",children:[o.jsx("b",{dir:"auto",children:a}),i&&o.jsx("span",{children:i})]})});if(u==="select")return o.jsxs("button",{type:"button",className:"sc-lookcard","data-fb-id":e,"data-variant":"select","data-size":S,"data-on":g||void 0,"data-just-added":k||void 0,"aria-pressed":!!g,"aria-label":r,onClick:()=>m==null?void 0:m(e),children:[o.jsxs("span",{className:"sc-lookcard-media",children:[K,o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0}),o.jsx("span",{className:"sc-lookcard-tick","aria-hidden":!0,children:o.jsx(Kn,{size:11,weight:"bold"})})]}),G]});const z=()=>{if(C&&A){A(e);return}if(H&&j){if(!L){T(!0);return}T(!1)}f?f(e):h==null||h(e)},Y=()=>{T(!1),h==null||h(e)},Z=o.jsxs("div",{ref:M,className:"sc-lookcard","data-fb":"catalog-card","data-fb-id":e,"data-variant":u,"data-size":S,"data-armed":L||void 0,"data-just-added":k||void 0,"data-picked":E||void 0,"data-batching":C||void 0,children:[o.jsxs("div",{className:"sc-lookcard-media",children:[p?o.jsxs(Vn,{className:"sc-lookcard-open",to:p,"aria-label":C?`${E?"Deselect":"Select"} ${a}`:r,onClick:ee=>{if(C&&A){U(ee);return}if(H&&j){if(!L){ee.preventDefault(),T(!0);return}T(!1)}},children:[K,!C&&o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0})]}):o.jsxs("button",{type:"button",className:"sc-lookcard-open",onClick:z,"aria-label":C?`${E?"Deselect":"Select"} ${a}`:r,children:[K,!C&&o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0})]}),H&&o.jsx("button",{type:"button",className:"sc-lookcard-use",onClick:Y,children:l}),A&&R(E?"Deselect":"Select",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-lookcard-pick","data-on":E||void 0,"aria-pressed":!!E,"aria-label":E?`Deselect ${a}`:`Select ${a}`,onClick:U,children:o.jsx(Kn,{size:13,weight:"bold"})}))]}),I,G]});return D.length===0||j?Z:o.jsxs(Xf,{children:[o.jsx(Qf,{children:Z}),o.jsx(Jf,{children:tk(D,e1,_m)})]})}function t2({size:e="grid",count:t=4,caption:n=!0}){return o.jsx(o.Fragment,{children:Array.from({length:t},(r,a)=>o.jsx("div",{className:"sc-lookcard sc-wait-late","data-variant":"skeleton","data-size":e,"data-caption":n?void 0:"photo","aria-hidden":!0},a))})}const Td=s.memo(WX),KX=/^(p|product|products|item|items|dp|sku)$/i;function GX(e){let t="";try{const r=new URL(e).pathname.split("/").filter(Boolean);t=[...r].reverse().find(a=>!KX.test(a)&&!/^\d+$/.test(a))??r.at(-1)??""}catch{t=e}const n=decodeURIComponent(t).replace(/\.(html?|php|aspx?)$/i,"").replace(/[-_+]+/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):e}function YX(e,t){if(!t)return!0;const n=a=>a.toLowerCase().replace(/[^a-z0-9]+/g," "),r=n(e);return n(t).split(" ").filter(Boolean).every(a=>r.includes(a))}const T8=24,qX=12;function eR({brandId:e,scan:t,busy:n,error:r,onImport:a,onImportAll:i,onDismiss:l}){const u=s.useMemo(()=>t.candidateUrls.length?t.candidateUrls:(t.cards??[]).map(Z=>Z.url).filter(Boolean),[t.candidateUrls,t.cards]),[f,h]=s.useState(""),[p,g]=s.useState(()=>new Set(u)),[m,w]=s.useState(T8),[y,b]=s.useState(()=>{const Z=new Map;for(const ee of t.cards??[])ee.url&&Z.set(ee.url,{externalKey:ee.externalKey,title:ee.title,url:ee.url,images:ee.image?[{url:ee.image}]:[]});for(const ee of t.candidates)ee.url&&Z.set(ee.url,ee);return Z}),k=s.useRef(new Set),S=s.useRef(y),E=s.useRef(!0),[C,A]=s.useState(0);s.useEffect(()=>(E.current=!0,()=>{E.current=!1}),[]);const[L,T]=s.useState(null),M=s.useRef(null),j=s.useMemo(()=>u.map(Z=>({url:Z,name:GX(Z)})),[u]),P=s.useMemo(()=>j.filter(Z=>YX(Z.name,f)),[j,f]),R=s.useMemo(()=>P.slice(0,m),[P,m]);s.useEffect(()=>w(T8),[f]);const H=s.useRef([]),D=s.useRef(0),B=s.useRef(()=>{}),V=2,U=120,K=s.useCallback(()=>{for(;D.current<V&&H.current.length;){const Z=H.current.splice(Math.max(0,H.current.length-qX));if(!Z.length)return;D.current++,A(D.current),Ee.catalogDetails(e,Z).then(({products:ee})=>{if(!E.current)return;const pe=new Map(S.current);for(const se of ee)se.url&&pe.set(se.url,se);for(let se=0;se<ee.length&&se<Z.length;se++)pe.has(Z[se])||pe.set(Z[se],ee[se]);S.current=pe,b(pe)}).catch(()=>{for(const ee of Z)k.current.delete(ee)}).finally(()=>{D.current=Math.max(0,D.current-1),E.current&&(A(D.current),B.current())})}},[e]);B.current=K,s.useEffect(()=>{const Z=M.current;if(!Z)return;const ee=new IntersectionObserver(pe=>{let se=!1;for(const xe of pe){if(!xe.isIntersecting)continue;const J=xe.target.dataset.fbId;if(ee.unobserve(xe.target),!(!J||S.current.has(J)||k.current.has(J))){for(k.current.add(J),H.current.push(J);H.current.length>U;){const te=H.current.shift();te&&k.current.delete(te)}se=!0}}se&&B.current()},{root:Z,rootMargin:"250% 0px"});for(const pe of Z.querySelectorAll("[data-fb-id]"))ee.observe(pe);return()=>ee.disconnect()},[m,f]),s.useEffect(()=>{if(!L||m>=P.length)return;const Z=L.closest(".sc-wizpick-grid"),ee=new IntersectionObserver(pe=>{pe.some(se=>se.isIntersecting)&&w(se=>se+T8)},{root:Z,rootMargin:"0px 0px 300% 0px"});return ee.observe(L),()=>ee.disconnect()},[L,m,P.length]);const O=s.useCallback(Z=>{g(ee=>{const pe=new Set(ee);return pe.delete(Z)||pe.add(Z),pe})},[]),F=P.length>0&&P.every(Z=>p.has(Z.url)),I=p.size===u.length,G=()=>{g(Z=>{const ee=new Set(Z);for(const pe of P)F?ee.delete(pe.url):ee.add(pe.url);return ee})},z=p.size,Y=z===1?"1 product":`${z.toLocaleString()} products`;return o.jsxs(Ws,{open:!0,className:"sc-wizpick",maxWidth:"760px",described:!0,onDismiss:l,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Products on your site"}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})]}),o.jsx(Hc,{className:"sc-wizpick-sub",children:`${u.length.toLocaleString()} found. Everything is selected; untick what you do not want, or search for what you do.`}),o.jsxs("div",{className:"sc-wizpick-tools",children:[o.jsxs("span",{className:"sc-wizpick-search",children:[o.jsx(hd,{size:13}),o.jsx("input",{type:"search",value:f,onChange:Z=>h(Z.target.value),placeholder:`Search ${u.length.toLocaleString()} products`,"aria-label":"Search products"})]}),o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:G,disabled:!P.length,children:F?"Select none":f?`Select these ${P.length.toLocaleString()}`:"Select all"}),o.jsxs("span",{className:"sc-wizpick-count",children:[z.toLocaleString()," selected"]})]}),o.jsxs("div",{className:"sc-wizpick-grid",ref:M,children:[R.map(Z=>{var pe,se;const ee=y.get(Z.url);return o.jsx(Td,{id:Z.url,previewUrl:((se=(pe=ee==null?void 0:ee.images)==null?void 0:pe[0])==null?void 0:se.url)??null,pending:!ee,title:(ee==null?void 0:ee.title)??Z.name,primary:(ee==null?void 0:ee.title)??Z.name,secondary:(ee==null?void 0:ee.price)!=null?`${ee.currency??""} ${ee.price}`.trim():(ee==null?void 0:ee.category)??"",useLabel:"Import",variant:"select",selected:p.has(Z.url),onToggle:O,size:"grid"},Z.url)}),m<P.length&&o.jsx("div",{className:"sc-wizpick-end",ref:T,"aria-hidden":!0}),!P.length&&o.jsxs("p",{className:"sc-wizpick-empty",children:["Nothing here matches “",f,"”."]})]}),o.jsxs("div",{className:"sc-wizpick-foot",children:[o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:l,children:"Not now"}),r?o.jsx("span",{className:"sc-wizpick-error",role:"alert",children:r}):C>0&&o.jsx("span",{className:"sc-wizpick-loading",children:"Loading products"}),o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!z||n||y.size===0&&C>0,onClick:()=>I?i():a([...p]),children:n?"Importing":`Import ${Y}`})]})]})}const D8=700,XX=45e3,QX=3e3;function tR(e,t){const[n,r]=s.useState(null),[a,i]=s.useState(!1),[l,u]=s.useState(!1),[f,h]=s.useState(null),[p,g]=s.useState(0),m=s.useRef(!0);s.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]),s.useEffect(()=>{if(!e)return;let b=!1,k,S=null;i(!0),u(!1),r(null),h(null);const E=(A,L)=>{r(A),h(L),i(!1),u(!0)};return(async()=>{try{const{scanId:A}=await Ee.catalogScan(e,t);if(S=A,b||!m.current){Ee.cancelCatalogScan(e,A).catch(()=>{});return}const L=Date.now()+XX,T=async()=>{if(!(b||!m.current)){if(Date.now()>L){E(null,{kind:"timeout"});return}try{const M=await Ee.catalogScanState(e,A,AbortSignal.timeout(QX));if(b||!m.current)return;if(M.status==="running"){k=setTimeout(T,D8);return}M.result?E(M.result,null):E(null,{kind:"error",reason:M.error??"The look for a shop did not finish."})}catch(M){if(b||!m.current)return;if((M==null?void 0:M.status)===404){E(null,{kind:"error",reason:"The look for a shop was interrupted."});return}k=setTimeout(T,D8)}}};k=setTimeout(T,D8)}catch{b||E(null,{kind:"error",reason:"The look for a shop could not start."})}})(),()=>{b=!0,k&&clearTimeout(k),S&&Ee.cancelCatalogScan(e,S).catch(()=>{})}},[e,t,p]);const w=s.useCallback(()=>g(b=>b+1),[]);return{scan:n,scanning:a,settled:l,outcome:a?{kind:"scanning"}:f||(n?{kind:"result",scan:n}:{kind:"idle"}),retry:w}}const gf=[{key:"fragrance",label:"Fragrance",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]},{key:"footwear",label:"Footwear",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"lateral-side",label:"Lateral side"},{key:"medial-side",label:"Medial side"}]},{key:"apparel",label:"Apparel",angles:[{key:"front",label:"Front"},{key:"back",label:"Back"},{key:"three-quarter",label:"Three-quarter"}]},{key:"furniture",label:"Furniture",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]},{key:"beauty",label:"Beauty / skincare",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]},{key:"electronics",label:"Electronics",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"back",label:"Back"}]},{key:"jewelry",label:"Jewelry",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]},{key:"accessories",label:"Accessories",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]},{key:"beverage",label:"Beverage",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]},{key:"food",label:"Food",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]},{key:"other",label:"Other",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]}],Qw=new Map(gf.map(e=>[e.key,e]));Qw.get("other");function vf(e){var t;return e?((t=Qw.get(e))==null?void 0:t.label)??e:null}function JX(e,t){const n=[e??"",...t??[]].join(" ").toLowerCase();if(!n.trim())return;const r=[["fragrance",["fragrance","perfume","eau de","cologne"]],["footwear",["shoe","sneaker","boot","sandal","footwear"]],["apparel",["shirt","dress","jacket","pant","apparel","clothing","hoodie"]],["furniture",["chair","table","sofa","furniture","shelf","desk"]],["beauty",["skincare","serum","cream","lotion","cosmetic","makeup","beauty"]],["electronics",["electronic","headphone","speaker","charger","device","gadget"]],["jewelry",["jewelry","jewellery","necklace","bracelet","earring","ring"]],["accessories",["bag","handbag","wallet","watch","accessory","accessories"]],["beverage",["drink","beverage","soda","juice","coffee","tea"]],["food",["food","snack","grocery","sauce","spice","pantry"]]];for(const[a,i]of r)if(i.some(l=>n.includes(l)))return a}function Jw(e){return e.category&&Qw.has(e.category)?e.category:JX(e.productType,e.tags)??null}function eQ({title:e,sub:t,error:n,footnote:r,primaryLabel:a,ready:i,blocked:l,busy:u,width:f="440px",onBack:h,onPrimary:p,onPasteFiles:g,children:m}){const{close:w}=jr("new");return o.jsxs(Ws,{maxWidth:f,onDismiss:w,onPaste:y=>{var k;if(!g)return;const b=Array.from(((k=y.clipboardData)==null?void 0:k.files)??[]).filter(S=>S.type.startsWith("image/"));b.length&&(y.preventDefault(),g(b))},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[h&&o.jsx("button",{type:"button",className:"sc-newdlg-back",onClick:h,"aria-label":"Back",children:o.jsx($a,{size:15})}),o.jsx(Ns,{className:"sc-newdlg-title",children:e}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})]}),t&&o.jsx("p",{className:"sc-newdlg-sub",children:t}),o.jsx("div",{className:"sc-newdlg-body",children:m}),o.jsxs("div",{className:"sc-newdlg-foot",children:[n&&o.jsx("p",{className:"sc-newdlg-err",role:"alert",children:n}),o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary sc-dlg-go","aria-disabled":!i||u||void 0,title:l,onClick:()=>{i&&!u&&p()},children:[u?o.jsx(Pr,{size:"1"}):null,a]}),r&&o.jsx("p",{className:"sc-dlg-foot",children:r})]})]})}function nR({onFiles:e,onReject:t,disabled:n}){const r=s.useRef(0),[a,i]=s.useState(!1),l=s.useCallback(()=>{r.current=0,i(!1)},[]);return{dragOver:a,dropProps:{"data-drag-over":a||void 0,onDragEnter:f=>{n||!Array.from(f.dataTransfer.types).includes("Files")||(f.preventDefault(),r.current++,i(!0))},onDragOver:f=>{n||f.preventDefault()},onDragLeave:()=>{r.current=Math.max(0,r.current-1),r.current===0&&i(!1)},onDrop:f=>{if(n)return;f.preventDefault(),l();const h=Array.from(f.dataTransfer.files).filter(p=>p.type.startsWith("image/"));h.length?e(h):t==null||t()}}}}function nk({label:e,hint:t,busy:n,disabled:r,multiple:a=!0,accept:i="image/*",onFiles:l,onReject:u,children:f}){const h=s.useRef(null),{dropProps:p}=nR({onFiles:l,onReject:u,disabled:r||n});return o.jsxs("button",{type:"button",className:"sc-dropzone",disabled:r||n,onClick:()=>{var g;return(g=h.current)==null?void 0:g.click()},...p,children:[o.jsx("input",{ref:h,type:"file",accept:i,multiple:a,hidden:!0,onChange:g=>{const m=Array.from(g.target.files??[]);g.target.value="",m.length&&l(m)}}),n?o.jsx(Pr,{}):f,o.jsx("span",{className:"sc-dropzone-label",children:e}),t&&o.jsx("small",{children:t})]})}function rR({hashes:e,max:t,label:n,hint:r,busy:a,onAdd:i,onRemove:l,onReject:u}){if(e.length===0)return o.jsx("div",{className:"sc-assetwell",children:o.jsx(nk,{label:n,hint:r,busy:a,onFiles:i,onReject:u,children:o.jsx(pr,{size:18})})});const f=t-e.length;return o.jsxs("div",{className:"sc-assetform-refs",children:[e.map((h,p)=>o.jsxs("span",{className:"sc-assetform-ref",children:[o.jsx("img",{src:gn(h,"micro"),alt:`Reference ${p+1}`,loading:"lazy",decoding:"async"}),o.jsx("button",{type:"button",className:"sc-assetform-drop","aria-label":`Remove reference ${p+1}`,onClick:()=>l(h),children:o.jsx(jn,{size:11,weight:"bold"})})]},h)),f>0&&o.jsx(nk,{label:`${f} more`,busy:a,onFiles:i,onReject:u,children:o.jsx(pr,{size:15})})]})}let T0=null;const sR=(e,t)=>`${e}:${t}`;function tQ(e,t,n){T0={key:sR(e,t),fields:n}}function nQ(e,t){if(!T0||T0.key!==sR(e,t))return null;const{fields:n}=T0;return T0=null,n}const rk={name:"",instruction:"",facets:[],imageHashes:[],importUrl:""};function rQ(e,t,n){const r=n.restore??!1,[a,i]=s.useState(rk),[l,u]=s.useState(!1),[f,h]=s.useState(null),p=s.useRef(null),g=s.useRef(null),m=s.useRef(n.pendingState);m.current=n.pendingState;const w=s.useRef(n.exists);w.current=n.exists;const y=s.useRef(n.onDiscarded);y.current=n.onDiscarded;const b=s.useRef(a);b.current=a,s.useEffect(()=>{var P;if(r){const R=nQ(e,t);if(R){i(R);return}}const M=eM(e,t),j=M!=null&&M.pending?m.current(M.pending):null;if(M!=null&&M.pending&&j==="unknown"&&((P=w.current)!=null&&P.call(w,M.name))){Vu(e,t);return}if(M&&!M.pending){Vu(e,t);return}M&&FY(M,j)&&(g.current=M.pending,i({name:M.name,instruction:M.instruction,facets:M.facets,imageHashes:M.imageHashes,importUrl:M.importUrl}))},[e,t,r]);const k=s.useCallback(M=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{g.current&&N8(M)?M8(e,t,{...M,pending:g.current}):Vu(e,t)},400)},[e,t]),S=s.useCallback(M=>{i(j=>{const P={...j,...typeof M=="function"?M(j):M};return k(P),P})},[k]),E=s.useCallback(()=>{var j;p.current&&clearTimeout(p.current);const M=b.current;if(g.current&&N8(M)){M8(e,t,{...M,pending:g.current});return}Vu(e,t),N8(M)&&(tQ(e,t,M),(j=y.current)==null||j.call(y))},[e,t]);s.useEffect(()=>(window.addEventListener("beforeunload",E),()=>{window.removeEventListener("beforeunload",E),E()}),[E]);const C=s.useCallback(async M=>{u(!0),h(null);try{const j=n.max-b.current.imageHashes.length,P=[];for(const R of M.slice(0,j))P.push(await df(R));S(R=>({imageHashes:[...new Set([...R.imageHashes,...P])].slice(0,n.max)}))}catch(j){h(String(j.message??j))}finally{u(!1)}},[n.max,S]),A=s.useCallback(M=>S(j=>({imageHashes:j.imageHashes.filter(P=>P!==M)})),[S]),L=s.useCallback(M=>S(j=>({facets:j.facets.includes(M)?j.facets.filter(P=>P!==M):[...j.facets,M]})),[S]),T=s.useCallback(M=>{if(p.current&&clearTimeout(p.current),!M){Vu(e,t),g.current=null,i(rk);return}g.current=M,i(j=>(M8(e,t,{...j,pending:M}),j))},[e,t]);return{fields:a,set:S,uploading:l,err:f,setErr:h,addFiles:C,removeHash:A,toggleFacet:L,submitted:T}}const sk=6,sQ=3;function aQ({onBack:e,onStarted:t,restore:n,onDiscarded:r}){var j,P;const{brand:a}=cn(),{applyBrand:i}=Nn(),[l,u]=s.useState(!1),[f,h]=s.useState(!1),[p,g]=s.useState(!1),m=rQ(a.id,"product",{max:sk,pendingState:()=>"unknown",restore:n,onDiscarded:r}),w=m.fields.imageHashes.length>0&&!m.uploading,y=m.uploading?"Photos are still uploading":w?void 0:"Add at least one photo",b=async()=>{u(!0),m.setErr(null);try{const{productId:R,...H}=await Ee.createProduct(a.id,{name:m.fields.name.trim(),imageHashes:m.fields.imageHashes,category:m.fields.facets[0]});i(H);const D=m.fields.name.trim()||"Product";m.submitted(null),t({kind:"product",id:R,name:D})}catch(R){m.setErr(String(R.message??R))}finally{u(!1)}},[k,S]=s.useState(null),{scan:E,scanning:C,settled:A}=tR(k?a.id:null,k??void 0),L=async R=>{const H=k??m.fields.importUrl.trim()??"";h(!0),m.setErr(null);try{await Ee.catalogImport(a.id,H,R),m.set({importUrl:""}),S(null),t({kind:"product",id:"",name:H})}catch(D){m.setErr(String(D.message??D))}finally{h(!1)}},T=()=>{var H,D;const R=m.fields.importUrl.trim()||(((D=(H=a.json)==null?void 0:H.meta)==null?void 0:D.website)??"");R&&(m.setErr(null),S(R))};s.useEffect(()=>{!k||!A||E&&E.verdict==="found"&&E.candidates.length||L()},[E,A,k]);const M=R=>{R.key==="Enter"&&(R.preventDefault(),w&&!l&&b())};return o.jsxs(eQ,{title:"New product",error:m.err,footnote:"Added to this brand. No preview.",primaryLabel:"Add product",ready:w,blocked:y,busy:l,onBack:e,onPrimary:()=>void b(),onPasteFiles:R=>void m.addFiles(R),children:[o.jsxs("div",{className:"sc-assetform",children:[o.jsx(rR,{hashes:m.fields.imageHashes,max:sk,label:"Add packshots",hint:`Straight, well-lit packshots. The first ${sQ} are the ones a shot attaches.`,busy:m.uploading,onAdd:R=>void m.addFiles(R),onRemove:m.removeHash,onReject:()=>m.setErr("Drop an image file.")}),o.jsx("div",{className:"sc-assetform-fields",children:o.jsxs("div",{className:"sc-assetform-field",children:[o.jsx("label",{className:"sc-newdlg-seclabel",htmlFor:"sc-product-name",children:"Name"}),o.jsx("input",{id:"sc-product-name",className:"sc-in",type:"text",placeholder:"Name this product",value:m.fields.name,onChange:R=>m.set({name:R.target.value}),onKeyDown:M})]})}),o.jsxs("fieldset",{className:"sc-assetform-facets",children:[o.jsx("legend",{children:"Category"}),o.jsx("div",{className:"sc-assetform-facets-chips",children:gf.map(R=>o.jsx("button",{type:"button",className:"sc-chip","data-on":m.fields.facets[0]===R.key||void 0,"aria-pressed":m.fields.facets[0]===R.key,onClick:()=>m.set({facets:m.fields.facets[0]===R.key?[]:[R.key]}),children:R.label},R.key))})]})]}),o.jsx("div",{className:"sc-newdlg-secondary",children:p?o.jsxs(o.Fragment,{children:[o.jsx("label",{className:"sc-newdlg-seclabel",htmlFor:"sc-import-url",children:"Your store's address"}),o.jsxs("div",{className:"sc-newdlg-secrow",children:[o.jsx("input",{id:"sc-import-url",className:"sc-in",type:"url",placeholder:((P=(j=a.json)==null?void 0:j.meta)==null?void 0:P.website)??"https://yourstore.com",value:m.fields.importUrl,onChange:R=>m.set({importUrl:R.target.value}),onKeyDown:R=>{R.key==="Enter"&&T()}}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:f||C,onClick:T,children:C?"Looking…":f?"Starting…":"Import"})]})]}):o.jsx("button",{type:"button",className:"sc-newdlg-secmore",onClick:()=>g(!0),children:"Import a catalog from a store URL"})}),E&&E.verdict==="found"&&E.candidates.length>0&&o.jsx(eR,{brandId:a.id,scan:E,busy:f,onImport:R=>void L(R),onImportAll:()=>void L(),onDismiss:()=>S(null)})]})}const H8="1",oQ={product:"Product",presenter:"Presenter",scene:"Scene"},iQ=["product","presenter","scene"],lQ=e=>!!e&&iQ.includes(e),aR=s.createContext(null);function oR(){const e=s.useContext(aR);if(!e)throw new Error("useCreateAsset must be used inside AssetCreateHost");return e}function Vl(){return oR().open}function iR(){const e=!!mn({path:mt.products,end:!1}),t=!!mn({path:mt.presenters,end:!1}),n=!!mn({path:mt.scenes,end:!1});return e?"product":t?"presenter":n?"scene":null}function ey(){const{announce:e,caps:t}=oR();return{announce:e,caps:t}}function cQ({children:e}){const{brand:t}=cn(),n=Bn(),r=Un(),{push:a}=rr(),{refreshBrands:i}=Nn(),{builds:l,poke:u}=ia(),f=jr("new"),h=f.value,p=iR(),g=!!mn({path:mt.presenterStudio}),m=!!mn({path:mt.presenterEdit}),w=!!mn({path:mt.sceneStudio}),y=!!mn({path:mt.sceneEdit}),[b,k]=s.useState(null),[S,E]=s.useState(!1),[C,A]=s.useState(!1),L=s.useRef(null),T=s.useRef(null),M=f.open,j=f.set,P=f.close,R=s.useCallback((Z,ee)=>{if(L.current=Z==="choose"||!(ee!=null&&ee.onCreated)?null:{kind:Z,fn:ee.onCreated},Z==="presenter"){n(gl(t));return}if(Z==="scene"){n(ml(t),{state:{from:r.pathname+r.search}});return}T.current=document.activeElement instanceof HTMLElement?document.activeElement:null,E(Z==="choose"),A(!1),M(Z==="choose"?H8:Z)},[M,n,t,r.pathname,r.search]);s.useEffect(()=>{h==="presenter"&&n(gl(t),{replace:!0}),h==="scene"&&n(ml(t),{replace:!0})},[h,n,t]);const H=s.useCallback(()=>{L.current=null,E(!1),P()},[P]),D=s.useCallback(Z=>{a({kind:"success",title:`${oQ[Z]} discarded`,detail:"Nothing was saved.",action:{label:"Undo",onClick:()=>{A(!0),E(!1),M(Z)}}})},[M,a]);s.useEffect(()=>{h===null&&A(!1)},[h]),s.useEffect(()=>{if(h!==null)return;const Z=T.current;T.current=null,Z!=null&&Z.isConnected&&Z.focus()},[h]);const B=h!==null||g||m||w||y,V=jr("setup").value,U=jr("settings").value,K=!!V||!!U;s.useEffect(()=>{if(!B||K)return;let Z=!0,ee=null;const pe=se=>Ee.assetBuildCapabilities().then(xe=>Z&&k(xe)).catch(()=>{Z&&se&&(ee=setTimeout(()=>pe(!1),600))});return pe(!0),()=>{Z=!1,ee&&clearTimeout(ee)}},[B,K]);const O=s.useCallback(Z=>{const ee=l.find(pe=>pe.id===Z);return ee?ee.stage==="failed"?"failed":ee.stage==="cancelled"?"cancelled":ee.stage==="done"?"done":"running":"unknown"},[l]),F=s.useCallback((Z,ee)=>{var J;const pe=L.current;L.current=null,u();const se=!!(ee!=null&&ee.quiet);if(Z.kind==="product"){if(!Z.id){a({kind:"info",title:"Importing your catalog",detail:Z.name});return}(pe==null?void 0:pe.kind)==="product"&&pe.fn(Z),a({kind:"success",title:`${Z.name} added`,actions:[{label:"Add details",onClick:()=>n(Ea(t,Z.id))},{label:"Use in a shot",onClick:()=>n(`${Sr(t)}?product=${Z.id}&compose=1${Ec()}`)}]});return}if(Z.kind==="presenter"){if((pe==null?void 0:pe.kind)==="presenter"&&pe.fn(Z),se)return;a({kind:"success",title:`${Z.name} added`,actions:[{label:"Use in a shot",onClick:()=>n(`${Sr(t)}?presenter=${Z.id}&compose=1${Ec()}`)}]});return}if(i(),(pe==null?void 0:pe.kind)==="scene"&&pe.fn(Z),se)return;const xe=(J=Z.verticals)!=null&&J.length?`Filed under ${Z.verticals.join(" and ")}.`:void 0;a({kind:"success",title:Z.how==="updated"?`${Z.name} changed`:`${Z.name} saved`,detail:xe,actions:[{label:"Open",onClick:()=>n(zr(t,Z.id))},{label:"Use in a shot",onClick:()=>n(`${Sr(t)}?scene=${Z.id}&compose=1${Ec()}`)}]})},[t,n,u,a,i]),I=s.useCallback(Z=>{F(Z),H()},[H,F]),G=s.useMemo(()=>({open:R,announce:F,caps:b}),[R,F,b]),z=lQ(h)?h:null,Y={onBack:S?()=>j(H8):void 0,onStarted:I,caps:b,pendingState:O,restore:C,onDiscarded:()=>z&&D(z)};return o.jsxs(aR.Provider,{value:G,children:[e,h===H8&&o.jsx(DX,{suggest:p,onPick:Z=>{if(Z==="presenter"){n(gl(t),{replace:!0});return}if(Z==="scene"){n(ml(t),{replace:!0});return}E(!0),j(Z)}}),z==="product"&&o.jsx(aQ,{...Y},"product")]})}const uQ=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:mm},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:hm},{kind:"scene",label:"Scene",line:"The place and its light",noun:"scene",icon:fm}],dQ={product:"New product",presenter:"New presenter",scene:"New scene"};function fQ(){var f;const e=Vl(),t=iR(),n=GM(),{showcase:r}=Nn(),a=((f=r.find(h=>h.previewUrl))==null?void 0:f.previewUrl)??null,i=zw(16).find(h=>h.key==="create"),l=i?`${i.to}&attach=all`:"",u=t?dQ[t]:"New";return o.jsxs("div",{className:"sc-new",children:[t?o.jsxs("button",{type:"button",className:"sc-new-go","aria-label":u,"data-guide":"library.new",onClick:()=>e(t),children:[o.jsx(pr,{size:14,weight:"bold",className:"sc-new-plus","aria-hidden":"true"}),o.jsxs("span",{className:"sc-new-lb",children:[o.jsx("span",{className:"sc-new-verb",children:"New "}),o.jsx("span",{className:"sc-new-kind",children:t})]})]}):o.jsxs(Vn,{className:"sc-new-go",to:l,"aria-label":"New shot","data-attach-opener":"",children:[o.jsx(pr,{size:14,weight:"bold",className:"sc-new-plus","aria-hidden":"true"}),o.jsx("span",{className:"sc-new-lb",children:"New"})]}),o.jsx("span",{className:"sc-new-split","aria-hidden":"true"}),o.jsxs(zM,{label:"New",className:"sc-menu-start",trigger:o.jsx("button",{type:"button",className:"sc-new-more","aria-label":"Other ways to start",children:o.jsx(bl,{size:12,weight:"bold",className:"sc-new-caret","aria-hidden":"true"})}),children:[o.jsxs(rd,{className:"sc-menu-item sc-start-row","data-lead":"",to:l,children:[o.jsx("span",{className:"sc-start-pic",children:a?o.jsx("img",{src:$n(a,"tile"),alt:"",loading:"lazy",decoding:"async"}):o.jsx("span",{className:"sc-start-glyph",children:o.jsx(Z7,{size:22})})}),o.jsxs("span",{className:"sc-start-txt",children:[o.jsx("b",{children:"New shot"}),o.jsx("small",{children:"Write a brief, get a shot"})]})]}),o.jsx("div",{className:"sc-menu-label",children:"Add to this brand"}),uQ.map(h=>{const{url:p,count:g}=n[h.kind];return o.jsxs(rd,{className:"sc-menu-item sc-start-row",onSelect:()=>e(h.kind),children:[o.jsx("span",{className:"sc-start-pic",children:p?o.jsx("img",{src:p,alt:"",loading:"lazy",decoding:"async"}):o.jsx("span",{className:"sc-start-glyph",children:o.jsx(h.icon,{size:22})})}),o.jsxs("span",{className:"sc-start-txt",children:[o.jsx("b",{children:h.label}),o.jsx("small",{children:h.line})]}),o.jsxs("span",{className:"sc-start-n",children:[g===0?"None yet":g,o.jsx("span",{className:"sc-vh",children:` ${h.noun}${g===1?"":"s"} so far`})]})]},h.kind)})]})]})}const hQ=24,pQ=8;function mQ(){const e=Nr(la),{pathname:t}=Un();s.useEffect(()=>{const n=document.querySelector(".sc-shell");if(!n||(delete n.dataset.condensed,e))return;let r=0;const a=i=>{const l=i.target;!(l!=null&&l.dataset)||!("pageScroll"in l.dataset)||r||(r=requestAnimationFrame(()=>{r=0;const u=n.dataset.condensed!==void 0,f=l.scrollTop;(u?f<=pQ:f>hQ)&&(u?delete n.dataset.condensed:n.dataset.condensed="")}))};return n.addEventListener("scroll",a,{capture:!0,passive:!0}),()=>{r&&cancelAnimationFrame(r),n.removeEventListener("scroll",a,{capture:!0}),delete n.dataset.condensed}},[e,t])}const lR=["M64 18.71V38.8L51.38 51.39V12.62H57.9C61.27 12.62 64 15.35 64 18.72V18.71Z","M12.62 12.62V51.39H6.1C2.73 51.39 0 48.66 0 45.29V25.2L12.62 12.61V12.62Z","M51.38 51.38L38.79 64H18.7C15.33 64 12.6 61.27 12.6 57.9V51.38H51.37H51.38Z","M12.62 12.62L25.2 0H45.29C48.66 0 51.39 2.73 51.39 6.1V12.62H12.62Z"],gQ=["M100.99 28.93L91.76 27.8C88.5 27.41 87.19 26.58 87.19 25.1C87.19 23.45 89.98 22.49 94.29 22.49C99.38 22.49 102.43 23.36 104.17 26.58L111.61 24.27C108.65 17.87 102.08 16 94.98 16C85.1 16 78.7 19.31 78.7 25.97C78.7 31.02 82.49 33.81 90.28 34.76L98.68 35.8C102.29 36.24 103.3 37.19 103.3 38.5C103.3 40.24 100.64 41.46 95.59 41.46C89.41 41.46 87.01 40.2 85.31 37.02L77.52 39.33C80.31 45.77 86.92 47.95 95.07 47.95C105.17 47.95 111.88 44.55 111.88 37.72C111.88 32.84 108.53 29.84 101 28.93H100.99Z","M132.73 22.66C137 22.66 140.87 24.01 142.7 28.54L150.49 26.67C148.79 20.66 142.3 16.05 132.6 16.05C121.41 16.05 113.44 22.23 113.44 31.98C113.44 41.73 121.41 48 132.6 48C142.31 48 148.8 43.3 150.49 37.29L142.7 35.42C140.87 39.95 137 41.3 132.73 41.3C126.94 41.3 122.24 38.38 122.24 32.42V31.55C122.24 25.59 126.94 22.67 132.73 22.67V22.66Z","M161.51 34.89H179.58V28.71H161.51V22.97H181.54V16.52H152.8V47.43H181.84V40.99H161.51V34.89Z","M208.71 33.85H208.67L193.86 16.52H184.94V47.43H193.04V27.49H193.08L210.15 47.43H216.81V16.52H208.71V33.85Z","M252.25 26.8C252.25 20.14 248.07 16.52 239.84 16.52H220.77V47.43H229.48V37.5H236.62L242.63 47.43H252.56L245.55 36.37C249.9 34.8 252.25 31.62 252.25 26.79V26.8ZM243.54 27.32C243.54 29.98 242.06 31.28 239.06 31.28H229.48V22.96H239.06C242.06 22.96 243.54 24.27 243.54 26.88V27.32Z","M263.79 16.52H255.08V47.43H263.79V16.52Z"];function vQ(e){return o.jsx("svg",{viewBox:"0 0 263.79 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:[...lR,...gQ].map(t=>o.jsx("path",{d:t},t))})}function wQ(e){return o.jsx("svg",{viewBox:"0 0 64 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:lR.map(t=>o.jsx("path",{d:t},t))})}function yQ(){const{brand:e}=cn();return mQ(),o.jsxs("header",{className:"sc-topbar",children:[o.jsx("a",{className:"sc-skip",href:"#main",children:"Skip to content"}),o.jsx("div",{className:"sc-topbar-lead",children:o.jsx(Vn,{className:"sc-wordmark","aria-label":"Scenri home",to:To(e),children:o.jsx(vQ,{"aria-hidden":"true"})})}),o.jsx(EX,{}),o.jsxs("div",{className:"sc-topbar-end",children:[o.jsx(MX,{}),o.jsx(kX,{}),o.jsx(fQ,{}),o.jsx(jX,{})]})]})}const bQ=60;function xQ(){s.useEffect(()=>{const e=window.visualViewport;if(!e)return;const t=document.documentElement,n=()=>{const r=window.innerHeight-e.height-e.offsetTop;t.style.setProperty("--sc-kb",r>bQ?`${Math.round(r)}px`:"0px")};return n(),e.addEventListener("resize",n),e.addEventListener("scroll",n),()=>{e.removeEventListener("resize",n),e.removeEventListener("scroll",n),t.style.removeProperty("--sc-kb")}},[])}const cR=s.createContext(null);function uR(){return s.useContext(cR)}function kQ({brand:e,children:t}){const n=e.id,[r,a]=s.useState({products:[],loaded:!1}),i=s.useRef(null),{tasks:l}=ia(),u=l.filter(w=>w.kind==="catalog").map(w=>`${w.id}:${w.state}`).join("|"),f=l.some(w=>w.kind==="catalog"&&w.state==="running"),h=s.useRef(0),p=s.useRef(n);p.current=n;const g=s.useCallback(async()=>{const w=++h.current;try{const y=await Ee.productsLibrary(n);if(w!==h.current||p.current!==n)return;const b=JSON.stringify(y.products);if(i.current===b)return;i.current=b,a({products:y.products,loaded:!0})}catch{if(w!==h.current||p.current!==n)return;a(y=>({products:y.products,loaded:!0}))}},[n]);s.useEffect(()=>{i.current=null,a({products:[],loaded:!1})},[n]),s.useEffect(()=>{g()},[g,e.updatedAt,u]),s.useEffect(()=>{if(!f)return;const w=setInterval(()=>void g(),2e3);return()=>clearInterval(w)},[f,g]);const m=s.useMemo(()=>({products:r.products,productsLoaded:r.loaded,importing:f,refreshProducts:g}),[r.products,r.loaded,f,g]);return o.jsx(cR.Provider,{value:m,children:t})}function SQ({feature:e}){const{isNew:t}=eu();return t(e)?o.jsx("span",{className:"sc-tag sc-tag-new",children:"New"}):null}function us({title:e,sub:t,children:n}){return o.jsxs("section",{className:"sc-set-sec",children:[(e||t)&&o.jsxs("div",{className:"sc-set-sech",children:[e&&o.jsx("h3",{children:e}),t&&o.jsx("p",{children:t})]}),o.jsx("div",{className:"sc-set-card",children:n})]})}const EQ={npx:"run with npx",global:"installed with npm",managed:"managed install",dev:"running from source",unknown:"local studio"};function CQ({version:e}){return o.jsxs(us,{children:[o.jsx("div",{className:"sc-set-row",children:o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Scenri"}),o.jsxs("small",{children:[e?`v${e.version}`:""," · ",EQ[(e==null?void 0:e.installKind)??"unknown"]]})]})}),o.jsx("div",{className:"sc-set-row",children:o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"License"}),o.jsx("small",{children:"AGPL-3.0 for the app · Apache-2.0 for the .brand format"})]})}),o.jsx("div",{className:"sc-set-row",children:o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Open source"}),o.jsxs("small",{children:["Built by Tony Gorb ·"," ",o.jsx("a",{href:"https://github.com/tonygorb/scenri",target:"_blank",rel:"noreferrer",children:"GitHub"})]})]})})]})}function L4({w:e,h:t,slot:n,box:r}){const a=r/Math.max(e,t);return o.jsx("span",{className:"sc-ratio-slot",style:{width:n,height:n},"aria-hidden":!0,children:o.jsx("span",{className:"sc-ratio",style:{width:Math.round(e*a),height:Math.round(t*a)}})})}const ak=()=>o.jsx("span",{className:"sc-setpop-tick","aria-hidden":!0,children:o.jsx(Kn,{size:12,weight:"bold"})});function ri({label:e,value:t,ids:n,unavailable:r=[],onChange:a,className:i,children:l}){const u=s.useRef(null),f=n.filter(p=>!r.includes(p)),h=p=>{var y,b;const g=p.key==="ArrowDown"||p.key==="ArrowRight"?1:p.key==="ArrowUp"||p.key==="ArrowLeft"?-1:p.key==="Home"?"first":p.key==="End"?"last":null;if(g===null||!f.length)return;p.preventDefault();const m=f.indexOf(t),w=g==="first"?f[0]:g==="last"?f[f.length-1]:g===1?f[m<0||m===f.length-1?0:m+1]:f[m<=0?f.length-1:m-1];a(w),(b=(y=u.current)==null?void 0:y.querySelector(`[data-id="${w}"]`))==null||b.focus()};return o.jsx("div",{className:i,role:"radiogroup","aria-label":e,ref:u,tabIndex:-1,onKeyDown:h,children:l})}const si=s.forwardRef(function({id:t,on:n,unavailable:r,label:a,onPick:i,className:l,children:u,...f},h){return o.jsx("button",{...f,ref:h,type:"button",role:"radio","data-id":t,className:l,"aria-checked":n,"aria-label":a,"aria-disabled":r||void 0,"data-on":n||void 0,tabIndex:n?0:-1,onClick:p=>{var g;(g=f.onClick)==null||g.call(f,p),r||i()},children:u})}),jQ=({children:e})=>o.jsx("p",{className:"sc-setpop-foot",children:e}),ok=[{id:"light",label:"Light"},{id:"dark",label:"Dark"},{id:"system",label:"System"}];function AQ(){const{choice:e,setChoice:t}=MG();return o.jsx(us,{children:o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Theme"}),o.jsx("small",{children:"Follows your system unless you pick a side."})]}),o.jsx(ri,{label:"Theme",className:"sc-seg",value:e,ids:ok.map(n=>n.id),onChange:n=>t(n),children:ok.map(n=>o.jsx(si,{id:n.id,className:"sc-seg-o",on:e===n.id,label:n.label,onPick:()=>t(n.id),children:n.label},n.id))})]})})}function NQ({value:e,onChange:t,placeholder:n,label:r,suggestions:a,max:i=24,maxLength:l=200}){const[u,f]=s.useState(""),h=e.length>=i,p=m=>{const w=m.trim().slice(0,l);f(""),!(!w||h)&&(e.some(y=>y.toLowerCase()===w.toLowerCase())||t([...e,w]))},g=!h&&a&&a.length>0?o.jsx("div",{className:"sc-chips-sugg",children:a.map(m=>o.jsx("button",{type:"button",className:"sc-chip",onClick:()=>p(m),"aria-label":`Never show ${m}`,children:m},m))}):null;return o.jsxs(o.Fragment,{children:[e.length===0&&g,o.jsxs("div",{className:"sc-chips",children:[e.map((m,w)=>o.jsxs("span",{className:"sc-chips-item",children:[o.jsx("span",{dir:"auto",children:m}),o.jsx("button",{type:"button",onClick:()=>t(e.filter((y,b)=>b!==w)),"aria-label":`Remove ${m}`,children:o.jsx(jn,{size:10,weight:"bold"})})]},m)),o.jsx("input",{className:"sc-chips-in",value:u,"aria-label":r,placeholder:h?void 0:e.length?"Add another…":n??"Add one…",disabled:h,dir:"auto",onChange:m=>{const w=m.target.value;if(w.includes(",")){const y=w.split(",");for(const b of y.slice(0,-1))p(b);f(y[y.length-1]);return}f(w.slice(0,l))},onKeyDown:m=>{m.key==="Enter"?(m.preventDefault(),p(u)):m.key==="Backspace"&&!u&&e.length&&t(e.slice(0,-1))},onBlur:()=>p(u)})]}),e.length>0&&g]})}const MQ=["competitor logos in frame","visible text or wordmarks on clothing","alcohol","children","visible clutter or mess","heavy skin retouching","neon or harsh colour","pure white studio backgrounds"],ik=e=>e.trim().toLowerCase();function RQ(e){const t=new Set((e??[]).map(ik));return MQ.filter(n=>!t.has(ik(n)))}function PQ({doc:e}){var a;const t=((a=e.json)==null?void 0:a.rules)??{},n=t.never??[],r=i=>{const l={...t};i.length?l.never=i:delete l.never,e.patch({rules:l})};return o.jsx("div",{className:"sc-nv",children:o.jsx(NQ,{label:"Things this brand never shows",value:n,placeholder:"Or type your own",suggestions:RQ(n),max:24,onChange:r})})}function LQ(){const{brand:e}=cn(),{applyBrand:t}=Nn(),{push:n}=rr(),[r,a]=s.useState({}),[i,l]=s.useState("idle"),u=s.useRef(r);u.current=r;const f=s.useRef(e);f.current=e;const h=s.useRef(null),p=s.useRef({}),g=s.useRef(!1),m=s.useRef(!1),w=s.useCallback(()=>({...f.current.json??{},...u.current}),[]),y=s.useCallback(async()=>{if(!Object.keys(u.current).length)return;if(g.current){m.current=!0;return}g.current=!0,l("saving");const C=u.current;try{const A=await Ee.updateBrand(f.current.id,w(),{...p.current});t(A);for(const L of Object.keys(C))u.current[L]===C[L]?delete p.current[L]:p.current[L]=C[L];a(L=>{const T={...L};for(const M of Object.keys(C))L[M]===C[M]&&delete T[M];return T}),l(m.current?"pending":"idle")}catch(A){l("error"),n({...ln(A,"Could not save the brand"),action:{label:"Retry",onClick:()=>void y()}})}finally{g.current=!1,m.current&&(m.current=!1,y())}},[t,w,n]),b=s.useCallback((C,A)=>{var M;h.current&&(clearTimeout(h.current),h.current=null);for(const j of Object.keys(C))j in p.current||(p.current[j]=((M=f.current.json)==null?void 0:M[j])??null);const L={...u.current,...C};u.current=L,a(L),l("pending");const T=(A==null?void 0:A.debounce)??0;T>0?h.current=setTimeout(()=>void y(),T):y()},[y]),k=s.useCallback(async()=>{h.current&&(clearTimeout(h.current),h.current=null),await y()},[y]),S=s.useCallback(C=>{a({}),u.current={},p.current={},t(C),l("idle")},[t]),E=e.id;return s.useEffect(()=>{a({}),u.current={},p.current={},l("idle")},[E]),s.useEffect(()=>{const C=()=>{Object.keys(u.current).length&&ZG(f.current.id,w(),{...p.current}).then(A=>{A&&t(A)})};return window.addEventListener("beforeunload",C),()=>{window.removeEventListener("beforeunload",C),h.current&&clearTimeout(h.current),C()}},[w,t]),{json:w(),state:i,patch:b,flush:k,applyRow:S}}function ty(e){const t=s.useRef(e);t.current=e,s.useEffect(()=>()=>t.current(),[])}function $Q(e){return e==="saving"?"Saving…":e==="pending"?"Unsaved changes":e==="error"?"Not saved":"Saved"}function TQ({brand:e,doc:t}){const{push:n}=rr(),[r,a]=s.useState(!1),i=t.json??{},l=i.meta??{},u=l.name??e.slug,f=n1(i),h=Ym(f)??void 0,p=f.filter(b=>b!==h),g=b=>{const k={...l};for(const[S,E]of Object.entries(b)){const C=E.trim();C?k[S]=C:delete k[S]}k.name||(k.name=l.name),t.patch({meta:k})},m=async(b,k)=>{a(!0);try{await t.flush(),t.applyRow(await k())}catch(S){n(ln(S,b))}finally{a(!1)}},w=b=>void m("Could not upload that mark",async()=>{const k=await PN(e.id,b[0]),S=k.logoEdge;return S&&S<512&&n({kind:"warning",title:"Logo added, but it is small",detail:`Only ${S}px across. Fine lettering may not survive generation. Export it larger, or as SVG.`}),k}),{dropProps:y}=nR({onFiles:w,onReject:()=>n({kind:"warning",title:"That is not an image",detail:"Drop a PNG, SVG or JPG."}),disabled:r});return o.jsxs("div",{className:"sc-ident",...y,children:[o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Logo"}),o.jsx("small",{children:"Drop an image, or tap to add."})]}),o.jsxs("div",{className:"sc-set-controls",children:[o.jsx(DQ,{mark:h,name:u,busy:r,onUpload:w}),(h==null?void 0:h.attachable)&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:r,onClick:()=>void m("Could not remove that mark",()=>Ee.deleteLogo(e.id,h.hash??"")),children:"Remove"})]})]}),h&&o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Sits on"}),o.jsx("small",{children:"So a dark mark is not shown on a dark ground."})]}),o.jsx("select",{className:"sc-in",value:h.background,disabled:r||!h.attachable,onChange:b=>void m("Could not update that mark",()=>Ee.updateLogo(e.id,h.hash??"",{background:b.target.value})),"aria-label":"Sits on",children:Zw.map(b=>o.jsx("option",{value:b,children:b==="any"?"Any background":`On ${b}`},b))})]}),o.jsx(lk,{label:"Name",value:l.name??"",placeholder:e.slug,maxLength:120,onCommit:b=>g({name:b})}),o.jsx(lk,{label:"Tagline",value:l.tagline??"",placeholder:"Add a tagline",maxLength:200,onCommit:b=>g({tagline:b})}),p.map(b=>o.jsx(HQ,{mark:b,busy:r,onRole:k=>void m("Could not retag that mark",()=>Ee.updateLogo(e.id,b.hash??"",{role:k})),onBackground:k=>void m("Could not update that mark",()=>Ee.updateLogo(e.id,b.hash??"",{background:k})),onRemove:()=>void m("Could not remove that mark",()=>Ee.deleteLogo(e.id,b.hash??""))},b.hash??b.file)),h&&o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Variant"}),o.jsx("small",{children:"A second mark for dark or light grounds."})]}),o.jsxs("label",{className:"sc-btn sc-btn-ghost",children:[o.jsx(pr,{size:12}),"Add",o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:r,onChange:b=>{const k=Array.from(b.target.files??[]);b.target.value="",k.length&&w(k)}})]})]})]})}function lk({label:e,value:t,placeholder:n,maxLength:r,onCommit:a}){const[i,l]=s.useState(t),u=s.useRef(t),f=p=>{u.current=p,l(p)};s.useEffect(()=>{u.current=t,l(t)},[t]);const h=()=>{const p=u.current.trim();p!==t&&a(p)};return ty(h),o.jsxs("div",{className:"sc-set-row",children:[o.jsx("span",{className:"txt",children:o.jsx("b",{children:e})}),o.jsx("input",{className:"sc-in",value:i,placeholder:n,"aria-label":e,maxLength:r,dir:"auto",onChange:p=>f(p.target.value),onBlur:()=>{h(),f(u.current.trim())},onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),p.currentTarget.blur()),p.key==="Escape"&&(f(t),p.currentTarget.blur())}})]})}function DQ({mark:e,name:t,busy:n,onUpload:r}){const[a,i]=s.useState(null);if(e){const l=e.hash?Tr(e.hash):e.file;return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-well","data-bg":e.background,children:o.jsx("img",{src:l,alt:`${t} logo`,onLoad:u=>{const f=u.currentTarget,h=Math.max(f.naturalWidth,f.naturalHeight);i(h>0&&h<512?h:null)}})}),a!==null&&o.jsxs("small",{className:"sc-mark-small",children:["Only ",a,"px across. Fine lettering may not survive generation."]})]})}return o.jsxs("label",{className:"sc-well","data-empty":"","aria-label":"Add logo",children:[o.jsx(Dv,{size:16}),o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:n,onChange:l=>{const u=Array.from(l.target.files??[]);l.target.value="",u.length&&r(u)}})]})}function HQ({mark:e,busy:t,onRole:n,onBackground:r,onRemove:a}){const i=e.hash?Tr(e.hash):e.file;return o.jsxs("div",{className:"sc-set-row",children:[o.jsx("span",{className:"txt",children:o.jsx("b",{children:Ph[e.role]})}),o.jsxs("div",{className:"sc-set-controls",children:[o.jsx("span",{className:"sc-well","data-bg":e.background,children:o.jsx("img",{src:i,alt:Ph[e.role]})}),o.jsx("select",{className:"sc-in",value:e.role,disabled:t||!e.attachable,onChange:l=>n(l.target.value),"aria-label":"Mark role",children:NM.map(l=>o.jsx("option",{value:l,children:Ph[l]},l))}),o.jsx("select",{className:"sc-in",value:e.background,disabled:t||!e.attachable,onChange:l=>r(l.target.value),"aria-label":"Sits on",children:Zw.map(l=>o.jsx("option",{value:l,children:l==="any"?"Any background":`On ${l}`},l))}),e.attachable&&o.jsx("button",{type:"button",disabled:t,onClick:a,"aria-label":`Remove ${Ph[e.role]}`,children:o.jsx(gm,{size:13})})]})]})}const ck={primary:"Primary",secondary:"Secondary",accent:"Accent",neutral:"Neutral"},OQ=(e,t)=>t<=1?ck[e]:`${ck[e]} ${t}`;function IQ(e){return/^(Primary|Secondary|Accent|Neutral)( [2-9]\d*)?$/.test(String(e??"").trim())}const FQ=/^#[0-9A-F]{6}$/;function ur(e){const t=String(e??"").trim(),n=(t.startsWith("#")?t.slice(1):t).toUpperCase();if(/^[0-9A-F]{3}$/.test(n)){const[a,i,l]=n;return`#${a}${a}${i}${i}${l}${l}`}const r=`#${n}`;return FQ.test(r)?r:null}const _Q=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;function VQ(e){const t=String(e??"").trim();return _Q.test(t)?ur(t):null}function ra(e){const t=[],n={primary:0,secondary:0,accent:0,neutral:0},r=(a,i)=>{const l=ur(String((a==null?void 0:a.hex)??""));if(!l)return;n[i]+=1;const u=String((a==null?void 0:a.name)??"").trim();t.push({hex:l,name:u||OQ(i,n[i]),slot:i})};r(e==null?void 0:e.primary,"primary"),r(e==null?void 0:e.secondary,"secondary");for(const a of Array.isArray(e==null?void 0:e.accent)?e.accent:[])r(a,"accent");for(const a of Array.isArray(e==null?void 0:e.neutrals)?e.neutrals:[])r(a,"neutral");return t}function ny(e,t){const n={},r=[],a=[],i=p=>{const g=p.name.trim();return g&&!IQ(g)?{hex:p.hex,name:g}:{hex:p.hex}};for(const p of e){const g=ur(p.hex);if(!g)continue;const m=i({...p,hex:g});p.slot==="neutral"?a.push(m):r.push(m)}const[l,u,...f]=r;l&&(n.primary=l),u&&(n.secondary=u),f.length&&(n.accent=f),a.length&&(n.neutrals=a);const h=String((t==null?void 0:t.usage)??"").trim();return h&&(n.usage=h),n}const uk=e=>e.slot!=="neutral";function n2(e){var l;const t=(l=e[e.length-1])==null?void 0:l.hex;if(!t)return"#808080";const n=Number.parseInt(t.slice(1),16),[r,a,i]=[n>>16&255,n>>8&255,n&255];return`#${[i,r,a].map(u=>u.toString(16).padStart(2,"0")).join("").toUpperCase()}`}function dR(e,t){const n=ur(t);if(!n)return{palette:e,added:!1,swatch:null};const r=ra(e),a=r.find(f=>f.hex===n);if(a)return{palette:e,added:!1,swatch:a};const i=[...r,{hex:n,name:"",slot:r.length?"accent":"primary"}],l=ny(i,e),u=ra(l).find(f=>f.hex===n)??null;return{palette:l,added:!0,swatch:u}}function ZQ(e,t){const n=ur(t);if(!n)return{palette:e,removed:!1};const r=ra(e),a=r.filter(i=>i.hex!==n);return a.length===r.length?{palette:e,removed:!1}:{palette:ny(a,e),removed:!0}}function r2(){return(r2=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function fR(e,t){if(e==null)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(a[n]=e[n]);return a}function W0(e){var t=s.useRef(e),n=s.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var wf=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},K0=function(e){return"touches"in e},$4=function(e){return e&&e.ownerDocument.defaultView||self},dk=function(e,t,n){var r=e.getBoundingClientRect(),a=K0(t)?(function(i,l){for(var u=0;u<i.length;u++)if(i[u].identifier===l)return i[u];return i[0]})(t.touches,n):t;return{left:wf((a.pageX-(r.left+$4(e).pageXOffset))/r.width),top:wf((a.pageY-(r.top+$4(e).pageYOffset))/r.height)}},fk=function(e){!K0(e)&&e.preventDefault()},hR=zn.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,a=fR(e,["onMove","onKey","onEnd"]),i=s.useRef(null),l=W0(t),u=W0(n),f=W0(r),h=s.useRef(null),p=s.useRef(!1),g=s.useMemo(function(){var k=function(C){fk(C),(K0(C)?C.touches.length>0:C.buttons>0)&&i.current?l(dk(i.current,C,h.current)):(E(!1),f())},S=function(){E(!1),f()};function E(C){var A=p.current,L=$4(i.current),T=C?L.addEventListener:L.removeEventListener;T(A?"touchmove":"mousemove",k),T(A?"touchend":"mouseup",S)}return[function(C){var A=C.nativeEvent,L=i.current;if(L&&(fk(A),!(function(M,j){return j&&!K0(M)})(A,p.current)&&L)){if(K0(A)){p.current=!0;var T=A.changedTouches||[];T.length&&(h.current=T[0].identifier)}L.focus(),l(dk(L,A,h.current)),E(!0)}},function(C){var A=C.which||C.keyCode;A<37||A>40||(C.preventDefault(),u({left:A===39?.05:A===37?-.05:0,top:A===40?.05:A===38?-.05:0}))},function(C){var A=C.which||C.keyCode;A>=37&&A<=40&&f()},E]},[u,l,f]),m=g[0],w=g[1],y=g[2],b=g[3];return s.useEffect(function(){return b},[b]),zn.createElement("div",r2({},a,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:i,onKeyDown:w,onKeyUp:y,tabIndex:0,role:"slider"}))}),ry=function(e){return e.filter(Boolean).join(" ")},pR=function(e){var t=e.color,n=e.left,r=e.top,a=r===void 0?.5:r,i=ry(["react-colorful__pointer",e.className]);return zn.createElement("div",{className:i,style:{top:100*a+"%",left:100*n+"%"}},zn.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Xr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},zQ=function(e){return GQ(T4(e))},T4=function(e){return e[0]==="#"&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Xr(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?Xr(parseInt(e.substring(6,8),16)/255,2):1}},BQ=function(e){return KQ(WQ(e))},UQ=function(e){var t=e.s,n=e.v,r=e.a,a=(200-t)*n/100;return{h:Xr(e.h),s:Xr(a>0&&a<200?t*n/100/(a<=100?a:200-a)*100:0),l:Xr(a/2),a:Xr(r,2)}},D4=function(e){var t=UQ(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},WQ=function(e){var t=e.h,n=e.s,r=e.v,a=e.a;t=t/360*6,n/=100,r/=100;var i=Math.floor(t),l=r*(1-n),u=r*(1-(t-i)*n),f=r*(1-(1-t+i)*n),h=i%6;return{r:Xr(255*[r,u,l,l,f,r][h]),g:Xr(255*[f,r,r,u,l,l][h]),b:Xr(255*[l,l,f,r,r,u][h]),a:Xr(a,2)}},$h=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},KQ=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,i=a<1?$h(Xr(255*a)):"";return"#"+$h(t)+$h(n)+$h(r)+i},GQ=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,i=Math.max(t,n,r),l=i-Math.min(t,n,r),u=l?i===t?(n-r)/l:i===n?2+(r-t)/l:4+(t-n)/l:0;return{h:Xr(60*(u<0?u+6:u)),s:Xr(i?l/i*100:0),v:Xr(i/255*100),a}},YQ=zn.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,a=ry(["react-colorful__hue",e.className]);return zn.createElement("div",{className:a},zn.createElement(hR,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:wf(t+360*i.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":Xr(t),"aria-valuemax":"360","aria-valuemin":"0"},zn.createElement(pR,{className:"react-colorful__hue-pointer",left:t/360,color:D4({h:t,s:100,v:100,a:1})})))}),qQ=zn.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,a={backgroundColor:D4({h:t.h,s:100,v:100,a:1})};return zn.createElement("div",{className:"react-colorful__saturation",style:a},zn.createElement(hR,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:wf(t.s+100*i.left,0,100),v:wf(t.v-100*i.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+Xr(t.s)+"%, Brightness "+Xr(t.v)+"%"},zn.createElement(pR,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:D4(t)})))}),mR=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},XQ=function(e,t){return e.toLowerCase()===t.toLowerCase()||mR(T4(e),T4(t))};function QQ(e,t,n,r){var a=W0(n),i=W0(r),l=s.useState(function(){return e.toHsva(t)}),u=l[0],f=l[1],h=s.useRef({color:t,hsva:u}),p=s.useRef(!1);s.useEffect(function(){if(!e.equal(t,h.current.color)){var w=e.toHsva(t);h.current={hsva:w,color:t},f(w),p.current=!1}},[t,e]),s.useEffect(function(){var w;mR(u,h.current.hsva)||e.equal(w=e.fromHsva(u),h.current.color)||(h.current={hsva:u,color:w},a(w),p.current=!0)},[u,e,a]);var g=s.useCallback(function(w){f(function(y){return Object.assign({},y,w)})},[]),m=s.useCallback(function(){p.current&&(p.current=!1,i(h.current.color))},[i]);return[u,g,m]}var JQ=typeof window<"u"?s.useLayoutEffect:s.useEffect,eJ=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},hk=new WeakMap,tJ=function(e){JQ(function(){var t=e.current;if(typeof document<"u"&&t){var n=t.getRootNode?t.getRootNode():t.ownerDocument,r=n&&("head"in n||"host"in n)?n:t.ownerDocument;if(!hk.has(r)){var a="head"in r?r.head:r,i=(a.ownerDocument||document).createElement("style");i.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`;var l=eJ();l&&i.setAttribute("nonce",l),hk.set(r,i),a.appendChild(i)}}},[])},nJ=function(e){var t=e.className,n=e.colorModel,r=e.color,a=r===void 0?n.defaultColor:r,i=e.onChange,l=e.onChangeEnd,u=fR(e,["className","colorModel","color","onChange","onChangeEnd"]),f=s.useRef(null);tJ(f);var h=QQ(n,a,i,l),p=h[0],g=h[1],m=h[2],w=ry(["react-colorful",t]);return zn.createElement("div",r2({},u,{ref:f,className:w}),zn.createElement(qQ,{hsva:p,onChange:g,onChangeEnd:m}),zn.createElement(YQ,{hue:p.h,onChange:g,onChangeEnd:m,className:"react-colorful__last-control"}))},rJ={defaultColor:"000",toHsva:zQ,fromHsva:function(e){return BQ({h:e.h,s:e.s,v:e.v,a:1})},equal:XQ},sJ=function(e){return zn.createElement(nJ,r2({},e,{colorModel:rJ}))};function bd({value:e,onChange:t,label:n,presets:r,className:a,triggerStyle:i,triggerProps:l,tip:u,commitMode:f="live",align:h="start",children:p}){const g=ur(e)??"#000000",[m,w]=s.useState(g),[y,b]=s.useState(!1);s.useEffect(()=>{y||w(g)},[g,y]);const k=L=>{const T=ur(L);T&&(w(T),f==="live"&&t(T))},S=L=>{const T=ur(L);T&&(w(T),t(T),f==="close"&&b(!1))},E=L=>{if(b(L),L||f!=="close")return;const T=ur(m);T&&T!==g&&t(T)},C=[...new Set((r??[]).map(L=>ur(L)).filter(L=>!!L))],A=o.jsx(vd,{children:o.jsx("button",{type:"button",className:a??"sc-cp-trigger",style:{background:g,...i},"aria-label":n,...l,children:p})});return o.jsxs(gd,{open:y,onOpenChange:E,children:[u?o.jsx(fr,{label:n,children:A}):A,o.jsxs(wd,{className:"sc-cp",align:h,sideOffset:6,width:"232px",children:[o.jsx(sJ,{color:m,onChange:k}),o.jsxs("div",{className:"sc-cp-foot",children:[o.jsx("span",{className:"sc-cp-preview",style:{background:m},"aria-hidden":!0}),o.jsx("input",{className:"sc-cp-hex",value:m,spellCheck:!1,maxLength:7,"aria-label":"Hex value",onChange:L=>{w(L.target.value);const T=ur(L.target.value);T&&f==="live"&&t(T)},onBlur:()=>w(ur(m)??g),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),f==="close"?S(m):b(!1))}})]}),C.length>0&&o.jsx("div",{className:"sc-cp-presets",children:C.map(L=>o.jsx("button",{type:"button",style:{background:L},"data-on":L===m||void 0,title:L,"aria-label":L,onClick:()=>f==="close"?S(L):k(L)},L))})]})]})}function aJ({doc:e,suggestions:t}){var w;const n=(w=e.json)==null?void 0:w.palette,[r,a]=s.useState(()=>ra(n)),i=JSON.stringify(n??{});s.useEffect(()=>{a(ra(n))},[i]);const l=(y,b=0)=>{a(y),e.patch({palette:ny(y,n)},{debounce:b})},u=(y,b,k=0)=>l(r.map((S,E)=>E===y?{...S,...b}:S),k),f=()=>l([...r,{hex:n2(r),name:"",slot:r.length?"accent":"primary"}]),h=(t??[]).filter(y=>{const b=ur(y.hex);return b&&!r.some(k=>k.hex===b)}),p=(y,b)=>o.jsx(oJ,{swatch:y,presets:r.map(k=>k.hex),onHex:k=>u(b,{hex:k},300),onRemove:()=>l(r.filter((k,S)=>S!==b))},`${y.slot}-${b}`),g=r.map((y,b)=>[y,b]),m=g.filter(([y])=>!uk(y));return o.jsxs("div",{className:"sc-pal",children:[r.length===0&&o.jsx("p",{className:"sc-pal-empty",children:"No colours yet. Add one and it becomes a chip you can drop into any shot."}),g.filter(([y])=>uk(y)).map(([y,b])=>p(y,b)),m.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"sc-pal-group",children:"Neutrals"}),m.map(([y,b])=>p(y,b))]}),o.jsxs("div",{className:"sc-pal-foot",children:[o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:f,children:[o.jsx(pr,{size:12}),"Add colour"]}),h.length>0&&o.jsxs("span",{className:"sc-pal-sugg",children:[o.jsx("small",{children:"From the website"}),h.map(y=>{const b=ur(y.hex);return o.jsx("button",{type:"button",className:"sc-pal-sugg-chip",style:{background:b},title:`Add ${b}`,"aria-label":`Add ${b}`,onClick:()=>l([...r,{hex:b,name:"",slot:"accent"}])},b)})]})]})]})}function oJ({swatch:e,presets:t,onHex:n,onRemove:r}){const[a,i]=s.useState(e.hex);s.useEffect(()=>i(e.hex),[e.hex]);const l=()=>{const u=ur(a);u&&n(u),i(u??e.hex)};return ty(()=>{a!==e.hex&&l()}),o.jsxs("div",{className:"sc-pal-row",children:[o.jsx(bd,{value:e.hex,onChange:n,label:`${e.name} color`,presets:t,className:"sc-pal-chip"}),o.jsx("span",{className:"sc-pal-name",children:e.name}),o.jsx("input",{className:"sc-in sc-pal-hex",value:a,spellCheck:!1,maxLength:7,"aria-label":`${e.name} hex`,onChange:u=>i(u.target.value),onBlur:l,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),u.currentTarget.blur())}}),o.jsx("button",{type:"button",className:"sc-pal-act","data-danger":"",onClick:r,"aria-label":`Remove ${e.name}`,title:"Remove",children:o.jsx(gm,{size:13})})]})}function iJ({onSaveState:e}){var w,y;const{brand:t}=cn(),{push:n}=rr(),r=LQ();s.useEffect(()=>e(r.state),[r.state,e]);const[a,i]=s.useState(!1),[l,u]=s.useState([]),f=((y=(w=r.json)==null?void 0:w.meta)==null?void 0:y.website)??"",[h,p]=s.useState(f);s.useEffect(()=>p(f),[f]);const g=()=>{var E;const b=h.trim(),k=b&&!/^https?:\/\//i.test(b)?`https://${b}`:b;p(k);const S={...((E=r.json)==null?void 0:E.meta)??{}};k?S.website=k:delete S.website,r.patch({meta:S})};ty(()=>{h.trim()!==f&&g()});const m=async()=>{var b,k,S;i(!0);try{await r.flush();const E=await Ee.refreshBrandFromUrl(t.id);r.applyRow(E),u(((b=E.suggestions)==null?void 0:b.palette)??[]),n({kind:(k=E.warnings)!=null&&k.length?"warning":"success",title:"Read the website again",detail:(S=E.warnings)!=null&&S.length?E.warnings.join(" "):"Your edits were kept."})}catch(E){n(ln(E,"Could not read that website"))}finally{i(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(us,{title:"Identity",sub:"The name and the mark.",children:o.jsx(TQ,{brand:t,doc:r})}),o.jsx(us,{title:"Palette",sub:"Favoured on a shot that asks for the kit.",children:o.jsx("div",{className:"sc-set-block",children:o.jsx(aJ,{doc:r,suggestions:l})})}),o.jsx(us,{title:"We never",sub:"Held on every shot, whether the kit is asked for or not.",children:o.jsx("div",{className:"sc-set-block",children:o.jsx(PQ,{doc:r})})}),o.jsxs(us,{title:"Website and file",sub:"The kit is a file, not a lock-in.",children:[o.jsxs("div",{className:"sc-set-row","data-stack":"",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Website"}),o.jsx("small",{children:"Reads colours and marks from the site again. Edits are kept; new colours are offered, not applied."})]}),o.jsxs("div",{className:"sc-set-controls",children:[o.jsx("input",{className:"sc-in",value:h,type:"url",inputMode:"url",placeholder:"acme.coffee","aria-label":"Brand website",onChange:b=>p(b.target.value),onBlur:g,onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),b.currentTarget.blur())}}),o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:!f||a,onClick:()=>void m(),children:[a?o.jsx(Pr,{size:"1"}):o.jsx(K7,{size:13})," Refresh"]})]})]}),o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Export .brand"}),o.jsx("small",{"data-prose":"",children:"A zip holding brand.json and every image it references: the form any tool can read."})]}),o.jsx("a",{className:"sc-btn sc-btn-ghost",href:_G(t.id),download:!0,onClick:()=>void r.flush(),children:"Export"})]})]})]})}const vl=e=>e.replace(/\s*\(BYOK\)\s*$/i,""),yf="codex-cli";function lJ(e,t){var n;return e.some(r=>r.id===t)?t:((n=e[0])==null?void 0:n.id)??yf}const cJ=e=>e.toFixed(3).replace(/0+$/,"").replace(/\.$/,"");function uJ(e){return e.free?e.localOnly?"Runs on your ChatGPT plan":"No cost per image":`$${cJ(e.perGeneration)} / image`}function dJ(e,t){if(t)return e.available?"Manage":"Connect";if(e.available)return e.id===yf?"Manage":null;switch(e.code){case"update-needed":return"Update";case"env-conflict":return"Fix";case"not-installed":case"not-authenticated":case"unverified":return"Set up";default:return null}}function fJ(e){if(e.trim()==="")return null;const t=e.trim().replace(/^\$\s*|\s*\$$/g,"").replace(/\s+/g,""),n=/^\d{1,3}(,\d{3})+(\.\d+)?$/.test(t)?t.replace(/,/g,""):t;if(/^(\d+(\.\d*)?|\.\d+)$/.test(n))return Number(n)}function hJ({engines:e,onSaved:t,thisComputer:n}){const r=e.filter(f=>!f.free),{push:a}=rr(),[i,l]=s.useState({});s.useEffect(()=>{l(Object.fromEntries(r.map(f=>[f.id,f.cap===null?"":String(f.cap)])))},[e]);const u=async f=>{const h=g=>l(m=>({...m,[f.id]:g===null?"":String(g)})),p=fJ(i[f.id]??"");if(p===void 0){h(f.cap),a({kind:"warning",title:"That is not an amount",detail:"Type the cap in dollars, like 20 or 12.50."});return}if(p===f.cap){h(p);return}try{await Ee.setCap(f.id,p),h(p),t()}catch(g){h(f.cap),a(ln(g,"Could not save that cap"))}};return r.length?o.jsx(us,{title:"Monthly caps",sub:n?"Your own API budget. Generation stops before a cap is crossed, so a runaway loop cannot spend your month.":"Your own API budget. Generation stops before a cap is crossed. Caps are set on the computer running Scenri.",children:r.map(f=>{const h=f.generationsLeft,p=f.generationsTotal,g=p&&p>0?Math.min(100,Math.round((p-(h??0))/p*100)):0,m=`$${f.monthlySpend.toFixed(2)} this month`;return o.jsxs("div",{className:"sc-cap",children:[o.jsxs("div",{className:"sc-cap-top",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:vl(f.displayName)}),o.jsx("small",{children:h===null?m:`${m} · ${h} left`})]}),o.jsxs("div",{className:"sc-cap-in",children:[o.jsx("span",{className:"sc-cap-dollar",children:"$"}),o.jsx("input",{className:"sc-in",inputMode:"decimal",placeholder:"None",value:i[f.id]??"",onChange:w=>l(y=>({...y,[f.id]:w.target.value})),onBlur:()=>void u(f),disabled:!n,"aria-label":`${vl(f.displayName)} monthly cap in dollars`})]})]}),p!==null&&o.jsx("div",{className:"sc-meter",children:o.jsx("i",{style:{width:`${g}%`}})})]},f.id)})}):o.jsx(us,{title:"Monthly caps",sub:"Nothing to cap yet. Caps apply to engines you pay for per image. Codex usage counts against your ChatGPT plan, which OpenAI meters, not Scenri.",children:o.jsx("p",{className:"sc-set-empty",children:"Add a paid engine key and its cap appears here."})})}function pJ({onDone:e,thisComputer:t}){const{brand:n,resetShots:r}=cn(),{refresh:a}=Nn(),i=Bn(),[l,u]=s.useState(!1),f=s.useCallback(async h=>{u(!0);try{await Ee.deleteData(h),e(),h==="shots"&&r(),h==="all"&&window.location.replace("/")}finally{u(!1)}},[e,r]);return o.jsxs(o.Fragment,{children:[o.jsx(us,{title:"This brand",children:o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Delete this brand"}),o.jsxs("small",{"data-prose":"",children:["Removes ",Ca(n),", its sets and every shot. Other brands stay."]})]}),o.jsx(Xn,{label:"Delete brand",title:`Delete ${Ca(n)}?`,body:"The kit, its sets and every shot go with it. Exports you already downloaded stay yours.",busy:l,onConfirm:()=>{u(!0),Ee.deleteBrand(n.id).then(()=>a()).then(()=>i("/",{replace:!0})).finally(()=>u(!1))}})]})}),t&&o.jsxs(us,{title:"Every brand",children:[o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Delete generated shots"}),o.jsx("small",{"data-prose":"",children:"Removes every set and every generated shot, in every brand. Brands, cast and scenes stay."})]}),o.jsx(Xn,{label:"Delete shots",title:"Delete every generated shot?",body:"Brands, cast and scenes stay. Every set and every generated shot goes.",busy:l,onConfirm:()=>void f("shots")})]}),o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Delete all local data"}),o.jsx("small",{"data-prose":"",children:"Brands, cast, sets, shots and saved keys, in one go."})]}),o.jsx(Xn,{label:"Delete everything",title:"Delete everything on this machine?",body:"The whole library folder is removed: brands, cast, sets, shots and your saved keys. There is no undo.",busy:l,onConfirm:()=>void f("all")})]})]})]})}function mJ(e,t){return t?{body:t,action:"retry"}:e?e.installKind==="dev"?{body:"Running from source; nothing to put on a desktop.",action:null}:e.supported?e.installed?{body:"Scenri is on your desktop.",action:"recreate"}:{body:"Open Scenri without a terminal.",action:"add"}:{body:"Desktop shortcuts are not available on this system yet.",action:null}:{body:"Checking this machine.",action:null}}function gJ({status:e,onStatus:t}){const[n,r]=s.useState(null),[a,i]=s.useState(!1),[l,u]=s.useState(!1),f=s.useRef(null);s.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const h=async()=>{if(!a){i(!0),r(null);try{await Ee.desktopInstall(),u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>u(!1),1600),t(await Ee.desktop())}catch(g){r(String((g==null?void 0:g.message)??g))}finally{i(!1)}}},p=mJ(e,n);return o.jsx(us,{title:"This computer",children:o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Desktop shortcut"}),o.jsx("small",{"data-prose":"",children:p.body})]}),p.action&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:a,onClick:()=>void h(),children:l?"Added":a?"Adding…":p.action==="add"?"Add to desktop":p.action==="recreate"?"Recreate":"Try again"})]})})}function gR(e){return o.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:o.jsx("path",{d:"M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z"})})}function vJ(e){return o.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:o.jsx("path",{d:"M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z"})})}function wJ(e){return o.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:o.jsx("path",{d:"M24 10.262v2.712h-9.518V24h-3.034V10.262zm0-5.131v2.717H8.755V24H5.722V5.131zM24 0v2.717H3.034V24H0V0z"})})}const yJ=[{engineId:"openrouter",settingKey:"openrouter_api_key",hint:"sk-or-...",keysUrl:"https://openrouter.ai/keys"},{engineId:"replicate",settingKey:"replicate_api_token",hint:"r8_...",keysUrl:"https://replicate.com/account/api-tokens"},{engineId:"fal",settingKey:"fal_key",hint:"fal_...",keysUrl:"https://fal.ai/dashboard/keys"}],vR=e=>yJ.find(t=>t.engineId===e),wR={"codex-cli":{Mark:gR,size:16,plate:"#FFFFFF",ink:"#000000"},openrouter:{Mark:vJ,size:18,plate:"#FFFFFF",ink:"#7624F4"},replicate:{Mark:wJ,size:15,plate:"#E42022",ink:"#FFFFFF"}},yR=e=>{const t=wR[e];return t?{plate:t.plate,ink:t.ink}:void 0},bJ={demo:JI};function bR({engineId:e,scale:t=1}){const n=wR[e];if(n){const a=Math.round(n.size*t);return o.jsx(n.Mark,{width:a,height:a})}const r=bJ[e]??tf;return o.jsx(r,{size:Math.round(15*t)})}const xJ=e=>[...e].sort((t,n)=>+(n.id===yf)-+(t.id===yf));function kJ({engines:e}){const t=_l(),r=e.filter(a=>a.available).length===0;return o.jsx(us,{children:xJ(e).map(a=>{const i=vR(a.id),l=vl(a.displayName),u=dJ(a,!!i),f=a.available?"Connected":null,h=!f&&a.reason&&(!u||a.code==="unverified"),p=yR(a.id);return o.jsxs("div",{className:"sc-eng","data-connected":a.available?"":void 0,children:[o.jsx("span",{className:"sc-eng-ic","data-brand":p?"":void 0,style:p?{"--sc-plate":p.plate,"--sc-ink":p.ink}:void 0,children:o.jsx(bR,{engineId:a.id})}),o.jsxs("span",{className:"sc-eng-name",children:[o.jsx("b",{children:l}),o.jsx("small",{children:uJ(a)})]}),f&&o.jsxs("span",{className:"sc-stat",children:[o.jsx("span",{className:"d"}),f]}),h&&o.jsx("span",{className:"sc-stat sc-stat-why",children:a.reason}),u&&o.jsx("button",{type:"button",className:`sc-btn ${r&&!i?"sc-btn-primary":"sc-btn-ghost"} sc-eng-act`,onClick:()=>t(a.id),"aria-label":`${u} ${l}`,children:u})]},a.id)})})}const SJ=e=>e>1e9?`${(e/1e9).toFixed(1)} GB`:e>1e6?`${Math.round(e/1e6)} MB`:`${Math.round(e/1e3)} KB`,O8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function EJ(e){return e===0?0:e<3?1:e<6?2:e<12?3:4}function pk(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function mk(e,t){const n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),a=new Date(r);a.setDate(r.getDate()-r.getDay()-(t-1)*7);const i=(t-1)*7+r.getDay()+1,l=[],u=[];let f=-1,h=0;for(let p=0;p<i;p++){const g=new Date(a);g.setDate(a.getDate()+p);const m=pk(g),w=e.get(m)??0;if(h+=w,l.push({key:m,level:EJ(w),title:w?`${w} run${w===1?"":"s"} on ${g.getDate()} ${O8[g.getMonth()]}`:`nothing on ${g.getDate()} ${O8[g.getMonth()]}`}),g.getDay()===0){const y=g.getMonth()!==f&&g.getDate()<=7;y&&(f=g.getMonth()),u.push({key:m,label:y?O8[g.getMonth()]:""})}}return{cells:l,months:u,sum:h,from:pk(a)}}function CJ({info:e,thisComputer:t}){const{push:n}=rr();return o.jsxs(us,{children:[o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Library folder"}),o.jsx("small",{children:e?[e.dir,`${SJ(e.bytes)} across ${e.images} images`].filter(Boolean).join(" · "):"…"})]}),t&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void Ee.reveal().catch(r=>n(ln(r,"Could not open the library folder"))),children:"Reveal"})]}),o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Export everything"}),o.jsx("small",{children:"One zip: brands, cast, prompts, shots. Never keys."})]}),o.jsx("a",{className:"sc-btn sc-btn-ghost",href:"/api/export/all",download:!0,children:"Export"})]}),o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Telemetry"}),o.jsx("small",{children:"There is none. This row exists to say so."})]}),o.jsx("span",{className:"sc-tag",children:"off, permanently"})]})]})}async function jJ(e,t){if(window.isSecureContext&&navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}const n=document.activeElement,r=document.createElement("textarea");r.value=e,r.readOnly=!0,r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;",(t??document.body).appendChild(r);try{return r.focus(),r.select(),r.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{r.remove(),n==null||n.focus()}}const Dd=function(e,t){let a=e;const i=D0[t];let l=null,u=0,f=null;const h=[],p={},g=function(M,j){u=a*4+17,l=(function(P){const R=new Array(P);for(let H=0;H<P;H+=1){R[H]=new Array(P);for(let D=0;D<P;D+=1)R[H][D]=null}return R})(u),m(0,0),m(u-7,0),m(0,u-7),b(),y(),S(M,j),a>=7&&k(M),f==null&&(f=A(a,i,h)),E(f,j)},m=function(M,j){for(let P=-1;P<=7;P+=1)if(!(M+P<=-1||u<=M+P))for(let R=-1;R<=7;R+=1)j+R<=-1||u<=j+R||(0<=P&&P<=6&&(R==0||R==6)||0<=R&&R<=6&&(P==0||P==6)||2<=P&&P<=4&&2<=R&&R<=4?l[M+P][j+R]=!0:l[M+P][j+R]=!1)},w=function(){let M=0,j=0;for(let P=0;P<8;P+=1){g(!0,P);const R=Qi.getLostPoint(p);(P==0||M>R)&&(M=R,j=P)}return j},y=function(){for(let M=8;M<u-8;M+=1)l[M][6]==null&&(l[M][6]=M%2==0);for(let M=8;M<u-8;M+=1)l[6][M]==null&&(l[6][M]=M%2==0)},b=function(){const M=Qi.getPatternPosition(a);for(let j=0;j<M.length;j+=1)for(let P=0;P<M.length;P+=1){const R=M[j],H=M[P];if(l[R][H]==null)for(let D=-2;D<=2;D+=1)for(let B=-2;B<=2;B+=1)D==-2||D==2||B==-2||B==2||D==0&&B==0?l[R+D][H+B]=!0:l[R+D][H+B]=!1}},k=function(M){const j=Qi.getBCHTypeNumber(a);for(let P=0;P<18;P+=1){const R=!M&&(j>>P&1)==1;l[Math.floor(P/3)][P%3+u-8-3]=R}for(let P=0;P<18;P+=1){const R=!M&&(j>>P&1)==1;l[P%3+u-8-3][Math.floor(P/3)]=R}},S=function(M,j){const P=i<<3|j,R=Qi.getBCHTypeInfo(P);for(let H=0;H<15;H+=1){const D=!M&&(R>>H&1)==1;H<6?l[H][8]=D:H<8?l[H+1][8]=D:l[u-15+H][8]=D}for(let H=0;H<15;H+=1){const D=!M&&(R>>H&1)==1;H<8?l[8][u-H-1]=D:H<9?l[8][15-H-1+1]=D:l[8][15-H-1]=D}l[u-8][8]=!M},E=function(M,j){let P=-1,R=u-1,H=7,D=0;const B=Qi.getMaskFunction(j);for(let V=u-1;V>0;V-=2)for(V==6&&(V-=1);;){for(let U=0;U<2;U+=1)if(l[R][V-U]==null){let K=!1;D<M.length&&(K=(M[D]>>>H&1)==1),B(R,V-U)&&(K=!K),l[R][V-U]=K,H-=1,H==-1&&(D+=1,H=7)}if(R+=P,R<0||u<=R){R-=P,P=-P;break}}},C=function(M,j){let P=0,R=0,H=0;const D=new Array(j.length),B=new Array(j.length);for(let O=0;O<j.length;O+=1){const F=j[O].dataCount,I=j[O].totalCount-F;R=Math.max(R,F),H=Math.max(H,I),D[O]=new Array(F);for(let Z=0;Z<D[O].length;Z+=1)D[O][Z]=255&M.getBuffer()[Z+P];P+=F;const G=Qi.getErrorCorrectPolynomial(I),Y=bf(D[O],G.getLength()-1).mod(G);B[O]=new Array(G.getLength()-1);for(let Z=0;Z<B[O].length;Z+=1){const ee=Z+Y.getLength()-B[O].length;B[O][Z]=ee>=0?Y.getAt(ee):0}}let V=0;for(let O=0;O<j.length;O+=1)V+=j[O].totalCount;const U=new Array(V);let K=0;for(let O=0;O<R;O+=1)for(let F=0;F<j.length;F+=1)O<D[F].length&&(U[K]=D[F][O],K+=1);for(let O=0;O<H;O+=1)for(let F=0;F<j.length;F+=1)O<B[F].length&&(U[K]=B[F][O],K+=1);return U},A=function(M,j,P){const R=gk.getRSBlocks(M,j),H=vk();for(let B=0;B<P.length;B+=1){const V=P[B];H.put(V.getMode(),4),H.put(V.getLength(),Qi.getLengthInBits(V.getMode(),M)),V.write(H)}let D=0;for(let B=0;B<R.length;B+=1)D+=R[B].dataCount;if(H.getLengthInBits()>D*8)throw"code length overflow. ("+H.getLengthInBits()+">"+D*8+")";for(H.getLengthInBits()+4<=D*8&&H.put(0,4);H.getLengthInBits()%8!=0;)H.putBit(!1);for(;!(H.getLengthInBits()>=D*8||(H.put(236,8),H.getLengthInBits()>=D*8));)H.put(17,8);return C(H,R)};p.addData=function(M,j){j=j||"Byte";let P=null;switch(j){case"Numeric":P=AJ(M);break;case"Alphanumeric":P=NJ(M);break;case"Byte":P=MJ(M);break;case"Kanji":P=RJ(M);break;default:throw"mode:"+j}h.push(P),f=null},p.isDark=function(M,j){if(M<0||u<=M||j<0||u<=j)throw M+","+j;return l[M][j]},p.getModuleCount=function(){return u},p.make=function(){if(a<1){let M=1;for(;M<40;M++){const j=gk.getRSBlocks(M,i),P=vk();for(let H=0;H<h.length;H++){const D=h[H];P.put(D.getMode(),4),P.put(D.getLength(),Qi.getLengthInBits(D.getMode(),M)),D.write(P)}let R=0;for(let H=0;H<j.length;H++)R+=j[H].dataCount;if(P.getLengthInBits()<=R*8)break}a=M}g(!1,w())},p.createTableTag=function(M,j){M=M||2,j=typeof j>"u"?M*4:j;let P="";P+='<table style="',P+=" border-width: 0px; border-style: none;",P+=" border-collapse: collapse;",P+=" padding: 0px; margin: "+j+"px;",P+='">',P+="<tbody>";for(let R=0;R<p.getModuleCount();R+=1){P+="<tr>";for(let H=0;H<p.getModuleCount();H+=1)P+='<td style="',P+=" border-width: 0px; border-style: none;",P+=" border-collapse: collapse;",P+=" padding: 0px; margin: 0px;",P+=" width: "+M+"px;",P+=" height: "+M+"px;",P+=" background-color: ",P+=p.isDark(R,H)?"#000000":"#ffffff",P+=";",P+='"/>';P+="</tr>"}return P+="</tbody>",P+="</table>",P},p.createSvgTag=function(M,j,P,R){let H={};typeof arguments[0]=="object"&&(H=arguments[0],M=H.cellSize,j=H.margin,P=H.alt,R=H.title),M=M||2,j=typeof j>"u"?M*4:j,P=typeof P=="string"?{text:P}:P||{},P.text=P.text||null,P.id=P.text?P.id||"qrcode-description":null,R=typeof R=="string"?{text:R}:R||{},R.text=R.text||null,R.id=R.text?R.id||"qrcode-title":null;const D=p.getModuleCount()*M+j*2;let B,V,U,K,O="",F;for(F="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",O+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',O+=H.scalable?"":' width="'+D+'px" height="'+D+'px"',O+=' viewBox="0 0 '+D+" "+D+'" ',O+=' preserveAspectRatio="xMinYMin meet"',O+=R.text||P.text?' role="img" aria-labelledby="'+L([R.id,P.id].join(" ").trim())+'"':"",O+=">",O+=R.text?'<title id="'+L(R.id)+'">'+L(R.text)+"</title>":"",O+=P.text?'<description id="'+L(P.id)+'">'+L(P.text)+"</description>":"",O+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',O+='<path d="',U=0;U<p.getModuleCount();U+=1)for(K=U*M+j,B=0;B<p.getModuleCount();B+=1)p.isDark(U,B)&&(V=B*M+j,O+="M"+V+","+K+F);return O+='" stroke="transparent" fill="black"/>',O+="</svg>",O},p.createDataURL=function(M,j){M=M||2,j=typeof j>"u"?M*4:j;const P=p.getModuleCount()*M+j*2,R=j,H=P-j;return TJ(P,P,function(D,B){if(R<=D&&D<H&&R<=B&&B<H){const V=Math.floor((D-R)/M),U=Math.floor((B-R)/M);return p.isDark(U,V)?0:1}else return 1})},p.createImgTag=function(M,j,P){M=M||2,j=typeof j>"u"?M*4:j;const R=p.getModuleCount()*M+j*2;let H="";return H+="<img",H+=' src="',H+=p.createDataURL(M,j),H+='"',H+=' width="',H+=R,H+='"',H+=' height="',H+=R,H+='"',P&&(H+=' alt="',H+=L(P),H+='"'),H+="/>",H};const L=function(M){let j="";for(let P=0;P<M.length;P+=1){const R=M.charAt(P);switch(R){case"<":j+="&lt;";break;case">":j+="&gt;";break;case"&":j+="&amp;";break;case'"':j+="&quot;";break;default:j+=R;break}}return j},T=function(M){M=typeof M>"u"?2:M;const P=p.getModuleCount()*1+M*2,R=M,H=P-M;let D,B,V,U,K;const O={"██":"█","█ ":"▀"," █":"▄"," ":" "},F={"██":"▀","█ ":"▀"," █":" "," ":" "};let I="";for(D=0;D<P;D+=2){for(V=Math.floor((D-R)/1),U=Math.floor((D+1-R)/1),B=0;B<P;B+=1)K="█",R<=B&&B<H&&R<=D&&D<H&&p.isDark(V,Math.floor((B-R)/1))&&(K=" "),R<=B&&B<H&&R<=D+1&&D+1<H&&p.isDark(U,Math.floor((B-R)/1))?K+=" ":K+="█",I+=M<1&&D+1>=H?F[K]:O[K];I+=`
97
+ `}return P%2&&M>0?I.substring(0,I.length-P-1)+Array(P+1).join("▀"):I.substring(0,I.length-1)};return p.createASCII=function(M,j){if(M=M||1,M<2)return T(j);M-=1,j=typeof j>"u"?M*2:j;const P=p.getModuleCount()*M+j*2,R=j,H=P-j;let D,B,V,U;const K=Array(M+1).join("██"),O=Array(M+1).join(" ");let F="",I="";for(D=0;D<P;D+=1){for(V=Math.floor((D-R)/M),I="",B=0;B<P;B+=1)U=1,R<=B&&B<H&&R<=D&&D<H&&p.isDark(V,Math.floor((B-R)/M))&&(U=0),I+=U?K:O;for(V=0;V<M;V+=1)F+=I+`
98
+ `}return F.substring(0,F.length-1)},p.renderTo2dContext=function(M,j){j=j||2;const P=p.getModuleCount();for(let R=0;R<P;R++)for(let H=0;H<P;H++)M.fillStyle=p.isDark(R,H)?"black":"white",M.fillRect(H*j,R*j,j,j)},p};Dd.stringToBytes=function(e){const t=[];for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);t.push(r&255)}return t};Dd.createStringToBytes=function(e,t){const n=(function(){const a=LJ(e),i=function(){const f=a.read();if(f==-1)throw"eof";return f};let l=0;const u={};for(;;){const f=a.read();if(f==-1)break;const h=i(),p=i(),g=i(),m=String.fromCharCode(f<<8|h),w=p<<8|g;u[m]=w,l+=1}if(l!=t)throw l+" != "+t;return u})(),r=63;return function(a){const i=[];for(let l=0;l<a.length;l+=1){const u=a.charCodeAt(l);if(u<128)i.push(u);else{const f=n[a.charAt(l)];typeof f=="number"?(f&255)==f?i.push(f):(i.push(f>>>8),i.push(f&255)):i.push(r)}}return i}};const is={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},D0={L:1,M:0,Q:3,H:2},Xi={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Qi=(function(){const e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r=21522,a={},i=function(l){let u=0;for(;l!=0;)u+=1,l>>>=1;return u};return a.getBCHTypeInfo=function(l){let u=l<<10;for(;i(u)-i(t)>=0;)u^=t<<i(u)-i(t);return(l<<10|u)^r},a.getBCHTypeNumber=function(l){let u=l<<12;for(;i(u)-i(n)>=0;)u^=n<<i(u)-i(n);return l<<12|u},a.getPatternPosition=function(l){return e[l-1]},a.getMaskFunction=function(l){switch(l){case Xi.PATTERN000:return function(u,f){return(u+f)%2==0};case Xi.PATTERN001:return function(u,f){return u%2==0};case Xi.PATTERN010:return function(u,f){return f%3==0};case Xi.PATTERN011:return function(u,f){return(u+f)%3==0};case Xi.PATTERN100:return function(u,f){return(Math.floor(u/2)+Math.floor(f/3))%2==0};case Xi.PATTERN101:return function(u,f){return u*f%2+u*f%3==0};case Xi.PATTERN110:return function(u,f){return(u*f%2+u*f%3)%2==0};case Xi.PATTERN111:return function(u,f){return(u*f%3+(u+f)%2)%2==0};default:throw"bad maskPattern:"+l}},a.getErrorCorrectPolynomial=function(l){let u=bf([1],0);for(let f=0;f<l;f+=1)u=u.multiply(bf([1,tl.gexp(f)],0));return u},a.getLengthInBits=function(l,u){if(1<=u&&u<10)switch(l){case is.MODE_NUMBER:return 10;case is.MODE_ALPHA_NUM:return 9;case is.MODE_8BIT_BYTE:return 8;case is.MODE_KANJI:return 8;default:throw"mode:"+l}else if(u<27)switch(l){case is.MODE_NUMBER:return 12;case is.MODE_ALPHA_NUM:return 11;case is.MODE_8BIT_BYTE:return 16;case is.MODE_KANJI:return 10;default:throw"mode:"+l}else if(u<41)switch(l){case is.MODE_NUMBER:return 14;case is.MODE_ALPHA_NUM:return 13;case is.MODE_8BIT_BYTE:return 16;case is.MODE_KANJI:return 12;default:throw"mode:"+l}else throw"type:"+u},a.getLostPoint=function(l){const u=l.getModuleCount();let f=0;for(let g=0;g<u;g+=1)for(let m=0;m<u;m+=1){let w=0;const y=l.isDark(g,m);for(let b=-1;b<=1;b+=1)if(!(g+b<0||u<=g+b))for(let k=-1;k<=1;k+=1)m+k<0||u<=m+k||b==0&&k==0||y==l.isDark(g+b,m+k)&&(w+=1);w>5&&(f+=3+w-5)}for(let g=0;g<u-1;g+=1)for(let m=0;m<u-1;m+=1){let w=0;l.isDark(g,m)&&(w+=1),l.isDark(g+1,m)&&(w+=1),l.isDark(g,m+1)&&(w+=1),l.isDark(g+1,m+1)&&(w+=1),(w==0||w==4)&&(f+=3)}for(let g=0;g<u;g+=1)for(let m=0;m<u-6;m+=1)l.isDark(g,m)&&!l.isDark(g,m+1)&&l.isDark(g,m+2)&&l.isDark(g,m+3)&&l.isDark(g,m+4)&&!l.isDark(g,m+5)&&l.isDark(g,m+6)&&(f+=40);for(let g=0;g<u;g+=1)for(let m=0;m<u-6;m+=1)l.isDark(m,g)&&!l.isDark(m+1,g)&&l.isDark(m+2,g)&&l.isDark(m+3,g)&&l.isDark(m+4,g)&&!l.isDark(m+5,g)&&l.isDark(m+6,g)&&(f+=40);let h=0;for(let g=0;g<u;g+=1)for(let m=0;m<u;m+=1)l.isDark(m,g)&&(h+=1);const p=Math.abs(100*h/u/u-50)/5;return f+=p*10,f},a})(),tl=(function(){const e=new Array(256),t=new Array(256);for(let r=0;r<8;r+=1)e[r]=1<<r;for(let r=8;r<256;r+=1)e[r]=e[r-4]^e[r-5]^e[r-6]^e[r-8];for(let r=0;r<255;r+=1)t[e[r]]=r;const n={};return n.glog=function(r){if(r<1)throw"glog("+r+")";return t[r]},n.gexp=function(r){for(;r<0;)r+=255;for(;r>=256;)r-=255;return e[r]},n})(),bf=function(e,t){if(typeof e.length>"u")throw e.length+"/"+t;const n=(function(){let a=0;for(;a<e.length&&e[a]==0;)a+=1;const i=new Array(e.length-a+t);for(let l=0;l<e.length-a;l+=1)i[l]=e[l+a];return i})(),r={};return r.getAt=function(a){return n[a]},r.getLength=function(){return n.length},r.multiply=function(a){const i=new Array(r.getLength()+a.getLength()-1);for(let l=0;l<r.getLength();l+=1)for(let u=0;u<a.getLength();u+=1)i[l+u]^=tl.gexp(tl.glog(r.getAt(l))+tl.glog(a.getAt(u)));return bf(i,0)},r.mod=function(a){if(r.getLength()-a.getLength()<0)return r;const i=tl.glog(r.getAt(0))-tl.glog(a.getAt(0)),l=new Array(r.getLength());for(let u=0;u<r.getLength();u+=1)l[u]=r.getAt(u);for(let u=0;u<a.getLength();u+=1)l[u]^=tl.gexp(tl.glog(a.getAt(u))+i);return bf(l,0).mod(a)},r},gk=(function(){const e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(a,i){const l={};return l.totalCount=a,l.dataCount=i,l},n={},r=function(a,i){switch(i){case D0.L:return e[(a-1)*4+0];case D0.M:return e[(a-1)*4+1];case D0.Q:return e[(a-1)*4+2];case D0.H:return e[(a-1)*4+3];default:return}};return n.getRSBlocks=function(a,i){const l=r(a,i);if(typeof l>"u")throw"bad rs block @ typeNumber:"+a+"/errorCorrectionLevel:"+i;const u=l.length/3,f=[];for(let h=0;h<u;h+=1){const p=l[h*3+0],g=l[h*3+1],m=l[h*3+2];for(let w=0;w<p;w+=1)f.push(t(g,m))}return f},n})(),vk=function(){const e=[];let t=0;const n={};return n.getBuffer=function(){return e},n.getAt=function(r){const a=Math.floor(r/8);return(e[a]>>>7-r%8&1)==1},n.put=function(r,a){for(let i=0;i<a;i+=1)n.putBit((r>>>a-i-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(r){const a=Math.floor(t/8);e.length<=a&&e.push(0),r&&(e[a]|=128>>>t%8),t+=1},n},AJ=function(e){const t=is.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(l){return n.length},r.write=function(l){const u=n;let f=0;for(;f+2<u.length;)l.put(a(u.substring(f,f+3)),10),f+=3;f<u.length&&(u.length-f==1?l.put(a(u.substring(f,f+1)),4):u.length-f==2&&l.put(a(u.substring(f,f+2)),7))};const a=function(l){let u=0;for(let f=0;f<l.length;f+=1)u=u*10+i(l.charAt(f));return u},i=function(l){if("0"<=l&&l<="9")return l.charCodeAt(0)-48;throw"illegal char :"+l};return r},NJ=function(e){const t=is.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(i){return n.length},r.write=function(i){const l=n;let u=0;for(;u+1<l.length;)i.put(a(l.charAt(u))*45+a(l.charAt(u+1)),11),u+=2;u<l.length&&i.put(a(l.charAt(u)),6)};const a=function(i){if("0"<=i&&i<="9")return i.charCodeAt(0)-48;if("A"<=i&&i<="Z")return i.charCodeAt(0)-65+10;switch(i){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+i}};return r},MJ=function(e){const t=is.MODE_8BIT_BYTE,n=Dd.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(a){return n.length},r.write=function(a){for(let i=0;i<n.length;i+=1)a.put(n[i],8)},r},RJ=function(e){const t=is.MODE_KANJI,n=Dd.stringToBytes;(function(i,l){const u=n(i);if(u.length!=2||(u[0]<<8|u[1])!=l)throw"sjis not supported."})("友",38726);const r=n(e),a={};return a.getMode=function(){return t},a.getLength=function(i){return~~(r.length/2)},a.write=function(i){const l=r;let u=0;for(;u+1<l.length;){let f=(255&l[u])<<8|255&l[u+1];if(33088<=f&&f<=40956)f-=33088;else if(57408<=f&&f<=60351)f-=49472;else throw"illegal char at "+(u+1)+"/"+f;f=(f>>>8&255)*192+(f&255),i.put(f,13),u+=2}if(u<l.length)throw"illegal char at "+(u+1)},a},xR=function(){const e=[],t={};return t.writeByte=function(n){e.push(n&255)},t.writeShort=function(n){t.writeByte(n),t.writeByte(n>>>8)},t.writeBytes=function(n,r,a){r=r||0,a=a||n.length;for(let i=0;i<a;i+=1)t.writeByte(n[i+r])},t.writeString=function(n){for(let r=0;r<n.length;r+=1)t.writeByte(n.charCodeAt(r))},t.toByteArray=function(){return e},t.toString=function(){let n="";n+="[";for(let r=0;r<e.length;r+=1)r>0&&(n+=","),n+=e[r];return n+="]",n},t},PJ=function(){let e=0,t=0,n=0,r="";const a={},i=function(u){r+=String.fromCharCode(l(u&63))},l=function(u){if(u<0)throw"n:"+u;if(u<26)return 65+u;if(u<52)return 97+(u-26);if(u<62)return 48+(u-52);if(u==62)return 43;if(u==63)return 47;throw"n:"+u};return a.writeByte=function(u){for(e=e<<8|u&255,t+=8,n+=1;t>=6;)i(e>>>t-6),t-=6},a.flush=function(){if(t>0&&(i(e<<6-t),e=0,t=0),n%3!=0){const u=3-n%3;for(let f=0;f<u;f+=1)r+="="}},a.toString=function(){return r},a},LJ=function(e){const t=e;let n=0,r=0,a=0;const i={};i.read=function(){for(;a<8;){if(n>=t.length){if(a==0)return-1;throw"unexpected end of file./"+a}const f=t.charAt(n);if(n+=1,f=="=")return a=0,-1;if(f.match(/^\s$/))continue;r=r<<6|l(f.charCodeAt(0)),a+=6}const u=r>>>a-8&255;return a-=8,u};const l=function(u){if(65<=u&&u<=90)return u-65;if(97<=u&&u<=122)return u-97+26;if(48<=u&&u<=57)return u-48+52;if(u==43)return 62;if(u==47)return 63;throw"c:"+u};return i},$J=function(e,t){const n=e,r=t,a=new Array(e*t),i={};i.setPixel=function(h,p,g){a[p*n+h]=g},i.write=function(h){h.writeString("GIF87a"),h.writeShort(n),h.writeShort(r),h.writeByte(128),h.writeByte(0),h.writeByte(0),h.writeByte(0),h.writeByte(0),h.writeByte(0),h.writeByte(255),h.writeByte(255),h.writeByte(255),h.writeString(","),h.writeShort(0),h.writeShort(0),h.writeShort(n),h.writeShort(r),h.writeByte(0);const p=2,g=u(p);h.writeByte(p);let m=0;for(;g.length-m>255;)h.writeByte(255),h.writeBytes(g,m,255),m+=255;h.writeByte(g.length-m),h.writeBytes(g,m,g.length-m),h.writeByte(0),h.writeString(";")};const l=function(h){const p=h;let g=0,m=0;const w={};return w.write=function(y,b){if(y>>>b)throw"length over";for(;g+b>=8;)p.writeByte(255&(y<<g|m)),b-=8-g,y>>>=8-g,m=0,g=0;m=y<<g|m,g=g+b},w.flush=function(){g>0&&p.writeByte(m)},w},u=function(h){const p=1<<h,g=(1<<h)+1;let m=h+1;const w=f();for(let E=0;E<p;E+=1)w.add(String.fromCharCode(E));w.add(String.fromCharCode(p)),w.add(String.fromCharCode(g));const y=xR(),b=l(y);b.write(p,m);let k=0,S=String.fromCharCode(a[k]);for(k+=1;k<a.length;){const E=String.fromCharCode(a[k]);k+=1,w.contains(S+E)?S=S+E:(b.write(w.indexOf(S),m),w.size()<4095&&(w.size()==1<<m&&(m+=1),w.add(S+E)),S=E)}return b.write(w.indexOf(S),m),b.write(g,m),b.flush(),y.toByteArray()},f=function(){const h={};let p=0;const g={};return g.add=function(m){if(g.contains(m))throw"dup key:"+m;h[m]=p,p+=1},g.size=function(){return p},g.indexOf=function(m){return h[m]},g.contains=function(m){return typeof h[m]<"u"},g};return i},TJ=function(e,t,n){const r=$J(e,t);for(let u=0;u<t;u+=1)for(let f=0;f<e;f+=1)r.setPixel(f,u,n(f,u));const a=xR();r.write(a);const i=PJ(),l=a.toByteArray();for(let u=0;u<l.length;u+=1)i.writeByte(l[u]);return i.flush(),"data:image/gif;base64,"+i};Dd.stringToBytes;const I8=4;function DJ({value:e,label:t,size:n=200}){const{side:r,path:a}=s.useMemo(()=>{const i=Dd(0,"M");i.addData(e),i.make();const l=i.getModuleCount();let u="";for(let f=0;f<l;f++)for(let h=0;h<l;h++)i.isDark(f,h)&&(u+=`M${h+I8} ${f+I8}h1v1h-1z`);return{side:l+I8*2,path:u}},[e]);return o.jsxs("svg",{className:"sc-qr",viewBox:`0 0 ${r} ${r}`,width:n,height:n,role:"img","aria-label":t,shapeRendering:"crispEdges",children:[o.jsx("rect",{className:"sc-qr-plate",width:r,height:r}),o.jsx("path",{className:"sc-qr-ink",d:a})]})}const HJ=3e4,OJ=5*6e4;function IJ(e,t=!1){return t?{sentence:"Could not read this computer's network.",action:"check"}:e?e.reach==="this-computer"?{sentence:"Scenri was started for this computer only. Start it without SCENRI_HOST to open it on your phone.",action:null}:e.problem==="no-network"?{sentence:"Connect this computer to Wi-Fi, then check again.",action:"check"}:e.problem==="blocked"||!e.url?{sentence:"Another app is holding this address, so phones cannot open Scenri yet.",action:"check"}:{sentence:"Point your phone's camera at the code, or copy the link for another computer.",action:"copy"}:{sentence:"Checking this computer's network.",action:null}}const FJ=e=>e.url,_J=e=>`${e.slice(0,3)} ${e.slice(3)}`;function VJ(e,t,n){return e.lastVisit&&e.lastVisit.at>=t-OJ?"connected":n-t>=HJ?"stuck":"waiting"}function ZJ(e,t){var n;return e==="connected"?`Connected. Scenri opened on your ${((n=t.lastVisit)==null?void 0:n.device)??"device"}.`:e==="stuck"?"No phone has opened it yet.":"Waiting for your phone…"}function zJ(e,t){return e==="blocked"&&t==="darwin"?{text:"Your Mac's firewall is blocking Scenri, so your phone cannot open it yet.",canAllow:!0}:e==="blocked"&&t==="win32"?{text:"Windows Firewall is blocking Scenri on this network, so your phone cannot open it yet.",canAllow:!0}:e==="blocks-all"?{text:"Your Mac's firewall blocks every incoming connection. To open Scenri on your phone, turn off Block all incoming connections in System Settings, Network, Firewall, Options.",canAllow:!1}:null}function BJ(e,t){const n=t==="darwin";switch(e){case"asking":return n?"Enter your Mac password to allow Scenri.":"Choose Yes when Windows asks to allow Scenri.";case"done":return"Allowed. Scan the code again.";case"cancelled":return"Nothing changed. Press Allow Scenri to try again.";case"failed":case"unsupported":return n?"Could not change the firewall. Open System Settings, Network, Firewall, Options, and set node to allow incoming connections.":"Could not change the firewall. Open Windows Security, Firewall and network protection, Allow an app through firewall, and tick Node.js for Private and Public.";default:return null}}function UJ(e,t){const n=["Your phone has to be on the same Wi-Fi as this computer. Guest networks keep devices apart."];return e!=="blocked"&&e!=="blocks-all"&&e!=="ok"&&n.push("If this computer asks whether node may accept incoming connections, allow it."),n.push("If your phone's browser asks to find devices on your local network, allow it."),t.others.length&&n.push(`Or try ${t.others.join(" or ")}.`),n}const WJ=2e3;function KJ(){const{markUsed:e}=eu();s.useLayoutEffect(()=>{e("local-access")},[e]);const[t,n]=s.useState(null),[r,a]=s.useState(!1),[i,l]=s.useState(null),[u,f]=s.useState(()=>Date.now()),[h,p]=s.useState(!1),[g,m]=s.useState(null),[w,y]=s.useState("idle"),[b,k]=s.useState(!1),S=s.useRef(null),E=s.useRef(null),{push:C}=rr(),A=s.useCallback(async(K=!1)=>{try{n(await Ee.phone(K)),a(!1)}catch{a(!0)}},[]),[L,T]=s.useState(!1),M=async()=>{T(!0);try{n(await Ee.phoneNewCode()),l(Date.now())}catch{C({kind:"warning",title:"Could not make a new code"})}finally{T(!1)}};s.useEffect(()=>{A();const K=setInterval(()=>{f(Date.now()),A()},WJ);return()=>{clearInterval(K),S.current&&clearTimeout(S.current)}},[A]);const j=t?FJ(t):null;s.useEffect(()=>{j&&i===null&&l(Date.now())},[j,i]);const P=t&&j&&i!==null?VJ(t,i,u):null;s.useEffect(()=>{P==="stuck"&&p(!0)},[P]);const R=!!j&&!!(t!=null&&t.thisComputer);s.useEffect(()=>{if(!R)return;let K=!0;return Ee.phoneHelp().then(O=>K&&m(O.firewall)).catch(()=>K&&m("unknown")),()=>{K=!1}},[R]);const H=IJ(t,r),D=t?zJ(g,t.platform):null,B=t?BJ(w,t.platform):null,V=async()=>{j&&(await jJ(j,E.current)?(k(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>k(!1),1600)):C({kind:"warning",title:"Could not copy the link",detail:j}))},U=async()=>{y("asking");try{const K=await Ee.phoneAllow();m(K.firewall),y(K.result)}catch{y("failed")}};return o.jsxs(us,{title:"Other devices",children:[o.jsxs("div",{className:"sc-set-row",ref:E,children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Open on your phone"}),o.jsx("small",{"data-prose":"",children:H.sentence})]}),H.action==="copy"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void V(),children:o.jsx("span",{"aria-live":"polite",children:b?"Copied":"Copy link"})}),H.action==="check"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void A(!0),children:"Check again"})]}),t&&j&&o.jsxs("div",{className:"sc-phone",children:[o.jsx(DJ,{value:j,label:`QR code for ${t.address}`}),o.jsxs("div",{className:"sc-phone-how",children:[o.jsxs("p",{children:["No camera? Go to ",o.jsx("b",{className:"sc-phone-key",children:t.address})," in any browser on the same Wi-Fi, then enter ",o.jsx("b",{className:"sc-phone-key",children:_J(t.code)}),"."]}),t.thisComputer&&D&&o.jsxs("div",{className:"sc-phone-fw",role:"status",children:[o.jsx("p",{children:D.text}),D.canAllow&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:w==="asking",onClick:()=>void U(),children:w==="asking"?"Waiting for your permission…":"Allow Scenri"})]}),t.thisComputer&&B&&o.jsx("p",{className:"sc-phone-allow","data-state":w,"aria-live":"polite",children:B}),t.thisComputer&&P&&o.jsx("p",{className:"sc-phone-arrival","data-state":P,"aria-live":"polite",children:ZJ(P,t)}),t.thisComputer&&o.jsxs("details",{className:"sc-phone-help",open:h,onToggle:K=>p(K.currentTarget.open),children:[o.jsx("summary",{children:"Not opening?"}),o.jsx("ul",{children:UJ(g,t).map(K=>o.jsx("li",{children:K},K))})]})]})]}),(t==null?void 0:t.thisComputer)&&j&&o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"New code"}),o.jsx("small",{"data-prose":"",children:"Signs out every phone and tablet. They scan the new code to open Scenri again."})]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:L,onClick:()=>void M(),children:L?"Making…":"New code"})]})]})}function GJ(e){switch(e){case"npx":return"npx scenri update";case"global":case"managed":return"scenri update";default:return"npx scenri@latest"}}function YJ({version:e}){var k;const t=Um(),n=eu(),{brand:r}=cn(),a=t.status,[i,l]=s.useState(null),[u,f]=s.useState(!1);s.useEffect(()=>{Ee.settings().then(S=>l(!!S.updateCheck)).catch(()=>{})},[]);const h=async()=>{if(i===null)return;const S=!i;l(S);try{await Ee.saveSettings({updateCheck:S})}catch{l(!S)}},p=s.useRef(null);s.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const g=GJ(e==null?void 0:e.installKind),m=async()=>{try{await navigator.clipboard.writeText(g),f(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(!1),1600)}catch{}},w=t.checking?o.jsx("span",{className:"sc-tag",children:"checking…"}):a!=null&&a.available?o.jsxs("span",{className:"sc-tag sc-tag-gold",children:[a.latest," available"]}):t.checkError||a!=null&&a.error?o.jsx("span",{className:"sc-tag",children:"couldn't check for updates"}):a!=null&&a.checkedAt?o.jsx("span",{className:"sc-tag",children:"up to date"}):null;let y,b;return a!=null&&a.available?(e==null?void 0:e.installKind)==="dev"?(y="Running from source. Pull and rebuild when you're ready; nothing here touches your checkout.",b=null):(e==null?void 0:e.thisComputer)!==!0?(y="Updates are installed on the computer running Scenri.",b=null):qN(a)?a.phase==="ready"?(y=t.applyError??`${a.stagedVersion} is downloaded and verified. Restarting finishes it.`,b="restart"):a.phase==="staging"?(y="Downloading in the background. Nothing interrupts your work.",b="downloading"):a.phase==="error"?(y=t.applyError??a.error??"Couldn't download the update. Try again.",b="update"):(y=`You are on ${a.current}.`,b="update"):(y=o.jsxs(o.Fragment,{children:["Run ",o.jsx("code",{children:g})," in a terminal, then start Scenri again. Your library is not part of the app and stays put."]}),b="copy"):(y=a&&!a.enabled?"Automatic checks are off. Checking here still works.":"New versions announce themselves here.",b="check"),o.jsxs(us,{children:[o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Updates"}),o.jsxs("small",{"data-prose":"",children:[y,(a==null?void 0:a.available)&&a.phase!=="ready"&&a.notesUrl&&o.jsxs(o.Fragment,{children:[" ",o.jsxs("a",{href:a.notesUrl,target:"_blank",rel:"noreferrer",children:["See what's in ",a.latest]})]})]})]}),w,b==="check"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:t.checking,onClick:()=>void t.checkNow(),children:"Check for updates"}),(b==="update"||b==="restart")&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:t.busy!=="idle",onClick:()=>void t.apply(),children:t.busy!=="idle"?"Updating…":(a==null?void 0:a.phase)==="error"?"Try again":"Update"}),b==="downloading"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:!0,children:"Downloading…"}),b==="copy"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void m(),children:u?"Copied":"Copy command"})]}),o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Automatic updates"}),o.jsx("small",{"data-prose":"",children:"A version check every six hours; new versions download in the background, and restarting is always your call. Off means Scenri never calls anywhere by itself."})]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:i===null,onClick:()=>void h(),children:i===null?"…":i?"Turn off":"Turn on"})]}),o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"What's new"}),o.jsx("small",{children:((k=n.featured)==null?void 0:k.title)??"What changed in Scenri, newest first."})]}),o.jsx(Vn,{className:"sc-btn sc-btn-ghost",to:Ap(r),children:"Show"})]})]})}function wk({weeks:e,months:t,cells:n}){return o.jsxs("div",{className:"sc-heat-range","data-weeks":e,children:[o.jsx("div",{className:"sc-heat-months",children:t.map(r=>o.jsx("span",{children:r.label},r.key))}),o.jsx("div",{className:"sc-heat-grid",children:n.map(r=>o.jsx("i",{"data-l":r.level||void 0,title:r.title},r.key))})]})}function qJ({brandId:e}){const[t,n]=s.useState(null);s.useEffect(()=>{let u=!0;return n(null),Ee.usage(e).then(f=>u&&n(f.days)).catch(()=>u&&n([])),()=>{u=!1}},[e]);const{year:r,quarter:a,total:i,byKind:l}=s.useMemo(()=>{const u=new Map;for(const g of t??[])u.set(g.day,(u.get(g.day)??0)+g.generations+g.edits);const f=mk(u,53),h=mk(u,13),p={generation:0,edit:0};for(const g of t??[])g.day<f.from||(p.generation+=g.generations,p.edit+=g.edits);return{year:f,quarter:h,total:f.sum,byKind:p}},[t]);return o.jsx(us,{sub:t===null?"Counting your runs…":i?`${i.toLocaleString()} runs in the last year: ${l.generation.toLocaleString()} generations, ${l.edit.toLocaleString()} edits.`:"Nothing made yet this year. The first shot lands here.",children:o.jsxs("div",{className:"sc-heat",children:[o.jsx(wk,{weeks:53,months:r.months,cells:r.cells}),o.jsx(wk,{weeks:13,months:a.months,cells:a.cells})]})})}function XJ({engines:e,brandId:t,onSaved:n}){const r=jr("settings"),a=r.value!==null,[i,l]=s.useState(null);s.useEffect(()=>{if(!a||i)return;let y=!0;return Ee.version().then(b=>y&&l(b)).catch(()=>{}),()=>{y=!1}},[a,i]);const[u,f]=s.useState(null);s.useEffect(()=>{if(!a)return;let y=!0;return Ee.home().then(b=>y&&f(b)).catch(()=>{}),()=>{y=!1}},[a]);const[h,p]=s.useState(null),g=(i==null?void 0:i.thisComputer)===!0;s.useEffect(()=>{if(!a||!g)return;let y=!0;return Ee.desktop().then(b=>y&&p(b)).catch(()=>{}),()=>{y=!1}},[a,g]);const[m,w]=s.useState("idle");return o.jsx(Ws,{open:a,className:"sc-set",maxWidth:"880px",onDismiss:r.close,children:o.jsx(QJ,{value:r.value,onPick:r.set,saved:o.jsx(JJ,{state:m}),page:y=>o.jsx(eee,{page:y,engines:e,brandId:t,onSaved:n,onKitState:w,version:i,home:u,desktop:h,onDesktop:p})})})}function QJ({value:e,onPick:t,saved:n,page:r}){const a=Nr(la),{brand:i}=cn(),l=yY(e),[u,f]=s.useState(()=>bY(e)),h=s.useRef(new Map),p=s.useRef(!1);s.useEffect(()=>{var y;!a||!u||!p.current||(p.current=!1,(y=h.current.get(l))==null||y.focus({preventScroll:!0}))},[a,u,l]);const g=y=>{t(y),f(!1)},m=Rh.find(y=>y.id===l);if(a&&!u)return o.jsxs("div",{className:"sc-set-level",children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx("button",{type:"button",className:"sc-newdlg-back",onClick:()=>{p.current=!0,f(!0)},"aria-label":"Settings",children:o.jsx($a,{size:15})}),o.jsx(Ns,{className:"sc-newdlg-title",children:m.label}),l==="brand"&&n,o.jsx(yk,{})]}),o.jsx("div",{className:"sc-newdlg-body sc-set-body",children:o.jsxs("div",{className:"sc-set-scroll",children:[o.jsx("p",{className:"sc-set-lede",children:m.sub(Ca(i))}),r(l)]})})]},`page-${l}`);const w=y=>o.jsx("li",{children:o.jsxs("button",{type:"button",className:"sc-set-item","data-danger":y.scope==="apart"?"":void 0,"aria-current":!a&&l===y.id?"page":void 0,ref:b=>{b?h.current.set(y.id,b):h.current.delete(y.id)},onClick:()=>g(y.id),children:[o.jsx(y.Icon,{size:16,className:"sc-set-item-ic"}),o.jsx("span",{className:"sc-set-item-lb",children:y.label}),y.feature&&o.jsx(SQ,{feature:y.feature}),a&&o.jsx(Al,{size:14,className:"sc-set-item-go"})]})},y.id);return o.jsxs("div",{className:"sc-set-level",children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Settings"}),o.jsx(yk,{})]}),o.jsxs("div",{className:"sc-newdlg-body sc-set-body",children:[o.jsxs("nav",{className:"sc-set-rail","aria-label":"Settings",children:[o.jsx("p",{className:"sc-set-group",children:"This brand"}),o.jsx("ul",{children:Rh.filter(y=>y.scope==="brand").map(w)}),o.jsx("p",{className:"sc-set-group",children:"Studio"}),o.jsx("ul",{children:Rh.filter(y=>y.scope==="studio").map(w)}),o.jsx("p",{className:"sc-set-group",children:"Delete"}),o.jsx("ul",{className:"sc-set-apart",children:Rh.filter(y=>y.scope==="apart").map(w)})]}),!a&&o.jsxs("div",{className:"sc-set-scroll",children:[o.jsxs("header",{className:"sc-set-head",children:[o.jsxs("span",{className:"sc-set-head-say",children:[o.jsx("h2",{children:m.label}),o.jsx("p",{children:m.sub(Ca(i))})]}),l==="brand"&&n]}),r(l)]},l)]})]},"index")}function JJ({state:e}){const[t,n]=s.useState(!1),r=s.useRef(e);return s.useEffect(()=>{const a=r.current;if(r.current=e,e!=="idle"){n(!0);return}if(a==="idle")return;const i=setTimeout(()=>n(!1),1600);return()=>clearTimeout(i)},[e]),o.jsxs("span",{className:"sc-set-saved","data-on":t?"":void 0,"data-state":e,"aria-live":"polite",children:[e==="idle"&&o.jsx(Kn,{size:12,weight:"bold"}),$Q(e)]})}function eee({page:e,engines:t,brandId:n,onSaved:r,onKitState:a,version:i,home:l,desktop:u,onDesktop:f}){const h=(i==null?void 0:i.thisComputer)===!0;switch(e){case"brand":return o.jsx(iJ,{onSaveState:a});case"usage":return o.jsx(qJ,{brandId:n});case"engines":return o.jsxs(o.Fragment,{children:[o.jsx(kJ,{engines:t}),o.jsx(hJ,{engines:t,onSaved:r,thisComputer:h})]});case"appearance":return o.jsx(AQ,{});case"library":return o.jsx(CJ,{info:l,thisComputer:h});case"phone":return o.jsxs(o.Fragment,{children:[o.jsx(KJ,{}),h&&o.jsx(gJ,{status:u,onStatus:f})]});case"updates":return o.jsx(YJ,{version:i});case"about":return o.jsx(CQ,{version:i});case"danger":return o.jsx(pJ,{onDone:r,thisComputer:h})}}function yk(){return o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})}function tee(e){return!e.lead||e.spent||e.firstUse||e.onPage||!e.loaded||!e.visible||e.dialogOpen?!1:e.running===0&&!e.builds.some(t=>!t.finished)}function nee(e){return e>0?`See ${e} more update${e===1?"":"s"}`:"See all updates"}const kR="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1920'%20height='1080'%20viewBox='0%200%201920%201080'%20fill='none'%3e%3c!--%20Scenri%20og-image,%20Figma%20hYeysad0V3rwpN49vWNSeE%20node%205480:2:%20the%20ground%20and%20the%20logo,%20paths%20as%20exported%20--%3e%3ctitle%3eScenri%3c/title%3e%3crect%20width='1920'%20height='1080'%20fill='%2311100E'/%3e%3cpath%20d='M872.355%20532.044L846.18%20528.839C836.935%20527.733%20833.219%20525.379%20833.219%20521.182C833.219%20516.503%20841.132%20513.78%20853.355%20513.78C867.79%20513.78%20876.439%20516.247%20881.374%20525.379L902.473%20518.828C894.079%20500.678%20875.447%20495.375%20855.311%20495.375C827.292%20495.375%20809.142%20504.762%20809.142%20523.649C809.142%20537.971%20819.891%20545.883%20841.982%20548.577L865.804%20551.527C876.042%20552.774%20878.906%20555.469%20878.906%20559.184C878.906%20564.118%20871.363%20567.578%20857.041%20567.578C839.515%20567.578%20832.709%20564.005%20827.888%20554.986L805.796%20561.537C813.708%20579.801%20832.454%20585.983%20855.567%20585.983C884.21%20585.983%20903.239%20576.341%20903.239%20556.972C903.239%20543.132%20893.738%20534.624%20872.384%20532.044H872.355Z'%20fill='%23fff'/%3e%3cpath%20d='M962.368%20514.262C974.478%20514.262%20985.453%20518.091%20990.643%20530.938L1012.73%20525.635C1007.91%20508.591%20989.508%20495.517%20962%20495.517C930.266%20495.517%20907.663%20513.043%20907.663%20540.693C907.663%20568.344%20930.266%20586.125%20962%20586.125C989.537%20586.125%201007.94%20572.796%201012.73%20555.752L990.643%20550.449C985.453%20563.296%20974.478%20567.124%20962.368%20567.124C945.948%20567.124%20932.619%20558.843%20932.619%20541.941V539.474C932.619%20522.572%20945.948%20514.291%20962.368%20514.291V514.262Z'%20fill='%23fff'/%3e%3cpath%20d='M1043.99%20548.946H1095.23V531.42H1043.99V515.142H1100.79V496.85H1019.29V584.509H1101.64V566.245H1043.99V548.946Z'%20fill='%23fff'/%3e%3cpath%20d='M1177.84%20545.997H1177.73L1135.73%20496.85H1110.43V584.509H1133.4V527.96H1133.52L1181.93%20584.509H1200.81V496.85H1177.84V545.997Z'%20fill='%23fff'/%3e%3cpath%20d='M1301.32%20526.003C1301.32%20507.116%201289.47%20496.85%201266.13%20496.85H1212.04V584.509H1236.75V556.348H1256.99L1274.04%20584.509H1302.2L1282.32%20553.143C1294.66%20548.691%201301.32%20539.672%201301.32%20525.975V526.003ZM1276.62%20527.478C1276.62%20535.021%201272.42%20538.708%201263.91%20538.708H1236.75V515.113H1263.91C1272.42%20515.113%201276.62%20518.828%201276.62%20526.23V527.478Z'%20fill='%23fff'/%3e%3cpath%20d='M1334.05%20496.85H1309.35V584.509H1334.05V496.85Z'%20fill='%23fff'/%3e%3cpath%20d='M767.454%20503.06V560.034L731.665%20595.739V485.79H750.155C759.712%20485.79%20767.454%20493.532%20767.454%20503.089V503.06Z'%20fill='%23fff'/%3e%3cpath%20d='M621.744%20485.789V595.739H603.253C593.696%20595.739%20585.954%20587.997%20585.954%20578.44V521.466L621.744%20485.761V485.789Z'%20fill='%23fff'/%3e%3cpath%20d='M731.664%20595.71L695.96%20631.5H638.986C629.429%20631.5%20621.687%20623.758%20621.687%20614.201V595.71H731.636H731.664Z'%20fill='%23fff'/%3e%3cpath%20d='M621.744%20485.79L657.42%20450H714.394C723.951%20450%20731.693%20457.742%20731.693%20467.299V485.79H621.744Z'%20fill='%23fff'/%3e%3c/svg%3e",ree="/assets/whatsnew-stage-DlyjaAn6.webp",see=["January","February","March","April","May","June","July","August","September","October","November","December"];function SR(e){const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return e;const n=see[Number(t[2])-1];return n?`${Number(t[3])} ${n} ${t[1]}`:e}function aee(e){const t=SR(e);if(t===e)return e;const[n,r,a]=t.split(" ");return`${n} ${r.slice(0,3)} ${a}`}const oee="/assets/0.16.0-local-access-D7XQonLd.webp",iee="/assets/0.17.0-select-several-DdAw3yQ3.webp",lee="/assets/0.17.1-presenter-identity-BfgRpajU.webp",cee="/assets/0.17.2-presenter-prompt-BiaRpVJN.webp",uee="/assets/0.18.0-portrait-standard-CrJ6Ixm2.webp",dee="/assets/0.19.0-home-examples-Dv7HjKk9.webp",fee="/assets/0.20.0-made-in-place-B0L_kS__.webp",hee=Object.assign({"./assets/whatsnew/0.16.0-local-access.webp":oee,"./assets/whatsnew/0.17.0-select-several.webp":iee,"./assets/whatsnew/0.17.1-presenter-identity.webp":lee,"./assets/whatsnew/0.17.2-presenter-prompt.webp":cee,"./assets/whatsnew/0.18.0-portrait-standard.webp":uee,"./assets/whatsnew/0.19.0-home-examples.webp":dee,"./assets/whatsnew/0.20.0-made-in-place.webp":fee});function pee(e){return hee[`./assets/whatsnew/${e}`]??null}const ER="Scenri could not read its release notes. If you are running a development server, it may predate this page; restart it and try again.",CR="There is nothing new to show here yet.",mee={fetchpriority:"high"};function jR(e){var r;const t=(r=e==null?void 0:e.sections.find(a=>a.image))==null?void 0:r.image,n=t?pee(t.file):null;return t&&n?{src:n,alt:t.alt}:null}function AR({picture:e,eager:t=!1,onOpen:n,onBroken:r}){const[a,i]=s.useState("wait"),l=s.useCallback(h=>{h!=null&&h.complete&&h.naturalWidth>0&&i("ready")},[]);if(a==="broken")return null;const u=a==="ready"||void 0,f=o.jsx("img",{ref:l,...t?mee:void 0,src:e.src,alt:e.alt,loading:t?"eager":"lazy",decoding:"async",onLoad:()=>i("ready"),onError:()=>{i("broken"),r==null||r()}});return n?o.jsxs("button",{type:"button",className:"sc-wn-media","data-ready":u,"aria-haspopup":"dialog",onClick:n,children:[f,o.jsx("span",{className:"sc-vh",children:", view larger"}),o.jsx("span",{className:"sc-corner","aria-hidden":"true",children:o.jsx("span",{className:"sc-cell-ctl",children:o.jsx(qI,{size:14})})})]}):o.jsx("div",{className:"sc-wn-media","data-ready":u,children:f})}function gee({src:e,alt:t,onClose:n}){const r=s.useRef(null);return o.jsx(Ml,{open:!0,onOpenChange:a=>!a&&n(),children:o.jsxs(Rl,{children:[o.jsx(Pl,{className:"sc-wn-lb-scrim"}),o.jsxs(Ll,{className:"sc-wn-lb","aria-describedby":void 0,onOpenAutoFocus:a=>{r.current=document.activeElement,WN(a)},onCloseAutoFocus:a=>{var i;a.preventDefault(),(i=r.current)!=null&&i.isConnected&&r.current.focus()},onClick:n,children:[o.jsx($l,{className:"sc-vh",children:t}),o.jsx("div",{className:"sc-wn-media sc-wn-lb-stage","data-ready":!0,children:o.jsx("img",{src:e,alt:t})}),o.jsx(Of,{className:"sc-icon-btn sc-wn-lb-close","aria-label":"Close",children:o.jsx(jn,{size:16})})]})]})})}function NR({version:e,current:t=!1}){return o.jsxs("span",{className:"sc-tag sc-tag-version","data-on":t||void 0,children:[o.jsx("span",{className:"sc-vh",children:"Version "}),e,t&&o.jsx("span",{className:"sc-vh",children:", the version you are on"})]})}function vee({sections:e}){return o.jsx("div",{className:"sc-wn-areas",children:e.map(t=>o.jsxs("section",{className:"sc-wn-area",children:[o.jsx("h3",{children:t.heading}),o.jsx("p",{children:t.body})]},t.heading))})}function MR({entry:e,current:t=!1,hideVersion:n=!1}){return o.jsxs("p",{className:"sc-wn-when",children:[!n&&o.jsx(NR,{version:e.version,current:t}),o.jsxs("time",{dateTime:e.date,children:[o.jsx("span",{"aria-hidden":"true",children:aee(e.date)}),o.jsx("span",{className:"sc-vh",children:SR(e.date)})]})]})}function wee({version:e,current:t}){return o.jsxs("div",{className:"sc-wn-media sc-wn-fallback","data-ready":!0,children:[o.jsx("img",{src:kR,alt:""}),o.jsx("span",{className:"sc-wn-fallback-chip","data-theme":"dark",children:o.jsx(NR,{version:e,current:t})})]})}function yee({href:e,version:t}){return o.jsxs("a",{className:"sc-wn-notes",href:e,target:"_blank",rel:"noopener noreferrer",children:["Release notes",o.jsxs("span",{className:"sc-vh",children:[" for ",t," on GitHub, opens in a new tab"]}),o.jsx(Ac,{size:12,"aria-hidden":"true"})]})}function bee(){const e=jr("whatsnew"),{brand:t}=cn(),{status:n,featured:r,recent:a,unseen:i,lead:l,running:u,markSeen:f}=eu(),h=e.value!==null&&n!=="loading",p=r,g=s.useRef({open:!1,more:0});h&&!g.current.open?g.current={open:!0,more:i.filter(A=>A!==(p==null?void 0:p.version)).length}:h||(g.current.open=!1);const m=()=>{f(),e.close()},w=s.useRef(h);s.useEffect(()=>{w.current&&!h&&f(),w.current=h},[h,f]);const[y,b]=s.useState(null),k=p&&y!==p.version?jR(p):null,S=(k==null?void 0:k.src)??kR;s.useEffect(()=>{if(l)for(const A of[S,ree]){const L=new Image;L.fetchPriority="high",L.src=A}},[l,S]);const E=s.useRef(!1),C=A=>{!A.metaKey&&!A.ctrlKey&&!A.shiftKey&&!A.altKey&&(E.current=!0)};return o.jsxs(Ws,{open:h,className:"sc-wn",tone:"dim",maxWidth:"520px",described:!0,onDismiss:m,onCloseAutoFocus:A=>{E.current&&(A.preventDefault(),E.current=!1)},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"What's new"}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})]}),o.jsx("div",{className:"sc-newdlg-body",children:p?o.jsxs("article",{className:"sc-wn-ex",children:[k?o.jsx(AR,{picture:k,eager:!0,onBroken:()=>b(p.version)},p.version):o.jsx(wee,{version:p.version,current:p.version===u}),o.jsx(MR,{entry:p,current:p.version===u,hideVersion:!k}),o.jsx(Hc,{asChild:!0,children:o.jsx("h3",{className:"sc-wn-hed",children:o.jsx(Vn,{className:"sc-wn-ex-link",to:`${Ap(t)}#v${p.version}`,replace:!0,onClick:C,children:p.title})})})]}):o.jsx(Hc,{className:"sc-wn-txt",children:n==="failed"?ER:CR})}),o.jsxs("div",{className:"sc-newdlg-foot sc-wn-foot",children:[a.length>0&&o.jsxs(Vn,{className:"sc-wn-link",to:Ap(t),replace:!0,onClick:C,children:[nee(g.current.more),o.jsx(xa,{size:13,"aria-hidden":"true"})]}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",children:"Got it"})})]})]})}function xee(e){return{installed:e==="not-authenticated"||e==="signing-in"||e==="update-needed"||e==="env-conflict"||e==="repairing"||e==="ready",signedIn:e==="env-conflict"||e==="repairing"||e==="ready",connected:e==="ready",now:e==="not-installed"||e==="installing"?"install":e==="not-authenticated"||e==="signing-in"?"signin":e==="env-conflict"||e==="repairing"?"connect":null}}function RR(e){return e.length===0?"that key":e.length===1?`the ${e[0]} variable`:`the ${e.slice(0,-1).join(", ")} and ${e[e.length-1]} variables`}function kee(e){return`Scenri will start Codex without ${RR(e)}. Nothing on your computer changes, and you can undo this here later.`}function See(e){return`Scenri is starting Codex without ${RR(e)} on this computer.`}const Eee=2e3,Cee=5*6e4;function jee({engines:e,onSaved:t}){const n=jr("setup"),r=n.close,a=n.value,i=a?vR(a):void 0,u=!!i||a==="codex-cli",f=e.find(g=>g.id===a),[h,p]=s.useState(!0);return s.useEffect(()=>{let g=!0;return Ee.version().then(m=>g&&p(m.thisComputer!==!1)).catch(()=>{}),()=>{g=!1}},[]),o.jsx(Ws,{open:u,className:"sc-setup",maxWidth:"520px",onDismiss:r,onOpenAutoFocus:i&&h?g=>{var m;g.preventDefault(),(m=g.target.querySelector(".sc-setup-key input"))==null||m.focus()}:void 0,children:i?o.jsx(Aee,{provider:i,name:f?vl(f.displayName):i.engineId,connected:!!(f!=null&&f.available),thisComputer:h,onSaved:t,onDone:r}):o.jsx(Nee,{engines:e,onSaved:t,onDone:r})})}function PR({title:e}){return o.jsxs("div",{className:"sc-newdlg-head sc-setup-head",children:[o.jsx(Ns,{className:"sc-newdlg-title sc-setup-title",children:e}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})]})}function Aee({provider:e,name:t,connected:n,thisComputer:r,onSaved:a,onDone:i}){const[l,u]=s.useState(""),[f,h]=s.useState(!1),[p,g]=s.useState(null),[m,w]=s.useState(!1),y=async()=>{const k=l.trim();if(k){h(!0),g(null);try{await Ee.saveSettings({[e.settingKey]:k}),u(""),a(),i()}catch(S){g(S.message)}finally{h(!1)}}},b=async()=>{h(!0),g(null);try{await Ee.saveSettings({[e.settingKey]:""});const k=await Ee.settings();if(a(),k[e.settingKey]){w(!0);return}i()}catch(k){g(k.message)}finally{h(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(PR,{title:n?`${t} key`:`Connect ${t}`}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(LR,{engineId:e.engineId,name:t,state:n?"Connected":"Not connected",ready:n}),o.jsx("p",{className:"sc-setup-lead",children:r?n?`A key is saved for ${t}. Paste a new one to replace it, or disconnect to remove it from this computer.`:`Paste a key from ${t}. It is stored in your library folder on this computer, sent only to ${t}, and never shown again.`:"Keys are added on the computer running Scenri."})]}),r&&o.jsxs("form",{className:"sc-setup-key",onSubmit:k=>{k.preventDefault(),y()},children:[o.jsx("input",{className:"sc-in",type:"password",placeholder:e.hint,value:l,onChange:k=>u(k.target.value),autoComplete:"off",name:e.settingKey,"aria-label":`${t} key`}),o.jsxs("div",{className:"sc-setup-acts",children:[o.jsxs("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:f||!l.trim(),children:[f?o.jsx(Pr,{size:"1"}):o.jsx(_E,{size:15}),n?"Replace key":"Connect"]}),o.jsxs("a",{className:"sc-setup-alt",href:e.keysUrl,target:"_blank",rel:"noreferrer",children:["Get a key ",o.jsx(Ac,{size:13})]})]})]}),r&&n&&o.jsx("div",{className:"sc-setup-cut",children:o.jsx(Xn,{label:"Disconnect",title:`Disconnect ${t}?`,body:"The key is deleted from this computer. Nothing you have already generated changes, and you can paste a new key at any time.",busy:f,onConfirm:()=>void b()})}),m&&o.jsxs("p",{className:"sc-setup-note",children:["The stored key is gone, but ",t," is still connected through the ",e.settingKey.toUpperCase()," ","environment variable on this computer. Remove it from your shell to disconnect fully."]}),p&&o.jsx("div",{className:"sc-setup-problem",children:o.jsxs("p",{"data-detail":"",children:[o.jsx(vm,{size:15})," ",p]})})]})]})}function Nee({engines:e,onSaved:t,onDone:n}){const r=_l(),[a,i]=s.useState("checking"),[l,u]=s.useState(null),[f,h]=s.useState(!1),[p,g]=s.useState("mac"),[m,w]=s.useState(null),[y,b]=s.useState([]),[k,S]=s.useState([]),E=s.useRef(null),C=s.useCallback(()=>{E.current!==null&&(window.clearInterval(E.current),E.current=null)},[]),A=s.useCallback(async(K=!1)=>{const{state:O,reason:F,platform:I,conflictKeys:G,ignoredKeys:z}=await Ee.codexStatus({force:K});return I&&g(I),w(F??null),b(G??[]),S(z??[]),i(O),O},[]);s.useEffect(()=>(u(null),i("checking"),A().catch(()=>i("unverified")),C),[A,C]);const L=s.useCallback(()=>{u(null),i("checking"),A(!0).catch(()=>i("unverified"))},[A]),T=async()=>{u(null),i("repairing");try{const{state:K,conflictKeys:O,ignoredKeys:F,reason:I}=await Ee.repairCodexEnv(y);b(O??[]),S(F??[]),w(I??null),i(K)}catch(K){u({detail:K.message}),i("env-conflict")}},M=async()=>{u(null),i("checking");try{const{state:K,conflictKeys:O,ignoredKeys:F}=await Ee.restoreCodexEnv();b(O??[]),S(F??[]),i(K)}catch{A().catch(()=>i("unverified"))}};s.useEffect(()=>{a==="ready"&&t()},[a,t]);const j=async()=>{u(null),i("installing");try{const K=await Ee.installCodex();if(K.ok||K.state!=="not-installed"){i(K.state);return}u({detail:K.detail,command:K.fallbackCommand,docsUrl:K.docsUrl}),i(K.state)}catch(K){u({detail:K.message,command:"npm install -g @openai/codex"}),i("not-installed")}},P=async()=>{u(null),i("signing-in");const K=Date.now();C(),E.current=window.setInterval(()=>{if(Date.now()-K>Cee){C(),i("not-authenticated"),u({detail:"Sign-in did not finish. Try again, or use the command below.",command:"codex login"});return}Ee.codexStatus().then(({state:O})=>{O==="ready"&&(C(),i("ready"))}).catch(()=>{})},Eee);try{const O=await Ee.loginCodex();if(C(),O.ok||O.state==="ready"){i(O.state);return}u({detail:O.detail,command:O.fallbackCommand}),i(O.state)}catch(O){C(),u({detail:O.message,command:"codex login --device-auth"}),i("not-authenticated")}},R=s.useRef(null);s.useEffect(()=>()=>{R.current&&window.clearTimeout(R.current)},[]);const H=K=>{var O;(O=navigator.clipboard)==null||O.writeText(K).then(()=>{h(!0),R.current&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>h(!1),1600)})},D=e.filter(K=>K.available&&K.id!=="codex-cli"&&!K.localOnly),B=a==="checking"||a==="installing"||a==="signing-in"||a==="repairing",V=a==="not-installed"||a==="installing"?{step:0,label:"Install Codex CLI",verb:a==="installing"?"Installing":"Install",busy:a==="installing",run:j}:a==="not-authenticated"||a==="signing-in"?{step:1,label:"Sign in with ChatGPT",verb:a==="signing-in"?"Waiting for your browser":"Sign in",busy:a==="signing-in",run:P}:a==="env-conflict"||a==="repairing"?{step:2,label:"Ignore that key",verb:a==="repairing"?"Ignoring":"Ignore that key",busy:a==="repairing",run:T}:null,U=a==="not-installed"||a==="installing"||a==="not-authenticated"||a==="signing-in";return o.jsxs(o.Fragment,{children:[o.jsx(PR,{title:"Set up image generation"}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(LR,{engineId:"codex-cli",name:"Codex CLI",state:Mee[a],ready:a==="ready",busy:B}),o.jsx("p",{className:"sc-setup-lead",children:Ree[a](m)}),a==="no-plan"&&o.jsx("p",{className:"sc-setup-lead",children:"You can use your own key from an image provider instead. You pay that provider directly, per image, and the key stays in your library folder on this computer."})]}),a!=="no-plan"&&o.jsx(Pee,{phase:a,act:V}),a==="signing-in"&&o.jsx("p",{className:"sc-setup-note",children:"Finish in the browser tab that just opened. This screen updates itself."}),(a==="env-conflict"||a==="repairing")&&o.jsx("p",{className:"sc-setup-note",children:kee(y)}),a==="ready"&&k.length>0&&o.jsxs("p",{className:"sc-setup-note",children:[See(k)," ",o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:M,children:"Use it again"})]}),a==="unverified"&&o.jsx("p",{className:"sc-setup-note",children:"If you just installed Codex, quit and reopen Scenri so it can see the new command."}),a==="update-needed"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"sc-setup-cmd",children:[o.jsx("code",{children:"npm install -g @openai/codex@latest"}),o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>H("npm install -g @openai/codex@latest"),children:[f?o.jsx(Kn,{size:14}):o.jsx(mp,{size:14}),f?"Copied":"Copy"]})]}),p==="windows"&&o.jsxs("p",{className:"sc-setup-note",children:["Installed with the standalone installer instead? Update it in PowerShell:"," ",o.jsx("code",{children:"irm https://chatgpt.com/codex/install.ps1 | iex"})]})]}),a==="no-plan"&&D.length>0&&o.jsxs("p",{className:"sc-setup-note",children:[D.map(K=>vl(K.displayName)).join(", ")," is already connected, so you can generate now."]}),l&&o.jsxs("div",{className:"sc-setup-problem",children:[o.jsxs("p",{"data-detail":"",children:[o.jsx(vm,{size:15})," ",l.detail??"That did not work."]}),l.command&&o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"sc-setup-note",children:["Run this in ",p==="windows"?"PowerShell":"Terminal",", then reopen this window:"]}),o.jsxs("div",{className:"sc-setup-cmd",children:[o.jsx("code",{children:l.command}),o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>H(l.command),children:[f?o.jsx(Kn,{size:14}):o.jsx(mp,{size:14}),f?"Copied":"Copy"]})]})]}),l.docsUrl&&o.jsxs("a",{className:"sc-setup-alt",href:l.docsUrl,target:"_blank",rel:"noreferrer",children:["Installation help ",o.jsx(Ac,{size:13})]})]}),a==="ready"&&o.jsxs("div",{className:"sc-setup-acts",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:n,children:"Start creating"}),o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:L,children:[o.jsx(pp,{size:14})," Check again"]})]}),(a==="unverified"||a==="update-needed")&&o.jsxs("div",{className:"sc-setup-acts",children:[o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:L,children:[o.jsx(pp,{size:15})," Check again"]}),a==="unverified"&&o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:()=>i("no-plan"),children:"I do not have ChatGPT"})]}),a==="no-plan"&&o.jsxs("div",{className:"sc-setup-acts",children:[o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>r("openrouter"),children:[o.jsx(_E,{size:15})," Add a provider key"]}),o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:()=>void A(),children:"Back to Codex setup"})]}),U&&o.jsx("div",{className:"sc-setup-acts",children:o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:()=>i("no-plan"),children:"I do not have ChatGPT"})})]})]})}const Mee={checking:"Checking","not-installed":"Not installed",installing:"Installing","not-authenticated":"Not signed in","signing-in":"Waiting for your browser",ready:"Ready","env-conflict":"An old key is in the way",repairing:"Setting that key aside",unverified:"Could not verify","update-needed":"Needs an update","no-plan":"Needs a ChatGPT plan"},Ree={checking:()=>"Checking that Codex can actually reach OpenAI from this computer.","not-installed":()=>"Scenri generates with Codex CLI, a small official helper from OpenAI that runs on this computer and uses your own ChatGPT plan. It needs to be installed once.",installing:()=>"Scenri generates with Codex CLI, a small official helper from OpenAI that runs on this computer and uses your own ChatGPT plan. It needs to be installed once.","not-authenticated":()=>"Codex CLI is installed. Sign in with the ChatGPT account whose plan should cover your images. This opens your browser, and Scenri never sees your password or token.","signing-in":()=>"Codex CLI is installed. Sign in with the ChatGPT account whose plan should cover your images. This opens your browser, and Scenri never sees your password or token.",ready:()=>"Codex CLI is ready. Your images run on your own ChatGPT plan, and Scenri adds nothing to the bill.","env-conflict":()=>"Codex is signed in, but an old OpenAI API key on this computer is being used instead of your ChatGPT plan, and OpenAI turned it down.",repairing:()=>"Codex is signed in, but an old OpenAI API key on this computer is being used instead of your ChatGPT plan, and OpenAI turned it down.",unverified:()=>"Scenri could not verify Codex on this computer. Something answered too slowly or not at all, so nothing is assumed to work.","update-needed":e=>`${e??"Codex CLI on this computer is too old for Scenri."} Update it once, then check again.`,"no-plan":()=>"Codex CLI draws on a ChatGPT plan, so without one there is nothing behind it to generate your images."};function LR({engineId:e,name:t,state:n,ready:r,busy:a}){const i=yR(e);return o.jsxs("div",{className:"sc-setup-subject",children:[o.jsx("span",{className:"sc-eng-ic","data-brand":i?"":void 0,style:i?{"--sc-plate":i.plate,"--sc-ink":i.ink}:void 0,children:o.jsx(bR,{engineId:e})}),o.jsxs("span",{className:"sc-setup-say",children:[o.jsx("b",{className:"sc-setup-name",children:t}),o.jsxs("span",{className:"sc-setup-state",children:[a?o.jsx(Pr,{size:"1"}):r?o.jsx("span",{className:"d"}):null,n]})]})]})}function Pee({phase:e,act:t}){const{installed:n,signedIn:r,connected:a}=xee(e),i=[n,r,a],l=["Install Codex CLI","Sign in with ChatGPT","Connect to Scenri"];return o.jsx("ol",{className:"sc-learn-steps sc-setup-steps",children:l.map((u,f)=>{const h=(t==null?void 0:t.step)===f,p=i[f]?"done":h?"active":"todo",g=o.jsx("span",{className:"sc-learn-n","aria-hidden":"true",children:i[f]?o.jsx(Kn,{size:14,weight:"bold"}):f+1}),m=h&&t.busy;return o.jsx("li",{"data-on":i[f]?"":void 0,"data-now":h?"":void 0,children:h?o.jsxs("button",{type:"button",className:"sc-learn-step","data-state":p,"aria-label":t.label,disabled:m,onClick:t.run,children:[g,o.jsx("span",{className:"sc-learn-step-name",children:u}),o.jsxs("span",{className:"sc-learn-go","aria-hidden":"true",children:[m?o.jsx(Pr,{size:"1"}):null,t.verb,m?null:o.jsx(xa,{size:12,weight:"bold"})]})]}):o.jsxs("div",{className:"sc-learn-step","data-state":p,children:[g,o.jsx("span",{className:"sc-learn-step-name",children:u}),i[f]&&o.jsx("span",{className:"sc-vh",children:", done"})]})},u)})})}function Lee(){const{brands:e}=Nn(),t=$R(e);return t?o.jsx(Ja,{to:To(t),replace:!0}):o.jsx(Ja,{to:"/setup",replace:!0})}function $R(e){const t=CG();return e.find(n=>n.id===t)??e[0]??null}const $ee=48;function Tee(e,t,n=$ee){let r=null;for(const a of t){if(a.kind==="root")continue;const i=(r??e).findIndex(h=>h.id===a.id),l=a.status==="done"&&a.images.length>0&&!a.archived;if(i>=0){if((r??e)[i]===a)continue;r??(r=[...e]),l?r[i]=a:r.splice(i,1);continue}if(!l)continue;const u=r??e;if(u.length>=n&&Ku(u[u.length-1],a)<0)continue;r??(r=[...e]);let f=0;for(;f<r.length&&Ku(r[f],a)<=0;)f++;r.splice(f,0,a),r.length>n&&(r.length=n)}return r??e}const TR='[data-guide="library.new"]',Hd=(e,t)=>({id:"go",voice:"ask",point:`[data-guide="nav.${e}"]`,side:"bottom",soft:!0,...t}),Dee='[data-guide="compose"] .sc-attachpanel',Hee='[data-guide="compose"] .sc-attachpanel .sc-ap-body',Tp='[data-guide="compose"] .sc-promptcard',Oee='[data-guide="compose.add"]',DR='[data-guide="compose"] .sc-brief-line',Dp='[data-guide="compose.send"]',HR='[data-guide="compose.engine"]',id=".sc-pstudio",H4=`${id} .sc-convo-card`,Iee=".sc-newdlg-layer",ld=".sc-ovl",En={go:{title:"Shots are made in Create",body:"A shot is built from what you sell, who shows it and where. Open Create, and we'll make your first one together."},intro:{title:"This is Create, where shots are made",body:"A shot is built from three things Scenri keeps for you: what you sell, who shows it, and where it happens. Add them, say how to shoot it, and Scenri makes the picture in about a minute."},engine:{title:"Connect image generation",body:"Scenri needs an image engine before it can make anything. Setting one up takes about a minute."},product:{title:"Choose a product",body:"A product is the thing you are selling. Scenri keeps its real photos, so it looks the same in every shot you make."},presenter:{title:"Choose a presenter",body:"A presenter is a person Scenri keeps. Pick one and the same face shows your product in every shot."},scene:{title:"Choose a scene",body:"A scene is a place and its light. It decides where the shot happens and how it feels."},make:{title:"Say how to shoot it, then make it",body:"A few words about the moment, the light or the framing. Generate then puts your ingredients and your words together into a picture."},waiting:{title:"Scenri is making it",body:"This takes a moment. Your ingredients are kept, so you can change one thing later without starting over."},result:{title:"Your first shot",body:"The product, the presenter and the scene you chose are kept, so your next shot starts from them. Open it to change one thing."},failed:{title:"That one didn't work",body:"The tile says why. Put the shot together again and Scenri will try it again."},reuseProduct:{title:"Add the product you saved",body:"Yours sits in the shelf with ours. Putting it in again costs nothing: it is the same product, in a new shot."},reuseScene:{title:"Put it somewhere else",body:"A different place and light, so the two shots share the product and little else."},reuseResult:{title:"The same product, twice",body:"Two shots, one thing you added once. Anything Scenri keeps works this way: products, presenters and scenes."},refineAsk:{title:"Change one thing",body:"Say what to change, like warmer light or a closer crop. The rest of the shot stays."},refineResult:{title:"Here is the change",body:"The original stays one step back in the history, so nothing is lost."},refineFailed:{title:"That change didn't work",body:"Say the change again and Scenri will try it once more."},refineChoose:{title:"Choose a shot to change",body:"Open one from what you have made. You can also use Refine on its card."},refineGo:{title:"Your shots live in Create",body:"Refining starts from a picture you already have. Open Create to find one."},productGo:{title:"Your products live here",body:"Each one you add is kept, so it looks the same in every shot. Open Products to add yours."},productNew:{title:"Start a new product",body:"Add its real photos, or bring in your catalog from your store. Either way it is yours to reuse."},sceneGo:{title:"Your scenes live here",body:"A scene is a place and its light, saved to shoot in again. Open Scenes to make one."},sceneNew:{title:"Start a new scene",body:"Describe the place in a sentence, start from pictures of it, or let it guide you."},presenterGo:{title:"Your presenters live here",body:"A presenter is a person Scenri keeps, the same face in every shot. Open Presenters to make one."},presenterNew:{title:"Start a new presenter",body:"Describe someone, or add photos of a real person. The studio takes it from there."},presenterEngine:{title:"Set up image generation",body:"Drawing a face needs an engine. Setting one up takes about a minute, and the answers so far are kept."},presenterStart:{title:"Describe someone, or start from photos",body:"Photos keep a real face. Describing invents one, question by question."},presenterFace:{title:"Decide the face",body:"Every shot with this presenter uses this face, so take the one you want."},presenterSave:{title:"Save your presenter",body:"Once saved they are in your ingredients, ready for every shot."},sceneStart:{title:"Describe the place, or start from pictures",body:"A scene is the place and its light around your shot. Pictures are read for you; guided, it asks one thing at a time."},sceneWords:{title:"These words are the scene",body:"Every shot made in this scene is told exactly this. Draw it to see it, or say what to add."},productMake:{title:"Add your product",body:"Its real photos keep it the same in every shot. Add a few, or bring in your catalog from your store."}},wl=e=>`.sc-feed .sc-cell[data-fb-node="${e}"]`,sy=e=>e.status==="done"&&e.images>0,ay=e=>e.status==="error"||e.status==="cancelled"||e.status==="done"&&e.images===0,O4=e=>e.products+e.presenters+(e.scene?1:0)+e.others,bk={product:"Products",presenter:"Presenters",scene:"Scenes"};function OR(e){if(!e.here)return e.heading?Hd("create",En.go):null;const t=e.composer,n=e.nodes.find(sy);if(n)return{id:"result",voice:"note",point:wl(n.id),side:"bottom",...En.result,done:!0};const r=e.nodes.find(u=>u.status==="running");if(r)return{id:"waiting",voice:"note",point:wl(r.id),side:"bottom",...En.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||O4(t)>0||t.words,i=e.nodes.find(ay);if(i&&!a)return{id:"failed",voice:"note",point:wl(i.id),side:"bottom",...En.failed};if(t.engine!=="ready")return{id:"engine",voice:"ask",point:HR,side:"top",...En.engine};if(!e.begun&&O4(t)===0&&!t.words)return{id:"intro",voice:"ask",live:[],start:!0,...En.intro};const l=FR(t);return l?I4(l,t.pickerOpen):{id:"make",voice:"ask",point:Dp,live:[DR,Dp],side:"top",...En.make}}function IR(e){if(!e.here)return e.heading?Hd("create",En.go):null;const t=e.composer,n=e.nodes.find(sy);if(n)return{id:"again",voice:"note",point:wl(n.id),side:"bottom",...En.reuseResult,done:!0};const r=e.nodes.find(l=>l.status==="running");if(r)return{id:"waiting",voice:"note",point:wl(r.id),side:"bottom",...En.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||O4(t)>0||t.words,i=e.nodes.find(ay);return i&&!a?{id:"failed",voice:"note",point:wl(i.id),side:"bottom",...En.failed}:t.engine!=="ready"?{id:"engine",voice:"ask",point:HR,side:"top",...En.engine}:t.products===0?I4("product",t.pickerOpen,En.reuseProduct):t.scene?{id:"make",voice:"ask",point:Dp,live:[DR,Dp],side:"top",...En.make}:I4("scene",t.pickerOpen,En.reuseScene)}function FR(e){return e.products===0?"product":e.presenters===0?"presenter":e.scene?null:"scene"}function I4(e,t,n){const r=n??En[e];return t?{id:e,voice:"ask",point:Dee,live:[Hee],lit:[Tp],beside:!0,side:"right",...r}:{id:e,voice:"ask",point:Oee,side:"top",...r}}const _R=`${ld} .sc-promptcard`,Fee=`${ld} .sc-stage-img`,xk=`${ld} .sc-trail`,kk=".sc-feed";function _ee(e){if(e.heading)return Hd("create",En.refineGo);if(!e.here)return null;if(!e.open&&!e.armed)return{id:"choose",voice:"ask",point:kk,live:[kk],beside:!0,side:"left",...En.refineChoose};const t=e.nodes.find(sy);if(t)return e.open?{id:"refined",voice:"note",shell:ld,point:xk,side:"top",...En.refineResult,done:!0}:{id:"refined",voice:"note",point:wl(t.id),side:"bottom",...En.refineResult,done:!0};if(e.nodes.some(r=>r.status==="running"))return{id:"refining",voice:"quiet"};const n=e.nodes.find(ay);return n&&!e.asking?e.open?{id:"refine-failed",voice:"note",shell:ld,point:xk,side:"top",...En.refineFailed}:{id:"refine-failed",voice:"note",point:wl(n.id),side:"bottom",...En.refineFailed}:e.open?{id:"ask",voice:"ask",shell:ld,point:_R,also:[Fee],beside:!0,side:"left",...En.refineAsk}:{id:"ask",voice:"ask",point:Tp,live:[Tp],beside:!0,side:"top",...En.refineAsk}}function VR(e){if(e.heading)return Hd("presenters",En.presenterGo);const t=e.studio;if(t){const n=`${id} [data-turn="q:${t.open}"]`,r=(a,i,l=[],u)=>({id:a,voice:"ask",shell:id,point:`${n} .sc-convo-ask`,live:[n],also:l,...u?{lit:u}:{},beside:!0,side:"left",...i});switch(t.open){case"source":return r("start",En.presenterStart,[H4]);case"noengine":return r("engine",En.presenterEngine);case"identity":case"revision":return r("face",En.presenterFace,[".sc-pstudio-well",H4],[`${id} [data-turn]:has(+ [data-turn="q:${t.open}"])`]);case"save":return r("save",En.presenterSave);default:return{id:"studio",voice:"quiet"}}}return e.onPage?{id:"new",voice:"ask",point:TR,side:"bottom",...En.presenterNew}:null}function Vee(e,t){return{id:e,voice:"ask",shell:Iee,point:".sc-newdlg",beside:!0,side:"left",...t}}function ZR(e){return{id:"new",voice:"ask",point:TR,side:"bottom",...e}}function Zee(e){var n,r;if(e.heading)return Hd("scenes",En.sceneGo);const t=e.studio;if(t){const a=`${id} [data-turn="q:${t.open}"]`,i=(l,u)=>({id:l,voice:"ask",shell:id,point:`${a} .sc-convo-ask`,live:[a],also:[H4],beside:!0,side:"left",...u});return t.open==="source"?i("start",En.sceneStart):(n=t.open)!=null&&n.startsWith("agree-")?i("words",En.sceneWords):(r=t.open)!=null&&r.startsWith("decide-")?{id:"use",voice:"quiet"}:{id:"studio",voice:"quiet"}}return e.onPage?ZR(En.sceneNew):null}function zee(e){return e.heading?Hd("products",En.productGo):e.dialogOpen?Vee("product",En.productMake):e.onPage?ZR(En.productNew):null}function zR(e,t){if(e==="first-shot"){if(t==="presenter")return"product";if(t==="scene")return"presenter";if(t==="make")return"scene"}if(e==="reuse"){if(t==="scene")return"product";if(t==="make")return"scene"}return null}function Bee(e,t,n){return e?zR(e,t)||n&&(t==="new"||t==="choose"||(e==="first-shot"||e==="reuse")&&t==="product")||e==="presenter"&&(t==="start"||t==="face"||t==="save")||(e==="product"||e==="scene")&&t===e?!0:e==="refine"&&t==="ask":!1}function Uee(e,t){const n=e.active;return n?n.task==="presenter"?t.presenters>n.baseline.presenters:n.task==="scene"?t.scenes>n.baseline.scenes:n.task==="product"?t.products>n.baseline.products:!1:!1}const Wee={"first-shot":"shot",reuse:"shot",refine:"refine",product:"product",presenter:"presenter",scene:"scene"};function Th(e,t){return!(!t.eligible||t.hidden||t.active&&(t.active.task===e||t.active.task==="first-shot")||t.done[Wee[e]]||t.dismissed.includes(e)||e==="refine"&&!t.done.shot)}function Kee(e){return e.onMainPage&&e.eligible&&e.welcome===null&&e.ready&&e.visible&&!e.blocked&&!e.busy}const Yu={lede:"Scenri makes product shots for your brand. You choose the product, who shows it and where, and it makes the picture.",take:"Make your first shot",notNow:"Not now",again:"Welcome to Scenri",note:e=>e.engineReady?e.ownsProducts?"We'll make your first one together, a step at a time, with one of your products.":"We'll make your first one together, a step at a time. You can start with one of our products.":"First a short setup for image generation, then your first shot together, a step at a time."};function Gee(e){const t=e.filter(a=>a.previewUrl),n=(a,i)=>{var l,u;return(u=(((l=a.brief)==null?void 0:l.tokens)??[]).find(f=>(f==null?void 0:f.t)===i))==null?void 0:u.id},r=new Map;for(const a of t){const i=n(a,"product");i&&r.set(i,[...r.get(i)??[],a])}for(const a of r.values()){const i=new Map;for(const l of a){const u=n(l,"template");u&&!i.has(u)&&i.set(u,l)}if(i.size>=3)return[...i.values()].slice(0,3)}for(const a of r.values())if(a.length>=3)return a.slice(0,3);return t.slice(0,3)}function Yee(e,t,n,r){const a=new Map(e.map(l=>[l.id,l]));let i=!1;for(const l of t){if(l.kind!==r||l.createdAt<n)continue;const u={id:l.id,kind:l.kind,status:l.status,images:Array.isArray(l.images)?l.images.length:0,createdAt:l.createdAt},f=a.get(l.id);f&&f.status===u.status&&f.images===u.images||(a.set(l.id,u),i=!0)}return i?[...a.values()].sort((l,u)=>l.createdAt<u.createdAt?1:l.createdAt>u.createdAt?-1:0):e}const qee="https://github.com/tonygorb/scenri";function Xee(){var S,E;const e=mn(mt.hub),t=mn(mt.set),n=!!e||!!t,r=eu(),a=Um(),i=!!((S=a.status)!=null&&S.available),l=i&&!a.dismissed||r.unread,u=Fl(),f=_l(),h=UN(),p=xY(),{engines:g}=Nn(),m=!g.some(C=>C.available),{brand:w}=cn(),{pathname:y}=Un(),b=s.useRef(!1),k=Ap(w);return o.jsx("div",{className:"sc-help-float",children:o.jsxs(Cs,{children:[o.jsx(fr,{label:"Help",children:o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-icon-btn sc-help-btn","aria-label":"Help",children:[o.jsx(wF,{size:16}),l&&o.jsx("span",{className:"sc-upd-dot","aria-hidden":"true"})]})})}),o.jsxs(As,{align:"end",side:"top",sideOffset:8,className:"sc-menu sc-help-menu",onCloseAutoFocus:C=>{b.current&&(C.preventDefault(),b.current=!1)},children:[i&&o.jsxs(qn,{className:"sc-menu-item","data-update":"",onSelect:()=>u("updates"),children:[o.jsx(U7,{size:18,className:"sc-menu-ic"}),o.jsxs("span",{className:"sc-menu-lb",children:["Update available · ",(E=a.status)==null?void 0:E.latest]})]}),o.jsxs(o.Fragment,{children:[o.jsxs(qn,{className:"sc-menu-item",onSelect:()=>{v4.current="help",h()},children:[o.jsx(aF,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Learn"})]}),o.jsxs(qn,{className:"sc-menu-item",onSelect:()=>p(),children:[o.jsx(oF,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:Yu.again})]})]}),n&&o.jsxs(qn,{className:"sc-menu-item",onSelect:()=>window.dispatchEvent(new Event("scenri:shortcuts")),children:[o.jsx(uF,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Keyboard shortcuts"})]}),o.jsx(qn,{className:"sc-menu-item",asChild:!0,children:o.jsxs(Vn,{to:k,onClick:C=>{!C.metaKey&&!C.ctrlKey&&!C.shiftKey&&!C.altKey&&y!==k&&(b.current=!0)},children:[o.jsx(dF,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"What's new"}),r.unread&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-menu-new","aria-hidden":"true"}),o.jsx("span",{className:"sc-vh",children:", not read yet"})]})]})}),m&&o.jsxs(qn,{className:"sc-menu-item",onSelect:()=>f(),children:[o.jsx(tf,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Set up image generation"})]}),o.jsx("div",{className:"sc-menu-sep"}),o.jsxs(qn,{className:"sc-menu-item",onSelect:()=>u("about"),children:[o.jsx(pm,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"About Scenri"})]}),o.jsx(qn,{className:"sc-menu-item",asChild:!0,children:o.jsxs("a",{href:qee,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(sF,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Scenri on GitHub"})]})})]})]})})}function Qee(){return o.jsx(Xee,{})}const Jee={composer:null,overlay:null,studio:null,showing:!1};let ro=Jee;const F4=new Set;function s2(e){ro=e;for(const t of F4)t()}const oy=(e,t)=>e===t||JSON.stringify(e)===JSON.stringify(t);function Sk(e){oy(ro.composer,e)||s2({...ro,composer:e})}function Ek(e){oy(ro.overlay,e)||s2({...ro,overlay:e})}function Hp(e){oy(ro.studio,e)||s2({...ro,studio:e})}function Ck(e){ro.showing!==e&&s2({...ro,showing:e})}function BR(e){return F4.add(e),()=>F4.delete(e)}function ete(){return ro}function UR(){return s.useSyncExternalStore(BR,ete)}function tte(){return s.useSyncExternalStore(BR,()=>ro.showing)}function WR(e){return e.milestones.map(t=>t.label)}const ol=[{id:"first-shot",title:"Make your first shot",summary:"A shot is three things Scenri keeps for you, put together and directed: what you sell, who shows it, and where it happens. Start with ours to see the shape of it, then swap in your own.",milestones:[{label:"Open Create",moments:["go"]},{label:"Choose a product",moments:["product"]},{label:"Choose a presenter",moments:["presenter"]},{label:"Choose a scene",moments:["scene"]},{label:"Say how to shoot it, then make it",moments:["make","sending","waiting","failed"]},{label:"Open your shot",moments:["result"]}]},{id:"product",title:"Add your product",summary:"Your own product, added once from its packshots or straight from your store, and exact in every shot you make from then on. Nothing is drawn here and nothing is spent.",milestones:[{label:"Find where your products live",moments:["go"]},{label:"Start a new one",moments:["new"]},{label:"Add its photos, or bring in your store",moments:["product"]}]},{id:"reuse",title:"Use it again",summary:"The same saved product in a different world. This is the whole point of keeping ingredients: one thing you added once, shot again and again without describing it twice.",milestones:[{label:"Open Create",moments:["go"]},{label:"Add the product you saved",moments:["product"]},{label:"Put it somewhere else",moments:["scene"]},{label:"Say how to shoot it, then make it",moments:["make","sending","waiting","failed"]},{label:"See the same product in both",moments:["again"]}],needs:"product"},{id:"presenter",title:"Create a presenter",summary:"One person Scenri keeps, invented question by question or built from photos of someone real, who stays the same face across every shot you put them in.",milestones:[{label:"Find where your presenters live",moments:["go"]},{label:"Start a new one",moments:["new"]},{label:"Describe someone, or add photos",moments:["start"]},{label:"Decide the face",moments:["face"]},{label:"Save them to the brand",moments:["save"]}]},{id:"scene",title:"Build a scene",summary:"A place and its light, saved to shoot in again, from pictures of it or a few questions.",milestones:[{label:"Find where your scenes live",moments:["go"]},{label:"Start a new one",moments:["new"]},{label:"Describe the place, or add pictures",moments:["start"]},{label:"Read what your shots are told",moments:["words"]},{label:"Use it",moments:["use"]}]},{id:"refine",title:"Refine a shot",summary:"Change one thing about a shot you already have and keep everything else, including the original. This is how a shot gets good: one change at a time, never a fresh start.",milestones:[{label:"Find the shots you have made",moments:["go"]},{label:"Choose a shot to change",moments:["choose"]},{label:"Say the one thing to change",moments:["ask","refine-failed"]},{label:"See the change on the trail",moments:["refining","refined"]}],needs:"shot"}],_4={shot:{note:"Refining starts from a shot you have made.",action:"Make a shot first",status:"Needs a shot"},product:{note:"Using one again starts with a product of your own.",action:"Add a product first",status:"Needs a product"}};function nte(e){return ol.find(t=>t.id===e)??null}function rte(e,t,n,r){var a,i,l;return((i=(a=t.progress)==null?void 0:a[e])==null?void 0:i.brandId)===n&&r>0?"active":(l=t.lessons)!=null&&l[e]?"done":"new"}function ste(e,t){return e.find(n=>t(n)!=="done")??null}const iy=Object.fromEntries(ol.map(e=>[e.id,Object.fromEntries(e.milestones.flatMap((t,n)=>t.moments.map(r=>[r,n])))]));function KR(e,t){let n=0;for(const r of t){const a=iy[e][r];a!==void 0&&a>n&&(n=a)}return n}function ate(e,t){return KR(e,t)>0}function ote(e,t){var a;const n=iy[e][t],r=((a=ol.find(i=>i.id===e))==null?void 0:a.milestones.length)??0;return n===void 0||!r?null:{at:n+1,of:r}}const F8=e=>e.status==="done"&&e.images>0;function jk(e,t,n){const r=KR(e,t);return n?Math.max(ite(e,n),r):r}function ite(e,t){const n=t.moment?iy[e][t.moment]:void 0;if(n!==void 0)return n;switch(e){case"first-shot":return t.nodes.some(F8)?5:t.nodes.length>0?4:0;case"reuse":return t.nodes.some(F8)?4:t.nodes.length>0?3:0;case"presenter":return t.draft?3:0;case"refine":return t.nodes.some(F8)||t.nodes.some(r=>r.status==="running")?3:0;default:return 0}}const V4={"first-shot":{square:new URL("/assets/first-shot-square-hTczF9bl.webp",import.meta.url).href,wide:new URL("/assets/first-shot-wide-BSpJwjNx.webp",import.meta.url).href},product:{square:new URL("/assets/product-square-DPR77tr0.webp",import.meta.url).href,wide:new URL("/assets/product-wide-DLSsO8IK.webp",import.meta.url).href},reuse:{square:new URL("/assets/reuse-square-CMLhjEwt.webp",import.meta.url).href,wide:new URL("/assets/reuse-wide-DbbTeKsL.webp",import.meta.url).href},presenter:{square:new URL("/assets/presenter-square-BpqHv8Aq.webp",import.meta.url).href,wide:new URL("/assets/presenter-wide-ecc4y7eJ.webp",import.meta.url).href},scene:{square:new URL("/assets/scene-square-CQBwEfXy.webp",import.meta.url).href,wide:new URL("/assets/scene-wide-CJ9ENIrh.webp",import.meta.url).href},refine:{square:new URL("/assets/refine-square-CietHTPe.webp",import.meta.url).href,wide:new URL("/assets/refine-wide-BM5sVq6w.webp",import.meta.url).href}};function lte({open:e,pictures:t,note:n,onTake:r,onDecline:a}){return o.jsxs(Ws,{open:e,className:"sc-welcome",maxWidth:"440px",described:!0,tone:"guide",onDismiss:a,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsxs(Ns,{className:"sc-newdlg-title",children:["Welcome to ",o.jsx("span",{className:"sc-accent",children:"Scenri"})]}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":Yu.notNow,children:o.jsx(jn,{size:16})})})]}),o.jsx(Hc,{className:"sc-welcome-lede",children:Yu.lede}),t.length>0&&o.jsx("div",{className:"sc-welcome-pics","aria-hidden":"true",children:t.map((i,l)=>o.jsx("img",{src:i,alt:"",style:{animationDelay:`${120+l*60}ms`}},i))}),o.jsxs("div",{className:"sc-newdlg-foot sc-welcome-foot",children:[o.jsx("p",{className:"sc-welcome-note",children:n}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:a,children:Yu.notNow}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:r,children:Yu.take})]})]})}const Ak=e=>e.t!=="format",ti=()=>[{t:"text",v:""}],Qa=e=>e.t==="product"?`p:${e.id}`:e.t==="template"?`t:${e.id}`:e.t==="ref"?`r:${e.imageHash}`:a2(e);function cte(e,t){const n=new Set,r=l=>{const u=Qa(l);return u?n.has(u)?!1:(n.add(u),!0):!0},a=e.filter(Ak).filter(r),i=t.filter(Ak).filter(r);return{own:a,carried:i}}function ly(e){const{own:t,carried:n}=cte(e.tokens??[],e.inherited??[]),r=[...t,...n],a=r.length?r:ti(),i=a.some(l=>l.t==="template");return e.templateId&&!i?[{t:"template",id:e.templateId},...a]:a}const pc="sc-token",o1=`.${pc}`,a2=e=>e.t==="template"?`t:${e.id}${e.setup||e.view?`|${e.setup??""}`:""}${e.view?`|${e.view}|${e.viewName??""}`:""}`:e.t==="product"?`p:${e.id}${e.angle?`|${e.angle}`:""}`:e.t==="character"?`h:${e.id}`:e.t==="color"?`c:${e.hex}|${e.name??""}`:e.t==="ref"?`r:${e.imageHash}${e.label?`|${e.label}`:""}`:e.t==="mark"?`m:${e.imageHash}`:"",ks=e=>{const t=e.slice(0,1),n=e.slice(2);if(t==="t"){const[r,a,i,l]=n.split("|");return r?{t:"template",id:r,...a?{setup:a}:{},...i?{view:i,...l?{viewName:l}:{}}:{}}:null}if(t==="p"){const[r,a]=n.split("|");return r?{t:"product",id:r,...a?{angle:a}:{}}:null}if(t==="h")return n?{t:"character",id:n}:null;if(t==="r"){const r=n.indexOf("|"),a=r<0?n:n.slice(0,r),i=r<0?"":n.slice(r+1);return a?{t:"ref",imageHash:a,...i?{label:i}:{}}:null}if(t==="m")return n?{t:"mark",imageHash:n}:null;if(t==="c"){const[r,a]=n.split("|");return r?{t:"color",hex:r,name:a||void 0}:null}return null},hi="\uFEFF",Zl=//g,jc=e=>!!e&&e.nodeType===Node.TEXT_NODE&&e.textContent===hi,GR=e=>{var t;return e.length-(((t=e.match(Zl))==null?void 0:t.length)??0)};function ko(e){const t=typeof window>"u"?null:window.getSelection();if(!e||!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.startContainer)?Ip(e,n.startContainer,n.startOffset):null}function Ka(e,t){if(!e)return;let n=0;for(const r of Array.from(e.childNodes)){const a=xd(r);if(r.nodeType===Node.TEXT_NODE){if(t<=n+a){Ro(e,r,Op(r,t-n));return}}else if(t<=n+a){const i=r.nextSibling;if((i==null?void 0:i.nodeType)===Node.TEXT_NODE){Ro(e,i,Op(i,0));return}break}n+=a}mc(e)}function Op(e,t){const n=e.textContent??"";if(n===hi)return 1;let r=0,a=0;for(;a<n.length&&r<t;)n[a]!==hi&&(r+=1),a+=1;return a}function mc(e){if(!e)return;e.focus({preventScroll:!0});const t=e.lastChild;if((t==null?void 0:t.nodeType)===Node.TEXT_NODE){Ro(e,t,t.length);return}const n=window.getSelection(),r=document.createRange();r.selectNodeContents(e),r.collapse(!1),n==null||n.removeAllRanges(),n==null||n.addRange(r)}function ute(e){if(!e)return!1;const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return!1;const n=t.getRangeAt(0);return e.contains(n.startContainer)&&e.contains(n.endContainer)}function Ro(e,t,n){const r=window.getSelection(),a=document.createRange();a.setStart(t,Math.max(0,Math.min(n,t.length))),a.collapse(!0),r==null||r.removeAllRanges(),r==null||r.addRange(a)}const xd=e=>e.nodeType===Node.TEXT_NODE?GR(e.textContent??""):1;function Ip(e,t,n){if(t===e){let a=0;for(let i=0;i<n&&i<e.childNodes.length;i++)a+=xd(e.childNodes[i]);return a}let r=0;for(const a of Array.from(e.childNodes)){if(a===t)return r+GR((a.textContent??"").slice(0,n));if(a.contains(t))return r+1;r+=xd(a)}return r}function Eo(e){var n,r;if(!e)return;const t=ko(e);e.normalize();for(const a of Array.from(e.childNodes)){if(a.nodeType!==Node.TEXT_NODE)continue;const i=a.textContent??"",l=i.replace(Zl,""),u=l.length?l:i.length?hi:"";u!==i&&(a.textContent=u),u||a.remove()}for(const a of Array.from(e.childNodes))jc(a)&&!_s(a.previousSibling)&&!_s(a.nextSibling)&&a.remove();for(const a of Array.from(e.childNodes))_s(a)&&(((n=a.previousSibling)==null?void 0:n.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(hi),a),((r=a.nextSibling)==null?void 0:r.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(hi),a.nextSibling));H0(e)||t!==null&&Ka(e,t)}function dte(e){var n,r,a;if(!e)return!0;const t=e.childNodes;for(let i=0;i<t.length;i++){const l=t[i];if(_s(l)){if(((n=l.previousSibling)==null?void 0:n.nodeType)!==Node.TEXT_NODE||((r=l.nextSibling)==null?void 0:r.nodeType)!==Node.TEXT_NODE)return!1;continue}if(l.nodeType!==Node.TEXT_NODE)continue;const u=l.textContent??"";if(!u||((a=t[i+1])==null?void 0:a.nodeType)===Node.TEXT_NODE||u.includes(hi)&&(u!==hi||!_s(l.previousSibling)&&!_s(l.nextSibling)))return!1}return!0}function fte(e){return e.querySelector(o1)?!1:!(e.textContent??"").replace(/[​ ]/g,"").trim()}function H0(e){if(!e)return!1;const t=fte(e);return t&&e.firstChild&&e.replaceChildren(),e.toggleAttribute("data-empty",t),t}const _s=e=>!!e&&e.nodeType===Node.ELEMENT_NODE&&e.classList.contains(pc);function cy(e){if(!e)return null;const t=typeof window>"u"?null:window.getSelection();if(!t||t.rangeCount===0||!t.getRangeAt(0).collapsed)return null;const n=t.getRangeAt(0),r=n.startContainer;return r.nodeType!==Node.TEXT_NODE||r.parentNode!==e?null:{text:r,at:n.startOffset}}function Nk(e){var a;if(!e)return ti();const t=[];let n="";const r=()=>{n&&(t.push({t:"text",v:n}),n="")};for(const i of Array.from(e.childNodes)){if(i.nodeType===Node.TEXT_NODE){n+=(i.textContent??"").replace(Zl,"");continue}const l=i,u=(a=l.dataset)==null?void 0:a.tok;if(u){const f=ks(u);if(f){r(),t.push(f);continue}}if(l.tagName==="BR"){n+=`
99
+ `;continue}n+=l.textContent??""}return r(),t.some(i=>i.t==="text")||t.push({t:"text",v:""}),t}function Mk(e,t,n){if(e){e.textContent="";for(const r of hte(t)){if(r.t==="text"){r.v&&e.appendChild(document.createTextNode(r.v));continue}e.appendChild(n(r))}Eo(e)}}function hte(e){const t=n=>n>=0&&n<e.length&&e[n].t!=="text";return e.filter((n,r)=>{if(n.t!=="text"||!/^\s+$/.test(n.v))return!0;const a=r===0||t(r-1),i=r===e.length-1||t(r+1);return!(a&&i)})}function _8(e,t){for(const n of Array.from(e.querySelectorAll(o1))){const r=ks(n.dataset.tok??"");if(r&&Qa(r)===t)return n}return null}function YR(e){const t=typeof window>"u"?null:window.getSelection();if(!e||!t||t.rangeCount===0)return"";const n=t.getRangeAt(0);if(n.startContainer.nodeType!==Node.TEXT_NODE||!e.contains(n.startContainer))return"";let r=(n.startContainer.textContent??"").slice(0,n.startOffset);for(let a=n.startContainer.previousSibling;a&&a.nodeType===Node.TEXT_NODE;a=a.previousSibling)r=(a.textContent??"")+r;return r}function qR(){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0).cloneRange(),n=t.getBoundingClientRect();if(n.width||n.height)return n;const r=document.createElement("span");r.textContent="​",t.insertNode(r);const a=r.getBoundingClientRect(),i=r.parentNode;return r.remove(),i==null||i.normalize(),a}function xc(e,t,n){if(!e||!t)return;const r=n==="after"?t.nextSibling:t.previousSibling;if((r==null?void 0:r.nodeType)!==Node.TEXT_NODE)return;const a=r;Ro(e,a,jc(a)?1:n==="after"?0:a.length)}const Fp=9;function XR(e){if(!e.firstChild)return[];const t=document.createRange();return t.selectNodeContents(e),Array.from(t.getClientRects()).filter(n=>n.height>0)}function QR(e,t){let n=null,r=1/0;for(const a of e){const i=t<a.top?a.top-t:t>a.bottom?t-a.bottom:0;i<r&&(r=i,n=a)}return n}function Rk(e,t,n){if(!e)return!1;const r=XR(e),a=QR(r,n);if(!a)return!1;const i=a.top+a.height/2;for(const u of Array.from(e.querySelectorAll(o1))){const f=u.getBoundingClientRect();if(!(f.bottom<a.top||f.top>a.bottom)&&!(t<f.left-Fp||t>f.right+Fp))return xc(e,u,t<f.left+f.width/2?"before":"after"),!0}if(n>=a.top&&n<=a.bottom)return!1;const l=JR(t,i);return!l||!e.contains(l.node)||l.node.nodeType!==Node.TEXT_NODE?!1:(Ro(e,l.node,l.offset),!0)}function pte(e,t,n){if(!e)return null;const r=QR(XR(e),n);if(!r)return null;const a=r.top+r.height/2;for(const l of Array.from(e.querySelectorAll(o1))){const u=l.getBoundingClientRect();if(!(u.bottom<r.top||u.top>r.bottom)&&!(t<u.left-Fp||t>u.right+Fp))return{beside:l,side:t<u.left+u.width/2?"before":"after"}}const i=JR(t,a);return!i||!e.contains(i.node)?null:{node:i.node,offset:i.offset}}function JR(e,t){var i,l;const n=document,r=(i=n.caretRangeFromPoint)==null?void 0:i.call(n,e,t);if(r)return{node:r.startContainer,offset:r.startOffset};const a=(l=n.caretPositionFromPoint)==null?void 0:l.call(n,e,t);return a?{node:a.offsetNode,offset:a.offset}:null}function mte(e,t,n={}){if(!e)return;const r=window.getSelection();let a=null;if(r&&r.rangeCount>0&&e.contains(r.getRangeAt(0).startContainer))a=r.getRangeAt(0);else if(n.fallbackUnits!=null){Ka(e,n.fallbackUnits);const l=window.getSelection();l&&l.rangeCount>0&&e.contains(l.getRangeAt(0).startContainer)&&(a=l.getRangeAt(0))}a||(a=document.createRange(),a.selectNodeContents(e),a.collapse(!1)),a.deleteContents();const i=a.startContainer;if(i.nodeType===Node.TEXT_NODE&&i.parentNode===e){const l=i,u=l.textContent??"";let f=u.slice(0,a.startOffset);const h=u.slice(a.startOffset);n.eatQuery&&(f=yte(l,f)),l.textContent=f,e.insertBefore(t,l.nextSibling),h&&e.insertBefore(document.createTextNode(h),t.nextSibling)}else{const l=i===e?a.startOffset:e.childNodes.length;e.insertBefore(t,e.childNodes[l]??null)}Eo(e),Ka(e,so(e,t)+1)}const gte=["$","/","@","#"],vte=e=>gte.includes(e),_p=e=>e===" "||e===`
100
+ `||e===" "||e===hi;function wte(e){const t=YR(e);for(let n=t.length-1;n>=0;n--){const r=t[n];if(_p(r))return null;if(vte(r))return n===0||_p(t[n-1])?{sigil:r,query:t.slice(n+1)}:null}return null}function yte(e,t){const n=i=>Math.max(i.lastIndexOf("$"),i.lastIndexOf("/"),i.lastIndexOf("@"),i.lastIndexOf("#")),r=n(t);if(r>=0)return t.slice(0,r);const a=[];for(let i=e.previousSibling;i&&i.nodeType===Node.TEXT_NODE;i=i.previousSibling){const l=i.textContent??"",u=n(l);if(u>=0){i.textContent=l.slice(0,u);for(const f of a)f.remove();return""}a.push(i)}return t}function V8(e,t){if(!e||!t)return;e.normalize();const n=so(e,t);t.remove(),Eo(e),Ka(e,n)}function so(e,t){let n=0;for(const r of Array.from(e.childNodes)){if(r===t)break;n+=xd(r)}return n}function bte(e,t){var u,f;const n=cy(e);if(!n||!e)return!1;const{text:r,at:a}=n,i=jc(r);if(t==="right"){if(!_s(r.nextSibling)||!i&&a!==r.length)return!1;const h=(u=r.nextSibling)==null?void 0:u.nextSibling;return(h==null?void 0:h.nodeType)!==Node.TEXT_NODE?!1:(Ro(e,h,jc(h)?1:0),!0)}if(!_s(r.previousSibling)||!i&&a!==0)return!1;const l=(f=r.previousSibling)==null?void 0:f.previousSibling;return(l==null?void 0:l.nodeType)!==Node.TEXT_NODE?!1:(Ro(e,l,jc(l)?1:l.length),!0)}function Pk(e,t){const n=cy(e);if(!n)return null;const{text:r,at:a}=n,i=jc(r);return t==="Backspace"?_s(r.previousSibling)&&(i||a===0)?r.previousSibling:null:_s(r.nextSibling)&&(i||a===r.length)?r.nextSibling:null}function Lk(e,t){const n=cy(e);return!n||!jc(n.text)?!1:t==="Backspace"?!n.text.previousSibling:!n.text.nextSibling}function xte(e,t){const n=ko(e);if(!e||n==null)return null;const r=Array.from(e.childNodes).filter(_s);if(t==="forward")return r.find(a=>so(e,a)>=n)??null;for(let a=r.length-1;a>=0;a--)if(so(e,r[a])<n)return r[a];return null}const cd=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function kte(e){let t="",n="",r=!1;const a=i=>{var f;if(i.nodeType===Node.TEXT_NODE){const h=(i.textContent??"").replace(Zl,"");if(!h)return;t+=h,n+=cd(h),r=!1;return}const l=i,u=(f=l.dataset)==null?void 0:f.tok;if(u){const h=ni(l);t+=(r?" ":"")+h,r=!0,n+=`<span data-sc-tok="${cd(u)}">${cd(h)}</span>`;return}i.childNodes.forEach(a)};return e.cloneContents().childNodes.forEach(a),{text:t,html:`<span data-sc-brief="1">${n}</span>`}}function Ste(e,t){const n=[],r=[];for(const a of e){if(a.t==="text"){const l=a.v.trim();if(!l)continue;n.push(l),r.push(cd(l));continue}const i=t(a);n.push(i),r.push(`<span data-sc-tok="${cd(a2(a))}">${cd(i)}</span>`)}return{text:n.join(" "),html:`<span data-sc-brief="1">${r.join(" ")}</span>`}}function ni(e){var t;return(((t=e.querySelector(".sc-token-label"))==null?void 0:t.textContent)??"").trim()}function Ete(e){if(!e.includes("data-sc-brief")&&!e.includes("data-bt-brief"))return null;const n=new DOMParser().parseFromString(e,"text/html").querySelector("[data-sc-brief], [data-bt-brief]");if(!n)return null;const r=[],a=i=>{var h,p;if(i.nodeType===Node.TEXT_NODE){const g=(i.textContent??"").replace(Zl,"");g&&r.push(g);return}const l=i,u=((h=l.dataset)==null?void 0:h.scTok)??((p=l.dataset)==null?void 0:p.btTok);if(u===void 0){i.childNodes.forEach(a);return}const f=ks(u);r.push(f??l.textContent??"")};return n.childNodes.forEach(a),r.length?r:null}function eP(e){const t=new Set([0]);let n=0;for(const i of e){if(i.t!=="text"){t.add(n),n+=1,t.add(n);continue}for(let l=0;l<i.v.length;l++)(i.v[l]===" "||i.v[l]===`
101
+ `)&&t.add(n+l+1);n+=i.v.length}t.add(n);const r=[...t].sort((i,l)=>i-l),a=i1(e);return r.filter((i,l)=>l===r.length-1||!/^[ \n]*$/.test(a.slice(i,r[l+1])))}const i1=e=>e.map(t=>t.t==="text"?t.v:"").join(""),uy=(e,t,n)=>{const r=n<=t?e.slice(n,t):e.slice(t+1,n);return/^[ \n]*$/.test(r)};function Cte(e,t){const n=i1(e);return eP(e).filter(r=>!uy(n,t,r))}function jte(e,t){return e.find(n=>n>=t)??(e.length?e[e.length-1]:null)}function Ate(e,t){let n=null,r=1/0;for(const a of e){const i=Math.abs(a-t);i<r&&(r=i,n=a)}return n}function tP(e,t,n){if(!e||!t.parentNode)return!1;const r=so(e,t);if(uy(i1(o2(e)),r,n))return!1;let a=null,i=0;for(const l of Array.from(e.childNodes)){const u=xd(l);if(n<=i+u){if(l.nodeType===Node.TEXT_NODE){const f=n-i;f<=0?a=l:f>=u?a=l.nextSibling:a=l.splitText(Op(l,f))}else a=n===i?l:l.nextSibling;break}i+=u}return a===t?!1:(t.remove(),e.insertBefore(t,a),Eo(e),!0)}function $k(e,t,n){if(!e)return!1;const r=so(e,t),a=Cte(o2(e),r),i=n===-1?[...a].reverse().find(l=>l<r):a.find(l=>l>r+1);return i===void 0?!1:tP(e,t,i)}function Nte(e,t){if(!e)return t;const n=i1(o2(e));let r=t;for(;r>0&&(n[r-1]===" "||n[r-1]===`
102
+ `);)r-=1;return r}function Tk(e,t,n,r){if(!e)return null;const a=pte(e,n,r);if(!a)return null;const i=o2(e),l=so(e,t),u=eP(i),f="beside"in a?so(e,a.beside)+(a.side==="before"?0:1):a.node.nodeType===Node.TEXT_NODE||a.node===e?Ip(e,a.node,a.offset):null;if(f===null)return null;const h="beside"in a&&a.side==="after"?jte(u,f):Ate(u,f);return h===null?null:{units:h,noop:uy(i1(i),l,h)}}function Z4(e,t){const n=ni(t)||"the chip",r=Mte(t);if(r)return`Moved ${n} before ${r}.`;const a=Rte(t);return a?`Moved ${n} after ${a}.`:so(e,t)===0?`Moved ${n} to the start of the brief.`:`Moved ${n} to the end of the brief.`}const nP=3;function Mte(e){for(let t=e.nextSibling;t;t=t.nextSibling){if(_s(t))return ni(t)||null;const n=(t.textContent??"").replace(Zl,"").trim();if(n)return`"${n.split(/\s+/).slice(0,nP).join(" ")}"`}return null}function Rte(e){for(let t=e.previousSibling;t;t=t.previousSibling){if(_s(t))return ni(t)||null;const n=(t.textContent??"").replace(Zl,"").trim();if(n)return`"${n.split(/\s+/).slice(-nP).join(" ")}"`}return null}function o2(e){const t=[];let n="";for(const r of Array.from(e.childNodes)){if(r.nodeType===Node.TEXT_NODE){n+=(r.textContent??"").replace(Zl,"");continue}n&&(t.push({t:"text",v:n}),n=""),t.push({t:"ref",imageHash:""})}return n&&t.push({t:"text",v:n}),t}function z4(e){var n;const t=e.target;(n=t==null?void 0:t.closest)!=null&&n.call(t,'input, textarea, select, [contenteditable=""], [contenteditable="true"]')||e.preventDefault()}const y0=e=>(e==null?void 0:e.querySelector('[data-kind="template"]'))??null,nl=e=>{var t;return((t=e==null?void 0:e.closest)==null?void 0:t.call(e,o1))??null};function Z8(e,t,n={}){var a;if(!e)return!1;let r=!1;for(let i=0;i<32;i++){const l=Lte(e,!!n.commit);if(!l)break;const u={t:"color",hex:l.hex,name:(a=n.nameFor)==null?void 0:a.call(n,l.hex)};Dte(e,l.node,l.start,l.end,t(u)),r=!0}return r&&Eo(e),r}function Pte(e,t){var i;e.dataset.kind="color",e.dataset.tok=a2(t);const n=t.name??t.hex,r=e.querySelector(".sc-token-swatch");r&&(r.style.background=t.hex);const a=e.querySelector(".sc-token-label");a&&(a.textContent=n),e.getAttribute("role")==="button"&&e.setAttribute("aria-label",`colour: ${n}. Change or remove.`),(i=e.querySelector('[data-role="remove"]'))==null||i.setAttribute("aria-label",`Remove ${n}`)}function Lte(e,t){for(let n=e.childNodes.length-1;n>=0;n--){const r=e.childNodes[n];if(r.nodeType!==Node.TEXT_NODE)continue;const a=r,i=Tte(a.textContent??"",t,(u,f)=>$te(a,f,u)),l=i[i.length-1];if(l)return{node:a,...l}}return null}function $te(e,t,n){if(n>0)return _p(t[n-1]);const r=e.previousSibling;if(!r||_s(r))return!0;if(r.nodeType===Node.TEXT_NODE){const a=r.textContent??"";return!a.length||_p(a[a.length-1]??"")}return!0}function Tte(e,t,n){const r=[];for(let a=0;a<e.length;a++){if(e[a]!=="#"||!n(a,e))continue;let i=a+1;for(;i<e.length&&/[0-9A-Fa-f]/.test(e[i]??"");)i++;const l=e.slice(a,i),u=VQ(l);if(!u)continue;if(i-a-1===3){const h=e[i];if(h===void 0?!t:/[0-9A-Za-z]/.test(h))continue}r.push({start:a,end:i,hex:u})}return r}function Dte(e,t,n,r,a){const i=t.textContent??"",l=i.slice(0,n),u=i.slice(r),f=typeof window>"u"?null:window.getSelection();let h=null;f&&f.rangeCount>0&&f.getRangeAt(0).startContainer===t&&(h=f.getRangeAt(0).startOffset);const p=t.parentNode;if(p&&(t.textContent=u.length?u:" ",p.insertBefore(a,t),l&&p.insertBefore(document.createTextNode(l),a),h!=null)){if(h<=n){const g=a.previousSibling;(g==null?void 0:g.nodeType)===Node.TEXT_NODE&&Ro(e,g,Math.min(h,(g.textContent??"").length));return}if(h<=r||!u.length){Ro(e,t,t.length);return}Ro(e,t,Math.min(h-r,t.length))}}function ud(e){if(!e||!/^#[0-9a-f]{6}$/i.test(e))return;const t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,a=Math.max(t,n,r),i=Math.min(t,n,r),l=a-i;if(l<.02)return;let u;return a===t?u=((n-r)/l+(n<r?6:0))*60%360:a===n?u=((r-t)/l+2)*60:u=((t-n)/l+4)*60,`hsl(${Math.round(u)} 55% 55%)`}function Hte(){const e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("width","9"),t.setAttribute("height","9"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2.4");const n=document.createElementNS(e,"path");return n.setAttribute("d","m6 6 12 12M18 6 6 18"),t.appendChild(n),t}const b0="data-sc-coach-inert",Ote=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Ite(e=document.body){let t=new Set;const n=a=>{a.hasAttribute("inert")&&!a.hasAttribute(b0)||(a.setAttribute(b0,""),a.setAttribute("inert",""))},r=a=>{a.hasAttribute(b0)&&(a.removeAttribute(b0),a.removeAttribute("inert"))};return{set(a){const i=new Set(a.filter(h=>h.isConnected&&e.contains(h)&&h!==e)),l=new Set;for(const h of i)for(let p=h.parentElement;p&&p!==e;p=p.parentElement)l.add(p);const u=new Set,f=h=>{for(const p of Array.from(h.children))i.has(p)||Ote.has(p.tagName)||(l.has(p)?f(p):u.add(p))};f(e);for(const h of t)u.has(h)||r(h);for(const h of u)t.has(h)||n(h);t=new Set([...u].filter(h=>h.hasAttribute(b0)))},release(){for(const a of t)r(a);t=new Set}}}const op=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),pi=e=>e.right-e.left,Ao=e=>e.bottom-e.top;function rP(e,t){return{left:Math.min(e.left,t.left),top:Math.min(e.top,t.top),right:Math.max(e.right,t.right),bottom:Math.max(e.bottom,t.bottom)}}function x0(e,t){return{left:e.left-t,top:e.top-t,right:e.right+t,bottom:e.bottom+t}}function Dk(e,t=0,n=4,r=14,a=0,i=0,l=0){if(e>=4)return e+n;const u=i===0||a===0||a<=i+16;return t>=4&&u&&l<=1?t+n:r}function sP(e,t){return e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom}function Hk(e,t){let n=e;for(const r of t)n={left:Math.max(n.left,r.left),top:Math.max(n.top,r.top),right:Math.min(n.right,r.right),bottom:Math.min(n.bottom,r.bottom)};return pi(n)>0&&Ao(n)>0?n:null}function Ok(e,t){let{top:n,bottom:r}=e;const a=(e.top+e.bottom)/2;for(const i of t)sP(i,e)&&(i.bottom<=a?n=Math.max(n,i.bottom):r=Math.min(r,i.top));return r>n?{...e,top:n,bottom:r}:null}const Fte=e=>e==="top"||e==="bottom";function _te(e,t,n){return t?Fte(n)?{left:e.left,right:e.right,top:t.top,bottom:t.bottom}:{left:t.left,right:t.right,top:e.top,bottom:e.bottom}:e}const Ik=e=>e==="top"?"bottom":e==="bottom"?"top":e==="left"?"right":"left",Is=e=>Math.round(e*2)/2;function Vte(e,t,n){const r=Is(t),a=Is(n),i=e.map(u=>{const f=Math.max(0,Is(pi(u))),h=Math.max(0,Is(Ao(u))),p=Is(Math.max(0,Math.min(u.radius,f/2,h/2)));return`<rect x='${Is(u.left)}' y='${Is(u.top)}' width='${f}' height='${h}' rx='${p}' fill='black'/>`}).join(""),l=`<svg xmlns='http://www.w3.org/2000/svg' width='${r}' height='${a}'><defs><mask id='m' maskUnits='userSpaceOnUse' x='0' y='0' width='${r}' height='${a}'><rect width='${r}' height='${a}' fill='white'/>${i}</mask></defs><rect width='${r}' height='${a}' fill='black' mask='url(#m)'/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(l)}")`}function Zte(e,t,n,r){const a=Is(t),i=Is(n),l=e.map(p=>{const g=Math.max(0,Is(pi(p))),m=Math.max(0,Is(Ao(p))),w=Is(Math.max(0,Math.min(p.radius,g/2,m/2)));return{x:Is(p.left),y:Is(p.top),ww:g,hh:m,k:w}}),u=l.map(p=>`<rect x='${p.x}' y='${p.y}' width='${p.ww}' height='${p.hh}' rx='${p.k}' fill='black'/>`),f=l.map(p=>`<rect x='${p.x}' y='${p.y}' width='${p.ww}' height='${p.hh}' rx='${p.k}' fill='none' stroke='${r}' stroke-width='2'/>`),h=`<svg xmlns='http://www.w3.org/2000/svg' width='${a}' height='${i}'><defs><mask id='o' maskUnits='userSpaceOnUse' x='0' y='0' width='${a}' height='${i}'><rect width='${a}' height='${i}' fill='white'/>${u.join("")}</mask></defs><g mask='url(#o)'>${f.join("")}</g></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(h)}")`}function zte(e,t,n){const r={left:Math.max(0,e.left),top:Math.max(0,e.top),right:Math.min(t,e.right),bottom:Math.min(n,e.bottom)};return[{left:0,top:0,right:t,bottom:r.top},{left:0,top:r.bottom,right:t,bottom:n},{left:0,top:r.top,right:r.left,bottom:r.bottom},{left:r.right,top:r.top,right:t,bottom:r.bottom}].filter(a=>pi(a)>0&&Ao(a)>0)}const Fk=0,Bte=10,z8=14,k0=4,B8="data-guide-stage",Ute="rgba(255,255,255,0.05)",B4="[data-guide-shape]",_k=[],Wte="[data-radix-popper-content-wrapper], .sc-setpop, .sc-morepop, .sc-shotsheet, .sc-note-pop",Vk='input, textarea, [contenteditable]:not([contenteditable="false"])',Kte=17,Dh=12,Gte=20,Yte=450,qte=768,Zk=90,Xte=8,zk=12,Qte=2e3,Jte=".sc-topbar, .sc-tabbar, .sc-filterbar, .sc-canvas-dock, .sc-help-float, .sc-pstudio-head, .sc-newdlg-head",ene=120,tne="[aria-live], .sc-toasts, .sc-upd-float, .sc-upd-overlay, [data-radix-popper-content-wrapper], .sc-chip-preview, .sc-swap, .sc-shotsheet, .sc-shotsheet-scrim, .sc-cmd",U8=e=>({id:e.id,title:e.title,body:e.body,canBack:e.canBack,action:e.action,count:e.at&&e.of?`${e.at} of ${e.of}`:void 0});function nne(e){const{id:t,voice:n,target:r,live:a,side:i,container:l,onShown:u}=e,f=e.lit??_k,h=e.also??_k,p=n==="ask",g=!r,m=!!(e.title||e.body),w=s.useId(),y=s.useId(),b=s.useRef(null),k=s.useRef(null),S=s.useRef(null),E=s.useRef(null),C=s.useRef(null),A=s.useRef(null),L=s.useRef(null),T=s.useRef(null),M=s.useRef(null),j=s.useRef(null),[P,R]=s.useState("moving"),[H]=s.useState(lne),[D,B]=s.useState(()=>U8(e)),V=s.useRef(e);V.current=e;const U=s.useRef(!1),K=s.useRef(null),O=s.useRef([]),F=P==="shown"&&D.id===t?U8(e):D,I=W8(a),G=W8(h),z=W8(f);s.useEffect(()=>{if(p)return j.current=Ite(l),()=>{var Z;(Z=j.current)==null||Z.release(),j.current=null;for(const ee of O.current)ee.removeAttribute(B8);O.current=[]}},[p,l]),s.useLayoutEffect(()=>{var Zt,jt,Ft;const Z=b.current,ee=k.current,pe=S.current,se=E.current,xe=C.current,J=A.current;if(p&&(!pe||!se||!xe||!J)||m&&(!Z||!ee))return;let te=!0,X=0,ae=0,Le=!1,ce=!1,Se="",Ze=0,gt=0,Ke=0,nt=null,$e=null,ne=null;const Q=window.matchMedia("(prefers-reduced-motion: reduce)").matches,We=a[0]??r??l;let Ne="",ie=r?Hh(r):null;R("moving");const q=()=>{var Pt;return(Pt=j.current)==null?void 0:Pt.set([...Z?[Z]:[],...pe?[pe]:[],...se?[se]:[],...xe?[xe]:[],...J?[J]:[],...a,...h,...[...document.querySelectorAll(tne)].filter(Tt=>![...a,...h].some(ke=>Tt.contains(ke)))])},oe=()=>{var Pt,Tt;(Pt=j.current)==null||Pt.release(),ce=!1,R("away"),(Tt=r??a[0])!=null&&Tt.isConnected&&Ye()};if(p&&j.current&&U.current){q(),ce=!0;const Pt=a.find(ke=>ke.matches(Vk)),Tt=document.activeElement;Pt&&!a.some(ke=>ke.contains(Tt))&&Bk(Pt)}const Re=async()=>{const Pt=++X;if(r&&!r.isConnected||a.some(re=>!re.isConnected))return oe(),V.current.onLost();const Tt=window.innerWidth,ke=window.innerHeight,et=window.visualViewport,Et=[{left:0,top:0,right:Tt,bottom:ke},...et?[{left:et.offsetLeft,top:et.offsetTop,right:et.offsetLeft+et.width,bottom:et.offsetTop+et.height}]:[]],Qe=re=>{const ue=re===r?ie:Hh(re);return ue?[...Et,op(ue.getBoundingClientRect())]:Et},st=rne(We,l),rt=st.filter(re=>pi(re)>Tt/3),qt=r?Hk(op(r.getBoundingClientRect()),Qe(r)):null,Yt=qt&&Ok(qt,rt);if(r&&!Yt)return!Le&&Ke<zk&&(Ke++,ie=Hh(r),K8(r,ie,Q).then(()=>te&&Ie())),oe();const an=[],Wt=[];for(const re of[...r?[r]:[],...a,...h,...f,...Uk()]){const ue=Wk(re);Wt.includes(ue)||Wt.push(ue)}const Mn=new Set([...r?[r]:[],...a,...f,...Uk()].map(Wk));let Bt=null;for(const re of Wt){const ue=Hk(op(re.getBoundingClientRect()),Qe(re)),de=ue&&Ok(ue,rt);if(!de)continue;const _e=ip(re);an.push(_e>=4||re.matches("img, video, canvas")?{...x0(de,Fk),radius:_e+Fk}:{...x0(de,Bte),radius:z8}),Mn.has(re)&&(Bt=Bt?rP(Bt,de):de)}if(!g&&!Yt&&!Bt)return oe();if(ce&&(a.some(re=>re.closest("[inert]"))||Z!=null&&Z.closest("[inert]"))&&(ce=!1),p&&pe&&se&&xe&&J){if(!an.length&&Yt){const de=r,_e=Kk(de);an.push({...x0(Yt,k0),radius:Dk(ip(de),_e.radius,k0,z8,Ao(Yt),_e.height,_e.count)})}for(const de of O.current)Wt.includes(de)||de.removeAttribute(B8);for(const de of Wt)de.setAttribute(B8,"");O.current=Wt;const ue=`${an.map(de=>[de.left,de.top,de.right,de.bottom,de.radius].map(Math.round).join(",")).join("|")}@${Tt}x${ke}`;if(ue!==Ne&&(Ne=ue,ine(pe,se,J,an,H)),r&&Yt){const de=fne(r),_e=Kk(r),Fe=de??x0(Yt,k0);Object.assign(xe.style,{left:`${Fe.left}px`,top:`${Fe.top}px`,width:`${pi(Fe)}px`,height:`${Ao(Fe)}px`,borderRadius:`${de?dne:Dk(ip(r),_e.radius,k0,z8,Ao(Yt),_e.height,_e.count)}px`}),xe.hidden=!1}else xe.hidden=!0}if(Z&&document.documentElement.style.setProperty("--sc-coach-h",`${Math.round(Z.offsetHeight)}px`),Z&&g&&(Z.style.right="",Z.style.left=`${Math.round((Tt-Z.offsetWidth)/2)}px`,Z.style.top=`${Math.round((ke-Z.offsetHeight)/2)}px`,Z.dataset.side="centre",ee&&(ee.hidden=!0)),Z&&ee&&r&&Yt){Z.style.right="";const re={top:Dh+sne(st,ke),bottom:Dh+ane(st,ke),left:Dh,right:Dh},ue=Tt>=qte;$e!==ue&&($e!==null&&r&&(ie=Hh(r),K8(r,ie,Q)),nt=null,$e=ue);const de=i==="left"||i==="right"?"top":i,_e=!ue&&pi(Yt)>Tt*.6,Fe=ue?i:_e?`${de}-start`:de,xt=(Pe,Xe)=>Pj(one(Pe,r),Z,{strategy:"fixed",placement:nt??Fe,middleware:[Nj(Kte),Rj({padding:re,fallbackPlacements:Xe}),Mj({padding:re}),G6({element:ee,padding:Gte})]}),yt=!ue&&Bt?{...Yt,top:Bt.top,bottom:Bt.bottom}:Yt,kt=(Pe,Xe)=>sP({left:Pe,top:Xe,right:Pe+Z.offsetWidth,bottom:Xe+Z.offsetHeight},x0(yt,k0)),je=ue&&(i==="left"||i==="right")?[Ik(i),"top","bottom"]:ue?void 0:_e?["bottom-start","top-start"]:["bottom","top"],me=!p&&Ao(Yt)>ke*.6,tt=ue&&(e.beside||a.length>1),Ct=me?{...Yt,top:Yt.bottom-1}:tt?_te(Yt,Bt,i):yt;let be=await xt(Ct,me?["top"]:je);if(!te||Pt!==X||!me&&kt(be.x,be.y)&&(be=await xt(yt,void 0),!te||Pt!==X))return;if(!me&&kt(be.x,be.y))return R("stowed");nt=be.placement;const it=be.placement.split("-")[0];Z.style.left=`${Math.round(be.x)}px`,Z.style.top=`${Math.round(be.y)}px`,Z.dataset.side=it;const wt=be.middlewareData.arrow;ee.dataset.edge=Ik(it),ee.style.left=(wt==null?void 0:wt.x)!=null?`${wt.x}px`:"",ee.style.top=(wt==null?void 0:wt.y)!=null?`${wt.y}px`:"",ee.hidden=!wt||Math.abs(wt.centerOffset)>1}if(p&&!ce&&(q(),ce=!0),!Le){if(hne([...r?[r]:[],...a])&&++gt<zk){window.setTimeout(Ie,Zk);return}const re=[...r?[r]:[],...a,...h,...f].map(ue=>{const de=ue.getBoundingClientRect();return[de.left,de.top,de.right,de.bottom].map(Math.round).join(",")}).join("|");if(re!==Se&&(Se=re,Ze=0),++Ze<2&&Ze<Xte){window.setTimeout(Ie,Zk);return}}R("shown"),Le||(Le=!0,De(),Ye())};let ze=0;const Ye=()=>{const Pt=r??a[0];if(!Pt)return;cancelAnimationFrame(ze);let Tt=Pt.getBoundingClientRect();const ke=performance.now()+Qte,et=()=>{if(!te)return;const Et=Pt.getBoundingClientRect();(Et.top!==Tt.top||Et.left!==Tt.left||Et.height!==Tt.height)&&(Tt=Et,Ie()),performance.now()<ke&&(ze=requestAnimationFrame(et))};ze=requestAnimationFrame(et)},Ie=()=>{cancelAnimationFrame(ae),ae=requestAnimationFrame(()=>void Re())},De=()=>{U.current=!0;let Pt=!1;if(p&&Z){const Tt=Et=>!!Et&&a.some(Qe=>Qe.contains(Et)),ke=document.activeElement,et=a.find(Et=>Et.matches(Vk))??null;M.current&&Tt(ke)?M.current=null:M.current?(((M.current==="back"?L.current:null)??T.current??Z).focus({preventScroll:!0}),M.current=null):et&&!Tt(ke)?Bk(et):(!ke||ke===document.body||ke.closest("[inert]"))&&(Z.focus({preventScroll:!0}),Pt=!0)}u(t,Pt)},Ge=U.current&&!Q&&m&&K.current!==t?ene:0;K.current=t,cne(Ge).then(()=>{if(te)return Br.flushSync(()=>B(U8(V.current))),r?K8(r,ie,Q):void 0}).then(()=>{te&&(ne=Aj(We,Z??pe??We,Ie))});const ft=new ResizeObserver(Ie);for(const Pt of a)ft.observe(Pt);r&&ft.observe(r),Z&&ft.observe(Z);for(const Pt of[...r?[r]:[],...a]){const Tt=(Zt=Pt==null?void 0:Pt.closest)==null?void 0:Zt.call(Pt,B4);Tt&&ft.observe(Tt)}(jt=window.visualViewport)==null||jt.addEventListener("resize",Ie),(Ft=window.visualViewport)==null||Ft.addEventListener("scroll",Ie);let bt=0;const at=p?new MutationObserver(()=>{ce&&(cancelAnimationFrame(bt),bt=requestAnimationFrame(q))}):null;return at==null||at.observe(l,{childList:!0,subtree:!0}),()=>{var Pt,Tt;te=!1,document.documentElement.style.removeProperty("--sc-coach-h"),cancelAnimationFrame(ae),cancelAnimationFrame(ze),cancelAnimationFrame(bt),at==null||at.disconnect(),ne==null||ne(),ft.disconnect(),(Pt=window.visualViewport)==null||Pt.removeEventListener("resize",Ie),(Tt=window.visualViewport)==null||Tt.removeEventListener("scroll",Ie)}},[t,p,m,r,I,G,z,i,l,u,H]),s.useEffect(()=>{if(!m||!r||!une(r))return;const Z=(r.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);if(!Z.includes(y))return r.setAttribute("aria-describedby",[...Z,y].join(" ")),()=>{const ee=(r.getAttribute("aria-describedby")??"").split(/\s+/).filter(pe=>pe&&pe!==y);ee.length?r.setAttribute("aria-describedby",ee.join(" ")):r.removeAttribute("aria-describedby")}},[m,r,y]);const{onEscape:Y}=e;return s.useEffect(()=>{if(!p)return;const Z=te=>!!te&&a.some(X=>X.contains(te)),ee=te=>{var Se;const X=b.current,ae=te.target instanceof Node?te.target:null,Le=Z(ae),ce=document.activeElement;if(te.key==="Escape"){if(te.defaultPrevented||ce!=null&&ce.closest('[role="dialog"]:not(.sc-coach):not(.sc-attachpanel)')||Le&&(ce!=null&&ce.closest('input, textarea, select, [contenteditable="true"], [role="menu"], [role="listbox"]')))return;te.preventDefault(),te.stopPropagation(),Y(t);return}Le||(!ae||ae===document.body||ae===document.documentElement||X!=null&&X.contains(ae)||(Se=E.current)!=null&&Se.contains(ae))&&te.stopPropagation()};let pe=0,se=!1;const xe=te=>{se=te.target instanceof Node&&Z(te.target)},J=te=>{te.relatedTarget||se||!b.current||(cancelAnimationFrame(pe),pe=requestAnimationFrame(()=>{var ae;if(!document.hasFocus())return;const X=document.activeElement;(!X||X===document.body||X.closest("[inert]"))&&((ae=b.current)==null||ae.focus({preventScroll:!0}))}))};return window.addEventListener("keydown",ee,!0),window.addEventListener("pointerdown",xe,!0),document.addEventListener("focusout",J,!0),()=>{cancelAnimationFrame(pe),window.removeEventListener("keydown",ee,!0),window.removeEventListener("pointerdown",xe,!0),document.removeEventListener("focusout",J,!0)}},[t,p,I,Y]),Br.createPortal(o.jsxs(o.Fragment,{children:[p&&o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:S,className:"sc-coach-veil","data-veil":H?"mask":"panels","data-soft":e.soft||void 0,"data-state":P,"aria-hidden":"true",children:Yk.map(Z=>o.jsx("div",{className:"sc-coach-panel"},Z))}),o.jsx("div",{ref:E,className:"sc-coach-catch","data-guide":"catch","data-state":P,"aria-hidden":"true",onMouseDown:Z=>Z.preventDefault(),children:Yk.map(Z=>o.jsx("div",{className:"sc-coach-catch-part"},Z))}),o.jsx("div",{ref:A,className:"sc-coach-rim","data-state":P,"aria-hidden":"true"}),o.jsx("div",{ref:C,className:"sc-coach-ring","data-state":P,"aria-hidden":"true",hidden:!0})]}),m&&o.jsxs("div",{ref:b,className:"sc-coach","data-guide":"card","data-voice":p?"coach":"card","data-beside":e.beside||void 0,...p?{role:"dialog","aria-labelledby":F.title?w:void 0}:{role:"note"},"aria-describedby":y,tabIndex:-1,"data-state":P,children:[o.jsx("div",{ref:k,className:"sc-coach-arrow","aria-hidden":"true",hidden:!0}),o.jsxs("div",{className:"sc-coach-head",children:[F.title?o.jsx("h2",{id:w,className:"sc-coach-title",children:F.title}):o.jsx("p",{id:y,className:"sc-coach-body","data-lead":"",children:F.body}),F.count&&o.jsxs("p",{className:"sc-coach-count",children:[o.jsx("span",{className:"sc-vh",children:"Step "}),F.count]}),o.jsx(fr,{label:e.closeLabel,children:o.jsx("button",{type:"button",className:"sc-coach-x","aria-label":e.closeLabel,onClick:()=>e.onClose(t),children:o.jsx(jn,{size:16})})})]}),F.title&&F.body&&o.jsx("p",{id:y,className:"sc-coach-body",children:F.body}),(F.canBack||F.action)&&o.jsxs("div",{className:"sc-coach-foot",children:[F.canBack&&o.jsx("button",{ref:L,type:"button",className:"sc-coach-back",onClick:()=>{M.current="back",e.onBack(t)},children:"Back"}),F.action&&o.jsx("button",{ref:T,type:"button",className:"sc-btn sc-btn-primary sc-coach-next",onClick:()=>{M.current="action",e.onAction(t)},children:F.action.label})]})]})]}),l)}function Bk(e){var t,n;if(e.focus({preventScroll:!0}),!e.isContentEditable){const r=e,a=((t=r.value)==null?void 0:t.length)??0;(n=r.setSelectionRange)==null||n.call(r,a,a);return}mc(e)}function Uk(){return[...document.querySelectorAll(Wte)].filter(e=>e.getClientRects().length>0)}function W8(e){const t=s.useRef(e);return(t.current.length!==e.length||t.current.some((n,r)=>n!==e[r]))&&(t.current=e),t.current}function rne(e,t){const n=[];for(const r of document.querySelectorAll(Jte))t.contains(r)&&(r.contains(e)||e.contains(r)||r.getClientRects().length===0||n.push(op(r.getBoundingClientRect())));return n}function sne(e,t){return Math.max(0,...e.filter(n=>n.top<=0&&n.bottom<t/3).map(n=>n.bottom))}function ane(e,t){return Math.max(0,...e.filter(n=>n.bottom>=t&&n.top>t*2/3).map(n=>t-n.top))}function one(e,t){const n={x:e.left,y:e.top,left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:pi(e),height:Ao(e)};return{getBoundingClientRect:()=>n,contextElement:t}}function ine(e,t,n,r,a){const i=window.innerWidth,l=window.innerHeight,u=r.reduce((h,p)=>h?rP(h,p):p,null),f=u?zte(u,i,l):[];if(a){const h=Vte(r,i,l),p=e.style;p.maskImage=h,p.webkitMaskImage=h,n.style.backgroundImage=Zte(r,i,l,Ute)}else Gk(e,f);Gk(t,f)}function ip(e){return Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||0}function Wk(e){return e.closest(B4)??e.querySelector(B4)??e}function Kk(e){let t=0,n=0,r=0;for(const a of e.querySelectorAll("button, a[href], .sc-chip, .sc-btn"))a.getClientRects().length&&(r+=1,t=Math.max(t,ip(a)),n=Math.max(n,a.getBoundingClientRect().height));return{radius:t,height:n,count:r}}function Gk(e,t){Array.from(e.children).forEach((n,r)=>{const a=t[r],i=n.style;if(!a){i.display="none";return}Object.assign(i,{display:"block",left:`${a.left}px`,top:`${a.top}px`,width:`${pi(a)}px`,height:`${Ao(a)}px`})})}const Yk=[0,1,2,3];function lne(){return typeof CSS>"u"?!1:CSS.supports("mask-image",'url("x.svg")')||CSS.supports("-webkit-mask-image",'url("x.svg")')}function Hh(e){for(let t=e.parentElement;t&&t!==document.body;t=t.parentElement){const n=getComputedStyle(t).overflowY;if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t}return null}function K8(e,t,n){if(!t)return Promise.resolve();const r=e.getBoundingClientRect(),a=t.getBoundingClientRect();if(Math.max(0,Math.min(r.bottom,a.bottom,window.innerHeight)-Math.max(r.top,a.top,0))>=Math.min(120,r.height*.4))return Promise.resolve();const u=r.height>a.height*.8?r.top-a.top-16:(r.top+r.bottom)/2-(a.top+a.bottom)/2;return t.scrollBy({top:u,behavior:n?"auto":"smooth"}),n?Promise.resolve():new Promise(f=>{let h=!1;const p=()=>{h||(h=!0,t.removeEventListener("scrollend",p),f())};t.addEventListener("scrollend",p),window.setTimeout(p,Yte)})}function cne(e){return e>0?new Promise(t=>window.setTimeout(t,e)):Promise.resolve()}function une(e){return e.matches('button, a[href], input, select, textarea, [tabindex], [contenteditable="true"]')}const dne=10;function fne(e){if(!e.matches("a[href], button")||e.getBoundingClientRect().height<=48)return null;const t=document.createRange();t.selectNodeContents(e);const n=t.getBoundingClientRect();return n.width?{left:n.left-12,top:n.top-7,right:n.right+12,bottom:n.bottom+7}:null}function hne(e){return document.getAnimations().some(t=>{var r,a;const n=(r=t.effect)==null?void 0:r.target;return!(n instanceof Element)||t.playState!=="running"||((a=t.effect)==null?void 0:a.getTiming().iterations)===Number.POSITIVE_INFINITY?!1:e.some(i=>n.contains(i))})}const cr=e=>e.kind==="question"?`q:${e.question.id}`:`${e.kind}:${e.id}`;function pne(e){const t=e[e.length-1];return(t==null?void 0:t.kind)!=="question"||t.question.kind!=="confirm"||t.question.quiet||t.question.noEnter||e.some(r=>r.kind==="question"&&r.question.reopened||r.kind==="you"&&r.editing)?null:t.question}const l1=320,dy=180,mne=28,gne=700;function i2(e){const t=e.split(/(\s+)/).filter(a=>a.length>0),n=t.filter(a=>!/^\s+$/.test(a)).length,r=Math.min(mne,Math.floor(gne/Math.max(1,n)));return{words:t,step:r,total:l1+dy+r*n+160}}function G8(e,t){return e.every(n=>!!t[n.id])}function vne(e,t,n={}){const r=e.trim().toLowerCase();if(!r||r.split(/\s+/).length>6)return null;for(const i of t){const l=i.label.toLowerCase();if(r===l||r===i.id.toLowerCase())return i.id}for(const i of t){const l=n[i.id];if(l!=null&&l.test(r))return i.id}return null}function wne(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const yne=/^(hi|hello|hey|heya|hiya|yo|hola|shalom|sup|good (morning|afternoon|evening)|thanks|thank you|thx|cheers)\b/i,bne=/^(ok|okay|k|kk|sure|fine|yes|yeah|yep|yup|no|nope|nah|cool|nice|great|alright|right|hmm+|hm+|uh+|um+|oh|ah|wow|haha+|hehe+|lol|lmao|omg|meh|really|seriously|interesting|whatever)[\s!.,?]*$/i,xne=/^(how|what|what's|whats|who|who's|whos|why|where|when|which|can|could|do|does|did|are|is|will|would|should|may|have|has|am|isn't|aren't|don't|doesn't)\b/i,kne=/^(start over|start again|restart|reset|cancel|stop|quit|exit|go back|back|undo|never ?mind|forget it|close)\b/i,Sne=/^(skip|next|continue|go|go on|proceed|generate|draw|render|build|show me|show|try|do it|let'?s go|begin|start)\b/i,qk=/^(help|help me|how does this work|what do i do|what should i (write|say|type)|instructions|\?+)[\s!.,?]*$/i,Ene=/\b(presenters?|avatars?|characters?|Scenri|create|creating|generate|generating|images?|pictures?|shoot|campaign|brand|product)\b/i,Cne=/^(test|testing|blah|lorem|ipsum|foo|bar|baz|dummy|sample|placeholder|xxx+|abc|asdf\w*|qwer\w*|zxcv\w*|hjkl|jkl|sdfg?|dfgh?|fghj?|bull\w*|shit\w*|crap|fuck\w*|damn|wtf|stfu|bs|rofl|lol+|lmao+|haha\w*|hehe\w*|meh|idk|nvm)$/i,jne=/^[b-df-hj-np-tv-xz]{3,}$/i,Ane=/(.)\1{3,}/,Nne=/\b(like|as|resembling|resembles|similar to|looks? like|looking like)\s+([A-Z][a-z]+)(?:\s+[A-Z][a-z]+)*\b/,Mne=/^(mediterranean|asian|east|south|southeast|indian|chinese|japanese|korean|african|black|white|nordic|scandinavian|latin|latina|latino|hispanic|arab|arabic|middle|eastern|european|caucasian|israeli|jewish|irish|italian|french|spanish|greek|turkish|persian|brazilian|mexican|american|british|german|dutch|russian|polish|thai|vietnamese|filipino|filipina|nigerian|ethiopian|moroccan|egyptian|australian|canadian|swedish|norwegian|danish|finnish|portuguese|indonesian|pakistani|iranian|lebanese|slavic|celtic|west|north|central)$/i;function ai(e,t){const n=e.trim();if(!n)return null;const r=Nne.exec(n);if(r&&!Mne.test(r[2]))return"likeness";if(t(n))return null;if(!new RegExp("\\p{L}","u").test(n))return qk.test(n)?"help":"nonsense";const a=n.split(/\s+/).filter(Boolean),i=a.length;if(qk.test(n))return"help";if(yne.test(n)&&i<=4)return"greeting";if(bne.test(n))return"ack";const l=u=>u.replace(/[^a-z]/gi,"");return i<=8&&a.some(u=>Cne.test(l(u))||jne.test(l(u))||Ane.test(l(u)||u))?"nonsense":xne.test(n)||/\?\s*$/.test(n)?"question":kne.test(n)&&i<=4?"nav":Ene.test(n)&&i<=10?"intent":Sne.test(n)&&i<=4?"go":i===1&&/^[A-Z][a-z]+$/.test(n)?null:i<=2?"vague":null}const Rne=e=>`aside-said-${e}`,Xk=e=>e.startsWith("aside-said-")?e.slice(11):null,Ei=(e,t=!1,n=!1)=>[...n?[]:[{kind:"you",id:Rne(e.at),text:e.said,editable:!0,editing:t||void 0}],{kind:"scenri",id:`aside-reply-${e.at}${e.rev?`-${e.rev}`:""}`,text:e.reply}],Vp=e=>(e.kind==="you"||e.kind==="scenri")&&e.id.startsWith("aside-");function aP(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question.id;if(!Vp(n))return null}return null}const Zp=()=>new Date().toISOString();function Pne({options:e,picked:t,onPick:n}){return o.jsx("div",{className:"sc-convo-grid",children:e.map(r=>o.jsxs("button",{type:"button",className:"sc-convo-plate","aria-label":r.label,"aria-pressed":t===r.id,"data-on":t===r.id||void 0,onClick:()=>n(r.id),children:[o.jsx("span",{className:"sc-convo-plate-in","data-card":r.card}),o.jsx("span",{className:"sc-convo-plate-lb",children:r.label})]},r.id))})}function Lne({step:e,children:t}){const n=s.useRef(null),[r,a]=s.useState({back:!1,on:!0}),i=s.useCallback(()=>{const h=n.current;if(!h)return;const p=h.scrollWidth-h.clientWidth;a({back:h.scrollLeft>2,on:h.scrollLeft<p-2})},[]);s.useEffect(()=>{const h=n.current;if(!h)return;i(),h.addEventListener("scroll",i,{passive:!0});const p=new ResizeObserver(i);return p.observe(h),()=>{h.removeEventListener("scroll",i),p.disconnect()}},[i]);const l=h=>{const p=n.current;if(!p)return;const g=p.firstElementChild,m=Number.parseFloat(getComputedStyle(p).columnGap)||0,w=g?g.offsetWidth+m:e,y=!window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.scrollBy({left:h*w,behavior:y?"smooth":"auto"})},u=r.back&&r.on?"both":r.back?"back":r.on?"on":void 0,f=r.back||r.on;return o.jsxs("div",{className:"sc-convo-strip","data-fade":u,children:[f&&o.jsx(Qk,{dir:-1,live:r.back,onGo:l}),o.jsx("div",{className:"sc-convo-plates",ref:n,children:t}),f&&o.jsx(Qk,{dir:1,live:r.on,onGo:l})]})}function Qk({dir:e,live:t,onGo:n}){const r=e<0;return o.jsx("button",{type:"button",className:"sc-convo-strip-go","data-dir":r?"back":"on","data-spent":!t||void 0,"aria-label":r?"Show earlier":"Show more","aria-disabled":!t||void 0,tabIndex:-1,onClick:a=>{a.currentTarget.blur(),t&&n(e)},children:r?o.jsx($a,{size:14,weight:"bold"}):o.jsx(Al,{size:14,weight:"bold"})})}const $ne=106;function Jk({options:e,picked:t,onPick:n}){return o.jsx(Lne,{step:$ne,children:e.map(r=>o.jsxs("button",{type:"button",className:"sc-convo-plate","aria-label":r.label,"aria-pressed":t===r.id,"data-on":t===r.id||void 0,onClick:()=>n(r.id),children:[o.jsx("span",{className:"sc-convo-plate-in","data-card":r.card}),o.jsx("span",{className:"sc-convo-plate-lb",children:r.label})]},r.id))})}const oP=6e4,Tne=60*oP,Y8=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),Dne=e=>e.toLocaleDateString([],{day:"numeric",month:"short"});function Hne(e,t){const n=new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();return Math.round((r-n)/864e5)}function One(e,t=Date.now()){const n=Math.max(0,t-e);if(n<45e3)return"just now";if(n<Tne)return`${Math.max(1,Math.round(n/oP))} min ago`;const r=new Date(e),a=Hne(r,new Date(t));return a===0?Y8(r):a===1?`Yesterday ${Y8(r)}`:`${Dne(r)} ${Y8(r)}`}const Ine=e=>new Date(e).toLocaleString([],{dateStyle:"medium",timeStyle:"short"});function Fne({text:e,tone:t,at:n,now:r,reveal:a,eyebrow:i=!0,delay:l=0,leave:u,turnId:f,dim:h,thumb:p,label:g,view:m,current:w,restore:y,onRestore:b,retry:k,onRetry:S,onShow:E}){const[C]=s.useState(l),A=hy(u,C),{playing:L,thinking:T}=dP(a,e,C,A==="true");return o.jsxs("div",{className:"sc-convo-turn","data-guide-shape":"","data-who":"scenri","data-arrive":L||void 0,"data-leave":A,"data-turn":f,"data-dim":h||void 0,style:L?{...iP(C),"--sc-convo-after":`${i2(e).total}ms`}:void 0,children:[i&&o.jsx(fy,{thinking:T,at:n,now:r}),o.jsxs("p",{className:"sc-convo-say","data-tone":t,"data-reveal":L||void 0,children:[T&&o.jsx(cP,{}),o.jsx(uP,{text:e,playing:L})]}),p&&o.jsxs("span",{className:"sc-convo-shot","data-reveal":L||void 0,"data-current":w||void 0,children:[m&&E?o.jsx("button",{type:"button",className:"sc-convo-shot-pick","aria-label":g?`Show ${g} on the stage`:"Show this on the stage",onClick:()=>E(m),children:o.jsx(eS,{thumb:p,label:g,current:w})}):o.jsx(eS,{thumb:p,label:g,current:w}),y&&b?o.jsx("button",{type:"button",className:"sc-convo-shot-do sc-convo-restore",onClick:()=>b(y.view,y.hash),children:"Put back"}):k&&S?o.jsx("button",{type:"button",className:"sc-convo-shot-do sc-convo-restore",onClick:()=>S(k),children:"Try again"}):w&&o.jsx("span",{className:"sc-convo-shot-do",children:"Active"})]})]})}const iP=e=>({"--sc-convo-start":`${e}ms`,"--sc-convo-think":`${l1}ms`});function fy({thinking:e,at:t,now:n}){return o.jsxs("span",{className:"sc-convo-who","data-thinking":e||void 0,"aria-hidden":"true",children:[o.jsx(wQ,{className:"sc-convo-mark"}),"Scenri",t?o.jsx(lP,{at:t,now:n}):null]})}function lP({at:e,now:t}){return o.jsx("time",{className:"sc-convo-time",dateTime:new Date(e).toISOString(),title:Ine(e),children:One(e,t)})}function _ne({what:e="Thinking"}){return o.jsxs("div",{className:"sc-convo-turn","data-who":"scenri","data-working":"true",children:[o.jsx(fy,{thinking:!0}),o.jsx("p",{className:"sc-convo-say",children:o.jsxs("span",{className:"sc-convo-work",children:[e,o.jsx(Vne,{})]})})]})}function Vne(){return o.jsxs("span",{className:"sc-convo-ell","aria-hidden":"true",children:[o.jsx("i",{children:"."}),o.jsx("i",{children:"."}),o.jsx("i",{children:"."})]})}function cP(){return o.jsxs("span",{className:"sc-convo-dots","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]})}function uP({text:e,playing:t}){const n=s.useRef(t);if(t&&(n.current=!0),!n.current)return o.jsx(o.Fragment,{children:e});const{words:r,step:a}=i2(e);let i=0,l=0;return o.jsx(o.Fragment,{children:r.map(u=>{const f=l;if(l+=u.length,/^\s+$/.test(u))return u;const h=i++;return o.jsx("span",{className:"sc-convo-w",style:{"--sc-convo-word-delay":`${h*a}ms`},children:u},`${f}:${u}`)})})}function dP(e,t,n=0,r=!1){const[a,i]=s.useState(!!e),[l,u]=s.useState(!!e),f=s.useRef(!!e);return s.useEffect(()=>{e&&!f.current&&(i(!0),u(!0)),f.current=!!e},[e]),s.useEffect(()=>{if(!a)return;const h=setTimeout(()=>{u(!1),i(!1)},n+i2(t).total),p=setTimeout(()=>u(!1),n+l1);return()=>{clearTimeout(h),clearTimeout(p)}},[a,t,n]),{playing:a&&!r,thinking:a&&l&&!r}}function hy(e,t,n=l1+dy){const r=s.useRef(performance.now());if(e)return performance.now()-r.current<t+n?"early":"true"}function eS({thumb:e,label:t,current:n}){return o.jsx("img",{src:gn(e,"micro"),srcSet:`${gn(e,"micro")} 160w, ${gn(e,"small")} 320w, ${gn(e,"tile")} 640w`,sizes:"(max-width: 767px) 248px, 128px",alt:n&&t?`${t}, active`:t??""})}const Zne=300,zne=e=>typeof e=="string"?e:null,Bne=e=>Array.isArray(e)?e:[],Une=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{};function Wne({question:e,reveal:t,busy:n,eyebrow:r=!0,delay:a=0,leave:i,spent:l,turnId:u,dim:f,at:h,now:p,onAnswer:g,onPick:m,onStarter:w,onDescribe:y,onAttachFiles:b,onCancel:k}){var J,te,X,ae,Le;const[S]=s.useState(a),E=hy(i,S),{playing:C,thinking:A}=dP(t,e.prompt,S,E==="true"),L="given"in e?e.given:void 0,[T,M]=s.useState(()=>Une(L)),[j,P]=s.useState(null),[R,H]=s.useState(()=>new Set(Bne(L))),D=!!l||!!n,B=s.useRef(!1);s.useEffect(()=>{B.current&&!D&&P(null),B.current=D},[D]),s.useEffect(()=>{e.attempt&&P(null)},[e.attempt]);const V=(ce,Se)=>{j||(P(ce),m==null||m(e.id,{picked:ce,picks:T}),g(Se))},U=j??zne(L),K=s.useRef(null),O=s.useRef(null),F=s.useRef(()=>{});F.current=()=>{e.kind==="pick"&&e.more&&!e.loading&&g({kind:"pick",action:{type:"more"}})};const I=e.kind==="pick"?e.items.length:0,G=e.kind==="pick"&&!!e.more;s.useEffect(()=>{const ce=O.current,Se=K.current;if(!ce||!Se||!G||typeof IntersectionObserver>"u")return;const Ze=new IntersectionObserver(gt=>gt.some(Ke=>Ke.isIntersecting)&&F.current(),{root:Se,rootMargin:"0px 0px 240px 0px"});return Ze.observe(ce),()=>Ze.disconnect()},[I,G]);const z=I>0;s.useLayoutEffect(()=>{const ce=K.current;if(!ce||!z||typeof ResizeObserver>"u")return;const Se=()=>{const gt=ce.querySelector(".sc-convo-plate");gt&&ce.style.setProperty("--sc-pick-row",`${gt.getBoundingClientRect().height}px`)};Se();const Ze=new ResizeObserver(Se);return Ze.observe(ce),()=>Ze.disconnect()},[z]);const Y=e.kind==="pick"?(J=e.search)==null?void 0:J.value:void 0;s.useEffect(()=>{K.current&&(K.current.scrollTop=0)},[Y]);const Z=i2(e.prompt),ee=`sc-convo-q-${e.id}`,pe=s.useRef(null),se=e.reopened&&k&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost sc-convo-cancel",onClick:k,children:"Cancel"}),xe="attach"in e&&e.attach&&b&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass",onClick:()=>{var ce;return(ce=pe.current)==null?void 0:ce.click()},children:[o.jsx(mF,{size:14,weight:"bold"}),e.attach]}),o.jsx("input",{ref:pe,type:"file",accept:"image/*",hidden:!0,"aria-label":e.attach,onChange:ce=>{const Se=Array.from(ce.target.files??[]).filter(Ze=>Ze.type.startsWith("image/"));ce.target.value="",Se.length&&b(Se)}})]});return o.jsxs("div",{className:"sc-convo-turn","data-who":"scenri","data-arrive":C||void 0,"data-leave":E,"data-turn":u,"data-dim":f||void 0,"data-reopened":e.reopened||void 0,style:C?{...iP(S),"--sc-convo-after":`${Z.total}ms`}:void 0,children:[!e.reopened&&r&&o.jsx(fy,{thinking:A,at:h,now:p}),!e.reopened&&o.jsxs("p",{className:"sc-convo-say",id:ee,"data-tone":e.tone,"data-reveal":C||void 0,children:[A&&o.jsx(cP,{}),o.jsx(uP,{text:e.prompt,playing:C})]}),e.reopened&&o.jsx("span",{id:ee,hidden:!0,children:e.prompt}),!e.reopened&&e.hint&&o.jsx("p",{className:"sc-convo-hint","data-reveal":C||void 0,children:e.hint}),o.jsxs("fieldset",{className:"sc-convo-q","aria-labelledby":ee,hidden:e.kind==="text"&&!((te=e.starters)!=null&&te.length)&&!e.cost&&!e.note?!0:void 0,tabIndex:-1,"data-kind":e.kind,"data-reveal":C||void 0,"data-picked":!!j||void 0,disabled:n||void 0,children:[e.starters&&e.starters.length>0&&o.jsx("div",{className:"sc-convo-starters",children:e.starters.map(ce=>o.jsx(fr,{label:ce.text,children:o.jsx("button",{type:"button",className:"sc-convo-starter",onClick:()=>w==null?void 0:w(ce.text),children:ce.label})},ce.text))}),e.kind==="choice"&&((X=e.options)==null?void 0:X.some(ce=>ce.card))&&o.jsx(Jk,{options:e.options,picked:U,onPick:ce=>V(ce,{kind:"choice",id:ce})}),e.kind==="choice"&&e.options&&!e.groups&&!e.options.some(ce=>ce.card)&&o.jsx("div",{className:"sc-convo-choices sc-convo-ask","data-guide-shape":"",children:e.options.map(ce=>o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice","aria-pressed":e.multi?R.has(ce.id):void 0,"data-on":(e.multi?R.has(ce.id):U===ce.id)||void 0,onClick:()=>e.multi?H(Se=>{const Ze=new Set(Se);return Ze.delete(ce.id)||Ze.add(ce.id),Ze}):V(ce.id,{kind:"choice",id:ce.id}),children:ce.label},ce.id))}),e.kind==="choice"&&(e.describe||e.attach||e.skip)&&o.jsxs("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:[e.skip&&!e.multi&&!e.groups&&o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass","data-on":j==="skip"||!j&&e.skipped||void 0,onClick:()=>V("skip",{kind:"skip"}),children:e.skip}),e.describe&&y&&o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass","aria-pressed":e.saying===void 0?void 0:e.saying,"data-on":e.saying||void 0,onClick:y,children:e.describe}),xe,!e.multi&&se]}),e.kind==="choice"&&!e.groups&&!e.multi&&!e.describe&&!e.attach&&se&&o.jsx("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:se}),e.kind==="choice"&&e.multi&&o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary","data-on":j==="submit"||void 0,onClick:()=>V("submit",{kind:"choices",picks:Object.fromEntries([...R].map(ce=>[ce,"on"]))}),children:e.submit??"Continue"}),e.skip&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-on":j==="skip"||!j&&e.skipped||void 0,onClick:()=>V("skip",{kind:"skip"}),children:e.skip}),se]}),e.kind==="choice"&&e.groups&&o.jsxs("div",{className:"sc-convo-groups",children:[e.groups.map(ce=>o.jsxs("div",{className:"sc-convo-group",children:[o.jsx("span",{className:"sc-convo-group-lb",id:`sc-convo-g-${e.id}-${ce.id}`,children:ce.label}),o.jsx(ri,{label:ce.label,value:T[ce.id]??"",ids:ce.options.map(Se=>Se.id),onChange:Se=>M(Ze=>({...Ze,[ce.id]:Se})),className:"sc-convo-choices",children:ce.options.map(Se=>o.jsx(si,{id:Se.id,on:T[ce.id]===Se.id,label:Se.label,className:"sc-chip sc-convo-choice",onPick:()=>M(Ze=>({...Ze,[ce.id]:Se.id})),children:Se.label},Se.id))})]},ce.id)),o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary","aria-disabled":!G8(e.groups,T)||void 0,title:G8(e.groups,T)?void 0:"Pick one in each row, or skip.","data-on":j==="submit"||void 0,onClick:()=>{G8(e.groups??[],T)&&V("submit",{kind:"choices",picks:T})},children:e.submit??"Continue"}),e.skip&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-on":j==="skip"||!j&&e.skipped||void 0,onClick:()=>V("skip",{kind:"skip"}),children:e.skip}),se]})]}),e.kind==="swatches"&&o.jsxs("div",{className:"sc-convo-look",children:[e.row.options.some(ce=>ce.card)?e.layout==="grid"?o.jsx(Pne,{options:e.row.options,picked:U,onPick:ce=>V(ce,{kind:"swatches",picks:{[e.row.id]:ce}})}):o.jsx(Jk,{options:e.row.options,picked:U,onPick:ce=>V(ce,{kind:"swatches",picks:{[e.row.id]:ce}})}):o.jsx("div",{className:"sc-convo-swatches",children:e.row.options.map(ce=>o.jsx(fr,{label:ce.label,children:o.jsx("button",{type:"button",className:ce.color?"sc-convo-swatch":"sc-chip sc-convo-choice",style:ce.color?{"--sc-swatch":ce.color}:void 0,"aria-label":ce.label,"aria-pressed":U===ce.id,"data-on":U===ce.id||void 0,onClick:()=>V(ce.id,{kind:"swatches",picks:{[e.row.id]:ce.id}}),children:ce.color?null:ce.label})},ce.id))}),(e.skip||e.describe||se)&&o.jsxs("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:[e.skip&&o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass","aria-pressed":j==="skip"||!j&&e.skipped,"data-on":j==="skip"||!j&&e.skipped||void 0,onClick:()=>V("skip",{kind:"skip"}),children:e.skip}),e.describe&&y&&o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass","aria-pressed":e.saying===void 0?void 0:e.saying,"data-on":e.saying||void 0,onClick:y,children:e.describe}),se]})]}),e.kind==="photos"&&o.jsxs("div",{className:"sc-convo-photos-q",children:[o.jsx(rR,{hashes:e.hashes,max:e.max,label:((ae=e.drop)==null?void 0:ae.label)??"Add a photo of their face",hint:((Le=e.drop)==null?void 0:Le.hint)??"Drop it here, or choose a file",busy:e.busy,onAdd:ce=>g({kind:"photos",action:{type:"add",files:ce}}),onRemove:ce=>g({kind:"photos",action:{type:"remove",hash:ce}}),onReject:()=>g({kind:"photos",action:{type:"reject"}})}),e.instead&&o.jsx("button",{type:"button",className:"sc-convo-other","data-on":j==="instead"||void 0,"data-waiting":e.insteadWaiting||void 0,"aria-hidden":e.insteadWaiting||void 0,tabIndex:e.insteadWaiting?-1:void 0,disabled:e.insteadWaiting||void 0,onClick:()=>V("instead",{kind:"photos",action:{type:"instead"}}),children:e.instead}),e.attest&&o.jsxs("label",{className:"sc-convo-attest",children:[o.jsx("input",{type:"checkbox",checked:e.attest.checked,onChange:ce=>g({kind:"photos",action:{type:"attest",checked:ce.target.checked}})}),o.jsx("span",{children:e.attest.text})]}),o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary","aria-disabled":!!q8(e)||void 0,title:q8(e)??void 0,"data-on":j==="submit"||void 0,onClick:()=>{q8(e)||V("submit",{kind:"photos",action:{type:"submit"}})},children:e.submit}),e.back&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-on":j==="back"||void 0,onClick:()=>V("back",{kind:"photos",action:{type:"back"}}),children:e.back}),se]})]}),e.kind==="pick"&&o.jsxs("div",{className:"sc-convo-pick",children:[e.search&&o.jsx("input",{type:"search",className:"sc-convo-pick-q",value:e.search.value,placeholder:e.search.label,"aria-label":e.search.label,onChange:ce=>g({kind:"pick",action:{type:"query",text:ce.target.value}}),onKeyDown:ce=>{var Se;ce.key!=="Escape"||!((Se=e.search)!=null&&Se.value)||(ce.preventDefault(),g({kind:"pick",action:{type:"query",text:""}}))}}),o.jsxs("fieldset",{ref:K,className:"sc-convo-pick-scroll","aria-labelledby":ee,"aria-busy":e.loading||void 0,children:[e.items.length===0&&e.loading&&o.jsx("div",{className:"sc-convo-grid sc-convo-pick-grid","aria-hidden":!0,children:Array.from({length:8},(ce,Se)=>o.jsx("span",{className:"sc-convo-plate sc-convo-pick-wait",children:o.jsx("span",{className:"sc-convo-plate-in"})},Se))}),e.items.length>0&&o.jsx("div",{className:"sc-convo-grid sc-convo-pick-grid",children:e.items.map(ce=>o.jsx("button",{type:"button",className:"sc-convo-plate","aria-label":ce.alt,"aria-pressed":U===ce.id,"data-on":U===ce.id||void 0,onClick:()=>V(ce.id,{kind:"pick",action:{type:"pick",id:ce.id}}),children:o.jsx("span",{className:"sc-convo-plate-in",style:{backgroundImage:`url("${gn(ce.hash,"small")}")`}})},ce.id))}),e.items.length===0&&!e.loading&&e.empty&&o.jsx("p",{className:"sc-convo-pick-empty",children:e.empty}),e.more&&o.jsx("div",{ref:O,className:"sc-convo-pick-end","aria-hidden":!0})]}),o.jsx("p",{className:"sc-vh",role:"status",children:e.loading?"":e.status??""}),(e.back||se)&&o.jsxs("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:[e.back&&o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass","data-on":j==="back"||void 0,onClick:()=>V("back",{kind:"pick",action:{type:"back"}}),children:e.back}),se]})]}),e.kind==="confirm"&&e.quote&&o.jsx(Kne,{text:e.quote,label:e.quoteLabel,folded:e.quoteFolded}),e.kind==="confirm"&&o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[e.options.map((ce,Se)=>o.jsx("button",{type:"button",className:`sc-btn ${Se===0&&!e.quiet?"sc-btn-primary":"sc-btn-ghost"}`,"data-on":j===ce.id||void 0,onClick:()=>V(ce.id,{kind:"confirm",id:ce.id}),children:ce.label},ce.id)),e.describe&&y&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","aria-pressed":e.saying===void 0?void 0:e.saying,"data-on":e.saying||void 0,onClick:y,children:e.describe}),xe,se]}),e.cost&&o.jsx("p",{className:"sc-convo-note","data-cost":!0,children:e.cost}),e.note&&o.jsx("p",{className:"sc-convo-note",children:e.note})]})]})}function Kne({text:e,label:t="The brief",folded:n=!1}){const[r,a]=s.useState(!1),[i,l]=s.useState(!n);return s.useEffect(()=>{if(!r)return;const u=setTimeout(()=>a(!1),1600);return()=>clearTimeout(u)},[r]),o.jsxs("figure",{className:"sc-convo-brief",children:[o.jsxs("figcaption",{className:"sc-convo-brief-head",children:[o.jsx("span",{className:"sc-convo-brief-lb",children:t}),o.jsxs("button",{type:"button",className:"sc-convo-brief-copy","data-took":r||void 0,onClick:()=>{var u;(u=navigator.clipboard)==null||u.writeText(e).then(()=>a(!0),()=>{})},children:[r?o.jsx(Kn,{size:13,weight:"bold"}):o.jsx(mp,{size:13,weight:"bold"}),r?"Copied":"Copy"]})]}),o.jsx("p",{className:"sc-convo-brief-text","data-folded":!i||void 0,children:e}),n&&o.jsx("button",{type:"button",className:"sc-convo-brief-more","aria-expanded":i,onClick:()=>l(u=>!u),children:i?"Show less":"Show all"})]})}function q8(e){return e.busy?"Still uploading.":e.hashes.length===0?"Add at least one photo.":e.attest&&!e.attest.checked?"Confirm you have permission to use their likeness.":null}function Gne({text:e,photos:t,at:n,now:r,editable:a,editing:i,arrive:l,leave:u,delay:f=0,turnId:h,dim:p,onEdit:g,onSave:m,onCancel:w}){const[y]=s.useState(!!l),[b]=s.useState(f),k=hy(u,y?b:0,y?240:0);return o.jsxs("div",{className:"sc-convo-turn","data-guide-shape":"","data-who":"you","data-arrive":y||void 0,"data-leave":k,"data-turn":h,"data-dim":p||void 0,style:y?{"--sc-convo-start":`${b}ms`}:void 0,children:[n?o.jsx(lP,{at:n,now:r}):null,i&&m&&w?o.jsx(Yne,{text:e,onSave:m,onCancel:w}):o.jsxs("div",{className:"sc-convo-bubble",children:[a&&g&&o.jsx(fr,{label:"Change this answer",children:o.jsx("button",{type:"button",className:"sc-convo-edit","aria-label":"Change this answer",onClick:g,children:o.jsx(jd,{size:13})})}),o.jsx("p",{children:e}),t&&t.length>0&&o.jsx("div",{className:"sc-convo-photos",children:t.map((S,E)=>o.jsx("img",{src:gn(S,"micro"),alt:`Yours, ${E+1} of ${t.length}`},S))})]})]})}function Yne({text:e,onSave:t,onCancel:n}){const[r,a]=s.useState(e),i=s.useRef(null);s.useEffect(()=>{const u=i.current;u&&(u.focus(),u.setSelectionRange(u.value.length,u.value.length))},[]);const l=()=>{const u=r.trim();u&&t(u)};return o.jsxs("div",{className:"sc-convo-bubble","data-editing":"true",children:[o.jsx("textarea",{ref:i,className:"sc-convo-rewrite","aria-label":"Your answer",rows:Math.min(6,Math.max(1,r.split(`
103
+ `).length)),value:r,onChange:u=>a(u.target.value),onKeyDown:u=>{u.key==="Escape"&&(u.preventDefault(),n()),u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),l())}}),o.jsxs("div",{className:"sc-convo-rewrite-do",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:n,children:"Cancel"}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary","aria-disabled":!r.trim()||void 0,onClick:l,children:"Save"})]})]})}const qne=180,tS=3e3,fP=460,Xne="cubic-bezier(0.22, 1, 0.36, 1)",Qne=220,Jne=450,ere=48;function tre({turns:e,busy:t,working:n,memoryKey:r,resumed:a,onAnswer:i,onEdit:l,onSaveEdit:u,onCancelEdit:f,onStarter:h,onDescribe:p,onAttachFiles:g,onRestore:m,onRetry:w,onShow:y}){var Ne;const b=s.useRef(null),k=s.useRef(!0),S=s.useRef(!!a),E=s.useRef(performance.now());S.current&&performance.now()-E.current>tS&&(S.current=!1),s.useEffect(()=>{if(!S.current)return;const ie=()=>{S.current=!1},q=window.setTimeout(ie,tS);return window.addEventListener("pointerdown",ie,{capture:!0}),window.addEventListener("keydown",ie,{capture:!0}),()=>{window.clearTimeout(q),window.removeEventListener("pointerdown",ie,{capture:!0}),window.removeEventListener("keydown",ie,{capture:!0})}},[]);const C=wne(),A=s.useRef(e),L=s.useRef(null),T=s.useRef(null),M=s.useRef(null),j=s.useRef(null),P=s.useRef(null),R=s.useRef([]),[,H]=s.useState(0),D=s.useRef(new Map),B=s.useRef(0),V=performance.now(),U=s.useRef(!1),K=sre(e);if(K!==L.current){L.current=K,U.current=!0;const ie=j.current&&V<j.current.until?j.current:null,q=ie?nS(A.current,ie):A.current,oe=new Set(e.map(cr)),Re=sS(e),ze=sS(q),Ye=Ie=>Ie.startsWith("you:")&&Re.has(Oh(Ie))||Ie.startsWith("q:")&&ze.has(Ie)&&oe.has(Oh(Ie));if(R.current=q.map(cr).filter(Ie=>!oe.has(Ie)&&!Ye(Ie)),Re.size&&!ze.size){const Ie=Oh([...Re][0]),De=q.find(Ge=>cr(Ge)===Ie);M.current=(De==null?void 0:De.kind)==="you"?{key:Ie,text:De.text}:null}if(ze.size>0&&Re.size===0){const Ie=M.current;M.current=null;const De=Ie?e.find(bt=>cr(bt)===Ie.key):void 0,Ge=!!Ie&&((De==null?void 0:De.kind)!=="you"||De.text!==Ie.text),ft=e[e.length-1];T.current=Ge&&(ft==null?void 0:ft.kind)==="question"?cr(ft):null}if(!C&&R.current.length){const Ie=R.current.some(ft=>!(ie!=null&&ie.gone.has(ft))),De=ie!=null&&ie.look&&R.current.includes(`q:${ie.look.qid}`)?ie.look:null,Ge=P.current??De;j.current={from:q,gone:new Set(R.current),look:Ge,until:Ie?V+(P.current?Zne:qne):(ie==null?void 0:ie.until)??V}}else j.current=null;P.current=null,A.current=e}const O=j.current&&V<j.current.until?j.current:null;O||(j.current=null),s.useEffect(()=>{if(!O)return;const ie=window.setTimeout(()=>H(q=>q+1),Math.max(0,O.until-performance.now()));return()=>window.clearTimeout(ie)},[O]);const F=(ie,q)=>{P.current={qid:ie,look:q}},I=O?nS(e,O):e,G=s.useRef(null);if(G.current===null){const ie=r?lre(r):null;G.current=ie??new Set(a||e.length>2?e.map(cr):[])}const z=s.useRef(null);z.current===null&&(z.current=(r?ore(r):null)??new Map);const[Y,Z]=s.useState(()=>Date.now()),ee=Math.max(0,...z.current.values()),pe=Y-ee<36e5;s.useEffect(()=>{if(!pe)return;const ie=window.setInterval(()=>Z(Date.now()),3e4);return()=>window.clearInterval(ie)},[pe]),T.current&&(G.current.delete(T.current),T.current=null);const se=new Set;for(const ie of I){const q=cr(ie);ie.kind==="question"&&ie.question.reopened||G.current.has(q)||se.add(q)}if(a&&S.current&&se.size){for(const ie of se)G.current.add(ie);se.clear()}const xe=[];let J=Number.POSITIVE_INFINITY;{const ie=new Set(I.map(cr));for(const q of[...D.current.keys()])ie.has(q)||D.current.delete(q);for(const q of I){const oe=cr(q);if(!se.has(oe)){xe.push(q);continue}let Re=D.current.get(oe);if(Re===void 0){const ze=q.kind==="you"||q.kind==="scenri"&&!!q.quiet;Re=Math.max(V,ze?0:B.current,(O==null?void 0:O.until)??0),D.current.set(oe,Re),B.current=Math.max(B.current,Re+(ze?Qne:l1+dy))}Re<=V?xe.push(q):J=Math.min(J,Re-V)}}s.useEffect(()=>{if(J===Number.POSITIVE_INFINITY)return;const ie=window.setTimeout(()=>H(q=>q+1),J);return()=>window.clearTimeout(ie)},[J]),s.useEffect(()=>{const ie=G.current;if(ie){for(const q of R.current)ie.delete(q);for(const q of xe){if(q.kind==="question"&&q.question.reopened)continue;const oe=cr(q);O!=null&&O.gone.has(oe)||ie.add(oe)}r&&cre(r,ie),r&&z.current&&ire(r,z.current)}});const te=s.useRef(null),X=s.useCallback(()=>{const ie=b.current;if(!ie)return null;const q=te.current;return q!=null&&q.isConnected&&q.scrollHeight>q.clientHeight?q:(te.current=U4(ie),te.current)},[]);s.useEffect(()=>{const ie=()=>{const q=X();q&&(k.current=q.scrollHeight-q.scrollTop-q.clientHeight<24)};return document.addEventListener("scroll",ie,{passive:!0,capture:!0}),()=>document.removeEventListener("scroll",ie,{capture:!0})},[X]);const ae=(()=>{const ie=e.find(oe=>oe.kind==="question"&&oe.question.reopened);if(ie)return cr(ie);const q=e.find(oe=>oe.kind==="you"&&oe.editing);return q?cr(q):null})();s.useLayoutEffect(()=>{var oe;if(!k.current||ae)return;const ie=document.activeElement;if(ie instanceof HTMLInputElement&&ie.type==="search"&&((oe=b.current)!=null&&oe.contains(ie)))return;const q=X();q&&(q.scrollTop=q.scrollHeight)});const Le=s.useRef(ae);Le.current=ae;const ce=e.length;s.useEffect(()=>{const ie=ce>0&&b.current?are(b.current):null;if(!ie||typeof ResizeObserver>"u")return;const q=new ResizeObserver(()=>{!k.current||Le.current||(ie.scrollTop=ie.scrollHeight)});return q.observe(ie),()=>q.disconnect()},[ce]);const Se=s.useRef(null);s.useLayoutEffect(()=>{var Ye,Ie,De,Ge;if(ae===Se.current)return;const ie=Se.current;Se.current=ae;const q=b.current;if(!q)return;const oe=document.activeElement;if(!(!oe||oe===document.body||q.contains(oe)))return;if(ae){if(k.current=!1,ae.startsWith("you:"))return;(Ie=(Ye=S0(q,ae))==null?void 0:Ye.querySelector(".sc-convo-q"))==null||Ie.focus({preventScroll:!0});return}if(!ie)return;const ze=ie.startsWith("q:")?Oh(ie):ie;(Ge=(De=S0(q,ze))==null?void 0:De.querySelector(".sc-convo-edit"))==null||Ge.focus({preventScroll:!0})}),s.useEffect(()=>{if(!ae)return;const ie=window.setTimeout(()=>{const q=S0(b.current,ae),oe=b.current&&U4(b.current);if(!q||!oe)return;const Re=q.getBoundingClientRect(),ze=oe.getBoundingClientRect();Re.bottom-ze.bottom>ere&&rS(q,C)},fP);return()=>window.clearTimeout(ie)},[ae,C]);const Ze=e.length&&e[e.length-1].kind==="question"?cr(e[e.length-1]):null,gt=s.useRef(Ze);s.useLayoutEffect(()=>{var Ye,Ie;const ie=b.current;if(ae||!ie||Ze===gt.current)return;const q=document.activeElement,oe=(Ye=q==null?void 0:q.closest(".sc-convo-turn"))==null?void 0:Ye.getAttribute("data-turn"),Re=!q||q===document.body||q!==ie&&q.contains(ie)||!!oe&&oe.startsWith("q:")&&oe!==Ze;if(!Ze||!Re){gt.current=Ze;return}const ze=(Ie=S0(ie,Ze))==null?void 0:Ie.querySelector(".sc-convo-q:not([hidden])");ze&&(gt.current=Ze,ze.focus({preventScroll:!0}))});const Ke=s.useRef(Ze),nt=s.useRef(null);s.useEffect(()=>{if(Ze===Ke.current)return;if(!Ze){ae&&(nt.current=Ke.current),Ke.current=null;return}const ie=S0(b.current,Ze);if(!ie)return;Ke.current=Ze;const q=nt.current!==null,oe=nt.current===Ze;if(nt.current=null,k.current||q&&oe)return;const Re=()=>{rre(ie,b.current)||rS(ie,C)};if(!q){Re();return}const ze=window.setTimeout(Re,Jne);return()=>window.clearTimeout(ze)},[Ze,ae,C]);const $e=s.useRef(new Map);s.useLayoutEffect(()=>{const ie=b.current;if(!ie)return;const q=new Map,oe=U.current;U.current=!1;for(const Re of ie.querySelectorAll(".sc-convo-turn")){const ze=Re.dataset.turn??"",Ye=Re.offsetTop;q.set(ze,Ye);const Ie=$e.current.get(ze);!oe||C||Ie===void 0||Math.abs(Ie-Ye)<1||nre(Re,Ie-Ye)}$e.current=q});const ne=new Set;if(ae){ne.add(ae);const ie=ae.slice(ae.indexOf(":")+1);ne.add(`scenri:asked-${ie}`);const q=xe.findIndex(oe=>cr(oe)===ae);if(q>=0){for(let oe=q+1;oe<xe.length&&Vp(xe[oe]);oe++)ne.add(cr(xe[oe]));for(let oe=q-1;oe>=0&&Vp(xe[oe]);oe--)ne.add(cr(xe[oe]))}}for(const ie of xe){const q=cr(ie);z.current.has(q)||z.current.set(q,Date.now())}let Q=!1;const We=[];for(const ie of xe){const q=cr(ie),oe=!!ae&&!ne.has(q),Re=z.current.get(q),ze=!!(O!=null&&O.gone.has(q)),Ye=ze&&ie.kind==="question"&&((Ne=O==null?void 0:O.look)==null?void 0:Ne.qid)===ie.question.id,Ie=ie.kind==="scenri"&&!!ie.quiet,De=!C&&!ze&&se.has(q)&&!Ie,Ge=0,ft=Q;ze||(Q=ie.kind==="scenri"||ie.kind==="question"&&!ie.question.reopened),ie.kind==="you"?We.push(o.jsx(Gne,{text:ie.text,photos:ie.photos,editable:ie.editable,editing:ie.editing,arrive:De,leave:ze,delay:Ge,turnId:q,dim:oe,at:Re,now:Y,onEdit:ie.editable&&l?()=>l(ie.id):void 0,onSave:u?bt=>u(ie.id,bt):void 0,onCancel:f},q)):ie.kind==="scenri"?We.push(o.jsx(Fne,{text:ie.text,tone:ie.tone,reveal:De,leave:ze,eyebrow:!ft,delay:Ge,turnId:q,dim:oe,at:Re,now:Y,thumb:ie.thumb,label:ie.label,view:ie.view,current:ie.current,restore:ie.restore,onRestore:m,retry:ie.retry,onRetry:w,onShow:y},q)):We.push(o.jsx(Wne,{question:ie.question,reveal:De,leave:ze&&!Ye,spent:ze,delay:Ge,turnId:q,dim:oe,busy:t||oe,eyebrow:!ft,at:Re,now:Y,onAnswer:bt=>i(ie.question.id,bt),onPick:F,onStarter:h,onDescribe:p,onAttachFiles:g,onCancel:f},q))}return o.jsx("div",{ref:b,className:"sc-convo-log",role:"log","aria-live":"polite","aria-relevant":"additions","data-changing":ae?"true":void 0,children:o.jsxs("div",{className:"sc-convo-turns",children:[We,n&&o.jsx(_ne,{what:n===!0?void 0:n})]})})}function nS(e,t){const n=[],r=new Set(e.map(cr));let a=0;for(const i of t.from){const l=cr(i);if(t.gone.has(l)){r.has(l)||n.push(i);continue}for(;a<e.length&&cr(e[a])!==l;)n.push(e[a++]);a<e.length&&n.push(e[a++])}for(;a<e.length;)n.push(e[a++]);return n}function nre(e,t){for(const a of e.getAnimations())a.id==="slide"&&a.cancel();const n=`translateY(${t}px)`;e.style.transform=n;const r=e.animate([{transform:n},{transform:"translateY(0)"}],{duration:fP,easing:Xne,fill:"both"});r.id="slide",r.onfinish=()=>{e.style.transform="",r.cancel()}}function rre(e,t){if(!t)return!1;const n=U4(t),r=e.getBoundingClientRect(),a=n.getBoundingClientRect();return r.top>=a.top&&r.top<=a.bottom-24}function rS(e,t){var n;(n=e==null?void 0:e.scrollIntoView)==null||n.call(e,{block:"nearest",behavior:t?"auto":"smooth"})}function S0(e,t){if(!e)return null;for(const n of e.querySelectorAll(".sc-convo-turn"))if(n.dataset.turn===t)return n;return null}function sre(e){const t=[];for(const n of e){const r=cr(n);if(n.kind==="question"){const u=n.question,f="options"in u&&Array.isArray(u.options)?u.options.map(h=>h.id).join(","):"";t.push(`${r}~${u.reopened?1:0}~${u.prompt}~${u.hint??""}~${f}`);continue}const a="photos"in n&&Array.isArray(n.photos)?n.photos.length:0,i="thumb"in n?n.thumb??"":"",l="editing"in n&&n.editing?1:0;t.push(`${r}~${n.text??""}~${i}~${a}~${l}`)}return t.join("")}function sS(e){const t=new Set;for(const n of e)n.kind==="question"&&n.question.reopened&&t.add(cr(n));return t}function Oh(e){return e.startsWith("you:")?`q:${e.slice(4)}`:e.startsWith("q:")?`you:${e.slice(2)}`:""}function U4(e){let t=e;for(;t;){const{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return e}function are(e){for(let t=e;t;t=t.parentElement){const{overflowY:n}=getComputedStyle(t);if(n==="auto"||n==="scroll")return t}return null}const py=e=>`scenri:convo-said:${e}`;function dl(e){try{sessionStorage.removeItem(py(e)),sessionStorage.removeItem(my(e))}catch{}}const my=e=>`scenri:convo-at:${e}`;function ore(e){try{const t=sessionStorage.getItem(my(e));return t?new Map(Object.entries(JSON.parse(t))):null}catch{return null}}function ire(e,t){try{sessionStorage.setItem(my(e),JSON.stringify(Object.fromEntries(t)))}catch{}}function lre(e){try{const t=sessionStorage.getItem(py(e));return t?new Set(JSON.parse(t)):null}catch{return null}}function cre(e,t){try{sessionStorage.setItem(py(e),JSON.stringify([...t]))}catch{}}function X8(e){return`${["No","One","Two","Three","Four","Five"][e]??String(e)} picture${e===1?"":"s"}`}function Q8(e){const[t,...n]=e,r=[t,...n.map(a=>a.toLowerCase())];return r.length>1?`${r.slice(0,-1).join(", ")} and ${r[r.length-1]}`:r[0]??""}const ve={title:"Create scene",editTitle:"Edit scene",intent:"Create a scene",source:"Where are we shooting? Describe the place, or start from pictures of one.",addPictures:"Add pictures",guideMe:"Guide me",photos:"Add one to four pictures of the place. The more they share, the better it reads.",photosDrop:{label:"Add pictures of the place",hint:"Drop them here, or choose files"},fromShot:"Or start from one of your shots",fromShotAnswer:"Start from one of my shots",shot:"Which shot? I'll read the place in it and leave the product and people out.",shotSearch:"Find a shot",shotNone:"No shots to start from yet.",shotNotFound:e=>`No shot matches "${e}".`,shotsFailed:"The shots could not be read just now. Try the search again.",shotCount:(e,t)=>t?`${e} shots so far, more as you scroll`:`${e} ${e===1?"shot":"shots"}`,shotAnswer:"This shot",backToPictures:"Back to pictures",shotOff:"Choose a shot above.",madeIn:e=>`This shot was made in ${e}.`,takeScene:e=>`Use ${e}`,readNew:"Read a new scene from it",reuseOff:"Choose above.",anotherShot:"Choose another shot",stopped:"That was stopped. Nothing here was changed.",stoppedRead:"Stopped before the place was read. Read it again, or say it differently.",stoppedDraw:"Stopped. Nothing was drawn.",stoppedChange:"Stopped before the picture changed. The new words are kept: draw them, or put back the last picture.",readThem:"Read them",guideInstead:"Guide me instead",skip:"Skip",describeInstead:"Describe instead",worldHint:"Choose a starting world. You'll personalise it next.",worldLightPrompt:e=>`This world is already lit ${e}. Keep it, or choose another.`,keepWorldLight:"Keep it",keepWorldSurface:"Keep the world's own",suggestOne:"Suggest one",followWorld:"You have the feel of it. What kind of place is it?",followLight:"You have the place. What light is it in?",leaveToReading:"Leave it to the reading",worldIsAStart:"Treat this as a starting direction, not a picture to reproduce: keep the material language and the character of the light, and invent a specific original arrangement.",emptyLead:"The place appears here",emptyHint:"Describe it, or add pictures of it",sourcePlaceholder:"Describe the place, or choose above",nothingSaidPlaceholder:"Tell me where we are, in your own words",rowPlaceholder:e=>`Pick one above, or describe the ${e}`,photosOff:"Add the pictures above, then read them.",addPlaceholder:"Anything to add or leave out?",keepPlaceholder:"Anything to keep or ignore in them?",keepShotPlaceholder:"Anything to keep or ignore in it?",changePlaceholder:"Say what to change. The rest stays.",namePlaceholder:"Its name",nameIt:"Name this scene",attachLabel:"Add pictures of the place",send:"Send",lineLabel:"Your answer",change:"Change",reading:"Writing what your shots are told",readingPhotos:"Reading your pictures",changing:"Changing the words",drawing:"Drawing the scene",stillReading:"Still writing what your shots are told",readingHead:"What your shots are told",placeLabel:"The place",lightLabel:"Light",cameraLabel:"Camera",figureLabel:"Built around",agree:"Here is the place, in full. Ready to draw?",agreePhotos:"Here is the place I read in your pictures. Ready to draw?",agreeShot:"Here is the place I read in your shot. Ready to draw?",agreeChanged:"Here it is with that. Ready to draw?",drawsTwo:"It draws two pictures: the place, and the place in use.",agreeBlind:"Here is the place, in full. Nothing here can draw yet, so it is saved as words.",noReader:"Reading pictures needs Codex, which is not set up yet.",noReaderOff:"Set up Codex above to read them.",changePictures:"Change pictures",readAgain:"I read the place again.",draw:"Draw the scene",saveWords:"Save scene",here:"Here is the scene.",again:"Here it is again.",changed:"Here it is, changed.",decide:e=>`Here is ${e}. Use it, or change something.`,decideEdit:e=>`Here is ${e}. Save it, or change something.`,decideSaved:"Nothing has changed yet.",use:"Use this scene",saveChanges:"Save changes",tryAgain:"Try again",changeSomething:"Change something",name:"While it draws: what should we call it?",editOpen:e=>`Here is ${e}, as it is saved. Change something, or draw it again.`,failed:"That did not work. Nothing standing was touched.",failedFirst:e=>`That did not go through: ${e}. Nothing was drawn.`,failedSaid:e=>`${e} Nothing was drawn.`,failedKept:e=>`That did not go through: ${e}. The picture you had is kept.`,sayDifferently:"Say it differently",lost:"That work is gone: the server restarted while it ran. Try it again.",offline:"Lost touch with Scenri. Still trying.",stopLost:"Stop did not reach Scenri. Press it again.",busyElsewhere:"This scene is already being worked on in another window. Try again once that is done.",retry:"Try again",version:e=>`Version ${e}`,saved:"Saved.",savedQuiet:"Saved. Nothing is drawn until you ask.",usedOff:"The scene is saved. Choose above.",showInUse:(e,t)=>`Show it in use? ${X8(t.length)} with a Scenri demo ${e} in the place: ${Q8(t.map(n=>n.toLowerCase()))}.`,staleSet:e=>`${X8(e)} here show${e===1?"s":""} the place as it was before. Draw ${e===1?"it":"them"} again?`,moreViews:e=>`Add ${X8(e.length).toLowerCase()} of it in use? ${Q8(e)}.`,drawIt:"Draw it",drawThem:"Draw them",drawThemAgain:"Draw them again",inUse:e=>`Saved. Now it is shown in use, with a Scenri demo ${e}.`,noLibrary:"Saved. Scenri's library has not downloaded yet, so it cannot be shown in use for now.",exampleHere:{hero:"Here is the hero.",close:"Here is a close-up.",hands:"Here it is in hands.",angle:"Here is another angle.",bold:"Here is a bold one."},exampleFailed:(e,t)=>`The ${e.toLowerCase()} did not draw: ${t.replace(/[.\s]+$/,"")}.`,exampleFailedSaid:(e,t)=>`The ${e.toLowerCase()} did not draw. ${t}`,more:e=>`Add ${["no","one","two","three"][e.length]??e.length} more? ${Q8(e)}.`,addThem:"Add them",notNow:"Not now",ready:e=>`${e} is ready.`,readyUndrawn:e=>`${e} is ready. It can be shown in use any time, from its page.`,readyMissing:e=>`${e} is ready. Some did not draw.`,openScene:"Open scene",useInAShot:"Use in a shot",notAPlace:"That did not read as a place. Try a few words about it, like 'a quiet concrete gallery at dusk'.",greet:"Hello. Describe the place, or choose above.",greetRow:"Pick one above, or say it in a few words.",askHelp:"Describe the place in a few words, or tap one above. Everything can be changed later.",goFirst:"Choose above, or describe the place first.",startOverIsUp:"Start over is at the top of this panel.",notInAScene:"A scene holds the place and its light. Add presenters and products in Create.",usePutBack:"Step back through the versions on the picture, and Put back the one you want.",sayAChange:"Say what to change about the place, and the rest stays as it is.",renamed:e=>`Called it ${e}.`,changeIt:"Change it",changeTitle:"Change this answer?",changeBody:"The picture was drawn from the answers as they are. Changing one asks again from there, and the pictures so far go. To keep the picture and change one thing, say it in the line instead.",onlyPictures:"Only pictures can show a place.",fourPictures:"Four pictures is the most a scene is read from.",heicNotYet:"HEIC pictures cannot be read yet. Export them as JPEG, then add them.",leaveTitle:"Leave this scene?",leaveBody:"Nothing has been read yet, so the answers here go.",leave:"Leave",discardTitle:"Discard the changes?",discardBody:"The scene stays as it was saved. What was drawn here is let go.",discard:"Discard changes",startOver:"Start over",startOverTitle:"Start over?",startOverBody:"This conversation begins again from the first question. Nothing here is saved yet."},ure="part of the place itself, never a separate object that competes with the subject, and leaving the subject a clear place to stand",hP={water:{surface:[{key:"basalt",label:"Wet basalt",words:"a ledge of wet black basalt, glossy where the sea has just left it"},{key:"sand",label:"White sand",words:"rippled white sand under a few centimetres of clear water"},{key:"pebbles",label:"Sea pebbles",words:"a bed of smooth sea-worn pebbles, wet and gleaming"},{key:"awash",label:"Rock awash",words:"a flat rock just awash, a thin sheet of clear water sliding over it"}],light:[{key:"caustics",label:"Water caustics",words:"a live net of water caustics sliding across every surface"},{key:"sunset",label:"Low sun on water",words:"low sun skimming the water, long glittering reflections"},{key:"silver",label:"Silver overcast",words:"soft silver overcast light, the sea flat and pale"},{key:"backlit",label:"Backlit spray",words:"the sun behind the surf, the spray lit up like glass"}],signature:[{key:"wave",label:"Frozen wave",words:"a wave frozen mid-break behind the rock, its crest in glassy detail"},{key:"foam",label:"Foam lace",words:"a lace of sea foam drawn across the wet rock"},{key:"kelp",label:"Kelp ribbons",words:"glossy olive-gold ribbons of kelp draped over the rocks"},{key:"pool",label:"Mirror pool",words:"a still rock pool mirroring the sky"}]},stone:{surface:[{key:"travertine",label:"Travertine",words:"honed cream travertine up close, its pores and soft veins readable"},{key:"limestone",label:"Rough limestone",words:"a rough-cut block of warm limestone, chisel marks in its face"},{key:"terracotta",label:"Terracotta tile",words:"sun-baked terracotta floor tiles, worn at the edges"},{key:"marble",label:"Weathered marble",words:"weathered pale marble, its polish worn soft by years of sun"}],light:[{key:"shadow",label:"One long shadow",words:"one high hard light throwing a single long, precise shadow across the stone"},{key:"olive",label:"Olive-leaf dapple",words:"sun broken into moving dapples through olive leaves"},{key:"golden",label:"Low golden sun",words:"low golden sun raking almost flat across the stone, long warm shadows"},{key:"shade",label:"Cool shade",words:"the niche in open shade, cool bounced light and a bright sunlit world beyond"}],signature:[{key:"vines",label:"Vines taking over",words:"a vine growing down the stone, claiming its edges"},{key:"basin",label:"Water in the stone",words:"water trickling into a basin carved in the stone, glinting"},{key:"dust",label:"Dust in the sun",words:"fine dust hanging in one bright shaft of sun"},{key:"sphere",label:"A giant stone sphere",words:"one oversized stone sphere resting in the space, impossible in scale"}]},colour:{surface:[{key:"lacquer",label:"Glossy lacquer",words:"a glossy lacquered floor the same colour as the sweep, mirroring it"},{key:"paper",label:"Matte paper",words:"matte coloured paper, its fibres and one soft crease readable"},{key:"acrylic",label:"Frosted acrylic",words:"a sheet of frosted acrylic glowing softly with the colour behind it"},{key:"velvet",label:"Flocked velvet",words:"flocked velvet in the same colour, soaking up the light"}],light:[{key:"gobo",label:"Cut spotlight",words:"a hard spotlight cut into one graphic shape across the colour"},{key:"split",label:"Two-colour gels",words:"two coloured gels splitting the light, one warm and one cool edge"},{key:"wrap",label:"Soft studio wrap",words:"soft wrapping studio light, a gentle gradient across the sweep"},{key:"rim",label:"Neon rim",words:"one neon rim tracing the edges, the rest of the colour dimmed"}],signature:[{key:"shapes",label:"Floating shapes",words:"a few simple geometric shapes floating in the colour, frozen in place"},{key:"planes",label:"Cut-paper planes",words:"sharp-angled planes of cut paper converging in the colour"},{key:"block",label:"Colour-block shadow",words:"a hard shadow cut into a block of a second colour"},{key:"giant",label:"Surreal scale",words:"one oversized sphere or arch in the colour, impossible in scale"}]},citrus:{surface:[{key:"halves",label:"Cut citrus",words:"a bed of halved citrus, the flesh glistening with juice"},{key:"tile",label:"Glazed tile",words:"sun-bleached glazed tiles in white and cobalt"},{key:"ice",label:"Crushed ice",words:"crushed ice melting over the fruit"},{key:"cloth",label:"Crisp linen",words:"a crisp white linen cloth spread under the fruit"}],light:[{key:"glow",label:"Sun through fruit",words:"the sun behind the fruit, the flesh glowing like stained glass"},{key:"leaves",label:"Leaf shade",words:"sun broken into dapples through citrus leaves"},{key:"golden",label:"Late golden sun",words:"late golden sun, the sky deepening, long warm shadows"},{key:"flash",label:"Hard flash",words:"hard direct flash against the blue sky, crisp and saturated"}],signature:[{key:"blossom",label:"Blossom and leaves",words:"citrus blossom and glossy leaves threaded through the fruit"},{key:"melting",label:"Ice melting",words:"ice melting over the fruit, beads of water running down"},{key:"peel",label:"Peel spirals",words:"long spirals of peel curling across the mound"},{key:"giant",label:"Giant fruit",words:"one citrus fruit at an impossible, monumental scale on the horizon"}]},volcanic:{surface:[{key:"crust",label:"Lava crust",words:"a crust of cooled black lava, ropey and cracked"},{key:"sand",label:"Black sand",words:"fine black volcanic sand, wind-rippled"},{key:"pumice",label:"Pumice",words:"porous grey pumice, sharp and light"},{key:"obsidian",label:"Obsidian",words:"a slab of glassy black obsidian with conchoidal edges"}],light:[{key:"fissures",label:"Glow from below",words:"incandescent orange fissures lighting the rock from below"},{key:"raking",label:"Sun through haze",words:"a hard low sun raking through the orange haze"},{key:"ember",label:"Ember glow",words:"a deep ember glow, everything else falling into dark"},{key:"moon",label:"Blue moonlight",words:"cold blue moonlight on the black rock, the haze gone silver"}],signature:[{key:"lava",label:"Lava still moving",words:"lava still glowing in the cracks of the crust, cooling as it goes"},{key:"ash",label:"Ash in the air",words:"fine ash drifting through the haze"},{key:"steam",label:"Steam vents",words:"white steam rising from vents in the rock"},{key:"floating",label:"Floating rocks",words:"a few rocks hanging weightless in the haze, impossible and still"}]},dark:{surface:[{key:"mirror",label:"Black mirror",words:"black mirror glass, every reflection crisp"},{key:"steel",label:"Brushed steel",words:"brushed stainless steel with a fine directional grain"},{key:"marble",label:"Black marble",words:"polished black marble with thin white veins"},{key:"water",label:"Black water",words:"still black water, one faint ripple"}],light:[{key:"gobo",label:"Cut spotlight",words:"a hard spotlight cut into one graphic shape across the dark"},{key:"pool",label:"Pool of light",words:"one pool of light from above, the rest falling to true black"},{key:"neon",label:"Neon edge",words:"one line of coloured neon reflected in the black surface"},{key:"rim",label:"Thin rim",words:"a thin bright rim of light along every edge, nothing else lit"}],signature:[{key:"wax",label:"Wax cascading",words:"dark wax cascading down a wall into the mirror, glossy and still setting"},{key:"ripples",label:"Ripples",words:"slow concentric ripples crossing the black surface"},{key:"smoke",label:"Smoke curl",words:"one curl of smoke drifting through the light"},{key:"sphere",label:"Floating sphere",words:"a perfect sphere floating above the mirror, impossible and still"}]},plaster:{surface:[{key:"limewash",label:"Limewash floor",words:"a limewashed plaster floor, soft and chalky"},{key:"oak",label:"Pale oak",words:"pale oak boards, their grain soft in the light"},{key:"terrazzo",label:"Terrazzo",words:"pale terrazzo with small flecks of stone"},{key:"silk",label:"Silk drape",words:"a length of silk pooling on the floor in soft folds"}],light:[{key:"shadow",label:"Window shadow",words:"hard sun through the tall window, its shape laid long across the room"},{key:"leaves",label:"Leaf shadows",words:"soft moving leaf shadows thrown across the plaster"},{key:"golden",label:"Low golden sun",words:"low golden sun raking across the plaster, long warm shadows"},{key:"dusk",label:"Blue dusk",words:"cool blue dusk in the window, the room dim and quiet"}],signature:[{key:"curtain",label:"Curtain in the wind",words:"a sheer curtain lifted into the room by the wind"},{key:"plants",label:"Plants growing in",words:"green plants growing up the plaster walls, claiming the corners"},{key:"arch",label:"Arch shadow",words:"the hard shadow of an arch cut across the wall"},{key:"stair",label:"Surreal stair",words:"a plaster stair rising into the wall and going nowhere"}]},linen:{surface:[{key:"linen",label:"Raw linen",words:"raw undyed linen, its slub weave readable"},{key:"satin",label:"Silk satin",words:"heavy silk satin in deep folds, its sheen catching the light"},{key:"boucle",label:"Wool bouclé",words:"nubbly wool bouclé, soft and textured"},{key:"paper",label:"Crumpled paper",words:"large sheets of crumpled paper folded like cloth"}],light:[{key:"leaves",label:"Leaf dapple",words:"sun broken into soft dapples through leaves"},{key:"slice",label:"Slice of sun",words:"one hard slice of sun across the folds"},{key:"golden",label:"Low golden sun",words:"low golden sun raking across the folds, deep warm shadows"},{key:"through",label:"Light through cloth",words:"light glowing through the cloth from behind"}],signature:[{key:"wind",label:"Lifted by wind",words:"the cloth lifted by a gust and frozen mid-billow"},{key:"dried",label:"Dried flowers",words:"a few dried flowers and grasses caught in the folds"},{key:"thread",label:"One red thread",words:"a single red thread running through the folds"},{key:"landscape",label:"Folds as dunes",words:"the folds made vast, like a landscape of dunes"}]}};function gy(e,t){const n=e?hP[e]:void 0;return n?n[t].map((r,a)=>({id:`${e}-${r.key}`,label:r.label,words:r.words,card:`scene-${e}-${t}-${a+1}`})):null}function dre(e){return Object.keys(hP).flatMap(t=>gy(t,e)??[])}const fre=["water","stone","colour","citrus","volcanic","dark","plaster","linen"],c1=["world","surface","light","signature"],va=(e,t)=>`scene-${e}-${t}`,Sl={world:{prompt:"What world?",options:[{id:"water",label:"Rock and water",words:"a shoreline of wet dark rock and shallow turquoise water",light:"in hard midday sun",card:va("world",1),cues:["water","sea","ocean","shore","shoreline","beach","wet","pool","underwater"]},{id:"stone",label:"Sunlit stone",words:"a niche of warm limestone and rough plaster",light:"in hard afternoon sun",card:va("world",2),cues:["stone","limestone","wall","niche","arch","terracotta","mediterranean","sunlit"]},{id:"colour",label:"Colour field",words:"a seamless studio sweep in one saturated colour",light:"in flat hard poster light",card:va("world",3),cues:["studio","sweep","seamless","backdrop","colour","color","paper","poster","graphic","flat"]},{id:"citrus",label:"Fruit and sky",words:"a mound of cut citrus under an open blue sky",light:"in bright direct sun",card:va("world",4),cues:["fruit","citrus","orange","lemon","sky","outdoors","outdoor","summer","juice"]},{id:"volcanic",label:"Volcanic haze",words:"dark volcanic rock in a deep orange haze",light:"with one hard low light raking across it",card:va("world",5),cues:["volcanic","lava","rock","ash","dust","haze","smoke","desert","mars"]},{id:"dark",label:"Dark mirror",words:"a near-black polished surface like a still pool",light:"in low-key light, with one bright edge",card:va("world",6),cues:["mirror","reflection","polished","still pool"]},{id:"plaster",label:"Soft plaster",words:"a bare plaster room with one tall soft window",light:"in soft overcast daylight",card:va("world",7),cues:["plaster","concrete","microcement","minimal","interior","room","window","raw","architectural","overcast"]},{id:"linen",label:"Linen fold",words:"a length of raw undyed linen folded in soft loose drapes",light:"in soft window light",card:va("world",8),cues:["linen","fabric","textile","cloth","drape","fold","woven","cotton","soft fabric"]}]},surface:{prompt:"What is it made of, up close?",options:[{id:"travertine",label:"Travertine",words:"honed cream travertine up close, its pores and soft veins readable",cues:["travertine"]},{id:"steel",label:"Brushed steel",words:"brushed stainless steel with a fine directional grain",cues:["steel","stainless","brushed metal","aluminium","aluminum"]},{id:"clay",label:"Cracked clay",words:"sun-dried terracotta clay cracked into deep fissures",cues:["clay","terracotta","cracked earth"]},{id:"silk",label:"Silk folds",words:"heavy silk gathered into deep sculptural folds",cues:["silk","satin"]},{id:"sand",label:"Wet sand",words:"rippled wet sand, glossy where the water has just drawn back",cues:["sand","wet sand"]},{id:"moss",label:"Moss and roots",words:"damp moss over exposed roots, dense and living",cues:["moss","mossy","roots"]},{id:"ice",label:"Ice",words:"clear ice with trapped bubbles and a cold blue depth",cues:["ice","icy","glacial"]},{id:"concrete",label:"Raw concrete",words:"raw board-formed concrete with timber grain printed into it",cues:["board-formed","cement"]}]},light:{prompt:"What does the light do?",options:[{id:"shadow",label:"One long shadow",words:"one high hard light throwing a single long, precise shadow across the place",cues:["long shadow","skylight","shaft of light","single shadow"]},{id:"dapple",label:"Dappled leaves",words:"sun broken into soft moving dapples through leaves",cues:["dappled","dapple","through leaves","leaf shadows","canopy"]},{id:"caustics",label:"Water caustics",words:"a live net of water caustics sliding across every surface",cues:["caustics","caustic","rippling light","underwater light"]},{id:"gobo",label:"Cut spotlight",words:"a hard spotlight cut into one graphic shape across the set",cues:["gobo","spotlight","cut light","shaped light"]},{id:"window",label:"Soft window",words:"soft daylight from one large window, falling open and shadowless on the far side",card:va("light",7),cues:["window light","side light","from a window","sidelit","window","soft","daylight","overcast","diffused"]},{id:"golden",label:"Low golden sun",words:"low golden sun raking almost flat across it, long warm shadows",card:va("light",2),cues:["golden","golden hour","sunset","sunrise","dusk","warm"]},{id:"neon",label:"Neon glow",words:"coloured neon streaking its light across glossy surfaces at night",card:va("light",4),cues:["neon","night","nocturnal","after dark"]},{id:"lowkey",label:"Pool of light",words:"one pool of light with a bright edge, the rest falling to true black",card:va("light",6),cues:["low key","lowkey","dramatic","shadowy","chiaroscuro","rim light"]}]},signature:{prompt:"What makes it unforgettable?",options:[{id:"air",label:"Mist, snow or wind",words:"the air of the place alive, such as mist lying low, snow drifting down or wind moving through fabric or grass: one, chosen for this place",cues:["mist","misty","fog","foggy","snow","snowing","wind","windswept","haze"]},{id:"change",label:"Caught mid-change",words:"the place's own material caught mid-change, such as wax cascading down a wall, sugar pulled glassy across the surface or ice melting at its edge: one, chosen for this place",cues:["melting","molten","dripping","wax","resin","mid-change"]},{id:"graphic",label:"Graphic light and shadow",words:"one bold graphic device of light and shadow shaping the set, such as a cut shadow or a hard slice of colour",cues:["graphic","geometric","cut shadow","colour block","color block"]},{id:"nature",label:"Nature taking over",words:"nature growing through the set, such as moss, blooms or roots claiming its edges: one, chosen for this place",cues:["overgrown","blooms","flowers","vines","growing"]},{id:"water",label:"Glass and water",words:"water and reflection in the place, such as a still reflecting pool or rain-beaded glass: one, chosen for this place",cues:["reflection","reflecting","rain","puddle","rain glass"]},{id:"scale",label:"Surreal scale",words:"one surreal touch of scale, an oversized natural or architectural form that makes the place feel impossible",cues:["surreal","giant","oversized","impossible","dreamlike"]}]}},hre=new Set([...Sl.world.options.map(e=>e.card),...Sl.light.options.filter(e=>e.card).map(e=>e.card),...fre.flatMap(e=>["surface","light","signature"].flatMap(t=>(gy(e,t)??[]).map(n=>n.card)))]);function pre(e,t){return e==="world"?Sl.world.options:gy(t,e)??Sl[e].options}function mre(e,t){const n=pre(e,t),r=n.every(a=>!!a.card&&hre.has(a.card));return{id:e,label:Sl[e].prompt,options:n.map(a=>({id:a.id,label:a.label,...r?{card:a.card}:{}}))}}const gre={world:"place",surface:"surface",light:"light",signature:"idea"},aS=e=>gre[e],Po=(e,t)=>{if(!t)return;const n=Sl[e].options.find(r=>r.id===t);return n||e==="world"?n:dre(e).find(r=>r.id===t)},vre="one signature idea that makes this place unforgettable, invented for it and never generic";function wre(e){const t=` ${e.toLowerCase().replace(/[^a-z0-9]+/g," ")} `,n={};for(const r of c1){let a=null;for(const i of Sl[r].options)for(const l of i.cues??[]){const u=` ${l.replace(/[^a-z0-9]+/g," ")} `;t.includes(u)&&(!a||l.length>a.len)&&(a={id:i.id,len:l.length})}a&&(n[r]=a.id)}return n}const kd=4e3,pP=8e3,yre=["studio","cyclorama","cyc","seamless","sweep","backdrop","set","room","interior","exterior","beach","shore","shoreline","coast","sea","ocean","lake","river","water","pool","forest","woods","woodland","jungle","garden","park","field","meadow","desert","dune","dunes","mountain","mountains","cliff","cave","canyon","street","city","urban","rooftop","loft","warehouse","gallery","museum","hotel","lobby","kitchen","bathroom","bedroom","living room","cafe","café","bar","restaurant","shop","store","boutique","market","library","courtyard","terrace","balcony","corridor","hallway","tunnel","bridge","station","greenhouse","spa","chapel","ruin","ruins","architecture","landscape","outdoors","indoors","sky"],W4=["stone","rock","rocks","marble","travertine","limestone","granite","basalt","concrete","plaster","terrazzo","tile","tiles","wood","wooden","oak","walnut","linen","fabric","velvet","silk","satin","glass","metal","steel","chrome","brass","mirror","sand","moss","ferns","foliage","flowers","paper","colour field","color field","colour block","color block","pastel","brutalist","minimal","wall","walls","clay","terracotta","ice","aluminium","aluminum","stainless","leather","felt","slate","onyx","salt"],mP=["splash","splashing","mid air","frozen","falling","petals","confetti","smoke","mist","fog","steam","dust","drifting","bubbles","melting","molten","dripping","wax","resin","pouring","overgrown","blooms","flowers","vines","reflection","reflections","reflecting","rain","puddle","ripples","surreal","giant","oversized","levitating","impossible","dreamlike","cut shadow","gobo"],gP=["light","lit","lighting","flash","strobe","strobes","sun","sunny","sunlight","sunlit","sunshine","daylight","golden hour","sunset","sunrise","dusk","dawn","twilight","blue hour","night","neon","moonlight","moonlit","candle","candlelight","candlelit","lamp","lamplight","spotlight","spotlit","softbox","overcast","shadow","shadows","shadowless","backlit","backlight","rim light","glow","glowing","noon","midday","low key","high key","chiaroscuro","hard sun","window light"],vP=["plinth","pedestal","podium","platform","block","cube","table","tabletop","counter","countertop","shelf","ledge","tray","on the floor","on the ground","in hand","in hands","hand","hands","held","holding","resting","rests","floating","floats","suspended","hanging","leaning","propped","nestled","nested","half buried","emerging","balanced","stacked","scattered"],wP=["top down","overhead","flat lay","flatlay","birds eye","bird s eye","aerial","from above","from below","low angle","high angle","eye level","worms eye","close up","closeup","macro","wide angle","wide shot","wide","telephoto","35mm","50mm","85mm","lens","shot from","framed","framing","straight on","profile"],yP={world:[...yre,...W4],surface:W4,light:gP,signature:mP,stage:vP,camera:wP},bre=e=>` ${e.toLowerCase().replace(/[^a-z0-9é]+/g," ").trim()} `,xre=(e,t)=>e.includes(` ${t.replace(/[^a-z0-9é]+/g," ")} `);function bP(e){const t=bre(e),n=r=>r.some(a=>xre(t,a));return{world:n(yP.world),surface:n(W4),light:n(gP),signature:n(mP),stage:n(vP),camera:n(wP)}}const kre=e=>Object.keys(yP).filter(t=>e[t]);function Sre(e){const t=["world","surface","light"].filter(r=>!e[r]),n=kre(e).length>=3?t.filter(r=>r==="world"):t.slice(0,2);return e.signature?n:[...n,"signature"]}const mi="__passed",O0=e=>{var t;return(t=e.source)==null?void 0:t.door},Ere=e=>{var t;return O0(e)==="words"?Sre(bP(((t=e.source)==null?void 0:t.text)??"")):[]},l2=[{id:"source",applies:()=>!0},{id:"photos",applies:e=>O0(e)==="photos"},{id:"shot",applies:e=>O0(e)==="shot"},{id:"reuse",applies:e=>{var t;return O0(e)==="shot"&&!!((t=e.shot)!=null&&t.scene)}},...c1.map(e=>({id:e,applies:t=>O0(t)==="guided"||Ere(t).includes(e)}))],lp=l2.map(e=>e.id),zp=e=>c1.includes(e),oS=e=>lp.includes(e),Cre=e=>{var t;return!!e&&(!!e.pick||!!((t=e.words)!=null&&t.trim()))};function vy(e,t){var n;return e==="source"?!!t.source:e==="photos"?!!((n=t.photos)!=null&&n.done)&&t.photos.hashes.length>0:e==="shot"?!!t.shot:e==="reuse"?t.reuse==="read":Cre(t[e])}const jre=e=>l2.filter(t=>t.applies(e)&&vy(t.id,e)).map(t=>t.id);function xP(e){var t;return((t=l2.find(n=>n.applies(e)&&!vy(n.id,e)))==null?void 0:t.id)??null}const kP=e=>{var t,n,r,a,i;return((t=e.source)==null?void 0:t.door)==="words"?!!((n=e.source.text)!=null&&n.trim()):((r=e.source)==null?void 0:r.door)==="photos"?(((a=e.photos)==null?void 0:a.hashes.length)??0)>0:((i=e.source)==null?void 0:i.door)==="shot"?!!e.shot:c1.some(l=>rl(l,e[l])!==null)},iS=e=>!!e.source&&xP(e)===null&&kP(e),K4=(e,t)=>JSON.stringify(e)!==JSON.stringify(t);function wy(e,t){const n={...e},r=[];for(const[a,i]of Object.entries(t))K4(e[a],i)&&(i===void 0?delete n[a]:n[a]=i,r.push(a));if(r.length){const a=Math.min(...r.map(i=>lp.indexOf(i)));for(const i of lp)lp.indexOf(i)<=a||i in t||delete n[i]}for(const a of l2)n[a.id]!==void 0&&!a.applies(n)&&delete n[a.id];return n}function Are(e,t,n){var r,a;if(e==="source")return t.kind!=="choice"?null:t.id==="photos"?{source:{door:"photos"},photos:{hashes:((r=n.photos)==null?void 0:r.hashes)??[],done:!1}}:t.id==="guided"?{source:{door:"guided"}}:null;if(e==="reuse")return t.kind==="choice"&&t.id==="read"?{reuse:"read"}:null;if(zp(e)){const i=(a=n[e])==null?void 0:a.words,l=t.kind==="swatches"?t.picks[e]??Object.values(t.picks)[0]:t.kind==="choice"?t.id:void 0;if(l)return{[e]:{pick:l,...i?{words:i}:{}}};if(t.kind==="skip")return{[e]:{pick:mi,...i?{words:i}:{}}}}return null}function lS(e){var t;return(e==null?void 0:e.pick)===mi?[vre,(t=e.words)==null?void 0:t.trim()].filter(Boolean).join(", "):rl("signature",e)}function rl(e,t){var a,i;if(!t)return null;const n=t.pick&&t.pick!==mi?(a=Po(e,t.pick))==null?void 0:a.words:void 0,r=(i=t.words)==null?void 0:i.trim();return n&&r?`${n}, ${r}`:n??r??null}const cS=e=>e?`, ${ure}`:"";function Nre(e){var l,u,f,h,p,g,m;if(((l=e.source)==null?void 0:l.door)==="words"){const w=(e.source.text??"").trim(),y=rl("world",e.world),b=rl("light",e.light)??(bP(w).light?null:((f=Po("world",(u=e.world)==null?void 0:u.pick))==null?void 0:f.light)??null),k=lS(e.signature),S=[y,rl("surface",e.surface),b,k].filter(Boolean);return S.length?`${w.replace(/[.\s]+$/,"")}, ${S.join(", ")}${cS(k)}.`:w}if(((h=e.source)==null?void 0:h.door)!=="guided")return"";const t=rl("world",e.world),n=rl("light",e.light)??((g=Po("world",(p=e.world)==null?void 0:p.pick))==null?void 0:g.light)??null,r=lS(e.signature),i=`${[t??"a place",rl("surface",e.surface),n,r].filter(Boolean).join(", ").replace(/^./,w=>w.toUpperCase())}${cS(r)}.`;return(m=e.world)!=null&&m.pick?`${i.slice(0,-1)}. ${ve.worldIsAStart}`:i}function Mre(e){var t,n,r;return((t=e.source)==null?void 0:t.door)==="shot"?e.shot?[e.shot.hash]:[]:((n=e.source)==null?void 0:n.door)==="photos"&&((r=e.photos)!=null&&r.done)?e.photos.hashes:[]}const uS=e=>/^image\/hei[cf]/i.test(e.type)||/\.hei[cf]$/i.test(e.name),Rre={answers:{},revision:0,editing:null,held:null,asides:[]};function SP(e,t){var n,r;switch(t.type){case"answer":{const a=wy(e.answers,t.patch);return K4(a,e.answers)?{...e,answers:a,revision:e.revision+1,editing:null,held:null}:{...e,editing:null,held:null}}case"photos":{if(((n=e.answers.source)==null?void 0:n.door)!=="photos")return e;const a=[...new Set(t.hashes)].slice(0,4),i=e.editing==="photos";return{...e,answers:{...e.answers,photos:{hashes:a,done:i}},revision:e.revision+1}}case"photo":return SP(e,{type:"photos",hashes:[...((r=e.answers.photos)==null?void 0:r.hashes)??[],t.hash]});case"edit":return vy(t.id,e.answers)?{...e,editing:t.id,held:e.answers}:e;case"cancel-edit":return!e.held||!K4(e.held,e.answers)?{...e,editing:null,held:null}:{...e,answers:e.held,revision:e.revision+1,editing:null,held:null};case"aside":return{...e,asides:[...e.asides,t.aside].slice(-40)}}}const Pre=e=>({answers:e.held??e.answers,revision:e.revision,asides:e.asides}),Lre=/^[a-f0-9]{32}$/,dS=/^[\w.:-]{1,80}$/;function $re(e){const t=e;if(!t||typeof t!="object"||typeof t.answers!="object"||!t.answers)return null;const n={},r=t.answers.source;r&&["photos","shot","guided","words"].includes(r.door)&&(n.source={door:r.door,...typeof r.text=="string"?{text:r.text.slice(0,kd)}:{}});const a=t.answers.photos;a&&Array.isArray(a.hashes)&&(n.photos={hashes:a.hashes.filter(u=>typeof u=="string").slice(0,4),done:!!a.done});const i=t.answers.shot;if(i&&typeof i.id=="string"&&dS.test(i.id)&&typeof i.hash=="string"&&Lre.test(i.hash)){const u=i.scene,f=u&&typeof u.id=="string"&&dS.test(u.id)&&typeof u.name=="string"?{id:u.id,name:u.name.slice(0,120)}:void 0;n.shot={id:i.id,hash:i.hash,...f?{scene:f}:{}}}t.answers.reuse==="read"&&(n.reuse="read");for(const u of c1){const f=t.answers[u];if(!f||typeof f!="object")continue;const h=typeof f.pick=="string"&&(f.pick===mi||Po(u,f.pick))?f.pick:void 0,p=typeof f.words=="string"?f.words.slice(0,kd):void 0;(h||p)&&(n[u]={...h?{pick:h}:{},...p?{words:p}:{}})}const l=Array.isArray(t.asides)?t.asides.filter(u=>u&&typeof u.said=="string"&&typeof u.reply=="string"&&typeof u.at=="string").map(u=>({said:u.said,reply:u.reply,at:u.at,q:typeof u.q=="string"?u.q:null})):[];return{answers:wy({},n),revision:Number(t.revision)||0,editing:null,held:null,asides:l}}const Bp=4,EP=pP,yy=60,CP={place:"",pictures:[],heldPictures:[],inputsRev:0,readRev:null,readTried:null,versions:[],current:-1,name:"",named:!1,job:null,error:null,saved:null,moreDeclined:!1,moreAsked:!1,setDrawn:!1,setDeclined:!1};function Tre(e){return{...CP,place:e.place,pictures:e.pictures.slice(0,Bp),heldPictures:e.pictures.slice(Bp),readRev:0,versions:[{reading:e.reading,hash:e.hash,...e.anchor?{anchor:!0}:{},...e.hash&&e.hero?{hero:e.hero,...e.heroWith?{heroWith:e.heroWith}:{}}:{},coverage:[],how:"read"}],current:0,name:e.name,named:!0}}const $r=e=>e.versions[e.current]??null,fS=e=>e.versions.some(t=>!!t.hash);function Dre(e,t){return!t||e.job||e.inputsRev===0||e.readRev!==null&&e.readRev===e.inputsRev||e.readTried===e.inputsRev?null:e.inputsRev}const jP=e=>e.readRev!==null&&e.readRev!==e.inputsRev;function Hre(e,t){var n,r,a;switch(t.type){case"inputs":{const i=t.place.slice(0,EP),l=[...new Set(t.pictures)].slice(0,Bp);return i===e.place&&l.join()===e.pictures.join()?e:{...e,place:i,pictures:l,inputsRev:e.inputsRev+1}}case"name":return{...e,name:t.text.slice(0,yy),named:!0};case"started":return e.job?e:{...e,job:{id:t.id,kind:t.kind,ask:t.ask,inputsRev:e.inputsRev,pending:null,coverage:[],phase:t.kind==="again"?"drawing":t.kind==="change"?"changing":"reading",since:t.since},readTried:t.kind==="make"?e.inputsRev:e.readTried,error:null};case"stopping":return!e.job||e.job.id!==t.id||e.job.stopping?e:{...e,job:{...e.job,stopping:!0}};case"stop-failed":{if(!e.job||e.job.id!==t.id||!e.job.stopping)return e;const{stopping:i,...l}=e.job;return{...e,job:l}}case"progress":{if(!e.job||e.job.id!==t.job.id)return e;const i={...e.job,pending:t.job.reading??e.job.pending,coverage:t.job.coverage??e.job.coverage,phase:t.job.phase,since:t.job.phaseAt??e.job.since};return i.phase===e.job.phase&&i.since===e.job.since&&i.coverage.join(`
104
+ `)===e.job.coverage.join(`
105
+ `)&&JSON.stringify(i.pending)===JSON.stringify(e.job.pending)?e:hS({...e,job:i},i.pending)}case"finished":{if(!e.job||e.job.id!==t.job.id)return e;const i=e.job,l=t.job,u={...e,job:null};if(i.kind==="make"&&i.inputsRev!==e.inputsRev)return u;const f=l.reading??(i.kind==="again"?((n=$r(e))==null?void 0:n.reading)??null:null),h=l.status==="failed"?l.error??ve.failed:null;if(l.status==="cancelled"){if(!f)return{...u,error:i.kind==="make"?ve.stoppedRead:ve.stopped};if(i.kind==="again"&&!l.hash)return{...u,error:ve.stoppedDraw}}const p=l.status==="cancelled"&&i.kind==="change"&&!l.hash;if(!f||i.kind==="again"&&!l.hash)return{...u,error:h};const g=i.kind==="make"?"read":i.kind==="change"?"change":e.versions.some(S=>S.hash)?"again":"draw",m={reading:f,hash:l.hash,...l.hash&&l.anchor?{anchor:!0}:{},...l.hash&&l.hero?{hero:l.hero,...l.heroWith?{heroWith:l.heroWith}:{}}:{},ask:i.kind==="change"?i.ask:void 0,coverage:(r=l.coverage)!=null&&r.length?l.coverage:i.kind==="again"?((a=$r(e))==null?void 0:a.coverage)??[]:[],how:g},w=$r(e),y=i.kind==="make"&&!l.hash&&w&&!w.hash&&w.how==="read",b=y?e.versions.map((S,E)=>E===e.current?m:S):[...e.versions,m],k={...u,versions:b,current:y?e.current:b.length-1,readRev:i.kind==="make"?i.inputsRev:e.readRev,error:p?ve.stoppedChange:h};return hS(k,f)}case"lost":return!e.job||e.job.id!==t.id?e:{...e,job:null,error:t.error};case"put-back":return e.job||!e.versions[t.index]?e:{...e,current:t.index};case"forget-record":return e.job||!e.versions.length?e:{...e,versions:[],current:-1,error:null};case"edit-words":{const i=$r(e);if(e.job||!i||!t.reading.prompt.trim()||JSON.stringify(t.reading)===JSON.stringify(i.reading))return e;const l=[...e.versions,{reading:t.reading,hash:i.hash,...i.anchor?{anchor:!0}:{},...i.hero?{hero:i.hero,...i.heroWith?{heroWith:i.heroWith}:{}}:{},coverage:i.coverage,how:"edit"}];return{...e,versions:l,current:l.length-1}}case"error":return{...e,error:t.text};case"saved":return{...e,saved:t.id,error:null};case"decline-more":return{...e,moreDeclined:!0};case"ask-more":return{...e,moreAsked:!0};case"set-drawn":return{...e,setDrawn:!0,setDeclined:!1};case"set-declined":return{...e,setDeclined:!0};case"set-failed":return t.more?{...e,moreAsked:!1}:{...e,setDrawn:!1}}}function hS(e,t){return e.named||!(t!=null&&t.name)?e:{...e,name:t.name.slice(0,yy)}}function Ore(e){var n;const t=e.job?e.job.phase==="drawing"?e.job.pending:null:((n=$r(e))==null?void 0:n.reading)??null;return t?!e.job&&jP(e)?{can:!1,why:ve.stillReading,words:t}:e.name.trim()?{can:!0,why:null,words:t}:{can:!1,why:ve.nameIt,words:t}:{can:!1,why:e.job?ve.stillReading:null,words:null}}const J8=e=>e.job?e.job.phase==="changing"?ve.changing:e.job.phase==="drawing"?ve.drawing:e.pictures.length?ve.readingPhotos:ve.reading:void 0;function Ire(e){var r;const t=new Map;e.versions.forEach((a,i)=>{a.hash&&t.set(a.hash,i)});const n=((r=$r(e))==null?void 0:r.hash)??null;return[...t.entries()].sort((a,i)=>a[1]-i[1]).map(([a],i)=>({n:i+1,hash:a,current:a===n}))}const AP=e=>(e==null?void 0:e.hero)??(e==null?void 0:e.hash)??null,Fre=(e,t)=>e.versions.slice(0,t+1).filter(n=>!!n.hash).length,_re=(e,t)=>e.versions.map(n=>n.hash).lastIndexOf(t);function Vre(e){const t=[{label:ve.placeLabel,text:e.prompt}];return e.lighting&&t.push({label:ve.lightLabel,text:e.lighting}),e.camera&&t.push({label:ve.cameraLabel,text:e.camera}),e.figure&&t.push({label:ve.figureLabel,text:e.figureTreatment?`${pS(e.figure)}, ${pS(e.figureTreatment)}.`:e.figure}),t}const pS=e=>e.replace(/[.\s]+$/,""),Zre=/\b(presenters?|models?|influencers?|celebrit(y|ies)|actors?|actress(es)?)\b/i,zre=/\b(my|our|the|a|an)\s+(\w+\s+)?(products?|bottles?|serum|perfume|shoes?|bag|jar|packaging|package|logos?|brand|brand name|wordmark)\b/i,Bre=/\b(add|put|place|include|show|feature|with|holding|wearing|sitting|standing)\b/i,Ure=/\b(no|without|remove|removing|empty|nobody|none|take out|get rid of|less)\b/i,Wre=/^\s*(undo|go back|revert|back to|previous|the (first|last|previous|old|earlier) (one|version))\b/i,Kre=/^\s*(hi|hello|hey|thanks|thank you|ok|okay|cool|nice|great|good|wow|yes|no)\b[\s!.]*$/i,Gre=/^(?:please\s+)?(?:(?:call|name)\s+(?:it|this|the\s+scene)|rename(?:\s+(?:it|this|the\s+scene))?)\s+(?:to\s+|as\s+)?["'\u201c\u2018]?(.+?)["'\u201d\u2019]?[.!]?$/i,NP=e=>{var t,n;return((n=(t=Gre.exec(e.trim()))==null?void 0:t[1])==null?void 0:n.trim())||null};function Yre(e){const t=e.trim(),n=NP(t);return n?{kind:"rename",name:n}:Wre.test(t)?{kind:"navigate",say:ve.usePutBack}:Kre.test(t)||/\?\s*$/.test(t)&&!/\b(make|can you|could you|try)\b/i.test(t)?{kind:"chatter",say:ve.sayAChange}:(Zre.test(t)||zre.test(t))&&Bre.test(t)&&!Ure.test(t)?{kind:"refuse",say:ve.notInAScene}:{kind:"change"}}const qre=(e,t)=>{var n;return!!((n=$r(e))!=null&&n.ask)&&$r(e).ask.trim().toLowerCase()===t.trim().toLowerCase()},MP=e=>!e.saved&&(e.versions.length>0||!!e.job||!!e.error),mS=(e,t)=>e.saved?!1:t?e.versions.length>t.versions.length||e.current!==t.current||e.place!==t.place||e.pictures.join()!==t.pictures.join()||e.name!==t.name||!!e.job:!!(e.place.trim()||e.pictures.length||e.versions.length||e.job);function Xre(e,t){const n={};for(const[r,a]of Object.entries(e))JSON.stringify(a)!==JSON.stringify(t[r])&&(n[r]=a);return"previewHash"in n&&(n.anchor=e.anchor),"heroHash"in n&&e.heroWith&&(n.heroWith=e.heroWith),n}const RP=1;function Qre(e){return JSON.stringify({v:RP,...e})}function Jre(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||t.v!==RP)return null;const n=u=>Array.isArray(u)?u.filter(f=>typeof f=="string"):[],r=u=>!!u&&typeof u.prompt=="string"&&typeof u.name=="string",a=Array.isArray(t.versions)?t.versions.filter(u=>u&&r(u.reading)).map(u=>({reading:u.reading,hash:typeof u.hash=="string"?u.hash:null,...u.anchor===!0&&typeof u.hash=="string"?{anchor:!0}:{},...typeof u.hero=="string"&&typeof u.hash=="string"?{hero:u.hero,...u.heroWith&&typeof u.heroWith=="object"?{heroWith:u.heroWith}:{}}:{},ask:typeof u.ask=="string"?u.ask:void 0,coverage:n(u.coverage),how:["read","draw","again","change","edit"].includes(u.how)?u.how:u.hash?"draw":"read"})):[],i=t.job&&typeof t.job.id=="string"&&["make","again","change"].includes(t.job.kind)?{id:t.job.id,kind:t.job.kind,ask:typeof t.job.ask=="string"?t.job.ask:void 0,inputsRev:Number(t.job.inputsRev)||0,pending:r(t.job.pending)?t.job.pending:null,coverage:n(t.job.coverage),phase:["reading","changing","drawing"].includes(t.job.phase)?t.job.phase:null,since:typeof t.job.since=="string"?t.job.since:null,...t.job.stopping===!0?{stopping:!0}:{}}:null,l=Number.isInteger(t.current)&&t.current>=-1&&t.current<a.length?t.current:a.length-1;return{place:typeof t.place=="string"?t.place.slice(0,EP):"",pictures:n(t.pictures).slice(0,Bp),heldPictures:n(t.heldPictures).slice(0,4),inputsRev:Number(t.inputsRev)||0,readRev:t.readRev===null||t.readRev===void 0?null:Number(t.readRev),readTried:t.readTried===null||t.readTried===void 0?null:Number(t.readTried),versions:a,current:l,name:typeof t.name=="string"?t.name.slice(0,yy):"",named:!!t.named,job:i,error:typeof t.error=="string"?t.error:null,saved:typeof t.saved=="string"&&t.saved?t.saved:null,moreDeclined:t.moreDeclined===!0,moreAsked:t.moreAsked===!0,setDrawn:t.setDrawn===!0,setDeclined:t.setDeclined===!0}}function ese(e){if(!e||e.loading)return"";const t=e.items.length;return t?ve.shotCount(t,e.more):e.error?ve.shotsFailed:e.query.trim()?ve.shotNotFound(e.query.trim()):ve.shotNone}function gS(e){var n;const t=(n=e==null?void 0:e.tokens)==null?void 0:n.find(r=>(r==null?void 0:r.t)==="template");return typeof(t==null?void 0:t.id)=="string"&&t.id?t.id:typeof(e==null?void 0:e.templateId)=="string"&&e.templateId?e.templateId:null}function tse(e){return Vre(e).map(t=>t.label===ve.placeLabel?t.text:`${t.label}: ${t.text.replace(/[.\s]+$/,"")}.`).join(" ")}const c2=new Set([ve.stopped,ve.stoppedRead,ve.stoppedDraw,ve.stoppedChange,ve.lost,ve.failed,ve.busyElsewhere]),nse=e=>c2.has(e)?e:ff(e)??ve.failedKept(e.replace(/[.\s]+$/,"")),rse=new Set([ve.stopped,ve.stoppedRead,ve.stoppedDraw,ve.stoppedChange]),e6=e=>rse.has(e)?{}:{tone:"alert"},vS=e=>{if(c2.has(e))return e;const t=ff(e);return t?ve.failedSaid(t):ve.failedFirst(e.replace(/[.\s]+$/,""))},PP=e=>e&&!c2.has(e)?co(e).remedy:void 0,G4=e=>{const t=PP(e);return t?[{id:`remedy:${t.opens}`,label:t.label}]:[]};function wS(e){const t=!PP(e)&&!c2.has(e)&&!co(e).retryable;return[...G4(e),...t?[{id:"reword",label:ve.sayDifferently}]:[],{id:"retry",label:ve.retry}]}function yS(e,t,n,r,a){var y,b,k,S,E,C,A,L,T,M,j,P,R,H;const i=t.answers,l=n?{reopened:!0}:{};if(e==="source")return{id:e,kind:"choice",prompt:ve.source,options:[{id:"photos",label:ve.addPictures},{id:"guided",label:ve.guideMe}],given:((y=i.source)==null?void 0:y.door)==="words"?void 0:((b=i.source)==null?void 0:b.door)==="shot"?"photos":(k=i.source)==null?void 0:k.door,note:((S=i.source)==null?void 0:S.door)==="words"?i.source.text:void 0,...l};if(e==="photos")return{id:e,kind:"photos",prompt:ve.photos,hashes:((E=i.photos)==null?void 0:E.hashes)??[],max:4,busy:r>0,submit:ve.readThem,back:ve.guideInstead,drop:ve.photosDrop,...l,...a&&a.any!==!1&&!((C=i.photos)!=null&&C.hashes.length)&&r===0&&!n?{instead:ve.fromShot,...a.any===null?{insteadWaiting:!0}:{}}:{}};if(e==="shot"){const D=(a==null?void 0:a.query.trim())??"";return{id:e,kind:"pick",prompt:ve.shot,items:(a==null?void 0:a.items)??[],given:(A=i.shot)==null?void 0:A.id,search:{label:ve.shotSearch,value:(a==null?void 0:a.query)??""},more:(a==null?void 0:a.more)??!1,loading:(a==null?void 0:a.loading)??!1,empty:a!=null&&a.error?ve.shotsFailed:D?ve.shotNotFound(D):ve.shotNone,status:ese(a),back:n?void 0:ve.backToPictures,...l}}if(e==="reuse"){const D=((T=(L=i.shot)==null?void 0:L.scene)==null?void 0:T.name)??"";return{id:e,kind:"choice",prompt:ve.madeIn(D),options:[{id:"use",label:ve.takeScene(D)},{id:"read",label:ve.readNew}],given:i.reuse,...l}}const u=i[e],f=e==="light"?(j=Po("world",(M=i.world)==null?void 0:M.pick))==null?void 0:j.light:void 0,h=e==="surface"&&!!Po("world",(P=i.world)==null?void 0:P.pick),p=(u==null?void 0:u.pick)===mi||u==null?void 0:u.pick,g=(u==null?void 0:u.pick)===mi,m=u==null?void 0:u.words,w=((R=i.source)==null?void 0:R.door)==="words";return{id:e,kind:"swatches",prompt:LP(e,i),row:mre(e,(H=i.world)==null?void 0:H.pick),layout:e==="world"?"grid":void 0,hint:e==="world"&&!w?ve.worldHint:void 0,skip:f?ve.keepWorldLight:h?ve.keepWorldSurface:e==="signature"&&!w?ve.suggestOne:w?ve.leaveToReading:ve.skip,describe:ve.describeInstead,given:p,skipped:g,note:m,...l}}function LP(e,t){var r,a,i;const n=e==="light"?(a=Po("world",(r=t.world)==null?void 0:r.pick))==null?void 0:a.light:void 0;if(n)return ve.worldLightPrompt(n);if(((i=t.source)==null?void 0:i.door)==="words"){if(e==="world")return ve.followWorld;if(e==="light")return ve.followLight}return Sl[e].prompt}function sse(e,t){var n,r;return e==="source"?ve.source:e==="photos"?ve.photos:e==="shot"?ve.shot:e==="reuse"?ve.madeIn(((r=(n=t.shot)==null?void 0:n.scene)==null?void 0:r.name)??""):LP(e,t)}function bS(e,t){var f,h,p,g,m,w,y,b,k,S,E;if(e==="source")return((f=t.source)==null?void 0:f.door)==="words"?{text:t.source.text??""}:((h=t.source)==null?void 0:h.door)==="shot"?{text:ve.fromShotAnswer}:{text:((p=t.source)==null?void 0:p.door)==="photos"?ve.addPictures:ve.guideMe};if(e==="shot")return{text:ve.shotAnswer,photos:t.shot?[t.shot.hash]:[]};if(e==="reuse")return{text:ve.readNew};if(e==="photos"){const C=((g=t.photos)==null?void 0:g.hashes.length)??0;return{text:`${C} ${C===1?"picture":"pictures"}`,photos:(m=t.photos)==null?void 0:m.hashes}}const n=t[e],r=e==="light"&&(n==null?void 0:n.pick)===mi&&((y=Po("world",(w=t.world)==null?void 0:w.pick))==null?void 0:y.light),a=e==="surface"&&(n==null?void 0:n.pick)===mi&&!!Po("world",(b=t.world)==null?void 0:b.pick),i=r?ve.keepWorldLight:a?ve.keepWorldSurface:((k=t.source)==null?void 0:k.door)==="words"?ve.leaveToReading:e==="signature"?ve.suggestOne:ve.skip,l=(n==null?void 0:n.pick)===mi?i:(S=Po(e,n==null?void 0:n.pick))==null?void 0:S.label,u=(E=n==null?void 0:n.words)==null?void 0:E.trim();return{text:l&&u?`${l}, ${u}`:u??l??""}}const xS=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,ase=e=>{const t=$r(e);return t?`${t.hash?"decide":"agree"}-${e.current}`:null};function ose(e){var w,y,b,k,S,E;const{setup:t,studio:n,edit:r}=e,a=t.answers,i=[],l=new Set,u=C=>{for(const A of t.asides.filter(L=>L.q===C&&!l.has(L)).sort(xS))l.add(A),i.push(...Ei(A))};r?i.push({kind:"scenri",id:"edit-open",text:ve.editOpen(r.name)}):i.push({kind:"you",id:"intent",text:ve.intent});const f=r?null:xP(a);if(!r)for(const C of jre(a)){if(i.push({kind:"scenri",id:`asked-${C}`,text:sse(C,a),quiet:!0}),u(C),t.editing===C){i.push({kind:"question",question:yS(C,t,!0,e.uploading,e.shots)});continue}const A=bS(C,a);i.push({kind:"you",id:C,text:A.text,photos:A.photos,editable:!n.job&&!n.saved})}const h=n.versions.findIndex(C=>!!C.hash);n.versions.forEach((C,A)=>{if(C.how==="read"&&A>0&&i.push({kind:"scenri",id:`reread-${A}`,text:ve.readAgain}),C.how==="change"&&i.push({kind:"you",id:`ask-${A}`,text:C.ask??""}),C.hash&&(C.how==="draw"&&i.push({kind:"you",id:`draw-${A}`,text:ve.draw}),C.how==="again"&&i.push({kind:"you",id:`again-${A}`,text:ve.tryAgain}),A===h&&!r&&kS(i,e),i.push({kind:"scenri",id:`pic-${A}`,text:C.how==="change"?ve.changed:C.how==="again"?ve.again:ve.here,thumb:AP(C)??C.hash,label:ve.version(Fre(n,A)),view:"scene",current:A===n.current,restore:A===n.current||n.saved?void 0:{view:"scene",hash:C.hash}})),A===n.current)for(const[L,T]of C.coverage.entries())i.push({kind:"scenri",id:`cover-${A}-${L}`,text:T});u(`agree-${A}`),u(`decide-${A}`)});const p=n.job;(p==null?void 0:p.kind)==="again"&&i.push({kind:"you",id:`pending-${p.id}`,text:h<0?ve.draw:ve.tryAgain}),(p==null?void 0:p.kind)==="change"&&i.push({kind:"you",id:`pending-${p.id}`,text:p.ask??""}),(p==null?void 0:p.kind)==="again"&&h<0&&!r&&kS(i,e),n.saved&&ise(i,e);let g=null;const m=!r&&!p&&!n.versions.length&&e.canRead===!1&&((w=a.source)==null?void 0:w.door)===e.noReader?e.noReader:null;if(m==="photos"&&((y=a.photos)!=null&&y.hashes.length)&&i.push({kind:"you",id:"photos",...bS("photos",a)}),m)g={id:"noreader",kind:"confirm",quiet:!0,prompt:ve.noReader,options:[{id:"remedy:setup",label:"Set up"},{id:"unstop",label:m==="photos"?ve.changePictures:ve.anotherShot}]};else if(f)g=yS(f,t,!1,e.uploading,e.shots);else if(p){if(p.kind==="again"&&h<0&&!n.named&&!e.editingName){const C=((k=p.pending??((b=$r(n))==null?void 0:b.reading))==null?void 0:k.name)??n.name;g={id:"name",kind:"text",prompt:ve.name,starters:C?[{label:C,text:C}]:void 0}}}else if(n.saved)g=lse(e);else{const C=$r(n);if(e.stale&&!r)n.error&&(g={id:"retry",kind:"confirm",...e6(n.error),prompt:vS(n.error),options:wS(n.error)});else if(!C&&n.error)g={id:"retry",kind:"confirm",...e6(n.error),prompt:vS(n.error),options:wS(n.error)};else if(C){n.error&&i.push({kind:"scenri",id:`error-${n.versions.length}`,text:nse(n.error),...e6(n.error)});const A=tse(C.reading);if(C.hash){const L=!!r&&!r.changed;g={id:`decide-${n.current}`,kind:"confirm",prompt:L?ve.decideSaved:(r?ve.decideEdit:ve.decide)(n.name.trim()||C.reading.name),quote:A,quoteLabel:ve.readingHead,...C.how==="draw"||C.how==="again"?{quoteFolded:!0}:{},options:[...G4(n.error),...L?[]:[{id:"use",label:r?ve.saveChanges:ve.use}],...e.canDraw?[{id:"again",label:ve.tryAgain}]:[]],...L?{quiet:!0}:{},describe:ve.changeSomething}}else{const L=!r&&((S=a.source)==null?void 0:S.door)==="photos",T=!r&&((E=a.source)==null?void 0:E.door)==="shot",M=T?[{id:"another-shot",label:ve.anotherShot}]:[],j=C.how==="change"?ve.agreeChanged:L?ve.agreePhotos:T?ve.agreeShot:ve.agree;g={id:`agree-${n.current}`,kind:"confirm",prompt:e.canDraw?C.reading.hero==="place"?j:`${j} ${ve.drawsTwo}`:ve.agreeBlind,quote:A,quoteLabel:ve.readingHead,options:[...G4(n.error),...e.canDraw?[{id:"draw",label:ve.draw}]:[{id:"use",label:r?ve.saveChanges:ve.saveWords}],...M]}}}}for(const C of t.asides.filter(A=>!l.has(A)).sort(xS))i.push(...Ei(C));return e.note&&i.push({kind:"scenri",id:`note-${e.note.length}-${e.note.slice(0,12)}`,text:e.note}),g&&i.push({kind:"question",question:g}),i}function ise(e,t){const{studio:n,edit:r,set:a,canDraw:i}=t;if(e.push({kind:"you",id:"use",text:r?ve.saveChanges:i?ve.use:ve.saveWords}),!a)return;const l=$P(t),u=a.tiles.filter(m=>!(m.role==="hero"&&m.hash===l)),f=u.length>0||a.running;e.push({kind:"scenri",id:"saved",text:f?ve.inUse(a.who):a.read&&a.noSubject&&i?ve.noLibrary:a.read&&i&&a.first.length?ve.savedQuiet:ve.saved}),(n.setDrawn||n.setDeclined)&&e.push({kind:"you",id:"set-start",text:n.setDrawn?a.stale?ve.drawThemAgain:l?ve.drawIt:ve.drawThem:ve.notNow});const h=n.moreAsked?ve.addThem:n.moreDeclined?ve.notNow:null;let p=!1;const g=()=>{!h||p||(p=!0,e.push({kind:"you",id:"more",text:h}))};for(const m of u)if(m.role!=="hero"&&m.role!=="close"&&g(),m.state==="shown"&&m.hash)e.push({kind:"scenri",id:`ex-${m.role}-${m.hash}`,text:ve.exampleHere[m.role],thumb:m.hash,label:Xa[m.role],view:m.role,...a.running||n.job?{}:{retry:m.role}});else if(m.state==="failed"){const w=m.error?ff(m.error):null;e.push({kind:"scenri",id:`ex-failed-${m.role}`,text:w?ve.exampleFailedSaid(Xa[m.role],w):ve.exampleFailed(Xa[m.role],m.error??ve.failed),tone:"alert"})}g()}function lse(e){var u;const{set:t,studio:n}=e,r=n.name.trim()||((u=$r(n))==null?void 0:u.reading.name)||"The scene";if(!t||t.running||!t.read)return null;const a=$P(e);if(e.canDraw&&t.first.length&&!n.setDrawn&&!n.setDeclined){const f=t.first.map(h=>Xa[h]);return{id:"set-start",kind:"confirm",prompt:t.stale?ve.staleSet(t.first.length):a?ve.moreViews(f):ve.showInUse(t.who,f),options:[{id:"draw-set",label:t.stale?ve.drawThemAgain:t.first.length===1?ve.drawIt:ve.drawThem},{id:"not-now",label:ve.notNow}]}}const i=t.tiles.some(f=>f.role==="hero"&&f.state==="shown");if(e.canDraw&&i&&t.missing.length&&!n.setDeclined&&!n.moreDeclined&&!n.moreAsked)return{id:"set-more",kind:"confirm",prompt:ve.more(t.missing.map(f=>Xa[f])),options:[{id:"more",label:ve.addThem},{id:"not-now",label:ve.notNow}]};const l=t.tiles.filter(f=>f.state==="failed");return{id:"set-done",kind:"confirm",prompt:l.length?ve.readyMissing(r):t.tiles.length?ve.ready(r):ve.readyUndrawn(r),options:[...l.length&&e.canDraw?[{id:"retry-failed",label:ve.tryAgain}]:[],{id:"done",label:t.finish}]}}function $P(e){var n,r;const t=((n=$r(e.studio))==null?void 0:n.hero)??null;return t&&((r=e.set)!=null&&r.tiles.some(a=>a.role==="hero"&&a.state==="shown"&&a.hash===t))?t:null}function kS(e,t){if(!t.studio.named&&!t.editingName)return;e.push({kind:"scenri",id:"asked-name",text:ve.name,quiet:!0});const n=!t.studio.saved;e.push({kind:"you",id:"name",text:t.studio.name,editable:n,editing:t.editingName||void 0})}function cse(e,t){var l,u,f;const{setup:n,studio:r}=e,a=(h,p=!1)=>({target:{kind:"off",why:h},placeholder:"",label:ve.lineLabel,action:ve.send,working:p,attach:!1});if(r.saved){const h=!!r.job||!!((l=e.set)!=null&&l.running);return a(t&&!h?ve.usedOff:"",h)}const i=n.editing;return i==="source"?Xo({kind:"source"},ve.sourcePlaceholder,!0):i&&zp(i)?Xo({kind:"row",id:i},ve.rowPlaceholder(aS(i))):i==="photos"?a(ve.photosOff):i==="shot"?a(ve.shotOff):i==="reuse"?a(ve.reuseOff):!t&&!r.job&&n.answers.source&&!kP(n.answers)?Xo({kind:"source"},ve.nothingSaidPlaceholder,!0):t?t.id==="source"?Xo({kind:"source"},ve.sourcePlaceholder,!0):t.id==="photos"?{...a(ve.photosOff),attach:!0}:t.id==="shot"?a(ve.shotOff):t.id==="reuse"?a(ve.reuseOff):t.id==="noreader"?a(ve.noReaderOff):zp(t.id)?Xo({kind:"row",id:t.id},ve.rowPlaceholder(aS(t.id))):t.id==="name"?Xo({kind:"name"},ve.namePlaceholder):t.id==="retry"?Xo({kind:"source"},ve.nothingSaidPlaceholder,!0):t.id.startsWith("agree-")?e.canDraw?Xo({kind:"add"},e.edit?ve.addPlaceholder:((u=n.answers.source)==null?void 0:u.door)==="photos"?ve.keepPlaceholder:((f=n.answers.source)==null?void 0:f.door)==="shot"?ve.keepShotPlaceholder:ve.addPlaceholder):a(""):t.id.startsWith("decide-")?{...Xo({kind:"change"},ve.changePlaceholder),action:ve.change}:a(""):r.job?a("",!0):a("")}function Xo(e,t,n=!1){return{target:e,placeholder:t,label:t,action:ve.send,working:!1,attach:n}}const use=/\b(studio|room|lobby|hall|beach|forest|desert|street|city|kitchen|bathroom|bedroom|office|garden|park|field|mountain|shore|sea|ocean|lake|river|cave|rooftop|roof|terrace|warehouse|loft|gallery|museum|church|hotel|restaurant|caf[eé]|bar|shop|store|market|set|stage|backdrop|wall|floor|marble|concrete|wood|stone|light|dusk|dawn|night|sun|neon|fog|rain|snow|sand|water|glass|metal|plaster|fabric|interior|outdoors?|indoors?|landscape|pool|library|station|tunnel|bridge|corridor|courtyard|balcony|window|sky|cyclorama|cyc|seamless|brutalist|minimal)\b/i,TP=e=>use.test(e)||e.trim().split(/\s+/).length>=5&&!/\?\s*$/.test(e);function SS(e,t){switch(e){case"greeting":case"ack":return t==="source"?ve.greet:ve.greetRow;case"question":case"help":return ve.askHelp;case"nav":return ve.startOverIsUp;case"go":return t==="source"?ve.goFirst:ve.greetRow;default:return ve.notAPlace}}function ES(e,t){if(t==="source"){const r=ai(e,TP);return r==="vague"?null:r}const n=ai(e,()=>!1);return n==="vague"||n==="intent"||n==="likeness"?null:n}const DP=2;function dse(e,t){return JSON.stringify({v:DP,setup:Pre(e),studio:Qre(t)})}function HP(e){if(!e)return null;try{const t=JSON.parse(e);return(t==null?void 0:t.v)!==DP?null:{setup:$re(t.setup),studio:Jre(typeof t.studio=="string"?t.studio:null)}}catch{return null}}const by=e=>`scenri:scene-studio:${e}:`;function fse(e,t){var f,h,p;if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(n!=null&&n.sceneId)return null;const r=HP(typeof(n==null?void 0:n.session)=="string"?n.session:null),a=r==null?void 0:r.studio;if(!a||!MP(a))return null;const i=[a.versions[a.current],...[...a.versions].reverse()].find(g=>g==null?void 0:g.hash),l=$r(a),u=a.place.trim().split(/\s+/).slice(0,5).join(" ");return{convo:e,name:a.name.trim()||(l==null?void 0:l.reading.name)||((h=(f=a.job)==null?void 0:f.pending)==null?void 0:h.name)||u,hash:(i==null?void 0:i.hash)??null,drawing:!!a.job,failed:!a.job&&!!a.error,read:a.versions.length>0,jobId:((p=a.job)==null?void 0:p.id)??null,at:Number(n.at)||0}}function hse(e,t,n=pse()){const r=new Map(t.filter(l=>l.kind==="scene").map(l=>[l.id.slice(6),l])),a=e.map(l=>{const u=l.jobId?r.get(l.jobId):void 0;return u?l.drawing?{...l,name:l.name||u.name,hash:u.status==="done"&&u.thumb?u.thumb:l.hash,drawing:u.status==="running",failed:u.status==="failed"}:l:{...l,drawing:!1}}),i=new Set([...e.map(l=>l.convo),...n]);for(const l of t)l.kind!=="scene"||l.status!=="running"||!l.conversation||l.sceneId||i.has(l.conversation)||(i.add(l.conversation),a.push({convo:l.conversation,name:l.name,hash:null,drawing:!0,failed:!1,read:!1,jobId:l.id.slice(6),at:Date.parse(l.startedAt)||0}));return a.filter(l=>l.drawing||l.hash||l.failed||l.read).sort((l,u)=>u.at-l.at)}function pse(){var t;const e=[];for(const n of Cr.keys("scenri:scene-studio:"))try{(t=JSON.parse(Cr.get(n)??"null"))!=null&&t.sceneId&&e.push(n.slice(n.lastIndexOf(":")+1))}catch{}return e}function mse(e){return e.drawing?"Drawing":e.hash?"Drawn, not used yet":e.failed?"Did not finish":"Not drawn yet"}function cp(e){const t=by(e);return Cr.keys(t).map(n=>fse(n.slice(t.length),Cr.get(n))).filter(n=>!!n)}function gse(e,t){Cr.set(e,JSON.stringify({at:Date.now(),sceneId:t,done:!0}))}function vse(e,t){try{const n=JSON.parse(Cr.get(`${by(e)}${t}`)??"null");return(n==null?void 0:n.done)===!0&&typeof n.sceneId=="string"?n.sceneId:null}catch{return null}}function wse(e,t){const n=`${by(e)}${t}`;Cr.del(n),dl(n)}function yse(e,t,n,r){const a=ate(e,n)||e==="presenter"&&!!r;switch(e){case"first-shot":case"reuse":return t.onHub?{kind:"stay"}:a?{kind:"hub"}:{kind:"head"};case"refine":return t.onShot||t.onHub?{kind:"stay"}:a?{kind:"hub"}:{kind:"head"};case"presenter":return r||n.some(i=>i==="start"||i==="face"||i==="save")?t.onStudio?{kind:"stay"}:{kind:"studio"}:t.onStudio||t.onPresenters?{kind:"stay"}:a?{kind:"presenters"}:{kind:"head"};case"product":return a&&n.includes("product")?{kind:"dialog",asset:"product"}:t.onProducts?{kind:"stay"}:a?{kind:"products"}:{kind:"head"};case"scene":return a&&n.some(i=>i==="start"||i==="words"||i==="use")?t.onSceneStudio?{kind:"stay"}:{kind:"sceneStudio"}:t.onSceneStudio||t.onScenes?{kind:"stay"}:a?{kind:"scenes"}:{kind:"head"}}}function OP(){const{brand:e,recent:t,products:n}=cn(),r=Bn(),a=Vl(),i=!!mn(mt.hub),l=!!mn(mt.hubShot),u=!!mn(mt.products),f=!!mn(mt.scenes),h=!!mn(mt.presenters),p=!!mn(mt.presenterStudio),g=!!mn(mt.sceneStudio);return s.useCallback(async m=>{var C,A;const w=t.find(L=>L.kind!=="root"&&L.status==="done"&&L.images.length>0),y=m==="refine"&&!w?"first-shot":m==="reuse"&&n.length===0?"product":m,b=rp().active;(b==null?void 0:b.task)===y&&b.brandId===e.id&&!b.paused||await dc({start:{task:y,brandId:e.id}});const k=((A=(C=rp().progress)==null?void 0:C[y])==null?void 0:A.reached)??[],S=rp().activeDraftId,E=yse(y,{onHub:i,onShot:l,onProducts:u,onScenes:f,onPresenters:h,onStudio:p,onSceneStudio:g},k,S);switch(E.kind!=="head"&&g4(),E.kind){case"stay":try{window.localStorage.removeItem(m4(e.id,y)),(y==="first-shot"||y==="reuse")&&window.localStorage.removeItem(FN(e.id))}catch{}return(y==="first-shot"||y==="reuse")&&i?r(Sr(e)):void 0;case"head":return _N(e.id,y);case"hub":return r(Sr(e));case"products":return r(td(e));case"scenes":return r(pl(e));case"presenters":return r(ui(e));case"studio":return r(gl(e,S));case"sceneStudio":{const L=cp(e.id).sort((T,M)=>M.at-T.at)[0];return r(ml(e,(L==null?void 0:L.convo)??null))}case"dialog":return a(E.asset)}},[e,t,n,r,a,i,l,u,f,h,p,g])}const bse=Number(window.localStorage.getItem("scenri:welcome-settle-ms")??900),xse='[role="dialog"]:not(.sc-coach):not(.sc-attachpanel):not(.sc-swap), [role="alertdialog"], .sc-lightbox',kse='[data-guide="compose"] .sc-attachpanel';function Sse(){var Fe,xt,yt,kt,ot,ht,je;const e=Lw(),t=UR(),n=Nn(),{brand:r,recent:a,subscribeActivity:i,products:l,importing:u}=cn(),{tasks:f,builds:h}=ia(),{push:p}=rr(),g=OP(),m=Bn(),[w]=jl(),y=jr("new"),b=!!mn(mt.brand),k=!!mn(mt.hub),S=((Fe=mn(mt.hubShot))==null?void 0:Fe.params.shotId)??null,E=!!mn(mt.presenterStudio),C=!!mn(mt.sceneStudio),A=!!mn(mt.products),L=!!mn(mt.scenes),T=!!mn(mt.presenters),M=e.active,j=M&&M.brandId===r.id?M.task:null,P=j&&!(M!=null&&M.paused)?j:null,R=P==="first-shot"||P==="reuse"?"generation":P==="refine"?"edit":null,H=e.loaded&&e.eligible&&e.welcome===null,[D,B]=s.useState(e.activeNodes);s.useEffect(()=>B(e.activeNodes),[e.activeNodes]),s.useEffect(()=>{if(!(!R||!M))return i(me=>B(tt=>Yee(tt,me,M.since,R)))},[R,M,i]);const V=!!((xt=t.composer)!=null&&xt.busy),U=s.useRef(!1),[K,O]=s.useState(!1);s.useEffect(()=>{U.current&&!V&&R&&(O(!0),C8().finally(()=>O(!1))),U.current=V},[V,R]);const[,F]=s.useState(0),I=s.useRef(0),G=s.useCallback(()=>{cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>F(me=>me+1))},[]);s.useEffect(()=>{if(!P&&!H)return;const me=new MutationObserver(G);return me.observe(document.body,{childList:!0,subtree:H}),window.addEventListener("resize",G),()=>{cancelAnimationFrame(I.current),me.disconnect(),window.removeEventListener("resize",G)}},[P,H,G]);const[z,Y]=s.useState(()=>!document.hidden);s.useEffect(()=>{const me=()=>Y(!document.hidden);return document.addEventListener("visibilitychange",me),()=>document.removeEventListener("visibilitychange",me)},[]);const Z=!!P||H,ee=BN.some(me=>w.has(me)),pe=Z&&(ee||[...document.querySelectorAll(xse)].some(me=>!me.closest("[data-radix-popper-content-wrapper], .sc-shotsheet"))),se=w.get("new"),xe=P?`scenri:guide-begun:${r.id}:${P}`:null,[J,te]=s.useState(!1);s.useEffect(()=>{te(!!xe&&window.localStorage.getItem(xe)==="1")},[xe]);const X=s.useCallback(()=>{if(xe)try{window.localStorage.setItem(xe,"1")}catch{}te(!0)},[xe]),ae=e.heading,Le=me=>!!me&&(ae==null?void 0:ae.brandId)===r.id&&ae.task===me&&!pe,ce=me=>me==="first-shot"||me==="reuse"||me==="refine"?k:me==="product"?A:me==="scene"?L:me==="presenter"?T||E:!1,[Se,Ze]=s.useState(!1);s.useEffect(()=>{let me=!1;try{me=!!P&&window.localStorage.getItem(m4(r.id,P))==="1"}catch{}Ze(me)},[P,r.id,ae]),s.useEffect(()=>{if(!(!ae||ae.brandId!==r.id)&&ce(ae.task)){try{window.localStorage.setItem(m4(r.id,ae.task),"1")}catch{}Ze(!0),(ae.task==="first-shot"||ae.task==="reuse")&&X(),g4()}},[ae,k,A,L,T,E,r.id,X]);const gt=s.useRef(null);s.useEffect(()=>{const me=gt.current;!me||ce(me)||(gt.current=null,_N(r.id,me))},[k,A,L,T,E,r.id]),s.useEffect(()=>{e.loaded&&!j&&ae&&g4()},[e.loaded,j,ae]);let Ke=null;if(P==="first-shot"||P==="reuse"){const me=((yt=t.composer)==null?void 0:yt.brandId)===r.id?t.composer:null,tt=k&&Le(P),Ct={here:k&&!pe,heading:Le(P)&&!k,composer:me&&K?{...me,busy:!0}:me,nodes:D,begun:J||tt||D.length>0};Ke=P==="reuse"?IR(Ct):OR(Ct)}else if(P==="refine"){const me=((kt=t.composer)==null?void 0:kt.brandId)===r.id?t.composer:null,tt=!!S;Ke=_ee({here:tt||k&&!pe,heading:Le(P)&&!k&&!tt,open:tt,armed:k&&!!(me!=null&&me.refining),nodes:D,asking:tt?!!lc(_R):!!lc(Tp)})}else P==="presenter"?Ke=VR({heading:Le(P)&&!T&&!E,onPage:T&&!E&&!pe,studio:E?t.studio:null}):P==="scene"?Ke=Zee({heading:Le(P)&&!L&&!C,onPage:L&&!C&&!pe,studio:C?t.studio:null}):P==="product"&&(Ke=zee({heading:Le(P)&&!A,onPage:A&&!pe&&se!=="product",dialogOpen:se==="product"}));const nt=((ot=t.composer)==null?void 0:ot.brandId)===r.id?t.composer:null,$e=P==="first-shot"&&nt?FR(nt):P==="reuse"&&nt?nt.products===0?"product":nt.scene?null:"scene":null,ne=!!((ht=t.composer)!=null&&ht.pickerOpen);s.useEffect(()=>{ne&&(P==="first-shot"&&!$e?window.dispatchEvent(new Event("scenri:guide-close-picker")):$e&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:bk[$e]}})))},[P,ne,$e]),s.useEffect(()=>{P==="first-shot"&&!$e&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:null}}))},[P,$e]),s.useEffect(()=>{if(P)return document.documentElement.dataset.guideTask=P,()=>{delete document.documentElement.dataset.guideTask}},[P]);const Q=(Ke==null?void 0:Ke.point)===kse&&window.innerWidth<1024;if(s.useEffect(()=>{if(Q)return document.documentElement.dataset.guidePicker="",()=>{delete document.documentElement.dataset.guidePicker}},[Q]),P&&Ke&&Ke.voice!=="quiet"){const me=ote(P,Ke.id);me&&(Ke={...Ke,...me})}const We=P&&Ke&&Ke.voice!=="quiet"?Ke.id:null,Ne=s.useRef("");s.useEffect(()=>{var tt,Ct;if(!P||!We)return;const me=`${P}:${We}`;Ne.current!==me&&(Ne.current=me,!((Ct=(tt=e.progress)==null?void 0:tt[P])!=null&&Ct.reached.includes(We))&&dc({reached:{task:P,moment:We}}))},[P,We,e.progress]);const ie=Ke,q=s.useRef(new Set),oe=s.useCallback(me=>{q.current.add(me),dc({finish:me})},[]),Re=s.useCallback(me=>{dc({dismiss:me}),p({kind:"info",title:"Guide closed",detail:"Continue it any time from Learn."})},[p]);s.useEffect(()=>{P==="first-shot"&&S&&D.some(me=>me.id===S&&me.status==="done"&&me.images>0)&&oe("first-shot")},[P,S,D,oe]),s.useEffect(()=>{P==="refine"&&S&&C8()},[P,S]);const ze=s.useRef(!1);s.useEffect(()=>{if(P!=="refine"){ze.current=!1;return}S?ze.current=!0:ze.current&&(ze.current=!1,oe("refine"))},[P,S,oe]);const Ye=j==="presenter"||j==="scene"||j==="product",Ie=h.filter(me=>!me.finished).length;s.useEffect(()=>{Ye&&C8()},[Ye,r,l.length,Ie,u]),s.useEffect(()=>{Ye&&e.counts&&Uee(e,e.counts)&&oe(M==null?void 0:M.task)},[Ye,e,M,oe]);const De=!!((je=t.overlay)!=null&&je.engaged);s.useEffect(()=>{if(!e.loaded||!e.eligible)return;const me={eligible:e.eligible,hidden:e.hidden,done:e.done,dismissed:e.dismissed,active:M},Ct=!!S&&De&&a.some(be=>be.id===S&&be.status==="done")&&Th("refine",me)?"refine":C&&Th("scene",me)?"scene":se==="product"&&Th("product",me)?"product":E&&Th("presenter",me)?"presenter":null;!Ct||q.current.has(Ct)||(q.current.add(Ct),dc({start:{task:Ct,brandId:r.id}}))},[e,M,S,De,a,se,E,C,r.id]);const[Ge,ft]=s.useState(""),bt=s.useRef(ie);bt.current=ie;const at=s.useCallback((me,tt)=>{if(ft(""),tt)return;const Ct=bt.current,be=Ct?[Ct.title,Ct.body].filter(Boolean).join(". "):"";be&&requestAnimationFrame(()=>ft(be))},[]),[Zt,jt]=s.useState(!1),Ft=jr("welcome"),Pt=Ft.value!==null,Tt=b&&n.showcaseLoaded||k,ke=h.some(me=>!me.finished)||f.some(me=>me.state==="running"&&me.kind!=="catalog"&&me.kind!=="library"),et=Kee({onMainPage:b||k,eligible:e.eligible,welcome:e.welcome,ready:Tt&&!document.querySelector('[data-variant="skeleton"]'),visible:z,blocked:pe,busy:ke});s.useEffect(()=>{if(!et)return;const me=window.setTimeout(()=>jt(!0),bse);return()=>window.clearTimeout(me)},[et]);const Et=s.useMemo(()=>Gee(n.showcase).map(me=>Ese(me.previewUrl)),[n.showcase]),Qe=n.engines.some(me=>me.available),st=l.length>0,rt=ie&&(ie.voice==="ask"||ie.voice==="note")?ie:null,qt=rt!=null&&rt.shell?lc(rt.shell):document.body,Yt=rt!=null&&rt.point?lc(rt.point):null,an=(rt==null?void 0:rt.live)??(rt!=null&&rt.point?[rt.point]:[]),Wt=an.map(me=>lc(me)).filter(me=>!!me),Mn=((rt==null?void 0:rt.also)??[]).map(me=>lc(me)).filter(me=>!!me),Bt=((rt==null?void 0:rt.lit)??[]).map(me=>lc(me)).filter(me=>!!me),re=!!rt&&!!qt&&(!rt.point||!!Yt)&&Wt.length===an.length,ue=rt&&!re?rt:null,de=Zt||re;s.useEffect(()=>Ck(de),[de]),s.useEffect(()=>()=>Ck(!1),[]),s.useEffect(()=>{if(!ue)return;const me=(ue.shell?document.querySelector(ue.shell):null)??document.querySelector(".sc-feed")??document.body,tt=new MutationObserver(G);return tt.observe(me,{childList:!0,subtree:!0}),()=>tt.disconnect()},[ue==null?void 0:ue.id,ue==null?void 0:ue.shell,G]);const _e=me=>{P&&(me.done?oe(P):Re(P))};return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:Ge}),rt&&re&&o.jsx(nne,{id:rt.id,voice:rt.voice,target:Yt,live:Wt,also:Mn,lit:Bt,side:rt.side??"top",beside:rt.beside,soft:rt.soft,container:qt,title:rt.title,body:rt.body,at:rt.at,of:rt.of,canBack:Bee(P,rt.id,Se||!!(k&&Le(P))),action:rt.start?{label:"Start"}:rt.done?{label:"Done"}:null,closeLabel:rt.done?"Close":"Close guide",onBack:()=>{const me=P?zR(P,rt.id):null;if(me){window.dispatchEvent(new CustomEvent("scenri:guide-take-back",{detail:{kind:me}})),window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:bk[me]}}));return}if(P==="presenter"&&(rt.id==="start"||rt.id==="face"||rt.id==="save"))return m(ui(r),{replace:!0});if((P==="product"||P==="scene")&&rt.id===P)return y.close();if(P==="refine"&&rt.id==="ask"){if(S)return m(Sr(r),{replace:!0});window.dispatchEvent(new Event("scenri:guide-clear-refine"));return}if(Se&&P&&(rt.id==="new"||rt.id==="choose"||rt.id==="product"))return window.dispatchEvent(new Event("scenri:guide-close-picker")),gt.current=P,m(To(r))},onAction:()=>{if(rt.start)return X();rt.done&&P&&oe(P)},onClose:()=>_e(rt),onEscape:()=>_e(rt),onShown:at,onLost:G}),o.jsx(lte,{open:Zt||Pt,pictures:Et,note:Yu.note({engineReady:Qe,ownsProducts:st}),onTake:()=>{const me=Zt;jt(!1),Pt&&Ft.close(),me?dc({welcome:"taken"}).then(()=>g("first-shot")):window.setTimeout(()=>void g("first-shot"),0)},onDecline:()=>{const me=Zt;jt(!1),Pt&&Ft.close(),me&&dc({welcome:"declined"})}})]})}function lc(e){for(const t of document.querySelectorAll(e))if(t.getClientRects().length>0)return t;return null}function Ese(e){return`${e}${e.includes("?")?"&":"?"}w=320`}const Cse="lessons";function jse(){var O;const e=jr("learn"),t=e.value!==null,n=nte(e.value),r=Nr(la),a=Lw(),i=UR(),{brand:l,recent:u,products:f}=cn(),h=OP(),[p,g]=s.useState(null);s.useEffect(()=>{t||!p||(g(null),h(p))},[t,p,h]);const m=s.useRef(!1),w=F=>{m.current=!0,g(F),e.close()},y=s.useRef(null);s.useEffect(()=>{t&&(y.current=v4.current,v4.current=null)},[t]);const b=()=>{const F=m.current;if(m.current=!1,F)return;const I=y.current==="help";requestAnimationFrame(()=>{var Y;if(document.activeElement!==document.body)return;const G=I?".sc-help-btn":".sc-learn-btn",z=I?".sc-learn-btn":".sc-help-btn";(Y=document.querySelector(G)??document.querySelector(z))==null||Y.focus()})},k=!!mn(mt.hub),S=!!mn(mt.presenterStudio),E=!!mn(mt.presenters),C=F=>{var I;return((I=a.heading)==null?void 0:I.brandId)===l.id&&a.heading.task===F},A=((O=a.active)==null?void 0:O.brandId)===l.id&&!a.active.paused?a.active.task:null,L=u.some(F=>F.kind!=="root"&&F.status==="done"&&F.images.length>0),T=F=>F.needs==="shot"&&!L||F.needs==="product"&&f.length===0?F.needs??null:null,M=F=>{var Z,ee,pe,se,xe,J;const I=((ee=(Z=a.progress)==null?void 0:Z[F.id])==null?void 0:ee.reached)??[];if(A!==F.id)return jk(F.id,I,null);const G=((pe=i.composer)==null?void 0:pe.brandId)===l.id?i.composer:null,z={here:k,heading:C(F.id),composer:k?G:null,nodes:a.activeNodes,begun:!0},Y=F.id==="first-shot"?((se=OR(z))==null?void 0:se.id)??null:F.id==="reuse"?((xe=IR(z))==null?void 0:xe.id)??null:F.id==="presenter"?((J=VR({heading:C("presenter"),onPage:E&&!S,studio:S?i.studio:null}))==null?void 0:J.id)??null:null;return jk(F.id,I,{moment:Y,nodes:a.activeNodes,draft:!!a.activeDraftId})},j=F=>rte(F.id,a,l.id,M(F)),P=ste(ol,j),R=n??P??ol[0],H=ol.filter(F=>j(F)==="done").length;s.useEffect(()=>{if(t)for(const F of Object.values(V4))new Image().src=F.wide},[t]);const D=s.useRef(null),B=s.useRef(new Map),V=s.useRef(null),U=s.useRef(!1);s.useEffect(()=>{var G;const F=t&&!U.current;if(U.current=t,!t)return;const I=()=>{var z,Y;(z=D.current)==null||z.focus({preventScroll:!0}),(Y=D.current)==null||Y.scrollIntoView({block:"nearest"})};r&&n?(V.current=n.id,I()):r&&V.current?(G=B.current.get(V.current))==null||G.focus({preventScroll:!0}):F&&I()},[t,r,n]);const K=(F,I)=>o.jsx(Ase,{lesson:F,state:j(F),at:M(F),blocked:T(F),describe:I,actionRef:D,onBegin:()=>w(F.id)});return o.jsx(Ws,{open:t,className:"sc-learn",maxWidth:"880px",described:!0,onDismiss:e.close,onCloseAutoFocus:b,children:r&&n?o.jsxs("div",{className:"sc-learn-level",children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx("button",{type:"button",className:"sc-newdlg-back",onClick:()=>e.set(Cse),"aria-label":"All lessons",children:o.jsx($a,{size:15})}),o.jsx(Ns,{className:"sc-newdlg-title",children:n.title}),o.jsx(CS,{})]}),o.jsx("div",{className:"sc-newdlg-body sc-learn-body",children:K(n,!0)})]},`one-${n.id}`):o.jsxs("div",{className:"sc-learn-level",children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Learn"}),o.jsxs("span",{className:"sc-learn-count",children:[H," of ",ol.length," done"]}),o.jsx(CS,{})]}),o.jsx(Hc,{className:"sc-vh",children:"Each one walks you through one real thing, a step at a time."}),o.jsxs("div",{className:"sc-newdlg-body sc-learn-body",children:[o.jsx("ul",{className:"sc-learn-list",children:ol.map(F=>o.jsx("li",{children:o.jsxs("button",{type:"button",className:"sc-learn-row","data-state":j(F),"aria-current":!r&&R.id===F.id?"true":void 0,ref:I=>{I?B.current.set(F.id,I):B.current.delete(F.id)},onClick:()=>e.set(F.id),children:[o.jsx("span",{className:"sc-learn-thumb",children:o.jsx("img",{src:V4[F.id].square,alt:"",decoding:"async"})}),o.jsxs("span",{className:"sc-learn-say",children:[o.jsx("span",{className:"sc-learn-name",children:F.title}),o.jsx(IP,{lesson:F,state:j(F),at:M(F),blocked:T(F)})]}),(P==null?void 0:P.id)===F.id&&o.jsx("span",{className:"sc-learn-next",children:"Next"})]})},F.id))}),!r&&K(R,!1)]})]},"all")})}function Ase({lesson:e,state:t,at:n,blocked:r,describe:a,actionRef:i,onBegin:l}){const u=r?_4[r].action:t==="active"?"Continue":t==="done"?"Start again":"Start",f=t==="active"?n:0,h=g=>t==="done"?"done":t==="active"?g<n?"done":g===n?"active":"todo":g===0?"active":"todo",p=a?o.jsx(Hc,{className:"sc-learn-summary",children:e.summary}):o.jsx("p",{className:"sc-learn-summary",children:e.summary});return o.jsxs("section",{className:"sc-learn-lesson","aria-label":e.title,children:[o.jsx("span",{className:"sc-learn-hero",children:o.jsx("img",{src:V4[e.id].wide,alt:"",decoding:"async"})}),o.jsxs("div",{className:"sc-learn-copy",children:[o.jsx("div",{className:"sc-learn-kicker",children:o.jsx(IP,{lesson:e,state:t,at:n,blocked:r})}),o.jsx("h3",{className:"sc-learn-title",children:e.title}),p,o.jsxs("div",{className:"sc-learn-do",children:[o.jsx("ol",{className:"sc-learn-steps",children:WR(e).map((g,m)=>{const w=h(m),y=o.jsx("span",{className:"sc-learn-n","aria-hidden":"true",children:w==="done"?o.jsx(Kn,{size:14,weight:"bold"}):m+1}),b=t==="active"&&m===n?"step":void 0,k=o.jsx("span",{className:"sc-learn-step-name",children:g});return o.jsx("li",{children:m===f?o.jsxs("button",{ref:i,type:"button",className:"sc-learn-step","data-state":w,"data-here":"","aria-current":b,"aria-label":`${u}: ${g}`,onClick:l,children:[y,k,o.jsxs("span",{className:"sc-learn-go","aria-hidden":"true",children:[u," ",o.jsx(xa,{size:12,weight:"bold"})]})]}):o.jsxs("div",{className:"sc-learn-step","data-state":w,"aria-current":b,children:[y,k,w==="done"&&o.jsx("span",{className:"sc-vh",children:", done"})]})},g)})}),r&&o.jsx("p",{className:"sc-learn-note",children:_4[r].note})]})]})]})}function IP({lesson:e,state:t,at:n,blocked:r}){const a=WR(e).length;return t==="done"?o.jsxs("span",{className:"sc-learn-status","data-state":"done",children:[o.jsx("span",{className:"sc-learn-tick","aria-hidden":"true",children:o.jsx(Kn,{size:9,weight:"bold"})}),"Done"]}):t==="active"?o.jsxs("span",{className:"sc-learn-status","data-state":"active",children:["Step ",Math.min(n+1,a)," of ",a]}):r?o.jsx("span",{className:"sc-learn-status",children:_4[r].status}):o.jsxs("span",{className:"sc-learn-status",children:[a," step",a===1?"":"s"]})}function CS(){return o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})}const FP=s.createContext(null),Nse={products:[],productsLoaded:!1,importing:!1,refreshProducts:async()=>{}};function cn(){const e=s.useContext(FP),t=uR()??Nse;if(!e)throw new Error("useBrand must be used inside BrandLayout");return s.useMemo(()=>({...e,...t}),[e,t])}const _P=s.createContext(null);function Mse(){const e=s.useContext(_P);if(!e)throw new Error("useAssetsPanel must be used inside BrandLayout");return e}function Rse(){const{brandSlug:e}=aa(),{pathname:t,search:n}=Un(),r=mn({path:mt.brand,end:!1}),{brands:a,engines:i,refresh:l}=Nn(),[u,f]=s.useState(null),[h,p]=s.useState(null),[g,m]=s.useState([]),[w,y]=s.useState([]),[b,k]=s.useState({}),[S,E]=s.useState(!1),[C,A]=s.useState(0),L=s.useCallback(()=>A(J=>J+1),[]),T=Bn(),[M,j]=Ma(qr.assetsOpen,window.innerWidth>=1280),P=s.useCallback(()=>j(J=>!J),[]),R=s.useMemo(()=>({open:M,toggle:P,setOpen:j}),[M,P]);xQ();const H=s.useRef(null),D=a.find(J=>J.slug===e)??a.find(J=>J.id===e)??a.find(J=>J.id===H.current)??null;D&&(H.current=D.id);const B=s.useRef(D==null?void 0:D.id);B.current=D==null?void 0:D.id;const V=s.useCallback(async()=>{if(!D)return;const J=D.id,te=await Ee.workspace(J);B.current===J&&(f(te.project),p(te.root),m(te.recent),y(te.sets),k(te.membership),E(!0))},[D==null?void 0:D.id]),U=s.useRef(new Set),K=s.useCallback(J=>(U.current.add(J),()=>{U.current.delete(J)}),[]),O=s.useCallback(J=>{if(J.length){m(te=>Tee(te,J));for(const te of U.current)te(J)}},[]),F=s.useCallback((J,te)=>{!D||J!==D.id||O(te)},[D==null?void 0:D.id,O]),I=s.useCallback(J=>y(te=>te.map(X=>X.id===J.id?J:X)),[]),G=s.useCallback(J=>y(te=>te.filter(X=>X.id!==J)),[]),z=s.useCallback(J=>y(te=>te.some(X=>X.id===J.id)?te:[J,...te]),[]),Y=s.useCallback((J,te)=>k(X=>({...X,[J]:te})),[]),Z=s.useMemo(()=>D?{brand:D,workspace:(u==null?void 0:u.brandId)===D.id?u:null,root:h,recent:g,sets:w,membership:b,loaded:S,refresh:V,applySet:I,dropSet:G,insertSet:z,applyMembership:Y,applyNodes:O,subscribeActivity:K,shotsEpoch:C,resetShots:L}:null,[D,u,h,g,w,b,S,V,I,G,z,Y,O,K,C,L]);s.useEffect(()=>{E(!1),m([]),p(null)},[D==null?void 0:D.id]),s.useEffect(()=>{D&&jG(D.id)},[D==null?void 0:D.id]),s.useEffect(()=>{V()},[V]);const ee=s.useCallback(()=>{l(),V()},[l,V]),pe=r?t.slice(r.pathnameBase.length):"",se=!!D&&e!==D.slug,xe=D?To(D)+pe+n:"";if(s.useEffect(()=>{se&&T(xe,{replace:!0})},[se,xe,T]),!D){const J=$R(a),te=!!H.current&&!a.some(Le=>Le.id===H.current),X=new URLSearchParams(n);te&&(X.delete("settings"),X.delete("new"));const ae=X.toString();return o.jsx(Ja,{to:J?To(J)+pe+(ae?`?${ae}`:""):mt.root,replace:!0})}return o.jsxs(FP.Provider,{value:Z,children:[o.jsx(XJ,{engines:i,brandId:D.id,onSaved:ee}),o.jsx(jee,{engines:i,onSaved:l}),o.jsx(bee,{}),o.jsx(Hq,{brand:D,onActivity:F,children:o.jsxs(kQ,{brand:D,children:[o.jsx(Tse,{}),o.jsx(cQ,{children:o.jsxs(_P.Provider,{value:R,children:[o.jsxs("div",{className:"sc-shell",children:[o.jsx(yQ,{}),o.jsx(Zc,{}),o.jsx(Xq,{})]}),o.jsx(Sse,{}),o.jsx(jse,{}),o.jsx(Qee,{})]})})]})})]})}const Pse=Number(window.localStorage.getItem("scenri:whatsnew-settle-ms")??2500)||2500,VP=s.createContext(null);function eu(){const e=s.useContext(VP);if(!e)throw new Error("useWhatsNew must be used inside WhatsNewProvider");return e}function Lse({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState("loading"),[i,l]=s.useState(!1),[u,f]=s.useState([]),h=jr("whatsnew");s.useEffect(()=>{let M=!0;return Ee.releaseNotes().then(j=>{if(M){if(f(j.newFeatures??[]),!Array.isArray(j.recent)){a("failed");return}n({...j,releasesUrl:j.releasesUrl??null,history:j.history??j.recent,unseen:j.unseen??[],lead:j.lead??null}),a("ready")}}).catch(()=>{M&&a("failed")}),()=>{M=!1}},[]);const p=(t==null?void 0:t.recent)??jS,g=p[0]??null,m=s.useMemo(()=>p.find(M=>M.version===(t==null?void 0:t.lead))??null,[p,t==null?void 0:t.lead]),w=h.open,y=(m==null?void 0:m.version)??null,b=s.useCallback(()=>{l(!0),y&&w(y)},[w,y]),k=s.useRef(null),S=s.useCallback(()=>{!t||t.unseen.length===0||k.current===t.version||(k.current=t.version,n({...t,seen:t.version,unseen:[],lead:null}),Ee.releaseSeen(t.version).catch(()=>{}))},[t]),E=(t==null?void 0:t.releasesUrl)??null,C=s.useCallback(M=>E?`${E}/tag/v${M}`:null,[E]),A=s.useCallback(M=>u.includes(M),[u]),L=s.useCallback(M=>{u.includes(M)&&(f(j=>j.filter(P=>P!==M)),Ee.releaseUsed(M).catch(()=>{}))},[u]),T=s.useMemo(()=>({status:r,recent:p,history:(t==null?void 0:t.history)??jS,featured:g,running:t&&t.version!=="0.0.0"?t.version:null,unseen:(t==null?void 0:t.unseen)??$se,lead:m,releasesUrl:E,notesFor:C,unread:((t==null?void 0:t.unseen.length)??0)>0,autoOpenSpent:i,autoOpen:b,markSeen:S,isNew:A,markUsed:L}),[r,t,p,g,m,E,C,i,b,S,A,L]);return o.jsx(VP.Provider,{value:T,children:e})}const jS=[],$se=[];function Tse(){var S;const e=eu(),{running:t,builds:n}=ia(),{loaded:r}=cn(),[a]=jl(),i=!!mn(mt.whatsNew),[l,u]=s.useState(()=>!document.hidden),f=s.useRef(!1),h=Lw(),p=tte(),g=h.eligible&&h.welcome===null,m=g||p||((S=h.active)==null?void 0:S.task)==="first-shot"&&!h.active.paused,w=!h.loaded||m;m&&(f.current=!0);const y=s.useRef(!1),{markSeen:b}=e;s.useEffect(()=>{g?y.current=!0:y.current&&(y.current=!1,b())},[g,b]),s.useEffect(()=>{const E=()=>u(!document.hidden);return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},[]);const k=BN.some(E=>a.has(E));return s.useEffect(()=>{if(!tee({lead:e.lead!==null,spent:f.current||e.autoOpenSpent,loaded:r,visible:l,dialogOpen:k,running:t,builds:n,firstUse:w,onPage:i}))return;const C=window.setTimeout(()=>{f.current=!0,e.autoOpen()},Pse);return()=>window.clearTimeout(C)},[e,r,l,k,t,n,w,i]),null}function Dse(e,t){return!!e&&e.arriving===t.arriving&&e.installs===t.installs&&(e.landed??0)===(t.landed??0)&&(e.failed??0)===(t.failed??0)&&(e.outcome??null)===(t.outcome??null)}function Hse(e,t){return e?e.installs!==t.installs||(e.landed??0)!==(t.landed??0)||(e.outcome??null)!==(t.outcome??null):t.installs>0||(t.landed??0)>0}function Ose(e,t){return e?e.arriving||t:!0}const Ise=5e3,ZP=s.createContext(null);function Nn(){const e=s.useContext(ZP);if(!e)throw new Error("useAppData must be used inside AppShell");return e}function Fse(){const e=cY(),[t,n]=s.useState(null),[r,a]=s.useState([]),[i,l]=s.useState(null),u=dY(),f=hY(),h=mY(),p=vY(),[g,m]=s.useState(null),w=s.useCallback(O=>{O&&m(F=>Dse(F,O)?F:O)},[]),y=s.useRef(null),[b,k]=s.useState(!1),[S,E]=s.useState(0),{refetch:C}=u,{refetch:A}=f,{refetch:L}=h,{refetch:T}=p;s.useEffect(()=>{if(!g)return;const O=y.current;if(y.current=g,!Hse(O,g))return;const F=!g.arriving;F&&k(!0),E(I=>I+1),Promise.all([C,A,L,T].map(I=>I({quiet:!0}))).finally(()=>{F&&k(!1)})},[g,C,A,L,T]);const M=Ose(g,b),j=s.useRef(0),P=s.useRef(new Map),R=s.useRef(0),H=s.useRef(!1),D=s.useCallback(O=>{P.current.set(O.id,++j.current),n(F=>F&&TY(F,O))},[]),B=s.useCallback(async()=>{const O=++j.current;R.current=O;const F=await Ee.brands();if(R.current!==O)return;const I=new Set;for(const[G,z]of P.current)z>O&&I.add(G);n(G=>DY(G,F,I))},[]),V=s.useCallback(()=>B().catch(()=>{}),[B]),U=s.useCallback(async()=>{try{await Promise.all([B(),Ee.engines().then(a)]),H.current=!0}catch(O){H.current||l(String(O.message??O))}},[B]);s.useEffect(()=>{U(),eY()},[U]),s.useEffect(()=>{let O=0;const F=()=>{document.hidden||Date.now()-O<Ise||(O=Date.now(),V())};return document.addEventListener("visibilitychange",F),window.addEventListener("focus",F),()=>{document.removeEventListener("visibilitychange",F),window.removeEventListener("focus",F)}},[V]);const K=s.useMemo(()=>t===null?null:{brands:t,engines:r,scenes:u.scenes,collections:u.collections,verticals:u.verticals,loaded:u.loaded,error:u.error,refetch:u.refetch,presenters:f.presenters,presenterCategories:f.categories,presenterStyles:f.styles,presentersLoaded:f.loaded,presentersError:f.error,refetchPresenters:f.refetch,demoProducts:h.demoProducts,demoProductCategories:h.categories,demoProductsLoaded:h.loaded,demoProductsError:h.error,showcase:p.showcase,showcaseCategories:p.categories,showcaseLoaded:p.loaded,showcaseError:p.error,refetchShowcase:p.refetch,refresh:U,refreshBrands:V,applyBrand:D,contentArriving:M,libraryTick:S,noteContent:w},[t,r,u.scenes,u.collections,u.verticals,u.loaded,u.error,u.refetch,f.presenters,f.categories,f.styles,f.loaded,f.error,f.refetch,h.demoProducts,h.categories,h.loaded,h.error,p.showcase,p.categories,p.loaded,p.error,p.refetch,U,V,D,M,S,w]);return i?o.jsx(Vs,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(Tw,{failure:{kind:"unknown",title:"Scenri could not read your library.",fix:"Check that it is still running, then reload.",raw:i,retryable:!0}})}):t===null?o.jsx(Vs,{align:"center",justify:"center",height:"100vh",children:o.jsx(Pr,{size:"3"})}):o.jsx(ZP.Provider,{value:K,children:o.jsx(VN.Provider,{value:e,children:o.jsx(MY,{children:o.jsxs(Lse,{children:[o.jsx(I7,{}),o.jsx(Zc,{})]})})})})}function jr(e){const[t,n]=jl(),r=t.get(e),a=s.useCallback(u=>{n(f=>{const h=new URLSearchParams(f);return h.set(e,u),h},{replace:!1})},[e,n]),i=s.useCallback(u=>{n(f=>{const h=new URLSearchParams(f);return h.set(e,u),h},{replace:!0})},[e,n]),l=s.useCallback(()=>{n(u=>{const f=new URLSearchParams(u);return f.delete(e),f},{replace:!0})},[e,n]);return{value:r,open:a,set:i,close:l}}function Ih(e,t=""){const[n,r]=jl(),a=n.get(e)??t,i=s.useCallback(l=>{r(u=>{const f=new URLSearchParams(u);return l===null||l===t?f.delete(e):f.set(e,l),f},{replace:!0})},[e,t,r]);return[a,i]}function AS(e,t){const n=NS(t.name),r=MS(t.url);return!n&&!r?null:e.find(a=>{var i,l,u,f;return!!(r&&MS((l=(i=a.json)==null?void 0:i.meta)==null?void 0:l.website)===r||n&&NS(((f=(u=a.json)==null?void 0:u.meta)==null?void 0:f.name)??a.slug)===n)})??null}const NS=e=>String(e??"").trim().replace(/\s+/g," ").toLowerCase()||null,MS=e=>{const t=String(e??"").trim();if(!t)return null;const n=/^https?:\/\//i.test(t)?t:`https://${t}`;try{return new URL(n).hostname.toLowerCase().replace(/^www\./,"")||null}catch{return null}};function _se(e){const t=e.name.source==="hostname"?{key:"name",found:!1,label:"Name",value:`taken from the address (${e.host})`}:{key:"name",found:!0,label:"Name",value:e.name.value},n=e.logo.status==="primary"?{key:"logo",found:!0,label:"Logo",value:"found on the site"}:e.logo.status==="alternate"?{key:"logo",found:!0,label:"Logo",value:"only a small mark, saved as an alternate"}:{key:"logo",found:!1,label:"Logo",value:"none found"},r=e.colors.count>0?{key:"colors",found:!0,label:"Colours",value:`${e.colors.count} taken from the site`}:{key:"colors",found:!1,label:"Colours",value:"none we could trust"};return[t,n,r]}function Vse(e){return e.logo.status!=="primary"||e.colors.count===0||e.name.source==="hostname"}const E0=(e,t=!1)=>({key:"products",found:t,label:"Products",value:e});function Zse(e){switch(e.kind){case"idle":return null;case"scanning":return E0("looking for a shop");case"timeout":return E0("this site took too long to search");case"error":return E0("the search did not finish");case"result":{const{scan:t}=e;if(t.verdict==="none")return null;if(t.verdict==="found"){const n=t.countSource==="sitemap"&&t.count>20;return E0(`${n?"about ":""}${t.count.toLocaleString()} found`,!0)}return E0("we could not load the catalogue")}}}function zse(e){return e.kind==="timeout"||e.kind==="error"?!0:e.kind==="result"&&(e.scan.verdict==="blocked"||e.scan.verdict==="likely")}function Bse(e){var t;return!e||e.verdict!=="found"?!1:e.candidates.length>0||(((t=e.cards)==null?void 0:t.length)??0)>0}function Use(e,t){const n=e.trim();if(n.length<=t)return n;const r=n.slice(0,t),a=r.lastIndexOf(" ");return`${(a>t*.6?r.slice(0,a):r).replace(/[\s,;:.]+$/,"")}...`}function Wse(){var J,te,X,ae,Le,ce;const{brands:e,refresh:t}=Nn(),n=Bn(),r=e.length>0,[a,i]=s.useState(""),[l,u]=s.useState(""),[f,h]=s.useState(!1),[p,g]=s.useState(!1),[m,w]=s.useState(null),[y,b]=s.useState(null),[k,S]=s.useState(!1),[E,C]=s.useState(!1),[A,L]=s.useState(null),[T,M]=s.useState(null),[j,P]=s.useState(null),[R,H]=s.useState(null),D=s.useRef(!1),B=s.useRef(null),V=async(Se,Ze)=>{D.current=!0,B.current=null,b(Se),await t(),n(`${To(Se)}${Ze?`?settings=${Ze}`:""}`,{replace:!0})},U=s.useRef(!1);s.useEffect(()=>{U.current=!1;const Se=()=>{const Ze=B.current;!Ze||D.current||(B.current=null,fetch(`/api/brands/${Ze}`,{method:"DELETE",keepalive:!0}).catch(()=>{}))};return window.addEventListener("pagehide",Se),()=>{U.current=!0,window.removeEventListener("pagehide",Se),Se()}},[]);const K=async(Se=!1)=>{var Ze,gt;if(!Se){const Ke=AS(e,{url:a.trim()});if(Ke){H(Ke);return}}g(!0),w(null);try{const Ke=await Ee.brandFromUrl(a);if(U.current){fetch(`/api/brands/${Ke.id}`,{method:"DELETE",keepalive:!0}).catch(()=>{});return}b(Ke),B.current=Ke.id,L(Ke.report),M(((Ze=Ke.report)==null?void 0:Ze.read)===!1&&((gt=Ke.warnings)==null?void 0:gt.slice(0,2).join(" "))||null),g(!1)}catch(Ke){w(String(Ke.message??Ke)),g(!1)}},O=async(Se=!1)=>{if(!Se){const Ze=AS(e,{name:l});if(Ze){H(Ze);return}}g(!0),w(null);try{await V(await Ee.createBrand({specVersion:"0.1",meta:{name:l.trim()||"Untitled brand"}}))}catch(Ze){w(String(Ze.message??Ze)),g(!1)}},F=()=>n("/",{replace:!0}),{scan:I,scanning:G,outcome:z,retry:Y}=tR((y==null?void 0:y.id)??null),Z=Zse(z),ee=z.kind==="timeout"||z.kind==="error",pe=async Se=>{var Ze,gt;if(y){P(null),C(!0);try{await Ee.catalogImport(y.id,String(((gt=(Ze=y.json)==null?void 0:Ze.meta)==null?void 0:gt.website)??a),Se)}catch{P("That did not start. Check your connection and try again."),C(!1);return}C(!1),S(!1),await V(y)}},se=y?ra((J=y.json)==null?void 0:J.palette):[],xe=y?Jr((te=Vq(y.json))==null?void 0:te.file):null;return o.jsxs("div",{className:"sc-wiz",children:[o.jsxs("div",{className:"sc-wiz-form",children:[o.jsxs("div",{className:"sc-wiz-head",children:[o.jsxs("button",{type:"button",className:"sc-wiz-back",onClick:F,style:r?void 0:{visibility:"hidden"},children:[o.jsx($a,{size:11})," Back"]}),o.jsx("span",{}),o.jsx("span",{})]}),o.jsxs("h1",{children:["Your ",o.jsx("em",{children:"brand"})]}),o.jsx("p",{className:"sc-wiz-sub",children:y&&A?o.jsxs(o.Fragment,{children:["Built from ",A.host,". Everything here can be changed later, from Settings."]}):o.jsx(o.Fragment,{children:"Paste a website and the kit builds itself: name, logo, palette. You can also start from nothing and fill it in later from Settings."})}),o.jsxs("div",{className:"sc-wiz-fields",children:[y?o.jsx("div",{style:{textAlign:"center"},children:G?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",disabled:!0,children:[o.jsx(Pr,{size:"1"})," Looking for products"]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y),children:"Skip and add the brand only"})})]}):ee?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:Y,children:["Look for products again ",o.jsx(xa,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y),children:"Continue without products"})})]}):Bse(I)?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:()=>S(!0),children:["Add brand and products ",o.jsx(xa,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y),children:"Just the brand"})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:()=>void V(y),children:["Looks right ",o.jsx(xa,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y,"brand"),children:A&&Vse(A)?"Finish the kit first":"Edit the kit first"})})]})}):f?o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:"sc-wiz-name",children:"Brand name"}),o.jsx("input",{id:"sc-wiz-name",className:"sc-in",placeholder:"Brand name",value:l,onChange:Se=>{u(Se.target.value),H(null)},onKeyDown:Se=>Se.key==="Enter"&&l.trim()&&!p&&void O()}),o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!l.trim()||p,onClick:()=>void O(),children:p?o.jsx(Pr,{size:"1"}):o.jsxs(o.Fragment,{children:["Create it ",o.jsx(xa,{size:12})]})}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>{h(!1),H(null)},children:"Build from a website instead"})})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:"sc-wiz-url",children:"Website"}),o.jsx("input",{id:"sc-wiz-url",className:"sc-in",placeholder:"acme.com",value:a,onChange:Se=>{i(Se.target.value),H(null)},onKeyDown:Se=>Se.key==="Enter"&&a.trim()&&!p&&void K()}),o.jsx("p",{className:"sc-wiz-hint",children:"We only read public pages. Nothing leaves this machine."}),o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!a.trim()||p,onClick:()=>void K(),children:p?o.jsx(Pr,{size:"1"}):o.jsxs(o.Fragment,{children:["Build the kit ",o.jsx(xa,{size:12})]})}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>{h(!0),H(null)},children:"Start from scratch instead"})})]})]}),R&&o.jsxs(a4,{color:"amber",mt:"3",size:"1",children:[o.jsxs(o4,{children:["You already have ",Ca(R),". Creating another makes a second workspace with its own address."]}),o.jsxs("div",{style:{display:"flex",gap:10,marginTop:4,flexWrap:"wrap"},children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:()=>n(To(R)),children:["Open ",Ca(R)," instead"]}),o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>{H(null),f?O(!0):K(!0)},children:"Create anyway"})]})]}),m&&o.jsx(a4,{color:"red",mt:"3",size:"1",children:o.jsx(o4,{children:m})})]})]}),o.jsx("div",{className:"sc-wiz-preview",children:o.jsxs("div",{className:"sc-wiz-card",children:[o.jsx("div",{className:"sc-wiz-cap",children:y?"Your kit":p?`Reading ${a||"the site"}`:"Live kit preview"}),o.jsxs("div",{className:"sc-wiz-body",children:[p&&!y&&o.jsxs("div",{className:"sc-scrape-row",children:[o.jsx(Pr,{size:"1"})," Reading the site and building the kit"]}),!p&&!y&&o.jsx("p",{style:{color:"var(--sc-fg3)",fontSize:12.5,margin:0},children:"The kit appears here as it is found."}),y&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:se.length?16:0},children:[o.jsx("span",{className:"sc-kit-logo",style:{width:44,height:44,padding:7,borderRadius:12},children:xe?o.jsx("img",{src:xe,alt:""}):o.jsx(Ta,{size:16,color:"var(--sc-fg3)"})}),o.jsxs("span",{children:[o.jsx("b",{dir:"auto",style:{fontFamily:"var(--sc-font-display)",fontSize:16},children:(ae=(X=y.json)==null?void 0:X.meta)==null?void 0:ae.name}),((ce=(Le=y.json)==null?void 0:Le.meta)==null?void 0:ce.tagline)&&o.jsx("small",{dir:"auto",style:{display:"block",color:"var(--sc-fg3)",fontSize:11.5},children:Use(String(y.json.meta.tagline),72)})]})]}),se.length>0&&o.jsx("div",{style:{display:"flex",gap:8},children:se.slice(0,5).map(Se=>o.jsx("span",{style:{flex:1,height:44,borderRadius:9,border:"1px solid var(--sc-line)",background:Se.hex}},Se.hex))}),A&&o.jsx("ul",{className:"sc-kit-lines",role:"status",children:[..._se(A),...Z?[Z]:[]].map(Se=>o.jsxs("li",{"data-found":Se.found?"":void 0,children:[Se.key==="products"&&G?o.jsx(Pr,{size:"1"}):Se.found?o.jsx(Kn,{size:12,weight:"bold"}):o.jsx(fF,{size:12}),o.jsx("span",{className:"sc-kit-line-label",children:Se.label}),o.jsx("span",{className:"sc-kit-line-value",children:Se.value})]},Se.key))}),T&&o.jsx("p",{className:"sc-kit-note",role:"status",children:T}),!G&&!ee&&zse(z)&&o.jsx("button",{type:"button",className:"sc-wizpick-open",onClick:Y,children:"Try the catalogue again"})]})]})]})}),k&&I&&y&&o.jsx(eR,{brandId:y.id,scan:I,busy:E,error:j,onImport:Se=>void pe(Se),onImportAll:()=>void pe(),onDismiss:()=>S(!1)})]})}const Zu=e=>{const t=(e??"").trim();return t||null};function Kse(e){const t=e;return{name:e.name,brand:Zu(t.brand)??Zu(t.vendor),qualifier:Zu(t.format)??Zu(t.subcategory)??Zu(t.variant)}}function Gse(e){return!e.brand||e.name.toLowerCase().startsWith(e.brand.toLowerCase())?e.name:`${e.brand} ${e.name}`}function Do(e,t){const n=Kse(e);if(t==="chip")return n.name;const r=Gse(n);return t==="tooltip"?[r,n.qualifier].filter(Boolean).join(" · "):r}function El(e,t){return t==="tooltip"?[e.name,Zu(e.lighting)].filter(Boolean).join(" · "):e.name}function Up(e){return[e.name,...e.legacyNames??[],...e.keywords??[],e.description,e.lighting,e.subject].concat(e.collections??[],e.verticals??[]).filter(Boolean).join(" ")}function xy(e){const t=e;return[e.name,...t.legacyNames??[],...t.keywords??[],t.brand,t.vendor,t.format,t.subcategory,t.variant,t.productType,...t.tags??[]].filter(Boolean).join(" ")}function Wp(e){return[e.name,e.descriptor,e.presentation,e.ageRange,e.facial,e.skin,e.hair,e.build,e.wardrobeDefault,...e.suitableCategories,...e.suitableStyles].filter(Boolean).join(" ")}function Yse(e,t,n){return[e.title,e.category,n,t.product?xy(t.product):null,t.presenter?Wp(t.presenter):null,t.scene?Up(t.scene):null].filter(Boolean).join(" ")}function ky(){const{brand:e}=cn(),t=Bn(),n=Sr(e);return s.useCallback(r=>{t(`${n}?presenter=${encodeURIComponent(r)}&compose=1${Ec()}`)},[n,t])}function u2(){const{brand:e}=cn(),t=Bn(),n=Sr(e);return s.useCallback((r,a,i,l)=>{const u=a?`&setup=${encodeURIComponent(a)}`:"",f=i?`&ref=${encodeURIComponent(i)}${l?`&view=${l}`:""}`:"";t(`${n}?scene=${encodeURIComponent(r)}${u}${f}&compose=1${Ec()}`)},[n,t])}function Y4(e){return{...e.brief,...e.quality?{quality:e.quality}:{},_at:Date.now()}}function qse(){const{brand:e}=cn(),t=Bn(),n=Sr(e);return s.useCallback(r=>{t(`${n}?showcase=${encodeURIComponent(r)}`)},[n,t])}const up=e=>`sc-favscenes-${e}`,Xse=e=>`sc-favlooks-${e}`,Qse=e=>`bt-favlooks-${e}`;function zP(e,t){return e==="presenter"?`sc-favpresenters-${t}`:e==="product"?`sc-favproducts-${t}`:up(t)}function BP(e){try{const t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function Ci(e){try{const t=localStorage.getItem(up(e))??c4(Xse(e),up(e))??c4(Qse(e),up(e));return BP(t)}catch{return[]}}function Sd(e,t){try{return e==="scene"?Ci(t):BP(localStorage.getItem(zP(e,t)))}catch{return[]}}function UP(e,t,n){try{localStorage.setItem(zP(e,t),JSON.stringify(n))}catch{}}function d2(e,t,n){const r=Sd(e,t),a=r.includes(n)?r.filter(i=>i!==n):[...r,n];return UP(e,t,a),a}function Sy(e,t,n,r){const a=Sd(e,t),i=r?[...a,...n.filter(l=>!a.includes(l))]:a.filter(l=>!n.includes(l));return UP(e,t,i),i}const WP=[{key:"campaign",label:"Product campaign"},{key:"lifestyle",label:"Lifestyle"},{key:"editorial",label:"Fashion & editorial"},{key:"beauty",label:"Beauty"},{key:"food-drink",label:"Food & drink"},{key:"launch",label:"Tech launch"},{key:"social",label:"Social"},{key:"cinematic",label:"Cinematic"},{key:"catalog",label:"Catalog"},{key:"seasonal",label:"Seasonal"}],Jse=new Map(WP.map(e=>[e.key,e]));function t6(e){var t;return e?((t=Jse.get(e))==null?void 0:t.label)??e:null}function eae(e){const t=new Map(WP.map((n,r)=>[n.key,r]));return[...e].sort((n,r)=>(t.get(n)??99)-(t.get(r)??99)||n.localeCompare(r))}function tae(e,t){let r=null,a=null,i=null,l=null,u=null,f=null,h=null,p={dx:0,dy:0},g={w:0,h:0},m=0;const w=P=>{P.style.position="fixed",P.style.left="0",P.style.top="0",P.style.margin="0",P.style.zIndex="var(--sc-z-popover)",P.style.pointerEvents="none"},y=()=>{const P=R=>{var H,D;window.removeEventListener("click",P,!0),!((D=(H=R.target).closest)!=null&&D.call(H,'[data-role="remove"]'))&&(R.stopPropagation(),R.preventDefault())};window.addEventListener("click",P,!0),setTimeout(()=>window.removeEventListener("click",P,!0),250)},b=()=>{if(h!==null){try{e.releasePointerCapture(h)}catch{}h=null}i==null||i.remove(),l==null||l.remove(),i=null,l=null,u=null,a==null||a.removeAttribute("data-drag-src"),a=null,r=null,e.removeAttribute("data-chip-drag"),document.documentElement.style.cursor="",cancelAnimationFrame(m)},k=P=>{!e.isConnected||!e.contains(document.activeElement)||(f!==null?Ka(e,f):xc(e,P,"after"))},S=()=>{if(!a)return;const P=a;b(),y(),k(P),t.onCancelled()},E=P=>{if(P.button!==0||P.pointerType==="touch")return;const R=P.target;if(R.closest('[data-role="remove"]'))return;const H=nl(R);H&&(r={chip:H,x:P.clientX,y:P.clientY})},C=P=>{var H,D;if(!r)return;f=ko(e),a=r.chip,t.onDragStart(),(H=window.getSelection())==null||H.removeAllRanges(),e.setAttribute("data-chip-drag","");const R=a.getBoundingClientRect();p={dx:r.x-R.left,dy:r.y-R.top},r=null;try{e.setPointerCapture(P.pointerId),h=P.pointerId}catch{}document.documentElement.style.cursor="grabbing",i=a.cloneNode(!0),(D=i.querySelector('[data-role="remove"]'))==null||D.remove(),i.className=`${a.className} sc-chip-ghost`,i.removeAttribute("data-drag-src"),i.removeAttribute("title"),w(i),i.style.width=`${R.width}px`,i.style.height=`${R.height}px`,i.style.fontSize=getComputedStyle(a).fontSize,g={w:R.width,h:R.height},document.body.appendChild(i),a.setAttribute("data-drag-src",""),l=document.createElement("div"),l.className="sc-drop-caret",w(l),l.style.display="none",document.body.appendChild(l),A(P)},A=P=>{if(!i||!a)return;const R=Math.min(Math.max(4,P.clientX-p.dx),window.innerWidth-g.w-4),H=Math.min(Math.max(4,P.clientY-p.dy),window.innerHeight-g.h-4);i.style.transform=`translate3d(${R}px, ${H}px, 0)`;const D=Tk(e,a,P.clientX,P.clientY);if(u=D,!l)return;const B=D&&!D.noop?RS(e,D.units):null;if(!B||!D){l.style.display="none";return}const V=Nte(e,D.units),U=V<D.units?RS(e,V):null,K=!!U&&Math.abs(U.top+U.height/2-(B.top+B.height/2))<B.height/2,O=U&&K?(U.left+B.left)/2:B.left;l.style.display="",l.style.transform=`translate3d(${O-1.5}px, ${B.top-2}px, 0)`,l.style.height=`${B.height+4}px`},L=P=>{if(r){if(Math.hypot(P.clientX-r.x,P.clientY-r.y)<5)return;P.preventDefault(),C(P);return}if(!a)return;P.preventDefault(),cancelAnimationFrame(m);const{clientX:R,clientY:H}=P;m=requestAnimationFrame(()=>A({clientX:R,clientY:H}))},T=P=>{if(r){r=null;return}if(!a)return;const R=a;let H;try{H=Tk(e,R,P.clientX,P.clientY)??u}catch{H=u}finally{b()}if(y(),H&&!H.noop&&tP(e,R,H.units)){xc(e,R,"after"),t.onMoved(R,Z4(e,R));return}k(R),t.onCancelled()},M=P=>{P.key==="Escape"&&a&&(P.stopPropagation(),S())},j=P=>{nl(P.target)&&P.preventDefault()};return e.addEventListener("pointerdown",E),e.addEventListener("dragstart",j),e.addEventListener("lostpointercapture",S),window.addEventListener("pointermove",L),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",S),window.addEventListener("blur",S),window.addEventListener("keydown",M,!0),()=>{b(),e.removeEventListener("pointerdown",E),e.removeEventListener("dragstart",j),e.removeEventListener("lostpointercapture",S),window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",S),window.removeEventListener("blur",S),window.removeEventListener("keydown",M,!0)}}function RS(e,t){let n=0;const r=Array.from(e.childNodes);for(let l=0;l<r.length;l++){const u=r[l],f=xd(u),h=u.nodeType===Node.TEXT_NODE&&t===n+f&&l<r.length-1;if(t<=n+f&&!h){if(u.nodeType!==Node.TEXT_NODE){const m=u.getBoundingClientRect();return new DOMRect(t===n?m.left:m.right,m.top,0,m.height)}const p=document.createRange();p.setStart(u,Op(u,Math.max(0,Math.min(t-n,f)))),p.collapse(!0);const g=p.getBoundingClientRect();return g.height?g:null}n+=f}const i=(e.lastElementChild??e).getBoundingClientRect();return new DOMRect(i.right,i.top,0,i.height||18)}function nae({kind:e,label:t,thumb:n,onInspect:r,onMove:a,onRemove:i,onClose:l}){const{sheet:u,grip:f}=$d(()=>l("dismiss")),h=e==="mark"?"brand mark":"reference image";return o.jsx(Ml,{open:!0,onOpenChange:p=>!p&&l("dismiss"),children:o.jsxs(Rl,{children:[o.jsx(Pl,{className:"sc-shotsheet-scrim"}),o.jsxs(Ll,{ref:u,className:"sc-shotsheet sc-swapsheet","data-kind":e,"aria-describedby":void 0,onOpenAutoFocus:p=>{var g;p.preventDefault(),(g=u.current)==null||g.focus({preventScroll:!0})},onCloseAutoFocus:p=>p.preventDefault(),onEscapeKeyDown:p=>{p.preventDefault(),l("escape")},children:[o.jsxs("div",{className:"sc-shotsheet-grip",...f,children:[o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0}),o.jsxs($l,{className:"sc-vh",children:["Move or remove ",h]})]}),o.jsxs("div",{className:"sc-movesheet-head",children:[n&&o.jsx("button",{type:"button",className:"sc-movesheet-face",onClick:r,"aria-label":`Open ${h}`,children:o.jsx("img",{src:n,alt:"",onError:p=>p.currentTarget.remove()})}),o.jsxs("span",{className:"sc-movesheet-txt",children:[o.jsx("b",{dir:"auto",children:t||h}),o.jsx("span",{children:h})]})]}),o.jsxs("div",{className:"sc-swap-foot",children:[o.jsxs("div",{className:"sc-swap-move",children:[o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>a(-1),children:[o.jsx(Rv,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>a(1),children:["Move later ",o.jsx(xa,{size:13})]})]}),i&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:i,children:[o.jsx(Nl,{size:13}),"Remove ",e==="mark"?"mark":"reference"]})]})]})]})})}const rae=440,sae=460,aae=600,PS=156,KP=8,dp=14,n6=20,xr=12,GP=200,oae=240,YP=204;function iae(e,t,n){if(e.bottom<0||e.top>t.height)return null;const r=Math.min(n==null?void 0:n.width,t.width-xr*2),i=e.right+dp+r+xr<=t.width?e.right+dp:Math.max(xr,e.left-dp-r),l=Math.max(xr,Math.min(e.top,t.height-xr-YP));return{left:i,top:l,width:r,maxHeight:Math.max(GP,t.height-l-xr),side:"beside"}}function lae(e,t){const n=(r,a)=>Math.min(Math.max(r,n6),Math.max(n6,a-n6));return t.side==="beside"?{edge:t.left>=e.right?"left":"right",x:0,y:n((e.top+e.bottom)/2-t.top,YP)}:{edge:t.side==="above"?"bottom":"top",x:n((e.left+e.right)/2-t.left,t.width),y:0}}function cae(e,t,n,r){if(e.bottom<0||e.top>t.height)return null;const a=KP,i=Math.min(n.width,t.width-xr*2),l=n.height,u=Math.min(Math.max(e.left+(e.right-e.left)/2-i/2,xr),Math.max(xr,t.width-i-xr)),h=e.top-a-xr>=l?e.top-a-l:Math.min(e.bottom+a,Math.max(xr,t.height-l-xr));return{left:u,top:h}}function Ey(e,t,n){if(e.bottom<0||e.top>t.height)return null;const r=Math.min((n==null?void 0:n.width)??rae,t.width-xr*2),a=(n==null?void 0:n.gap)??KP,i=e.top-a-xr,l=t.height-e.bottom-a-xr,u=i>=oae||i>=l?"above":"below",f=u==="above"?i:l,h=Math.max(GP,Math.min((n==null?void 0:n.maxHeight)??sae,f)),p=Math.min(Math.max(e.left,xr),Math.max(xr,t.width-r-xr)),g=u==="above"?Math.max(xr,e.top-a-h):e.bottom+a;return u==="above"?{left:p,top:g,width:r,maxHeight:h,side:u,bottomEdge:e.top-a}:{left:p,top:g,width:r,maxHeight:h,side:u}}function qP(e){return e.side==="above"&&e.bottomEdge!==void 0?{left:e.left,width:e.width,maxHeight:e.maxHeight,top:"auto",bottom:window.innerHeight-e.bottomEdge}:{left:e.left,width:e.width,maxHeight:e.maxHeight,top:e.top}}const uae=["ref","mark","product","presenter","scene","shot"],fp=e=>uae.includes(e),XP={ref:"Reference image",mark:"Brand mark",product:"Product",presenter:"Presenter",scene:"Scene",shot:"Shot"};function dae(e){return e.side==="below"||e.side==="beside"?{top:Math.round(e.top)}:{bottom:Math.round(window.innerHeight-(e.top+e.maxHeight))}}function Od({anchor:e,kind:t,src:n,label:r,warning:a,note:i,noun:l,side:u="auto",onOpen:f,onHoverIn:h,onHoverOut:p,onClose:g}){const[m,w]=s.useState(null),[y,b]=s.useState(!1);if(s.useEffect(()=>b(!1),[n]),s.useLayoutEffect(()=>{var E,C;const S=()=>{const A=window.visualViewport,L=e.getBoundingClientRect(),T={width:(A==null?void 0:A.width)??window.innerWidth,height:(A==null?void 0:A.height)??window.innerHeight},M=u==="beside"?iae(L,T,{width:PS}):Ey(L,T,{width:PS,gap:dp});if(!M){g();return}w({...M,tail:lae(L,M)})};return S(),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),(E=window.visualViewport)==null||E.addEventListener("resize",S),(C=window.visualViewport)==null||C.addEventListener("scroll",S),()=>{var A,L;window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),(A=window.visualViewport)==null||A.removeEventListener("resize",S),(L=window.visualViewport)==null||L.removeEventListener("scroll",S)}},[e,u,g]),s.useEffect(()=>{const S=E=>{E.key==="Escape"&&g()};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[g]),!m)return null;const k=l??XP[t];return Br.createPortal(o.jsxs("div",{className:"sc-chip-preview","data-kind":t,"data-side":m.side,"aria-hidden":"true",style:{left:Math.round(m.left),...dae(m),maxWidth:m.width,maxHeight:m.maxHeight},onPointerEnter:h,onPointerLeave:p,children:[o.jsx("span",{className:"sc-chip-preview-tail","data-edge":m.tail.edge,style:m.tail.edge==="left"||m.tail.edge==="right"?{top:Math.round(m.tail.y)}:{left:Math.round(m.tail.x)}}),o.jsxs("button",{type:"button",className:"sc-chip-preview-hit",tabIndex:-1,onClick:f,children:[y?o.jsxs("span",{className:"sc-chip-preview-plate sc-chip-preview-blank",children:[o.jsx(Ta,{size:20}),"Image unavailable"]}):o.jsx("img",{className:"sc-chip-preview-plate",src:n,alt:"",decoding:"async",onError:()=>b(!0)}),r&&o.jsx("b",{dir:"auto",children:r}),k&&o.jsx("span",{children:k})]}),i&&o.jsx("p",{className:"sc-chip-preview-note",children:i}),a&&o.jsx("p",{className:"sc-swap-warn",children:a})]}),document.body)}const fae=160,hae=120;function Id(){const[e,t]=s.useState(null),n=s.useRef(null),r=s.useRef(!1);r.current=e!==null;const a=s.useCallback(()=>{n.current&&clearTimeout(n.current),n.current=null},[]),i=s.useCallback(f=>{if(a(),r.current){t(f);return}n.current=setTimeout(()=>t(f),fae)},[a]),l=s.useCallback(()=>{a(),n.current=setTimeout(()=>t(null),hae)},[a]),u=s.useCallback(()=>{a(),t(null)},[a]);return s.useEffect(()=>a,[a]),{shown:e,open:i,keep:a,close:l,closeNow:u}}const I0="sc-insert-menu";function pae(e){var t;return!!(((t=e.nativeEvent)==null?void 0:t.isComposing)??e.isComposing)||e.keyCode===229}function mae(e){return e==="/"?"Scenes":e==="@"?"Presenters":e==="#"?"Colors":"Products"}function gae(e){return e==="/"?"No matching scenes":e==="#"?"No matching colours":e==="@"?"No matching presenters":"No matching products"}function vae({menuOpen:e,handled:t}){return!e&&!t}function wae(e,t){return t||!e?{open:!1}:{open:!0,sigil:e.sigil,query:e.query}}function yae(e,t){const n=t.trim().split(/\s+/).filter(Boolean)[0];if(!n)return[{text:e,hit:!1}];const r=e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase());if(r<0)return[{text:e,hit:!1}];const a=r+n.length;return[...r>0?[{text:e.slice(0,r),hit:!1}]:[],{text:e.slice(r,a),hit:!0},...a<e.length?[{text:e.slice(a),hit:!1}]:[]]}function bae(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.right-e.left,h:e.bottom-e.top}}function xae(e,t){return{left:e.left+t.x,top:e.top+t.y,right:e.left+t.x+t.w,bottom:e.top+t.y+t.h}}function kae(e,t,n){return n?t:e||t}function Sae(e,t){return!t||e==null?!0:e===t?!1:!t.contains(e)}function r6(e,t){return e===t?!0:!e||!t?!1:e.left===t.left&&e.top===t.top&&e.width===t.width&&e.maxHeight===t.maxHeight&&e.side===t.side&&e.shell===t.shell}function Eae(e,t,n){return Math.min(n,Math.max(0,e)+Math.max(0,t))}function Cae(e,t,n){return n>0&&t>0&&e!==t}function jae(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.bottom>r.bottom?e.scrollTop+=n.bottom-r.bottom:n.top<r.top&&(e.scrollTop-=r.top-n.top)}const QP=320,Kp=320,Aae=280,gc=8,fc=12,Nae=8,LS=80,Mae=120,JP=48;function eL(e,t){return!(!e||e.top===0&&e.left===0&&e.right===0&&e.bottom===0||e.bottom<0||e.top>t.height||e.right-e.left>JP)}function Rae(e){return{top:e.top,bottom:Math.min(e.bottom,e.top+22),left:e.left,right:e.left+2}}function tL(e,t,n,r){return Math.min(Math.max(e,r),Math.max(r,n.width-t-r))}function q4(e,t,n,r){const a=n?Nae:fc,i=n?Math.max(0,e.right-e.left):Math.min(QP,t.width-a*2),l=n?e.left:tL(e.left,i,t,a),u=n?Math.min(Aae,Math.floor(t.height*.4)):Kp,f=Math.min(u,r??u),h=e.top-gc-a,p=Math.max(0,Math.min(f,h)),g=Math.max(a,e.top-gc-p);return{left:l,top:g,width:i,maxHeight:p,side:"above",shell:"dock"}}function $S(e,t,n,r){const a=Math.min(QP,n.width-fc*2),i=tL(e.left,a,n,fc),l=e.top-gc-fc,u=n.height-e.bottom-gc-fc,f=l>=Mae||l>=u?"above":"below",h=Math.min(Kp,r??Kp),p=f==="above"?l:u,g=Math.min(h,r==null?Math.max(LS,p):p);if(f==="above"){const w=Math.max(fc,e.top-gc-Math.min(h,l)),y=Math.min(h,e.top-gc-w);return r==null&&y<LS?q4(t,n,!1):{left:i,top:w,width:a,maxHeight:y,side:f,shell:"caret"}}const m=e.bottom+gc;return m+Math.min(g,u)>n.height-fc?q4(t,n,!1,r):{left:i,top:m,width:a,maxHeight:Math.min(h,u),side:f,shell:"caret"}}function Pae(e,t,n,r={}){if(r.phone)return q4(t,n,!0,r.height);const a=r.line??t;if(eL(e,n)&&e)return $S(e,t,n,r.height);const i=e&&e.right-e.left>JP?e:a;return $S(Rae(i),t,n,r.height)}function Lae({anchor:e,composer:t,line:n,query:r,options:a,remaining:i=0,total:l=0,sigil:u,onMore:f,onActiveId:h,onClose:p}){const g=Nr(la),[m,w]=s.useState(0),[y,b]=s.useState(null),k=s.useRef(null),S=s.useRef(null),E=s.useRef(null),C=s.useRef(null),A=`${u??""}\0${r}`,L=s.useRef({}),T=s.useRef(f);T.current=f;const M=s.useRef(i);M.current=i;const j=s.useRef(0),P=s.useCallback(()=>{var V;Cae(j.current,a.length,M.current)&&(j.current=a.length,(V=T.current)==null||V.call(T))},[a.length]);s.useEffect(()=>{w(0),j.current=0},[r]),s.useEffect(()=>{w(V=>Math.min(V,Math.max(0,a.length-1)))},[a.length]),s.useEffect(()=>{C.current=null,L.current={}},[u]);const R=s.useCallback(V=>{var ee;const U=t==null?void 0:t.getBoundingClientRect();if(!U)return null;const K=(n==null?void 0:n.getBoundingClientRect())??U,O=window.visualViewport,F={width:(O==null?void 0:O.width)??window.innerWidth,height:(O==null?void 0:O.height)??window.innerHeight},I=!!((ee=k.current)!=null&&ee.contains(document.activeElement)),G=I?null:qR(),z=G&&eL(G,F)?G:null;z&&(C.current=bae(z,K));const Y=C.current?xae(K,C.current):null,Z=kae(z,Y,I)??(I?null:(e==null?void 0:e.getBoundingClientRect())??null);return Pae(Z,U,F,{phone:g,line:K,height:V})},[e,t,n,g]);s.useLayoutEffect(()=>{var O,F;L.current.sigil!==u&&(L.current={sigil:u});const V=()=>{const I=M.current>0?void 0:L.current.height,G=R(I);b(z=>r6(z,G)?z:G)},U=I=>{Sae(I.target,k.current)&&V()};V();const K=requestAnimationFrame(V);return window.addEventListener("resize",V),window.addEventListener("scroll",U,!0),(O=window.visualViewport)==null||O.addEventListener("resize",V),(F=window.visualViewport)==null||F.addEventListener("scroll",V),()=>{var I,G;cancelAnimationFrame(K),window.removeEventListener("resize",V),window.removeEventListener("scroll",U,!0),(I=window.visualViewport)==null||I.removeEventListener("resize",V),(G=window.visualViewport)==null||G.removeEventListener("scroll",V)}},[e,t,n,g,u,R]),s.useLayoutEffect(()=>{if(!y||!k.current)return;if(i>0){if(L.current.height==null&&L.current.sigil===(u??""))return;L.current={sigil:u??""};const I=R();I&&!r6(y,I)&&b(I);return}const V=k.current,U=S.current,K=U?V.offsetHeight-U.clientHeight:V.offsetHeight,O=Eae(K,(U==null?void 0:U.scrollHeight)??0,Kp);if(!(O>0)||L.current.height===O&&L.current.sigil===(u??""))return;L.current={sigil:u??"",height:O};const F=R(O);!F||r6(y,F)||b(F)},[y,A,R,i,a.length,u]),s.useLayoutEffect(()=>{const V=U=>{U.isComposing||U.keyCode===229||(U.key==="ArrowDown"?(U.preventDefault(),m>=a.length-1?P():w(K=>K+1)):U.key==="ArrowUp"?(U.preventDefault(),w(K=>Math.max(0,K-1))):(U.key==="Enter"||U.key==="Tab")&&a[m]?(U.preventDefault(),a[m].run()):U.key==="Escape"&&(U.preventDefault(),p()))};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[a,m,p,P]),s.useEffect(()=>{const V=S.current,U=V==null?void 0:V.querySelector('[data-active="true"]');V&&U&&jae(V,U)},[m]),s.useEffect(()=>{const V=E.current,U=S.current;if(!V||!U)return;const K=new IntersectionObserver(O=>{U.scrollTop<=0||O.some(F=>F.isIntersecting)&&P()},{root:U,rootMargin:"0px 0px 8px 0px"});return K.observe(V),()=>K.disconnect()},[y,A,P]);const H=a[m]?`${I0}-opt-${m}`:null;if(s.useEffect(()=>(h==null||h(H),()=>h==null?void 0:h(null)),[H,h]),s.useEffect(()=>{const V=U=>{U.target.closest(".sc-cmd")||(z4(U),p())};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[p]),!y)return null;const D=`${I0}-list`,B=mae(u);return Br.createPortal(o.jsx("div",{className:"sc-cmd",id:I0,"data-shell":y.shell,style:{left:y.left,top:y.top,width:y.width,maxHeight:y.maxHeight,height:y.side==="above"&&i>0?y.maxHeight:void 0},ref:k,children:o.jsxs("div",{className:"sc-cmd-list",ref:S,role:"listbox","aria-label":B,id:D,children:[a.length?a.map((V,U)=>{var O;const K=U===0||V.group!==((O=a[U-1])==null?void 0:O.group);return o.jsxs("div",{children:[K&&o.jsx(TS,{name:V.group,total:l}),o.jsxs("button",{type:"button",id:`${I0}-opt-${U}`,className:"sc-cmd-row",role:"option","aria-selected":U===m,"data-active":U===m,onMouseEnter:()=>w(U),onMouseDown:F=>z4(F),onClick:()=>V.run(),children:[V.thumb?o.jsx("img",{src:V.thumb,alt:"","data-crop":V.crop}):V.swatch?o.jsx("span",{className:"sc-cmd-swatch",style:{background:V.swatch}}):null,o.jsx($ae,{text:V.label,query:r}),V.hint&&o.jsx("span",{className:"sc-cmd-hint",children:V.hint})]})]},V.key)}):o.jsxs(o.Fragment,{children:[o.jsx(TS,{name:B,total:l}),o.jsx("div",{className:"sc-cmd-empty",children:gae(u)})]}),i>0&&a.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"sc-cmd-count","aria-live":"polite",children:[a.length," of ",l]}),o.jsx("div",{ref:E,className:"sc-cmd-sentinel","aria-hidden":!0})]})]})}),document.body)}function TS({name:e,total:t}){return o.jsxs("div",{className:"sc-cmd-group",children:[e," ",o.jsx("span",{className:"sc-cmd-n",children:t})]})}function $ae({text:e,query:t}){return o.jsx("span",{className:"sc-cmd-label",children:yae(e,t).map(n=>n.hit?o.jsx("b",{children:n.text},`h:${n.text}`):o.jsx("span",{children:n.text},`t:${n.text}`))})}const Tae={fragrance:["Fragrance"],footwear:["Footwear"],apparel:["Apparel"],furniture:["Furniture","Home"],beauty:["Beauty"],electronics:["Electronics"],accessories:["Accessories"],beverage:["Food & drink"],jewelry:["Jewelry"],food:["Food & drink"]},Dae={fragrance:["Fragrance"],footwear:["Footwear","Apparel"],apparel:["Apparel"],furniture:["Furniture","Home"],beauty:["Beauty"],electronics:["Electronics"],accessories:["Accessories"],beverage:["Food & drink"],jewelry:["Jewelry"],food:["Food & drink"]};function Hae(e,t){if(!t)return!1;const n=Tae[t];return!!n&&n.some(r=>e.verticals.includes(r))}function Oae(e,t){if(!t)return!1;const n=Dae[t];return!!n&&n.some(r=>e.suitableCategories.includes(r))}function DS(e){return e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").replace(/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g,"").toLowerCase()}const Iae=4;function Ho(e,t){const n=DS(t).trim().split(/\s+/).filter(Boolean);if(!n.length)return!0;const r=DS(e);return n.every(a=>r.includes(a)||a.length>=Iae&&a.endsWith("s")&&r.includes(a.slice(0,-1)))}function Cy(e,t){return{visible:e.slice(0,t),remaining:Math.max(0,e.length-t)}}function nL(e,t){return[...e].sort((n,r)=>Number(t(r))-Number(t(n)))}function rL(e,t){if(e.t==="product"){const n=t.products.find(a=>a.id===e.id)??null,r=n?null:t.demoProducts.find(a=>a.id===e.id)??null;return{kind:"product",product:n,demo:r}}if(e.t==="character"){const n=t.cast.find(a=>a.id===e.id)??null,r=n?null:t.presenters.find(a=>a.id===e.id)??null;return{kind:"presenter",character:n,presenter:r}}if(e.t==="template"){const n=t.scenes.find(r=>r.id===e.id)??null;return{kind:"scene",scene:n,custom:!!n&&"custom"in n&&!!n.custom}}return null}const u1={product:"product",presenter:"presenter",scene:"scene"},fl=48;function Fae(e){return e?e.t==="product"?"product":e.t==="character"?"presenter":e.t==="template"?"scene":null:null}function zu(e){const t=Fae(e);return t||((e==null?void 0:e.t)==="color"?"color":null)}function _ae(e){const t=zu(e);return t||((e==null?void 0:e.t)==="ref"||(e==null?void 0:e.t)==="mark"?e.t:null)}function s6(e){return(e==null?void 0:e.t)==="ref"||(e==null?void 0:e.t)==="mark"?e.imageHash:null}const G0=e=>{const t=(e??"").trim();return t||void 0},HS=e=>(e==null?void 0:e.custom)===!0;function hl(e,t){return e==="product"?[...(t.libraryProducts.length?t.libraryProducts:t.brandProducts).map(r=>{var a,i;return OS(r,"brand",Vm((i=(a=r.shots)==null?void 0:a[0])==null?void 0:i.file,"tile"))}),...t.demoProducts.map(r=>OS(r,"catalog",r.previewUrl??null))]:e==="presenter"?[...t.presenters.map(n=>{const r=ki(n);return{kind:"presenter",id:n.id,label:n.name,full:[n.name,G0(n.descriptor)].filter(Boolean).join(" · "),sub:G0(n.descriptor),search:Wp(n),thumb:$n(r.src,"tile"),crop:r.crop,source:HS(n)?"brand":"catalog",recommended:Oae(n,t.productCategory),token:{t:"character",id:n.id}}}),...t.cast.map(n=>{const r=Kw(n);return{kind:"presenter",id:n.id,label:n.name,full:n.name,search:n.name,thumb:$n(r.src,"tile"),crop:r.crop,source:"brand",token:{t:"character",id:n.id}}})]:t.scenes.map(n=>({kind:"scene",id:n.id,label:El(n,"card"),full:El(n,"tooltip"),sub:G0(n.lighting),search:Up(n),thumb:$n(n.previewUrl??null,"tile"),tint:ud(n.previewColor),source:HS(n)?"brand":"catalog",recommended:Hae(n,t.productCategory),token:{t:"template",id:n.id}}))}function OS(e,t,n){return{kind:"product",id:e.id,label:Do(e,"chip"),full:Do(e,"tooltip"),sub:Vae(e),search:xy(e),thumb:n,source:t,token:{t:"product",id:e.id}}}function Vae(e){const t=e;return G0(t.brand)??G0(t.vendor)}function dd(e,t){const n=t.trim();return n?e.filter(r=>Ho(r.search,n)):e}function IS(e,t,n){return t.source==="brand"?0:e==="scene"?n.has(t.id)?1:t.recommended?2:3:e==="presenter"?t.recommended?1:2:1}function f2(e,t,n){const r=n.currentId?t.find(h=>h.id===n.currentId)??null:null,a=r?t.filter(h=>h.id!==r.id):t,l=[...dd(a,n.query)].sort((h,p)=>IS(e,h,n.bookmarked)-IS(e,p,n.bookmarked)).map(h=>n.bookmarked.has(h.id)?{...h,bookmarked:!0}:h),{visible:u,remaining:f}=Cy(l,n.shown??fl);return{current:r,items:u,remaining:f,total:l.length}}const Zae={$:"product","/":"scene","@":"presenter"},sL={Products:8,Presenters:8,Colors:16,Scenes:8},aL={$:"Products","/":"Scenes","@":"Presenters","#":"Colors"};function C0(e){return sL[aL[e??"$"]]}function oL(e){return{key:`${e.kind}:${e.id}`,group:e.kind==="presenter"?"Presenters":e.kind==="scene"?"Scenes":"Products",label:e.label,hint:e.sub,search:e.search,thumb:e.thumb??void 0,crop:e.crop,token:e.token}}function zae(e,t,n){return f2(e,t,{currentId:null,query:"",bookmarked:n,shown:t.length}).items.map(oL)}function FS(e,t){const{visible:n,remaining:r}=Cy(e,t);return{items:n,remaining:r,total:e.length}}function Bae(e,t,n={query:""}){const r=n.query.trim(),a=n.bookmarked??new Set,i=n.shown??sL[aL[e]];if(e==="#"){const h=(t.colors??[]).map(Uae),p=r?h.filter(g=>Ho(g.search??g.label,r)):h;return FS(p,i)}const l=Zae[e],u=l==="product"?t.products:l==="presenter"?t.presenters:t.scenes??[],f=r?dd(u,r).map(oL):zae(l,u,a);return FS(f,i)}function Uae(e){return{key:`color:${e.hex}`,group:"Colors",label:e.name,hint:e.hex,search:`${e.name} ${e.hex}`,swatch:e.hex,token:{t:"color",hex:e.hex,name:e.name||void 0}}}const Wae="(pointer: coarse)";function Kae(e){return Nr(la)?o.jsx(Jae,{...e}):o.jsx(Qae,{...e,onMove:void 0})}function Gae(){return!Nr(Wae)}const Yae=e=>`Remove ${u1[e]}`;function _S(e,t,n){const r={slug:t};return e==="product"?Ea(r,n):e==="presenter"?Ra(r,n):zr(r,n)}function iL({kind:e,currentId:t,candidates:n,brandId:r,brandSlug:a,warning:i,note:l,onPick:u,onRemove:f,onClose:h,onAttachRequest:p,onMove:g,views:m,autoFocusSearch:w}){const[y,b]=s.useState(""),[k,S]=s.useState(!1),E=async O=>{if(!(!m||k)){S(!0);try{await m.onPick(O)}finally{S(!1)}}},[C,A]=s.useState(fl),L=s.useRef(null),T=s.useRef(null),[M,j]=s.useState(0),P=s.useMemo(()=>e==="scene"?new Set(Ci(r)):new Set,[e,r]);s.useEffect(()=>{A(fl),j(0)},[y]);const R=s.useMemo(()=>f2(e,n,{currentId:t,query:y,bookmarked:P,shown:C}),[e,n,t,y,P,C]);s.useLayoutEffect(()=>{var O;w&&((O=L.current)==null||O.focus({preventScroll:!0}))},[w]),s.useEffect(()=>{j(O=>Math.max(0,Math.min(O,R.items.length-1)))},[R.items.length]);const H=s.useCallback(O=>{var I;const F=(I=T.current)==null?void 0:I.querySelectorAll("[data-nav]")[O];F&&(j(O),F.focus({preventScroll:!0}),F.scrollIntoView({block:"nearest"}))},[]),D=s.useCallback(()=>{const O=T.current;return O?Math.max(1,getComputedStyle(O).gridTemplateColumns.split(" ").filter(Boolean).length):1},[]),B=O=>{var z;if(O.key==="Escape"){O.preventDefault(),O.stopPropagation(),h("escape");return}const F=O.target===L.current;if(F&&O.key==="ArrowDown"){O.preventDefault(),H(0);return}if(F&&O.key==="Enter"){O.preventDefault(),R.items[0]&&u(R.items[0]);return}if(F)return;const I=D(),G=O.key==="ArrowRight"?1:O.key==="ArrowLeft"?-1:O.key==="ArrowDown"?I:O.key==="ArrowUp"?-I:0;if(G){O.preventDefault();const Y=M+G;Y<0&&G===-I?(z=L.current)==null||z.focus():Y>=0&&Y<R.items.length&&H(Y);return}O.key==="Home"?(O.preventDefault(),H(0)):O.key==="End"&&(O.preventDefault(),H(R.items.length-1))},V=u1[e],U=e==="product",K=!!R.current&&!!m&&m.options.length>1&&!y.trim();return o.jsxs("div",{className:"sc-swap-inner","data-sections":K||void 0,onKeyDown:B,children:[o.jsx("div",{className:"sc-swap-head",children:o.jsxs("span",{className:"sc-swap-search",children:[o.jsx(hd,{size:13}),o.jsx("input",{ref:L,type:"text",value:y,onChange:O=>b(O.target.value),placeholder:`Search ${V}s`,"aria-label":`Search ${V}s`,autoComplete:"off",spellCheck:!1})]})}),R.current&&!K&&o.jsxs("div",{className:"sc-swap-cur",title:R.current.full,children:[o.jsx(VS,{src:R.current.thumb,tinted:!!R.current.tint,crop:R.current.crop}),o.jsxs("span",{className:"sc-swap-curtext",children:[o.jsx("b",{dir:"auto",children:R.current.label}),R.current.sub&&o.jsx("span",{dir:"auto",children:R.current.sub})]}),o.jsx("a",{className:"sc-swap-open",href:_S(e,a,R.current.id),target:"_blank",rel:"noreferrer",title:`Open this ${V} in a new tab`,"aria-label":`Open ${R.current.label} in a new tab`,children:o.jsx(Ac,{size:14})}),o.jsx("span",{className:"sc-swap-tick","aria-hidden":!0,children:o.jsx(Kn,{size:11,weight:"bold"})})]}),o.jsxs("div",{className:"sc-swap-body",children:[K&&R.current&&m&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"sc-ap-sec",children:[o.jsx("span",{className:"sc-ap-sec-title",dir:"auto",children:R.current.label}),o.jsxs("a",{className:"sc-ap-sec-act sc-swap-sec-open",href:_S(e,a,R.current.id),target:"_blank",rel:"noreferrer","aria-label":`Open ${R.current.label} in a new tab`,children:["Open",o.jsx(Ac,{size:12})]})]}),o.jsxs("fieldset",{className:"sc-swap-this","aria-label":`${R.current.label}: the picture a shot follows`,"aria-busy":k||void 0,children:[o.jsx(qae,{views:m.options,on:!m.picked,disabled:k,onPress:()=>void E(null)}),m.options.map(O=>o.jsx(Xae,{option:O,on:m.picked===O.view,disabled:k,onPress:()=>void E(m.picked===O.view?null:O)},O.view))]}),o.jsx("div",{className:"sc-ap-sec sc-swap-sec-others",children:o.jsxs("span",{className:"sc-ap-sec-title",children:["Other ",V,"s",o.jsx("span",{className:"sc-ap-sec-n",children:R.total})]})})]}),R.items.length===0&&o.jsx("p",{className:"sc-swap-empty",children:y.trim()?`Nothing matches “${y.trim()}”.`:`No other ${V}s.`}),o.jsx("div",{className:"sc-swap-grid",ref:T,role:"listbox","aria-label":`Choose a ${V}`,children:R.items.map((O,F)=>o.jsxs("div",{className:"sc-swap-card",role:"option","aria-selected":!1,"data-nav":F,tabIndex:F===M?0:-1,title:O.full,style:O.tint?{"--tint":O.tint}:void 0,onFocus:()=>j(F),onClick:()=>u(O),onKeyDown:I=>{I.key!=="Enter"&&I.key!==" "||(I.preventDefault(),u(O))},children:[o.jsx(VS,{src:O.thumb,tinted:!!O.tint,crop:O.crop}),o.jsxs("b",{dir:"auto",children:[O.bookmarked&&o.jsxs(o.Fragment,{children:[o.jsx(eo,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Kept. "})]}),O.label]}),U&&O.sub&&o.jsx("span",{dir:"auto",children:O.sub}),e==="scene"&&o.jsx(jy,{})]},O.id))}),R.remaining>0&&o.jsxs("button",{type:"button",className:"sc-swap-more",onClick:()=>A(O=>O+fl),children:["Show ",Math.min(fl,R.remaining)," more of ",R.total]})]}),o.jsxs("div",{className:"sc-swap-foot",children:[t&&!R.current&&o.jsxs("p",{className:"sc-swap-warn",children:["This ",V," is no longer available."]}),l&&o.jsx("p",{className:"sc-chip-preview-note",children:l}),i&&o.jsx("p",{className:"sc-swap-warn",children:i}),i&&p&&e==="scene"&&o.jsxs("div",{className:"sc-swap-attach",children:[i.includes("product")&&o.jsx("button",{type:"button",className:"sc-btn",onClick:()=>p("Products"),children:"Attach a product"}),i.includes("person")&&o.jsx("button",{type:"button",className:"sc-btn",onClick:()=>p("Presenters"),children:"Attach a presenter"})]}),g&&o.jsxs("div",{className:"sc-swap-move",children:[o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>g(-1),children:[o.jsx(Rv,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>g(1),children:["Move later ",o.jsx(xa,{size:13})]})]}),f&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:f,children:[o.jsx(Nl,{size:13}),Yae(e)]})]})]})}function jy(){return o.jsxs("span",{className:"sc-ap-puck","aria-hidden":!0,children:[o.jsx(pr,{className:"sc-ap-puck-add",size:11,weight:"bold"}),o.jsx(Kn,{className:"sc-ap-puck-on",size:11,weight:"bold"}),o.jsx(jn,{className:"sc-ap-puck-off",size:11,weight:"bold"})]})}function qae({views:e,on:t,disabled:n,onPress:r}){const a=e.slice(0,4),i=e.length-3;return o.jsxs("button",{type:"button",className:"sc-ap-card","data-on":t?"":void 0,"data-whole":"","aria-pressed":t,disabled:n,onClick:r,children:[o.jsx("span",{className:"sc-ap-thumb sc-swap-mosaic","data-count":a.length,children:a.map((l,u)=>o.jsxs("span",{className:"sc-swap-cut","data-more":u===3&&i>0?"":void 0,children:[o.jsx("img",{src:$n(l.thumb,"micro"),alt:"",loading:"lazy"}),u===3&&i>0&&o.jsxs("span",{className:"sc-swap-cut-more",children:["+",i]})]},l.view))}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:"Whole scene"})}),o.jsx(jy,{})]})}function Xae({option:e,on:t,disabled:n,onPress:r}){return o.jsxs("button",{type:"button",className:"sc-ap-card","data-on":t?"":void 0,"aria-pressed":t,disabled:n,onClick:r,children:[o.jsx("span",{className:"sc-ap-thumb",children:o.jsx("img",{src:$n(e.thumb,"small"),alt:"",loading:"lazy"})}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:e.name})}),o.jsx(jy,{})]})}function VS({src:e,tinted:t,crop:n}){const[r,a]=s.useState(!1);return s.useEffect(()=>a(!1),[e]),!e||r?o.jsx("span",{className:"sc-swap-thumb sc-swap-thumb-empty",children:o.jsx(Ta,{size:18})}):o.jsx("img",{className:"sc-swap-thumb","data-tinted":t||void 0,"data-crop":n,src:e,alt:"",loading:"lazy",onError:()=>a(!0)})}function Qae(e){const{anchor:t,kind:n,onClose:r}=e,a=Gae(),[i,l]=s.useState(null),u=s.useRef(null);return s.useLayoutEffect(()=>{var h,p;const f=()=>{const g=window.visualViewport,m=Ey(t.getBoundingClientRect(),{width:(g==null?void 0:g.width)??window.innerWidth,height:(g==null?void 0:g.height)??window.innerHeight},n==="scene"?{maxHeight:aae}:void 0);if(!m){r("outside");return}l(m)};return f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),(h=window.visualViewport)==null||h.addEventListener("resize",f),(p=window.visualViewport)==null||p.addEventListener("scroll",f),()=>{var g,m;window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),(g=window.visualViewport)==null||g.removeEventListener("resize",f),(m=window.visualViewport)==null||m.removeEventListener("scroll",f)}},[t,r]),s.useEffect(()=>{const f=h=>{var g;const p=h.target;(g=u.current)!=null&&g.contains(p)||t.contains(p)||r("outside")};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r,t]),i?Br.createPortal(o.jsx("div",{ref:u,className:"sc-swap","data-kind":n,"data-side":i.side,role:"dialog","aria-label":`Change ${u1[n]}`,style:qP(i),children:o.jsx(iL,{...e,autoFocusSearch:a})}),document.body):null}function Jae(e){const{kind:t,onClose:n}=e,{sheet:r,grip:a}=$d(()=>n("dismiss"));return o.jsx(Ml,{open:!0,onOpenChange:i=>!i&&n("dismiss"),children:o.jsxs(Rl,{children:[o.jsx(Pl,{className:"sc-shotsheet-scrim"}),o.jsxs(Ll,{ref:r,className:"sc-shotsheet sc-swapsheet","data-kind":t,"aria-describedby":void 0,onOpenAutoFocus:i=>{var l;i.preventDefault(),(l=r.current)==null||l.focus({preventScroll:!0})},onCloseAutoFocus:i=>i.preventDefault(),onEscapeKeyDown:i=>{i.preventDefault(),n("escape")},children:[o.jsxs("div",{className:"sc-shotsheet-grip",...a,children:[o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0}),o.jsxs($l,{className:"sc-vh",children:["Change ",u1[t]]})]}),o.jsx(iL,{...e,autoFocusSearch:!1})]})]})})}const eoe=260;function toe(e){return Nr(la)?o.jsx(roe,{...e}):o.jsx(noe,{...e,onMove:void 0})}function Pu(e,t){const n=e?ur(e):null,r=t?ur(t):null;return!!n&&n===r}function lL({currentHex:e,currentName:t,palette:n,onPick:r,onRemove:a,onClose:i,onMove:l}){const u=s.useMemo(()=>{const S=new Set,E=[],C=L=>{const T=ur(L.hex);!T||S.has(T)||(S.add(T),E.push({...L,hex:T}))},A=e?ur(e):null;A&&!n.some(L=>Pu(L.hex,A))&&C({hex:A,name:t||A,slot:"accent"});for(const L of n)C(L);return E},[n,e,t]),f=s.useRef(null),[h,p]=s.useState(()=>Math.max(0,u.findIndex(S=>Pu(S.hex,e))));s.useEffect(()=>{p(S=>Math.max(0,Math.min(S,Math.max(0,u.length-1))))},[u.length]),s.useLayoutEffect(()=>{var E,C;const S=Math.max(0,u.findIndex(A=>Pu(A.hex,e)));(C=(E=f.current)==null?void 0:E.querySelectorAll("[data-nav]")[S])==null||C.focus({preventScroll:!0})},[]);const g=s.useCallback(S=>{var C;const E=(C=f.current)==null?void 0:C.querySelectorAll("[data-nav]")[S];E&&(p(S),E.focus({preventScroll:!0}))},[]),m=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),i("escape");return}if(S.key==="ArrowDown"||S.key==="ArrowUp"){S.preventDefault();const E=h+(S.key==="ArrowDown"?1:-1);E>=0&&E<u.length&&g(E)}},w=S=>r({t:"color",hex:S.hex,name:S.name||void 0}),y=(S,E)=>{const C=u.find(A=>Pu(A.hex,S));r({t:"color",hex:S,name:(C==null?void 0:C.name)||void 0},{live:!0})},b=e?ur(e):null,k=!!b&&!n.some(S=>Pu(S.hex,b));return o.jsxs("div",{className:"sc-swap-inner",onKeyDown:m,children:[o.jsx("div",{className:"sc-swap-body",children:u.length===0?o.jsx("p",{className:"sc-swap-empty",children:"No brand colours yet."}):o.jsx("div",{className:"sc-swap-swatches",ref:f,role:"listbox","aria-label":"Choose a colour",children:u.map((S,E)=>{const C=Pu(S.hex,e),A=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-swap-dot",style:{background:S.hex},"aria-hidden":!0}),o.jsx("b",{dir:"auto",children:S.name}),o.jsx("span",{children:S.hex}),C&&o.jsx("span",{className:"sc-swap-tick","aria-hidden":!0,children:o.jsx(Kn,{size:11,weight:"bold"})})]});return k&&C?o.jsx(bd,{className:"sc-swap-swatch",triggerStyle:{background:"none"},value:S.hex,presets:n.map(L=>L.hex),commitMode:"live",align:"start",label:`Edit ${S.name}`,triggerProps:{role:"option","aria-selected":!0,"data-on":"","data-nav":E,tabIndex:E===h?0:-1,title:`${S.name} ${S.hex}`,onFocus:()=>p(E)},onChange:L=>y(L),children:A},"current-custom"):o.jsx("div",{className:"sc-swap-swatch",role:"option","aria-selected":C,"data-on":C||void 0,"data-nav":E,tabIndex:E===h?0:-1,title:`${S.name} ${S.hex}`,onFocus:()=>p(E),onClick:()=>w(S),onKeyDown:L=>{L.key!=="Enter"&&L.key!==" "||(L.preventDefault(),w(S))},children:A},S.hex)})})}),o.jsxs("div",{className:"sc-swap-foot",children:[o.jsxs(bd,{className:"sc-swap-swatch sc-swap-custom",triggerStyle:{background:"none"},value:e??n2(n),presets:n.map(S=>S.hex),commitMode:"live",align:"start",label:"Custom colour",onChange:S=>y(S),children:[o.jsx(pr,{size:12}),o.jsx("b",{children:"Custom colour"})]}),l&&o.jsxs("div",{className:"sc-swap-move",children:[o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>l(-1),children:[o.jsx(Rv,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>l(1),children:["Move later ",o.jsx(xa,{size:13})]})]}),a&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:a,children:[o.jsx(Nl,{size:13}),"Remove colour"]})]})]})}function noe(e){const{anchor:t,onClose:n}=e,[r,a]=s.useState(null),i=s.useRef(null);return s.useLayoutEffect(()=>{var u,f;const l=()=>{const h=window.visualViewport,p=Ey(t.getBoundingClientRect(),{width:(h==null?void 0:h.width)??window.innerWidth,height:(h==null?void 0:h.height)??window.innerHeight},{width:eoe});if(!p){n("outside");return}a(p)};return l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),(u=window.visualViewport)==null||u.addEventListener("resize",l),(f=window.visualViewport)==null||f.addEventListener("scroll",l),()=>{var h,p;window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0),(h=window.visualViewport)==null||h.removeEventListener("resize",l),(p=window.visualViewport)==null||p.removeEventListener("scroll",l)}},[t,n]),s.useEffect(()=>{const l=u=>{var h,p;const f=u.target;(h=i.current)!=null&&h.contains(f)||t.contains(f)||(p=f.closest)!=null&&p.call(f,".sc-cp")||n("outside")};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n,t]),r?Br.createPortal(o.jsx("div",{ref:i,className:"sc-swap","data-kind":"color","data-side":r.side,role:"dialog","aria-label":"Change colour",style:qP(r),children:o.jsx(lL,{...e})}),document.body):null}function roe(e){const{onClose:t}=e,{sheet:n,grip:r}=$d(()=>t("dismiss"));return o.jsx(Ml,{open:!0,onOpenChange:a=>!a&&t("dismiss"),children:o.jsxs(Rl,{children:[o.jsx(Pl,{className:"sc-shotsheet-scrim"}),o.jsxs(Ll,{ref:n,className:"sc-shotsheet sc-swapsheet","data-kind":"color","aria-describedby":void 0,onOpenAutoFocus:a=>{var i;a.preventDefault(),(i=n.current)==null||i.focus({preventScroll:!0})},onCloseAutoFocus:a=>a.preventDefault(),onEscapeKeyDown:a=>{a.preventDefault(),t("escape")},children:[o.jsxs("div",{className:"sc-shotsheet-grip",...r,children:[o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0}),o.jsx($l,{className:"sc-vh",children:"Change colour"})]}),o.jsx(lL,{...e})]})]})})}function d1(e){const{brand:t,products:n}=cn(),{scenes:r,presenters:a,demoProducts:i}=Nn(),l=s.useMemo(()=>$p(Qc(t),r),[t,r]),u=s.useMemo(()=>$p(s1(t),a),[t,a]),f=s.useMemo(()=>{var p;return(((p=t==null?void 0:t.json)==null?void 0:p.characters)??[]).filter(g=>(g==null?void 0:g.origin)!=="custom")},[t]),h=s.useMemo(()=>{var p;return pf(((p=t==null?void 0:t.json)==null?void 0:p.products)??[])},[t]);return s.useMemo(()=>({libraryProducts:WM(n),brandProducts:h,demoProducts:i,presenters:u,cast:f,scenes:l,productCategory:e??null}),[n,h,i,u,f,l,e])}const j0=new Map,soe=64;function cL(e){let t=j0.get(e);if(!t)for(t=ooe(e).then(n=>n?ioe(n.data,4):null).catch(()=>null),j0.set(e,t);j0.size>soe;)j0.delete(j0.keys().next().value);return t}function aoe(e,t){cL(t).then(n=>{const r=ud(n??void 0);!r||!e.isConnected||(e.dataset.tinted="true",e.style.setProperty("--tint",r))})}async function ooe(e){const t=new Image;t.decoding="async",t.src=e;try{await t.decode()}catch{return null}const n=Math.min(1,48/Math.max(t.naturalWidth,t.naturalHeight,1)),r=Math.max(1,Math.round(t.naturalWidth*n)),a=Math.max(1,Math.round(t.naturalHeight*n)),i=document.createElement("canvas");i.width=r,i.height=a;const l=i.getContext("2d",{willReadFrequently:!0});if(!l)return null;l.drawImage(t,0,0,r,a);try{return l.getImageData(0,0,r,a)}catch{return null}}function ioe(e,t){const n=Array.from({length:24},()=>({score:0,r:0,g:0,b:0}));for(let a=0;a+t-1<e.length;a+=t){if(e[a+3]<128)continue;const i=e[a],l=e[a+1],u=e[a+2],{h:f,s:h,l:p}=loe(i,l,u);if(h<.18||p<.12||p>.92)continue;const g=h*(1-Math.abs(p-.5)*1.2),m=n[Math.min(23,Math.floor(f/360*24))];m.score+=g,m.r+=i*g,m.g+=l*g,m.b+=u*g}const r=n.reduce((a,i)=>i.score>a.score?i:a,n[0]);return r.score<=0?null:coe(r.r/r.score,r.g/r.score,r.b/r.score)}function loe(e,t,n){const r=e/255,a=t/255,i=n/255,l=Math.max(r,a,i),u=Math.min(r,a,i),f=(l+u)/2;if(l===u)return{h:0,s:0,l:f};const h=l-u,p=f>.5?h/(2-l-u):h/(l+u);let g;return l===r?g=((a-i)/h+(a<i?6:0))*60:l===a?g=((i-r)/h+2)*60:g=((r-a)/h+4)*60,{h:g,s:p,l:f}}function coe(e,t,n){const r=a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function h2(e){const{libraryTick:t}=Nn(),n=s.useRef(t),r=s.useRef(e);r.current=e,s.useEffect(()=>{t!==n.current&&(n.current=t,r.current())},[t])}const ZS=["hero","place","close","hands","angle","bold"],zS=e=>[...e].sort((t,n)=>ZS.indexOf(t.view)-ZS.indexOf(n.view));function uoe(e){const t=e&&e.custom?e:null,n=e&&!t?e.id:null,[r,a]=s.useState(null);if(s.useEffect(()=>{if(!n)return;let i=!0;return Ee.sceneFrames(n).then(l=>{if(!i)return;const u=l.views.map(f=>({view:f.view,name:bc[f.view],thumb:f.url,hash:null}));a({id:n,views:u})}).catch(()=>{}),()=>{i=!1}},[n]),h2(()=>{if(!n)return;const i=n;Ee.sceneFrames(i).then(l=>{const u=l.views.map(f=>({view:f.view,name:bc[f.view],thumb:f.url,hash:null}));a(f=>f&&f.id!==i?f:xi(f,{id:i,views:u}))}).catch(()=>{})}),t){const i=[];t.placeUrl&&t.previewHash&&i.push({view:"place",name:bc.place,thumb:t.placeUrl,hash:t.previewHash});for(const l of t.examples??[])i.push({view:l.role,name:bc[l.role],thumb:l.url,hash:l.hash});return zS(i)}return r&&r.id===n?zS(r.views):[]}function doe(e){return!e||e.cap==null||e.cap<=0?null:e.cap}function foe(e){const t=new Set;if(!e||e.cap==null||e.cap<=0)return t;const n=new Set(e.attachments.map(r=>vc(r.role,r.id??r.hash)));for(const r of e.dropped){const a=vc(r.role,r.id??r.hash);r.reason!=="missing"&&!n.has(a)&&t.add(a)}return t}const vc=(e,t)=>`${e}:${t}`,F0=new Set(["product","character","ref","mark","template"]),Gp=12,X4=`Shot is full: ${Gp} identities. Remove one to add another.`,Yr=[{id:"square",label:"Square",hint:"1:1",w:1024,h:1024},{id:"portrait",label:"Portrait",hint:"4:5",w:1024,h:1280},{id:"story",label:"Story",hint:"9:16",w:1080,h:1920},{id:"landscape",label:"Landscape",hint:"16:9",w:1600,h:900}];function gi(e){const t=Yr.find(n=>n.id===e);return t?t.w/t.h:1}function hoe(e,t=0){var i,l;const n=Yr.find(u=>u.id===(e==null?void 0:e.format));if(n)return n.id;const r=(l=(i=e==null?void 0:e.rendered)==null?void 0:i.sizes)==null?void 0:l[t];if(!r||!(r[0]>0)||!(r[1]>0))return;const a=Math.log(r[0]/r[1]);return Yr.reduce((u,f)=>Math.abs(Math.log(f.w/f.h)-a)<Math.abs(Math.log(u.w/u.h)-a)?f:u).id}const Fh=6,poe=s.forwardRef(function({initialTokens:t,onChange:n,brand:r,templates:a,presenters:i,demoProducts:l,onTemplatePick:u,scenesSitOut:f,placeholder:h,placeholderSm:p,label:g="Brief",flag:m,described:w,describedNote:y,onInspect:b,activeProductCategory:k,onAttachRequest:S,onSubmit:E,onDropFiles:C},A){var Lt,Ut,At,_t,Ae,Ve,Je;const L=s.useRef(null),T=s.useRef(null),M=s.useId(),[j,P]=s.useState(""),R=s.useCallback(_=>{P(""),requestAnimationFrame(()=>P(_))},[]),H=s.useRef(null),[D,B]=s.useState(null),[V,U]=s.useState(null),K=Id(),{shown:O,closeNow:F}=K,I=s.useRef(V);s.useEffect(()=>{I.current=V},[V]);const G=s.useRef(m);s.useEffect(()=>{G.current=m},[m]);const[z,Y]=s.useState(""),[Z,ee]=s.useState(C0("$")),[pe,se]=s.useState(null),xe=s.useRef(!1),J=s.useRef(0),[te,X]=s.useState(!1),ae=s.useRef(0),{products:Le}=cn(),ce=Le.length?Le:((Lt=r.json)==null?void 0:Lt.products)??[],Se=((Ut=r.json)==null?void 0:Ut.characters)??[],Ze=s.useMemo(()=>r1(r.json),[r]),gt=s.useCallback((_,fe)=>{var Qn,dn,mr;const we=document.createElement("span");we.className=pc,we.contentEditable="false",we.dir="ltr",we.dataset.kind=_.t,we.dataset.tok=a2(_),we.dataset.uid=fe??`u${J.current++}`;let Ue="",Me=null,ct,Ot=null;const zt=rL(_,{products:ce,demoProducts:l,cast:Se,presenters:i,scenes:a});if((zt==null?void 0:zt.kind)==="scene"){const Kt=zt.scene;Ue=Kt?El(Kt,"chip"):"missing template",Me=$n((Kt==null?void 0:Kt.previewUrl)??null,"micro"),Kt&&_.t==="template"&&_.view&&(Me=gn(_.view,"micro"),_.viewName&&(Ue=`${Ue} · ${_.viewName}`));const wr=ud(Kt==null?void 0:Kt.previewColor);wr&&(we.dataset.tinted="true",we.style.setProperty("--tint",wr)),!wr&&Me&&zt.custom&&aoe(we,Me)}else if((zt==null?void 0:zt.kind)==="product"){const Kt=zt.product??zt.demo;Ue=Kt?Do(Kt,"chip"):"missing product",Me=zt.product?Vm((dn=(Qn=zt.product.shots)==null?void 0:Qn[0])==null?void 0:dn.file,"micro"):$n(((mr=zt.demo)==null?void 0:mr.previewUrl)??null,"micro")}else if((zt==null?void 0:zt.kind)==="presenter"){const{character:Kt,presenter:wr}=zt;Ue=(Kt==null?void 0:Kt.name)??(wr==null?void 0:wr.name)??"missing person";const Hr=Kt?Kw(Kt):wr?ki(wr):{src:null};Me=$n(Hr.src,"micro"),ct=Hr.crop}else if(_.t==="color")Ue=_.name??_.hex,Ot=_.hex;else if(_.t==="ref")Ue=_.label??"Image",Me=gn(_.imageHash,"micro");else if(_.t==="mark"){const Kt=Ze.find(wr=>wr.hash===_.imageHash);Ue=Kt?qm(r.json,Kt):"missing mark",Me=gn(_.imageHash,"micro")}if(Ue.startsWith("missing ")&&(we.dataset.missing=""),Me){const Kt=document.createElement("img");Kt.src=Me,Kt.alt="",ct&&(Kt.dataset.crop=ct),Kt.onerror=()=>Kt.remove(),we.appendChild(Kt)}else if(Ot){const Kt=document.createElement("span");Kt.className="sc-token-swatch",Kt.style.background=Ot,we.appendChild(Kt)}const Rt=document.createElement("span");Rt.className="sc-token-label",Rt.dir="auto",Rt.textContent=Ue,we.appendChild(Rt);const kn=(m==null?void 0:m(_))??null;kn&&(we.title=kn,_.t!=="template"&&(we.dataset.warn="1")),w!=null&&w(_)&&(we.dataset.described="1");const Jt=zu(_);if(Jt){const Kt=Jt==="color"?"colour":u1[Jt];we.tabIndex=-1,we.setAttribute("role","button"),we.setAttribute("aria-haspopup","dialog"),we.setAttribute("aria-expanded","false"),we.setAttribute("aria-label",`${Kt}: ${Ue}. Change or remove.`)}else we.tabIndex=-1,we.setAttribute("role","button"),we.setAttribute("aria-haspopup","dialog"),we.setAttribute("aria-expanded","false"),we.setAttribute("aria-label",`${_.t==="mark"?"brand mark":"reference image"}: ${Ue}. Open, remove or move.`);we.setAttribute("aria-keyshortcuts","Alt+ArrowLeft Alt+ArrowRight"),we.setAttribute("aria-describedby",M),we.setAttribute("draggable","false");const Sn=document.createElement("button");return Sn.type="button",Sn.tabIndex=-1,Sn.setAttribute("aria-hidden","true"),Sn.dataset.role="remove",Sn.appendChild(Hte()),we.appendChild(Sn),we},[a,ce,Se,i,l,Ze,r,m,w,M]),Ke=s.useCallback(()=>{const _=L.current;_&&n(Nk(_))},[n]);s.useEffect(()=>{const _=L.current;_&&(Mk(_,t!=null&&t.length?t:ti(),fe=>gt(fe)),H0(_))},[]);const nt=s.useCallback((_,fe)=>{var Me;const we=L.current,Ue=we==null?void 0:we.querySelector(`[data-uid="${CSS.escape(_)}"]`);if(we&&Ue&&$k(we,Ue,fe)){xc(we,Ue,"after");const ct=ko(we);ct!==null&&(H.current=ct,((Me=I.current)==null?void 0:Me.uid)===_&&(I.current={...I.current,caret:ct}),U(Ot=>Ot&&Ot.uid===_?{...Ot,caret:ct}:Ot)),Ke(),R(Z4(we,Ue))}},[Ke,R]);s.useEffect(()=>{const _=L.current;if(_)return tae(_,{onDragStart:()=>{B(null),Y(""),F()},onMoved:(fe,we)=>{Ke(),R(we)},onCancelled:()=>R("Reorder cancelled.")})},[Ke,R,F]),s.useEffect(()=>{const _=L.current;if(_)for(const fe of _.querySelectorAll(`.${pc}`)){const we=ks(fe.dataset.tok??"");if(!we)continue;const Ue=(m==null?void 0:m(we))??null;Ue&&we.t!=="template"?fe.dataset.warn="1":delete fe.dataset.warn,w!=null&&w(we)?fe.dataset.described="1":delete fe.dataset.described,Ue&&!("open"in fe.dataset)?fe.title=Ue:fe.removeAttribute("title")}},[m,w]),s.useEffect(()=>{const _=()=>{const fe=ko(L.current);fe!==null&&(H.current=fe)};return document.addEventListener("selectionchange",_),()=>document.removeEventListener("selectionchange",_)},[]);const $e=s.useCallback(_=>{const fe=L.current;if(!fe)return;if(_.t==="template"){const ct=y0(fe);if(ct){ct.replaceWith(gt(_,ct.dataset.uid)),Eo(fe),Ke(),B(null),Y("");return}}const we=Qa(_);if(we){const ct=_8(fe,we);if(ct){B(null),Y(""),R(`${ni(ct)||"That"} is already in the brief.`);return}}if(F0.has(_.t)&&!(_.t==="template"&&y0(fe))&&Array.from(fe.querySelectorAll(`.${pc}`)).filter(Ot=>F0.has(Ot.dataset.kind??"")).length>=Gp){B(null),Y(""),R(X4);return}mte(fe,gt(_),{eatQuery:!!D,fallbackUnits:H.current});const Me=ko(fe);Me!==null&&(H.current=Me),Ke(),B(null),Y("")},[D,gt,Ke,R]),ne=s.useRef($e);s.useEffect(()=>{ne.current=$e},[$e]);const Q=s.useCallback((_,fe)=>{const we=L.current,Ue=we==null?void 0:we.querySelector(`[data-uid="${CSS.escape(_)}"]`);return!we||!Ue?!1:(Ue.replaceWith(gt(fe,_)),Eo(we),Ke(),!0)},[gt,Ke]),We=s.useCallback(_=>{const fe=L.current,we=fe==null?void 0:fe.querySelector(`[data-uid="${CSS.escape(_)}"]`);if(!fe||!we)return null;const Ue=so(fe,we);return V8(fe,we),Ke(),Ue},[Ke]),Ne=()=>{var _;return document.documentElement.dataset.guideTask==="first-shot"&&!!((_=L.current)!=null&&_.closest('[data-guide="compose"]'))},ie=(_,fe)=>{var ct;const we=[..._.querySelectorAll(".sc-token")];if(!we.length)return!1;const[Ue]=((ct=fe.getTargetRanges)==null?void 0:ct.call(fe))??[];if(!Ue)return!1;const Me=document.createRange();return Me.setStart(Ue.startContainer,Ue.startOffset),Me.setEnd(Ue.endContainer,Ue.endOffset),we.some(Ot=>Me.intersectsNode(Ot))},q=s.useRef(We);s.useEffect(()=>{q.current=We},[We]),s.useEffect(()=>{const _=L.current;if(!_)return;const fe=we=>{if(we.inputType.startsWith("delete")&&Ne()&&ie(_,we))return we.preventDefault();const Ue=we.inputType==="deleteContentBackward"?"Backspace":we.inputType==="deleteContentForward"?"Delete":null;if(!Ue)return;const Me=Pk(_,Ue);if(!(Me!=null&&Me.dataset.uid)){Lk(_,Ue)&&we.preventDefault();return}we.preventDefault();const ct=q.current(Me.dataset.uid);ct!=null&&Ka(_,ct)};return _.addEventListener("beforeinput",fe),()=>_.removeEventListener("beforeinput",fe)},[]);const oe=s.useCallback(_=>{const fe=ks(_.dataset.tok??"");if(!fe||fe.t!=="ref"&&fe.t!=="mark")return!1;const we=L.current,Ue=we?ko(we):null;return Ue!=null&&(H.current=Ue),F(),b==null||b({src:Tr(fe.imageHash),kind:fe.t,label:fe.t==="mark"?ni(_):null}),!0},[b,F]),Re=s.useCallback((_,fe,we,Ue)=>{const Me=_.dataset.uid;Me&&(F(),_.dataset.open="",_.hasAttribute("aria-haspopup")&&_.setAttribute("aria-expanded","true"),_.removeAttribute("title"),B(null),Y(""),U({uid:Me,kind:fe,anchor:_,caret:we,touch:Ue}))},[F]),ze=s.useCallback((_,fe)=>{var Ot;const we=I.current;if(I.current=null,U(null),!we)return;const Ue=L.current,Me=Ue==null?void 0:Ue.querySelector(`[data-uid="${CSS.escape(we.uid)}"]`);if(Me){delete Me.dataset.open,Me.hasAttribute("aria-haspopup")&&Me.setAttribute("aria-expanded","false");const zt=ks(Me.dataset.tok??""),Rt=zt?((Ot=G.current)==null?void 0:Ot.call(G,zt))??null:null;Rt&&(Me.title=Rt)}const ct=fe!==void 0?fe:we.caret;if(we.touch){ct!=null&&(H.current=ct);return}Ue&&(Ue.focus({preventScroll:!0}),ct!=null?Ka(Ue,ct):mc(Ue))},[]);s.useEffect(()=>{if(!V)return;const _=L.current;_!=null&&_.querySelector(`[data-uid="${CSS.escape(V.uid)}"]`)||ze("outside")},[V,ze]),s.useEffect(()=>{var _;O&&((_=L.current)!=null&&_.contains(O.anchor)||F())},[O,F]),s.useEffect(()=>{const _=O==null?void 0:O.anchor;if(!_)return;_.dataset.open="";const fe=_.getAttribute("title");return fe&&_.removeAttribute("title"),()=>{delete _.dataset.open,fe&&_.setAttribute("title",fe)}},[O]),s.useImperativeHandle(A,()=>({insert:_=>ne.current(_),setTokens:_=>{const fe=L.current;fe&&(Mk(fe,_.length?_:ti(),we=>gt(we)),H0(fe),n(Nk(fe)))},removeTemplate:()=>{const _=L.current,fe=_?y0(_):null;!_||!fe||(V8(_,fe),Ke())},remove:_=>{const fe=L.current;if(!fe)return;const we=_8(fe,Qa(_));we&&(V8(fe,we),Ke())},openMenu:_=>{Y(""),ee(C0("$")),B({anchor:_})},focus:()=>mc(L.current),restoreCaret:()=>{const _=L.current;if(!_)return;_.focus({preventScroll:!0});const fe=H.current;fe!=null?Ka(_,fe):mc(_)}}));const Ye=d1(k),Ie=s.useCallback(_=>hl(_,Ye),[Ye]),De=s.useMemo(()=>new Set(Ci(r.id)),[r.id]),Ge=s.useMemo(()=>{var _;return D?Bae(D.sigil??"$",{products:hl("product",Ye),presenters:hl("presenter",Ye),scenes:f?[]:hl("scene",Ye),colors:ra((_=r.json)==null?void 0:_.palette)},{query:z,bookmarked:De,shown:Z}):{items:[],remaining:0,total:0}},[D,Ye,z,De,Z,f,(At=r.json)==null?void 0:At.palette]),ft=s.useMemo(()=>Ge.items.map(_=>({..._,run:()=>_.token.t==="template"?u(_.token.id):ne.current(_.token)})),[Ge.items,u]),bt=s.useCallback(()=>{Ge.remaining<=0||ee(_=>_+C0(D==null?void 0:D.sigil))},[Ge.remaining,D==null?void 0:D.sigil]),at=_=>{const fe=L.current,we=_.target;if(we.closest('[data-role="remove"]')){if(_.preventDefault(),Ne())return;const Rt=nl(we);V&&(Rt==null?void 0:Rt.dataset.uid)===V.uid&&ze("remove"),Rt!=null&&Rt.dataset.uid&&We(Rt.dataset.uid),B(null);return}const Ue=nl(we),Me=Ue==null?void 0:Ue.getBoundingClientRect();if(!(!!Ue&&!!Me&&_.clientX-Me.left>Fh&&Me.right-_.clientX>Fh)){if(ute(fe))return;Rk(fe,_.clientX,_.clientY);return}Rk(fe,_.clientX,_.clientY);const Ot=Ue.dataset.uid??null;if(Ot&&(V==null?void 0:V.uid)===Ot){_.detail!==0&&ze("outside");return}const zt=zu(ks(Ue.dataset.tok??""));if(!zt){oe(Ue);return}Re(Ue,zt,ko(fe),!1)},Zt=_=>{if(_.pointerType!=="mouse")return;const fe=L.current;if(V||D||fe&&"chipDrag"in fe.dataset)return;const we=nl(_.target),Ue=we==null?void 0:we.dataset.uid;if(!we||!Ue||!jt(we)){K.close();return}if((O==null?void 0:O.uid)===Ue){K.keep();return}K.open({uid:Ue,anchor:we})},jt=_=>{const fe=ks(_.dataset.tok??"");if(s6(fe))return!0;const we=zu(fe);return!!(we&&we!=="color"&&fp(we)&&_.querySelector("img"))},Ft=_=>{const fe=nl(_.target),we=fe==null?void 0:fe.dataset.uid;!fe||!we||V||D||jt(fe)&&Xm(fe)&&K.open({uid:we,anchor:fe})},Pt=_=>{if(_.pointerType==="mouse")return;const fe=_.target;if(fe.closest('[data-role="remove"]'))return;const we=nl(fe);if(!we)return;const Ue=we.getBoundingClientRect();if(_.clientX-Ue.left<=Fh||Ue.right-_.clientX<=Fh)return;const Me=_ae(ks(we.dataset.tok??""));if(!Me||we.dataset.uid&&(V==null?void 0:V.uid)===we.dataset.uid)return;_.preventDefault();const ct=L.current,Ot=document.activeElement===ct,zt=Ot?ko(ct):H.current;Ot&&(ct==null||ct.blur()),Re(we,Me,zt,!0)},Tt=_=>{const fe=L.current,we=nl(_.target);if(we&&!V){const Ue=()=>{xc(fe,we,"after"),fe==null||fe.focus({preventScroll:!0})};if(_.altKey&&(_.key==="ArrowLeft"||_.key==="ArrowRight")){_.preventDefault(),fe&&$k(fe,we,_.key==="ArrowLeft"?-1:1)&&(we.focus({preventScroll:!0}),Ke(),R(Z4(fe,we)));return}if(_.key==="ArrowLeft"||_.key==="ArrowRight"){_.preventDefault(),xc(fe,we,_.key==="ArrowLeft"?"before":"after"),fe==null||fe.focus({preventScroll:!0});return}if(_.key==="Tab"){_.preventDefault(),xc(fe,we,_.shiftKey?"before":"after"),fe==null||fe.focus({preventScroll:!0});return}if(_.key==="Enter"||_.key===" "){_.preventDefault();const Me=zu(ks(we.dataset.tok??""));Me&&fe?Re(we,Me,so(fe,we)+1,!1):oe(we);return}if(_.key==="Backspace"||_.key==="Delete"){if(_.preventDefault(),Ne())return;const Me=we.dataset.uid?We(we.dataset.uid):null;fe==null||fe.focus({preventScroll:!0}),Me!=null&&Ka(fe,Me);return}if(_.key==="Escape"){_.preventDefault(),Ue();return}}if(_.key==="Escape"&&D){_.preventDefault(),B(null),Y("");return}if(_.key==="Enter"&&!_.shiftKey){const Ue=_.defaultPrevented;_.preventDefault(),vae({menuOpen:!!D,handled:Ue})&&E();return}if(!(D||V)&&!pae(_)){if(_.key==="Tab"&&!_.altKey&&!_.metaKey&&!_.ctrlKey){const Ue=xte(fe,_.shiftKey?"back":"forward");Ue&&(_.preventDefault(),Ue.focus({preventScroll:!0}));return}if(!_.shiftKey&&!_.altKey&&!_.metaKey&&!_.ctrlKey){if(_.key==="ArrowLeft"||_.key==="ArrowRight"){bte(fe,_.key==="ArrowLeft"?"left":"right")&&_.preventDefault();return}if(_.key==="Backspace"||_.key==="Delete"){const Ue=Pk(fe,_.key);if(Ue!=null&&Ue.dataset.uid){if(_.preventDefault(),Ne())return;const Me=We(Ue.dataset.uid);Me!=null&&Ka(fe,Me);return}if(Lk(fe,_.key)){_.preventDefault();return}}}if((_.key==="$"||_.key==="/"||_.key==="@"||_.key==="#")&&!Ne()){const Ue=L.current,Me=YR(Ue),ct=Me.slice(-1);if(Me.length&&!/[\s\u00a0]/.test(ct))return;Y(""),ee(C0(_.key)),B({anchor:{getBoundingClientRect:()=>qR()??(Ue==null?void 0:Ue.getBoundingClientRect())??new DOMRect},sigil:_.key})}}},ke=s.useCallback(_=>{var fe,we;return(we=ra((fe=r.json)==null?void 0:fe.palette).find(Ue=>Ue.hex===_))==null?void 0:we.name},[(_t=r.json)==null?void 0:_t.palette]),et=s.useCallback(()=>{requestAnimationFrame(()=>{const _=T.current;if(!_)return;_.scrollHeight-_.scrollTop-_.clientHeight>1?_.dataset.more="":delete _.dataset.more})},[]);s.useEffect(()=>{const _=T.current;if(!_)return;et();const fe=new ResizeObserver(et);fe.observe(_);for(const we of _.children)fe.observe(we);return()=>fe.disconnect()},[et]);const Et=_=>{et();const fe=L.current,we=_==null?void 0:_.nativeEvent;if(we!=null&&we.isComposing)return;dte(fe)||Eo(fe),H0(fe)&&mc(fe);const Ue=xe.current;xe.current=!1;const Me=Z8(fe,Ot=>gt(Ot),{commit:Ue,nameFor:ke});Me&&(B(null),Y(""));const ct=Me?{open:!1}:wae(wte(fe),Ue);ct.open?D&&(ct.query!==z&&ee(C0(ct.sigil)),Y(ct.query)):D&&(B(null),Y("")),Ke()},Qe=_=>{const fe=window.getSelection();if(!fe||fe.rangeCount===0||fe.isCollapsed)return null;const we=fe.getRangeAt(0),{text:Ue,html:Me}=kte(we);return Ue?(_.clipboardData.setData("text/plain",Ue),_.clipboardData.setData("text/html",Me),_.preventDefault(),we):null},st=_=>{Qe(_)},rt=_=>{const fe=Qe(_);fe&&(fe.deleteContents(),Eo(L.current),Ke())},qt=s.useCallback(_=>_.t==="template"?a.some(fe=>fe.id===_.id):_.t==="product"?ce.some(fe=>fe.id===_.id)||l.some(fe=>fe.id===_.id):_.t==="character"?Se.some(fe=>fe.id===_.id)||i.some(fe=>fe.id===_.id):_.t==="mark"?Ze.some(fe=>fe.hash===_.imageHash):!0,[a,ce,Se,i,l,Ze]);s.useEffect(()=>{const _=L.current;if(_)for(const fe of _.querySelectorAll(`.${pc}[data-missing]`)){const we=ks(fe.dataset.tok??"");we&&qt(we)&&fe.replaceWith(gt(we,fe.dataset.uid))}},[qt,gt]);const Yt=_=>{Array.from(_.dataTransfer.types).includes("Files")&&(_.preventDefault(),ae.current++,X(!0))},an=_=>_.preventDefault(),Wt=()=>{ae.current=Math.max(0,ae.current-1),ae.current===0&&X(!1)},Mn=_=>{_.preventDefault(),ae.current=0,X(!1),_.dataTransfer.files.length&&(C==null||C(_.dataTransfer.files))},Bt=_=>{_.preventDefault();const fe=_.clipboardData.files;if(fe.length&&Array.from(fe).some(Me=>Me.type.startsWith("image/"))){C==null||C(fe);return}xe.current=!0;const we=Ete(_.clipboardData.getData("text/html"));if(we&&re(we)){const Me=L.current;Z8(Me,ct=>gt(ct),{commit:!0,nameFor:ke})&&Ke();return}const Ue=_.clipboardData.getData("text/plain");Ue&&document.execCommand("insertText",!1,Ue)},re=_=>{const fe=L.current,we=window.getSelection();if(!fe||!we||we.rangeCount===0||!fe.contains(we.getRangeAt(0).startContainer))return!1;const Ue=we.getRangeAt(0);Ue.deleteContents();let Me=!1,ct=Array.from(fe.querySelectorAll(`.${pc}`)).filter(dn=>F0.has(dn.dataset.kind??"")).length,Ot=!1;const zt=new Set,Rt=[];for(const dn of _){if(typeof dn=="string"){Rt.push(dn);continue}if(!qt(dn)){Rt.push(voe(dn,a,ce));continue}if(dn.t==="template"){if(Me)continue;Me=!0}const mr=Qa(dn);if(mr){if(zt.has(mr)||_8(fe,mr))continue;zt.add(mr)}if(F0.has(dn.t)&&!(dn.t==="template"&&y0(fe))){if(ct>=Gp){Ot=!0;continue}ct+=1}Rt.push(dn)}Ot&&R(X4);const kn=Me?y0(fe):null,Jt=document.createDocumentFragment();for(const dn of Rt)Jt.appendChild(typeof dn=="string"?document.createTextNode(dn):gt(dn));const Sn=Jt.lastChild;Ue.insertNode(Jt),kn&&kn.remove();const Qn=Sn?Sn.nodeType===Node.TEXT_NODE?Ip(fe,Sn,Sn.length):Ip(fe,fe,Array.from(fe.childNodes).indexOf(Sn)+1):ko(fe)??0;return Eo(fe),Ka(fe,Qn),Ke(),!0},ue=s.useCallback(()=>{requestAnimationFrame(()=>{const _=L.current;_&&document.activeElement===_&&H0(_)&&mc(_)})},[]),de=V?ks(V.anchor.dataset.tok??""):null,_e=s6(de),Fe=(V==null?void 0:V.kind)==="scene"&&(de==null?void 0:de.t)==="template"?a.find(_=>_.id===de.id)??null:null,xt=uoe(Fe),yt=(de==null?void 0:de.t)==="template"&&de.view?((Ae=xt.find(_=>_.hash===de.view)??xt.find(_=>_.name===de.viewName))==null?void 0:Ae.view)??null:null,kt=async _=>{if(!V||(de==null?void 0:de.t)!=="template")return;const{uid:fe}=V,{id:we,setup:Ue}=de;let Me=(_==null?void 0:_.hash)??null;if(_&&!Me)try{Me=(await Ee.pickSceneView(we,_.view)).hash}catch{return}Q(fe,{t:"template",id:we,...Ue?{setup:Ue}:{},..._&&Me?{view:Me,viewName:_.name}:{}}),ze("pick")},ot=de?(m==null?void 0:m(de))??null:null,ht=de&&(w!=null&&w(de))?y??null:null,je=O?ks(O.anchor.dataset.tok??""):null,me=s6(je),tt=((Ve=O==null?void 0:O.anchor.querySelector("img"))==null?void 0:Ve.getAttribute("src"))??null,Ct=me?gn(me,"tile"):$n(tt,"tile"),be=zu(je),it=je&&fp(je.t)?je.t:be&&be!=="color"&&fp(be)?be:null,wt=je?(m==null?void 0:m(je))??null:null,Pe=je&&(w!=null&&w(je))?y??null:null,Xe=Ne()?void 0:()=>{if(!V)return;const _=We(V.uid);ze("remove",_)};return o.jsxs("div",{className:"sc-brief",ref:T,onScroll:et,"data-drag-over":te||void 0,children:[o.jsx("span",{id:M,className:"sc-vh",children:"Press Enter to open, Delete to remove, Alt plus arrow keys to move."}),o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:j}),o.jsx("div",{ref:L,className:"sc-brief-line",contentEditable:!0,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-autocomplete":"list","aria-expanded":D?!0:void 0,"aria-controls":D?I0:void 0,"aria-activedescendant":D?pe??void 0:void 0,"aria-label":g,"aria-placeholder":h,tabIndex:0,dir:"auto","data-ph":h,...p?{"data-ph-sm":p}:{},onClick:at,onPointerDown:Pt,onPointerOver:Zt,onPointerLeave:_=>_.pointerType==="mouse"&&K.close(),onFocusCapture:Ft,onKeyDown:Tt,onInput:Et,onCopy:st,onCut:rt,onPaste:Bt,onDragEnter:Yt,onDragOver:an,onDragLeave:Wt,onDrop:Mn,onFocus:ue,onBlur:()=>{const _=L.current;Z8(_,fe=>gt(fe),{commit:!0,nameFor:ke})&&(B(null),Y("")),Ke()}}),D&&o.jsx(Lae,{anchor:D.anchor,composer:{getBoundingClientRect:()=>{var _,fe,we;return((fe=(_=L.current)==null?void 0:_.closest(".sc-promptcard"))==null?void 0:fe.getBoundingClientRect())??((we=L.current)==null?void 0:we.getBoundingClientRect())??new DOMRect}},line:{getBoundingClientRect:()=>{var _;return((_=L.current)==null?void 0:_.getBoundingClientRect())??new DOMRect}},query:z,options:ft,remaining:Ge.remaining,total:Ge.total,sigil:D.sigil,onMore:bt,onActiveId:se,onClose:()=>{B(null),Y("")}}),O&&Ct&&it&&o.jsx(Od,{anchor:O.anchor,kind:it,src:Ct,label:ni(O.anchor),warning:wt,note:Pe,onOpen:()=>{const _=O.anchor;if(me){oe(_);return}F(),b==null||b({src:Ct,kind:it,label:ni(_)})},onHoverIn:K.keep,onHoverOut:K.close,onClose:F},O.uid),(V==null?void 0:V.kind)==="ref"||(V==null?void 0:V.kind)==="mark"?o.jsx(nae,{kind:V.kind,label:ni(V.anchor),thumb:_e?gn(_e,"micro"):null,onInspect:()=>oe(V.anchor),onMove:_=>nt(V.uid,_),onRemove:Xe,onClose:ze},V.uid):(V==null?void 0:V.kind)==="color"?o.jsx(toe,{anchor:V.anchor,currentHex:_h(V.anchor),currentName:moe(V.anchor),palette:ra((Je=r.json)==null?void 0:Je.palette),onPick:(_,fe)=>{var Ue;const we=V.uid;if(fe!=null&&fe.live){const Me=(Ue=L.current)==null?void 0:Ue.querySelector(`[data-uid="${CSS.escape(we)}"]`);Me&&Pte(Me,_),Ke();return}if(goe(_.hex,_h(V.anchor))){ze("pick");return}Q(we,_),ze("pick")},onRemove:Xe,onMove:_=>nt(V.uid,_),onClose:ze},V.uid):V?o.jsx(Kae,{kind:V.kind,anchor:V.anchor,currentId:_h(V.anchor),candidates:Ie(V.kind),brandId:r.id,brandSlug:r.slug,warning:ot,note:ht,onAttachRequest:S?_=>{ze("outside"),S(_)}:void 0,onPick:_=>{const fe=V.uid;if(_.id===_h(V.anchor)){ze("pick");return}_.kind==="scene"?u(_.id):Q(fe,_.token),ze("pick")},onRemove:Xe,onMove:_=>nt(V.uid,_),onClose:ze,views:V.kind==="scene"?{options:xt,picked:yt,onPick:kt}:void 0},V.uid):null]})});function _h(e){const t=ks(e.dataset.tok??"");return t?t.t==="color"?t.hex:"id"in t?t.id:null:null}function moe(e){const t=ks(e.dataset.tok??"");return(t==null?void 0:t.t)==="color"?t.name:void 0}function goe(e,t){const n=e?ur(e):null,r=t?ur(t):null;return!!n&&n===r}function voe(e,t,n){var r,a;if(e.t==="template"){const i=((r=t.find(l=>l.id===e.id))==null?void 0:r.name)??"template";return e.view&&e.viewName?`${i} · ${e.viewName}`:i}return e.t==="product"?((a=n.find(i=>i.id===e.id))==null?void 0:a.name)??"product":e.t==="character"?"someone":e.t==="color"?e.name??e.hex:e.t==="mark"?"brand mark":e.t==="ref"?e.label??"Image":"reference"}function Vh(e,t){return t===null?e===null:e===t}function woe(e){const t=e.closest(".sc-filterbar, .sc-toolbar"),n=t==null?void 0:t.closest("[data-page-scroll]");if(!t||!n)return;let r=t.nextElementSibling;for(;r&&r.getBoundingClientRect().height===0;)r=r.nextElementSibling;if(!r)return;const i=r.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop-Number.parseFloat(getComputedStyle(t).marginBottom)-t.offsetHeight;if(n.scrollTop<=i+1)return;const l=window.matchMedia("(prefers-reduced-motion: reduce)").matches;n.scrollTo({top:i,behavior:l?"auto":"smooth"})}function Ay({"aria-label":e,activeKey:t,items:n,onSelect:r}){const a=s.useRef(null),i=s.useRef(null),l=n.map(p=>`${p.value??""}:${p.count??""}`).join("|");s.useLayoutEffect(()=>{const p=a.current,g=i.current;if(!p||!g)return;let m=0;const w=()=>{const A=g.querySelector(":scope > button[data-on]");if(!A)return g.style.setProperty("--sc-ink-x","0px"),g.style.setProperty("--sc-ink-w","0px"),null;const L=A.querySelector(".sc-vlabel")??A;return g.style.setProperty("--sc-ink-x",`${A.offsetLeft+L.offsetLeft}px`),g.style.setProperty("--sc-ink-w",`${L.offsetWidth}px`),A},y=()=>{const A=g.scrollWidth-g.clientWidth;if(A<=1){delete p.dataset.overflowLeft,delete p.dataset.overflowRight;return}g.scrollLeft>2?p.dataset.overflowLeft="":delete p.dataset.overflowLeft,g.scrollLeft<A-2?p.dataset.overflowRight="":delete p.dataset.overflowRight},b=A=>{const L=g.scrollWidth-g.clientWidth;if(L<=0)return;const T=[...g.querySelectorAll(":scope > button")],M=T.indexOf(A);if(M<0)return;const j=72,P=g.scrollLeft,R=P+g.clientWidth,H=T[M-1],D=T[M+1],B=D?D.offsetLeft+Math.min(j,D.offsetWidth):A.offsetLeft+A.offsetWidth+8,V=H?Math.max(0,H.offsetLeft+H.offsetWidth-j):Math.max(0,A.offsetLeft-8);let U=P;if(B>R)U=Math.min(L,B-g.clientWidth);else if(V<P)U=V;else return;if(Math.abs(U-P)<1)return;const K=window.matchMedia("(prefers-reduced-motion: reduce)").matches;g.scrollTo({left:U,behavior:K?"auto":"smooth"})},k=w();k&&b(k),y(),g.dataset.inkReady||requestAnimationFrame(()=>{g.dataset.inkReady=""});const S=()=>{m||(m=requestAnimationFrame(()=>{m=0,y()}))},E=A=>{if(g.scrollWidth<=g.clientWidth+1||Math.abs(A.deltaX)>Math.abs(A.deltaY)||A.deltaY===0)return;const L=g.scrollWidth-g.clientWidth,T=Math.max(0,Math.min(L,g.scrollLeft+A.deltaY));T!==g.scrollLeft&&(A.preventDefault(),g.scrollLeft=T,y())},C=new ResizeObserver(()=>{w(),y()});C.observe(g);for(const A of g.querySelectorAll(":scope > button"))C.observe(A);return g.addEventListener("scroll",S,{passive:!0}),g.addEventListener("wheel",E,{passive:!1}),()=>{m&&cancelAnimationFrame(m),C.disconnect(),g.removeEventListener("scroll",S),g.removeEventListener("wheel",E)}},[t,l]);const u=p=>{Vh(t,p)||(a.current&&woe(a.current),r(p))},f=p=>{var y;if(p.key!=="ArrowLeft"&&p.key!=="ArrowRight"&&p.key!=="Home"&&p.key!=="End"||n.length===0)return;p.preventDefault();const g=Math.max(0,n.findIndex(b=>Vh(t,b.value)));let m=g;if(p.key==="ArrowRight"?m=Math.min(n.length-1,g+1):p.key==="ArrowLeft"?m=Math.max(0,g-1):p.key==="Home"?m=0:p.key==="End"&&(m=n.length-1),m===g)return;u(n[m].value);const w=(y=i.current)==null?void 0:y.querySelectorAll(":scope > button")[m];w==null||w.focus()},h=n.findIndex(p=>Vh(t,p.value));return o.jsx("div",{ref:a,className:"sc-verticals-shell",children:o.jsxs("div",{ref:i,className:"sc-verticals",role:"tablist","aria-label":e,onKeyDown:f,children:[o.jsx("span",{className:"sc-verticals-ink","aria-hidden":!0}),n.map((p,g)=>{const m=Vh(t,p.value);return o.jsxs("button",{type:"button",role:"tab","aria-selected":m,"data-on":m?"":void 0,tabIndex:m||h<0&&g===0?0:-1,onClick:()=>u(p.value),children:[o.jsx("span",{className:"sc-vlabel",children:p.label}),p.count!==void 0&&o.jsx("span",{className:"sc-vcount",children:p.count})]},p.value??"__all__")})]})})}function Fd({value:e,onChange:t,noun:n,total:r,shortcut:a=!0}){const i=s.useRef(null),[l,u]=s.useState(e.trim().length>0),f=s.useCallback(()=>{var p;Br.flushSync(()=>u(!0)),(p=i.current)==null||p.focus()},[]);s.useEffect(()=>{e.trim().length>0&&u(!0)},[e]),s.useEffect(()=>{if(!a)return;const p=g=>{if(g.key!=="/"||g.metaKey||g.ctrlKey||g.altKey)return;const m=g.target;m!=null&&m.isContentEditable||m&&/^(input|textarea|select)$/i.test(m.tagName)||(g.preventDefault(),f())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[f,a]);const h=p=>{var g;p.key==="Escape"&&(p.stopPropagation(),e?t(""):(u(!1),(g=i.current)==null||g.blur()))};return o.jsxs("div",{className:"sc-libsearch","data-open":l?"":void 0,children:[o.jsx("button",{type:"button",className:"sc-libsearch-toggle","aria-label":`Search ${n}`,"aria-expanded":l,tabIndex:l?-1:0,onClick:f,children:o.jsx(hd,{size:16})}),o.jsxs("div",{className:"sc-libsearch-field",children:[o.jsx(hd,{size:15,"aria-hidden":!0}),o.jsx("input",{ref:i,type:"search",value:e,placeholder:r==null?`Search ${n}`:`Search ${r} ${n}`,"aria-label":`Search ${n}`,autoComplete:"off",autoCorrect:"off",spellCheck:!1,tabIndex:l?0:-1,onChange:p=>t(p.target.value),onKeyDown:h,onBlur:()=>{e.trim()||u(!1)}}),o.jsx("button",{type:"button",className:"sc-libsearch-clear","aria-label":"Clear search",hidden:!e,tabIndex:e?0:-1,onMouseDown:p=>p.preventDefault(),onClick:()=>{var p;t(""),(p=i.current)==null||p.focus()},children:o.jsx(jn,{size:12,weight:"bold"})})]})]})}function uL({why:e,children:t}){return e?o.jsx(Pw,{content:e,className:"sc-tip",maxWidth:"220px",children:ZM(t)}):t}const yoe=["All","Products","Presenters","Scenes","Colors","Brand","Shots"],Yp=yoe.filter(e=>e!=="All"),BS={Products:"Products",Presenters:"Presenters",Scenes:"Scenes",Colors:"Brand colors",Brand:"Brand marks",Shots:"Shots"},boe={Products:"Product",Presenters:"Presenter",Scenes:"Scene",Colors:"Brand color",Brand:"Brand mark",Shots:"Reference shot"},Q4={Products:"products",Presenters:"presenters",Scenes:"scenes",Colors:"brand colors",Brand:"brand marks",Shots:"shots"},xoe={Products:"square",Presenters:"square",Scenes:"square",Colors:"swatch",Brand:"square",Shots:"square"},dL={Products:132,Presenters:132,Scenes:132,Colors:132,Brand:132,Shots:132},J4={Products:96,Presenters:96,Scenes:96,Colors:96,Brand:96,Shots:96},US=10;function koe(e,t,n){const r=(n?J4:dL)[e];return r<=0||t<=0?1:Math.max(1,Math.floor((t+US)/(r+US)))}const Soe={product:"Products",presenter:"Presenters",scene:"Scenes"};function Eoe(e){const t=Soe[e.kind];return{key:Qa(e.token),group:t,shape:xoe[t],label:e.label,sub:e.kind==="product"?e.sub:void 0,full:e.recommended?`${e.full} · Recommended`:e.full,search:e.search,thumb:$n(e.thumb??null,"small"),crop:e.crop,recommended:e.recommended,bookmarked:e.bookmarked,token:e.token}}function Coe(e){const t=r1(e).map(r=>{const a=r.hash,i=qm(e,r);return{key:`m:${a}`,group:"Brand",shape:"square",label:i,full:`${i} · the mark itself`,search:i,thumb:gn(a,"micro"),token:{t:"mark",imageHash:a}}}),n=ra(e==null?void 0:e.palette).map(r=>{const a={t:"color",hex:r.hex,name:r.name};return{key:Qa(a),group:"Colors",shape:"swatch",label:r.name,full:`${r.name} · ${r.hex}`,search:`${r.name} ${r.hex}`,swatch:r.hex,token:a}});return[...t,...n]}function joe(e,t){return e.map((n,r)=>{const a=`Shot ${Math.max(1,t-r)}`;return{key:`r:${n.images[0]}`,group:"Shots",shape:"square",label:a,full:`${a} · joins the shot as a reference image`,search:a,thumb:gn(n.images[0],"micro"),token:{t:"ref",imageHash:n.images[0],label:"Shot"}}})}const WS=(e,t)=>Ho(`${e.label} ${e.sub??""} ${e.search}`,t),fL=`
106
+ `;function Aoe(e){return e.map(Qa).filter(t=>t.length>0).join(fL)}function Noe(e){return new Set(e?e.split(fL):[])}const Moe=new Set(["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"]);function Roe(e,t,n,r){const a=r.length?r[r.length-1].end+1:0;if(a===0)return t==="ArrowUp"?"search":null;const i=Math.max(1,n),l=r.findIndex(p=>e>=p.start&&e<=p.end),u=r[l]??{start:0,end:a-1},f=(e-u.start)%i,h=p=>p.start+Math.floor((p.end-p.start)/i)*i;switch(t){case"ArrowRight":return e+1<a?e+1:null;case"ArrowLeft":return e>0?e-1:null;case"Home":return 0;case"End":return a-1;case"ArrowDown":{if(e+i<=u.end)return e+i;if(e<h(u))return u.end;const p=r[l+1];return p?p.start+Math.min(f,p.end-p.start):null}case"ArrowUp":{if(e-i>=u.start)return e-i;const p=r[l-1];return p?Math.min(p.end,h(p)+f):"search"}}}function Poe(e,t){const n=t.trim();return e==="All"?n?`Nothing matches “${n}”.`:"Nothing to add yet.":n?`No matching ${Q4[e]}.`:e==="Shots"?"No finished shots yet.":`No ${Q4[e]} yet.`}function Loe(e){return[{value:null,label:"All",count:Yp.reduce((n,r)=>n+e[r],0)},...Yp.map(n=>({value:n,label:n,count:e[n]}))]}const $oe=s.memo(function({card:t,index:n,active:r,ticked:a,why:i,onPick:l,onFocus:u}){const f=g=>{(g.key==="Enter"||g.key===" ")&&g.stopPropagation()},h=i&&!a?i:null,p=o.jsxs("button",{type:"button",className:"sc-ap-card","data-shape":t.shape,"data-group":t.group,"data-nav":n,"data-on":a?"":void 0,tabIndex:r?0:-1,"aria-disabled":h?!0:void 0,"aria-pressed":a,title:h??(a?`${t.label} is in the shot. Press to remove it.`:t.full),onClick:h?void 0:()=>l(n),onFocus:()=>u(n),onKeyDown:f,children:[t.shape==="swatch"?o.jsx("span",{className:"sc-ap-thumb sc-ap-swatch",style:{background:t.swatch},"aria-hidden":!0}):o.jsx(Toe,{src:t.thumb,crop:t.crop}),o.jsxs("span",{className:"sc-ap-cap",children:[o.jsxs("span",{className:"sc-vh",children:[boe[t.group],": "]}),o.jsx("b",{dir:"auto",children:t.label}),t.sub&&o.jsx("span",{dir:"auto",children:t.sub})]}),(a||!i)&&o.jsxs("span",{className:"sc-ap-puck","aria-hidden":!0,children:[o.jsx(pr,{className:"sc-ap-puck-add",size:11,weight:"bold"}),o.jsx(Kn,{className:"sc-ap-puck-on",size:11,weight:"bold"}),o.jsx(jn,{className:"sc-ap-puck-off",size:11,weight:"bold"})]}),a&&o.jsx("span",{className:"sc-vh",children:" In the shot."})]});return o.jsx(uL,{why:h,children:p})});function Toe({src:e,crop:t}){const[n,r]=s.useState(!1);return s.useEffect(()=>r(!1),[e]),o.jsx("span",{className:"sc-ap-thumb","data-empty":!e||n?"":void 0,children:!e||n?o.jsx(Ta,{size:16}):o.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async","data-crop":t,onError:()=>r(!0)})})}function KS({onClick:e}){return o.jsxs("button",{type:"button",className:"sc-ap-card sc-ap-add sc-ap-upload-tile",title:"Add an image from your phone. It joins the shot as a reference.",onClick:e,children:[o.jsx("span",{className:"sc-ap-thumb",children:o.jsx(Dv,{size:22,"aria-hidden":!0})}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:"Upload image"})})]})}const Doe=48,Hoe={items:[],total:0,hasMore:!1,loading:!1,settled:!1,error:null,loadMore:()=>{}};function Ny(e,t,n=!0){const r=t.trim(),{shotsEpoch:a,subscribeActivity:i}=cn(),l=`${e}|${r}|${a}`,[u,f]=s.useState({key:"",items:[],next:null,total:0}),[h,p]=s.useState(!1),[g,m]=s.useState(null),w=s.useRef(null),y=s.useCallback(async S=>{var C;(C=w.current)==null||C.abort();const E=new AbortController;w.current=E,p(!0),m(null);try{const A=await Ee.feed(e,{lens:"all",sort:"newest",q:r,limit:Doe,cursor:S??void 0},E.signal);if(E.signal.aborted)return;f(L=>{var M;const T=S===null||L.key!==l;return{key:l,items:T?A.items:[...L.items,...A.items],next:A.next,total:((M=A.counts)==null?void 0:M.all)??(T?A.items.length:L.total)}})}catch(A){if(E.signal.aborted)return;m(String(A.message??A))}finally{E.signal.aborted||p(!1)}},[e,r,l]);s.useEffect(()=>{if(!n)return;const S=u.key===""?0:150,E=setTimeout(()=>void y(null),S);return()=>clearTimeout(E)},[y,n]),s.useEffect(()=>()=>{var S;return(S=w.current)==null?void 0:S.abort()},[]),s.useEffect(()=>i(S=>{const E=new Map(S.map(C=>[C.id,C]));f(C=>{if(!C.items.some(L=>E.has(L.id)))return C;const A=C.items.flatMap(L=>{const T=E.get(L.id);return T?T.archived?[]:[{...L,...T}]:[L]});return{...C,items:A,total:Math.max(0,C.total-(C.items.length-A.length))}})}),[i]);const b=u.key===l?u:null,k=s.useCallback(()=>{b!=null&&b.next&&y(b.next)},[b==null?void 0:b.next,y]);return b?{items:b.items.filter(S=>S.status==="done"&&S.images.length>0),total:b.total,hasMore:b.next!==null,loading:h,settled:!0,error:g,loadMore:k}:{...Hoe,loading:h,error:g,loadMore:k}}const a6={Products:"product",Presenters:"presenter",Scenes:"scene"};function Ooe({brand:e,tab:t,onTab:n,only:r,activeProductCategory:a,refining:i,full:l,attached:u,phone:f,touch:h,onPick:p,onRemove:g,onUpload:m,onFiles:w,onClose:y}){const b=s.useRef(a).current,k=d1(b),S=s.useMemo(()=>new Set(Ci(e.id)),[e.id]),E=Vl(),{applyBrand:C}=Nn(),{push:A}=rr(),[L,T]=s.useState(!1),[M,j]=s.useState(""),P=s.useDeferredValue(M),[R,H]=s.useState(fl),[D,B]=s.useState(0),[V,U]=s.useState(f?347:696),K=s.useRef(null),O=s.useRef(null);s.useEffect(()=>{H(fl),B(0)},[t,P]),s.useLayoutEffect(()=>{const $e=O.current;if(!$e)return;const ne=()=>U($e.clientWidth-2*Foe($e));ne();const Q=new ResizeObserver(ne);return Q.observe($e),()=>Q.disconnect()},[]);const F=s.useMemo(()=>({product:hl("product",k),presenter:hl("presenter",k),scene:hl("scene",k)}),[k]),I=s.useMemo(()=>Coe(e.json),[e.json]),G=Ny(e.id,P),z=s.useMemo(()=>joe(G.items,G.total),[G.items,G.total]),Y=s.useMemo(()=>{const $e={};for(const ne of Yp){const Q=a6[ne];$e[ne]=ne==="Shots"?G.total:Q?dd(F[Q],P).length:I.filter(We=>We.group===ne&&WS(We,P)).length}return $e},[F,I,P,G.total]),Z=s.useCallback(($e,ne)=>{const Q=a6[$e];if(Q){const Ne=f2(Q,F[Q],{currentId:null,query:P,bookmarked:S,shown:ne});return{group:$e,items:Ne.items.map(Eoe),total:Ne.total,remaining:Ne.remaining}}if($e==="Shots"){const Ne=z.slice(0,ne),ie=G.hasMore?Math.max(1,G.total-z.length):Math.max(0,z.length-ne);return{group:$e,items:Ne,total:G.total,remaining:ie}}const We=I.filter(Ne=>Ne.group===$e&&WS(Ne,P));return{group:$e,items:We.slice(0,ne),total:We.length,remaining:Math.max(0,We.length-ne)}},[F,I,P,S,z,G.hasMore,G.total]),ee=s.useMemo(()=>{if(t==="All"){const $e=[];for(const ne of Yp){const Q=koe(ne,V,f),We=Z(ne,f&&$e.length===0?Math.max(1,Q-1):Q);We.items.length>0&&$e.push(We)}return $e}return[Z(t,t==="Shots"?Number.MAX_SAFE_INTEGER:R)]},[t,Z,R,V,f]),{flat:pe,navGroups:se}=s.useMemo(()=>{const $e=[],ne=[];for(const Q of ee)Q.items.length&&(ne.push({start:$e.length,end:$e.length+Q.items.length-1}),$e.push(...Q.items));return{flat:$e,navGroups:ne}},[ee]);s.useEffect(()=>{B($e=>Math.max(0,Math.min($e,pe.length-1)))},[pe.length]);const xe=s.useCallback($e=>{var Q;const ne=(Q=O.current)==null?void 0:Q.querySelector(`[data-nav="${$e}"]`);ne&&(B($e),ne.focus({preventScroll:!0}),ne.scrollIntoView({block:"nearest"}))},[]),J=s.useRef(null),te=s.useRef(()=>{});te.current=()=>{const $e=ee[0];!$e||t==="All"||$e.remaining<=0||($e.group==="Shots"?G.loading||G.loadMore():H(ne=>ne+fl))},s.useEffect(()=>{const $e=J.current,ne=O.current;if(!$e||!ne)return;const Q=new IntersectionObserver(We=>{We.some(Ne=>Ne.isIntersecting)&&te.current()},{root:ne,rootMargin:"0px 0px 240px 0px"});return Q.observe($e),()=>Q.disconnect()},[t,ee]);const X=s.useCallback($e=>{var Q,We;const ne=pe[$e];ne&&(u.has(ne.key)?g(ne):p(ne),h&&((We=(Q=document.activeElement)==null?void 0:Q.blur)==null||We.call(Q)))},[pe,u,h,p,g]),ae=$e=>{const ne=$e.clipboardData.files;!ne.length||!Array.from(ne).some(Q=>Q.type.startsWith("image/"))||($e.preventDefault(),w(ne))},Le=$e=>{var ie,q;const ne=$e.target,Q=ne instanceof HTMLInputElement&&!!((ie=K.current)!=null&&ie.contains(ne));if($e.key==="Escape"){if(Q)return;$e.preventDefault(),$e.stopPropagation(),y();return}if(Q){$e.key==="ArrowDown"?($e.preventDefault(),$e.stopPropagation(),xe(0)):$e.key==="Enter"&&($e.preventDefault(),$e.stopPropagation(),X(0));return}if(!Moe.has($e.key)||($e.stopPropagation(),ne.closest('[role="tablist"]')))return;const We=ne.closest("[data-nav]");if(!We)return;$e.preventDefault();const Ne=Roe(D,$e.key,Ioe(We.closest(".sc-ap-grid")),se);if(Ne==="search"){const oe=K.current;(q=(oe==null?void 0:oe.querySelector(".sc-libsearch[data-open] input"))??(oe==null?void 0:oe.querySelector(".sc-libsearch-toggle")))==null||q.focus()}else Ne!=null&&xe(Ne)},ce=async $e=>{T(!0);try{const ne=await PN(e.id,$e);C(ne);const Q=ne.logoHash;Q&&p({key:`m:${Q}`,group:"Brand",shape:"square",label:"Logo",full:"Logo",search:"",token:{t:"mark",imageHash:Q}});const We=ne.logoEdge;We&&We<512&&A({kind:"warning",title:"Logo added, but it is small",detail:`Only ${We}px across. Fine lettering may not survive generation. Export it larger, or as SVG.`})}catch(ne){A(ln(ne,"Could not upload that logo"))}finally{T(!1)}},Se=$e=>E($e,{onCreated:ne=>{if(ne.kind===$e){if(ne.kind==="product"){const Q={t:"product",id:ne.id};p({key:Qa(Q),group:"Products",shape:"square",label:"Product",full:"",search:"",token:Q});return}if(ne.kind==="presenter"){const Q={t:"character",id:ne.id};p({key:Qa(Q),group:"Presenters",shape:"square",label:"Presenter",full:ne.name,search:ne.name,token:Q});return}n("Scenes")}}}),Ze=async $e=>{var We;const ne=dR((We=e.json)==null?void 0:We.palette,$e);if(!ne.swatch)return;if(ne.added)try{const Ne=await Ee.updateBrand(e.id,{...e.json??{},palette:ne.palette},e.json);C(Ne)}catch(Ne){A(ln(Ne,"Could not save the brand"));return}const Q={t:"color",hex:ne.swatch.hex,name:ne.swatch.name};p({key:Qa(Q),group:"Colors",shape:"swatch",label:ne.swatch.name,full:"",search:"",swatch:ne.swatch.hex,token:Q})},gt=$e=>i&&$e==="Scenes"?"Scenes set up a new shot. Press X on Refining to use one.":l&&$e!=="Colors"?l:null,Ke=pe.length===0;let nt=0;return o.jsxs("div",{className:"sc-ap-inner",onKeyDown:Le,onPaste:ae,children:[o.jsxs("div",{className:"sc-ap-head",ref:K,children:[o.jsx("div",{className:"sc-ap-tabs",children:o.jsx(Ay,{"aria-label":"What to add",activeKey:t==="All"?null:t,items:Loe(Y),onSelect:$e=>n($e??"All")})}),o.jsxs("div",{className:"sc-ap-actions",children:[o.jsxs("div",{className:"sc-ap-actions-add",children:[o.jsx(Fd,{value:M,onChange:j,noun:t==="All"?"everything":Q4[t],total:t==="All"?void 0:Y[t],shortcut:!1}),!f&&o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary sc-ap-upload",onClick:m,title:"Add an image from your computer. It joins the shot as a reference.",children:[o.jsx(Dv,{size:14,"aria-hidden":!0}),o.jsx("span",{children:"Upload image"})]})]}),!f&&o.jsx("button",{type:"button",className:"sc-icon-btn sc-ap-close",onClick:y,"aria-label":"Close",children:o.jsx(jn,{size:14})})]})]}),o.jsxs("div",{className:"sc-ap-body",ref:O,children:[i&&t==="Scenes"&&o.jsx("p",{className:"sc-ap-hint",children:"Scenes set up a new shot, so they sit out while you are refining. Press X on Refining to use one."}),ee.map(($e,ne)=>{var oe,Re,ze;const Q=gt($e.group),We=nt;nt+=$e.items.length;const Ne=a6[$e.group],q={"--ap-min":`${(f?J4:dL)[$e.group]}px`,"--ap-lines":Ne==="product"?2:1};return o.jsxs("section",{className:"sc-ap-group","aria-label":BS[$e.group],children:[o.jsxs("div",{className:"sc-ap-sec",children:[o.jsxs("span",{className:"sc-ap-sec-title",children:[BS[$e.group],o.jsx("span",{className:"sc-ap-sec-n",children:$e.total})]}),t==="All"&&$e.total>$e.items.length&&o.jsxs("button",{type:"button",className:"sc-ap-sec-act",onClick:()=>n($e.group),children:["Show all ",$e.total]}),t==="Products"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>Se("product"),children:"Add product"}),t==="Presenters"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>Se("presenter"),children:"Create presenter"}),t==="Scenes"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>Se("scene"),children:"Create scene"}),t==="Colors"&&o.jsx(bd,{className:"sc-ap-sec-act sc-ap-add",triggerStyle:{background:"none"},value:n2(ra((oe=e.json)==null?void 0:oe.palette)),presets:ra((Re=e.json)==null?void 0:Re.palette).map(Ye=>Ye.hex),commitMode:"close",align:"end",label:"Add color",onChange:Ye=>void Ze(Ye),children:"Add color"}),t==="Brand"&&o.jsxs("label",{className:"sc-ap-sec-act sc-ap-add",title:"Add your logo to the brand kit","data-busy":L||void 0,children:[o.jsx("input",{type:"file",accept:"image/*",className:"sc-vh",disabled:L,onChange:Ye=>{var De;const Ie=(De=Ye.target.files)==null?void 0:De[0];Ye.target.value="",Ie&&ce(Ie)}}),"Add logo"]})]}),o.jsxs("div",{className:"sc-ap-grid","data-shape":((ze=$e.items[0])==null?void 0:ze.shape)??"square",style:q,children:[f&&ne===0&&!r&&o.jsx(KS,{onClick:m}),$e.items.map((Ye,Ie)=>o.jsx($oe,{card:Ye,index:We+Ie,active:We+Ie===D,ticked:u.has(Ye.key),why:Q,onPick:X,onFocus:B},Ye.key))]}),t!=="All"&&$e.remaining>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:J,className:"sc-ap-sentinel","aria-hidden":!0}),o.jsxs("p",{className:"sc-ap-foot","aria-live":"polite",children:[$e.items.length," of ",$e.total]})]})]},$e.group)}),t==="Shots"&&G.error&&o.jsxs("p",{className:"sc-ap-empty",children:["Could not load the shots. ",G.error]}),Ke&&f&&o.jsx("div",{className:"sc-ap-grid",style:{"--ap-min":`${J4.Products}px`},children:o.jsx(KS,{onClick:m})}),Ke&&!(t==="Shots"&&(!G.settled||G.loading||G.error))&&o.jsx("p",{className:"sc-ap-empty",children:Poe(t,M)})]})]})}function Ioe(e){return e?Math.max(1,getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length):1}function Foe(e){return Number.parseFloat(getComputedStyle(e).paddingLeft)||0}const _oe="(pointer: coarse)";function Voe(e){const t=Nr(la),n=Nr(_oe),[r,a]=s.useState(e.initialTab??"All");s.useEffect(()=>{a(e.initialTab??"All")},[e.initialTab,e.tabNonce]);const[i]=jl(),l=i.get("new")!==null;return o.jsx(Zoe,{id:e.id,phone:t,touch:n,creating:l,onClose:e.onClose,children:o.jsx(Ooe,{brand:e.brand,tab:e.only??r,onTab:a,only:e.only,activeProductCategory:e.activeProductCategory,refining:e.refining,full:e.full,attached:e.attached,phone:t,touch:n,onPick:e.onPick,onRemove:e.onRemove,onUpload:e.onUpload,onFiles:e.onFiles,onClose:()=>e.onClose({restore:!n})})})}function Zoe({id:e,phone:t,touch:n,creating:r,onClose:a,children:i}){const l=s.useRef(null),u=()=>{var p;return a({restore:!n&&!!((p=l.current)!=null&&p.contains(document.activeElement))})},f=s.useRef(u);f.current=u,s.useEffect(()=>{var p,g;n&&((g=(p=document.activeElement)==null?void 0:p.blur)==null||g.call(p))},[n]),s.useLayoutEffect(()=>{var y,b;const p=l.current,g=p==null?void 0:p.parentElement;if(!t||!p||!g)return;const m=()=>{const k=p.closest(".sc-shell")??document.documentElement,S=Number.parseFloat(getComputedStyle(k).getPropertyValue("--sc-topbar-h"))||0,E=g.getBoundingClientRect().top-S-16;p.style.setProperty("--ap-avail",`${Math.max(160,Math.round(E))}px`)};m();const w=new ResizeObserver(m);return w.observe(g),window.addEventListener("resize",m),(y=window.visualViewport)==null||y.addEventListener("resize",m),(b=window.visualViewport)==null||b.addEventListener("scroll",m),()=>{var k,S;w.disconnect(),window.removeEventListener("resize",m),(k=window.visualViewport)==null||k.removeEventListener("resize",m),(S=window.visualViewport)==null||S.removeEventListener("scroll",m)}},[t]),s.useEffect(()=>{const p=g=>{var w;if(g.key!=="Escape"||r)return;const m=document.activeElement;m instanceof HTMLInputElement&&((w=l.current)!=null&&w.contains(m))||(g.preventDefault(),g.stopPropagation(),f.current())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[r]);const h=p=>{var w;const g=document.activeElement,m=p.target;g instanceof HTMLInputElement&&((w=l.current)!=null&&w.contains(g))&&!m.closest("input")&&g.blur(),z4(p)};return s.useEffect(()=>{const p=g=>{if(r)return;const m=g.target;m.closest('[data-guide="catch"], [data-guide="card"], [data-guide="inline"]')||document.querySelector('[data-guide="catch"]')||m.closest(".sc-attachpanel, .sc-attach-toggle, [data-attach-opener]")||f.current()};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]),o.jsx("div",{ref:l,className:"sc-attachpanel","data-guide-shape":"",role:"dialog",id:e,"aria-label":"Add to shot",onMouseDownCapture:h,children:i})}function zoe({target:e,onOpenImage:t,onClear:n}){var f;const r=Id(),a=e.images[0],l=(((f=e.brief)==null?void 0:f.tokens)??[]).filter(h=>h.t==="text"&&typeof h.v=="string").map(h=>h.v.trim()).join(" ").trim()||Dr(e),u=s.useCallback(()=>{a&&(r.closeNow(),t())},[a,r.closeNow,t]);return o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"sc-token sc-target-chip",role:"button",tabIndex:0,"aria-haspopup":"dialog","aria-label":n?`Version being refined: ${l}. Open the image, or remove to make a new shot.`:`Version being refined: ${l}. Open the image.`,onPointerEnter:h=>{h.pointerType==="mouse"&&a&&r.open({anchor:h.currentTarget})},onPointerLeave:h=>h.pointerType==="mouse"&&r.close(),onClick:u,onKeyDown:h=>{h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u())},children:[a?o.jsx("img",{src:gn(a,"micro"),alt:""}):o.jsx("span",{className:"sc-target-thumb",children:o.jsx(Pa,{})}),"Refining",n&&o.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),r.closeNow(),n()},"aria-label":"Make a new shot instead",children:o.jsx(jn,{size:12})})]}),r.shown&&a&&o.jsx(Od,{anchor:r.shown.anchor,kind:"shot",src:gn(a,"tile"),label:l,noun:"Refining this shot",onOpen:u,onHoverIn:r.keep,onHoverOut:r.close,onClose:r.closeNow})]})}function Ed({src:e,kind:t,label:n,noun:r,actions:a,onRestoreFocus:i,onClose:l}){const[u,f]=s.useState(!1),h=r??XP[t],p=s.useRef(null);return o.jsxs(Ws,{className:"sc-lightbox",maxWidth:"min(880px, 92vw)",onOpenAutoFocus:()=>{p.current=document.activeElement},onCloseAutoFocus:g=>{var m;if(g.preventDefault(),i)return i();(m=p.current)!=null&&m.isConnected&&p.current.focus()},onDismiss:l,children:[o.jsx("div",{className:"sc-newdlg-head sc-lightbox-head",children:o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(jn,{size:16})})})}),o.jsx("div",{className:"sc-lightbox-frame","data-kind":t,children:u?o.jsxs("span",{className:"sc-lightbox-blank",children:[o.jsx(Ta,{size:28}),"Image unavailable"]}):o.jsx("img",{src:e,alt:n?`${n}, ${h.toLowerCase()}`:h,onError:()=>f(!0)})}),o.jsxs("p",{className:"sc-lightbox-cap",children:[n&&o.jsx("b",{dir:"auto",children:n}),o.jsx("span",{children:h})]}),a&&o.jsx("div",{className:"sc-lightbox-acts",children:a})]})}const Boe={"codex-cli":{sizing:"advisory"},openrouter:{sizing:"ratio"},replicate:{sizing:"ratio"},fal:{sizing:"exact"},demo:{sizing:"exact"}},Uoe={sizing:"exact"},hL=e=>Boe[e]??Uoe;function Woe(e,t){const n=hL(e).formats;return!n||n.includes(t)}const My=e=>hL(e).sizing,Koe="portrait",Goe=1,Yoe="standard",oi=[{id:"draft",label:"Draft",edge:768,note:"quick checks"},{id:"standard",label:"Standard",edge:1024,note:"everyday shots"},{id:"high",label:"High",edge:1536,note:"hero and print"}],qp=[1,2,3,4],pL=e=>Yr.filter(t=>!Woe(e,t.id)).map(t=>t.id),ev=(e,t)=>t.length===0?void 0:`${e} cannot make ${Yr.filter(n=>t.includes(n.id)).map(n=>n.hint).join(" or ")}.`,Ry=e=>{var n;e.preventDefault();const t=e.currentTarget??e.target;(n=t==null?void 0:t.querySelector('[role="radiogroup"]'))==null||n.focus()};function o6({aria:e,width:t,trigger:n,open:r,onOpenChange:a,children:i,onCloseAutoFocus:l,guide:u}){const f=s.useRef(null);return s.useEffect(()=>{var p;const h=(p=f.current)==null?void 0:p.parentElement;h&&(h.style.pointerEvents=r?"":"none")},[r]),o.jsxs(gd,{open:r,onOpenChange:a,children:[o.jsx(vd,{children:o.jsx("button",{type:"button",className:"sc-var","aria-label":e,"data-guide":u,children:n})}),o.jsx(wd,{ref:f,className:"sc-setpop",align:"end",sideOffset:8,width:t,onOpenAutoFocus:Ry,onCloseAutoFocus:l,onInteractOutside:h=>{var p;(p=h.target)!=null&&p.closest(".sc-prompt-pills")&&h.preventDefault()},children:i(()=>a(!1))})]})}function qoe({mode:e,engineId:t,engineName:n,formatId:r,onFormat:a,count:i,onCount:l,quality:u,onQuality:f,onCloseAutoFocus:h,guided:p=!1,onSettle:g}){const m=Yr.find(T=>T.id===r)??Yr[0],w=oi.find(T=>T.id===u)??oi[1],y=pL(t),b=My(t),[k,S]=s.useState(null),E=s.useRef(null);E.current=k;const C=T=>{T.preventDefault(),E.current===null&&(h==null||h(T))},A={aspect:"shape",variants:"count",resolution:"quality"},L=T=>({open:k===T,onCloseAutoFocus:C,guide:p?`compose.${A[T]}`:void 0,onOpenChange:M=>{!M&&E.current===T&&(g==null||g(A[T])),S(j=>M?T:j===T?null:j)}});return o.jsxs("div",{className:"sc-prompt-pills","data-guide":p?"compose.settings-row":void 0,children:[o.jsx(o6,{...L("aspect"),aria:`Aspect ${m.label}, ${m.hint}`,width:"178px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(L4,{w:m.w,h:m.h,slot:15,box:13}),m.label]}),children:T=>o.jsxs(o.Fragment,{children:[o.jsx(ri,{label:"Aspect ratio",className:"sc-setpop-list",value:r,ids:Yr.map(M=>M.id),unavailable:y,onChange:a,children:Yr.map(M=>o.jsxs(si,{id:M.id,className:"sc-setrow",on:M.id===r,unavailable:y.includes(M.id),label:`${M.label}, ${M.hint}`,onPick:()=>{a(M.id),T()},children:[o.jsx(L4,{w:M.w,h:M.h,slot:20,box:17}),o.jsx("span",{className:"sc-setrow-n",children:M.label}),o.jsx("span",{className:"sc-setrow-v",children:M.hint}),o.jsx(ak,{})]},M.id))}),ev(n,y)&&o.jsx(jQ,{children:ev(n,y)})]})}),e==="generation"&&o.jsx(o6,{...L("variants"),aria:`${i} shot${i===1?"":"s"}`,width:"156px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(oC,{size:14}),i]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(ri,{label:"Shots",className:"sc-seg",value:String(i),ids:qp.map(String),onChange:M=>l(Number(M)),children:qp.map(M=>o.jsx(si,{id:String(M),className:"sc-seg-o",on:M===i,label:`${M} shot${M===1?"":"s"}`,onPick:()=>{l(M),T()},children:M},M))})})}),e==="generation"&&b!=="ratio"&&o.jsx(o6,{...L("resolution"),aria:`Resolution ${w.label}, ${w.edge} px`,width:"192px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(CE,{size:14}),w.label]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(ri,{label:"Resolution",className:"sc-setpop-list",value:u,ids:oi.map(M=>M.id),onChange:M=>f(M),children:oi.map(M=>o.jsxs(si,{id:M.id,className:"sc-setrow",on:M.id===u,label:`${M.label}, ${M.edge} px, ${M.note}`,onPick:()=>{f(M.id),T()},children:[o.jsx("span",{className:"sc-setrow-n",children:M.label}),o.jsxs("span",{className:"sc-setrow-v",children:[M.edge," px"]}),o.jsx(ak,{})]},M.id))})})})]})}function mL({mode:e,engineId:t,engineName:n,formatId:r,onFormat:a,count:i,onCount:l,quality:u,onQuality:f,engineChoices:h,onEngine:p}){const g=pL(t),m=My(t);return o.jsxs(o.Fragment,{children:[h&&p&&h.length>1&&o.jsx(Zh,{label:"Engine",children:o.jsx(ri,{label:"Engine",className:"sc-seg",value:t,ids:h.map(w=>w.id),onChange:p,children:h.map(w=>o.jsx(si,{id:w.id,className:"sc-seg-o",on:w.id===t,label:w.displayName,onPick:()=>p(w.id),children:w.displayName},w.id))})}),o.jsx(Zh,{label:"Aspect ratio",note:ev(n,g),children:o.jsx(ri,{label:"Aspect ratio",className:"sc-seg",value:r,ids:Yr.map(w=>w.id),unavailable:g,onChange:a,children:Yr.map(w=>o.jsxs(si,{id:w.id,className:"sc-seg-o sc-seg-ratio",on:w.id===r,unavailable:g.includes(w.id),label:`${w.label}, ${w.hint}`,onPick:()=>a(w.id),children:[o.jsx(L4,{w:w.w,h:w.h,slot:17,box:14}),w.hint]},w.id))})}),e==="generation"&&o.jsx(Zh,{label:"Shots",children:o.jsx(ri,{label:"Shots",className:"sc-seg",value:String(i),ids:qp.map(String),onChange:w=>l(Number(w)),children:qp.map(w=>o.jsx(si,{id:String(w),className:"sc-seg-o",on:w===i,label:`${w} shot${w===1?"":"s"}`,onPick:()=>l(w),children:w},w))})}),e==="generation"&&m!=="ratio"&&o.jsx(Zh,{label:"Resolution",note:m==="advisory"?"This engine renders at its own size, so this is a request rather than a guarantee.":void 0,children:o.jsx(ri,{label:"Resolution",className:"sc-seg",value:u,ids:oi.map(w=>w.id),onChange:w=>f(w),children:oi.map(w=>o.jsx(si,{id:w.id,className:"sc-seg-o",on:w.id===u,label:m==="advisory"?`${w.label}, asks for ${w.edge} px, ${w.note}`:`${w.label}, ${w.edge} px, ${w.note}`,onPick:()=>f(w.id),children:w.label},w.id))})})]})}function Zh({label:e,note:t,children:n}){return o.jsxs("div",{className:"sc-shotfield",children:[o.jsx("span",{className:"sc-shotfield-lb",children:e}),n,t&&o.jsx("p",{className:"sc-shotfield-note",children:t})]})}function Xoe({guide:e,onSettle:t,...n}){const[r,a]=s.useState(!1),i=f=>{!f&&r&&(t==null||t()),a(f)},{sheet:l,grip:u}=$d(()=>i(!1));return o.jsxs(Ml,{open:r,onOpenChange:i,children:[o.jsx(Bv,{asChild:!0,children:o.jsx("button",{type:"button",className:"sc-var sc-shotset","aria-label":"Shot settings",title:"Shot settings","data-guide":e,children:o.jsx(Tv,{size:16})})}),o.jsxs(Rl,{children:[o.jsx(Pl,{className:"sc-shotsheet-scrim"}),o.jsxs(Ll,{ref:l,className:"sc-shotsheet","aria-describedby":void 0,onOpenAutoFocus:Ry,onCloseAutoFocus:f=>f.preventDefault(),children:[o.jsxs("div",{className:"sc-shotsheet-grip",...u,children:[o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0}),o.jsx($l,{className:"sc-vh",children:"Shot settings"})]}),o.jsx(mL,{...n})]})]})]})}const gL=e=>e.t==="template"&&typeof e.view=="string"&&Object.hasOwn(bc,e.view);async function Qoe(e){return Promise.all(e.map(async t=>{if(t.t!=="template"||!gL(t))return t;const{view:n,viewName:r,...a}=t,i=await Ee.pickSceneView(t.id,n).then(l=>l.hash,()=>null);return i?{...a,view:i,...r?{viewName:r}:{}}:a}))}function GS(e,t,n,r,a){if(e===t)return{changed:!1,toast:null};const i=!!r;return e===null&&!i?{changed:!0,toast:null}:{changed:!0,toast:{title:i?`Switched to ${n}. This starts a new shot instead of refining ${a??"that shot"}.`:`Switched to ${n}.`,prevSceneId:e,branchWasCleared:i}}}function Joe(e,t){return e>0&&t>0&&Math.abs(Math.log(t))<Math.abs(Math.log(e))-.01?"crop":"extend"}const i6=2,eie=.15;function tie(e,t){if(Joe(e,t)==="crop")return"crop";if(!(e>0&&t>0))return"extend";const n=t>e?t/e:e/t;return(n>i6?Math.max(i6,n*(1-eie)):n)>i6+1e-9?"crop":"extend"}const tv=4,Xp=24,Y0=24,vL={product:[],presenter:[],scene:null,ref:[],color:[]};function nie(e){const t=[],n=[],r=[],a=[];let i=null;const l=(u,f)=>{u.includes(f)||u.push(f)};for(const u of e)u.t==="product"?l(t,u.id):u.t==="character"?l(n,u.id):u.t==="template"?i=u.id:u.t==="ref"?l(r,u.imageHash):u.t==="color"&&l(a,u.hex.toLowerCase());return{product:t,presenter:n,scene:i,ref:r,color:a}}function rie(e){return`${e.product.join(",")}|${e.presenter.join(",")}|${e.scene??""}|${e.ref.join(",")}|${e.color.join(",")}`}function sie(e,t,n){const r=e.slice(0,n);return{visible:r,more:Math.max(0,e.length-r.length)}}const Py=s.forwardRef(function({projectId:t,brand:n,engines:r,parentId:a,initialBrief:i,suppressDraftRestore:l,startScene:u,startSetup:f,startPresenter:h,startProduct:p,startRef:g,startView:m,startFresh:w,onSeedsSpent:y,openAttachTab:b,onQueued:k,onSending:S,onAttached:E,onCeiling:C,target:A,holdFor:L,onClearTarget:T,sourceImage:M,onRestoreBranchId:j,setSlug:P,persistDraft:R=!0,variant:H="dock",guided:D=!1},B){var Vd,y1;const{products:V,productsLoaded:U}=cn(),{demoProducts:K,demoProductsLoaded:O,loaded:F}=Nn(),I=d1(),G=I.scenes,z=I.presenters,Y=Fl(),Z=_l(),{push:ee}=rr(),pe=r.filter(ge=>ge.available),[se,xe]=Ma(qr.engine,yf);s.useEffect(()=>{const ge=lJ(pe,se);ge!==se&&xe(ge)},[pe,se,xe]);const J=pe.length===0&&r.some(ge=>ge.code==="not-installed"||ge.code==="not-authenticated"),te=pe.length===0,X=te?J?{icon:o.jsx(gR,{}),title:"Image generation is not set up yet",detail:"About a minute, using the ChatGPT account you already have.",action:"Set up",onAct:()=>Z(),info:!0}:{icon:o.jsx(tf,{size:15}),title:"No image provider connected",detail:"Add a provider key and this prompt is ready to run.",action:"Open settings",onAct:()=>Y("engines"),info:!1}:null,[ae,Le]=s.useState(ti()),[ce,Se]=s.useState(void 0),[Ze,gt,Ke,nt]=k8(qr.format,Koe),[$e,ne]=s.useState({}),Q=A&&A.kind!=="root"?A:null,We=Q?hoe(Q.brief):void 0,Ne=Q?$e[Q.id]??We??Ze:Ze,ie=ge=>{Q?ne(pt=>({...pt,[Q.id]:ge})):gt(ge)},[q,oe]=s.useState({}),[Re,ze,Ye,Ie]=k8(qr.count,Goe),[De,Ge]=s.useState(!1),[ft,bt]=s.useState(null),[at,Zt]=s.useState(null),[jt,Ft]=s.useState(!1),[Pt,Tt]=s.useState("All"),[ke,et]=s.useState(0),[Et,Qe]=s.useState(null),[st,rt,qt,Yt]=k8(qr.quality,Yoe),[an,Wt]=s.useState(!1),[Mn,Bt]=s.useState(!1),re=ge=>Bt(ge);Nr("(hover: hover) and (min-width: 1024px)");const ue=Nr("(max-width: 767px)"),de=s.useRef(null),_e=s.useRef(null),Fe=s.useRef(null),xt=s.useId(),yt={...nt?{format:nt}:{},...Ie?{count:Ie}:{},...Yt?{quality:Yt}:{}},kt=s.useRef({tokens:ae,tplFields:q,branchId:(A==null?void 0:A.id)??null,lent:yt});kt.current={tokens:ae,tplFields:q,branchId:(A==null?void 0:A.id)??null,lent:yt};const ot=s.useRef(null),ht=s.useRef(null),je=s.useRef(null),me=s.useRef(void 0),tt=s.useRef(void 0),Ct=s.useRef(void 0),be=s.useRef(void 0),it=s.useCallback(ge=>{if(je.current&&(clearTimeout(je.current),je.current=null),!R)return;const pt=kt.current;if(pt.branchId)return;const tn=ot.current??pt.tokens;R8(tn,pt.tplFields)?Hw(ge,{tokens:tn,tplFields:pt.tplFields,setSlug:P,lent:pt.lent}):D5(ge)},[P,R]);s.useEffect(()=>{b&&(Tt(b),Ft(!0))},[b]);const wt=s.useCallback(ge=>{if(!ge.some(gL)){ot.current=null,Se(ge);return}ot.current=ge,Qoe(ge).then(pt=>{ot.current===ge&&(ot.current=null,Se(pt))})},[]),Pe=ge=>{Ke(ge.format&&Yr.some(pt=>pt.id===ge.format)?ge.format:null),Ye(ge.count??null),qt(ge.quality&&oi.some(pt=>pt.id===ge.quality)?ge.quality:null)};s.useEffect(()=>{if(!i)return;const ge=(i.tokens??[]).find(pt=>pt.t==="format");ge&&Ke(ge.id),Ye(i.variants??null),i.quality&&qt(i.quality),oe(i.templateFields??{}),wt(ly(i))},[i]),s.useEffect(()=>{var b1;const ge=ht.current,pt=!!ge&&ge!==n.id;pt&&it(ge);const tn=!R||!pt&&(!!i||!!l),pn=ge!==n.id;let rn=null,An=null,Wr=null;if(!tn&&pn){const Dn=T5(n.id);Dn&&R8(Dn.tokens,Dn.tplFields)?(rn=ap(n,Dn.tokens),An=Dn.tplFields,Wr=Dn.lent??null):pt&&(rn=ti(),An={})}pt&&(Ke(null),Ye(null),qt(null),ne({}));const On=!!u&&u!==me.current||!!h&&h!==tt.current||!!p&&p!==Ct.current||!!g&&!u&&g!==be.current;let sr=null;if(w&&On){const Dn=pn?null:kt.current,ts=rn??(Dn?ot.current??Dn.tokens:null),ws=An??(Dn==null?void 0:Dn.tplFields)??{};ts&&R8(ts,ws)&&(sr={tokens:ts,tplFields:ws,lent:Wr??(Dn==null?void 0:Dn.lent)??null}),rn=ti(),An={},Wr=null,Ke(null),Ye(null),qt(null)}const or=()=>pn?ti():kt.current.tokens;let Oa=!1;if(u&&u!==me.current){me.current=u,Oa=!0;const Dn=rn??or(),ts=Dn.find(Ia=>Ia.t==="template"),ws=(ts==null?void 0:ts.id)??null,A2=((b1=G.find(Ia=>Ia.id===u))==null?void 0:b1.name)??"this scene",Zd=GS(ws,u,A2,null,null),au=g&&/^[a-f0-9]{32}$/.test(g)?g:null,x1=m&&m in bc?bc[m]:void 0;if((Zd.changed||au)&&(rn=[{t:"template",id:u,...f?{setup:f}:{},...au?{view:au,...x1?{viewName:x1}:{}}:{}},...Dn.filter(Ia=>Ia.t!=="template")],Zd.toast)){const Ia=Zd.toast;ee({kind:"info",title:Ia.title,action:{label:"Undo",onClick:()=>{var k1,S1;Ia.prevSceneId?(k1=de.current)==null||k1.insert({t:"template",id:Ia.prevSceneId}):(S1=de.current)==null||S1.removeTemplate()}}})}}if(h&&h!==tt.current){tt.current=h,Oa=!0;const Dn=rn??or();Dn.some(ws=>ws.t==="character"&&ws.id===h)||(rn=[...Dn,{t:"character",id:h}])}if(p&&p!==Ct.current){Ct.current=p,Oa=!0;const Dn=rn??or();Dn.some(ws=>ws.t==="product"&&ws.id===p)||(rn=[...Dn,{t:"product",id:p}])}if(g&&!u&&/^[a-f0-9]{32}$/.test(g)&&g!==be.current){be.current=g,Oa=!0;const Dn=rn??or();Dn.some(ws=>ws.t==="ref"&&ws.imageHash===g)||(rn=[...Dn,{t:"ref",imageHash:g,label:"Scene view"}])}if(rn&&(wt(rn),An&&oe(An)),Wr&&Pe(Wr),sr){const Dn=sr,ts=n.id;ee({kind:"info",title:"Started a new shot",action:{label:"Undo",onClick:()=>zY(ts,{tokens:Dn.tokens,tplFields:Dn.tplFields,setSlug:P,lent:Dn.lent??void 0})}})}Oa&&(y==null||y()),ht.current=n.id},[n.id,u,h,p,g]),s.useEffect(()=>{var ge;ce&&((ge=de.current)==null||ge.setTokens(ce),Se(void 0))},[ce]);const Xe=s.useMemo(()=>{var rn;const ge=Yr.find(An=>An.id===Ne)??Yr[0],tn=(((rn=oi.find(An=>An.id===st))==null?void 0:rn.edge)??1024)/Math.max(ge.w,ge.h),pn=An=>Math.max(256,Math.round(An*tn/8)*8);return{t:"format",id:ge.id,w:pn(ge.w),h:pn(ge.h)}},[Ne,st]),Lt=s.useMemo(()=>[Xe,...ae],[Xe,ae]),Ut=s.useMemo(()=>({tokens:Lt,templateFields:q,variants:Re,quality:st,format:Ne}),[Lt,q,Re,st,Ne]),At=ae.some(ge=>ge.t==="text"?!!ge.v.trim():!0),_t=s.useMemo(()=>{const ge=ae.find(pt=>pt.t==="template");return ge?G.find(pt=>pt.id===ge.id)??null:null},[ae,G]),Ae=s.useMemo(()=>{const ge=ae.find(pt=>pt.t==="template");return(ge==null?void 0:ge.id)??null},[ae]),Ve=s.useCallback(ge=>{var An,Wr;const pt=(_t==null?void 0:_t.id)??null,tn=(A==null?void 0:A.id)??null,pn=((An=G.find(On=>On.id===ge))==null?void 0:An.name)??"this scene",rn=GS(pt,ge,pn,tn,A?Dr(A):null);if(rn.changed&&((Wr=de.current)==null||Wr.insert({t:"template",id:ge}),rn.toast)){const On=rn.toast;ee({kind:"info",title:On.title,action:{label:"Undo",onClick:()=>{var sr,or;On.prevSceneId?(sr=de.current)==null||sr.insert({t:"template",id:On.prevSceneId}):(or=de.current)==null||or.removeTemplate(),On.branchWasCleared&&tn&&(j==null||j(tn))}}})}},[_t,A,G,ee,j]);s.useImperativeHandle(B,()=>({insertToken:ge=>{var pt;return(pt=de.current)==null?void 0:pt.insert(ge)},removeToken:ge=>{var pt;return(pt=de.current)==null?void 0:pt.remove(ge)},applyScene:ge=>Ve(ge),removeTemplate:()=>{var ge;return(ge=de.current)==null?void 0:ge.removeTemplate()},openAttach:ge=>uo(ge),showAttach:()=>{le.current||uo("All")},focus:()=>{var ge;return(ge=de.current)==null?void 0:ge.focus()},submit:()=>{ho()}}));const Je=s.useMemo(()=>nie(ae),[ae]),_=rie(Je),fe=Aoe(ae),we=s.useMemo(()=>Noe(fe),[fe]),Ue=s.useRef(Je);Ue.current=Je,s.useEffect(()=>{E==null||E(Ue.current)},[_,E]),s.useEffect(()=>{var ge;!F||!Ae||_t||((ge=de.current)==null||ge.removeTemplate(),ee({kind:"warning",title:"That scene is no longer available",detail:"Removed from the brief."}))},[F,Ae,_t,ee]);const Me=s.useRef(null);s.useEffect(()=>(je.current&&clearTimeout(je.current),je.current=setTimeout(()=>it(ht.current??n.id),500),()=>{je.current&&clearTimeout(je.current)}),[ae,q,nt,Ie,Yt,A==null?void 0:A.id,n.id,it]),s.useEffect(()=>R?_Y():void 0,[R]),s.useEffect(()=>{if(!R)return;const ge=pt=>{const tn=pt.detail;if(tn!==(ht.current??n.id))return;const pn=T5(tn);pn&&(wt(ap(n,pn.tokens)),oe(pn.tplFields),Pe(pn.lent??{}))};return window.addEventListener(b4,ge),()=>window.removeEventListener(b4,ge)},[R,n,wt]),s.useEffect(()=>()=>it(ht.current??n.id),[it]),s.useEffect(()=>{const ge=()=>it(ht.current??n.id);return window.addEventListener("beforeunload",ge),()=>window.removeEventListener("beforeunload",ge)},[it,n.id]);const ct=r.find(ge=>ge.id===se),Ot=ct?vl(ct.displayName):"This engine",zt=!!A&&A.kind!=="root"&&A.status==="running",Rt=A&&A.kind!=="root"&&A.status==="done"&&A.images.length>0||zt,kn=!!(ct!=null&&ct.supportsEdit),Sn=!!Q&&!!We&&We!==Ne&&Rt&&!_t,Qn=Sn?tie(gi(We),gi(Ne)):null,dn=Qn==="crop",mr=Qn==="extend"&&kn,Kt=Yr.find(ge=>ge.id===Ne),wr=Kt?`${Kt.label} ${Kt.hint}`:Ne,[Hr,wn]=s.useState(null),_o=()=>{A!=null&&A.images[0]&&wn({src:Tr(A.images[0]),kind:"shot",label:Dr(A),noun:"Refining this shot"})},Rn=Rt&&!_t&&(kn||dn||mr)?"edit":"generation",Ks=Rn==="edit"&&!!A&&H!=="overlay",Ps=Rt?_t?"A scene starts a new shot.":dn||mr||kn?null:`${(ct==null?void 0:ct.displayName)??"This engine"} cannot edit. This makes a new shot.`:null,on=s.useMemo(()=>{const ge=Yr.find(An=>An.id===Ne)??Yr[0],pt=`Aspect ${ge.label} ${ge.hint}`;if(Rn==="edit")return pt;const tn=oi.find(An=>An.id===st),pn=My(se),rn=pn==="ratio"||!tn?null:pn==="advisory"?`${tn.label}, asking for ${tn.edge} px`:`${tn.label} ${tn.edge} px`;return[pt,`${Re} shot${Re===1?"":"s"}`,rn&&`resolution ${rn}`].filter(Boolean).join(", ")},[Rn,Ne,Re,st,se]),yn=s.useRef(void 0),Wn=s.useRef(void 0);s.useEffect(()=>{var pn;const ge=Rt?(A==null?void 0:A.id)??null:null,pt=ge!==yn.current&&yn.current!==void 0;yn.current=ge;const tn=Ae!==Wn.current;Wn.current=Ae,!(!_t||!Rt)&&(pt&&!tn&&ge?(pn=de.current)==null||pn.removeTemplate():T==null||T())},[_t,Ae,Rt,A,T]);const Ur=(at==null?void 0:at.warnings.filter(ge=>ge.includes("built around a product")))??[],Jn=Sn&&!At,Fn=dn&&At,es=z.length>0&&ae.some(ge=>ge.t==="character"&&!z.some(pt=>pt.id===ge.id)),ca=!De&&(At||Jn)&&!Fn&&!es&&!!t&&!zt&&!L&&(dn||!te),Vo=te&&!dn?"Image generation is not set up yet":De?"Working on the last one":t?zt?"Wait for this version to finish, or press X to start a new shot":L?"Wait for this refinement to finish":Fn?"This shape is reached by cropping, and a crop uses no words. Clear the prompt, or keep the current shape.":es?"Remove the presenter who is no longer in your roster":!At&&!Jn?"Write a prompt first":null:"Still opening this brand";s.useEffect(()=>{const ge=Rn==="edit"&&!!A;if(dn||!At&&!ge){Zt(null);return}Me.current&&clearTimeout(Me.current);const pt=Ut;return Me.current=setTimeout(()=>{Ee.previewBrief(Ut,se,n.id,ge?A.id:void 0).then(tn=>Zt({...tn,forBrief:pt})).catch(()=>Zt(null))},280),()=>{Me.current&&clearTimeout(Me.current)}},[Ut,se,n.id,At,Rn,A,dn]);const ms=ge=>{var pt;ie(ge),(pt=de.current)==null||pt.focus()},Gs=ge=>{var pt;rt(ge),(pt=de.current)==null||pt.focus()},Zo=ge=>{var pt;ze(ge),(pt=de.current)==null||pt.focus()},Ys=ge=>{var pt;ge.preventDefault(),(pt=de.current)==null||pt.focus()},uo=ge=>{Tt(ge),et(pt=>pt+1),Ft(!0)},le=s.useRef(!1);le.current=jt;const He=s.useRef(uo);He.current=uo;const lt=s.useCallback(({restore:ge})=>{var pt;le.current&&(le.current=!1,Ft(!1),ge&&((pt=de.current)==null||pt.restoreCaret()))},[]),en=s.useRef(Ve);en.current=Ve;const nn=s.useRef(ae);nn.current=ae;const Zn=s.useCallback(ge=>{var tn;const pt=ge.token;pt.t==="template"?en.current(pt.id):(tn=de.current)==null||tn.insert(pt)},[]),Tn=s.useCallback(ge=>{var tn,pn;const pt=ge.token;pt.t==="template"?(tn=de.current)==null||tn.removeTemplate():(pn=de.current)==null||pn.remove(pt)},[]),Pn=async ge=>{var tn;if(!(ge!=null&&ge.length))return;const pt=Array.from(ge).filter(pn=>pn.type.startsWith("image/"));if(!pt.length){ee({kind:"warning",title:"Only images can be attached here"});return}Wt(!0),bt(null);try{for(const pn of pt.slice(0,4)){const rn=await df(pn);(tn=de.current)==null||tn.insert({t:"ref",imageHash:rn,label:aie(pn.name)})}pt.length>4&&ee({kind:"warning",title:"Only the first 4 images were attached",detail:`${pt.length-4} more ${pt.length-4===1?"was":"were"} skipped. Attach ${pt.length-4===1?"it":"them"} in another pick.`})}catch(pn){bt(String(pn.message??pn)),ee(ln(pn,"Could not attach that image"))}finally{Wt(!1),Fe.current&&(Fe.current.value="")}},un=at&&at.forBrief===Ut?at:null,gr=s.useMemo(()=>ae.filter(ge=>F0.has(ge.t)).length,[ae]),ua=s.useRef(null),Or=s.useMemo(()=>gr===0?(ua.current=null,null):(un&&(ua.current={cap:doe(un),described:foe(un),preview:un}),ua.current),[un,gr]),tu=(Or==null?void 0:Or.cap)??null,gs=(Or==null?void 0:Or.preview)??null,fo=(ct==null?void 0:ct.displayName)??"This engine",zl=gr>=Gp?X4:null;s.useEffect(()=>{C==null||C(zl)},[zl,C]);const nu=ge=>{const pt=Or==null?void 0:Or.described;return!pt||pt.size===0?!1:ge.t==="product"?pt.has(vc("product",ge.id)):ge.t==="character"?pt.has(vc("character",ge.id)):ge.t==="template"?pt.has(vc("scene",ge.id)):ge.t==="ref"?pt.has(vc("reference",ge.imageHash)):ge.t==="mark"?pt.has(vc("brand",ge.imageHash)):!1},g1=tu!=null?`Described in words: ${fo} pictures ${tu} per shot, products and presenters first. Drag it earlier to picture it.`:null,Li=_t?Ur.length>0?"This scene builds around a product. Attach one.":(gs==null?void 0:gs.warnings.some(ge=>ge.includes("built around a person")))??!1?"This scene builds around a person. Without a presenter, only the set renders.":null:null,ru=ge=>{var An,Wr;if(ge.t==="template")return Li;if(ge.t==="product"&&U&&O&&!((V.length?V:((An=n.json)==null?void 0:An.products)??[]).some(or=>or.id===ge.id)||K.some(or=>or.id===ge.id)))return"This product is no longer in your library. Remove it from the brief.";if(ge.t==="mark"&&!r1(n.json).some(On=>On.hash===ge.imageHash))return"This mark is no longer in your brand kit. Remove it from the brief.";if(!gs)return null;const pt=(ct==null?void 0:ct.displayName)??"this engine",tn=gs.cap,pn=On=>`${On} won't reach ${pt} this time.`,rn=(On,sr)=>{var or;return((or=gs.dropped)==null?void 0:or.some(Oa=>Oa.role===On&&Oa.id===sr&&Oa.reason==="missing"))??!1};if(ge.t==="ref"&&!gs.attachments.some(On=>On.hash===ge.imageHash))return tn===0?`This reference won't reach ${pt}. Choose an engine that reads images, or remove it.`:tn==null?pn("This reference"):null;if(ge.t==="mark"&&!gs.attachments.some(On=>On.role==="brand"&&On.hash===ge.imageHash))return tn===0?`The brand mark won't reach ${pt}, so the logo can't be drawn from it. Choose an engine that reads images.`:tn==null?`${pn("The brand mark")} The logo can't be drawn from it.`:null;if(ge.t==="mark"){const On=gs.warnings.find(sr=>sr.includes("px across"));if(On)return On}if(ge.t==="product"){const sr=(V.length?V:((Wr=n.json)==null?void 0:Wr.products)??[]).find(or=>or.id===ge.id)??K.find(or=>or.id===ge.id);if(sr&&!gs.attachments.some(or=>or.role==="product"&&or.id===sr.id))return rn("product",sr.id)?`${sr.name} has no usable photo. Re-add one, or remove this.`:null}if(ge.t==="character"){const On=z.find(sr=>sr.id===ge.id);if(!On&&z.length>0)return"This presenter is no longer in your roster. Remove them from the brief.";if(On&&!gs.attachments.some(sr=>sr.role==="character"&&sr.id===On.id))return rn("character",On.id)?`${On.name} has no usable photo. Re-add one, or remove this.`:null}return null},v1=s.useCallback(ru,[gs,ct==null?void 0:ct.displayName,Li,V,U,n.json,K,O,z]),vs=s.useCallback(nu,[Or]),ho=async()=>{var pt,tn,pn;if(!ca)return;Ge(!0),bt(null);const ge=ae.flatMap(rn=>rn.t==="text"?[rn.v]:[]).join(" ").replace(/\s+/g," ").trim();S==null||S({said:ge||"Your shot",count:Rn==="generation"?Re:1,format:Ne});try{if(!t)throw new Error("the workspace is still loading");const rn=await Ee.addNode({projectId:t,parentId:Rn==="edit"&&A?A.id:a,kind:Rn,engineId:se,count:Re,brief:{...Ut,tokens:ap(n,Ut.tokens)},...Rn==="edit"&&M?{sourceImage:M}:{},...Rn==="edit"&&Qn?{reshape:Qn}:{}}),An=rn.warnings??[];An.length===1?ee({kind:"warning",title:"Sent, with one thing to know",detail:An[0]}):An.length>1&&ee({kind:"warning",title:`Sent, with ${An.length} things to know`,detail:An.join(" ")}),ot.current=null,(pt=de.current)==null||pt.setTokens(ti()),oe({}),Ke(null),ne({}),Ye(null),qt(null),R&&D5(n.id),k(rn.id,Rn,(tn=rn.siblings)==null?void 0:tn.map(Wr=>Wr.id),(pn=rn.siblings)!=null&&pn.length?rn.siblings:[rn])}catch(rn){const An=String(rn.message??rn);bt(An),ee(ln(rn,"That did not send",ct==null?void 0:ct.displayName)),S==null||S(null)}finally{Ge(!1)}},$i=(Vd=ae.find(ge=>ge.t==="product"))==null?void 0:Vd.id,Ti=$i?V.find(ge=>ge.id===$i)??(((y1=n.json)==null?void 0:y1.products)??[]).find(ge=>ge.id===$i)??K.find(ge=>ge.id===$i)??null:null,w1=Ti?Jw(Ti):null,su=D?{brandId:n.id,products:ae.filter(ge=>ge.t==="product").length,presenters:ae.filter(ge=>ge.t==="character").length,scene:!!_t,others:ae.filter(ge=>ge.t==="color"||ge.t==="ref"||ge.t==="mark").length,words:ae.some(ge=>ge.t==="text"&&!!ge.v.trim()),busy:De,pickerOpen:jt,refining:Rn==="edit"&&!!A,engine:te?J?"setup":"settings":"ready"}:null;s.useEffect(()=>{su&&Sk(su)}),s.useEffect(()=>{if(D)return()=>Sk(null)},[D]),s.useEffect(()=>{if(!D||!jt)return;const ge=()=>lt({restore:!0});return window.addEventListener("scenri:guide-close-picker",ge),()=>window.removeEventListener("scenri:guide-close-picker",ge)},[D,jt,lt]),s.useEffect(()=>{if(!D)return;const ge=pt=>{var An;const{kind:tn}=pt.detail,pn=tn==="presenter"?"character":tn==="scene"?"template":"product",rn=[...nn.current].reverse().find(Wr=>Wr.t===pn);rn&&((An=de.current)==null||An.remove(rn))};return window.addEventListener("scenri:guide-take-back",ge),()=>window.removeEventListener("scenri:guide-take-back",ge)},[D]),s.useEffect(()=>{if(!T)return;const ge=()=>T();return window.addEventListener("scenri:guide-clear-refine",ge),()=>window.removeEventListener("scenri:guide-clear-refine",ge)},[T]),s.useEffect(()=>{if(!D)return;const ge=pt=>{const{tab:tn}=pt.detail;Qe(tn??null),tn&&He.current(tn)};return window.addEventListener("scenri:guide-picker",ge),()=>{window.removeEventListener("scenri:guide-picker",ge),Qe(null)}},[D]);const[Bl,Di]=s.useState(!1),Ul=H==="overlay"&&(Bl||ae.some(ge=>ge.t==="text"&&!!ge.v.trim()));return s.useEffect(()=>{H==="overlay"&&Ek({engaged:Ul})},[H,Ul]),s.useEffect(()=>{if(H==="overlay")return()=>Ek(null)},[H]),o.jsxs("div",{className:"sc-composer","data-guide":D?"compose":void 0,onPointerDownCapture:H==="overlay"&&!Bl?()=>Di(!0):void 0,onKeyDownCapture:H==="overlay"&&!Bl?()=>Di(!0):void 0,children:[o.jsx("input",{ref:Fe,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ge=>void Pn(ge.target.files)}),Hr&&o.jsx(Ed,{src:Hr.src,kind:Hr.kind,label:Hr.label,noun:Hr.noun,onRestoreFocus:()=>{var ge;return(ge=de.current)==null?void 0:ge.restoreCaret()},onClose:()=>wn(null)}),jt&&o.jsx(Voe,{brand:n,activeProductCategory:w1,refining:Ks,full:zl,initialTab:Pt,tabNonce:ke,only:Et,id:xt,attached:we,onUpload:()=>{var ge;return(ge=Fe.current)==null?void 0:ge.click()},onFiles:ge=>void Pn(ge),onPick:Zn,onRemove:Tn,onClose:lt}),X&&o.jsx("div",{className:"sc-notes","data-guide-shape":D?"":void 0,children:X&&o.jsxs("div",{className:"sc-banner","data-tone":"action",children:[o.jsx("span",{className:"sc-banner-ic",children:X.icon}),o.jsxs("span",{className:"sc-banner-txt",children:[o.jsx("b",{children:X.title}),o.jsxs("small",{children:[X.detail,X.info&&o.jsxs(gd,{children:[o.jsx(vd,{children:o.jsx("button",{type:"button",className:"sc-note-info","aria-label":"What a ChatGPT account has to do with this",children:o.jsx(pm,{size:13})})}),o.jsxs(wd,{className:"sc-note-pop",align:"start",sideOffset:8,width:"300px",children:[o.jsx("p",{children:"Codex CLI signs in with your ChatGPT account and makes the images there. Every plan includes some Codex usage, so how many images you get depends on the plan you are on."}),o.jsx("p",{children:"No ChatGPT account, or run out for now? Use your own key from an image provider instead."}),o.jsx("p",{className:"sc-note-pop-fine",children:"Scenri never sees your password or token. The sign-in happens in your browser and stays with Codex."}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>Y("engines"),children:"Use a provider key instead"})]})]})]})]}),o.jsx("button",{type:"button",className:"sc-banner-act","data-primary":"","data-guide":D?"compose.engine":void 0,onClick:X.onAct,children:X.action})]})}),o.jsxs("div",{className:"sc-promptcard","data-guide-shape":D?"":void 0,children:[Rt&&(T||H==="overlay"&&Rn==="edit")&&o.jsxs("div",{className:"sc-target","data-note":Ps?"":void 0,children:[o.jsx(zoe,{target:A,onOpenImage:_o,onClear:T}),Ps&&o.jsx("small",{className:"sc-target-note",children:Ps})]}),Rt&&!T&&Ps&&!(H==="overlay"&&Rn==="edit")&&o.jsx("small",{className:"sc-target-note sc-target-note-alone",children:Ps}),Sn&&(dn||mr)&&o.jsxs("small",{className:"sc-reshape-hint","aria-live":"polite",children:[dn?"Will crop to":"Will extend to"," ",wr]}),o.jsx(poe,{ref:de,onChange:Le,brand:n,templates:G,presenters:z,demoProducts:K,onTemplatePick:Ve,scenesSitOut:Ks,flag:v1,described:vs,describedNote:g1,onInspect:ge=>wn(ge),onAttachRequest:ge=>uo(ge),activeProductCategory:w1,placeholder:_t?"Add art direction, or run it as written":Rn==="edit"?"Say what to change about this shot":"What should we shoot? (use $ / @ #)",placeholderSm:_t||Rn==="edit"?void 0:"What should we shoot? ($ / @ #)",label:_t?"Art direction":Rn==="edit"?"What to change":"Shot brief",onSubmit:()=>void ho(),onDropFiles:ge=>void Pn(ge)}),o.jsxs("div",{className:"sc-prompt-row",children:[o.jsxs("div",{className:"sc-prompt-left",children:[o.jsx("button",{type:"button",ref:_e,className:"sc-icon-btn sc-attach-toggle","data-guide":D?"compose.add":void 0,"aria-expanded":jt,"aria-controls":jt?xt:void 0,"aria-label":"Add to shot",title:"Add a product, a presenter, a scene, a colour or an image",onClick:()=>jt?lt({restore:!1}):uo("All"),children:an?o.jsx(Pr,{size:"1"}):o.jsx(pr,{size:16})}),pe.length>1&&o.jsxs(SN,{value:se,onValueChange:xe,children:[o.jsxs(EN,{variant:"ghost",className:"sc-mini-sel",children:[o.jsx(tf,{size:14}),o.jsx("span",{className:"sc-mini-sel-t",children:ct?vl(ct.displayName):"Demo"})]}),o.jsx(CN,{children:pe.map(ge=>o.jsx(jN,{value:ge.id,children:vl(ge.displayName)},ge.id))})]})]}),o.jsxs("div",{className:"sc-prompt-right",children:[o.jsx(qoe,{mode:Rn,engineId:se,engineName:Ot,formatId:Ne,onFormat:ms,count:Re,onCount:Zo,quality:st,onQuality:Gs,onCloseAutoFocus:Ys,guided:D}),o.jsxs(gd,{open:Mn,onOpenChange:re,children:[o.jsx(vd,{children:o.jsxs("button",{type:"button",className:"sc-var sc-more","aria-label":`Shot settings. ${on}`,"data-guide":D&&!ue?"compose.settings":void 0,children:[o.jsx(Tv,{size:14}),"More"]})}),o.jsx(wd,{className:"sc-morepop",align:"end",sideOffset:8,width:"300px",onOpenAutoFocus:Ry,onCloseAutoFocus:Ys,children:o.jsx(mL,{mode:Rn,engineId:se,engineName:Ot,formatId:Ne,onFormat:ms,count:Re,onCount:Zo,quality:st,onQuality:Gs})})]}),o.jsx(Xoe,{guide:D&&ue?"compose.settings":void 0,mode:Rn,engineId:se,engineName:Ot,formatId:Ne,onFormat:ms,count:Re,onCount:Zo,quality:st,onQuality:Gs}),o.jsxs("button",{type:"button",className:"sc-send","data-guide":D?"compose.send":void 0,"aria-disabled":!ca||void 0,onClick:()=>void ho(),"aria-label":Rn==="edit"?"Refine":"Generate",title:ft??Li??Vo??`${Rn==="edit"?"Refine":"Generate"} (enter)`,children:[o.jsx("span",{className:"sc-send-ico",children:De?o.jsx(Pr,{size:"1"}):o.jsx(eE,{size:17,weight:"bold"})}),o.jsx("span",{className:"sc-send-lb",children:Rn==="edit"?"Refine":"Generate"})]})]})]})]})]})});function aie(e){return e.replace(/\.[a-z0-9]{2,5}$/i,"").trim()||"Image"}function Ly(e,t){s.useLayoutEffect(()=>{if(!e||typeof ResizeObserver>"u")return;const n=document.documentElement,r=()=>n.style.setProperty(t,`${Math.round(e.offsetHeight)}px`);r();const a=new ResizeObserver(r);return a.observe(e),()=>{a.disconnect(),n.style.removeProperty(t)}},[e,t])}function wL({full:e=!0,children:t}){const[n,r]=s.useState(null);return Ly(n,"--sc-dock-h"),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-dock-fade","data-full":e,"aria-hidden":!0}),o.jsx("div",{className:"sc-canvas-dock","data-full":e,ref:r,children:t})]})}function $y(){const{brand:e}=cn(),{tasks:t}=ia(),[n,r]=s.useState(null),[a,i]=s.useState(null),[l,u]=s.useState(()=>Date.now()),f=s.useRef({id:"",pct:0}),h=t.find(y=>y.kind==="catalog"&&y.state==="running");if(s.useEffect(()=>{if(!h)return;const y=window.setInterval(()=>u(Date.now()),1e3);return()=>window.clearInterval(y)},[h]),!h&&!a)return null;const p=h!=null&&h.id.startsWith("catalog:")?h.id.slice(8):null,g=h!=null&&n===h.id,m=Zq(e.json),w=Jr(m==null?void 0:m.file);return h&&(f.current.id!==h.id&&(f.current={id:h.id,pct:0}),f.current.pct=Math.max(f.current.pct,h.percent??0)),o.jsxs(o.Fragment,{children:[h&&o.jsxs("div",{className:"sc-impbar",role:"status",style:{"--sc-impbar-p":`${f.current.pct}%`},children:[o.jsx("span",{className:"sc-impbar-fill","aria-hidden":!0}),o.jsxs("button",{type:"button",className:"sc-impbar-open",onClick:()=>p&&i(p),disabled:!p,"aria-label":"Show import details",children:[o.jsx("span",{className:"sc-impbar-mark","aria-hidden":!0,children:w?o.jsx("img",{src:w,alt:"",className:(m==null?void 0:m.role)==="mark"?"sc-impbar-badge":void 0}):o.jsx(cC,{size:13,weight:"regular"})}),o.jsx("span",{className:"sc-impbar-count",children:h.subtitle}),o.jsx("span",{className:"sc-impbar-clock",children:Dc(h.startedAt,l)})]}),p&&o.jsxs("button",{type:"button",className:"sc-impbar-stop",disabled:g,"aria-label":"Stop importing",onClick:()=>{r(h.id),Ee.cancelCatalogJob(e.id,p).catch(()=>r(null))},children:[o.jsx(jn,{size:12,weight:"bold"}),g?"Stopping":"Stop"]})]}),a&&o.jsx(A4,{brandId:e.id,jobId:a,onDismiss:()=>i(null)})]})}const oie={presenter:"Presenter",product:"Product",scene:"Scene"};function yL({entry:e,productName:t,productPreviewUrl:n,productId:r,presenterName:a,presenterPreviewUrl:i,presenterId:l,sceneName:u,scenePreviewUrl:f,sceneId:h,onOpen:p,productHref:g,presenterHref:m,sceneHref:w,active:y,hideRecipe:b,decorative:k,size:S="grid"}){const{contentArriving:E}=Nn(),C=[t,a,u].filter(Boolean).join(" · "),A=a?{key:"presenter",name:a,previewUrl:i,linked:!!(m&&l),href:m&&l?m(l):void 0}:null,L=n&&t?{key:"product",name:t,previewUrl:n,linked:!!(g&&r),href:g&&r?g(r):void 0}:null,T=f&&u?{key:"scene",name:u,previewUrl:f,linked:!!(w&&h),href:w&&h?w(h):void 0}:null;return o.jsxs("div",{className:"sc-showcase-tile","data-active":y||void 0,"aria-hidden":k||void 0,...k?{inert:""}:{},children:[o.jsx(Td,{id:e.id,previewUrl:e.previewUrl,pending:!e.previewUrl&&E,title:e.title,primary:e.title,secondary:b?"":C,useLabel:"Recreate this",variant:"use",onOpen:p,onUse:p,size:S}),(A||L||T)&&o.jsx(lie,{presenter:A,product:L,scene:T})]})}function iie(e){return o.jsx(t2,{...e,caption:!1})}function lie({presenter:e,product:t,scene:n}){const[r,a]=s.useState(null),i=[t,n].filter(Boolean),l=i.length+(e?1:0)+Math.max(0,i.length-1);let u=0;const f=()=>({"--i":u++});return o.jsxs("div",{className:"sc-showcase-chips",onMouseLeave:()=>a(null),children:[e&&o.jsx(YS,{credit:e,open:r==="presenter",onEnter:()=>a("presenter"),children:uie(e)}),i.length>0&&o.jsxs("div",{className:"sc-showcase-recipe",style:{"--n":l},children:[e&&o.jsx("span",{className:"sc-showcase-join",style:f(),"aria-hidden":!0}),i.map((h,p)=>o.jsxs(s.Fragment,{children:[p>0&&o.jsx("span",{className:"sc-showcase-join",style:f(),"aria-hidden":!0}),o.jsx(YS,{credit:h,open:r===h.key,onEnter:()=>a(h.key),style:f(),children:cie({credit:h,step:p===0?1:2})})]},h.key))]})]})}function YS({credit:e,open:t,onEnter:n,children:r,style:a}){const i=s.useRef(null),l=s.useRef(null),[u,f]=s.useState(null),h=XM(),p=h==="large"?144:88,g=h==="large"?168:112;if(s.useLayoutEffect(()=>{var S,E;if(!t||!e.previewUrl){f(null);return}const w=()=>{const C=i.current;if(!C)return;const A=C.getBoundingClientRect(),L=l.current,T=(L==null?void 0:L.offsetWidth)||p,M=(L==null?void 0:L.offsetHeight)||g,j=window.visualViewport,P=cae(A,{width:(j==null?void 0:j.width)??window.innerWidth,height:(j==null?void 0:j.height)??window.innerHeight},{width:T,height:M});if(!P){f(null);return}f({left:Math.round(P.left),top:Math.round(P.top)})};w();const y=requestAnimationFrame(w),b=i.current,k=b?new ResizeObserver(w):null;return b&&k&&k.observe(b),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),(S=window.visualViewport)==null||S.addEventListener("resize",w),(E=window.visualViewport)==null||E.addEventListener("scroll",w),()=>{var C,A;cancelAnimationFrame(y),k==null||k.disconnect(),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w),(C=window.visualViewport)==null||C.removeEventListener("resize",w),(A=window.visualViewport)==null||A.removeEventListener("scroll",w)}},[t,e.previewUrl,e.key,p,g]),!e.previewUrl)return o.jsx("span",{ref:i,className:"sc-credit-tip",onPointerEnter:n,style:a,children:r});const m=oie[e.key];return o.jsxs("span",{ref:i,className:"sc-credit-tip","data-open":t||void 0,onPointerEnter:n,style:a,children:[r,t&&Br.createPortal(o.jsx("span",{ref:l,className:"sc-credit-tip-pop","data-size":h,style:u?{left:u.left,top:u.top}:{left:-9999,top:0},role:"tooltip","aria-label":`${m}: ${e.name}`,children:o.jsxs("span",{className:"sc-credit-tip-card",children:[o.jsx("img",{src:$n(e.previewUrl,"small"),alt:""}),o.jsx("span",{className:"sc-credit-tip-name",children:e.name}),o.jsx("span",{className:"sc-credit-tip-role",children:m})]})}),document.body)]})}function cie({credit:e,step:t}){const{name:n,previewUrl:r,linked:a,href:i}=e;return a&&i?o.jsx(Vn,{className:"sc-showcase-chip",to:i,"data-link":!0,"data-step":t,"aria-label":`See ${n}`,onClick:l=>l.stopPropagation(),children:r?o.jsx("img",{src:$n(r,"micro"),alt:""}):null}):o.jsx("span",{className:"sc-showcase-chip","data-step":t,children:r?o.jsx("img",{src:$n(r,"micro"),alt:n}):o.jsx("span",{className:"sc-vh",children:n})})}function uie(e){const{name:t,previewUrl:n,linked:r,href:a}=e;return r&&a?o.jsxs(Vn,{className:"sc-showcase-badge",to:a,"data-link":!0,"aria-label":`See ${t}`,onClick:i=>i.stopPropagation(),children:[n?o.jsx("img",{src:$n(n,"micro"),alt:""}):null,o.jsx("span",{className:"sc-showcase-badge-name",children:t})]}):o.jsxs("span",{className:"sc-showcase-badge","aria-hidden":!0,children:[n?o.jsx("img",{src:$n(n,"micro"),alt:""}):null,o.jsx("span",{className:"sc-showcase-badge-name",children:t})]})}function qS(e){return{key:"open-tab",icon:"open-tab",label:"Open in new tab",onSelect:()=>window.open(e,"_blank")}}function XS(e){return{key:"select",icon:"select",label:"Select",onSelect:e}}function Cl(e){if(e.only)return[{key:"only",icon:"use",label:e.only.label,onSelect:e.only.run}];if(e.draft){const n=[{key:"continue",icon:"continue",label:"Continue",onSelect:e.draft.onContinue}];return e.draft.href&&n.push(qS(e.draft.href)),e.select&&n.push(XS(e.select.run)),n.push({key:"discard",icon:"discard",label:"Discard",onSelect:e.draft.onDiscard,danger:!0,separated:!0}),n}const t=[];return e.onOpen&&t.push({key:"open",icon:"open",label:"Open",onSelect:e.onOpen}),e.href&&t.push(qS(e.href)),e.use&&t.push({key:"use",icon:"use",label:e.use.label,onSelect:e.use.run}),e.select&&t.push(XS(e.select.run)),e.keep&&t.push({key:"keep",icon:e.keep.on?"kept":"keep",label:e.keep.on?"Remove from Keepers":"Add to Keepers",onSelect:e.keep.run}),e.onRename&&t.push({key:"rename",icon:"rename",label:"Rename",onSelect:e.onRename}),e.onDuplicate&&t.push({key:"duplicate",icon:"duplicate",label:"Duplicate presenter",onSelect:e.onDuplicate}),e.onEdit&&t.push({key:"edit",icon:"edit",label:"Edit presenter",onSelect:e.onEdit}),e.remove&&t.push({key:"delete",icon:"delete",label:e.remove.label,onSelect:e.remove.run,danger:!0,separated:!0}),t}function cs(e,t){if(e==="draft")return{tool:"Discard",menu:t>1?`Discard ${t} drafts`:"Discard",icon:"discard",danger:!0};const n=e==="presenter"?"Delete presenter":e==="product"?"Delete product":"Delete scene",r=e==="presenter"?"presenters":e==="product"?"products":"scenes";return{tool:"Delete",menu:t>1?`Delete ${t} ${r}`:n,icon:"delete",danger:!0}}function ji(e,t){const n=t>1;return e==="owned-scene"?n?"Shots already made here keep their images. Their recipe will say these scenes are gone, and building from one again will miss them.":"Shots already made here keep their images. Their recipe will say this scene is gone, and building from one again will miss it.":e==="product"?n?"Shots already made with them keep their images. Their recipe loses these products, and building from one again will miss them.":"Shots already made with it keep their images. Their recipe loses this product, and building from one again will miss it.":n?"Shots already made with them keep their images. Their recipe loses these people, and building from one again will miss them.":"Shots already made with them keep their images. Their recipe loses this person, and building from one again will miss them."}function p2(e,t,n){return{tool:t?"Remove from keepers":"Keep",menu:e>1?t?`Remove ${e} ${n} from Keepers`:`Add ${e} ${n} to Keepers`:t?"Remove from Keepers":"Add to Keepers",icon:t?"kept":"keep"}}function m2({kind:e,count:t,openLabel:n,onOpen:r,href:a,onDeselect:i,onAct:l,onKeep:u,allKept:f}){const h=cs(e,t),p=[{key:"open",icon:n==="Continue"?"continue":"open",label:n,onSelect:r}];if(a&&p.push({key:"open-tab",icon:"open-tab",label:"Open in new tab",onSelect:()=>window.open(a,"_blank")}),p.push({key:"deselect",icon:"select",label:t>1?"Deselect this":"Deselect",onSelect:i}),u&&e!=="draft"){const m=p2(t,!!f,e==="presenter"?"presenters":e==="product"?"products":"scenes");p.push({key:"keep",icon:m.icon,label:m.menu,onSelect:u})}return p.push({key:e==="draft"?"discard":"delete",icon:h.icon,label:h.menu,onSelect:l,danger:h.danger||void 0,separated:!0}),p}async function Qp(e,t){const n=[];let r;for(const a of e)try{await t(a)}catch(i){if((i==null?void 0:i.status)===404)continue;n.push(a),r??(r=i)}return{failed:n,error:r}}function nv({presenter:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,onDuplicate:u,onEdit:f,onDelete:h,onRename:p,bookmarked:g,onBookmark:m,fresh:w,chosen:y,batching:b,onPick:k,batch:S,size:E="grid"}){const A=S?m2({kind:"presenter",count:S.count,openLabel:"Open",onOpen:()=>n==null?void 0:n(e.id),href:a,onDeselect:()=>k==null?void 0:k(e.id),onAct:S.onAct,onKeep:S.onKeep,allKept:S.allKept}):Cl(!a&&!r&&!!n?{only:{label:"Use in a shot",run:()=>n(e.id)}}:{onOpen:n?()=>n(e.id):void 0,href:a,use:r?{label:"Use in a shot",run:()=>r(e.id)}:void 0,select:k?{run:()=>k(e.id)}:void 0,keep:m?{on:!!g,run:()=>m(e.id)}:void 0,onRename:p?()=>p(e.id):void 0,onDuplicate:u?()=>u(e.id):void 0,onEdit:f?()=>f(e.id):void 0,remove:h?{label:"Delete presenter",run:()=>h(e.id)}:void 0});return o.jsx(Td,{id:e.id,previewUrl:e.previewUrl,title:e.descriptor||e.name,primary:e.name,secondary:"",useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,menu:A,bookmarked:g,onBookmark:m,fresh:w,chosen:y,batching:b,onPick:k,size:E})}function bL(e){return o.jsx(t2,{...e})}function xf({scene:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,bookmarked:u,onBookmark:f,onDelete:h,onRename:p,chosen:g,batching:m,onPick:w,batch:y,size:b="grid"}){const S=y&&h?m2({kind:"owned-scene",count:y.count,openLabel:"Open",onOpen:()=>n==null?void 0:n(e.id),href:a,onDeselect:()=>w==null?void 0:w(e.id),onAct:y.onAct,onKeep:y.onKeep,allKept:y.allKept}):Cl(!a&&!r&&!!n?{only:{label:"Use in a shot",run:()=>n(e.id)}}:{onOpen:n?()=>n(e.id):void 0,href:a,use:r?{label:"Use in a shot",run:()=>r(e.id)}:void 0,select:w?{run:()=>w(e.id)}:void 0,keep:f?{on:!!u,run:()=>f(e.id)}:void 0,onRename:p?()=>p(e.id):void 0,remove:h?{label:"Delete scene",run:()=>h(e.id)}:void 0});return o.jsx(Td,{id:e.id,previewUrl:e.previewUrl,title:e.description||El(e,"tooltip"),primary:El(e,"card"),secondary:"",useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,bookmarked:u,onBookmark:f,menu:S,chosen:g,batching:m,onPick:w,size:b})}function xL(e){return o.jsx(t2,{...e})}const Bu=new Map,die=50;function fie(e,t){for(Bu.delete(e),Bu.set(e,t);Bu.size>die;)Bu.delete(Bu.keys().next().value)}function hie(e){return Bu.get(e)}const pie=1e3;function ds({className:e="sc-home",children:t}){const n=s.useRef(null),{key:r}=Un(),a=s.useRef(!1);return s.useLayoutEffect(()=>{const i=n.current,l=hie(r);if(!i||!l)return;let u=!1;const f=()=>{u||(u=!0,a.current=!1,p.disconnect(),clearTimeout(g),i.removeEventListener("wheel",f),i.removeEventListener("touchstart",f))},h=()=>{u||(i.scrollTop=l,Math.abs(i.scrollTop-l)<1&&f())};a.current=!0;const p=new ResizeObserver(h),g=setTimeout(f,pie);return i.addEventListener("wheel",f,{passive:!0}),i.addEventListener("touchstart",f,{passive:!0}),h(),p.observe(i),i.firstElementChild&&p.observe(i.firstElementChild),f},[r]),s.useEffect(()=>{const i=n.current;if(!i)return;const l=()=>{a.current||fie(r,i.scrollTop)};return i.addEventListener("scroll",l,{passive:!0}),()=>i.removeEventListener("scroll",l)},[r]),o.jsx("div",{ref:n,className:e,"data-page-scroll":"",children:t})}function g2({title:e,filters:t,active:n,summary:r,onClear:a,density:i,search:l,action:u}){return o.jsxs("div",{className:"sc-filterbar",children:[e?o.jsx("h1",{className:"sc-vh",children:e}):null,t,o.jsxs("div",{className:"sc-filterbar-actions",children:[n&&o.jsxs("span",{className:"sc-lib-count",children:[r,a&&o.jsx("button",{type:"button",className:"sc-lib-clear",onClick:a,children:"Clear"})]}),l,i,u?o.jsx("span",{className:"sc-filterbar-cta",children:u}):null]})]})}function v2({mode:e,group:t}){if(e==="none"||!t)return null;const n=[{value:null,label:t.everyLabel,count:t.everyCount},...t.options.map(r=>({value:r.value,label:r.label,count:r.count}))];return o.jsx(Ay,{"aria-label":t.label,activeKey:t.selected,items:n,onSelect:t.onSelect})}const Ty=o.jsx(eo,{size:21,weight:"regular"});function No({shape:e,title:t,body:n,action:r,mark:a,onRetry:i}){return e==="error"?o.jsxs(o.Fragment,{children:[o.jsx("h1",{children:t??"Couldn't load this library"}),o.jsx("p",{className:"sc-lookpage-lede",children:n}),o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:i,children:"Retry"})})]}):e==="cold"?o.jsxs("div",{className:"sc-canvas-empty",children:[t&&o.jsx("h3",{children:t}),o.jsx("p",{children:n}),r&&o.jsx("div",{className:"sc-lookpage-acts",children:r})]}):o.jsxs("div",{className:"sc-lib-zero",children:[a&&o.jsx("span",{className:"sc-lib-zero-mark","aria-hidden":!0,children:a}),t&&o.jsx("h3",{children:t}),o.jsx("p",{children:n}),r]})}function w2({noun:e,q:t,facet:n,onClearSearch:r,onClearAll:a}){const i=t.trim(),l=i?o.jsxs(o.Fragment,{children:["No ",e," found for ",o.jsxs("em",{children:["“",i,"”"]}),n?` in ${n}`:""]}):o.jsxs(o.Fragment,{children:["No ",e," in ",n]});return o.jsx(No,{shape:"zero",body:l,action:o.jsxs("span",{className:"sc-lib-zero-acts",children:[i&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:r,children:"Clear search"}),i&&n&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:a,children:"Clear all"}),!i&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:a,children:"Clear filter"})]})})}const mie=150;function f1(e){const[t,n]=jl(),r=t.get("q")??"",a=e.join(","),i=s.useMemo(()=>{const E={};for(const C of a.split(",").filter(Boolean))E[C]=t.get(C)||null;return E},[t,a]),l=s.useCallback(E=>{n(C=>{const A=new URLSearchParams(C);for(const[L,T]of Object.entries(E))T===null||T===""?A.delete(L):A.set(L,T);return A},{replace:!0})},[n]),[u,f]=s.useState(r),h=s.useRef(r),p=s.useRef(null),g=s.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]);s.useEffect(()=>{r!==h.current&&(h.current=r,g(),f(r))},[r,g]),s.useEffect(()=>g,[g]);const m=s.useCallback(E=>{f(E),g(),p.current=setTimeout(()=>{p.current=null,h.current=E,l({q:E||null})},mie)},[l,g]),w=s.useCallback((E,C)=>l({[E]:C}),[l]),y=l,b=u.trim().length>0||Object.values(i).some(Boolean),k=s.useCallback(()=>{g(),f(""),h.current="",l({q:null})},[l,g]),S=s.useCallback(()=>{g(),f(""),h.current="";const E={q:null};for(const C of a.split(",").filter(Boolean))E[C]=null;l(E)},[l,g,a]);return{q:u,setQ:m,facets:i,setFacet:w,setFacets:y,active:b,clearSearch:k,clear:S}}const gie=6,il=new Map;function QS(e){return il.get(e)??null}function vie(e){if(e.key)for(il.delete(e.key),il.set(e.key,e);il.size>gie;)il.delete(il.keys().next().value)}function wie(e){for(const[t,n]of il)n.brandId===e&&il.delete(t)}const yie=8;function bie(){var We;const{engines:e,scenes:t,loaded:n,presenters:r,presentersLoaded:a,demoProducts:i,showcase:l,showcaseCategories:u,showcaseLoaded:f,showcaseError:h,refetchShowcase:p}=Nn(),{brand:g,workspace:m,root:w,products:y,applyNodes:b}=cn(),k=t,{poke:S}=ia(),E=Vl(),C=Bn(),{push:A}=rr(),L=ky(),T=u2(),M=qse(),j=Nr(la),{q:P,setQ:R,facets:H,setFacet:D,clearSearch:B,clear:V}=f1(["category"]),U=H.category,K=Ne=>D("category",Ne),O=P.trim().length>0,[F,I]=Ma(qr.wallDensity,yd),G=Jc(F),z=Ne=>I(Ne),Y=e2(G),Z=Qm(G),ee=IX[G],pe=Ne=>{const ie=new URLSearchParams(Ne??{}).toString();C(`${Sr(g)}${ie?`?${ie}`:""}`)},se=y.length?y:((We=g.json)==null?void 0:We.products)??[],xe=Ne=>{var Re,ze,Ye;const ie=(Re=Ne.brief.tokens.find(Ie=>Ie.t==="product"))==null?void 0:Re.id,q=(ze=Ne.brief.tokens.find(Ie=>Ie.t==="character"))==null?void 0:ze.id,oe=(Ye=Ne.brief.tokens.find(Ie=>Ie.t==="template"))==null?void 0:Ye.id;return{product:ie?i.find(Ie=>Ie.id===ie):void 0,presenter:q?r.find(Ie=>Ie.id===q):void 0,scene:oe?k.find(Ie=>Ie.id===oe):void 0}},J=s.useMemo(()=>{const Ne=new Map;for(const ie of l){const{product:q,presenter:oe,scene:Re}=xe(ie);Ne.set(ie.id,Yse(ie,{product:q,presenter:oe,scene:Re},t6(ie.category)))}return Ne},[l,i,r,k]),te=s.useMemo(()=>(U?l.filter(ie=>ie.category===U):l).filter(ie=>Ho(J.get(ie.id)??ie.title,P)),[l,U,P,J]),X=s.useMemo(()=>{const Ne=eae(u);return{key:"category",label:"Categories",everyLabel:"All examples",everyCount:l.length,selected:U,onSelect:K,options:Ne.map(ie=>({value:ie,label:t6(ie)??ie,count:l.filter(q=>q.category===ie).length}))}},[l,u,U,K]),ae=Ne=>{const{product:ie,presenter:q,scene:oe}=xe(Ne);return{productName:ie?Do(ie,"chip"):null,productPreviewUrl:(ie==null?void 0:ie.previewUrl)??null,productId:(ie==null?void 0:ie.id)??null,presenterName:(q==null?void 0:q.name)??null,presenterPreviewUrl:q?ki(q).src:null,presenterId:(q==null?void 0:q.id)??null,sceneName:oe?El(oe,"chip"):null,scenePreviewUrl:(oe==null?void 0:oe.previewUrl)??null,sceneId:(oe==null?void 0:oe.id)??null}},[Le,ce]=s.useState(null),Ze=j?M:Ne=>{const ie=l.find(q=>q.id===Ne);ie&&(ce(Y4(ie)),A({kind:"info",title:`Starting from "${ie.title}"`}))},gt=()=>{const ie=[...Ci(g.id)].reverse().find(q=>k.some(oe=>oe.id===q));pe(ie?{scene:ie,attach:"products",compose:"1"}:{attach:"products",compose:"1"})},Ke=s.useMemo(()=>$p(s1(g),r),[g,r]),nt=Ke.slice(0,ee),$e=s.useMemo(()=>{const Ne=Ci(g.id);return $p(Qc(g),nL(k,ie=>Ne.includes(ie.id)))},[k,g]),ne=$e.slice(0,ee),Q=s.useMemo(()=>{var Ye,Ie,De,Ge,ft;const Ne=new Set,ie=bt=>!bt||Ne.has(bt)?null:(Ne.add(bt),$n(bt,"tile")),q=bt=>{for(const at of bt){const Zt=l.find(Ft=>Ft.id===at&&Ft.previewUrl),jt=ie(Zt==null?void 0:Zt.previewUrl);if(jt)return jt}return null},oe=bt=>{for(const at of bt){const Zt=k.find(Ft=>Ft.id===at&&Ft.previewUrl),jt=ie(Zt==null?void 0:Zt.previewUrl);if(jt)return jt}return null},Re=bt=>{for(const at of l)if(!(!at.previewUrl||Ne.has(at.previewUrl))&&!(bt&&!at.brief.tokens.some(Zt=>Zt.t===bt)))return ie(at.previewUrl);return null},ze=se.find(bt=>{var at,Zt;return Jr((Zt=(at=bt==null?void 0:bt.shots)==null?void 0:at[0])==null?void 0:Zt.file)});return{compose:ie(ze?Jr((Ie=(Ye=ze.shots)==null?void 0:Ye[0])==null?void 0:Ie.file):null)??q(["c15-orange-pool","orris-waterline","hoops-painted-canvas"])??ie((De=i.find(bt=>bt.id==="calder-vane-c15-serum"))==null?void 0:De.previewUrl)??ie((Ge=i.find(bt=>bt.previewUrl))==null?void 0:Ge.previewUrl)??Re("product"),product:q(["ridgeline-tyre-top","ridgeline-boulder-gap","yuzu-ice-burst"])??ie((ft=i.find(bt=>bt.id==="voss-rowe-ridgeline-trail"))==null?void 0:ft.previewUrl)??Re("product"),presenter:ie(ki(r.find(bt=>bt.id==="odette")??r.find(bt=>bt.avatarUrl)??r[0]??{}).src)??Re("character"),scene:oe(["travertine-window-light","palm-shade-garden","lantern-room","cobalt-container","sunlit-color-field"])??q(["lounge-chair-travertine","lounge-chair-snowfall","capsule-model-village"])??Re("template")}},[k,r,se,i,l]);return o.jsx(a1.Provider,{value:Z,children:o.jsxs(ds,{children:[o.jsxs("main",{className:"sc-main",id:"main","data-no-dock":j||void 0,children:[o.jsxs("h1",{className:"sc-greet",children:["Compose a shot ",o.jsx("em",{children:"on brand"})]}),o.jsxs("div",{className:"sc-create-grid",children:[o.jsxs("button",{type:"button",className:"sc-create-card","data-tone":"compose","data-main":"",onClick:gt,children:[o.jsx(kL,{thumbUrl:Q.compose,fallback:o.jsx(Z7,{size:22,weight:"fill"})}),o.jsx("b",{children:"Create an image"})]}),o.jsx(l6,{tone:"product",title:"Add a product",count:se.length,thumbUrl:Q.product,icon:o.jsx(mm,{size:22,weight:"fill"}),onClick:()=>E("product")}),o.jsx(l6,{tone:"presenter",title:"Create a presenter",thumbUrl:Q.presenter,icon:o.jsx(bF,{size:22,weight:"fill"}),onClick:()=>E("presenter")}),o.jsx(l6,{tone:"scene",title:"Create a scene",thumbUrl:Q.scene,icon:o.jsx(hF,{size:22,weight:"fill"}),onClick:()=>E("scene")})]}),(!f||h||l.length>0)&&o.jsxs("section",{children:[!f&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:Y,"aria-hidden":!0,children:o.jsx(iie,{size:"grid",count:8})}),f&&h&&o.jsxs("p",{className:"sc-feed-empty",children:["Couldn't load the showcase gallery."," ",o.jsx("button",{type:"button",className:"sc-sec-more",onClick:()=>p(),children:"Retry"})]}),f&&!h&&l.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(g2,{filters:o.jsx(v2,{mode:"tabs",group:X}),search:l.length>=yie&&o.jsx(Fd,{value:P,onChange:R,noun:"examples",total:l.length}),density:o.jsx(Jm,{value:G,onChange:z})}),te.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":Z,style:Y,children:te.map(Ne=>o.jsx(yL,{entry:Ne,size:"grid",hideRecipe:!0,onOpen:Ze,productHref:ie=>Ea(g,ie),presenterHref:ie=>Ra(g,ie),sceneHref:ie=>zr(g,ie),...ae(Ne)},Ne.id))}),te.length===0&&(O?o.jsx(w2,{noun:"examples",q:P,facet:U?t6(U):null,onClearSearch:B,onClearAll:V}):o.jsx("p",{className:"sc-looks-empty",children:"No example carries that category yet."}))]})]}),(!a||nt.length>0)&&o.jsxs("section",{children:[o.jsx("div",{className:"sc-sec-head",children:o.jsx("h2",{className:"sc-sec-title",children:"Presenters"})}),a?o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:Y,children:nt.map(Ne=>o.jsx(nv,{presenter:Ne,variant:"navigate",size:"grid",onOpen:L},Ne.id))}):o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:Y,"aria-hidden":!0,children:o.jsx(bL,{size:"grid",count:ee})}),(!a||Ke.length>nt.length)&&o.jsx("div",{className:"sc-lib-more",children:o.jsx(Vn,{className:"sc-btn sc-btn-ghost",to:ui(g),children:a?`Show all ${Ke.length} presenters`:"Show all presenters"})})]}),(!n||ne.length>0)&&o.jsxs("section",{children:[o.jsx("div",{className:"sc-sec-head",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenes"})}),n?o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:Y,children:ne.map(Ne=>o.jsx(xf,{scene:Ne,variant:"navigate",size:"grid",onOpen:T},Ne.id))}):o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:Y,"aria-hidden":!0,children:o.jsx(xL,{size:"grid",count:ee})}),(!n||$e.length>ne.length)&&o.jsx("div",{className:"sc-lib-more",children:o.jsx(Vn,{className:"sc-btn sc-btn-ghost",to:pl(g),children:n?`Show all ${$e.length} scenes`:"Show all scenes"})})]})]}),!j&&o.jsxs(wL,{children:[o.jsx($y,{}),o.jsx(Py,{projectId:(m==null?void 0:m.id)||null,brand:g,engines:e,parentId:w,initialBrief:Le,onQueued:(Ne,ie,q,oe)=>{oe!=null&&oe.length&&b(oe),S(),wie(g.id),C(Sr(g))}})]})]})})}function l6({tone:e,title:t,icon:n,count:r,thumbUrl:a,onClick:i}){return o.jsxs("button",{type:"button",className:"sc-create-card","data-tone":e,onClick:i,children:[o.jsx(kL,{thumbUrl:a,fallback:n}),o.jsxs("b",{children:[t,r?o.jsx(dN,{variant:"soft",radius:"full",size:"1",children:r}):null]})]})}function kL({thumbUrl:e,fallback:t}){return o.jsx("span",{className:"sc-glyph","data-photo":e?"":void 0,"aria-hidden":!0,children:e?o.jsx("span",{className:"sc-glyph-shot",children:o.jsx("img",{src:e,alt:"",loading:"lazy"})}):t})}function SL({id:e,name:t,hash:n,drawing:r,state:a,href:i,blank:l,onDiscard:u,chosen:f,batching:h,onPick:p,batch:g}){const m=Bn(),w=Ww(),y=g?m2({kind:"draft",count:g.count,openLabel:"Continue",onOpen:()=>m(i),href:i,onDeselect:()=>p==null?void 0:p(e),onAct:g.onAct}):Cl(u?{draft:{onContinue:()=>m(i),href:i,onDiscard:()=>u(e)},select:p?{run:()=>p(e)}:void 0}:{onOpen:()=>m(i),href:i}),b=o.jsxs("div",{className:"sc-lookcard","data-variant":"plain","data-size":"grid","data-build":!0,"data-building":r||void 0,"data-picked":f||void 0,"data-batching":h||void 0,children:[o.jsxs(Vn,{className:"sc-lookcard-media",to:i,"aria-label":h?`${f?"Deselect":"Select"} ${t}`:`Continue ${t}`,onClick:k=>{h&&p&&(k.preventDefault(),p(e))},children:[n?o.jsx("img",{src:gn(n,"tile"),alt:""}):o.jsx("span",{className:"sc-lookcard-blank",children:l}),r&&o.jsx(Pa,{}),o.jsx("span",{className:"sc-draftmark",children:"Draft"})]}),p&&o.jsx("button",{type:"button",className:"sc-cell-ctl sc-lookcard-pick","data-on":f||void 0,"aria-pressed":!!f,"aria-label":f?`Deselect ${t}`:`Select ${t}`,onClick:k=>{k.preventDefault(),k.stopPropagation(),p(e)},children:o.jsx(Kn,{size:13,weight:"bold"})}),u&&!h&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Discard ${t}`,onClick:()=>u(e),children:o.jsx(jn,{size:13})}),o.jsxs("span",{className:"sc-lookcard-cap",children:[o.jsx("b",{dir:"auto",children:t}),o.jsx("span",{children:a})]})]});return w?b:o.jsxs(Xf,{children:[o.jsx(Qf,{children:b}),o.jsx(Jf,{children:y.map(k=>o.jsxs("span",{style:{display:"contents"},children:[k.separated&&o.jsx(_m,{}),o.jsxs(e1,{color:k.danger?"red":void 0,onSelect:k.onSelect,children:[o.jsx(ad,{name:k.icon}),k.label]})]},k.key))})]})}function Dy({title:e,name:t,maxLength:n,busy:r,error:a,onConfirm:i,onDismiss:l}){const[u,f]=s.useState(t),h=s.useRef(null),p=s.useRef(!1),g=u.trim(),m=g.length>0,w=b=>{b&&(b.style.height="auto",b.style.height=`${b.scrollHeight}px`)};s.useEffect(()=>{p.current=!1,w(h.current)},[t]),s.useEffect(()=>{r||(p.current=!1)},[r]);const y=()=>{if(!(!m||r||p.current)){if(g===t.trim())return l();p.current=!0,i(g)}};return o.jsxs(Ws,{className:"sc-newdlg sc-pdetails",maxWidth:"min(420px, 94vw)",onDismiss:l,onOpenAutoFocus:b=>{b.preventDefault();const k=h.current;k&&(k.focus(),k.select(),w(k))},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:e}),o.jsx(Ms,{asChild:!0,children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx("span",{"aria-hidden":!0,children:"×"})})})]}),o.jsxs("div",{className:"sc-newdlg-body",children:[o.jsxs("label",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Name"}),o.jsx("textarea",{ref:h,className:"sc-pdetails-field",value:u,dir:"auto",rows:1,maxLength:n,"aria-label":"Name",onChange:b=>{f(b.target.value),w(b.currentTarget)},onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),y())}})]}),a&&o.jsx("p",{className:"sc-assetform-err",children:a})]}),o.jsxs("div",{className:"sc-newdlg-foot",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:l,children:"Cancel"}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:!m||r,"data-busy":r||void 0,onClick:y,children:r?"Saving":"Save"})]})]})}function EL({since:e}){const[t,n]=s.useState(Date.now());return s.useEffect(()=>{const r=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(r)},[]),o.jsx("span",{className:"sc-cell-tag",role:"timer","aria-label":`${Vw(e,t)}, ${Dc(e,t)}`,children:Dc(e,t)})}function xie({build:e,onCancel:t,onRetry:n,onDismiss:r}){const a=e.stage==="failed",i=a?co(e.error):null;return o.jsxs("div",{className:"sc-lookcard","data-variant":"plain","data-size":"grid","data-build":a||void 0,"data-building":!a||void 0,children:[o.jsxs("div",{className:"sc-lookcard-media",children:[o.jsx("span",{className:"sc-lookcard-blank"}),!a&&o.jsxs(o.Fragment,{children:[o.jsx(Pa,{since:e.startedAt}),o.jsx(EL,{since:e.startedAt})]}),!a&&t&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Stop building ${e.name}`,onClick:()=>t(e.id),children:o.jsx(jn,{size:13})}),a&&r&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Dismiss ${e.name}`,onClick:()=>r(e.id),children:o.jsx(jn,{size:13})}),a&&n&&o.jsxs("button",{type:"button",className:"sc-lookcard-use",onClick:()=>n(e),children:[o.jsx(K7,{size:12})," Try again"]})]}),i?o.jsxs("span",{className:"sc-lookcard-cap",title:i.raw,children:[o.jsx("b",{dir:"auto",children:e.name}),o.jsx("span",{children:i.title})]}):null]})}function Hy({count:e,loaded:t,tool:n,icon:r,danger:a,onAct:i,keep:l,onClear:u,onSelectAll:f}){return o.jsxs("div",{className:"sc-picked",role:"toolbar","aria-label":"Selection",children:[o.jsxs("span",{className:"sc-picked-meta",children:[o.jsxs("span",{className:"sc-picked-n",role:"status",children:[e,o.jsx("span",{className:"sc-vh",children:" selected"})]}),t>1&&o.jsx("button",{type:"button",className:"sc-picked-all",onClick:e<t?f:u,children:e<t?"Select all":"Deselect all"})]}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsxs("span",{className:"sc-picked-tools",children:[l&&o.jsx(c6,{label:l.label,onClick:l.onAct,children:o.jsx(eo,{size:17,weight:l.filled?"fill":"regular"})}),o.jsx(c6,{label:n,tone:a?"danger":void 0,onClick:i,children:o.jsx(kie,{name:r})})]}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-exit",children:o.jsx(c6,{label:"Done",onClick:u,children:o.jsx(jn,{size:16,weight:"bold"})})})]})}function kie(e){return o.jsx(Nl,{size:17})}function c6({label:e,tone:t,onClick:n,children:r}){return o.jsx(fr,{label:e,children:o.jsx("button",{type:"button",className:"sc-picked-tool","data-tone":t,"aria-label":e,onClick:n,children:r})})}const A0=()=>({kind:null,ids:new Set});function Oy(e){const[t,n]=s.useState(A0),r=s.useCallback(()=>n(A0()),[]);s.useEffect(()=>{r()},[e,r]),s.useEffect(()=>{if(t.ids.size===0)return;const p=g=>{g.defaultPrevented||g.key!=="Escape"||r()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t.ids.size,r]);const a=s.useCallback((p,g)=>{n(m=>{if(m.kind&&m.kind!==p)return m;const w=new Set(m.ids);return w.has(g)?w.delete(g):w.add(g),w.size?{kind:m.kind??p,ids:w}:A0()})},[]),i=s.useCallback((p,g)=>{n({kind:p,ids:new Set(g)})},[]),l=s.useCallback(p=>{const g=new Set(p);n(m=>{const w=new Set([...m.ids].filter(y=>g.has(y)));return w.size?{kind:m.kind,ids:w}:A0()})},[]),u=s.useCallback(p=>{n(g=>{if(!g.ids.has(p))return g;const m=new Set(g.ids);return m.delete(p),m.size?{kind:g.kind,ids:m}:A0()})},[]),f=s.useCallback(p=>{t.ids.size===0||p.target.closest(".sc-lookcard, .sc-picked, button, a, input, select, textarea, label, [role], [contenteditable]")||r()},[t.ids.size,r]),h=s.useCallback(p=>t.kind===null||t.kind===p,[t.kind]);return{kind:t.kind,ids:t.ids,toggle:a,selectAll:i,clear:r,retain:l,forget:u,onBlank:f,picking:h,batching:t.kind}}function Iy({label:e}){return o.jsx("div",{className:"sc-starter-rule",children:o.jsx("span",{children:e})})}const u6=60;function kf(e,t){const[n,r]=s.useState(u6);s.useEffect(()=>{r(u6)},[t]);const{visible:a,remaining:i}=Cy(e,n),l=s.useCallback(()=>r(u=>u+u6),[]);return{visible:a,remaining:i,showMore:l}}const Sie=24,Eie=8,d6="__bookmarked";function Cie(){const{scenes:e,collections:t,verticals:n,loaded:r,error:a,refetch:i,applyBrand:l,refreshBrands:u}=Nn(),{brand:f}=cn(),h=e,{push:p}=rr(),g=Bn(),[m,w]=s.useState(()=>Ci(f.id)),y=je=>w(d2("scene",f.id,je)),b=u2(),{builds:k,poke:S,studio:E}=ia(),C=Vl(),A=s.useMemo(()=>Qc(f),[f]),L=k.filter(je=>je.kind==="scene"&&(!je.finished||je.stage==="failed")),T=!!mn({path:mt.sceneStudio}),[M,j]=s.useState(()=>cp(f.id)),P=E.filter(je=>je.kind==="scene").map(je=>`${je.id}:${je.status}`).join("|");s.useEffect(()=>{T||j(cp(f.id))},[T,f.id,P]);const R=s.useMemo(()=>hse(M,E),[M,E]),[H,D]=s.useState(null),B=je=>{je.drawing&&je.jobId&&Ee.cancelSceneStudioJob(f.id,je.jobId).catch(()=>{}),wse(f.id,je.convo),j(cp(f.id))},V=je=>{const me=R.find(tt=>tt.convo===je);me&&(me.hash||me.drawing?D(me):B(me))},{q:U,setQ:K,facets:O,setFacets:F,clearSearch:I,clear:G}=f1(["vertical","bookmarked"]),z=O.vertical,Y=O.bookmarked==="1",Z=Oy(`${f.id}|${U}|${z??""}|${Y?"1":""}`),ee=U.trim().length>0,[pe,se]=Ma(qr.wallDensity,yd),xe=Jc(pe),J=je=>se(je),te=e2(xe),X=Qm(xe),ae=je=>g(zr(f,je)),[Le,ce]=s.useState(null),[Se,Ze]=s.useState(!1),[gt,Ke]=s.useState(null),[nt,$e]=s.useState(!1),[ne,Q]=s.useState(null),[We,Ne]=s.useState(!1),ie=s.useCallback(je=>{const me=A.find(tt=>tt.id===je);me&&ce(me)},[A]),q=s.useCallback(je=>{const me=A.find(tt=>tt.id===je);me&&(Q(null),Ke(me))},[A]),oe=async je=>{if(!(!gt||nt)){$e(!0),Q(null);try{l((await Ee.updateScene(f.id,gt.id,{name:je})).brand),Ke(null)}catch(me){const tt=ln(me,"Could not rename this scene");Q([tt.title,tt.detail].filter(Boolean).join(" "))}finally{$e(!1)}}},Re=async()=>{if(!(!Le||Se)){Ze(!0);try{l((await Ee.deleteScene(f.id,Le.id)).brand),Z.forget(Le.id),ce(null)}catch(je){(je==null?void 0:je.status)===404?(await u(),Z.forget(Le.id),ce(null)):p(ln(je,"Could not delete this scene"))}finally{Ze(!1)}}},ze=s.useMemo(()=>Y?h.filter(je=>m.includes(je.id)):z?h.filter(je=>je.verticals.includes(z)):h,[h,z,Y,m]),Ie=!(A.length>0||L.length>0||R.length>0),De=[...h,...A].reduce((je,me)=>je+(m.includes(me.id)?1:0),0),Ge=Y&&De===0,ft=Ge&&Ie,bt=Ge&&!Ie,at=ee||Y&&!ft,Zt=s.useMemo(()=>ft?h:ze,[ft,h,ze]),jt=s.useMemo(()=>Zt.filter(je=>Ho(Up(je),U)),[Zt,U]),[Ft,Pt]=s.useState(()=>new Set),{visible:Tt,remaining:ke,showMore:et}=kf(jt,`${z??""}|${Y?"bookmarked":""}|${ft?"browse":""}|${U}`),Et=je=>[...A,...h].filter(me=>!me.verticals.length||me.verticals.includes(je)).length,Qe=[{value:d6,label:"Keepers",count:De},...n.map(je=>({value:je,label:je,count:Et(je)}))],st=h.length>0?"tabs":"none",rt={key:"vertical",label:"Vertical",everyLabel:"All scenes",everyCount:h.length+A.length,selected:Y?d6:z,onSelect:je=>F(je===d6?{bookmarked:"1",vertical:null}:{bookmarked:null,vertical:je}),options:Qe},qt=s.useMemo(()=>A.filter(je=>z?!je.verticals.length||je.verticals.includes(z):!0).filter(je=>Ho(Up(je),U)).filter(je=>Y?m.includes(je.id):!0),[A,z,U,Y,m]),Yt=Y?qt.length>0:R.length>0||L.length>0||qt.length>0,{visible:an,remaining:Wt,showMore:Mn}=kf(qt,`${f.id}|${z??""}|${Y?"bookmarked":""}|${U}`),[Bt,re]=s.useState(null);s.useEffect(()=>{if(!Bt||Wt<=0)return;const je=new IntersectionObserver(me=>{me.some(tt=>tt.isIntersecting)&&Mn()},{root:Bt.closest(".sc-home"),rootMargin:"200% 0px"});return je.observe(Bt),()=>je.disconnect()},[Bt,Wt,Mn]);const ue=()=>{Z.ids.size===1?ie([...Z.ids][0]):Ne(!0)},de=[...Z.ids],_e=de.length>0&&de.every(je=>m.includes(je)),Fe=()=>w(Sy("scene",f.id,de,!_e)),xt=p2(Z.ids.size,_e,"scenes"),yt=async()=>{if(Se)return;const je=[...Z.ids];Ze(!0);try{const{failed:me,error:tt}=await Qp(je,Ct=>Ee.deleteScene(f.id,Ct));await u(),Z.retain(me),Ne(!1),tt&&p(ln(tt,"Could not delete these scenes"))}finally{Ze(!1)}},kt=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>C("scene"),children:[o.jsx(pr,{size:12})," Create scene"]}),ot=(je,me=!1)=>o.jsx("div",{className:"sc-masonry","data-wall":me||void 0,"data-density":!0,"data-density-size":X,style:te,children:je.map(tt=>o.jsx(xf,{scene:tt,variant:"use",size:"grid",onOpen:ae,href:zr(f,tt.id),onUse:b,bookmarked:m.includes(tt.id),onBookmark:y},tt.id))}),ht=o.jsx(g2,{title:"Scenes",filters:o.jsx(v2,{mode:st,group:rt}),density:o.jsx(Jm,{value:xe,onChange:J}),search:h.length>=Eie&&o.jsx(Fd,{value:U,onChange:K,noun:"scenes",total:h.length})});return o.jsxs(a1.Provider,{value:X,children:[o.jsx(ds,{children:o.jsxs("main",{className:"sc-looks sc-scenes",id:"main","data-hero":Ie||void 0,onClick:Z.onBlank,children:[!Ie&&ht,Yt&&o.jsxs("section",{className:"sc-owned",children:[o.jsx("div",{className:"sc-sec-head",children:o.jsx("h2",{className:"sc-sec-title",children:"Your scenes"})}),o.jsxs("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":X,style:te,children:[!Y&&R.map(je=>o.jsx(SL,{id:je.convo,name:je.name||"Untitled scene",hash:je.hash,drawing:je.drawing,state:mse(je),href:ml(f,je.convo),blank:o.jsx(dC,{size:44,weight:"thin"}),onDiscard:V},je.convo)),H&&o.jsx(Xn,{label:"Discard",title:`Discard ${H.name||"this unfinished scene"}?`,body:H.drawing?"The picture being drawn is stopped, and what was drawn here is thrown away. Nothing was saved to the library.":"What was drawn here is thrown away. Nothing was saved to the library.",open:!0,busy:!1,onOpenChange:je=>{je||D(null)},onConfirm:()=>{B(H),D(null)}}),!Y&&L.map(je=>o.jsx(xie,{build:je,onCancel:me=>void Ee.cancelAssetBuild(f.id,me).then(S),onDismiss:me=>void Ee.deleteAssetBuild(f.id,me).then(S),onRetry:()=>C("scene")},je.id)),an.map(je=>o.jsx(xf,{scene:je,variant:"use",size:"grid",onOpen:ae,href:zr(f,je.id),onUse:b,bookmarked:m.includes(je.id),onBookmark:y,onDelete:ie,onRename:q,chosen:Z.ids.has(je.id),batching:Z.batching==="owned-scene",onPick:Z.picking("owned-scene")?me=>Z.toggle("owned-scene",me):void 0,batch:Z.kind==="owned-scene"&&Z.ids.has(je.id)?{count:Z.ids.size,onAct:ue,onKeep:Fe,allKept:_e}:null},je.id))]}),Wt>0&&o.jsx("div",{ref:re,"aria-hidden":!0}),Wt>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:Mn,children:["Show ",Math.min(Wt,60)," more"]})}),gt&&o.jsx(Dy,{title:"Rename scene",name:gt.name,maxLength:60,busy:nt,error:ne,onConfirm:je=>void oe(je),onDismiss:()=>{nt||Ke(null)}}),Le&&o.jsx(Xn,{label:"Delete scene",title:`Delete ${Le.name}?`,body:ji("owned-scene",1),open:!0,busy:Se,onOpenChange:je=>{!je&&!Se&&ce(null)},onConfirm:()=>void Re()}),We&&o.jsx(Xn,{label:cs("owned-scene",Z.ids.size).menu,title:`${cs("owned-scene",Z.ids.size).menu}?`,body:ji("owned-scene",Z.ids.size),open:!0,busy:Se,onOpenChange:je=>{!je&&!Se&&Ne(!1)},onConfirm:()=>void yt()})]}),Ie&&r&&!a&&h.length>0&&o.jsx(No,{shape:"cold",title:o.jsxs(o.Fragment,{children:["Build your own ",o.jsx("em",{children:"scene"})]}),body:"Upload a few references of a place, or describe it, and its light and materials carry into every image you make.",action:kt}),Yt&&r&&!a&&ze.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri scenes"})}),Ie&&r&&!a&&h.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Iy,{label:"Or start from one of ours"}),ht]}),!r&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":X,style:te,"aria-hidden":!0,children:o.jsx(xL,{size:"grid",count:8})}),r&&a&&o.jsx(No,{shape:"error",title:"Couldn't load this library",body:"Something went wrong reaching the catalog.",onRetry:()=>i()}),r&&!a&&!at&&t.map(je=>{const me=Zt.filter(be=>be.collections.includes(je));if(!me.length)return null;const Ct=Ft.has(je)?me:me.slice(0,Sie);return o.jsxs("section",{className:"sc-coll",children:[o.jsx("h2",{children:je}),ot(Ct),Ct.length<me.length&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>Pt(be=>new Set(be).add(je)),children:["Show all ",me.length]})})]},je)}),r&&!a&&at&&Tt.length>0&&ot(Tt,!0),r&&!a&&bt&&o.jsx(No,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a scene from its card and it stays here.",mark:Ty,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>F({bookmarked:null}),children:"Browse every scene"})}),r&&!a&&h.length>0&&!bt&&jt.length===0&&qt.length===0&&o.jsx(w2,{noun:"scenes",q:U,facet:ft?null:Y?"Keepers":z,onClearSearch:I,onClearAll:G}),at&&ke>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:et,children:["Show ",Math.min(ke,60)," more"]})})]})}),o.jsx(Zc,{}),Z.kind==="owned-scene"&&Z.ids.size>0&&o.jsx("div",{className:"sc-wall-dock",children:o.jsx(Hy,{count:Z.ids.size,loaded:an.length,tool:cs("owned-scene",Z.ids.size).tool,icon:cs("owned-scene",Z.ids.size).icon,danger:!0,onAct:ue,keep:{label:xt.tool,filled:_e,onAct:Fe},onClear:Z.clear,onSelectAll:()=>Z.selectAll("owned-scene",an.map(je=>je.id))})})]})}function Fy(e,t,n=12){const r=t.filter(Boolean).join(","),[a,i]=s.useState({key:"",items:[]});return s.useEffect(()=>{if(!r)return;const l=new AbortController;return Ee.feed(e,{token:r,limit:n},l.signal).then(u=>{l.signal.aborted||i({key:r,items:u.items.filter(f=>f.status==="done"&&f.images.length>0)})}).catch(()=>{}),()=>l.abort()},[e,r,n]),a.key===r?a.items:[]}const rv=[{id:"top-down",label:"Top down",camera:"Directly overhead, looking straight down, the subject centred, deep focus"},{id:"eye-level",label:"Eye level",camera:"Eye level, the subject at a natural three-quarter angle, medium depth"},{id:"ground",label:"Ground level",camera:"Ground level, camera low, the subject close and large in frame, the place rising behind it"},{id:"wide",label:"Wide",camera:"A wide view, the subject small in the frame, the place around it doing the talking"},{id:"close",label:"Close",camera:"Close in on the subject, its surface, edge and material filling the frame"}],CL=4;function jie(e,t=""){var u,f;const n=[],r=((u=e.refs)==null?void 0:u.length)??0;r>0&&n.push(`read from ${r} ${r===1?"photograph":"photographs"}`);const a=((f=e.setups)==null?void 0:f.length)??0;a>0&&n.push(`${a} ${a===1?"way":"ways"} to shoot it`);const i=n.join(" · "),l=i?`${i.charAt(0).toUpperCase()}${i.slice(1)}.`:"";return[t.trim(),l].filter(Boolean).join(" ")}function _y({to:e,wall:t,where:n}){return o.jsxs("div",{className:"sc-lookpage-crumb",children:[o.jsx(Vn,{to:e,children:t}),o.jsx("span",{children:"/"}),o.jsx("span",{children:n})]})}function Vy({kind:e,brandId:t,id:n}){const[r,a]=s.useState(()=>Sd(e,t).includes(n));s.useEffect(()=>{a(Sd(e,t).includes(n))},[e,t,n]);const i=r?"Remove from Keepers":"Add to Keepers";return o.jsx(fr,{label:i,children:o.jsx("button",{type:"button",className:"sc-icon-btn sc-lookpage-keep","data-kept":r||void 0,"aria-pressed":r,"aria-label":i,onClick:()=>a(d2(e,t,n).includes(n)),children:o.jsx(eo,{size:15,weight:r?"fill":"regular"})})})}function Aie({items:e,placeholder:t,open:n,hit:r,onRemove:a,onOpen:i}){return o.jsxs("div",{className:"sc-chipfield","data-state":n?"open":void 0,children:[r,o.jsxs("span",{className:"sc-chipfield-row",children:[e.length===0&&t?o.jsx("span",{className:"sc-chipfield-ph",children:t}):null,e.map(l=>o.jsxs("span",{className:"sc-chipfield-chip",onClick:()=>i==null?void 0:i(),children:[l,a&&o.jsx("button",{type:"button","data-role":"remove","aria-label":`Remove ${l}`,onPointerDown:u=>u.stopPropagation(),onClick:u=>{u.preventDefault(),u.stopPropagation(),a(l)},children:o.jsx(jn,{size:10,weight:"bold"})})]},l))]}),o.jsx(bl,{size:13,className:"sc-chipfield-caret","aria-hidden":!0})]})}function Nie({value:e,onChange:t,options:n,label:r,placeholder:a="Any",findPlaceholder:i="Find or add",emptyNote:l="Nothing by that name.",max:u=12,maxLength:f=40}){const[h,p]=s.useState(!1),[g,m]=s.useState(""),w=s.useRef(null),y=[...n,...e.filter(L=>!n.some(T=>Lu(T,L)))],b=g.trim(),k=b?y.filter(L=>L.toLowerCase().includes(b.toLowerCase())):y,S=e.length>=u,E=b.length>0&&!y.some(L=>Lu(L,b))&&!S,C=L=>{const T=e.some(M=>Lu(M,L));!T&&S||t(T?e.filter(M=>!Lu(M,L)):[...e,L])},A=()=>{var L;E&&(t([...e,b.slice(0,f)]),m(""),(L=w.current)==null||L.focus())};return s.useEffect(()=>{if(!h)return;const L=setTimeout(()=>{var T;return(T=w.current)==null?void 0:T.focus()},0);return()=>clearTimeout(L)},[h]),o.jsxs(Cs,{open:h,onOpenChange:L=>{p(L),L||m("")},children:[o.jsx(Aie,{items:e,placeholder:a,open:h,onOpen:()=>p(!0),onRemove:L=>t(e.filter(T=>!Lu(T,L))),hit:o.jsx(js,{children:o.jsx("button",{type:"button",className:"sc-chipfield-hit","aria-label":r})})}),o.jsxs(As,{align:"start",sideOffset:6,className:"sc-menu sc-chippick-menu",children:[o.jsx("input",{ref:w,className:"sc-chippick-find",type:"text",value:g,maxLength:f,placeholder:i,"aria-label":i,onChange:L=>m(L.target.value),onKeyDown:L=>{L.stopPropagation(),L.key==="Enter"?(L.preventDefault(),E?A():k.length===1&&C(k[0])):L.key==="Escape"&&p(!1)}}),o.jsxs("div",{className:"sc-chippick-list",children:[k.map(L=>{const T=e.some(M=>Lu(M,L));return o.jsxs(qn,{className:"sc-menu-item","data-on":T||void 0,"data-off":!T&&S?"":void 0,onSelect:M=>{M.preventDefault(),C(L)},children:[o.jsx("span",{className:"sc-menu-lb",children:L}),T&&o.jsx(Kn,{size:14,className:"sc-menu-check","aria-hidden":"true"})]},L)}),!k.length&&!E&&o.jsx("p",{className:"sc-chippick-none",children:l})]}),E&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-menu-sep"}),o.jsxs(qn,{className:"sc-menu-item",onSelect:L=>{L.preventDefault(),A()},children:[o.jsx(pr,{size:16,className:"sc-menu-ic"}),o.jsxs("span",{className:"sc-menu-lb",children:['Add "',b,'"']})]})]}),S&&o.jsx("p",{className:"sc-chippick-none",children:"That is as many as this holds."})]})]})}const Lu=(e,t)=>e.trim().toLowerCase()===t.trim().toLowerCase();function jL({name:e,categories:t,known:n,hint:r,ways:a,wayChoices:i,wayMax:l,busy:u,error:f,onSave:h,onDismiss:p}){const[g,m]=s.useState(e),[w,y]=s.useState(t),[b,k]=s.useState(()=>[...a??[]]),S=g.trim(),E=S.length>0,C=M=>M.map(j=>j.id).join(" "),A=S!==e.trim()||w.join(" ")!==t.join(" ")||!!a&&C(b)!==C(a),L=b.length>=(l??Number.POSITIVE_INFINITY)?[]:(i??[]).filter(M=>!b.some(j=>j.id===M.id)),T=()=>{if(!(!E||u)){if(!A)return p();h({name:S,categories:w,...a?{ways:b}:{}})}};return o.jsxs(Ws,{className:"sc-newdlg sc-pdetails",maxWidth:"min(460px, 94vw)",onDismiss:p,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Details"}),o.jsx(Ms,{asChild:!0,children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx("span",{"aria-hidden":!0,children:"×"})})})]}),o.jsxs("div",{className:"sc-newdlg-body",children:[o.jsxs("label",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Name"}),o.jsx("input",{className:"sc-pdetails-field",value:g,dir:"auto",onChange:M=>m(M.target.value),onKeyDown:M=>M.key==="Enter"&&T()})]}),o.jsxs("div",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Categories"}),o.jsx(Nie,{value:w,onChange:y,options:n,label:"Categories",placeholder:"Any",findPlaceholder:"Find or add a category",emptyNote:"Nothing by that name.",maxLength:30}),o.jsx("span",{className:"sc-pdetails-hint",children:r})]}),a&&o.jsxs("div",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Ways to shoot it"}),o.jsxs("div",{className:"sc-pdetails-ways",children:[b.map(M=>o.jsxs("div",{className:"sc-pdetails-way",children:[o.jsx("span",{className:"sc-pdetails-way-lb",children:M.label}),o.jsx("span",{className:"sc-pdetails-way-sub",children:M.camera}),o.jsx("button",{type:"button",className:"sc-icon-btn","aria-label":`Remove ${M.label}`,onClick:()=>k(b.filter(j=>j.id!==M.id)),children:o.jsx(jn,{size:13,weight:"bold","aria-hidden":!0})})]},M.id)),L.length>0&&o.jsxs(Cs,{children:[o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost","aria-label":"Add a way to shoot it",children:[o.jsx(pr,{size:12,weight:"bold","aria-hidden":!0}),o.jsx("span",{children:"Add a way"})]})}),o.jsx(As,{children:L.map(M=>o.jsx(qn,{onSelect:()=>k([...b,M]),children:M.label},M.id))})]})]}),o.jsxs("span",{className:"sc-pdetails-hint",children:["A way moves the camera and leaves the world alone.",l?` ${l} at most.`:""]})]}),f&&o.jsx("p",{className:"sc-assetform-err",children:f})]}),o.jsxs("div",{className:"sc-newdlg-foot",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:p,children:"Cancel"}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:!E,"data-busy":u||void 0,onClick:T,children:u?"Saving":"Save"})]})]})}function AL(e){const t=s.useRef(null),n=s.useRef(null);s.useLayoutEffect(()=>{const a=t.current,i=n.current;if(!a||!i)return;let l=0;const u=()=>{const p=i.scrollWidth-i.clientWidth;if(p<=1){delete a.dataset.overflowLeft,delete a.dataset.overflowRight;return}i.scrollLeft>2?a.dataset.overflowLeft="":delete a.dataset.overflowLeft,i.scrollLeft<p-2?a.dataset.overflowRight="":delete a.dataset.overflowRight},f=()=>{l||(l=requestAnimationFrame(()=>{l=0,u()}))};u();const h=new ResizeObserver(()=>u());h.observe(i);for(const p of i.children)h.observe(p);return i.addEventListener("scroll",f,{passive:!0}),()=>{l&&cancelAnimationFrame(l),h.disconnect(),i.removeEventListener("scroll",f)}},[e]);const r=s.useCallback(a=>{const i=n.current;if(!(i!=null&&i.firstElementChild))return;const l=i.firstElementChild.getBoundingClientRect().width,u=Number.parseFloat(getComputedStyle(i).columnGap)||0,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;i.scrollBy({left:a*(l+u),behavior:f?"auto":"smooth"})},[]);return{shellRef:t,railRef:n,page:r}}function Sf({count:e,label:t,className:n,trackClassName:r,style:a,children:i}){const{shellRef:l,railRef:u,page:f}=AL(e);return o.jsxs("div",{className:n?`sc-rail ${n}`:"sc-rail",ref:l,style:{"--sc-rail-count":e},children:[o.jsx("button",{type:"button",className:"sc-rail-arrow prev","aria-label":`${t}, earlier`,onClick:()=>f(-1),children:o.jsx($a,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-rail-arrow next","aria-label":`${t}, later`,onClick:()=>f(1),children:o.jsx(Al,{size:13,weight:"bold"})}),o.jsx("ol",{className:r?`sc-rail-track ${r}`:"sc-rail-track","aria-label":t,ref:u,style:a,children:i})]})}function y2(){const e=s.useRef(!1);return s.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),s.useCallback(()=>{const t=window.location.pathname;return()=>e.current&&window.location.pathname===t},[])}function qu({variant:e,label:t,isCover:n,onOpen:r,onUse:a,onCover:i,busy:l=!1}){const u=!n&&!!i;return e==="sheet"?o.jsxs(o.Fragment,{children:[a&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:l,onClick:a,children:"Use this view"}),u&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:l,onClick:i,children:"Set as cover"})]}):o.jsxs(o.Fragment,{children:[a&&o.jsx("button",{type:"button",className:"sc-lookcard-use","aria-label":`Use this view: ${t}`,disabled:l,onClick:a,children:"Use this view"}),(r||a||u)&&o.jsx("div",{className:"sc-corner",children:o.jsxs(Cs,{children:[o.jsx(fr,{label:"More",children:o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-cell-ctl sc-lookcard-more","aria-label":`More for ${t}`,children:[o.jsx(Lv,{className:"sc-lookcard-more-vert",size:16,weight:"bold"}),o.jsx(Pv,{className:"sc-lookcard-more-horiz",size:16,weight:"bold"})]})})}),o.jsxs(As,{side:"bottom",align:"end",sideOffset:4,collisionPadding:12,children:[r&&o.jsxs(qn,{onSelect:r,children:[o.jsx(ad,{name:"open"}),"Open"]}),a&&o.jsxs(qn,{disabled:l,onSelect:a,children:[o.jsx(ad,{name:"use"}),"Use this view"]}),u&&o.jsxs(qn,{disabled:l,onSelect:i,children:[o.jsx(ad,{name:"cover"}),"Set as cover"]})]})]})})]})}function Jp({label:e,isCover:t}){return o.jsxs("span",{className:"sc-refset-lb","data-cover":t||void 0,"aria-hidden":!0,children:[e,t&&o.jsx("span",{className:"sc-sceneview-cover",children:" · Cover"})]})}const JS=1500;function NL(e,t,n){const{refreshBrands:r}=Nn(),[a,i]=s.useState(null),[l,u]=s.useState([]),[f,h]=s.useState([]),[p,g]=s.useState(!1),[m,w]=s.useState(0),[y,b]=s.useState(!1),k=s.useRef(void 0),S=s.useRef(r);S.current=r,s.useEffect(()=>{if(!t)return;let C=!0,A=null;const L=async()=>{var T;try{const M=await Ee.sceneExamples(e,t);if(!C)return;const j=M.job?`${M.job.id}:${M.job.status}`:null;if(M.job&&M.job.status!=="running"&&k.current!==void 0&&j!==k.current&&await S.current(),!C)return;k.current=j,i(M.job),u(M.first),h(M.more),g(!0),b(!1),((T=M.job)==null?void 0:T.status)==="running"&&(A=setTimeout(L,JS))}catch(M){C&&(M==null?void 0:M.status)!==404&&(A=setTimeout(L,JS*2))}};return L(),()=>{C=!1,A&&clearTimeout(A)}},[e,t,n,m]);const E=s.useCallback(()=>{b(!0),w(C=>C+1)},[]);return{job:a,first:l,more:f,read:p,waiting:y,again:E}}const Mie=["no","one","two","three","four","five"];function Rie({brandId:e,scene:t,onError:n}){var F;const{applyBrand:r}=Nn(),a=u2(),i=y2(),{job:l,first:u,again:f}=NL(e,t.id,t.placeUrl??null),[h,p]=s.useState(!1),[g,m]=s.useState(!1),[w,y]=s.useState(!1),[b,k]=s.useState(null),S=vM(t.examples,l),E=(l==null?void 0:l.status)==="running",C=pq(t.examples),A=async()=>{if(g||!u.length)return;const I=i();m(!0),n(null);try{await Ee.drawSceneExamples(e,t.id,{first:!0}),f()}catch(G){I()&&n(String((G==null?void 0:G.message)??G))}finally{I()&&m(!1)}},L=u.length&&(l==null?void 0:l.status)!=="running"?o.jsx("p",{className:"sc-scenepage-examples-ask",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:g,onClick:()=>void A(),children:[C.length?"Draw them again":"Draw it in use",`, ${Mie[u.length]??u.length} picture${u.length===1?"":"s"}`]})}):null,T=async I=>{const G=rv.find(Y=>Y.id===I);if(!G||h)return;const z=i();p(!0),n(null);try{const Y=t.setups??[];if(!Y.some(Z=>Z.id===G.id)){const Z=await Ee.updateScene(e,t.id,{setups:[...Y,G]});r(Z.brand)}if(!z())return;a(t.id,G.id)}catch(Y){z()&&n(String((Y==null?void 0:Y.message)??Y))}finally{z()&&p(!1)}},M=async I=>{const G=i();y(!0),n(null);try{const z=await Ee.updateScene(e,t.id,{cover:I});r(z.brand)}catch(z){G()&&n(String((z==null?void 0:z.message)??z))}finally{G()&&y(!1)}},j=$X(t),P=(I,G)=>I?()=>a(t.id,void 0,I,G):void 0,R=t.placeUrl?{src:t.placeUrl,label:"The place",view:"place",...t.previewHash?{hash:t.previewHash}:{}}:null,H=I=>o.jsx(qu,{variant:"sheet",label:I.label,isCover:I.view===j,onUse:P(I.hash,I.view),onCover:()=>void M(I.view),busy:w});if(!S.length&&!R)return o.jsx(qw,{});if(!S.length&&R)return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"sc-scenepage-place sc-sceneview-frame",children:[o.jsx("button",{type:"button",className:"sc-scenepage-open","aria-label":`${R.label}, open`,onClick:()=>k(R),children:o.jsx(ja,{src:$n(R.src,"tile"),srcSet:yc(R.src)})}),o.jsx(qu,{variant:"tile",label:R.label,isCover:!0,onOpen:()=>k(R),onUse:P(R.hash,"place")})]}),L,b&&o.jsx(Ed,{src:b.src,kind:"scene",label:b.label,noun:t.name,onClose:()=>k(null),actions:H(b)})]});const D=b==null?void 0:b.tile,B=D!=null&&D.setup?rv.find(I=>I.id===D.setup):void 0,V=!!B&&((t.setups??[]).some(I=>I.id===B.id)||(t.setups??[]).length<CL),U=E&&l?_w({status:l.status,step:l.current,done:l.done.length,total:l.roles.length,error:l.error}):C.length>0?`${C.length===1?`The ${Xa[C[0]].toLowerCase()} shows`:"These show"} an earlier picture of this place.`:null,K=((F=S[0])==null?void 0:F.role)==="hero",O=R?o.jsxs("li",{children:[o.jsxs("span",{className:"sc-sceneview-frame","data-cover":j==="place"||void 0,children:[o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":`The place${j==="place"?", the cover":""}, open`,onClick:()=>k(R),children:o.jsx(ja,{src:$n(R.src,"tile"),srcSet:yc(R.src)})}),o.jsx(qu,{variant:"tile",label:R.label,isCover:j==="place",onOpen:()=>k(R),onUse:P(R.hash,"place"),onCover:()=>void M("place"),busy:w})]}),o.jsx(Jp,{label:"The place",isCover:j==="place"})]},"place"):null;return o.jsxs(o.Fragment,{children:[o.jsxs(Sf,{count:S.length+(R?1:0),label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:[!K&&O,S.map((I,G)=>{const z=Xa[I.role],Y=()=>k({src:I.url,label:z,view:I.role,tile:I,...I.hash?{hash:I.hash}:{}});return o.jsxs(s.Fragment,{children:[o.jsxs("li",{children:[I.state==="drawing"?o.jsxs("span",{className:"sc-refset-tile","data-state":"drawing",role:"img","aria-label":`${z}, drawing`,children:[I.url&&o.jsx(ja,{src:$n(I.url,"tile"),srcSet:yc(I.url)}),o.jsx(Pa,{})]}):I.state==="failed"?o.jsxs("span",{className:"sc-refset-tile","data-state":"failed",role:"img","aria-label":`${z} did not draw`,title:I.error?ff(I.error)??I.error:void 0,children:[o.jsx(zc,{size:20,"aria-hidden":!0}),o.jsx("span",{children:"Did not draw"}),I.error&&o.jsx("small",{className:"sc-refset-why",children:ff(I.error)??I.error})]}):o.jsxs("span",{className:"sc-sceneview-frame","data-cover":j===I.role||void 0,children:[o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":`${z}${j===I.role?", the cover":""}, open`,onClick:Y,children:o.jsx(ja,{src:$n(I.url,"tile"),srcSet:yc(I.url)})}),o.jsx(qu,{variant:"tile",label:z,isCover:j===I.role,onOpen:Y,onUse:P(I.hash,I.role),onCover:()=>void M(I.role),busy:w})]}),o.jsx(Jp,{label:z,isCover:j===I.role})]}),K&&G===0&&O]},I.role)})]}),U&&o.jsx("p",{className:"sc-scenepage-examples-state","aria-live":"polite",children:U}),L,b&&o.jsx(Ed,{src:b.src,kind:"scene",label:b.label,noun:t.name,onClose:()=>k(null),actions:B&&V?o.jsxs(o.Fragment,{children:[H(b),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:h,onClick:()=>void T(B.id),children:"Shoot it this way"})]}):H(b)})]})}const e9=["hero","place","close","hands","angle","bold"],t9=3;function Pie(){var gt,Ke,nt,$e,ne;const{sceneId:e}=aa(),{scenes:t,loaded:n,error:r,refetch:a,applyBrand:i,refreshBrands:l}=Nn(),{brand:u}=cn(),f=t,h=Bn(),p=u2(),g=u.id,[m,w]=s.useState([]),[y,b]=s.useState([]),[k,S]=s.useState(null),[E,C]=s.useState(!1),[A,L]=s.useState(null),T=Q=>h(zr(u,Q)),M=mf(u,e??""),j=M??f.find(Q=>Q.id===e);qc(j==null?void 0:j.name);const P=!!M;s.useEffect(()=>{let Q=!0;if(w([]),b([]),!P)return Ee.sceneFrames(e??"").then(We=>{Q&&(w(We.frames),b(We.views??[]),S(e??""))}).catch(()=>{Q&&(w([]),S(e??""))}),()=>{Q=!1}},[e,P]);const R=s.useRef(e);R.current=e,h2(()=>{if(P)return;const Q=e??"";Ee.sceneFrames(Q).then(We=>{R.current===e&&(w(Ne=>xi(Ne,We.frames)),b(Ne=>xi(Ne,We.views??[])))}).catch(()=>{})});const H=Fy(u.id,[e??""]),D=s.useMemo(()=>{if(!j||P)return[];return f.filter(Ne=>Ne.id!==j.id).sort((Ne,ie)=>We(ie)-We(Ne)).slice(0,8);function We(Ne){const ie=Ne.lighting.split(/[ ,]+/).some(oe=>oe.length>3&&j.lighting.toLowerCase().includes(oe.toLowerCase())),q=Ne.collections.some(oe=>j.collections.includes(oe));return(ie?2:0)+(q?1:0)}},[f,j,P]),B=s.useMemo(()=>{if(j||!n||r)return[];const Q=Ci(g);return nL(f,We=>Q.includes(We.id)).slice(0,6)},[j,n,r,f,g]),[V,U]=s.useState(null),[K,O]=s.useState(!1),[F,I]=s.useState(!1),[G,z]=s.useState(!1),Y=s.useRef(!1),Z=y2(),ee=s.useMemo(()=>[...new Set([...f.flatMap(Q=>Q.verticals),...Qc(u).flatMap(Q=>Q.verticals)])].sort((Q,We)=>Q.localeCompare(We)),[f,u]),pe=async Q=>{if(M){I(!0),U(null);try{const We=await Ee.updateScene(u.id,M.id,{name:Q.name,verticals:Q.categories,...Q.ways?{setups:Q.ways}:{}});i(We.brand),z(!1)}catch(We){U(String(We.message??We))}finally{I(!1)}}},se=async()=>{if(!M||Y.current)return;Y.current=!0;const Q=Z(),We=pl(u);O(!0);try{const Ne=await Ee.deleteScene(u.id,M.id);i(Ne.brand)}catch(Ne){if((Ne==null?void 0:Ne.status)!==404){Y.current=!1,Q()&&(U(String(Ne.message??Ne)),O(!1));return}await l()}Q()&&h(We,{replace:!0})};if(!n&&!M)return o.jsx(ds,{children:o.jsx("main",{className:"sc-lookpage sc-scenepage",id:"main",children:o.jsx("div",{className:"sc-tplrow","aria-hidden":!0})})});if(r&&!M)return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage sc-scenepage",id:"main",children:[o.jsx("h1",{children:"Couldn't load this scene"}),o.jsx("p",{className:"sc-lookpage-lede",children:"Something went wrong reaching the catalog."}),o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>a(),children:"Retry"})})]})});if(!j)return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage sc-scenepage",id:"main",children:[o.jsx("h1",{children:"This scene isn't here anymore"}),o.jsx("p",{className:"sc-lookpage-lede",children:"It may have been removed from the catalog, or the link is out of date."}),o.jsxs("div",{className:"sc-lookpage-acts",children:[o.jsx(Vn,{className:"sc-btn sc-btn-primary",to:`${Sr(u)}?compose=1`,children:"Start from scratch"}),o.jsx(Vn,{className:"sc-btn sc-btn-ghost",to:pl(u),children:"Browse all scenes"})]}),B.length>0&&o.jsx(od,{label:"You might like",children:B.map(Q=>o.jsx(xf,{scene:Q,variant:"navigate",size:"slider",onOpen:T,href:zr(u,Q.id)},Q.id))})]})});const xe=y.length?[...y].sort((Q,We)=>e9.indexOf(Q.view)-e9.indexOf(We.view)).map(Q=>({src:Q.url,label:Q.view==="place"?"The place":Xa[Q.view],view:Q.view})):m.length?m.map((Q,We)=>({src:Q,label:`Example ${We+1}`})):j.previewUrl?[{src:j.previewUrl,label:j.cover&&j.cover!=="place"?Xa[j.cover]:"The place"}]:[],J=async Q=>{if(E)return;const We=Z();C(!0),U(null);try{const{hash:Ne}=await Ee.pickSceneView(j.id,Q);if(!We())return;p(j.id,void 0,Ne,Q)}catch(Ne){U(String((Ne==null?void 0:Ne.message)??Ne))}finally{C(!1)}},te=(M==null?void 0:M.setups)??[],X=((M==null?void 0:M.refs)??[]).filter(Q=>Q!==(M==null?void 0:M.placeUrl)),ae=((Ke=(gt=M==null?void 0:M.examples)==null?void 0:gt.find(Q=>!Q.earlier))==null?void 0:Ke.with)??(($e=(nt=M==null?void 0:M.examples)==null?void 0:nt[0])==null?void 0:$e.with),Le=!!M&&(M.anchor===!0||!!(M.figure&&M.figureTreatment)),ce=M!=null&&M.previewHash||(ne=M==null?void 0:M.examples)!=null&&ne.length?" Use a view to shoot like it.":"",Se=M?M.figure&&Le?`The person in it is a stand-in: with a presenter attached, the picture goes with the shot and they take the role.${ce}`:Le?`${ae?`Shown in use with a Scenri demo ${ae}. `:""}Shots are given its picture as their world and find their own frame in it.${ce}`:ae?`Shown in use with a Scenri demo ${ae}. Shots are told the words.${ce}`:M.placeUrl?`Shots are told the words.${ce}`:"":"",Ze=M?jie({refs:X,setups:M.setups},Se):"";return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage sc-scenepage",id:"main",children:[o.jsx(_y,{to:pl(u),wall:"Scenes",where:M?"Yours":"Scenri library"}),o.jsx("h1",{children:j.name}),j.verticals.length>0&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Filed under",children:j.verticals.map(Q=>o.jsx("li",{className:"sc-chip","data-static":!0,children:Q},Q))}),o.jsx("p",{className:"sc-lookpage-lede",children:j.description}),o.jsxs("div",{className:"sc-lookpage-acts",children:[te.length>0?o.jsxs("span",{className:"sc-splitbtn",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary sc-splitbtn-go",onClick:()=>void p(j.id),children:"Use in a shot"}),o.jsxs(Cs,{children:[o.jsx(js,{children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary sc-splitbtn-more","aria-label":"Use it a way",children:o.jsx(bl,{size:12,weight:"bold","aria-hidden":!0})})}),o.jsx(As,{children:te.map(Q=>o.jsx(qn,{onSelect:()=>void p(j.id,Q.id),children:Q.label},Q.id))})]})]}):o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>void p(j.id),children:"Use in a shot"}),M&&o.jsx(Vn,{className:"sc-btn sc-btn-ghost",to:$w(u,M.id),children:"Edit scene"}),o.jsx(Vy,{kind:"scene",brandId:g,id:j.id}),M&&o.jsx(fr,{label:"Edit name, filing and ways",children:o.jsx("button",{type:"button",className:"sc-icon-btn","aria-label":"Edit name, filing and ways","aria-haspopup":"dialog",onClick:()=>z(!0),children:o.jsx(jd,{size:17})})})]}),V&&o.jsx("p",{className:"sc-assetform-err",children:V}),M?o.jsx(Rie,{brandId:u.id,scene:M,onError:U},M.id):k!==(e??"")?o.jsx(Sf,{count:t9,label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:Array.from({length:t9},(Q,We)=>o.jsxs("li",{"aria-hidden":!0,children:[o.jsx("span",{className:"sc-sceneview-frame",children:o.jsx("span",{className:"sc-refset-tile","data-state":"loading",children:o.jsx("span",{className:"sc-placeholder"})})}),o.jsx(Jp,{label:"",isCover:!1})]},We))}):xe.length>1?o.jsx(Sf,{count:xe.length,label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:xe.map(Q=>o.jsxs("li",{children:[o.jsxs("span",{className:"sc-sceneview-frame",children:[o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":`${Q.label}, open`,onClick:()=>L(Q),children:o.jsx(ja,{src:$n(Q.src,"tile"),srcSet:yc(Q.src)})}),Q.view&&o.jsx(qu,{variant:"tile",label:Q.label,isCover:!1,onOpen:()=>L(Q),onUse:()=>void J(Q.view),busy:E})]}),o.jsx(Jp,{label:Q.label,isCover:!1})]},Q.src))}):xe.length===1?o.jsx("div",{className:"sc-scenepage-place",children:o.jsx("button",{type:"button",className:"sc-scenepage-open","aria-label":`${xe[0].label}, open`,onClick:()=>L(xe[0]),children:o.jsx(ja,{src:$n(xe[0].src,"tile"),srcSet:yc(xe[0].src)})})}):o.jsx(qw,{}),M&&o.jsxs("section",{className:"sc-scenepage-told",children:[o.jsxs("dl",{className:"sc-lookpage-told",children:[o.jsxs("div",{children:[o.jsx("dt",{children:ve.lightLabel}),o.jsx("dd",{dir:"auto",children:M.lighting})]}),M.camera&&o.jsxs("div",{children:[o.jsx("dt",{children:ve.cameraLabel}),o.jsx("dd",{dir:"auto",children:M.camera})]}),M.figure&&o.jsxs("div",{children:[o.jsx("dt",{children:ve.figureLabel}),o.jsx("dd",{dir:"auto",children:M.figure})]})]}),o.jsx("p",{className:"sc-lookpage-note",children:"Every shot made here is told this. Anything you write in the shot wins."})]}),X.length>0&&o.jsxs("section",{className:"sc-presenterpage-sources",children:[o.jsx("p",{className:"sc-presenterpage-sources-lb",children:"What it was read from"}),o.jsx("div",{className:"sc-presenterpage-sources-row",children:X.map((Q,We)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${We+1}, open`,onClick:()=>L({src:Q,label:`Source photo ${We+1}`}),children:o.jsx(ja,{src:$n(Q,"micro")})},Q))})]}),M&&o.jsxs("div",{className:"sc-prec",children:[Ze&&o.jsx("p",{className:"sc-prec-note",children:Ze}),o.jsx(Xn,{label:"Delete scene",title:`Delete ${M.name}?`,body:ji("owned-scene",1),busy:K,onConfirm:()=>void se()})]}),H.length>0&&o.jsx(od,{label:`Shots made in ${j.name}`,children:H.map(Q=>o.jsx(Xw,{node:Q,to:zm(u,null,Q.id)},Q.id))}),D.length>0&&o.jsx(od,{label:"Other scenes, similar light",children:D.map(Q=>o.jsx(xf,{scene:Q,variant:"navigate",size:"slider",onOpen:T,href:zr(u,Q.id)},Q.id))}),G&&M&&o.jsx(jL,{name:M.name,categories:M.verticals,known:ee,hint:"The verticals this place suits, so it surfaces where you work.",ways:te,wayChoices:rv,wayMax:CL,busy:F,error:V,onSave:Q=>void pe(Q),onDismiss:()=>z(!1)}),A&&o.jsx(Ed,{src:A.src,kind:"scene",label:A.label,noun:j.name,onClose:()=>L(null),actions:A.view?o.jsx(qu,{variant:"sheet",label:A.label,isCover:!1,onUse:()=>void J(A.view),busy:E}):void 0})]})})}function Lie({draft:e,href:t,onDiscard:n,chosen:r,batching:a,onPick:i,batch:l}){return o.jsx(SL,{id:e.id,name:e.name.trim()||"Untitled presenter",hash:e.hash,drawing:!!e.drawing,state:$ie(e),href:t,blank:o.jsx(xF,{size:44,weight:"thin"}),onDiscard:n,chosen:r,batching:a,onPick:i,batch:l})}function $ie(e){return e.drawing?"Drawing":e.approved?e.approved===1?"Face ready":e.approved>=e.of?"Ready to save":`${e.approved} of ${e.of} views ready`:e.hash?"A face to decide":e.source==="photos"?"Photos added":"Not drawn yet"}function Tie({suggested:e,busy:t,error:n,onConfirm:r,onDismiss:a}){const[i,l]=s.useState(e),u=s.useRef(null),f=s.useRef(!1),h=i.trim(),p=h.length>0;s.useEffect(()=>{f.current=!1},[e]),s.useEffect(()=>{t||(f.current=!1)},[t]);const g=()=>{!p||t||f.current||(f.current=!0,r(h))};return o.jsxs(Ws,{className:"sc-newdlg sc-pdetails",maxWidth:"min(420px, 94vw)",onDismiss:a,onOpenAutoFocus:m=>{m.preventDefault();const w=u.current;w&&(w.focus(),w.select())},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Duplicate presenter"}),o.jsx(Ms,{asChild:!0,children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx("span",{"aria-hidden":!0,children:"×"})})})]}),o.jsxs("div",{className:"sc-newdlg-body",children:[o.jsxs("label",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Name"}),o.jsx("input",{ref:u,className:"sc-pdetails-field",value:i,dir:"auto",maxLength:60,onChange:m=>l(m.target.value),onKeyDown:m=>m.key==="Enter"&&g()})]}),n&&o.jsx("p",{className:"sc-assetform-err",children:n})]}),o.jsxs("div",{className:"sc-newdlg-foot",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:a,children:"Cancel"}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:!p||t,"data-busy":t||void 0,onClick:g,children:t?"Duplicating":"Duplicate"})]})]})}const Die=60;function Hie(e,t,n=Die){var l;const r=e.trim(),a=(((l=r.match(/^(.*?)(?: copy(?: \d+)?)?$/i))==null?void 0:l[1])??r).trim()||r,i=new Set(t.map(u=>u.trim().toLowerCase()).filter(Boolean));for(let u=1;u<1e4;u++){const f=u===1?" copy":` copy ${u}`,h=Math.max(1,n-f.length),p=`${a.slice(0,h).trimEnd()}${f}`;if(!i.has(p.toLowerCase()))return p}return`${a.slice(0,Math.max(1,n-5)).trimEnd()} copy`}const Oie=8,f6="__bookmarked";function Iie(){const{presenters:e,presenterCategories:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:l}=Nn(),{brand:u}=cn(),f=Bn(),h=ky(),{push:p}=rr(),{q:g,setQ:m,facets:w,setFacets:y,clearSearch:b,clear:k}=f1(["category","bookmarked"]),S=w.category,E=w.bookmarked==="1",[C,A]=s.useState(()=>Sd("presenter",u.id)),L=be=>A(d2("presenter",u.id,be)),T=Oy(`${u.id}|${g}|${S??""}|${E?"1":""}`),M=Vl(),j=s.useMemo(()=>s1(u),[u]),[P,R]=Ma(qr.wallDensity,yd),H=Jc(P),D=be=>R(be),B=e2(H),V=Qm(H),U=be=>f(Ra(u,be)),K=be=>f(Zm(u,be)),O=s.useMemo(()=>S?e.filter(be=>be.suitableCategories.includes(S)):e,[e,S]),F=s.useMemo(()=>O.filter(be=>Ho(Wp(be),g)),[O,g]),I=s.useRef(null),G=s.useRef(null),z=o.jsxs("button",{ref:G,type:"button",className:"sc-btn sc-btn-primary",onClick:()=>M("presenter"),children:[o.jsx(pr,{size:12})," Create presenter"]}),[Y,Z]=s.useState([]),ee=s.useRef(0),pe=s.useCallback(()=>{const be=++ee.current;return Ee.presenterDrafts(u.id).then(it=>{be===ee.current&&Z(it.drafts.filter(wt=>!wt.presenterId))}).catch(()=>{}),()=>{be===ee.current&&ee.current++}},[u.id]),se=!!mn({path:mt.presenterStudio}),{tasks:xe}=ia(),J=xe.filter(be=>be.id.startsWith("presenter:")).map(be=>`${be.id}:${be.state}:${be.percent??""}`).join("|");s.useEffect(()=>{if(!se)return pe()},[se,pe,J]);const te=s.useCallback(be=>{const it=Math.max(0,Y.findIndex(wt=>wt.id===be));X.current=it,T.forget(be),Z(wt=>wt.filter(Pe=>Pe.id!==be)),Ee.deletePresenterDraft(u.id,be).finally(()=>pe())},[u.id,Y,pe,T.forget]),X=s.useRef(null);s.useEffect(()=>{var Pe;const be=X.current;if(be===null)return;X.current=null;const it=(Pe=I.current)==null?void 0:Pe.querySelectorAll("[data-build] .sc-cardpuck"),wt=it!=null&&it.length?it[Math.min(be,it.length-1)]:G.current??document.querySelector(".sc-new-go");wt==null||wt.focus()},[Y]);const[ae,Le]=s.useState(null),[ce,Se]=s.useState(!1),[Ze,gt]=s.useState(!1),Ke=s.useCallback(be=>{const it=Y.find(wt=>wt.id===be);it!=null&&it.drawn?Le(it):te(be)},[Y,te]),[nt,$e]=s.useState(null),[ne,Q]=s.useState(null),[We,Ne]=s.useState(null),[ie,q]=s.useState(!1),[oe,Re]=s.useState(null),[ze,Ye]=s.useState(null),Ie=s.useCallback(be=>{const it=j.find(wt=>wt.id===be);it&&(Re(null),$e(it))},[j]),De=s.useCallback(be=>{const it=j.find(wt=>wt.id===be);it&&(Re(null),Q(it))},[j]),Ge=async be=>{if(!(!ne||ie)){q(!0),Re(null);try{i((await Ee.updatePresenter(u.id,ne.id,{name:be})).brand),Q(null)}catch(it){const wt=ln(it,"Could not rename this presenter");Re([wt.title,wt.detail].filter(Boolean).join(" "))}finally{q(!1)}}},ft=s.useCallback(be=>{const it=j.find(wt=>wt.id===be);it&&Ne(it)},[j]),bt=s.useRef(null);s.useEffect(()=>{var Pe;const be=bt.current;if(be===null)return;bt.current=null;const it=(Pe=I.current)==null?void 0:Pe.querySelectorAll(".sc-lookcard:not([data-build]) .sc-lookcard-more"),wt=it!=null&&it.length?it[Math.min(be,it.length-1)]:G.current??document.querySelector(".sc-new-go");wt==null||wt.focus()},[e,u]);const at=async be=>{if(!(!nt||ie)){q(!0),Re(null);try{const it=await Ee.duplicatePresenter(u.id,nt.id,be);i(it.brand),$e(null),Ye(it.presenter.id)}catch(it){const wt=ln(it,"Could not duplicate this presenter");Re([wt.title,wt.detail].filter(Boolean).join(" "))}finally{q(!1)}}},Zt=async()=>{if(!(!We||ie)){bt.current=Math.max(0,jt.findIndex(be=>be.id===We.id)),q(!0);try{const be=await Ee.deletePresenter(u.id,We.id);i(be.brand),T.forget(We.id),Ne(null)}catch(be){(be==null?void 0:be.status)===404?(await l(),T.forget(We.id),Ne(null)):p(ln(be,"Could not delete this presenter"))}finally{q(!1)}}};s.useEffect(()=>{var it,wt;if(!ze)return;(wt=(it=I.current)==null?void 0:it.querySelector(".sc-lookcard[data-just-added]"))==null||wt.scrollIntoView({block:"nearest"});const be=window.setTimeout(()=>Ye(null),1800);return()=>window.clearTimeout(be)},[ze]);const jt=s.useMemo(()=>j.filter(be=>S?!be.suitableCategories.length||be.suitableCategories.includes(S):!0).filter(be=>Ho(Wp(be),g)).filter(be=>E?C.includes(be.id):!0),[j,S,g,E,C]),Pt=!(j.length>0||Y.length>0),Tt=[...j,...e].reduce((be,it)=>be+(C.includes(it.id)?1:0),0),ke=E&&Tt===0,et=ke&&Pt,Et=ke&&!Pt,Qe=!E||et,st=jt.filter(be=>!E||et||C.includes(be.id)),rt=Qe&&Y.length>0||st.length>0,{visible:qt,remaining:Yt,showMore:an}=kf(st,`${u.id}|${S??""}|${E?"keepers":""}|${et?"browse":""}|${g}`),[Wt,Mn]=s.useState(null);s.useEffect(()=>{if(!Wt||Yt<=0)return;const be=new IntersectionObserver(it=>{it.some(wt=>wt.isIntersecting)&&an()},{root:Wt.closest(".sc-home"),rootMargin:"200% 0px"});return be.observe(Wt),()=>be.disconnect()},[Wt,Yt,an]);const Bt=s.useMemo(()=>!E||et?F:F.filter(be=>C.includes(be.id)),[F,E,et,C]),{visible:re,remaining:ue,showMore:de}=kf(Bt,`${S??""}|${E?"keepers":""}|${et?"browse":""}|${g}`),_e=e.length+j.length>0?"tabs":"none",Fe=s.useCallback(async be=>{const{failed:it,error:wt}=await Qp(be,Pe=>Ee.deletePresenterDraft(u.id,Pe));Z(Pe=>Pe.filter(Xe=>it.includes(Xe.id)||!be.includes(Xe.id))),T.retain(it),pe(),wt&&p(ln(wt,"Could not discard these drafts"))},[u.id,pe,T.retain,p]),xt=()=>{const be=Y.filter(it=>T.ids.has(it.id));be.some(it=>it.drawn)?be.length===1?Le(be[0]):Se(!0):Fe(be.map(it=>it.id))},yt=()=>{const be=[...T.ids];be.length===1?ft(be[0]):gt(!0)},kt=[...T.ids],ot=T.kind==="presenter"&&kt.length>0&&kt.every(be=>C.includes(be)),ht=()=>A(Sy("presenter",u.id,kt,!ot)),je=p2(T.ids.size,ot,"presenters"),me=async()=>{if(ie)return;const be=[...T.ids];q(!0);try{const{failed:it,error:wt}=await Qp(be,Pe=>Ee.deletePresenter(u.id,Pe));await l(),T.retain(it),gt(!1),wt&&p(ln(wt,"Could not delete these presenters"))}finally{q(!1)}},tt={key:"category",label:"Category",everyLabel:"All presenters",everyCount:e.length+j.length,selected:E?f6:S,onSelect:be=>y(be===f6?{bookmarked:"1",category:null}:{bookmarked:null,category:be}),options:[{value:f6,label:"Keepers",count:Tt},...t.map(be=>({value:be,label:be,count:[...j,...e].filter(it=>!it.suitableCategories.length||it.suitableCategories.includes(be)).length}))]},Ct=o.jsx(g2,{title:"Presenters",filters:o.jsx(v2,{mode:_e,group:tt}),density:o.jsx(Jm,{value:H,onChange:D}),search:e.length>=Oie&&o.jsx(Fd,{value:g,onChange:m,noun:"presenters",total:e.length})});return o.jsxs(a1.Provider,{value:V,children:[o.jsx(ds,{children:o.jsxs("main",{className:"sc-looks sc-presenters",id:"main","data-hero":Pt||void 0,onClick:T.onBlank,children:[!Pt&&Ct,rt&&o.jsxs("section",{className:"sc-owned",children:[o.jsx("div",{className:"sc-sec-head",children:o.jsx("h2",{className:"sc-sec-title",children:"Your presenters"})}),o.jsxs("div",{ref:I,className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:[Qe&&Y.map(be=>o.jsx(Lie,{draft:be,href:gl(u,be.id),onDiscard:Ke,chosen:T.ids.has(be.id),batching:T.batching==="draft",onPick:T.picking("draft")?it=>T.toggle("draft",it):void 0,batch:T.kind==="draft"&&T.ids.has(be.id)?{count:T.ids.size,onAct:xt}:null},be.id)),ae&&o.jsx(Xn,{label:"Discard",title:`Discard ${ae.name.trim()||"this unfinished presenter"}?`,body:"The views drawn so far are thrown away. Nothing was saved to the library.",open:!0,busy:!1,onOpenChange:be=>{be||Le(null)},onConfirm:()=>{te(ae.id),Le(null)}}),qt.map(be=>o.jsx(nv,{presenter:be,variant:"use",size:"grid",onOpen:U,href:Ra(u,be.id),onUse:h,onDuplicate:Ie,onEdit:K,onDelete:ft,onRename:De,bookmarked:C.includes(be.id),onBookmark:L,fresh:be.id===ze,chosen:T.ids.has(be.id),batching:T.batching==="presenter",onPick:T.picking("presenter")?it=>T.toggle("presenter",it):void 0,batch:T.kind==="presenter"&&T.ids.has(be.id)?{count:T.ids.size,onAct:yt,onKeep:ht,allKept:ot}:null},be.id)),ne&&o.jsx(Dy,{title:"Rename presenter",name:ne.name,maxLength:60,busy:ie,error:oe,onConfirm:be=>void Ge(be),onDismiss:()=>{ie||Q(null)}}),nt&&o.jsx(Tie,{suggested:Hie(nt.name,j.map(be=>be.name)),busy:ie,error:oe,onConfirm:be=>void at(be),onDismiss:()=>{ie||$e(null)}}),We&&o.jsx(Xn,{label:"Delete presenter",title:`Delete ${We.name}?`,body:ji("presenter",1),open:!0,busy:ie,onOpenChange:be=>{!be&&!ie&&Ne(null)},onConfirm:()=>void Zt()}),Ze&&o.jsx(Xn,{label:cs("presenter",T.ids.size).menu,title:`${cs("presenter",T.ids.size).menu}?`,body:ji("presenter",T.ids.size),open:!0,busy:ie,onOpenChange:be=>{!be&&!ie&&gt(!1)},onConfirm:()=>void me()}),ce&&o.jsx(Xn,{label:cs("draft",T.ids.size).menu,title:`${cs("draft",T.ids.size).menu}?`,body:"The views drawn so far are thrown away. Nothing was saved to the library.",open:!0,busy:!1,onOpenChange:be=>{be||Se(!1)},onConfirm:()=>{const be=[...T.ids];Se(!1),Fe(be)}})]}),Yt>0&&o.jsx("div",{ref:Mn,"aria-hidden":!0}),Yt>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:an,children:["Show ",Math.min(Yt,60)," more"]})})]}),Pt&&n&&!r&&e.length>0&&o.jsx(No,{shape:"cold",title:o.jsxs(o.Fragment,{children:["Cast your own ",o.jsx("em",{children:"presenter"})]}),body:"Describe someone new, or add photos of a real person. They stay the same person in every image you make.",action:z}),rt&&n&&!r&&re.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri presenters"})}),!n&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":V,style:B,"aria-hidden":!0,children:o.jsx(bL,{size:"grid",count:8})}),n&&r&&o.jsx(No,{shape:"error",title:"Couldn't load the presenter library",body:"Something went wrong reaching the catalog.",onRetry:()=>a()}),Pt&&n&&!r&&e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Iy,{label:"Or cast someone from ours"}),Ct]}),n&&!r&&re.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:re.map(be=>o.jsx(nv,{presenter:be,variant:"use",size:"grid",onOpen:U,href:Ra(u,be.id),onUse:h,bookmarked:C.includes(be.id),onBookmark:L},be.id))}),n&&!r&&Et&&o.jsx(No,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a presenter from its card and it stays here.",mark:Ty,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>y({bookmarked:null}),children:"Browse every presenter"})}),n&&!r&&!Et&&!Bt.length&&e.length>0&&o.jsx(w2,{noun:"presenters",q:g,facet:E?"Keepers":S,onClearSearch:b,onClearAll:k}),n&&!r&&!e.length&&o.jsx(No,{shape:"zero",body:"The presenter library is still being cast. Check back soon."}),ue>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:de,children:["Show ",Math.min(ue,60)," more"]})})]})}),T.ids.size>0&&(T.kind==="draft"||T.kind==="presenter")&&o.jsx("div",{className:"sc-wall-dock",children:o.jsx(Hy,{count:T.ids.size,loaded:T.kind==="draft"?Y.length:qt.length,tool:cs(T.kind,T.ids.size).tool,icon:cs(T.kind,T.ids.size).icon,danger:cs(T.kind,T.ids.size).danger,onAct:T.kind==="draft"?xt:yt,keep:T.kind==="presenter"?{label:je.tool,filled:ot,onAct:ht}:null,onClear:T.clear,onSelectAll:()=>T.selectAll(T.kind==="draft"?"draft":"presenter",(T.kind==="draft"?Y:qt).map(be=>be.id))})}),o.jsx(Zc,{})]})}const n9={portrait:"Face",identity:"Face",front:"Full body","three-quarter":"Three-quarter",back:"Back",left:"Left",right:"Right","left-profile":"Left","right-profile":"Right"},r9=3;function Fie(){var xe;const{presenterId:e=""}=aa(),{presenters:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:l,presenterCategories:u}=Nn(),{brand:f}=cn(),h=Bn(),p=y2(),g=s.useRef(!1),m=ky(),[w,y]=s.useState([]),[b,k]=s.useState(null),[S,E]=s.useState(null),C=RX(f,e),A=C??t.find(J=>J.id===e);qc(A==null?void 0:A.name);const L=!!C,[T,M]=s.useState(null);s.useEffect(()=>{let J=!0;if(y([]),!L)return Ee.presenterFrames(e).then(te=>{J&&(y(te.frames),M(e))}).catch(()=>{J&&(y([]),M(e))}),()=>{J=!1}},[e,L]);const j=s.useRef(e);j.current=e,h2(()=>{if(L)return;const J=e;Ee.presenterFrames(J).then(te=>{j.current===J&&y(X=>xi(X,te.frames))}).catch(()=>{})});const P=!!mn({path:mt.presenterEdit});s.useEffect(()=>{let J=!0;if(E(null),!(!L||P))return Ee.presenterDrafts(f.id).then(te=>{if(!J)return;const X=te.drafts.find(ae=>ae.presenterId===e);E((X==null?void 0:X.id)??null)}).catch(()=>{}),()=>{J=!1}},[f.id,e,L,P]);const R=((xe=f.json)==null?void 0:xe.characters)??[],H=R.find(J=>J.presenterId===e),D=R.find(J=>J.id===e),B=Fy(f.id,[e??"",(H==null?void 0:H.id)??""]),[V,U]=s.useState(null),[K,O]=s.useState(!1),[F,I]=s.useState(!1),G=async J=>{if(C){O(!0),U(null);try{const te=await Ee.updatePresenter(f.id,C.id,J);i(te.brand),I(!1)}catch(te){U(String(te.message??te))}finally{O(!1)}}},z=async()=>{if(!C||g.current)return;g.current=!0;const J=p(),te=ui(f);O(!0);try{const X=await Ee.deletePresenter(f.id,C.id);i(X.brand)}catch(X){if((X==null?void 0:X.status)!==404){g.current=!1,J()&&(U(String(X.message??X)),O(!1));return}await l()}J()&&h(te,{replace:!0})},Y=Yw(f,e);if(Y!==e)return o.jsx(Ja,{to:Ra(f,Y),replace:!0});if(!n&&!C)return o.jsx(ds,{children:o.jsx("main",{className:"sc-lookpage",id:"main",children:o.jsx("div",{className:"sc-tplrow","aria-hidden":!0})})});if(r&&!C)return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage",id:"main",children:[o.jsx("h1",{children:"Couldn't load this presenter"}),o.jsx("p",{className:"sc-lookpage-lede",children:"Something went wrong reaching the catalog."}),o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>a(),children:"Retry"})})]})});if(!A)return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage",id:"main",children:[o.jsx("h1",{children:"This presenter isn't here anymore"}),o.jsx("p",{className:"sc-lookpage-lede",children:"They may have been removed from the catalog, or the link is out of date."}),o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx(Vn,{className:"sc-btn sc-btn-primary",to:ui(f),children:"Browse presenters"})})]})});const Z=C?(Array.isArray(D==null?void 0:D.shots)?D.shots:[]).map((J,te)=>({src:Jr(J==null?void 0:J.file),label:n9[(J==null?void 0:J.angle)??""]??`Reference ${te+1}`,angle:typeof(J==null?void 0:J.angle)=="string"?J.angle:void 0})).filter(J=>!!J.src):w.length?w.map((J,te)=>({src:J.url,label:n9[J.angle]??`Reference ${te+1}`,angle:J.angle})):A.previewUrl?[{src:A.previewUrl,label:"Preview"}]:[],ee=Zm(f,e),pe=ki(C??A),se=[...new Set([...u,...s1(f).flatMap(J=>J.suitableCategories??[])])].sort((J,te)=>J.localeCompare(te));return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage sc-presenterpage",id:"main",children:[o.jsx(_y,{to:ui(f),wall:"Presenters",where:C?"Yours":"Scenri library"}),pe.src&&o.jsx("div",{className:"sc-presenterpage-avatar",children:o.jsx(ja,{src:$n(pe.src,"small"),crop:pe.crop})}),o.jsx("h1",{children:A.name}),A.suitableCategories.length>0&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Filed under",children:A.suitableCategories.map(J=>o.jsx("li",{className:"sc-chip","data-static":!0,children:J},J))}),A.descriptor&&o.jsx("p",{className:"sc-lookpage-lede",children:A.descriptor}),o.jsxs("div",{className:"sc-lookpage-acts",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>m(e),children:"Use in a shot"}),C&&o.jsx(Vn,{className:"sc-btn sc-btn-ghost",to:ee,children:S?"Continue editing":"Edit presenter"}),o.jsx(Vy,{kind:"presenter",brandId:f.id,id:e}),C&&o.jsx(fr,{label:"Edit name and details",children:o.jsx("button",{type:"button",className:"sc-icon-btn","aria-label":"Edit name and details","aria-haspopup":"dialog",onClick:()=>I(!0),children:o.jsx(jd,{size:17})})})]}),V&&o.jsx("p",{className:"sc-assetform-err",children:V}),!C&&T!==e?o.jsx(Sf,{count:r9,label:"Reference set",className:"sc-refset-rail",trackClassName:"sc-refset",children:Array.from({length:r9},(J,te)=>o.jsxs("li",{"aria-hidden":!0,children:[o.jsx("span",{className:"sc-refset-tile","data-state":"loading",children:o.jsx("span",{className:"sc-placeholder"})}),o.jsx("span",{className:"sc-refset-lb"})]},te))}):Z.length>0?o.jsx(Sf,{count:Z.length,label:"Reference set",className:"sc-refset-rail",trackClassName:"sc-refset",children:Z.map(J=>o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-refset-tile","data-role":J.angle,"aria-label":`${J.label}, open`,onClick:()=>k(J),children:o.jsx(ja,{src:$n(J.src,"small")})}),o.jsx("span",{className:"sc-refset-lb","aria-hidden":!0,children:J.label})]},J.label))}):o.jsx(qw,{}),C&&C.sourceRefs.length>0&&o.jsxs("section",{className:"sc-presenterpage-sources",children:[o.jsx("p",{className:"sc-presenterpage-sources-lb",children:"From your photos"}),o.jsx("div",{className:"sc-presenterpage-sources-row",children:C.sourceRefs.map((J,te)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${te+1}, open`,onClick:()=>k({src:J,label:`Source photo ${te+1}`}),children:o.jsx(ja,{src:$n(J,"micro")})},J))})]}),C&&o.jsxs("div",{className:"sc-prec",children:[o.jsxs("p",{className:"sc-prec-note",children:[A.ageRange?`${A.ageRange} · `:"",C.source==="synthetic"?"Created in Scenri. Not a real person.":C.source==="photos"?"Built from your photographs.":"Saved in Scenri.",C.likeness?` Likeness confirmed ${new Date(C.likeness.attestedAt).toLocaleDateString()}.`:""]}),o.jsx(Xn,{label:"Delete presenter",title:`Delete ${C.name}?`,body:ji("presenter",1),busy:K,onConfirm:()=>void z()})]}),B.length>0&&o.jsx(od,{label:`Shots featuring ${A.name}`,children:B.map(J=>o.jsx(Xw,{node:J,to:zm(f,null,J.id)},J.id))}),F&&C&&o.jsx(jL,{name:C.name,categories:A.suitableCategories,known:se,hint:"The verticals they suit, so they surface where you work.",busy:K,error:V,onSave:J=>void G({name:J.name,suitableCategories:J.categories}),onDismiss:()=>I(!1)}),b&&o.jsx(Ed,{src:b.src,kind:"presenter",label:b.label,noun:A.name,onClose:()=>k(null)})]})})}function _ie({placeholder:e,label:t,action:n="Send",scope:r,hint:a,value:i,onValue:l,allowEmpty:u,disabled:f,why:h,quiet:p,working:g,error:m,focusKey:w,onStop:y,stopping:b,onAttach:k,onAttachFiles:S,attachLabel:E,colour:C,refs:A,onSend:L}){const T=s.useRef(null),M=s.useRef(null),[j,P]=s.useState(void 0);s.useLayoutEffect(()=>{const z=T.current;if(!z)return;z.style.height="auto";const Y=Number.parseFloat(getComputedStyle(z).maxHeight)||Number.POSITIVE_INFINITY;z.style.height=`${Math.min(z.scrollHeight,Y)}px`,z.style.overflowY=z.scrollHeight>Y?"auto":"hidden"},[i]);const[R,H]=s.useState(!1),D=Nr(la);s.useEffect(()=>{if(!w||w===j||f||(P(w),D))return;const z=T.current;if(z==null||z.focus({preventScroll:!0}),z!=null&&z.value){z.select(),H(!0);const Y=setTimeout(()=>H(!1),700);return()=>clearTimeout(Y)}},[w,j,f,D]);const B=f||g,V=!!(C!=null&&C.hex)||!!(A!=null&&A.some(z=>!z.busy)),U=!i.trim()&&!u&&!V,K=()=>{B||U||L(i)},O=m?{text:m,tone:"alert"}:{text:(r==null?void 0:r.hint)??a??"",tone:r==null?void 0:r.tone},F=!!y&&(g||!i.trim()&&!V),I=g||F?null:f&&h?h:U&&!f?"Nothing typed yet.":null,G=o.jsxs("button",{type:"button",className:"sc-convo-send","aria-disabled":(F?!!b:g||B||U)||void 0,"aria-busy":g||F||void 0,"data-stop":F||void 0,onClick:F?b?void 0:y:g?void 0:K,children:[o.jsx("span",{className:"sc-convo-send-ico",children:g||F?o.jsx("span",{className:"sc-convo-spin","aria-hidden":"true"}):o.jsx(eE,{size:17,weight:"bold"})}),F?b?"Stopping":"Stop":g?"Working":n]});return o.jsxs("div",{className:"sc-convo-composer",children:[o.jsxs("div",{className:"sc-convo-card","data-quiet":p||void 0,"data-flash":R||void 0,children:[(r==null?void 0:r.chip)&&o.jsx("div",{className:"sc-convo-scope-row",children:o.jsxs("span",{className:"sc-convo-scope",children:[r.chip.thumb?o.jsx("img",{src:r.chip.thumb,alt:""}):null,r.chip.label]})}),o.jsxs("div",{className:"sc-convo-field",children:[A==null?void 0:A.map(z=>o.jsxs("span",{className:"sc-token","data-kind":"image","data-busy":z.busy||void 0,dir:"ltr",children:[o.jsx("img",{src:z.src,alt:""}),o.jsx("span",{className:"sc-token-label",children:z.label}),o.jsx("button",{type:"button",className:"sc-convo-chip-x","aria-label":`Remove ${z.label}`,onClick:z.onRemove,children:o.jsx(jn,{size:11,weight:"bold"})})]},z.key)),C&&o.jsxs("span",{className:"sc-token","data-kind":"color","data-empty":C.hex?void 0:"",dir:"ltr",children:[o.jsxs(bd,{className:"sc-convo-chip",triggerStyle:{background:"none"},value:C.hex??C.seed??"#808080",commitMode:"live",align:"start",label:C.hex?`${C.label}. Change the colour.`:"Pick a colour",onChange:C.onPick,children:[o.jsx("span",{className:"sc-token-swatch",style:C.hex?{background:C.hex}:void 0}),o.jsx("span",{className:"sc-token-label",children:C.label})]}),C.hex&&o.jsx("button",{type:"button",className:"sc-convo-chip-x","aria-label":"Remove colour",onClick:C.onClear,children:o.jsx(jn,{size:11,weight:"bold"})})]}),o.jsx("textarea",{ref:T,className:"sc-in",rows:1,maxLength:kd,"aria-label":t,placeholder:C!=null&&C.hex&&!i?"":f&&h?h:e,value:i,disabled:f,onChange:z=>l(z.target.value),onKeyDown:z=>{z.key!=="Enter"||z.shiftKey||(z.preventDefault(),K())}})]}),o.jsxs("div",{className:"sc-convo-row",children:[(k||S)&&o.jsxs(o.Fragment,{children:[o.jsx(fr,{label:B&&h?h:E??"Add photos",children:o.jsx("button",{type:"button",className:"sc-convo-attach","aria-label":E??"Add photos","aria-disabled":B||void 0,onClick:B?void 0:S?()=>{var z;return(z=M.current)==null?void 0:z.click()}:k,children:o.jsx(pr,{size:16,weight:"bold"})})}),S&&o.jsx("input",{ref:M,type:"file",accept:"image/*",hidden:!0,"aria-label":E??"Add a picture",onChange:z=>{const Y=Array.from(z.target.files??[]).filter(Z=>Z.type.startsWith("image/"));z.target.value="",Y.length&&S(Y)}})]}),I?o.jsx(fr,{label:I,children:G}):G]})]}),O.text?o.jsx("small",{className:"sc-convo-line",role:O.tone==="alert"?"alert":void 0,"data-tone":O.tone,children:O.text}):null]})}function ML({glyph:e,lead:t,hint:n}){return o.jsxs("div",{className:"sc-pstudio-empty",children:[o.jsxs("span",{className:"sc-pstudio-empty-mark","aria-hidden":!0,children:[o.jsx("span",{className:"sc-pstudio-empty-ring","data-at":"far"}),o.jsx("span",{className:"sc-pstudio-empty-ring","data-at":"near"}),e]}),t&&o.jsxs("span",{className:"sc-pstudio-empty-say",children:[o.jsx("span",{children:t}),n&&o.jsx("span",{children:n})]})]})}const s9=500,RL=400,PL=760,$u=e=>Math.min(PL,Math.max(RL,Math.round(e)));function Vie({title:e,headAction:t,stage:n,body:r,bodyProps:a,foot:i,overlay:l,kind:u,resizeLabel:f,onPaste:h,onDropFiles:p,onClose:g}){const m=s.useRef(null),[w,y]=s.useState(null);Ly(w,"--sc-pstudio-dock-h"),s.useEffect(()=>{const A=L=>{L.key!=="Escape"||L.defaultPrevented||(L.preventDefault(),g())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[g]);const[b,k]=Ma(qr.pstudioRailW,s9),S=s.useRef(0),E=s.useRef(0),C=s.useRef(null);return Br.createPortal(o.jsx(Nd,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:A=>{var L;C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,A.preventDefault(),(L=m.current)==null||L.focus({preventScroll:!0})},onUnmountAutoFocus:A=>{var L,T;(L=C.current)!=null&&L.isConnected||(A.preventDefault(),(T=document.querySelector(".sc-new-go")??document.getElementById("main"))==null||T.focus())},children:o.jsxs("div",{ref:m,tabIndex:-1,className:"sc-pstudio","data-kind":u,style:{"--sc-pstudio-rail-set":`${$u(b)}px`},role:"dialog","aria-modal":"true","aria-labelledby":"sc-pstudio-title",onDragOver:A=>{p&&Array.from(A.dataTransfer.types).includes("Files")&&A.preventDefault()},onDrop:A=>{var T;if(!p||A.defaultPrevented)return;const L=Array.from(((T=A.dataTransfer)==null?void 0:T.files)??[]);L.length&&(A.preventDefault(),p(L))},onPaste:A=>{var T;if(!h)return;const L=Array.from(((T=A.clipboardData)==null?void 0:T.files)??[]).filter(M=>M.type.startsWith("image/"));L.length&&(A.preventDefault(),h(L))},children:[o.jsxs("div",{className:"sc-pstudio-grid",children:[o.jsx(fr,{label:"Close (esc)",children:o.jsx("button",{type:"button",className:"sc-pstudio-close",onClick:g,"aria-label":"Close",children:o.jsx(jn,{size:13})})}),o.jsxs("div",{className:"sc-pstudio-head sc-newdlg-head",children:[o.jsx("h2",{id:"sc-pstudio-title",className:"sc-newdlg-title",children:e}),t,o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close",onClick:g,"aria-label":"Close",children:o.jsx(jn,{size:16})})]}),o.jsxs("div",{className:"sc-pstudio-scroll",children:[n,o.jsx("div",{className:"sc-pstudio-body",...a,children:r})]}),o.jsx("div",{className:"sc-pstudio-foot sc-dock",ref:y,children:i}),o.jsx("div",{className:"sc-pstudio-resize",role:"separator","aria-orientation":"vertical","aria-label":f,"aria-valuemin":RL,"aria-valuemax":PL,"aria-valuenow":$u(b),tabIndex:0,onPointerDown:A=>{A.button===0&&(A.preventDefault(),A.stopPropagation(),A.currentTarget.setPointerCapture(A.pointerId))},onPointerMove:A=>{if(!A.currentTarget.hasPointerCapture(A.pointerId))return;const L=A.currentTarget.closest(".sc-pstudio");S.current=A.clientX,!E.current&&(E.current=requestAnimationFrame(()=>{E.current=0,L==null||L.style.setProperty("--sc-pstudio-rail-set",`${$u(window.innerWidth-S.current)}px`)}))},onPointerUp:A=>{A.currentTarget.releasePointerCapture(A.pointerId),E.current&&(cancelAnimationFrame(E.current),E.current=0),k($u(window.innerWidth-A.clientX))},onDoubleClick:()=>k(s9),onKeyDown:A=>{if(A.key==="ArrowLeft")k(L=>$u(L+16));else if(A.key==="ArrowRight")k(L=>$u(L-16));else return;A.preventDefault()}})]}),l]})}),document.body)}function Zie({hash:e,alt:t,drawing:n,since:r,items:a,onPick:i,compare:l,doing:u,takes:f,onTake:h,empty:p,glyph:g}){const m=zie(n),[w,y]=s.useState(null),b=f??[],k=Math.max(0,b.findIndex(R=>w?R.hash===w:R.current)),S=b[k];s.useEffect(()=>y(null),[e]);const E=Bie(w&&b.some(R=>R.hash===w)?w:e),[C,A]=s.useState(void 0);s.useEffect(()=>{E||A(void 0)},[E]);const L=R=>{const H=b[k+R];H&&y(H.hash)},T=s.useRef(null),[M,j]=s.useState(!1);s.useLayoutEffect(()=>{const R=T.current,H=!!(R!=null&&R.complete&&R.naturalWidth);j(!H),H&&(R!=null&&R.naturalHeight)&&A(R.naturalWidth/R.naturalHeight)},[E]);const P=!!e&&!E;return o.jsxs("div",{className:"sc-pstudio-stage",children:[o.jsx("div",{className:"sc-pstudio-wrap",children:o.jsxs("div",{className:"sc-pstudio-well","data-drawing":n||void 0,"data-empty":!e||void 0,style:C?{"--sc-well-ar":C}:void 0,children:[e&&E?o.jsx("img",{ref:T,src:Tr(E),srcSet:`${gn(E,"tile")} 640w, ${Tr(E)} 1024w`,sizes:"(max-width: 767px) 92vw, 44vw",alt:t,decoding:"async","data-waiting":M||void 0,onLoad:R=>{const H=R.currentTarget;j(!1),H.naturalWidth&&H.naturalHeight&&A(H.naturalWidth/H.naturalHeight)}}):o.jsx("span",{className:"sc-pstudio-well-blank",children:!n&&!e&&o.jsx(ML,{glyph:g,lead:p==null?void 0:p.lead,hint:p==null?void 0:p.hint})}),(n&&!e||P)&&o.jsx(Pa,{}),n&&o.jsxs("span",{className:"sc-pstudio-doing",children:[o.jsx("span",{children:u??"Drawing"}),r&&o.jsx("time",{"aria-hidden":"true",children:Dc(r,m)})]}),b.length>1&&!n&&!(l!=null&&l.on)&&o.jsxs("div",{className:"sc-pstudio-vers",children:[o.jsx("button",{type:"button",className:"sc-pstudio-vers-step","aria-label":"The version before","aria-disabled":k===0||void 0,onClick:()=>k>0&&L(-1),children:o.jsx($a,{size:13,weight:"bold"})}),o.jsxs("span",{className:"sc-pstudio-vers-n","aria-live":"polite",children:["Version ",(S==null?void 0:S.n)??1," of ",b.length]}),o.jsx("button",{type:"button",className:"sc-pstudio-vers-step","aria-label":"The version after","aria-disabled":k===b.length-1||void 0,onClick:()=>k<b.length-1&&L(1),children:o.jsx(Al,{size:13,weight:"bold"})}),S&&!S.current&&h&&o.jsx("button",{type:"button",className:"sc-pstudio-vers-put",onClick:()=>h(S.hash),children:"Put back"}),(S==null?void 0:S.current)&&o.jsx("span",{className:"sc-pstudio-vers-on",children:"Active"})]}),l&&!n&&o.jsx("button",{type:"button",className:"sc-pstudio-compare","aria-pressed":l.on,onClick:l.toggle,children:l.on?"Showing current":"Compare"})]})}),a.length>0&&o.jsx("ol",{className:"sc-pstudio-strip","aria-label":"Views",children:a.map(R=>{const H=R.label+(R.approved?", used":R.state==="stale"?", to be drawn again":"")+(R.photo?", your photo":"")+(R.drawing?", drawing":"")+(R.error?", failed":"");return o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-pstudio-slot","data-state":R.state,"data-view":R.view,"aria-current":R.state==="current"?"step":void 0,"aria-label":H,disabled:!i,onClick:()=>i==null?void 0:i(R.view),children:o.jsxs("span",{className:"sc-pstudio-slot-inner",children:[R.hash?o.jsx("img",{src:gn(R.hash,"micro"),alt:""}):null,R.drawing?o.jsx(Pa,{}):null,R.approved&&!R.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","aria-hidden":!0,children:o.jsx(Kn,{size:11,weight:"bold"})}):null,R.error&&!R.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","data-tone":"alert","aria-hidden":!0,children:o.jsx(vm,{size:11,weight:"bold"})}):null]})}),o.jsx("span",{className:"sc-pstudio-slot-lb","data-on":R.state==="current"||void 0,"aria-hidden":!0,children:R.label})]},R.view)})})]})}function zie(e){const[t,n]=s.useState(()=>Date.now());return s.useEffect(()=>{if(!e)return;n(Date.now());const r=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(r)},[e]),t}function Bie(e){const[t,n]=s.useState(e);return s.useEffect(()=>{if(!e||e===t){e||n(void 0);return}let r=!0;const a=()=>{r&&n(e)},i=new Image;i.srcset=`${gn(e,"tile")} 640w, ${Tr(e)} 1024w`,i.sizes="(max-width: 767px) 92vw, 44vw",i.src=Tr(e),i.decode?i.decode().then(a,a):(i.onload=a,i.onerror=a);const l=window.setTimeout(a,3e3);return()=>{r=!1,window.clearTimeout(l)}},[e,t]),t}function Zy({surface:e,onClose:t}){var h,p,g;const n=Nr(la),r=e,a=(h=r.stage)==null?void 0:h.onPick,i=a?m=>a(m):void 0,l=pne(r.turns);s.useEffect(()=>{if(!l||r.busy)return;let m=!1;const w=y=>{var k,S;if(y.key!=="Enter"||y.shiftKey||y.defaultPrevented||m)return;const b=y.target;!((k=b==null?void 0:b.matches)!=null&&k.call(b,".sc-convo-q"))||((S=b.closest(".sc-convo-turn"))==null?void 0:S.getAttribute("data-turn"))!==`q:${l.id}`||(y.preventDefault(),m=!0,r.onAnswer(l.id,{kind:"confirm",id:l.options[0].id}))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[l,r.busy,r.onAnswer]);const u=r.glyph??o.jsx(kF,{size:32}),f=n?null:r.stage?o.jsx(Zie,{hash:r.stage.hash,alt:r.stage.alt,drawing:r.stage.drawing,since:r.stage.since,doing:r.stage.doing,takes:r.stage.takes,onTake:r.stage.onTake,items:r.stage.items,onPick:r.stage.onPick,compare:r.stage.compare,empty:r.stageEmpty,glyph:u}):o.jsx("div",{className:"sc-pstudio-stage","data-reserve":!0,children:o.jsx("div",{className:"sc-pstudio-wrap",children:o.jsx("div",{className:"sc-pstudio-well","data-empty":!0,children:o.jsx("span",{className:"sc-pstudio-well-blank",children:o.jsx(ML,{glyph:u,lead:(p=r.stageEmpty)==null?void 0:p.lead,hint:(g=r.stageEmpty)==null?void 0:g.hint})})})})});return o.jsx(Vie,{kind:r.kind??"presenter",title:r.title,headAction:r.headAction,resizeLabel:"Resize the conversation",onPaste:r.onPaste,onClose:t,overlay:r.overlay,stage:f,bodyProps:{"data-convo":!0},body:o.jsx(tre,{turns:r.turns,busy:r.busy,working:r.working,memoryKey:r.memoryKey,resumed:r.resumed,onAnswer:r.onAnswer,onEdit:r.onEdit,onSaveEdit:r.onSaveEdit,onCancelEdit:r.onCancelEdit,onRestore:r.onRestore,onRetry:r.onRetry,onShow:i,onStarter:m=>(r.onStarter??r.onText)(m),onDescribe:r.onDescribe,onAttachFiles:r.onAttachRef}),foot:o.jsxs(o.Fragment,{children:[r.dock,r.composer&&o.jsx(_ie,{quiet:!!r.composer.disabled&&!r.composer.working,placeholder:r.composer.placeholder,label:r.composer.label,action:r.composer.action,scope:r.composer.scope,hint:r.composer.hint,value:r.text,onValue:r.onText,allowEmpty:r.composer.allowEmpty,disabled:r.composer.disabled,why:r.composer.why,working:r.composer.working,error:r.composer.error,focusKey:r.composer.focusKey,onAttach:r.composer.onAttach,onAttachFiles:r.composer.onAttachFiles,attachLabel:r.composer.attachLabel,colour:r.composer.colour,refs:r.composer.refs,onStop:r.composer.onStop,stopping:r.composer.stopping,onSend:r.onSend})]})})}const _d=[{id:"glasses",label:"Glasses",ask:"What glasses do they wear?",options:[{id:"thin black rectangular metal frames",label:"Thin black",card:"glasses-1"},{id:"round thin gold metal frames",label:"Round metal",card:"glasses-2"},{id:"clear transparent acetate frames",label:"Clear acetate",card:"glasses-3"},{id:"bold thick black rectangular acetate frames",label:"Bold rectangular",card:"glasses-4"},{id:"tortoiseshell acetate frames",label:"Tortoiseshell",card:"glasses-5"},{id:"rimless frames with thin temples",label:"Rimless",card:"glasses-6"}],saying:"Describe the glasses",refHint:"A clear front or three-quarter view of the frames."},{id:"freckles",label:"Freckles or marks",ask:"What marks their skin?",options:[{id:"light freckles across the nose and cheeks",label:"Light freckles",card:"freckles-1"},{id:"dense freckles across the whole face",label:"Dense freckles",card:"freckles-2"},{id:"freckles across the face and shoulders",label:"Face and shoulders",card:"freckles-3"},{id:"a small birthmark on one cheek",label:"Birthmark",card:"freckles-4"},{id:"a beauty mark above the lip",label:"Beauty mark",card:"freckles-5"}],saying:"Describe it",refHint:"A clear, close photograph of it."},{id:"makeup",label:"Makeup",ask:"What makeup do they wear?",options:[{id:"natural, barely-there makeup",label:"Natural",card:"makeup-1"},{id:"black winged eyeliner",label:"Winged liner",card:"makeup-2"},{id:"a soft smoky eye",label:"Smoky eye",card:"makeup-3"},{id:"a bold red lip",label:"Bold red lip",card:"makeup-4"},{id:"soft glamorous makeup with a warm shimmer",label:"Soft glam",card:"makeup-5"},{id:"strong defined brows and a nude lip",label:"Strong brows",card:"makeup-6"}],saying:"Describe the makeup",refHint:"A clear face photograph showing the look."},{id:"scar",label:"Scar",ask:"What scar do they have?",options:[{id:"a thin pale scar through one eyebrow",label:"Through an eyebrow",card:"scar-1"},{id:"a small pale scar on one cheek",label:"On a cheek",card:"scar-2"},{id:"a small scar on the chin",label:"On the chin",card:"scar-3"},{id:"a fine scar along the jaw",label:"Along the jaw",card:"scar-4"},{id:"a small scar beside one eye",label:"Beside an eye",card:"scar-5"},{id:"a faded scar across the bridge of the nose",label:"Across the nose",card:"scar-6"}],saying:"Describe the scar",refHint:"A clear, close photograph of it."},{id:"piercing",label:"Piercing",ask:"What piercing do they wear?",options:[{id:"a small silver nose stud",label:"Nose stud",card:"piercing-1"},{id:"a silver septum ring",label:"Septum ring",card:"piercing-2"},{id:"a small silver hoop through one eyebrow",label:"Eyebrow hoop",card:"piercing-3"},{id:"several small silver hoops in one ear",label:"Ear hoops",card:"piercing-4"},{id:"a small silver lip ring",label:"Lip ring",card:"piercing-5"},{id:"a row of small silver studs up one ear",label:"Ear studs",card:"piercing-6"}],saying:"Describe the piercing",refHint:"A clear photograph of the jewellery."},{id:"tattoo",label:"Tattoo",ask:"What is their tattoo?",options:[{id:"a fine-line botanical tattoo",label:"Fine line",card:"tattoo-1"},{id:"a small geometric line tattoo",label:"Geometric",card:"tattoo-2"},{id:"a floral tattoo in soft grey shading",label:"Floral",card:"tattoo-3"},{id:"a bold traditional red rose tattoo with heavy black linework",label:"Traditional",card:"tattoo-4"},{id:"a solid blackwork snake tattoo in heavy black ink",label:"Blackwork",card:"tattoo-5"},{id:"a small script tattoo in thin lettering",label:"Script",card:"tattoo-6"}],saying:"Describe the tattoo",refHint:"A clear photograph of the design itself.",where:{ask:"And where is it?",options:[{id:"on their right forearm",label:"Right forearm"},{id:"on their left forearm",label:"Left forearm"},{id:"on their right upper arm",label:"Right upper arm"},{id:"on their left upper arm",label:"Left upper arm"},{id:"on one shoulder",label:"Shoulder"},{id:"on the side of their neck",label:"Neck"},{id:"on their hand",label:"Hand"},{id:"on their back",label:"Back"}]}},{id:"prosthetic",label:"Prosthetic limb",ask:"What does their limb look like?",options:[{id:"a matte black mechanical prosthetic limb with dark articulated joints",label:"Matte black",card:"prosthetic-1"},{id:"a brushed steel mechanical prosthetic limb with dark articulated joints",label:"Brushed steel",card:"prosthetic-2"},{id:"a woven carbon fibre mechanical prosthetic limb with dark articulated joints",label:"Carbon fibre",card:"prosthetic-3"},{id:"a skin-tone mechanical prosthetic limb with dark articulated joints",label:"Skin tone",card:"prosthetic-4"},{id:"a glossy bright red mechanical prosthetic limb with dark articulated joints",label:"Red",card:"prosthetic-5"},{id:"a matte white mechanical prosthetic limb with dark articulated joints",label:"Matte white",card:"prosthetic-6"}],saying:"Describe it",refHint:"A clear photograph showing its shape and finish.",where:{ask:"And which limb?",options:[{id:"in place of their left arm",label:"Left arm"},{id:"in place of their right arm",label:"Right arm"},{id:"in place of their left leg",label:"Left leg"},{id:"in place of their right leg",label:"Right leg"},{id:"in place of their left hand",label:"Left hand"},{id:"in place of their right hand",label:"Right hand"}]}}],Ha=e=>_d.find(t=>t.id===e),Uie=/\b(forearm|upper arm|arm|shoulder|neck|throat|hand|wrist|back|chest|ribs|thigh|leg|calf|ankle|foot|cheek|eyebrow|brow|chin|lip|nose|ear|temple|jaw|collarbone)\b/i;function LL(e){return Uie.test(e??"")}function Wie(e,t){var a,i,l;const n=((a=t.words)==null?void 0:a.trim())??"",r=((i=t.where)==null?void 0:i.trim())??"";return n?r&&!LL(n)?`${n} ${r}`:n:r?`${((l=Ha(e))==null?void 0:l.label.toLowerCase())??e} ${r}`:""}function a9(e,t){const n=(t??[]).filter(r=>/\b(left|right)\b/i.test(r.words)&&(e==="front"||!Kie.has(r.id)));if(n.length)return`Check the side: ${n.map(r=>r.words).join("; ")}. Facing you, their right is on your left.`}const Kie=new Set(["tattoo","prosthetic"]),b2=["who","age","heritage","skin","hair","length","facial","eyes","build","height"],Oc="either",Ic=e=>{var t,n;return[(e==null?void 0:e.pick)===Oc?"":(t=e==null?void 0:e.pick)==null?void 0:t.trim(),(n=e==null?void 0:e.words)==null?void 0:n.trim()].filter(Boolean).join(", ")},$L=e=>{var t;return!!(e!=null&&e.pick||(t=e==null?void 0:e.words)!=null&&t.trim())},x2=e=>{var t;return((t=e.source)==null?void 0:t.door)==="scratch"},sv=e=>{var t;return x2(e)&&((t=e.source)==null?void 0:t.via)==="taps"},k2=e=>{var t;return x2(e)&&((t=e.source)==null?void 0:t.via)!=="taps"},S2=e=>{var t;return((t=e.source)==null?void 0:t.door)==="photos"},Gie=/\b(slim|slender|athletic|average|fuller|curvy|broad|lean|muscular|petite|stocky|heavy|thin|plus.size)\b/i;function zy(e){const t=e.trim(),n=t.split(/\s+/).filter(Boolean).length,r=[];return Np.test(t)||r.push("who"),Iw.test(t)||r.push("age"),r.length&&!Gie.test(t)&&n<8&&r.push("build"),r}const Yie=(e,t)=>b2.every(n=>!_L(`look-${n}`,e,t)||e[`look-${n}`]!==void 0),TL=e=>k2(e)&&e.describe!==void 0&&zy(e.describe).length>0,qie=e=>k2(e)&&e.describe!==void 0&&(!TL(e)||e.gaps!==void 0),Xie=(e,t)=>{var n;return S2(e)&&!!t.draft&&t.draft.source==="photos"&&t.canGenerate&&t.draft.stage!=="analyzing"&&(e.traits!==void 0||!((n=t.draft.keep)!=null&&n.trim()))},DL=(e,t)=>sv(e)?Yie(e,t):k2(e)?qie(e):Xie(e,t),Qie=(e,t)=>x2(e)||S2(e)&&!!t.draft,HL=e=>t=>{var n;return!!((n=t.traits)!=null&&n.includes(e))},OL=e=>t=>$L(t[`trait-${e}`]),IL=e=>t=>{var n;return HL(e)(t)&&OL(e)(t)&&!!((n=Ha(e))!=null&&n.where)&&!LL(Ic(t[`trait-${e}`]))},zh=(e,t)=>Array.isArray(e)&&e.includes(t),Jie=(e,t)=>{var n;return DL(e,t)&&(((n=e.traits)==null?void 0:n.every(r=>OL(r)(e)&&(!IL(r)(e)||e[`trait-${r}-where`]!==void 0)))??!1)},ele=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),tle=(e,t)=>{var r;if(!S2(e)||!t.draft||t.draft.stage==="analyzing"||t.draft.views.portrait.status!=="empty")return!1;const n=((r=t.draft.analysis)==null?void 0:r.photos)??[];return n.length>0&&n.every(a=>a.usable===!1)},vi=[{id:"source",applies:()=>!0},{id:"photos",applies:S2},{id:"weakphotos",applies:tle},...b2.map(e=>({id:`look-${e}`,applies:e==="facial"?t=>{var n;return sv(t)&&((n=t["look-who"])==null?void 0:n.pick)!=="woman"}:sv})),{id:"describe",applies:k2},{id:"gaps",applies:TL,dependsOn:[{on:"describe"}]},{id:"traits",applies:Qie,ready:DL},..._d.flatMap(e=>[{id:`trait-${e.id}`,applies:HL(e.id),dependsOn:[{on:"traits",changed:(t,n)=>zh(t,e.id)!==zh(n,e.id)}]},{id:`trait-${e.id}-where`,applies:IL(e.id),dependsOn:[{on:`trait-${e.id}`,changed:(t,n)=>Ic(t)!==Ic(n)},{on:"traits",changed:(t,n)=>zh(t,e.id)!==zh(n,e.id)}]}]),{id:"keep",applies:x2,ready:Jie,optional:!0,sticky:!0}],FL=new Map(vi.map(e=>[e.id,e])),nle=vi.map(e=>e.id),Ef=e=>{const t=vi.findIndex(n=>n.id===e);return t<0?vi.length:t},rle=e=>FL.get(e);function _L(e,t,n){return rle(e).applies(t,n)}function VL(e,t,n){if(e==="photos")return!!n.draft&&n.draft.source==="photos";const r=t[e];return r===void 0?!1:dr(e)||ale(e)?$L(r):!0}function ZL(e,t){return vi.filter(n=>n.applies(e,t)&&VL(n.id,e,t)).map(n=>n.id)}function E2(e,t){var n;return((n=vi.find(r=>{var a;return!r.optional&&r.applies(e,t)&&(((a=r.ready)==null?void 0:a.call(r,e,t))??!0)&&!VL(r.id,e,t)}))==null?void 0:n.id)??null}function o9(e,t,n){const r={...e},a=new Set,i=new Set(Object.keys(t));for(const[u,f]of Object.entries(t))ele(e[u],f)&&(f===void 0?delete r[u]:r[u]=f,a.add(u));if(a.size){const u=vi.map(g=>g.id),f=Math.min(...[...a].map(g=>u.indexOf(g))),h=new Set(a),p=g=>(g.dependsOn??[]).some(m=>h.has(m.on));for(const g of vi)u.indexOf(g.id)<=f||i.has(g.id)||r[g.id]===void 0||g.sticky||p(g)||(delete r[g.id],a.add(g.id))}let l=!0;for(;l;){l=!1;for(const u of vi){if(r[u.id]===void 0)continue;(!i.has(u.id)&&(u.dependsOn??[]).some(h=>a.has(h.on)&&(h.changed?h.changed(e[h.on],r[h.on]):!0))||!u.applies(r,n))&&(delete r[u.id],a.add(u.id),l=!0)}}return r}function sle(e){const t={};for(const n of e.traits??[]){const r=e[`trait-${n}`];r&&(t[n]={words:Ic(r)||void 0,where:Ic(e[`trait-${n}-where`])||void 0,refs:r.refs.length?r.refs:void 0})}return t}function zL(e){const t={};for(const n of b2){const r=e[`look-${n}`];r!==void 0&&(t[n]=r)}return t}const BL=e=>_d.map(t=>t.id).filter(t=>e.includes(t)),dr=e=>e.startsWith("look-"),ale=e=>e.startsWith("trait-"),na=e=>FL.has(e);function fs(e){if(!e.startsWith("trait-"))return null;const t=e.endsWith("-where"),n=t?e.slice(6,-6):e.slice(6);return Ha(n)?{id:n,part:t?"where":"what"}:null}const ole=[{to:8,name:"red"},{to:16,name:"scarlet"},{to:30,name:"orange"},{to:36,name:"amber"},{to:46,name:"gold"},{to:64,name:"yellow"},{to:80,name:"lime"},{to:95,name:"yellow-green"},{to:158,name:"green"},{to:172,name:"sea green"},{to:183,name:"teal"},{to:196,name:"cyan"},{to:205,name:"sky blue"},{to:215,name:"azure"},{to:240,name:"blue"},{to:252,name:"indigo"},{to:268,name:"violet"},{to:285,name:"purple"},{to:300,name:"orchid"},{to:318,name:"magenta"},{to:330,name:"fuchsia"},{to:342,name:"pink"},{to:352,name:"rose"},{to:360,name:"red"}],ile=[{to:.05,name:"black"},{to:.16,name:"charcoal"},{to:.32,name:"dark grey"},{to:.62,name:"grey"},{to:.76,name:"light grey"},{to:.88,name:"silver"},{to:.96,name:"off-white"},{to:1.01,name:"white"}],lle=new Set(["black","charcoal","dark grey","grey","light grey","silver","off-white","white","dark brown","brown","chestnut","auburn","copper","tan","beige","cream","amber","gold","blonde"]),cle=e=>{const t=String(e??"").replace("#","").trim();return(t.length===3?t.split("").map(r=>r+r):[t.slice(0,2),t.slice(2,4),t.slice(4,6)]).map(r=>{const a=Number.parseInt(r,16);return Number.isFinite(a)?a:0})};function ule(e){const[t,n,r]=cle(e),a=t/255,i=n/255,l=r/255,u=Math.max(a,i,l),f=Math.min(a,i,l),h=(u+f)/2,p=u-f;if(p===0)return{h:0,s:0,l:h};const g=p/(1-Math.abs(2*h-1));return{h:((u===a?60*((i-l)/p%6):u===i?60*((l-a)/p+2):60*((a-i)/p+4))+360)%360,s:g,l:h}}const dle=e=>{var t;return((t=ole.find(n=>e<n.to))==null?void 0:t.name)??"red"};function fle(e,t,n){return e==="orange"||e==="amber"||e==="scarlet"?n<.2?"dark brown":n<.32?e==="scarlet"?"chestnut":"brown":n>=.86&&t<.6?"cream":n>=.72&&t<.6?"beige":n<.44&&t<.7?"brown":n<.62&&t<.55?"tan":null:(e==="gold"||e==="yellow")&&n<.42?"olive":(e==="indigo"||e==="violet"||e==="purple")&&n>=.72&&t<.7?"lavender":(e==="blue"||e==="azure"||e==="indigo")&&n<.22?"navy":e==="red"&&n<.34?t<.55?"burgundy":"maroon":e==="rose"&&n<.34?"burgundy":null}function hle(e){return e<.18?"deep":e<.34?"dark":e>=.88?"pale":e>=.74?"light":""}function UL(e){var u;const{h:t,s:n,l:r}=ule(e);if(n<.09){const f=((u=ile.find(h=>r<h.to))==null?void 0:u.name)??"grey";return{name:f,family:f,h:t,s:n,l:r}}const a=dle(t),i=fle(a,n,r);if(i){const f=r<.12?"deep":r>=.93?"pale":"";return{name:f?`${f} ${i}`:i,family:i,h:t,s:n,l:r}}const l=hle(r);return l?{name:`${l} ${a}`,family:a,h:t,s:n,l:r}:n<.22?{name:`muted ${a}`,family:a,h:t,s:n,l:r}:n>.85&&r>.4&&r<.65?{name:`vivid ${a}`,family:a,h:t,s:n,l:r}:{name:a,family:a,h:t,s:n,l:r}}function ple(e){const{family:t,h:n,s:r,l:a}=UL(e);return lle.has(t)?!0:n>=16&&n<=60&&a>=.7&&r<.7||r<.09}const By=[{id:"black",label:"Black",color:"#15120f"},{id:"dark brown",label:"Dark brown",color:"#3b2418"},{id:"brown",label:"Brown",color:"#6b4630"},{id:"auburn",label:"Auburn",color:"#8c3b26"},{id:"ginger",label:"Ginger",color:"#c2622a"},{id:"blonde",label:"Blonde",color:"#d8ac63"},{id:"platinum blonde",label:"Platinum",color:"#e9e1d0"},{id:"grey",label:"Grey",color:"#9b9b99"},{id:"white",label:"White",color:"#f0efed"}],WL=[{id:"buzzed",label:"Buzzed",card:"length-1"},{id:"cropped",label:"Cropped",card:"length-2"},{id:"short",label:"Short",card:"length-3"},{id:"chin-length",label:"Chin",card:"length-4"},{id:"shoulder-length",label:"Shoulder",card:"length-5"},{id:"long",label:"Long",card:"length-6"}],Uy=[{id:"porcelain",label:"Porcelain",color:"#f4e0d4"},{id:"fair",label:"Fair",color:"#edcdb6"},{id:"light olive",label:"Light olive",color:"#ddb894"},{id:"olive",label:"Olive",color:"#c2935f"},{id:"tan",label:"Tan",color:"#a9713f"},{id:"brown",label:"Brown",color:"#7c4f2c"},{id:"deep brown",label:"Deep brown",color:"#57351d"},{id:"deep",label:"Deep",color:"#3a2114"}],KL=[{id:"slight",label:"Slight",card:"build-1"},{id:"lean",label:"Lean",card:"build-2"},{id:"average",label:"Average",card:"build-3"},{id:"solid",label:"Solid",card:"build-4"},{id:"full",label:"Full",card:"build-5"}],mle=[{id:"East Asian",label:"East Asian"},{id:"South Asian",label:"South Asian"},{id:"Southeast Asian",label:"Southeast Asian"},{id:"Middle Eastern",label:"Middle Eastern"},{id:"Mediterranean",label:"Mediterranean"},{id:"North African",label:"North African"},{id:"West African",label:"West African"},{id:"East African",label:"East African"},{id:"Northern European",label:"Northern European"},{id:"Eastern European",label:"Eastern European"},{id:"Latin American",label:"Latin American"},{id:"Caribbean",label:"Caribbean"},{id:"mixed heritage",label:"Mixed"}],Wy=[{id:"dark brown",label:"Dark brown",color:"#3b2a1d"},{id:"brown",label:"Brown",color:"#6b4423"},{id:"hazel",label:"Hazel",color:"#8a7340"},{id:"amber",label:"Amber",color:"#b07d1a"},{id:"green",label:"Green",color:"#5b7a4b"},{id:"blue",label:"Blue",color:"#4a7ba7"},{id:"grey",label:"Grey",color:"#8b949c"}],GL=[{id:"clean-shaven",label:"Clean shaven",card:"facial-1"},{id:"light stubble",label:"Stubble",card:"facial-2"},{id:"a moustache",label:"Moustache",card:"facial-3"},{id:"a goatee",label:"Goatee",card:"facial-4"},{id:"a short beard",label:"Short beard",card:"facial-5"},{id:"a full beard",label:"Full beard",card:"facial-6"}],YL=[{id:"very short",label:"Very short",card:"height-1"},{id:"short",label:"Short",card:"height-2"},{id:"average height",label:"Average",card:"height-3"},{id:"tall",label:"Tall",card:"height-4"},{id:"very tall",label:"Very tall",card:"height-5"}],gle={},qL=[{id:"woman",label:"Woman"},{id:"man",label:"Man"},{id:"androgynous",label:"Androgynous"}],XL=["20s","30s","40s","50s","60+"].map(e=>({id:e,label:e})),h1={who:{row:{id:"who",label:"Who",options:qL},prompt:"Who are they?"},age:{row:{id:"age",label:"Age",options:XL},prompt:"Roughly how old?"},heritage:{row:{id:"heritage",label:"Heritage",options:mle},prompt:"Where are they from?"},skin:{row:{id:"skin",label:"Skin",options:Uy},prompt:"And their skin?"},eyes:{row:{id:"eyes",label:"Eyes",options:Wy},prompt:"What colour are their eyes?"},facial:{row:{id:"facial",label:"Facial hair",options:GL},prompt:"Any facial hair?"},hair:{row:{id:"hair",label:"Hair",options:By},prompt:"What colour is their hair?"},length:{row:{id:"length",label:"Length",options:WL},prompt:"And the length?"},build:{row:{id:"build",label:"Build",options:KL},prompt:"And their build?"},height:{row:{id:"height",label:"Height",options:YL},prompt:"And how tall?"}};b2.map(e=>h1[e]);const i9=new Set(["hair","skin","eyes"]),vle={who:"Who they are, in your words",age:"Their age, in words or a number",heritage:"Where they are from, in your words",hair:"Their hair colour, in words or a swatch",length:"Their cut, in your words",facial:"Their facial hair, in your words",eyes:"Their eye colour, in words or a swatch",skin:"Their skin, in words or a swatch",build:"Their build, in your words",height:"How tall they are, in your words"},wle=e=>e==="man"?"man":e==="woman"?"woman":"androgynous",yle=new Set(["length","height","build"]),ble=900;function Ky(e,t,n){const r=xle(e,t);if(r.far<ble)return r.id;const a=UL(e).name;return n==="hair"&&!ple(e)?`dyed ${a}`:a}function xle(e,t,n){const r=h=>{const p=h.replace("#","");return(p.length===3?p.split("").map(m=>m+m):[p.slice(0,2),p.slice(2,4),p.slice(4,6)]).map(m=>Number.parseInt(m,16)||0)},[a,i,l]=r(e);let u=t[0],f=Number.POSITIVE_INFINITY;for(const h of t){if(!h.color)continue;const[p,g,m]=r(h.color),w=(a-p)**2+(i-g)**2+(l-m)**2;w<f&&(f=w,u=h)}return{id:u.id,far:f}}const l9=e=>e==="skin"?Uy:e==="eyes"?Wy:By,hp=e=>e.charAt(0).toUpperCase()+e.slice(1);function QL(e){const t=H=>H!=null&&H.pick&&H.pick!==Oc?H.pick:"",n=(H,D,B)=>{var U;const V=t(H);return V?V.startsWith("#")?Ky(V,D,B):V:((U=H==null?void 0:H.words)==null?void 0:U.trim())??""},r=H=>{var D;return t(H)?((D=H==null?void 0:H.words)==null?void 0:D.trim())??"":""},a=(H,...D)=>[H,...D.filter(Boolean)].join(" "),i=(H,D,B)=>n(H,D,B).toLowerCase(),l={androgynous:"androgynous person",man:"man",woman:"woman"},u=i(e.who,[]),f=l[u]??u,p=[n(e.heritage,[]),f].filter(Boolean).join(" "),m=[p?/^(a|an|the)\s/i.test(p)?p:`${/^[aeiou]/i.test(p)?"an":"a"} ${p}`:"a person"],w=i(e.age,[]),y=w==="60+"?"in their 60s or older":/^\d{1,3}$/.test(w)?`aged ${w}`:`in their ${w}`;w&&m.push(a(y,r(e.age)));const b=[],k=i(e.length,WL),S=i(e.hair,By,"hair"),E=[k,S].filter(Boolean).join(" ");E&&b.push(a(`${E} hair`,r(e.length),r(e.hair)));const C=i(e.facial,GL);C&&b.push(a(C,r(e.facial)));const A=i(e.eyes,Wy);A&&b.push(a(`${A} eyes`,r(e.eyes)));const L=i(e.skin,Uy,"skin");L&&b.push(a(`${L} skin`,r(e.skin)));const T=i(e.height,YL),M=i(e.build,KL),j=T?a(gle[T]??T,r(e.height)):"",P=M?a(`${/^[aeiou]/.test(M)?"an":"a"} ${M} build`,r(e.build)):"",R=[j,P&&(j?`with ${P}`:P)].filter(Boolean).join(" ");return R&&b.push(R),b.length&&m.push(`with ${b.join(", ")}`),a(m.join(" "),r(e.who))}function kle(e,t){var i,l;const n=t.pick,r=n===Oc?"Either way":n!=null&&n.startsWith("#")?hp(Ky(n,e.options,e.id)):n?((i=e.options.find(u=>u.id===n))==null?void 0:i.label)??hp(n):"",a=((l=t.words)==null?void 0:l.trim())??"";return r?a?`${r}, ${a}`:r:hp(a)}function Sle(e){return hp(QL(e))}const Cf=e=>typeof e=="string"&&e.startsWith("aside:"),Ele=e=>e.slice(6),em={answers:{},revision:0,editing:null,saying:null,says:0,text:"",colour:null,composing:null,asides:[],unsure:null,extrasDeclined:!1,held:!1,uploading:0},Cle="That did not read as a description of someone.",JL=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function jle(e){if(!e||e==="name")return null;if(e==="keep")return"keep";const t=fs(e);return t&&t.part==="what"?`trait-${t.id}`:null}function c9(e,t){var r;const n=jle(t);return n?{id:n,refs:((r=e.answers[n])==null?void 0:r.refs)??[]}:null}function h6(e){const t=e.composing;if(!t)return e.answers;const n=e.answers[t.id];if(!n||JL(n.refs,t.refs))return e.answers;if(!Ic(n)&&!t.refs.length){const r={...e.answers};return delete r[t.id],r}return{...e.answers,[t.id]:{...n,refs:t.refs}}}function Ale(e,t){var r;if(!dr(t)&&!fs(t))return;const n=e.answers[t];if(n)return{saying:t,text:n.words??"",colour:(r=n.pick)!=null&&r.startsWith("#")?{step:t,hex:n.pick}:null}}function av(e,t,n,r){return e.filter(a=>!a.q||!na(a.q)?!0:!_L(a.q,t,n)||a.edit&&t[a.q]!==void 0?!1:r===void 0||Ef(a.q)<=r)}function Nle(e){const t=Object.keys(e).filter(n=>na(n));return t.length?Math.min(...t.map(Ef)):void 0}function e$(e,t){if(!e.some(r=>r.at===t.at))return t;let n=1;for(;e.some(r=>r.at===`${t.at}#${n}`);)n+=1;return{...t,at:`${t.at}#${n}`}}function p6(e,t){const n=e.unsure;if(!n)return e;const r=E2(e.answers,t),a=u=>u&&(u===r||na(u)&&e.answers[u]!==void 0)?u:null,i=e.asides.map(u=>u.q==="unsure"?{...u,q:a(n.q)}:u),l=e$(i,{said:n.said,reply:Cle,q:a(n.q),at:n.at});return{...e,unsure:null,asides:av([...i,l],e.answers,t)}}function Mle(e,t){var n,r,a;switch(t.type){case"answer":{const i=o9(e.answers,t.patch,t.ctx),l=!JL(i,e.answers),u=p6(e,t.ctx);return{...u,answers:i,revision:l?e.revision+1:e.revision,asides:av(u.asides,i,t.ctx,Nle(t.patch)),editing:null,saying:null,colour:null,composing:null,text:""}}case"edit":{const i=Cf(t.id)||t.id==="name"?void 0:Ale(e,t.id);return{...e,answers:h6(e),composing:Cf(t.id)?null:c9(e,t.id),editing:t.id,saying:(i==null?void 0:i.saying)??null,says:i?e.says+1:e.says,colour:(i==null?void 0:i.colour)??null,text:(i==null?void 0:i.text)??""}}case"amend-aside":{const i=e.asides.find(h=>h.at===t.at),l=i!=null&&i.q&&na(i.q)?i.q:null,u=l&&e.answers[l]!==void 0?o9(e.answers,{[l]:void 0},t.ctx):e.answers,f=av(e.asides.filter(h=>h.at<=t.at),u,t.ctx,l?Ef(l):void 0);return{...e,answers:u,revision:u===e.answers?e.revision:e.revision+1,editing:null,asides:f.map(h=>h.at===t.at?{...h,said:t.said,reply:t.reply,kind:t.kind,rev:(h.rev??0)+1}:h)}}case"drop-aside":return{...e,editing:null,asides:e.asides.filter(i=>i.at<t.at)};case"cancel-edit":return{...e,answers:h6(e),composing:null,editing:null,saying:null,colour:null,text:""};case"say":{const i=e.saying===t.id?null:t.id;return{...e,answers:h6(e),composing:c9(e,i),saying:i,says:e.says+1,colour:null,text:""}}case"text":return e.text===t.text?e:{...e,text:t.text};case"colour":return t.hex?t.step&&t.step!=="keep"?{...e,colour:{step:t.step,hex:t.hex}}:e:{...e,colour:null};case"aside":{if(!t.aside.said.trim()||!t.aside.reply.trim())return{...e,text:""};const l=!!t.aside.q&&na(t.aside.q)&&e.answers[t.aside.q]!==void 0?{...t.aside,after:!0}:t.aside;return{...e,asides:[...e.asides,e$(e.asides,l)],text:""}}case"unsure":return{...p6(e,t.ctx),unsure:t.unsure,text:""};case"settle-unsure":return p6(e,t.ctx);case"upload-begin":return{...e,uploading:e.uploading+1};case"upload-end":return{...e,uploading:Math.max(0,e.uploading-1)};case"uploaded":{if(((n=e.answers.source)==null?void 0:n.door)!=="photos")return e;const i=e.answers.photos??{hashes:[],attested:!1};return i.hashes.includes(t.hash)||i.hashes.length>=t.max?e:{...e,answers:{...e.answers,photos:{...i,hashes:[...i.hashes,t.hash]}},revision:e.revision+1}}case"remove-photo":{const i=e.answers.photos;if(!(i!=null&&i.hashes.includes(t.hash)))return e;const l=i.hashes.filter(u=>u!==t.hash);return{...e,answers:{...e.answers,photos:{hashes:l,attested:l.length?i.attested:!1}},revision:e.revision+1}}case"attest":{if(((r=e.answers.source)==null?void 0:r.door)!=="photos")return e;const i=e.answers.photos??{hashes:[],attested:!1};return i.attested===t.checked?e:{...e,answers:{...e.answers,photos:{...i,attested:t.checked}},revision:e.revision+1}}case"ref":{if(t.id!=="keep"){const u=t.id.slice(6);if(!((a=e.answers.traits)!=null&&a.includes(u)))return e}const i=e.answers[t.id]??{refs:[]},l=t.remove?i.refs.filter(u=>u!==t.hash):t.id==="keep"?[...i.refs.filter(u=>u!==t.hash),t.hash].slice(-4):[t.hash];return l.join()===i.refs.join()?e:{...e,answers:{...e.answers,[t.id]:{...i,refs:l}},revision:e.revision+1}}case"extras-declined":return{...e,extrasDeclined:!0};case"hold":return e.held===t.held?e:{...e,held:t.held};case"start-over":return{...em,revision:e.revision+1,text:t.text??""};case"restore":return{...em,answers:t.answers,revision:t.revision,asides:t.asides??[],extrasDeclined:!!t.extrasDeclined,held:!!t.held}}}function ov(e,t){return E2(e.answers,t)===null&&!e.editing&&!e.saying}const t$=5,n$=40;function Rle(e){return JSON.stringify({v:t$,answers:e.answers,revision:e.revision,asides:e.asides.slice(-n$),...e.extrasDeclined?{extrasDeclined:!0}:{},...e.held?{held:!0}:{}})}function Ple(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.said!="string"||typeof t.reply!="string"||typeof t.at!="string"||!t.said.trim()||!t.reply.trim())return null;const n=typeof t.q=="string"?t.q:null,r=typeof t.rev=="number"&&t.rev>0?t.rev:void 0,a=typeof t.kind=="string"?t.kind:void 0,i=t.after===!0?!0:void 0,l=t.edit===!0?!0:void 0;return{said:t.said,reply:t.reply,q:n,at:t.at,...r?{rev:r}:{},...a?{kind:a}:{},...i?{after:i}:{},...l?{edit:l}:{}}}function Lle(e){var r;if(dr(e))return h1[e.slice(5)].row.options;const t=fs(e),n=t&&Ha(t.id);return n?t.part==="where"?((r=n.where)==null?void 0:r.options)??[]:n.options:[]}function u9(e,t){return t===Oc||/^#[0-9a-f]{6}$/i.test(t)?{pick:t}:Lle(e).some(n=>n.id===t)?{pick:t}:{words:t}}function $le(e,t){if(e==="keep")return typeof t=="string"?{words:t,refs:[]}:t;if(typeof t=="string"&&(dr(e)||fs(e)))return u9(e,t);const n=fs(e);if((n==null?void 0:n.part)==="what"&&t&&typeof t=="object"){const r=t,a=Array.isArray(r.refs)?r.refs:[];return r.pick!==void 0||typeof r.words!="string"?{...r,refs:a}:{...u9(e,r.words),refs:a}}return t}function tm(e){if(!e)return null;try{const t=JSON.parse(e);if(t.v!==t$&&t.v!==4&&t.v!==3&&t.v!==2||!t.answers||typeof t.answers!="object")return null;const n={};for(const[a,i]of Object.entries(t.answers))na(a)&&(n[a]=$le(a,i));const r=(Array.isArray(t.asides)?t.asides:[]).map(Ple).filter(a=>a!==null).slice(-n$);return{answers:n,revision:typeof t.revision=="number"?t.revision:0,asides:r,...t.extrasDeclined===!0?{extrasDeclined:!0}:{},...t.held===!0?{held:!0}:{}}}catch{return null}}const Yn={source:"Who are we making? Describe someone new, or add photos of a real person.",describe:"Describe them. Age, hair, build, skin and presence all help; one or two sentences is enough.",lookHint:"Skip anything you would rather leave to us.",photos:"Add one clear photo of their face. Up to three more angles hold the likeness better.",weakPhotos:"I cannot read a face in any of those photos, so anything I draw now would be a stranger rather than them.",name:"What should we call them?",traits:"Anything else that is always true of them?",traitsPhotos:"Anything in these photos that is always true of them?",keep:"Anything else about them?",agree:"Here is the presenter, in full. Ready to draw?",noEngine:"Drawing a presenter needs image generation, which is not set up yet.",identity:e=>`Here is ${e==="them"?"the face":e}. Use this person to draw the rest from this face, or change something.`,change:"What should change?",landed:e=>`Here is the ${e}. Use it, or try again.`,extras:"Add back and profile views? Three more pictures, for shots from behind or in profile."},r$=e=>e==="photos"?"the photos":"the face",s$=[{id:"photos",label:"Add photos"},{id:"scratch",label:"Describe someone"}],Tle={photos:/\b(photos?|pictures?|pics?|upload|images?|selfies?)\b/,scratch:/\b(scratch|describe|description|invent|make (someone|one|them) up|imagine|new person)\b/},Dle=[{label:"Late 30s, warm",text:"A woman in her late 30s, Mediterranean, olive skin, dark shoulder-length hair, slim build, warm and composed."},{label:"Early 20s, bright",text:"A man in his early 20s, fair skin with freckles, short blond hair, athletic build, bright and easygoing."},{label:"Mid 40s, quiet",text:"A man in his mid 40s, East Asian, close-cropped black hair, lean build, quietly confident."},{label:"Late 20s, easy",text:"A woman in her late 20s, deep brown skin, natural curls, tall and graceful, with an easy laugh."},{label:"Sixties, calm",text:"A woman in her early sixties, light skin, silver hair in a soft bob, broad build, calm and assured."}];function a$(e){const t=(e??"").replace(/\s*\(BYOK\)\s*$/i,"").trim();return`I have permission to use this person's likeness, and to send these photos ${t?/^codex/i.test(t)?"to OpenAI, through Codex, to draw them":`to ${t} to draw them`:"to the engine that draws them"}.`}a$(null);function Hle(e){const t=[];return e.over>0&&t.push(e.over===1?`That is one more than ${e.max} photos, so the last one was not added.`:`That is ${e.over} more than ${e.max} photos, so the last ${e.over} were not added.`),e.same>0&&t.push(e.same===1?"One of those is already here.":`${e.same} of those are already here.`),e.failed.length&&t.push(e.failed.join(" ")),t.length?t.join(" "):null}const Ole=(e,t)=>`${e} is larger than ${Math.round(t/1024/1024)}MB. Choose a smaller copy of it.`,Ile=e=>/\.hei[cf]$/i.test(e)?`${e} is a HEIC photo, which Scenri cannot read yet. Export it as JPEG and add that.`:`${e} could not be read as a photograph. JPEG, PNG and WebP all work.`,Fle="First portrait appears here",_le=(e,t)=>!e||e==="portrait"||!t?Fle:`The ${t} appears here`;function Vle(e,t=0){return e==="agree"?"Ready when you are":e==="source"?"Describe them, or add photos":e==="photos"?t?"Continue when the photos are in":"Add their photos":e==="retry"?"Try again from the conversation":e==="noengine"?"Set up image generation to draw them":"Keep describing your presenter"}const o$=e=>e===1?"One thing I cannot tell yet.":e===2?"Two things I cannot tell yet.":"A few things I cannot tell yet.";function Zle(e){return e===1?"One photo":`${e} photos`}function zle(e,t){return e===0?"The same person, face clear. Add the clearest one first.":e===1?"One photo works. Two to four, from different angles, hold the likeness better.":e<t?`${e} photos. More angles hold the likeness better.`:"Four angles. The reference set comes from these, the first one leading."}const Ble="That does not read as a description yet. Draw from it anyway, or describe them: age, hair, build, skin, presence.",Ule=e=>e===0?void 0:e===1?"Changing this asks the one after it again.":`Changing this asks the ${e} after it again.`,Wle="Change this answer?",Kle="The face is drawn again from the change, and the views built on it follow. Nothing already saved changes.",Gle="The views drawn from the photos are drawn again with the change. The photos themselves stay as they are.",Yle={source:"describe them in a sentence, or pick one",describe:"a few words about them is enough: age, hair, build, skin, presence",look:"tap one, or say it in your own words",name:"a name, so the rest of the conversation can use it",refine:"say what should change: hair, age or build change the person; anything else changes the view on the stage",detail:"tap one, or say what it looks like"},qle={who:{thing:"a person",how:"tap who they are"},age:{thing:"an age",how:"tap an age, or type one: Scenri draws adults"},hair:{thing:"a hair colour",how:"tap a colour, or say it: dark auburn, salt and pepper"},length:{thing:"a length",how:"tap a length, or say it: a chin-length bob"},skin:{thing:"a skin tone",how:"tap a tone, or say it: warm olive"},build:{thing:"a build",how:"tap a build, or say it: lean and tall"}},xs=e=>e.charAt(0).toUpperCase()+e.slice(1);function cc(e,t,n,r="",a,i=!1){const l=t==="look"?qle[a??""]??null:null,u=(l==null?void 0:l.how)??Yle[t],f=i?"":` ${xs(u)}.`;if(n>=2&&e!=="likeness"){const h=t==="look"||t==="detail"?"Or Skip it and we will choose.":"";return i?h||`${xs(u)}.`:`${xs(u)}.${h?` ${h}`:""}`}switch(e){case"likeness":return"Describe them by looks. Scenri does not draw a named person.";case"help":return l?`${xs(u)}.`:t==="refine"?"Select a view and say what is wrong with it, or say what should change about them: hair, age, build, skin.":t==="name"?"Any name will do; it can be changed later.":t==="detail"?`${xs(u)}.`:"Describe the person in a sentence: age, hair, build, skin, presence. Or add photos of a real person.";case"question":return l?`This step asks for ${l.thing}: ${u}.`:t==="refine"?`This is where the picture is changed: ${u}.`:t==="name"?`This is where they get a name: ${u}.`:t==="detail"?`This asks what the detail looks like: ${u}.`:`This is where the person is described: ${u}.`;case"nav":return"To begin again, use Start over at the top. Close keeps the draft where it is.";case"go":return t==="refine"?"Try again redraws it as it is; a sentence says what should change.":`Nothing to draw yet. ${xs(u)}.`;case"intent":return l?`${xs(u)}.`:t==="refine"?`Nothing changes until it is said what: ${u}.`:`That is what we are here for. Who are they? ${xs(u)}.`;case"nonsense":return l?`That is not ${l.thing}.${f}`:t==="name"?`That is not a name. ${xs(u)}.`:t==="refine"?`That does not say what should change. ${xs(u)}.`:t==="detail"?`That does not say what it looks like. ${xs(u)}.`:`That does not describe anyone. ${xs(u)}.`;case"greeting":return n?`Still here.${f}`:/^(hi|hello|hey|heya|hiya|yo|hola|shalom|good)\b/i.test(r.trim())?`Hi.${f}`:`${xs(u)}.`;case"ack":return n?`Still here.${f}`:i?"Go ahead.":`Go ahead: ${u}.`;case"vague":return n?`Still here. ${xs(u)}.`:`${xs(u)}.`}}const Xle=e=>e.trim().replace(/[.\s]+$/,""),Gy=e=>e?e==="portrait"?"Everything else you had is kept.":"The face and everything else you had are kept.":"Everything you had is kept.";function C2(e,t,n=Gy(null)){const r=co(t);if(r.kind==="unknown")return{text:`${e}: ${Xle(t)}. ${n}`};const a=r.remedy??(r.retryable?void 0:{label:"Providers",opens:"engines"});return{text:`${e}. ${r.fix?`${r.title} ${r.fix}`:r.title}`,remedy:a}}const iv=e=>e&&aM.includes(e)?[{id:"skip-extras",label:"Not now"}]:[];function i$(e,t=[]){return{id:"retry",kind:"confirm",tone:"alert",prompt:e.text,options:[...e.remedy?[{id:`remedy:${e.remedy.opens}`,label:e.remedy.label}]:[],{id:"retry",label:"Retry"},...t]}}function Bh(e,t){const n=e==="portrait"?"face":xn[e];return t==="cancelled"?{id:"retry",kind:"confirm",quiet:!0,prompt:`Stopped drawing the ${n}. Nothing finished was touched.`,options:[{id:"retry",label:"Draw it again"},...iv(e)]}:i$(C2(`The ${n} could not be drawn`,t,Gy(e)),iv(e))}function Qle(e){var r;const t=(((r=e.analysis)==null?void 0:r.suitableCategories)??[]).filter(Boolean);return t.length?` Filed under ${t.length===1?t[0]:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}; that can change on their page.`:""}function Jle(e){if(!e)return"";const t=[...e.asks??[],...e.results??[],...e.decisions??[]].map(n=>n.at);return t.length?t.reduce((n,r)=>r>n?r:n):""}const ece=e=>e.charAt(0).toUpperCase()+e.slice(1);function tce({draft:e,ui:t,afterCoverage:n,asides:r,openId:a,placed:i}){var J;const l=[],u=(te,X,ae)=>l.push({kind:"scenri",id:te,text:X,tone:ae}),f=te=>l.push({kind:"question",question:te}),h=((J=e.name)==null?void 0:J.trim())??"",p=h||"them",g=()=>{h&&(l.push({kind:"scenri",id:"asked-name",text:Yn.name,quiet:!0}),l.push({kind:"you",id:"name",text:h,editable:!0,editing:t.editingName||void 0}))},m=()=>f({id:"name",kind:"text",prompt:Yn.name}),w=(te,X=[])=>t.failedView?Bh(t.failedView,te):i$(C2("That did not go through",te),X),y=()=>{h||m()};if(e.stage==="analyzing")return u("reading",`Reading ${r$(e.source)}.`),h?g():m(),l;const b=uq(e);b&&u("coverage",b.text,b.tone),l.push(...n);const k=e.views.portrait,S=e.activeView,E=e.asks??[],C=E[E.length-1],A=C?e.views[C.view]:null,L=!!C&&!!A&&(A.status==="generating"&&e.activeView===C.view||A.status==="candidate"&&A.adjustment===C.text||!!A.error),T=te=>te==="portrait"&&!fi(e)?Yn.identity(p):Yn.change,M=(e.results??[]).filter(te=>te.how!=="restored"),j=e.decisions??[],P=!e.activeView&&e.stage==="idle",R=new Map,H=new Map,D=new Map;for(const te of M){const X=`${te.view}:${te.hash}`;if(D.set(X,te),R.has(X))continue;const ae=(H.get(te.view)??0)+1;H.set(te.view,ae),R.set(X,ae)}const B=te=>R.get(`${te.view}:${te.hash}`)??1,V=(te,X)=>{const ae=B(te),Le=e.views[te.view].hash===te.hash,ce=(H.get(te.view)??0)>1;return{kind:"scenri",id:X,text:`Here is ${xn[te.view]} ${ae}.`,thumb:te.hash,view:te.view,label:`${$c[te.view]} ${ae}`,current:ce&&Le&&D.get(`${te.view}:${te.hash}`)===te,restore:P&&!Le&&!Fw(e,te.view)?{view:te.view,hash:te.hash}:void 0}},U=new Set,K=new Map(E.map(te=>{const X=M.find(ae=>!U.has(ae)&&ae.how==="drawn"&&ae.view===te.view&&ae.ask===te.text&&ae.at>=te.at);return X&&U.add(X),[te,X]})),O=new Map;for(const te of j)te.what==="use"&&!O.has(te.view)&&O.set(te.view,te);const F=te=>te==="portrait"?`Here is ${p} with the change. Use this, or keep the previous one. Using it redraws the views built on the face.`:`Redrew the ${xn[te]}. Use it, or keep the previous one.`,I=te=>{const X=te===O.get(te.view),ae=te.view==="portrait"&&X,Le=te.what==="again"?"Try again":te.what==="keep"?"Keep previous":ae?"Use this person":te.view==="portrait"?"Use this":"Use it";return[{kind:"scenri",id:`asked-decided-${te.at}`,text:ae?Yn.identity(p):X?Yn.landed(xn[te.view]):F(te.view),quiet:!0},{kind:"you",id:`decided-${te.at}`,text:Le,editable:!1}]},G=()=>{const te=L?E.slice(0,-1):E,X=Jle(e),ae=r.filter(Se=>!i.has(Se)&&(Se.q!==a||Se.at<=X));for(const Se of ae)i.add(Se);const Le=M.find(Se=>aM.includes(Se.view)),ce=[...te.map(Se=>{const Ze=K.get(Se);return{at:Se.at,turns:[{kind:"scenri",id:`asked-ask-${Se.at}`,text:T(Se.view),quiet:!0},{kind:"you",id:`ask-${Se.at}`,text:Se.text,editable:!1},...Ze?[V(Ze,`redrew-${Se.at}`)]:[]]}}),...M.filter(Se=>!U.has(Se)).map(Se=>({at:Se.at,turns:[V(Se,`result-${Se.at}`)]})),...j.map(Se=>({at:Se.at,turns:I(Se)})),...ae.map(Se=>({at:Se.at,turns:Ei(Se)})),...fi(e)&&(e.extras||t.extrasDeclined)?[{at:Le?Le.at.slice(0,-1):"~",turns:[{kind:"scenri",id:"asked-extras",text:Yn.extras,quiet:!0},{kind:"you",id:"extras",text:e.extras?"Add them":"Not now",editable:!1}]}]:[]];ce.sort((Se,Ze)=>Se.at<Ze.at?-1:Se.at>Ze.at?1:0);for(const Se of ce)l.push(...Se.turns)},z=()=>{!L||!C||(l.push({kind:"scenri",id:`asked-ask-${C.at}`,text:T(C.view),quiet:!0}),l.push({kind:"you",id:`ask-${C.at}`,text:C.text,editable:!1}))};if(!fi(e)){const te=k.status==="generating"||S==="portrait"&&k.status!=="candidate";return te&&!E.length?(u("drawing-face","Drawing their face."),h?g():m(),l):(g(),G(),te?(z(),u("drawing-face",L?"Adjusting the face. Everything else stays.":"Drawing their face."),h||m(),l):t.failed?(y(),f(w(t.failed)),l):k.error?(y(),z(),f(Bh("portrait",k.error)),l):(k.status==="candidate"&&(y(),z(),f({id:"identity",kind:"confirm",prompt:L?"Adjusted. Use this person, or try again.":Yn.identity(p),hint:a9("portrait",e.keepItems),options:[{id:"use",label:"Use this person"},{id:"again",label:"Try again"}],describe:"Change something"})),l))}g(),G();const Y=Object.keys(e.views),Z=di(e),ee=[...Z].reverse().find(te=>x4.has(te)),pe=Z.find(te=>!x4.has(te)),se=Y.find(te=>e.views[te].status==="candidate"),xe=Z.find(te=>!!e.views[te].error);if(t.failed&&!S)return y(),f(w(t.failed,iv(Km(e)))),l;if(S)return z(),u(`drawing-${S}`,L&&(C==null?void 0:C.view)===S?`Redrawing the ${xn[S]}.`:S===ee&&!e.views[S].hash?`Drawing the ${xn[S]} from this face.`:S===pe&&!e.views[S].hash&&ee?`Building the rest of the set from the ${xn[ee]}.`:`Drawing the ${xn[S]}.`),h||m(),l;if(se){y(),z();const te=e.views[se],X=!!te.prior,ae=ce=>ce?R.get(`${se}:${ce}`)??0:0,Le=!!te.hash&&!!te.prior&&ae(te.hash)<ae(te.prior);if(te.error){const ce=Bh(se,te.error);u(`failed-${se}`,ce.prompt,te.error==="cancelled"?void 0:"alert")}return te.hash&&l.push({kind:"scenri",id:`candidate-${se}-${te.hash}`,text:Le?`Here is ${xn[se]} ${ae(te.hash)} again.`:te.error?`Here is the ${xn[se]} as it is.`:X?se==="portrait"?`Here is ${p} with the change.`:`Redrew the ${xn[se]}.`:`Here is the ${xn[se]}.`,thumb:te.hash,label:$c[se],view:se,current:!0}),f({id:se==="portrait"?"revision":"view-revision",kind:"confirm",prompt:X?se==="portrait"?`Use this, or keep the previous one.${dq(e,se)?" Using it redraws the views built on the face.":""}`:"Use it, or keep the previous one.":"Use it, or try again.",hint:se==="portrait"||se==="front"?a9(se,e.keepItems):void 0,options:[{id:"use",label:se==="portrait"?"Use this":"Use it"},...X?[{id:"keep",label:"Keep previous"}]:[],{id:"again",label:"Try again"}]}),l}return xe?(y(),z(),f(Bh(xe,e.views[xe].error??"")),l):KY(e)?!e.extras&&!t.extrasDeclined?(y(),u("set-ready","The set is ready. Select a view and say what is wrong to redraw it."),f({id:"extras",kind:"confirm",prompt:Yn.extras,noEnter:!0,options:[{id:"add",label:"Add them"},{id:"save",label:"Not now"}]}),l):h?(f({id:"save",kind:"confirm",prompt:`${ece(p)} is ready.${Qle(e)}`,options:[{id:"save",label:"Save presenter"}]}),l):(m(),l):(h||m(),l)}const nce={who:{label:"Who",options:qL},age:{label:"Age",options:XL},build:{label:"Build",options:["slender","average","athletic","fuller"].map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1)}))}},nm=e=>e.charAt(0).toUpperCase()+e.slice(1);function rce(e){return!e||e==="skipped"?"Draw as is":Object.values(e).map(t=>nm(t)).join(", ")}function sce(e){const t=e.map(n=>{var r;return((r=Ha(n))==null?void 0:r.label)??n});return t.length?t.length===1?t[0]:`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`:"Nothing distinctive"}const ace=e=>vne(e,s$,Tle),l$=(e,t)=>e.trim().slice(0,t).trimEnd(),oce=pP;function p1(e){return l$(ice(e),oce)}function ice(e){var a;if(((a=e.source)==null?void 0:a.via)==="taps"){const i=zL(e),l=Ic(i.who);return QL(l&&!ya(l)?{...i,who:void 0}:i)}const t=(e.describe??"").trim(),n=e.gaps&&e.gaps!=="skipped"?e.gaps:{},r=n.build?`${t.replace(/[.\s]+$/,"")}, ${n.build} build`:t;return oq({steer:n.who??null,age:n.age??null},r)}function lce(e){return j2(e).map(t=>t.words)}const cce=kd,uce=12;function j2(e){var i,l;const t=sle(e),n=(u,f,h)=>({id:u,words:l$(f,cce),...h!=null&&h.length?{refs:h.slice(0,4)}:{}}),r=[];for(const u of BL(e.traits??[])){const f=t[u],h=f?Wie(u,f):"";h&&r.push(n(u,h,f==null?void 0:f.refs))}const a=(((i=e.keep)==null?void 0:i.words)??"").trim();return a&&r.push(n("said",a,(l=e.keep)==null?void 0:l.refs)),r.slice(0,uce)}function d9(e){const t=lce(e);return t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function dce(e){const t=e.trim().replace(/[.\s]+$/,""),n=t.replace(/^(?:but|and|also|plus|though|although|however)\b[\s,]*/i,"");return n.replace(/^(?:he|she|they|it)\s+(?:has|have|had|has got|have got|is|are|wears?|carries)\s+/i,"")||n||t}function fce(e,t,n,r){const a=r.toLowerCase().split(/[^a-z0-9]+/).filter(l=>l.length>2);if(!a.length)return!0;const i=p1({...e,[t]:n}).toLowerCase();return a.every(l=>i.includes(l))}function hce(e){const t=tm(e.setup??null);return t&&Object.keys(t.answers).length?{answers:t.answers,asides:t.asides,...t.extrasDeclined?{extrasDeclined:t.extrasDeclined}:{}}:{answers:pce(e),asides:[]}}function pce(e){const t=tm(e.setup??null);return t&&Object.keys(t.answers).length?t.answers:e.source==="photos"?{source:{door:"photos",via:"taps"},photos:{hashes:e.sources??[],attested:!0},...f9(e)}:{source:{door:"scratch",via:"typed"},describe:e.direction??"",gaps:"skipped",traits:[],...f9(e)}}function f9(e){const t=e.keepItems??[];if(!t.length)return{};const n={},r=[];let a;for(const i of t){const l=_d.find(u=>u.id===i.id);if(l){r.push(l.id),n[`trait-${l.id}`]={words:i.words,refs:i.refs??[]};continue}a={words:[a==null?void 0:a.words,i.words].filter(Boolean).join(", "),refs:[...(a==null?void 0:a.refs)??[],...i.refs??[]]}}return n.traits=r,a&&(n.keep=a),n}const c$=(e,t,n)=>({draft:e?{source:e.source,stage:e.stage,keep:e.keep,views:{portrait:{status:e.views.portrait.status}},analysis:e.analysis?{photos:e.analysis.photos}:void 0}:null,canGenerate:t,...n?{engine:n}:{}});function mce(e,t,n){var a,i;if(e==="source")return t.kind==="choice"?{source:{door:t.id,via:"taps"}}:null;if(dr(e)){const l=(a=n[e])==null?void 0:a.words,u=l?{words:l}:{};return t.kind==="swatches"?{[e]:{pick:t.picks[e.slice(5)]??Object.values(t.picks)[0],...u}}:t.kind==="skip"?{[e]:{pick:Oc,...u}}:null}if(e==="gaps")return t.kind==="choices"?{gaps:t.picks}:t.kind==="skip"?{gaps:"skipped"}:null;if(e==="traits")return t.kind==="choices"?{traits:_d.map(l=>l.id).filter(l=>t.picks[l])}:t.kind==="skip"?{traits:[]}:null;const r=fs(e);if(r&&t.kind==="choice"){if(r.part==="where"){const u=(i=n[e])==null?void 0:i.words;return{[e]:{pick:t.id,...u?{words:u}:{}}}}const l=n[`trait-${r.id}`];return{[e]:{pick:t.id,...l!=null&&l.words?{words:l.words}:{},refs:(l==null?void 0:l.refs)??[]}}}return null}function gce(e,t){var r;return`the ${((r=Ha(e))==null?void 0:r.label.toLowerCase())??"detail"} in the attached ${t===1?"picture":"pictures"}`}const h9="A scar, a ring, anything we missed",vce=new Set(["describe","keep"]),wce=new Set(["likeness","help","question","greeting","ack","nav","intent","go","nonsense"]);function p9(e,t){const n=(t==null?void 0:t.trim())??"";return e?n?`${e}, ${n}`:e:nm(n)}const yce=/^(?:but|and|though|although|only|just|except(?: that)?|with|without|plus)\s+/i,m9=e=>yce.test(e.trim());function m6(e){return e.trim().replace(/[.\s]+$/,"").replace(/^(?:but|and|though|although|only|just|except(?: that)?)\s+/i,"").trim()}function jf(e,t){if(!e)return!1;if(vce.has(e))return!0;if(!dr(e)&&!fs(e))return!1;const n=t[e];return!!n&&!n.pick&&!!n.words}function Uh(e,t,n){const r=t.trim();return r?e==="look-age"&&eq(r)?null:e!=="look-who"&&(dr(e)||e.startsWith("trait-"))&&XY(r)?"nonsense":dr(e)||e.startsWith("trait-")||e==="keep"?xce(r,n):e==="describe"||e==="source"?ai(r,n):null:"vague"}function g6(e,t,n){if(e&&dr(e))return"look";if(e==="keep"||e!=null&&e.startsWith("trait-"))return"detail";const r=e??t;if(r&&dr(r))return"look";if(r!=null&&r.startsWith("trait-"))return"detail";switch(r){case"source":return"source";case"describe":case"gaps":return"describe";case"name":return"name";case"traits":return"detail";default:return n?"refine":"describe"}}const g9=new Set(["who","age","hair","colour","color","length","cut","skin","build","body","name","look","style","face","person","presenter","glasses","scar","scars","tattoo","piercing","makeup","freckles","prosthetic"]),bce=/^[a-z]{1,10}\d+$/i,xce=(e,t)=>{const n=e.trim(),r=n.toLowerCase().replace(/[^a-z ]/g,"");if(g9.has(r)||g9.has(r.replace(/^(the|their|its|his|her)\s+/,"")))return"nonsense";const a=n.split(/\s+/).filter(Boolean);if(a.length<=2&&a.some(l=>bce.test(l)))return"nonsense";const i=ai(e,t);return i&&wce.has(i)?i:null};function kce(e,t){return e==="name"?"metadata":t?e==="source"||e==="photos"?"start-over":"redraw":"plain"}function v9(e,t,n,r){var f,h,p,g,m,w,y,b,k;const a=t.answers,i=r?{reopened:!0,cost:Ule(ZL(a,n).filter(S=>S!=="keep"&&Ef(S)>Ef(e)).length)}:{};switch(e){case"source":return{id:e,kind:"choice",prompt:Yn.source,options:s$,given:(f=a.source)==null?void 0:f.door,...i};case"weakphotos":return{id:e,kind:"confirm",prompt:Yn.weakPhotos,noEnter:!0,options:[{id:"again",label:"Use different photos"},{id:"anyway",label:"Draw from these anyway"}]};case"photos":{const S=a.photos??{hashes:[],attested:!1};return{id:e,kind:"photos",prompt:Yn.photos,hint:zle(S.hashes.length,B0),hashes:S.hashes,max:B0,busy:t.uploading>0,attest:{text:a$(n.engine),checked:S.attested},submit:"Continue",back:"Describe someone instead"}}case"describe":return{id:e,kind:"text",prompt:Yn.describe,starters:Dle};case"gaps":{const S=zy(a.describe??"");return{id:e,kind:"choice",prompt:o$(S.length),groups:S.map(E=>({id:E,...nce[E]})),submit:"Continue",skip:"Skip, draw as is",given:a.gaps&&a.gaps!=="skipped"?a.gaps:void 0,...i}}case"traits":{const S=((h=a.source)==null?void 0:h.door)==="photos";return{id:e,kind:"choice",prompt:S?Yn.traitsPhotos:Yn.traits,multi:!0,options:_d.map(E=>({id:E.id,label:E.label})),submit:"Continue",skip:S?"Nothing to add":"Nothing else",given:a.traits,...i}}case"keep":return{id:e,kind:"text",prompt:Yn.keep}}if(dr(e)){const S=e.slice(5),{row:E,prompt:C}=h1[S],A=wle((p=a["look-who"])==null?void 0:p.pick),L=yle.has(S)?{...E,options:E.options.map(T=>T.card?{...T,card:`${T.card}-${A}`}:T)}:E;return{id:e,kind:"swatches",prompt:C,hint:S==="who"?Yn.lookHint:void 0,row:L,skip:"Skip",describe:S==="who"?"Describe them instead":void 0,saying:t.saying===e,given:((g=a[e])==null?void 0:g.pick)===Oc||(m=a[e])==null?void 0:m.pick,skipped:((w=a[e])==null?void 0:w.pick)===Oc,note:(y=a[e])==null?void 0:y.words,...i}}const l=fs(e),u=l?Ha(l.id):void 0;if(l&&u&&l.part==="where"&&u.where)return{id:e,kind:"choice",prompt:u.where.ask,options:u.where.options.map(S=>({id:S.id,label:S.label})),saying:t.saying===e,given:(b=a[e])==null?void 0:b.pick,note:(k=a[e])==null?void 0:k.words,...i};if(l&&u){const S=a[`trait-${l.id}`];return{id:e,kind:"choice",prompt:u.ask,hint:u.hint,options:u.options.map(E=>({id:E.id,label:E.label,card:E.card})),attach:S!=null&&S.refs.length?"Replace the reference":"Add a reference",saying:t.saying===e,given:S==null?void 0:S.pick,note:S==null?void 0:S.words,...i}}return{id:e,kind:"text",prompt:""}}function v6(e,t){var a,i,l;switch(e){case"source":return Yn.source;case"photos":return Yn.photos;case"describe":return((a=t.source)==null?void 0:a.via)==="typed"?Yn.source:Yn.describe;case"gaps":return o$(zy(t.describe??"").length);case"traits":return((i=t.source)==null?void 0:i.door)==="photos"?Yn.traitsPhotos:Yn.traits;case"keep":return Yn.keep}if(dr(e))return h1[e.slice(5)].prompt;const n=fs(e),r=n?Ha(n.id):void 0;return!n||!r?"":n.part==="where"?((l=r.where)==null?void 0:l.ask)??"":r.ask}function w9(e,t,n){var u,f,h,p,g,m,w;switch(e){case"source":return{text:((u=t.source)==null?void 0:u.door)==="photos"?"Add photos":"Describe someone"};case"photos":{const y=(n==null?void 0:n.sources)??((f=t.photos)==null?void 0:f.hashes)??[];return{text:Zle(y.length),photos:y}}case"describe":return{text:(t.describe??"").trim()};case"gaps":return{text:rce(t.gaps)};case"traits":return{text:sce(BL(t.traits??[]))};case"keep":return{text:(((h=t.keep)==null?void 0:h.words)??"").trim(),photos:(p=t.keep)==null?void 0:p.refs}}if(dr(e)){const y=e.slice(5);return{text:kle(h1[y].row,t[e]??{})}}const r=fs(e),a=r?Ha(r.id):void 0;if(!r||!a)return{text:""};if(r.part==="where"){const y=t[e]??{},b=y.pick?((m=(g=a.where)==null?void 0:g.options.find(k=>k.id===y.pick))==null?void 0:m.label)??nm(y.pick):"";return{text:p9(b,y.words)}}const i=t[`trait-${r.id}`],l=i!=null&&i.pick?((w=a.options.find(y=>y.id===i.pick))==null?void 0:w.label)??nm(i.pick):"";return{text:p9(l,i==null?void 0:i.words),photos:i!=null&&i.refs.length?i.refs:void 0}}function Sce(e){const t=e.state.asides,n=t.length?aP(y9(e,[],null)):null;return y9(e,t,n)}const u$=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,rm=(e,t)=>Cf(e.editing)&&Ele(e.editing)===t.at;function y9(e,t,n){const r=new Set,a=Ece(e,t,n,r),i=a.length&&a[a.length-1].kind==="question"?a.pop():null,l=t.filter(f=>!r.has(f)).sort(u$),u=e.state.unsure;for(const f of l)(!u||f.at<u.at)&&a.push(...Ei(f,rm(e.state,f)));if(i&&a.push(i),u){a.push({kind:"you",id:`unsure-${u.at}`,text:u.said,editable:!1}),a.push({kind:"question",question:{id:"unsure",kind:"confirm",quiet:!0,prompt:Ble,options:[{id:"use",label:"Use it anyway"}]}});for(const f of l)f.at>=u.at&&a.push(...Ei(f,rm(e.state,f)))}return a}function Ece({state:e,draft:t,canGenerate:n,engine:r,failed:a,failedView:i,awaiting:l},u,f,h){var P,R,H,D,B,V;const p=c$(t,n,r),g=e.answers,m=[{kind:"you",id:"intent",text:"Create a presenter"}],w=[],y=((P=g.source)==null?void 0:P.door)==="photos",b=(U,K,O=!1)=>{const F=u.filter(I=>!h.has(I)&&!!I.q&&I.q!==f&&K.includes(I.q)&&!!I.after===O).sort(u$);for(const I of F)h.add(I),U.push(...Ei(I,rm(e,I)))},k=U=>u.find(K=>K.edit&&K.q===U&&!h.has(K)),S=(U,K,O=!0)=>{var I;if(U.push({kind:"scenri",id:`asked-${K}`,text:v6(K,g),quiet:!0}),b(U,K==="describe"&&((I=g.source)==null?void 0:I.via)==="typed"?["source","describe"]:[K]),!O){const G=k(K);G&&(h.add(G),U.push({kind:"you",id:K,text:G.said}),U.push(...Ei(G,rm(e,G),!0))),b(U,[K],!0);return}const F=w9(K,g,t);U.push({kind:"you",id:K,text:F.text,photos:F.photos,editable:!0,editing:e.editing===K&&jf(K,g)||void 0}),b(U,[K],!0)},E=new Set(ZL(g,p)),C=nle.filter(U=>E.has(U)||u.some(K=>K.edit&&K.q===U));for(const U of C){const K=y&&t&&U!=="source"&&U!=="photos"?w:m;if(e.editing===U&&!jf(U,g)){K.push({kind:"scenri",id:`asked-${U}`,text:v6(U,g),quiet:!0}),b(K,[U]),K.push({kind:"question",question:v9(U,e,p,!0)}),b(K,[U],!0);continue}U==="source"&&((R=g.source)==null?void 0:R.via)==="typed"||S(K,U,E.has(U))}let A=null;const L=((H=g.source)==null?void 0:H.door)==="photos"&&e.held&&!t,T=!n&&(t?!!Ow(t):((D=g.source)==null?void 0:D.door)==="scratch"||L)&&!(t&&e.editing);if(L&&!n&&((B=g.photos)!=null&&B.hashes.length)&&(m.push({kind:"scenri",id:"asked-photos",text:v6("photos",g),quiet:!0}),m.push({kind:"you",id:"photos",...w9("photos",g,null)})),T)A={id:"noengine",kind:"confirm",quiet:!0,prompt:Yn.noEngine,options:[{id:"setup",label:"Set up"},...L?[{id:"change",label:"Change photos"}]:[]]};else{const U=E2(g,p);U?A=v9(U,e,p,!1):!t&&((V=g.source)==null?void 0:V.door)==="scratch"&&(g.source.via==="taps"||e.held?A={id:"agree",kind:"confirm",prompt:Yn.agree,quote:g.source.via==="taps"?`${Sle(zL(g))}${d9(g)?`, and always ${d9(g)}`:""}.`:p1(g),options:[{id:"draw",label:"Draw the presenter"}]}:a&&(A={id:"retry",kind:"confirm",tone:"alert",prompt:`That did not go through: ${a}. Nothing was drawn.`,options:[{id:"retry",label:"Retry"}]}))}if(l&&(A=null),!t)return A&&m.push({kind:"question",question:A}),m;const M=tce({draft:t,ui:{extrasDeclined:e.extrasDeclined,failed:a,failedView:i,editingName:e.editing==="name"},afterCoverage:w,asides:u,openId:f,placed:h}),j=[...m,...A?M.filter(U=>U.kind!=="question"):M];return A&&j.push({kind:"question",question:A}),j}function d$(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question;if(!Vp(n))return null}return null}function Cce(e,t,n){return e.some(r=>r.kind==="scenri"&&(r.id==="reading"||r.id.startsWith("drawing-")))?!1:(t==null?void 0:t.stage)==="analyzing"?`Reading ${r$(t.source)}`:t!=null&&t.activeView?"Drawing":n}const Qo={placeholder:"Nothing to type yet",label:"Message",action:"Send"},b9=(e,t)=>({placeholder:t?vle[e]??"In your words":i9.has(e)?"Tap a swatch above, or say the colour":"Pick one above, or describe it",label:"Describe it",action:"Send",color:i9.has(e)});function x9(e,t){const n=fs(e),r=n?Ha(n.id):void 0,a=(n==null?void 0:n.part)==="where"?"Where it is, in your words":(r==null?void 0:r.saying)??"What it looks like",i=(n==null?void 0:n.part)==="where"?"Pick one above, or say where it is":`Pick one above, or ${((r==null?void 0:r.saying)??"describe it").toLowerCase()}`;return{placeholder:t?a:i,label:(r==null?void 0:r.saying)??"Describe it",action:"Send"}}function f$(e,t,n){var a;const r=e.trim();return!!t&&!((a=t.name)!=null&&a.trim())&&n!=="name"&&/^[A-Z][a-z]+(?:\s[A-Z][a-z]+)?$/.test(r)&&!ya(r)}function jce(e,t,n,r){const a=Ace(e,t,n,r);return a.action==="Refine"&&!a.off&&f$(t.text,n,(e==null?void 0:e.id)??null)?{...a,label:"Their name",action:"Send"}:a}function Ace(e,t,n,r){if(t.editing!==null&&(t.editing==="name"||Cf(t.editing)||jf(t.editing,t.answers)))return{...Qo,off:"Finish the change above."};if(t.saying==="keep")return{placeholder:h9,label:"What should stay the same about them",action:"Send"};if(t.saying&&dr(t.saying))return b9(t.saying.slice(5),!0);if(t.saying)return x9(t.saying,!0);if(t.editing!==null)return{...Qo,off:"Finish the change above."};if(e){if(dr(e.id))return b9(e.id.slice(5),!1);if(e.id.startsWith("trait-"))return x9(e.id,!1);switch(e.id){case"source":return{placeholder:"Describe them, or choose above",label:"Describe them",action:"Send"};case"describe":case"unsure":return{placeholder:"Describe them",label:"Describe them",action:"Send"};case"name":return{placeholder:"Their name",label:"Their name",action:"Send"};case"identity":return{placeholder:"What should change? Shorter hair, older",label:"What should change",action:"Refine"};case"agree":return{placeholder:h9,label:"Anything else that is always true of them",action:"Send"};case"traits":return{placeholder:"Tap any above, or say it in your own words",label:"Anything else that is always true of them",action:"Send"};case"gaps":return{placeholder:"Pick one above, or say it in your own words",label:"Fill in what is missing",action:"Send"};case"photos":return{...Qo,off:"Add their photos above."};case"noengine":return{...Qo,off:"Set up image generation above."};case"retry":return{...Qo,off:"Retry above."}}}return n?n.stage==="analyzing"?{...Qo,off:`Reading ${n.source==="photos"?"the photos":"the face"}.`}:Tc(n)?fi(n)?{placeholder:k9(r,n),label:"What should change",action:"Refine",off:""}:{...Qo,off:""}:fi(n)?{placeholder:k9(r,n),label:"What should change",action:"Refine"}:{...Qo,off:"The face comes first."}:{...Qo,off:"Starting the draft."}}function k9(e,t){var r;const n=((r=t.name)==null?void 0:r.trim())||"them";return e==="portrait"?`What should change about ${n}?`:`Change this view: ${xn[e]}`}function S9(e,t){return e.saying?e.saying:t&&na(t.id)&&(t.id==="source"||t.id==="describe")||t&&na(t.id)&&(dr(t.id)||t.id.startsWith("trait-"))?t.id:(t==null?void 0:t.id)==="agree"?"keep":(t==null?void 0:t.id)==="name"?"name":null}const Nce=/\b(here|in this (view|one|picture|image|frame)|this (view|one|picture|image|frame))\b/i,Mce=/\b(looks? like|doesn'?t look|does not look|not (her|him|them)|drift(s|ed|ing)?|wrong|\boff\b|different person|someone else|regenerate|redraw|again)\b/i,Rce=/\b(dress|gown|outfit|wearing|wear|jacket|coat|suit|shirt|t-shirt|tee|hoodie|jeans|trousers|skirt|shoes|heels|sneakers|boots|hat|cap|sunglasses|jewell?ery|necklace|earrings|watch|holding|holds?|product|bottle|perfume|bag|handbag|phone|laptop|scene|beach|paris|london|tokyo|street|rooftop|office|kitchen|cafe|city|forest|desert|snow|rain|sunset|sunrise|golden hour|background|backdrop|lighting|campaign|shoot)\b/i,Pce=/\b(simpler|plainer|plain|neutral|cleaner|tidier)\b/i,Lce=/\b(outfit|clothes|clothing|top|wardrobe|wearing)\b/i;function h$(e,t,n){const r=e.trim();if(!r)return{blocked:"Say what should change."};if(Rce.test(r)&&!(Pce.test(r)&&Lce.test(r)))return{scope:"out-of-scope"};const a=uM.test(r),i=Mce.test(r),l=Nce.test(r),u=n.source==="photos";if(t==="portrait")return u?{blocked:"Their photos define who they are. Change a drawn view instead."}:{scope:"identity",view:"portrait"};if(a&&i&&!l)return u?{scope:"view",view:t}:{scope:"ambiguous"};if(a&&!l)return u?{blocked:"Their photos define who they are. Change a drawn view instead."}:{scope:"identity",view:"portrait"};const f=n.views[t];return f.origin==="photo"?{blocked:"Your photo stands as it is. Pick a drawn view to change."}:f.status!=="approved"&&f.status!=="candidate"?{blocked:`Nothing drawn for the ${xn[t]} yet.`}:{scope:"view",view:t}}const p$=e=>`Use Create for wardrobe, products and scenes. Edits here change who ${e} is.`;function $ce(e,t,n,r){const a=e.trim(),i=t==="portrait"?"Describe a change to who they are.":"Say what is wrong with this view, or describe a change to who they are.";if(!a){const u=n.views[t];return t!=="portrait"&&u.origin==="photo"?{chip:null,hint:"Your photo stands as it is. Pick a drawn view to change."}:{chip:null,hint:i}}const l=h$(a,t,n);return"blocked"in l?{chip:null,hint:l.blocked,tone:"alert"}:l.scope==="out-of-scope"?{chip:null,hint:p$(r),tone:"alert"}:l.scope==="ambiguous"?{chip:null,hint:"This reads as the view or the person. Send it and I will ask which."}:l.scope==="identity"?{chip:{view:"portrait",label:"Changing the person"},hint:"Changes the person. The other views are redrawn after you use it."}:{chip:{view:l.view,label:`Refining the ${xn[l.view]}`},hint:"Changes this view only. Hair, skin, age or build change the person."}}const Tce=e=>e.replace(/^asset:/,"");function Yy(e,t){if((e.identityEdits??[]).join(`
107
+ `)!==(t.identityEdits??[]).join(`
108
+ `))return!0;const r=t.shots.some(i=>i.angle==="portrait"&&i.file),a=new Map(t.shots.map((i,l)=>[!r&&l===0?"portrait":i.angle??"",Tce(i.file)]));for(const i of di(e)){const l=e.views[i];if(l.status==="candidate"||l.status==="stale"||l.prior)return!0;const u=a.get(i);if(l.status==="approved"&&l.hash&&l.hash!==u||l.status==="empty"&&u)return!0}return!1}function E9(e,t){var n,r;return!Yy(e,t)&&!e.activeView&&e.stage==="idle"&&!((n=e.asks)!=null&&n.length)&&(e.results??[]).every(a=>{var i;return((i=e.views[a.view])==null?void 0:i.hash)===a.hash})&&!((r=e.decisions)!=null&&r.length)}const C9=(e,t)=>t==="cancelled"?{text:`Stopped drawing the ${xn[e]}. Nothing finished was touched.`,stopped:!0}:{...C2(`The ${xn[e]} could not be drawn`,t,Gy(e)),stopped:!1},Dce=e=>WY.filter(t=>e.views[t].status==="empty"&&t!=="portrait"),Hce=e=>e.length<=2?e.map(t=>xn[t]).join(" and "):`${e.slice(0,-1).map(t=>xn[t]).join(", ")} and ${xn[e[e.length-1]]}`,Oce={building:!1,buildDeclined:!1,scopeAsk:null,failed:null,conflict:null},Ice="Say what should change: hair, age or build change the person; anything else changes the view on the stage.",Fce="Still here. Select a view and say what is wrong with it, or say what should change about them.";function _ce(e,t,n){const r=`select a view and say what is wrong with it, or say what should change about ${t}`;switch(e){case"likeness":return"Describe the change by looks. Scenri does not draw a named person.";case"help":case"question":return`This is where ${t} is changed: ${r}.`;case"nav":return"Discard changes is at the top, and Save changes keeps what you did.";case"go":case"intent":return`Nothing changes until it is said what: ${r}.`;case"nonsense":return`That does not say what should change. ${r.charAt(0).toUpperCase()}${r.slice(1)}.`;default:return n?Fce:Ice}}const hc={opening:e=>`What would you like to change about ${e}? Select a view to work on it, or describe a change to who they are.`,scope:"Apply this to:",change:"What should change?",saved:"Save changes when you are done."};function Vce(e){const t=e.ui.asides??[],n=t.length?aP(j9(e,[],null)):null;return j9(e,t,n)}function j9({draft:e,base:t,name:n,selected:r,canGenerate:a,ui:i},l,u){var te;const f=[{kind:"scenri",id:"opening",text:hc.opening(n)}],h=new Set,p=()=>{for(const X of l)h.has(X)||f.push(...Ei(X));return f},g=(X,ae,Le)=>{Le&&f.push({kind:"scenri",id:`asked-${X}`,text:Le}),f.push({kind:"you",id:X,text:ae,editable:!1})},m=(X,ae,Le)=>f.push({kind:"scenri",id:X,text:ae,tone:Le}),w=X=>f.push({kind:"question",question:X});if(!e)return p();const y=Dce(e),b=e.source!=="synthetic"||!!((te=e.direction)!=null&&te.trim()),k=di(e).some(X=>e.views[X].status==="candidate");if(y.length&&b&&!k&&!i.building&&!i.buildDeclined&&!Tc(e)&&a){const X=di(e).filter(ae=>e.views[ae].status==="approved").length;return w({id:"legacy",kind:"confirm",prompt:`${n} has ${X===1?"one reference":`${X} references`}. Build the ${Hce(y)} from it?`,options:[{id:"build",label:"Build them"},{id:"not",label:"Not now"}]}),p()}const S=di(e),E=e.activeView,C=S.find(X=>e.views[X].status==="candidate"),A=S.find(X=>!!e.views[X].error),L=(t==null?void 0:t.identityEdits)??[];(e.identityEdits??[]).filter(X=>!L.includes(X)).forEach((X,ae)=>{g(`edit-${ae}`,X,hc.change),m(`changed-${ae}`,`Changed ${n}. The views built on the face were redrawn.`)});const M=e.asks??[],j=M[M.length-1],P=j?e.views[j.view]:null,R=!!j&&!!P&&(P.status==="generating"&&e.activeView===j.view||P.status==="candidate"&&P.adjustment===j.text||!!P.error),H=new Set((e.identityEdits??[]).map(X=>X.toLowerCase())),D=(R?M.slice(0,-1):M).filter(X=>!(X.view==="portrait"&&H.has(X.text.replace(/\s+/g," ").toLowerCase()))),B=[...M,...e.results??[],...e.decisions??[]].map(X=>X.at).reduce((X,ae)=>ae>X?ae:X,""),V=l.filter(X=>!h.has(X)&&(X.q!==u||X.at<=B));for(const X of V)h.add(X);const U=(e.results??[]).filter(X=>X.how!=="restored"),K=!e.activeView&&e.stage==="idle",O=new Map,F=new Map,I=new Map;for(const X of U){const ae=`${X.view}:${X.hash}`;if(I.set(ae,X),O.has(ae))continue;const Le=(F.get(X.view)??0)+1;F.set(X.view,Le),O.set(ae,Le)}const G=X=>O.get(`${X.view}:${X.hash}`)??1,z=(X,ae)=>{const Le=G(X),ce=e.views[X.view].hash===X.hash,Se=(F.get(X.view)??0)>1;return{kind:"scenri",id:ae,text:`Here is ${xn[X.view]} ${Le}.`,thumb:X.hash,view:X.view,label:`${$c[X.view]} ${Le}`,current:Se&&ce&&I.get(`${X.view}:${X.hash}`)===X,restore:K&&!ce?{view:X.view,hash:X.hash}:void 0}},Y=new Set,Z=new Map(M.map(X=>{const ae=U.find(Le=>!Y.has(Le)&&Le.how==="drawn"&&Le.view===X.view&&Le.ask===X.text&&Le.at>=X.at);return ae&&Y.add(ae),[X,ae]})),ee=(e.decisions??[]).filter(X=>!(X.view==="portrait"&&X.what==="use")),pe=X=>[{kind:"scenri",id:`asked-decided-${X.at}`,text:X.view==="portrait"?`Here is ${n} with the change. Use this, or keep the previous one. Using it redraws the views built on the face.`:`Redrew the ${xn[X.view]}. Use it, or keep the previous one.`},{kind:"you",id:`decided-${X.at}`,text:X.what==="again"?"Try again":X.what==="keep"?"Keep previous":"Use it",editable:!1}],se=[...D.map(X=>{const ae=Z.get(X);return{at:X.at,turns:[{kind:"scenri",id:`asked-ask-${X.at}`,text:hc.change},{kind:"you",id:`ask-${X.at}`,text:X.text,editable:!1},...ae?[z(ae,`redrew-${X.at}`)]:[]]}}),...U.filter(X=>!Y.has(X)).map(X=>({at:X.at,turns:[z(X,`result-${X.at}`)]})),...ee.map(X=>({at:X.at,turns:pe(X)})),...V.map(X=>({at:X.at,turns:Ei(X)}))];se.sort((X,ae)=>X.at<ae.at?-1:X.at>ae.at?1:0);for(const X of se)f.push(...X.turns);if(i.scopeAsk)return g("scope-ask",i.scopeAsk.said),w({id:"scope",kind:"choice",prompt:hc.scope,options:[{id:"view",label:`This view (the ${xn[r]})`},{id:"identity",label:"The presenter"}]}),p();const xe=()=>{R&&j&&g(`ask-${j.at}`,j.text,hc.change)};if(E){const X=e.views[E];return xe(),m(`drawing-${E}`,R&&(j==null?void 0:j.view)===E?E==="portrait"?`Changing ${n}. Everything else stays.`:`Redrawing the ${xn[E]}.`:X.status==="stale"||S.some(ae=>e.views[ae].status==="stale")?`Redrawing the views built on the face. The ${xn[E]} first.`:`Drawing the ${xn[E]}.`),p()}if(C){xe();const X=e.views[C];if(X.error){const ae=C9(C,X.error);m(`failed-${C}`,ae.text,ae.stopped?void 0:"alert")}return X.hash&&f.push({kind:"scenri",id:`candidate-${C}-${X.hash}`,text:X.error?`Here is the ${xn[C]} as it is.`:C==="portrait"?`Here is ${n} with the change.`:`Redrew the ${xn[C]}.`,thumb:X.hash,label:$c[C],view:C,current:!0}),w({id:C==="portrait"?"revision":"view-revision",kind:"confirm",prompt:C==="portrait"?"Use this, or keep the previous one. Using it redraws the views built on the face.":"Use it, or keep the previous one.",options:[{id:"use",label:C==="portrait"?"Use this":"Use it"},{id:"keep",label:"Keep previous"},{id:"again",label:"Try again"}]}),p()}if(i.failed||A){xe();const X=A?C9(A,e.views[A].error??""):{...C2("That did not go through",i.failed??""),stopped:!1};return w({id:"retry",kind:"confirm",...X.stopped?{quiet:!0}:{tone:"alert"},prompt:X.text,options:[...X.remedy?[{id:`remedy:${X.remedy.opens}`,label:X.remedy.label}]:[],{id:"retry",label:X.stopped?"Draw it again":"Retry"}]}),p()}if(i.conflict)return w({id:"conflict",kind:"confirm",tone:"alert",prompt:`${n} changed in another tab. Reload to continue.`,options:[{id:"reload",label:"Reload"}]}),p();const J=S.find(X=>e.views[X].status==="stale");return J?(m(`drawing-${J}`,`Redrawing the views built on the face. The ${xn[J]} first.`),p()):(t&&Yy(e,t)&&w({id:"save",kind:"confirm",prompt:`The set is coherent. ${hc.saved}`,options:[{id:"save",label:"Save changes"}]}),p())}function Zce(e,t,n){return!(!n||t.id!==n||e&&e.id===t.id&&t.updatedAt<e.updatedAt)}function m$(e,t){const[n,r]=s.useState(null),[a,i]=s.useState(!1),[l,u]=s.useState(null),[f,h]=s.useState(null),[p,g]=s.useState(!1),{poke:m}=ia(),w=s.useRef(!0);s.useEffect(()=>(w.current=!0,()=>{w.current=!1}),[]);const y=s.useRef(t);y.current=t;const b=s.useCallback(K=>{w.current&&r(O=>Zce(O,K,y.current)?K:O)},[]),k=s.useRef(!1);s.useEffect(()=>{r(null),i(!1),u(null),k.current=!1,g(!1)},[t]);const S=s.useCallback(async()=>{if(!t)return;const K=t;try{b(await Ee.presenterDraft(e,K)),k.current&&w.current&&y.current===K&&(k.current=!1,u(null))}catch(O){if(!w.current||y.current!==K)return;/HTTP 404|not found/i.test(String((O==null?void 0:O.message)??O))?i(!0):(k.current=!0,h(null),u(String((O==null?void 0:O.message)??O)))}},[e,t,b]);s.useEffect(()=>{S()},[S]);const E=!!n&&(n.stage!=="idle"||!!n.activeView);s.useEffect(()=>{if(!E)return;const K=setInterval(()=>void S(),1500);return()=>clearInterval(K)},[E,S]);const C=s.useCallback(async(K,O=null)=>{const F=y.current;g(!0),u(null),k.current=!1;try{return b(await K()),m(),!0}catch(I){return!w.current||y.current!==F?!1:(I==null?void 0:I.status)===409?(S(),!1):(k.current=!1,h(O),u(String((I==null?void 0:I.message)??I)),!1)}finally{w.current&&g(!1)}},[b,S,m]),A=s.useCallback((K,O,F)=>C(async()=>(await Ee.generateDraftView(e,t??"",K,{...O?{adjustment:O}:{},...F?{decide:F}:{}})).draft,K),[C,e,t]),L=s.useCallback(K=>C(()=>Ee.approveDraftView(e,t??"",K)),[C,e,t]),T=s.useCallback(K=>C(()=>Ee.redoDraftView(e,t??"",K)),[C,e,t]),M=s.useRef(!1),j=s.useCallback(async K=>{if(M.current)return!1;M.current=!0;try{return await C(K)}finally{M.current=!1}},[C]),P=s.useCallback(K=>j(()=>Ee.revertDraftView(e,t??"",K)),[j,e,t]),[R,H]=s.useState(!1),D=s.useCallback(async()=>{H(!0);try{return await C(()=>Ee.stopDraft(e,t??""))}finally{w.current&&H(!1)}},[C,e,t]),B=s.useCallback((K,O)=>j(()=>Ee.restoreDraftView(e,t??"",K,O)),[j,e,t]),V=s.useCallback(K=>C(()=>Ee.updatePresenterDraft(e,t??"",K)),[C,e,t]),U=s.useCallback(()=>{k.current=!1,u(null)},[]);return{draft:n,gone:a,err:l,errView:f,busy:p,drawing:E,reload:S,generate:A,approve:L,redo:T,revert:P,stop:D,stopping:R,restore:B,update:V,clearErr:U}}function zce({presenterId:e,onLeave:t,caps:n}){var Ne,ie;const{brand:r}=cn(),{applyBrand:a,refreshBrands:i}=Nn(),l=_l(),u=Fl(),f=jr("setup").value,h=jr("settings").value,p=!!f||!!h,g=!!(n!=null&&n.canGenerate),[m,w]=s.useState(null),[y,b]=s.useState(null),[k,S]=s.useState(Oce),[E,C]=s.useState(""),[A,L]=s.useState(null),[T,M]=s.useState(!1),[j,P]=s.useState(null),[R,H]=s.useState(!1),[D,B]=s.useState(!1),V=s.useRef(new Set),U=(((Ne=r.json)==null?void 0:Ne.characters)??[]).find(q=>q.id===e),K=((ie=U==null?void 0:U.name)==null?void 0:ie.trim())||"them",O=U?{shots:U.shots??[],identityEdits:U.identityEdits??[]}:null;s.useEffect(()=>{let q=!0;return w(null),b(null),Ee.editPresenter(r.id,e).then(oe=>{q&&w(oe.id)}).catch(oe=>{q&&b(String((oe==null?void 0:oe.message)??oe))}),()=>{q=!1}},[r.id,e]);const F=m$(r.id,m),I=F.draft,G=I?`presenter-edit:${r.id}:${e}:${I.id}`:void 0,z=!0;s.useEffect(()=>{if(!I||F.busy||!g||F.err)return;const q=Ow(I);if(!q||I.views[q].status==="empty"&&!k.building)return;const oe=`${q}:${I.views[q].attempts}:${I.generations}:${I.views[q].status}`;V.current.has(oe)||(V.current.add(oe),F.generate(q,void 0,ei(q)))},[I,F.busy,F.generate,g,F.err,k.building]);const Y=I?iM(I,A):"portrait",Z=I?I.views[Y]:null,ee=!!I&&(I.activeView===Y||I.stage==="analyzing"),pe=!!I&&!I.activeView&&I.stage==="idle",se=F.err&&I&&!I.activeView?F.err:null,xe=s.useMemo(()=>Vce({draft:I,base:O,name:K,selected:Y,canGenerate:g,ui:{...k,failed:se}}),[I,O,K,Y,g,k,se]),J=d$(xe),te=!!I&&!!O&&Yy(I,O),X=!!I&&!!O&&E9(I,O),ae=s.useCallback(q=>{G&&dl(G),t(q)},[G,t]),Le=s.useCallback(async()=>{if(!(!I||R)){H(!0),P(null);try{const q=await Ee.savePresenterDraft(r.id,I.id);ae(q.presenter.id),a(q.brand)}catch(q){H(!1);const oe=String((q==null?void 0:q.message)??q);/changed elsewhere|HTTP 409/i.test(oe)?S(Re=>({...Re,conflict:oe})):P(oe)}}},[I,R,r.id,a,ae]),ce=s.useCallback(async()=>{B(!0);try{I&&await Ee.deletePresenterDraft(r.id,I.id)}catch{}ae(e)},[I,r.id,e,ae]),Se=s.useCallback(async()=>{if(!(!I||!O)){B(!0);try{E9(await Ee.presenterDraft(r.id,I.id),O)&&await Ee.deletePresenterDraft(r.id,I.id)}catch{}ae(e)}},[I,O,r.id,e,ae]),Ze=s.useCallback(async()=>{B(!0);try{const q=await Ee.revertPresenter(r.id,e);I&&await Ee.deletePresenterDraft(r.id,I.id).catch(()=>{}),ae(q.presenter.id),a(q.brand)}catch(q){B(!1),P(String((q==null?void 0:q.message)??q))}},[r.id,e,I,a,ae]),gt=s.useCallback((q,oe)=>{var Re;if(P(null),!!I)switch(q){case"legacy":if(oe.kind!=="confirm")return;S(ze=>({...ze,building:oe.id==="build",buildDeclined:oe.id!=="build"}));return;case"scope":{if(oe.kind!=="choice")return;const ze=((Re=k.scopeAsk)==null?void 0:Re.said)??"";S(Ye=>({...Ye,scopeAsk:null})),oe.id==="identity"?F.generate("portrait",ze):F.generate(Y,ze,ei(Y)),L(oe.id==="identity"?"portrait":Y);return}case"revision":case"view-revision":{if(oe.kind!=="confirm")return;const ze=Object.keys(I.views).find(Ye=>I.views[Ye].status==="candidate")??Y;oe.id==="use"&&F.approve(ze),oe.id==="keep"&&F.revert(ze),oe.id==="again"&&F.generate(ze,I.views[ze].adjustment,ei(ze)),M(!1);return}case"retry":{if(oe.kind==="confirm"&&oe.id.startsWith("remedy:")){const Ye=oe.id.slice(7);Ye==="setup"?l():u(Ye);return}if(F.err){F.clearErr(),V.current=new Set;return}const ze=Object.keys(I.views).find(Ye=>!!I.views[Ye].error);ze&&F.generate(ze,I.views[ze].adjustment,ei(ze));return}case"conflict":S(ze=>({...ze,conflict:null})),B(!0),Promise.all([i(),Ee.deletePresenterDraft(r.id,I.id).catch(()=>{})]).finally(()=>ae(e));return;case"save":Le();return}},[I,k.scopeAsk,F,Y,Le,i,ae,e,r.id,l,u]),Ke=s.useCallback(q=>{const oe=q.trim();if(!oe||!I)return!1;P(null);const Re=(J==null?void 0:J.id)??null,ze=Zp(),Ye=(ft,bt)=>({...ft,asides:[...ft.asides??[],{said:oe,reply:bt,q:Re,at:ze}]}),Ie=ft=>ft.scopeAsk?{...ft,scopeAsk:null,asides:[...ft.asides??[],{said:ft.scopeAsk.said,reply:hc.scope,q:"scope",at:ft.scopeAsk.at}]}:ft,De=ai(oe,ya);if(De&&De!=="vague")return S(ft=>Ye(ft,_ce(De,K,(ft.asides??[]).some(bt=>bt.q===Re)))),C(""),!0;if(!g)return P("Image generation is not set up, so nothing can be redrawn yet."),!1;const Ge=h$(oe,Y,I);return"blocked"in Ge?(P(Ge.blocked),!1):Ge.scope==="out-of-scope"?(S(ft=>Ye(Ie(ft),p$(K))),C(""),!0):Ge.scope==="ambiguous"?(S(ft=>({...Ie(ft),scopeAsk:{said:oe,at:ze}})),C(""),!0):(S(ft=>Ie(ft)),L(Ge.view),M(!1),F.generate(Ge.view,oe,Ge.scope==="view"?ei(Ge.view):void 0),C(""),!0)},[I,g,Y,F,J==null?void 0:J.id,K]),nt=I?$ce(E,Y,I,K):null,$e=nt?{chip:nt.chip?{label:nt.chip.label,thumb:I!=null&&I.views[nt.chip.view].hash?gn(I.views[nt.chip.view].hash,"micro"):void 0}:null,hint:nt.hint,tone:nt.tone}:null,ne=T&&(Z!=null&&Z.prior)?Z.prior:Z==null?void 0:Z.hash,Q=I?(J==null?void 0:J.id)==="legacy"?"Decide above.":(J==null?void 0:J.id)==="conflict"?"Reload to continue.":(J==null?void 0:J.id)==="scope"?"Pick above.":(J==null?void 0:J.id)==="retry"?"Retry above.":I.stage==="analyzing"?"Reading the photos.":I.activeView?"":null:null,We=!!I;return{d:I,record:U,name:K,view:Y,slot:Z,dirty:te,saving:R,leaving:D,openErr:y,canRevert:!!(U!=null&&U.revisionOf),discard:ce,revert:Ze,closeUntouched:X?()=>void Se():null,keepPrevious:Z&&Z.status==="approved"&&Z.prior&&!ee&&!(I!=null&&I.activeView)&&(I==null?void 0:I.stage)==="idle"?()=>void F.revert(Y):null,surface:{title:"Edit presenter",memoryKey:G,resumed:z,turns:xe,busy:F.busy||R||D||p,stage:I?{hash:ne,alt:`${$c[Y]}${(Z==null?void 0:Z.status)==="candidate"?", candidate":""}`,drawing:ee,since:fM(I),doing:hM(I),takes:Fw(I,Y)?[]:mM(I,Y),onTake:pe?q=>{F.busy||F.restore(Y,q)}:void 0,items:lM(I,Y),onPick:q=>{L(q),M(!1)},compare:Z&&Z.status==="candidate"&&Z.prior?{on:T,toggle:()=>M(q=>!q)}:void 0}:null,composer:We?{placeholder:Y==="portrait"?`What should change about ${K}?`:`Change this view: ${xn[Y]}`,label:"What should change",action:"Refine",scope:Q?null:$e,hint:null,why:Q??void 0,error:j,disabled:F.busy||R||D||!!Q,working:!!(I!=null&&I.activeView),onStop:I!=null&&I.activeView?()=>void F.stop():void 0,stopping:F.stopping,focusKey:`${(J==null?void 0:J.id)??"open"}:${(I==null?void 0:I.id)??""}`}:null,text:E,onText:C,onSend:Ke,onAnswer:gt,onRestore:(q,oe)=>{F.busy||(L(q),F.restore(q,oe))}},setupNeeded:g?null:l}}function Bce({onClose:e,...t}){const n=zce(t),r=o.jsxs(o.Fragment,{children:[n.canRevert&&o.jsx(Xn,{label:"Revert last change",tone:"quiet",title:"Revert the last saved change?",body:`${n.name} goes back to the pictures and the person before the last save. Shots already made keep what they were made with.`,busy:n.leaving,onConfirm:()=>void n.revert()}),n.dirty&&o.jsx(Xn,{label:"Discard changes",tone:"quiet",title:"Discard the changes?",body:"The views redrawn in this session are thrown away. The saved presenter stays as it was.",busy:n.leaving,onConfirm:()=>void n.discard()})]}),a=n.keepPrevious?o.jsxs("div",{className:"sc-pstudio-offer",children:[o.jsxs("span",{children:["Redrew the ",xn[n.view],"."]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:n.keepPrevious,disabled:n.surface.busy,children:"Keep previous"})]}):n.openErr?o.jsx("p",{className:"sc-newdlg-err",role:"alert",children:n.openErr}):null;return o.jsx(Zy,{surface:{...n.surface,headAction:r,dock:a},onClose:n.closeUntouched??e})}function Uce(){const{presenterId:e=""}=aa(),{brand:t}=cn(),n=Bn(),{caps:r}=ey();qc("Edit presenter");const a=s.useRef(!1);s.useEffect(()=>(a.current=!0,()=>{a.current=!1}),[]);const[i]=s.useState(()=>Yw(t,e)),l=s.useCallback(f=>{a.current&&n(Ra(t,f),{replace:!0})},[n,t]),u=s.useCallback(()=>n(Ra(t,e),{replace:!0}),[n,t,e]);return i!==e?o.jsx(Ja,{to:Zm(t,i),replace:!0}):o.jsx(Bce,{presenterId:e,onLeave:l,onClose:u,caps:r})}function Wce(e,t){return(t.source!=="synthetic"||(t.direction??"")===p1(e.answers))&&Kce(t.keepItems,j2(e.answers))}function Kce(e,t){const n=e??[];return n.length!==t.length?!1:t.every((r,a)=>{const i=n[a];return!i||i.id!==r.id||i.words!==r.words?!1:(i.refs??[]).every(l=>(r.refs??[]).includes(l))})}function Gce(e,t){return{...t.source==="synthetic"?{direction:p1(e.answers)}:{},keepItems:j2(e.answers)}}const Yce=e=>e.source==="photos"?e.views.front.hash?"front":null:e.views.portrait.hash?"portrait":null;function g$(e){if(!e.draftId)return!1;const t=e.draft;return t?e.seededFor!==t.id&&(!e.state.answers.source||!ov(e.state,e.ctx)):!0}function qce(e){const{state:t,draft:n,ctx:r}=e;if(e.busy||e.err)return[];if(n){if(g$(e))return[{kind:"seed",...hce(n)}];if(!ov(t,r))return[];const i=[];Wce(t,n)||i.push({kind:"sync",patch:Gce(t,n),redo:Yce(n)});const l=e.canDraw?Ow(n):null;return l&&i.push({kind:"draw",view:l,decide:ei(l)}),i}if(e.draftId)return[];if(!e.canDraw||!ov(t,r))return[];const a=t.answers.source;return(a==null?void 0:a.door)==="scratch"&&a.via!=="taps"&&!t.held?[{kind:"start"}]:[]}function Xce(e){for(const t of qce(e))if(!e.done.has(v$(t,e)))return t;return null}function v$(e,t){const n=t.draft;switch(e.kind){case"seed":return`seed:${n==null?void 0:n.id}`;case"start":return`start:${t.state.revision}`;case"sync":return`sync:${n==null?void 0:n.id}:${JSON.stringify(e.patch)}`;case"draw":{const r=n==null?void 0:n.views[e.view];return`draw:${n==null?void 0:n.id}:${e.view}:${(r==null?void 0:r.attempts)??0}:${(n==null?void 0:n.generations)??0}:${(r==null?void 0:r.status)??""}`}}}const Tu=(e,t)=>`scenri:presenter-setup:${e}:${t}`,sl={read(e){try{return sessionStorage.getItem(e)}catch{return null}},write(e,t){try{sessionStorage.setItem(e,t)}catch{}},remove(e){try{sessionStorage.removeItem(e)}catch{}}};function A9(e,t){let n=sl.read("scenri:tab");return n||(n=[...crypto.getRandomValues(new Uint8Array(6))].map(r=>r.toString(16).padStart(2,"0")).join(""),sl.write("scenri:tab",n)),`${n}:${e}:${t}`}function Qce(e,t){var r,a,i;const n=t==="keep"?"detail":((a=Ha(((r=fs(t))==null?void 0:r.id)??"glasses"))==null?void 0:a.label.toLowerCase())??"detail";return`${(i=e.answers[t])!=null&&i.refs.length?"Replace":"Add"} the picture of the ${n}`}function N9(e,t,n){const r=e.editing&&e.editing!=="name"?e.editing:e.saying??E2(e.answers,t);if(r==="keep"||!r&&n==="agree")return"keep";if(!r)return null;const a=fs(r);return a&&a.part==="what"?`trait-${a.id}`:null}function Jce({draftId:e,convoKey:t,onOpenDraft:n,onLeaveDraft:r,onStarted:a,caps:i}){var Lt,Ut,At,_t;const{brand:l}=cn(),{presenterCategories:u,applyBrand:f}=Nn(),h=_l(),p=Fl(),g=jr("setup").value,m=jr("settings").value,w=!!g||!!m,[y,b]=s.useState(!1);s.useEffect(()=>b(!1),[i]);const k=!!(i!=null&&i.canGenerate)&&!y,[S,E]=s.useReducer(Mle,{brandId:l.id,convoKey:t},Ae=>{const Ve=tm(sl.read(Tu(Ae.brandId,Ae.convoKey)));return Ve?{...em,answers:Ve.answers,revision:Ve.revision,asides:Ve.asides,extrasDeclined:!!Ve.extrasDeclined,held:!!Ve.held}:em}),C=s.useRef(S);C.current=S;const A=Rle(S),L=Object.keys(S.answers).length>0||S.asides.length>0,T=s.useRef(t);s.useEffect(()=>{L?sl.write(Tu(l.id,t),A):sl.remove(Tu(l.id,t));const Ae=T.current;T.current=t,Ae!==t&&e&&t===e&&(sl.remove(Tu(l.id,Ae)),dl(`presenter-create:${l.id}:${Ae}`))},[l.id,t,e,A,L]);const M=s.useRef(null);s.useEffect(()=>{if(!e||M.current===A)return;const Ae=setTimeout(()=>{M.current=A,Ee.updatePresenterDraft(l.id,e,{setup:A}).catch(()=>{M.current=null})},800);return()=>clearTimeout(Ae)},[l.id,e,A]);const[j,P]=s.useState(null),[R,H]=s.useState(!1),[D,B]=s.useState(null),[V,U]=s.useState([]),[K,O]=s.useState(!1),[F,I]=s.useState(null),[G,z]=s.useState(!1),[Y,Z]=s.useState(null),[ee,pe]=s.useState(null),[se,xe]=s.useState(0),[J,te]=s.useState([]),X=s.useRef(new Map),[ae]=s.useState(()=>!!e||!!tm(sl.read(Tu(l.id,t))));s.useEffect(()=>()=>{for(const Ae of X.current.values())URL.revokeObjectURL(Ae)},[]);const Le=s.useRef(!1),ce=s.useRef(new Set),Se=s.useRef(!1),Ze=s.useRef(null),gt=s.useRef(!1),Ke=s.useRef(!0);s.useEffect(()=>(Ke.current=!0,()=>{Ke.current=!1}),[]);const nt=s.useRef(new Set),$e=s.useRef(0),ne=m$(l.id,e),Q=ne.draft,We=(i==null?void 0:i.engineName)??null,Ne=s.useMemo(()=>c$(Q,k,We),[Q,k,We]);s.useEffect(()=>{ce.current=new Set,Le.current=!1,U([]),M.current=null,e||(gt.current=!1)},[e]),s.useEffect(()=>{if(Le.current||!Q)return;const Ae=iq(Q,V);Ae&&(Le.current=!0,U(Ae))},[Q,V]),s.useEffect(()=>{ne.gone&&r()},[ne.gone,r]);const ie=s.useCallback(()=>{sl.remove(Tu(l.id,t)),dl(`presenter-create:${l.id}:${t}`)},[l.id,t]),q=s.useCallback(Ae=>n(Ae,!0),[n]),oe=s.useCallback(Ae=>{if(!nM.test(Ae)){B(Ae);return}b(!0),E({type:"hold",held:!0})},[]),Re=s.useCallback(async()=>{const Ae=C.current;if(!k||G)return;const Ve=Ae.revision;E({type:"hold",held:!1}),z(!0),B(null);try{const Je=j2(Ae.answers),_=await Ee.createPresenterDraft(l.id,{source:"synthetic",direction:p1(Ae.answers),...Je.length?{keepItems:Je}:{},clientKey:A9(t,Ve)});if(C.current.revision!==Ve||!Ke.current){Ee.deletePresenterDraft(l.id,_.id).catch(()=>{});return}q(_.id)}catch(Je){oe(String((Je==null?void 0:Je.message)??Je))}finally{z(!1)}},[l.id,k,G,q,t,oe]),ze=s.useCallback(async()=>{const Ae=C.current,Ve=Ae.answers.photos;if(!(Ve!=null&&Ve.hashes.length)||!Ve.attested||G)return;if(!k){E({type:"hold",held:!0});return}E({type:"hold",held:!1});const Je=Ae.revision;z(!0),B(null);try{const _=await Ee.createPresenterDraft(l.id,{source:"photos",imageHashes:Ve.hashes,attestation:!0,clientKey:A9(t,Je)});if(C.current.revision!==Je||!Ke.current){Ee.deletePresenterDraft(l.id,_.id).catch(()=>{});return}q(_.id)}catch(_){oe(String((_==null?void 0:_.message)??_))}finally{z(!1)}},[l.id,k,G,q,t,oe]),Ye=s.useCallback(async Ae=>{B(null);const Ve=()=>{var Ue;return((Ue=C.current.answers.photos)==null?void 0:Ue.hashes)??[]},Je=Ae.slice(0,Math.max(0,B0-Ve().length-$e.current));$e.current+=Je.length;const _=[];let fe=0;E({type:"upload-begin"});try{for(const Ue of Je){if(Ue.size>H5){_.push(Ole(Ue.name,H5));continue}try{const Me=await df(Ue);Ve().includes(Me)&&(fe+=1),E({type:"uploaded",hash:Me,max:B0})}catch{_.push(Ile(Ue.name))}}}finally{$e.current-=Je.length,E({type:"upload-end"})}const we=Hle({over:Ae.length-Je.length,same:fe,failed:_,max:B0});we&&B(we)},[]),Ie=s.useCallback(Ae=>{E({type:"answer",patch:Ae,ctx:Ne}),!k&&Ae.describe!==void 0&&E({type:"hold",held:!0})},[Ne,k]),De=s.useCallback(async Ae=>{const Ve=Ae??Q;if(!Ve||K)return;const Je=lq(Ve,Ve.name);if(Je){I(Je);return}O(!0),I(null);try{await Ee.updatePresenterDraft(l.id,Ve.id,{facets:V});const _=await Ee.savePresenterDraft(l.id,Ve.id);f(_.brand),ie(),E({type:"start-over"}),a({kind:"presenter",id:_.presenter.id,name:_.presenter.name})}catch(_){O(!1),I(String((_==null?void 0:_.message)??_))}},[Q,K,k,l.id,V,ie,a,f]),Ge=s.useCallback(async()=>{const Ve=C.current.answers.describe||(Q==null?void 0:Q.direction)||"";gt.current=!!e,ie(),E({type:"start-over",text:Ve}),B(null),Z(null),pe(null),ce.current=new Set,Q&&!cM(Q)&&await Ee.deletePresenterDraft(l.id,Q.id).catch(()=>{}),r()},[Q,e,l.id,ie,r]),ft=Q?ne.err&&!Tc(Q)?ne.err:null:D,bt=s.useMemo(()=>Sce({state:S,draft:Q,canGenerate:k,engine:We,failed:ft,failedView:ne.errView,awaiting:g$({state:S,draft:Q,ctx:Ne,draftId:e,seededFor:Ze.current})}),[S,Q,k,We,ft,ne.errView,e,Ne]),at=d$(bt),Zt=s.useRef(null);Zt.current=(at==null?void 0:at.id)??null;const jt=Q?iM(Q,j):"portrait",Ft=Q?Q.views[jt]:null,Pt=!!Q&&(Q.activeView===jt||Q.stage==="analyzing"),Tt=!!Q&&!Q.activeView&&Q.stage==="idle",ke={state:S,draft:Q,ctx:Ne,canDraw:k,busy:ne.busy||G||Se.current||gt.current||(Q?Tc(Q):!1),err:!!ne.err||!Q&&!!D,draftId:e,seededFor:Ze.current,done:ce.current},et=Xce(ke),Et=s.useRef(et);Et.current=et;const Qe=et?v$(et,ke):"";s.useEffect(()=>{var Ve;Q&&Ze.current!==Q.id&&!ke.busy&&!ke.err&&((Ve=Et.current)==null?void 0:Ve.kind)!=="seed"&&(Ze.current=Q.id);const Ae=Et.current;if(!(!Ae||ce.current.has(Qe)))switch(ce.current.add(Qe),Ae.kind){case"seed":Ze.current=(Q==null?void 0:Q.id)??null,E({type:"restore",answers:Ae.answers,revision:C.current.revision+1,asides:Ae.asides,extrasDeclined:Ae.extrasDeclined});return;case"start":Re();return;case"sync":Se.current=!0,(async()=>{if(!(await ne.update(Ae.patch)||await ne.update(Ae.patch))){ce.current.delete(Qe);return}Ae.redo&&await ne.redo(Ae.redo)})().finally(()=>{Se.current=!1});return;case"draw":ne.generate(Ae.view,void 0,Ae.decide);return}},[Qe,Q,Re,ne.update,ne.redo,ne.generate]);const st=s.useCallback((Ae,Ve,Je,_,fe=!1)=>{E({type:"aside",aside:{said:Ae,reply:Ve,q:Je,at:Zp(),kind:_,...fe?{edit:!0}:{}}})},[]),rt=s.useCallback((Ae,Ve)=>{B(null);const Je=C.current;if(na(Ae)){if(Ae==="weakphotos"&&Ve.kind==="confirm"){Ve.id==="again"&&Ge(),Ve.id==="anyway"&&Ie({weakphotos:{pick:"anyway"}});return}const _=mce(Ae,Ve,Je.answers);if(_){const fe=Je.text.trim(),we=_[Ae],Ue=(dr(Ae)||!!fs(Ae))&&we&&typeof we=="object"&&!we.words;Ie(Ue&&fe?{..._,[Ae]:{...we,words:m6(fe)}}:_);return}if(Ae==="photos"&&Ve.kind==="photos"){const fe=Ve.action;fe.type==="add"&&Ye(fe.files),fe.type==="remove"&&E({type:"remove-photo",hash:fe.hash}),fe.type==="attest"&&E({type:"attest",checked:fe.checked}),fe.type==="reject"&&B("That was not an image. Drop a photo, or choose a file."),fe.type==="submit"&&ze(),fe.type==="back"&&Ie({source:{door:"scratch",via:"taps"}})}return}switch(Ae){case"unsure":{if(Ve.kind!=="confirm"||Ve.id!=="use"||!Je.unsure)return;const _=Je.unsure.said,fe=Je.unsure.q==="describe"?"describe":"source";E({type:"settle-unsure",ctx:Ne}),Ie(fe==="describe"?{describe:_}:{source:{door:"scratch",via:"typed"},describe:_});return}case"noengine":Ve.kind==="confirm"&&Ve.id==="setup"&&h(),Ve.kind==="confirm"&&Ve.id==="change"&&E({type:"hold",held:!1});return;case"agree":{if(Ve.kind!=="confirm")return;Ve.id==="draw"&&Re();return}case"identity":if(Ve.kind!=="confirm"||!Q)return;Ve.id==="use"&&(ne.approve("portrait"),P(null)),Ve.id==="again"&&ne.generate("portrait");return;case"revision":case"view-revision":{if(Ve.kind!=="confirm"||!Q)return;const _=Ae==="revision"?"portrait":Object.keys(Q.views).find(fe=>Q.views[fe].status==="candidate")??jt;Ve.id==="use"&&ne.approve(_),Ve.id==="keep"&&ne.revert(_),Ve.id==="again"&&ne.generate(_,Q.views[_].adjustment,ei(_)),H(!1);return}case"retry":{if(Ve.kind==="confirm"&&Ve.id.startsWith("remedy:")){const fe=Ve.id.slice(7);fe==="setup"?h():p(fe);return}if(Ve.kind==="confirm"&&Ve.id==="skip-extras"){ne.clearErr(),ne.update({extras:!1}),E({type:"extras-declined"});return}if(!Q){ce.current=new Set,B(null);return}if(ne.err){ne.clearErr(),ce.current=new Set([...ce.current].filter(fe=>fe.startsWith("sync:")));return}const _=Object.keys(Q.views).find(fe=>!!Q.views[fe].error);_&&ne.generate(_,Q.views[_].adjustment,ei(_));return}case"extras":if(Ve.kind!=="confirm")return;Ve.id==="add"&&ne.update({extras:!0}),Ve.id==="save"&&E({type:"extras-declined"});return;case"save":De();return}},[Ie,Ye,ze,Re,h,p,Q,ne,jt,De]),qt=s.useCallback(Ae=>{var mr,Kt,wr,Hr,wn,_o,Rn,Ks,Ps;const Ve=Ae.trim(),Je=C.current,_=S9(Je,at),fe=_&&((mr=Je.colour)==null?void 0:mr.step)===_?Je.colour.hex:null,we=_&&dr(_)?_.slice(5):null,Ue=_==="keep"?(((Kt=Je.answers.keep)==null?void 0:Kt.refs)??[]).length:_!=null&&_.startsWith("trait-")?(((wr=Je.answers[_])==null?void 0:wr.refs)??[]).length:0,Me=Ve||fe||"";if(!Me&&!Ue)return!1;if(B(null),_==="name"){const on=Me.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||Me;return Q&&ne.update({name:on.slice(0,60)}),E({type:"text",text:""}),!0}const ct=(on,yn)=>Je.asides.filter(Wn=>Wn.q===on&&Wn.kind===yn).length,Ot=(on,yn=null)=>g6(on,yn,!!(Q!=null&&Q.views.portrait.hash)),zt=(on,yn,Wn,Ur)=>{const Jn=Wn!==null&&Je.editing===Wn;Jn&&Ie({[Wn]:void 0}),st(on,yn,Wn,Ur,Jn)};if(_&&_!=="keep"&&_.startsWith("trait-")){const on=fs(_);if(!on)return!1;const yn=on.part==="what"?((Hr=Je.answers[_])==null?void 0:Hr.refs)??[]:[];if(!Ve&&yn.length)return Ie({[_]:{pick:(wn=Je.answers[_])==null?void 0:wn.pick,words:gce(on.id,yn.length),refs:yn}}),!0;const Wn=Uh(_,Ve,ya);if(!Ve||Wn)return zt(Ve,cc(Wn??"vague",Ot(_),ct(_,Wn??"vague"),Ve,void 0,!0),_,Wn??"vague"),!0;const Ur=m9(Ve),Jn=Ur?m6(Ve):Ve;if(on.part==="where"){const Fn=Je.answers[_];Ie({[_]:{pick:Ur?Fn==null?void 0:Fn.pick:void 0,words:Jn}})}else{const Fn=Je.answers[_];Ie({[_]:{pick:Ur?Fn==null?void 0:Fn.pick:void 0,words:Jn,refs:(Fn==null?void 0:Fn.refs)??[]}})}return!0}if(_==="keep"){const on=Je.answers.keep,yn=(on==null?void 0:on.refs)??[],Wn=Ve||(yn.length&&!(on!=null&&on.words)?"the detail in the attached picture":"");return Wn?(Ie({keep:{words:[(_o=on==null?void 0:on.words)==null?void 0:_o.trim(),Wn].filter(Boolean).join(", "),refs:yn}}),!0):!1}if(_&&dr(_)&&we){const on=Ve&&!/^#[0-9a-f]{6}$/i.test(Ve)?Uh(_,Ve,ya):null;if(on)return zt(Ve,cc(on,Ot(_),ct(_,on),Ve,we,!0),_,on),!0;const yn=Je.answers[_],Wn=!Ve||m9(Ve),Ur=fe??(Wn?yn==null?void 0:yn.pick:void 0),Jn={pick:Ur,words:Ve?Wn?m6(Ve):Ve:yn==null?void 0:yn.words};if(Ve&&!Ur&&!fce(Je.answers,_,Jn,Ve)){const Fn=Je.answers.keep;return Ie({keep:{words:[(Rn=Fn==null?void 0:Fn.words)==null?void 0:Rn.trim(),dce(Ve)].filter(Boolean).join(", "),refs:(Fn==null?void 0:Fn.refs)??[]}}),!0}return Ie({[_]:Jn}),!0}const Rt=(at==null?void 0:at.id)??null,kn=Rt==="unsure"?((Ks=Je.unsure)==null?void 0:Ks.q)??"source":Rt;if(Rt==="traits"){const on=ai(Me,ya);if(on)return st(Me,cc(on,Ot(null,Rt),ct(Rt,on),Me),Rt,on),!0;const yn=Je.answers.keep;return Ie({traits:[],keep:{words:[(Ps=yn==null?void 0:yn.words)==null?void 0:Ps.trim(),Me].filter(Boolean).join(", "),refs:(yn==null?void 0:yn.refs)??[]}}),!0}if(Rt==="gaps"){const on=ai(Me,ya);if(on)return st(Me,cc(on,Ot(null,Rt),ct(Rt,on),Me),Rt,on),!0;const yn=(Je.answers.describe??"").trim().replace(/[.\s]+$/,"");return Ie({describe:yn?`${yn}, ${Me}`:Me}),!0}const Jt=Ot(null,kn),Sn=kn==="source"?ace(Me):null,Qn=Sn?null:ai(Me,ya);if(Qn&&(Jt==="source"||Jt==="describe"||Qn!=="vague"))return st(Me,cc(Qn,Jt,ct(Rt,Qn),Me),Rt,Qn),!0;if((kn==="source"||kn==="describe")&&!Sn&&!ya(Me))return E({type:"unsure",unsure:{said:Me,q:Rt,at:Zp()},ctx:Ne}),!0;if((kn==="source"||kn==="describe")&&E({type:"settle-unsure",ctx:Ne}),kn==="source")return Sn?(Ie({source:{door:Sn,via:"taps"}}),!0):(Ie({source:{door:"scratch",via:"typed"},describe:Me}),!0);if(kn==="describe")return Ie({describe:Me}),!0;if(f$(Me,Q,kn))return ne.update({name:Me.slice(0,60)}),E({type:"text",text:""}),!0;if(kn==="name"){const on=Me.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||Me;return Q&&ne.update({name:on.slice(0,60)}),E({type:"text",text:""}),!0}if(!Q)return!1;if(kn==="identity")return ne.generate("portrait",Me),E({type:"text",text:""}),!0;const dn=dM(Me,jt,Q);return"blocked"in dn?(B(dn.blocked),!1):(P(dn.view),H(!1),ne.generate(dn.view,Me,dn.scope==="view"?ei(dn.view):void 0),E({type:"text",text:""}),!0)},[at,Ie,st,Q,ne,jt]),Yt=s.useCallback(Ae=>{if(Ae==="name"){E({type:"edit",id:"name"});return}const Ve=Xk(Ae);if(Ve){E({type:"edit",id:`aside:${Ve}`});return}if(!na(Ae))return;const Je=kce(Ae,Q);if(Je==="start-over"){Z("start-over");return}if(Je==="redraw"){pe(Ae),Z("redraw");return}E({type:"edit",id:Ae})},[Q]),an=s.useCallback(()=>{Z(null),ee&&E({type:"edit",id:ee}),pe(null)},[ee]),Wt=s.useCallback((Ae,Ve)=>{const Je=C.current.answers;if(Ae==="keep"||Ae.startsWith("trait-")&&!Ae.endsWith("-where")){const _=Je[Ae];Ie({[Ae]:{pick:Ae==="keep"||_==null?void 0:_.pick,words:Ve,refs:(_==null?void 0:_.refs)??[]}});return}if(dr(Ae)||Ae.startsWith("trait-")){const _=Je[Ae];Ie({[Ae]:{pick:_==null?void 0:_.pick,words:Ve}});return}Ie({[Ae]:Ve})},[Ie]),Mn=s.useCallback((Ae,Ve)=>{const Je=Ve.trim();if(!Je)return;if(Ae==="name"){E({type:"cancel-edit"}),Q&&ne.update({name:Je.slice(0,60)});return}const _=Xk(Ae);if(_){const we=C.current,Ue=we.asides.find(Jt=>Jt.at===_);if(!Ue)return;const Me=Ue.q&&na(Ue.q)?Ue.q:null,ct=Me?Uh(Me,Je,ya):ai(Je,ya);if(!ct&&Me){E({type:"drop-aside",at:_}),Wt(Me,Je);return}const Ot=g6(Me,Ue.q,!!(Q!=null&&Q.views.portrait.hash)),zt=Me&&dr(Me)?Me.slice(5):void 0,Rt=ct??"vague",kn=we.asides.filter(Jt=>Jt.q===Ue.q&&Jt.at<Ue.at&&Jt.kind===Rt).length;E({type:"amend-aside",at:_,said:Je,reply:cc(Rt,Ot,kn,Je,zt),kind:Rt,ctx:Ne});return}if(!na(Ae)||!jf(Ae,C.current.answers))return;const fe=Uh(Ae,Je,ya);if(fe){const we=C.current,Ue=g6(Ae,Ae,!!(Q!=null&&Q.views.portrait.hash)),Me=dr(Ae)?Ae.slice(5):void 0,ct=we.asides.filter(Ot=>Ot.q===Ae&&Ot.kind===fe).length;Ie({[Ae]:void 0}),st(Je,cc(fe,Ue,ct,Je,Me),Ae,fe);return}Wt(Ae,Je)},[Q,ne.update,Ie,Wt,qt,at,Ne]),Bt=s.useCallback(()=>E({type:"cancel-edit"}),[]),re=s.useCallback(()=>{const Ae=C.current,Ve=Ae.editing&&Ae.editing!=="name"&&!Cf(Ae.editing)?Ae.editing:null,Je=Ve&&!jf(Ve,Ae.answers)?Ve:at==null?void 0:at.id;if(Je==="agree"){E({type:"say",id:"keep"});return}if(Je==="identity"){xe(_=>_+1);return}if(!(!Je||!na(Je))){if(Je==="look-who"){Ie({source:{door:"scratch",via:"words"}});return}E({type:"say",id:Je})}},[at==null?void 0:at.id,Ie]),ue=s.useCallback(()=>N9(C.current,Ne,Zt.current),[Ne]),de=s.useCallback(Ae=>{const Ve=ue();if(Ve){B(null),C.current.saying!==Ve&&E({type:"say",id:Ve});for(const Je of Ae.slice(0,1)){const _=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,fe=URL.createObjectURL(Je);te(we=>[...we,{key:_,id:Ve,url:fe}]),df(Je).then(we=>{if(nt.current.delete(_)){URL.revokeObjectURL(fe);return}X.current.has(we)?URL.revokeObjectURL(fe):X.current.set(we,fe),E({type:"ref",id:Ve,hash:we}),te(Ue=>Ue.filter(Me=>Me.key!==_))}).catch(we=>{nt.current.delete(_)||B(String((we==null?void 0:we.message)??we)),te(Ue=>Ue.filter(Me=>Me.key!==_)),URL.revokeObjectURL(fe)})}}},[ue]),_e=(Ae,Ve,Je)=>{const _=Ky(Ae,Ve,Je);return _.charAt(0).toUpperCase()+_.slice(1)},Fe=Ae=>l9(Ae).flatMap(Ve=>{const Je=Ve.color?ur(Ve.color):null;return Je?[{hex:Je,name:Ve.label,slot:"accent"}]:[]}),xt=N9(S,Ne,(at==null?void 0:at.id)??null),yt=(()=>{var ct,Ot,zt;if(!xt)return;const Ae=((ct=S.answers[xt])==null?void 0:ct.refs)??[],Ve=xt==="keep"?Ae.slice(((Ot=S.composing)==null?void 0:Ot.id)==="keep"?S.composing.refs.length:Ae.length):Ae,Je=J.filter(Rt=>Rt.id===xt);if(!Ve.length&&!Je.length)return;const _=xt==="keep"?null:fs(xt),fe=_&&((zt=Ha(_.id))==null?void 0:zt.label)||"Detail",we=Ve.length+Je.length>1;let Ue=0;const Me=()=>we?`${fe} ${++Ue}`:fe;return[...Ve.map(Rt=>({key:Rt,src:X.current.get(Rt)??gn(Rt,"micro"),label:Me(),onRemove:()=>E({type:"ref",id:xt,hash:Rt,remove:!0})})),...Je.map(Rt=>({key:Rt.key,src:Rt.url,label:Me(),busy:!0,onRemove:()=>{nt.current.add(Rt.key),te(kn=>kn.filter(Jt=>Jt.key!==Rt.key))}}))]})(),kt=jce(at,S,Q,jt),ot=ne.busy||G||!!kt.off,ht=xt,je=S9(S,at),me=je==="name"?null:je,tt=me&&dr(me)?me.slice(5):null,Ct=kt.color&&tt?Fe(tt):null,be=me&&((Lt=S.colour)==null?void 0:Lt.step)===me?S.colour.hex:null,it=Q&&fi(Q)&&!kt.off&&!(at!=null&&at.id.match(/^(name|describe)$/))?(()=>{const Ae=cq(S.text,jt,Q),Ve=Ae.chip?Q.views[Ae.chip.view].hash:void 0;return{chip:Ae.chip?{label:Ae.chip.label,thumb:Ve?gn(Ve,"micro"):void 0}:null,hint:Ae.hint,tone:Ae.tone}})():null,wt=Q?lM(Q,jt):[],Pe=(Ft==null?void 0:Ft.hash)??((Q==null?void 0:Q.stage)==="analyzing"?Q.sources[0]:void 0),Xe=R&&(Ft!=null&&Ft.prior)?Ft.prior:Pe;return{d:Q,view:jt,slot:Ft,facets:V,setFacets:U,presenterCategories:u,saving:K,saveErr:F,confirming:Y,setConfirming:Z,confirmEdit:an,pendingEdit:ee,startOver:Ge,begun:Object.keys(S.answers).length>0||!!Q,unsaved:!e&&!Q&&Object.keys(S.answers).length>0,leave:()=>{ie(),E({type:"start-over"})},revision:S.revision,open:(at==null?void 0:at.id)??null,keepPrevious:Ft&&Ft.status==="approved"&&Ft.prior&&!Pt&&!(Q!=null&&Q.activeView)&&(Q==null?void 0:Q.stage)==="idle"?()=>void ne.revert(jt):null,surface:{title:"Create presenter",memoryKey:`presenter-create:${l.id}:${t}`,resumed:ae,turns:bt,busy:ne.busy||G||w,working:Cce(bt,Q,G||ne.busy),stageEmpty:{lead:_le(Q?jt:void 0,xn[jt]),hint:Vle((at==null?void 0:at.id)??null,((Ut=S.answers.photos)==null?void 0:Ut.hashes.length)??0)},stage:Q?{hash:Xe,alt:`${$c[jt]}${(Ft==null?void 0:Ft.status)==="candidate"?", candidate":""}`,drawing:Pt,since:fM(Q),doing:hM(Q),takes:Fw(Q,jt)?[]:mM(Q,jt),onTake:Tt?Ae=>void ne.restore(jt,Ae):void 0,items:wt,onPick:Ae=>{P(Ae),H(!1)},compare:Ft&&Ft.status==="candidate"&&Ft.prior?{on:R,toggle:()=>H(Ae=>!Ae)}:void 0}:null,composer:{placeholder:kt.placeholder,label:kt.label,action:kt.action,scope:it,hint:null,why:kt.off??void 0,error:D??F,disabled:ot,working:!!Q&&!!Q.activeView&&(at==null?void 0:at.id)!=="name",onStop:Q!=null&&Q.activeView?()=>void ne.stop():void 0,stopping:ne.stopping,focusKey:at&&!(at.id==="agree"&&!S.saying)?`${at.id}:${(Q==null?void 0:Q.id)??"setup"}:${se}:${S.saying??""}:${S.says}`:void 0,onAttach:!ht&&!Q&&(at==null?void 0:at.id)==="source"?()=>Ie({source:{door:"photos",via:"taps"}}):void 0,onAttachFiles:ht?de:void 0,attachLabel:ht?Qce(S,ht):"Add photos",refs:yt,colour:Ct&&tt?{hex:be,label:be?_e(be,l9(tt),tt):"Pick a colour",seed:(At=Ct[Math.floor(Ct.length/2)])==null?void 0:At.hex,onPick:Ae=>E({type:"colour",hex:Ae,step:me}),onClear:()=>E({type:"colour",hex:null,step:me})}:null},text:S.text,onText:Ae=>E({type:"text",text:Ae}),onSend:qt,onAnswer:rt,onRestore:(Ae,Ve)=>{P(Ae),ne.restore(Ae,Ve)},onEdit:Yt,onSaveEdit:Mn,onCancelEdit:Bt,onDescribe:re,onAttachRef:de,onStarter:Ae=>{(at==null?void 0:at.id)==="agree"&&E({type:"say",id:"keep"}),E({type:"text",text:Ae})},onPaste:!Q&&((_t=S.answers.source)==null?void 0:_t.door)==="photos"?Ae=>void Ye(Ae):void 0}}}function eue({onClose:e,...t}){const n=Jce(t),r=n.d,{push:a}=rr();s.useEffect(()=>Hp({open:n.open}),[n.open]),s.useEffect(()=>()=>Hp(null),[]);const[i,l]=s.useState(!1);s.useEffect(()=>{i&&!n.unsaved&&l(!1)},[i,n.unsaved]);const u=()=>{if(n.unsaved){l(!0);return}r&&!n.saving&&a({kind:"info",title:"Kept on Presenters",detail:"Continue it from its card."}),e()},f=n.begun?r?o.jsx(Xn,{label:"Start over",tone:"quiet",title:"Start over?",body:`This conversation begins again from the first question. ${cM(r)?"The views drawn so far are kept: the unfinished presenter stays on your wall.":"Nothing has been drawn yet, so nothing is kept."}`,open:n.confirming==="start-over"||void 0,busy:!1,onOpenChange:m=>{m||n.setConfirming(null)},onConfirm:()=>void n.startOver()}):o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void n.startOver(),children:"Start over"}):null,h=o.jsx(o.Fragment,{children:n.keepPrevious&&n.slot&&o.jsxs("div",{className:"sc-pstudio-offer",children:[o.jsxs("span",{children:["Redrew the ",xn[n.view],"."]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:n.keepPrevious,children:"Keep previous"})]})}),p=o.jsx(Xn,{label:"Change it",title:Wle,body:(r==null?void 0:r.source)==="photos"?Gle:Kle,busy:!1,open:n.confirming==="redraw",onOpenChange:m=>{m||n.setConfirming(null)},onConfirm:n.confirmEdit}),g=o.jsxs(o.Fragment,{children:[p,o.jsx(Xn,{label:"Leave",title:"Leave without drawing them?",body:"Nothing has been drawn yet, so the answers are not kept. Starting again starts from the first question.",busy:!1,open:i,onOpenChange:m=>{m||l(!1)},onConfirm:()=>{l(!1),n.leave(),e()}})]});return o.jsx(Zy,{surface:{...n.surface,headAction:f,dock:h,overlay:g},onClose:u})}function tue(){const{draftId:e=null}=aa(),{key:t}=Un(),{brand:n}=cn(),r=Bn(),{announce:a,caps:i}=ey();qc("Create presenter");const l=s.useRef(!1);s.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=s.useRef(e),f=s.useRef(0);e!==u.current&&(u.current=e,f.current+=1);const h=s.useCallback((m,w=!1)=>{l.current&&(w&&(u.current=m),r(gl(n,m),{replace:w}))},[r,n]),p=s.useCallback(()=>{l.current&&(u.current=null,r(gl(n),{replace:!0}))},[r,n]),g=s.useCallback(()=>r(ui(n),{replace:!0}),[r,n]);return o.jsx(eue,{draftId:e,convoKey:e??t,onOpenDraft:h,onLeaveDraft:p,onClose:g,onStarted:m=>{a(m,{quiet:l.current&&m.kind==="presenter"}),l.current&&r(m.kind==="presenter"?Ra(n,m.id):ui(n),{replace:!0})},caps:i},f.current)}const M9=1e3,nue=3,rue=1e3;function R9(e,t,n){return{name:e.name.trim()||t.name,prompt:t.prompt,lighting:t.lighting,description:t.description,subject:t.subject,camera:t.camera??"",figure:t.figure??"",figureTreatment:t.figureTreatment??"",keywords:t.keywords??[],collections:t.collections??[],verticals:t.verticals??[],...t.promptName?{promptName:t.promptName}:{},instruction:e.place.trim(),refHashes:[...e.pictures,...e.heldPictures],...n!=null&&n.hash?{previewHash:n.hash,anchor:n.anchor===!0}:{},...n!=null&&n.hash&&n.hero?{heroHash:n.hero,...n.heroWith?{heroWith:n.heroWith}:{}}:{}}}function sue(e){var H,D;const{s:t,dispatch:n,brandId:r,sceneId:a,conversation:i,applyBrand:l}=e,[u,f]=s.useState(!1),[h,p]=s.useState(!1),[g,m]=s.useState(!1),[w,y]=s.useState(0),b=s.useRef(t);b.current=t;const k=s.useRef(e.seed);k.current=e.seed;const S=s.useRef(!1),E=s.useRef(e.onSaved);E.current=e.onSaved;const{poke:C}=ia(),A=s.useCallback(async(B,V={})=>{if(!(S.current||b.current.job)){S.current=!0,m(!0);try{const U=b.current,K=$r(U),O=B==="make"?{kind:B,instruction:U.place,imageHashes:U.pictures,draw:V.draw??!1,...V.shot?{shot:!0}:{}}:B==="again"?{kind:B,reading:K==null?void 0:K.reading,imageHashes:U.pictures}:{kind:B,reading:K==null?void 0:K.reading,ask:V.ask,from:(K==null?void 0:K.hash)??void 0,...K!=null&&K.hash&&K.anchor?{fromAnchor:!0}:{},...K!=null&&K.hash&&K.hero?{fromHero:K.hero,...K.heroWith?{heroWith:K.heroWith}:{}}:{},imageHashes:U.pictures,draw:V.draw},F=U.name.trim()||(K==null?void 0:K.reading.name)||void 0,{jobId:I,job:G,existing:z}=await Ee.startSceneStudioJob(r,{...O,conversation:i,...a?{sceneId:a}:{},...F?{label:F}:{}});if(z&&G.kind!==B){n({type:"error",text:ve.busyElsewhere});return}n({type:"started",id:I,kind:G.kind,ask:G.kind===B?V.ask:void 0,since:G.phaseAt}),C()}catch(U){n({type:"error",text:String((U==null?void 0:U.message)??U)}),y(K=>K+1)}finally{S.current=!1,m(!1)}}},[r,n,C]);s.useEffect(()=>{const B=b.current;if(B.job||!B.versions.length&&!B.inputsRev)return;let V=!0;return Ee.activity(r).then(U=>{var O;const K=(O=U.studio)==null?void 0:O.find(F=>F.kind==="scene"&&F.conversation===i&&F.status==="running"&&!!F.job);!V||!(K!=null&&K.job)||b.current.job||S.current||n({type:"started",id:K.id.slice(6),kind:K.job,since:K.startedAt})}).catch(()=>{}),()=>{V=!1}},[r,i,n]);const L=t.named?t.name.trim():"",T=((H=t.job)==null?void 0:H.id)??null;s.useEffect(()=>{!T||!L||Ee.labelSceneStudioJob(r,T,L).catch(()=>{})},[T,L,r]);const M=((D=t.job)==null?void 0:D.id)??null;s.useEffect(()=>{if(!M)return;let B=!0,V=0,U=!0,K;const O=async()=>{var F;try{const I=await Ee.sceneStudioJob(r,M);if(!B)return;V=0,f(!1),U&&I.status==="running"&&((F=b.current.job)!=null&&F.stopping)&&Ee.cancelSceneStudioJob(r,M).catch(()=>{}),U=!1,I.status==="running"?(n({type:"progress",job:I}),K=setTimeout(O,M9)):n({type:"finished",job:I})}catch(I){if(!B)return;if((I==null?void 0:I.status)===404){f(!1),n({type:"lost",id:M,error:ve.lost});return}V++,V>=nue&&f(!0),K=setTimeout(O,Math.min(M9*2**Math.min(V,3),8e3))}};return O(),()=>{B=!1,clearTimeout(K)}},[M,r,n]);const j=s.useCallback(()=>{const B=b.current.job;if(!B||B.stopping)return Promise.resolve(!0);n({type:"stopping",id:B.id});const V=()=>Ee.cancelSceneStudioJob(r,B.id);return V().catch(()=>new Promise(U=>setTimeout(U,rue)).then(V)).then(()=>!0,()=>(n({type:"stop-failed",id:B.id}),!1))},[r,n]),P=s.useCallback(B=>{const V=_re(b.current,B);V>=0&&n({type:"put-back",index:V})},[n]),R=s.useCallback(async(B={})=>{var F,I,G,z;const V=b.current,U=((F=$r(V))==null?void 0:F.reading.name)||((G=(I=V.job)==null?void 0:I.pending)==null?void 0:G.name)||"",K={...V,name:V.name.trim()||U},O=Ore(K);if(!(!O.can||!O.words||S.current)){S.current=!0,p(!0);try{const Y=((z=V.job)==null?void 0:z.phase)==="drawing"?V.job.id:null,Z=R9(K,O.words,Y?null:$r(V)??null),ee=k.current,pe=ee?$r(ee):null,se=a&&!B.asNew?await Ee.updateScene(r,a,ee&&pe?Xre(Z,R9(ee,pe.reading,pe)):Z):await Ee.createScene(r,{...Z,conversation:i});l(se.brand);const xe=se.scene;if(Y){const J=await Ee.attachSceneStudioJob(r,Y,xe.id).catch(()=>null);(J==null?void 0:J.state)==="landed"&&l(J.brand)}n({type:"saved",id:xe.id}),E.current({id:xe.id,name:xe.name,verticals:xe.verticals??[]},!!B.asNew)}catch(Y){n({type:"error",text:String((Y==null?void 0:Y.message)??Y)})}finally{S.current=!1,p(!1)}}},[r,a,i,l,n]);return{offline:u,saving:h,starting:g,failed:w,start:A,stop:j,putBack:P,use:R}}const aue="scenri:scene-studio:",oue=10080*60*1e3;function w$(e){const t=Cr.get(e);if(!t)return null;try{return JSON.parse(t)}catch{return null}}function iue(e){const t=w$(e);return HP(typeof(t==null?void 0:t.session)=="string"?t.session:null)}function lue(e,t,n){Cr.set(e,JSON.stringify({at:Date.now(),sceneId:n,session:t}))}function cue(e){const t=e.trim();if(!t)return"A shot";if(t.length<=60)return t;const n=t.slice(0,60);return`${n.slice(0,Math.max(n.lastIndexOf(" "),40)).trim()}…`}function P9(e){Cr.del(e)}function uue(e=Date.now()){var t;for(const n of Cr.keys(aue)){let r=0;try{r=Number((t=JSON.parse(Cr.get(n)??"null"))==null?void 0:t.at)||0}catch{}e-r>oue&&Cr.del(n)}}function due(e){var me,tt,Ct,be,it,wt;const{brand:t,applyBrand:n,sceneId:r,seed:a,conversation:i,storageKey:l,caps:u}=e,f=r&&a?{name:a.name}:null,[h]=s.useState(()=>{uue();const Pe=iue(l);return Pe||dl(l),Pe}),[p,g]=s.useReducer(SP,null,()=>(h==null?void 0:h.setup)??Rre),[m,w]=s.useReducer(Hre,null,()=>(h==null?void 0:h.studio)??a??CP),[y,b]=s.useState(0),[k,S]=s.useState(""),E=s.useRef(null),[C,A]=s.useState(!1),[L,T]=s.useState(void 0),[M,j]=s.useState(null),P=s.useRef(!1),R=s.useRef(p);R.current=p;const H=s.useRef(m);H.current=m;const[D,B]=s.useState(null),V=s.useRef(e.onSaved);V.current=e.onSaved;const U=sue({s:m,dispatch:w,brandId:t.id,sceneId:r,conversation:i,seed:a,applyBrand:n,onSaved:(Pe,Xe)=>V.current(Pe,r&&!Xe?"updated":"created")}),K=s.useRef(!1);s.useEffect(()=>{if(P.current)return;const Pe=w$(l);if((Pe==null?void 0:Pe.done)===!0||K.current&&!Pe){P.current=!0;return}const Xe=typeof(Pe==null?void 0:Pe.sceneId)=="string"?Pe.sceneId:null;lue(l,dse(p,m),r??m.saved??Xe),K.current=!0},[p,m,l,r]);const O=m.saved,F=O?mf(t,O):void 0,I=NL(t.id,O,(F==null?void 0:F.placeUrl)??null),G=((me=I.job)==null?void 0:me.status)==="running",[z,Y]=s.useState(!1),[Z,ee]=s.useState(0),[pe,se]=s.useState(!1);s.useEffect(()=>{G||se(!1)},[G]);const xe=s.useMemo(()=>vM(F==null?void 0:F.examples,I.job),[F==null?void 0:F.examples,I.job]),J=s.useRef(e.onDone);J.current=e.onDone;const te=s.useMemo(()=>{var Xe,Lt;if(!O)return;const Pe=(F==null?void 0:F.examples)??[];return{tiles:xe,running:G||z||I.waiting,read:I.read,who:((Xe=Pe[0])==null?void 0:Xe.with)??((Lt=I.job)==null?void 0:Lt.subject.kind)??((F==null?void 0:F.subject)==="person"||F!=null&&F.figure?"presenter":"product"),noSubject:I.read&&!I.job&&!Pe.length&&I.more.length===0,missing:hq(I.more,Pe,I.job),first:I.first,stale:I.first.length>0&&Pe.some(Ut=>Ut.earlier),finish:e.finish}},[O,F,xe,G,z,I.waiting,I.read,I.job,I.first,I.more,e.finish]),X=s.useCallback(Pe=>{O&&(j(null),Y(!0),Ee.drawSceneExamples(t.id,O,Pe).then(()=>{Y(!1),I.again()}).catch(Xe=>{Y(!1),ee(Lt=>Lt+1),"roles"in Pe||w({type:"set-failed",more:"more"in Pe}),j(String((Xe==null?void 0:Xe.message)??Xe))}))},[t.id,O,I.again]),ae=s.useCallback(()=>{O&&(P.current=!0,gse(l,O),dl(l),J.current(O))},[O,l]),[Le,ce]=s.useState(null);s.useEffect(()=>ce(null),[m.current]),s.useEffect(()=>{f||p.editing||!iS(p.answers)||w({type:"inputs",place:Nre(p.answers),pictures:Mre(p.answers)})},[p.answers,p.editing,f]);const Se=s.useRef(new Set),Ze=Dre(m,!f&&iS(p.answers));s.useEffect(()=>{var Pe;Ze===null||U.starting||Se.current.has(Ze)||(Se.current.add(Ze),U.start("make",{draw:!1,shot:((Pe=R.current.answers.source)==null?void 0:Pe.door)==="shot"}))},[Ze,U.starting,U.start]);const[gt,Ke]=s.useState(""),nt=Ny(t.id,gt,!f),$e=s.useRef(nt);$e.current=nt;const ne=s.useRef([]);nt.settled&&!nt.error&&(ne.current=nt.items);const Q=nt.settled?nt.items:ne.current,We=!nt.error&&(!nt.settled||nt.loading),{recent:Ne,loaded:ie}=cn(),[q,oe]=s.useState(null);s.useEffect(()=>{!gt.trim()&&nt.settled&&!nt.error&&oe(nt.items.length>0)},[gt,nt.settled,nt.error,nt.items.length]);const Re=q??(Ne.length>0?!0:ie?!1:null),ze=s.useMemo(()=>({any:Re,items:Q.map(Pe=>({id:Pe.id,hash:Pe.images[0],alt:cue(Pe.promptHead)})),query:gt,more:nt.settled&&nt.hasMore,loading:We,error:nt.error}),[Re,Q,gt,nt.settled,nt.hasMore,We,nt.error]),Ye=Nn().scenes,Ie=(u==null?void 0:u.canRead)??!0,[De,Ge]=s.useState(null),ft=s.useCallback(async Pe=>{var _t,Ae,Ve;const Xe=ne.current.find(Je=>Je.id===Pe)??nt.items.find(Je=>Je.id===Pe);if(!(Xe!=null&&Xe.images[0]))return;const Lt=R.current.revision;let Ut=gS(Xe.brief);if(!Ut&&Xe.kind==="edit"){const Je=await Ee.lineage(Xe.id).catch(()=>null);if(Ut=gS((_t=Je==null?void 0:Je.ancestors.find(_=>_.kind==="generation"))==null?void 0:_t.brief),R.current.revision!==Lt)return}const At=Ut?((Ae=mf(t,Ut))==null?void 0:Ae.name)??((Ve=Ye.find(Je=>Je.id===Ut))==null?void 0:Ve.name):void 0;if(!Ie&&!(Ut&&At)){Ge("shot");return}Ge(null),Et({shot:{id:Xe.id,hash:Xe.images[0],...Ut&&At?{scene:{id:Ut,name:At}}:{}},reuse:void 0})},[t,Ye,nt.items,Ie]),bt=s.useCallback(()=>{var Xe;const Pe=(Xe=R.current.answers.shot)==null?void 0:Xe.scene;Pe&&(P.current=!0,P9(l),dl(l),J.current(Pe.id,{existing:!0}))},[l]),at=(u==null?void 0:u.canDraw)??!0,Zt=U.offline?ve.offline:M,jt={setup:p,studio:m,canDraw:at,canRead:Ie,noReader:De,uploading:y,edit:f&&{...f,changed:mS(m,a)},editingName:C,note:Zt,stale:jP(m),shots:ze,set:te},Ft=U.failed+Z,Pt=s.useMemo(()=>ose(jt).map(Pe=>Pe.kind==="question"&&Ft?{...Pe,question:{...Pe.question,attempt:Ft}}:Pe),[p,m,at,Ie,De,y,C,Zt,f,ze,te,Ft]),Tt=(()=>{const Pe=Pt[Pt.length-1];return(Pe==null?void 0:Pe.kind)==="question"?Pe.question:null})(),ke=cse(jt,Tt),et=(Pe,Xe,Lt)=>g({type:"aside",aside:{said:Pe,reply:Xe,q:Lt,at:Zp()}}),Et=s.useCallback(Pe=>{const Xe=R.current,Lt=Xe.held??Xe.answers;Xe.editing&&fS(H.current)&&JSON.stringify(wy(Lt,Pe))!==JSON.stringify(Lt)&&w({type:"forget-record"}),g({type:"answer",patch:Pe})},[]),Qe=s.useRef(0),st=s.useCallback(async Pe=>{var Ae,Ve;const Xe=Pe.some(uS),Lt=Pe.filter(Je=>Je.type.startsWith("image/")&&!uS(Je));if(!Lt.length){j(Xe?ve.heicNotYet:ve.onlyPictures);return}((Ae=R.current.answers.source)==null?void 0:Ae.door)!=="photos"&&Et({source:{door:"photos"}});const At=4-(((Ve=R.current.answers.photos)==null?void 0:Ve.hashes)??[]).length-Qe.current;if(At<=0){j(ve.fourPictures);return}const _t=Lt.slice(0,At);j(Lt.length>At?ve.fourPictures:Xe?ve.heicNotYet:null),Qe.current+=_t.length,b(Je=>Je+1);try{for(const Je of _t)try{g({type:"photo",hash:await df(Je)})}catch(_){j(`${Je.name} could not be added: ${String((_==null?void 0:_.message)??_)}`)}finally{Qe.current-=1}}finally{b(Je=>Je-1)}},[Et]),rt=s.useRef(xe);rt.current=xe;const qt=Fl(),Yt=_l(),an=s.useCallback((Pe,Xe)=>{var Lt,Ut;if(j(null),Xe.kind==="confirm"&&Xe.id.startsWith("remedy:")){const At=Xe.id.slice(7);At==="setup"?Yt():(At==="engines"||At==="budget")&&qt(At);return}if(Xe.kind==="confirm"&&Xe.id==="reword"){T(String(Date.now()));return}if(Pe==="photos"&&Xe.kind==="photos"){const At=Xe.action,_t=((Lt=R.current.answers.photos)==null?void 0:Lt.hashes)??[];At.type==="add"?st(At.files):At.type==="instead"?Et({source:{door:"shot"}}):At.type==="remove"?g({type:"photos",hashes:_t.filter(Ae=>Ae!==At.hash)}):At.type==="reject"?j(ve.onlyPictures):At.type==="submit"&&_t.length?Ie?(Ge(null),Et({photos:{hashes:_t,done:!0}})):Ge("photos"):At.type==="back"&&Et({source:{door:"guided"}});return}if(Pe==="shot"&&Xe.kind==="pick"){const At=Xe.action;At.type==="pick"?ft(At.id):At.type==="query"?Ke(At.text):At.type==="more"?$e.current.loading||$e.current.loadMore():At.type==="back"&&(Ke(""),Et({source:{door:"photos"},photos:{hashes:[],done:!1}}));return}if(Pe==="reuse"&&Xe.kind==="choice"&&Xe.id==="use"){bt();return}if(Pe==="reuse"&&!Ie){Ge("shot");return}if(Pe==="noreader"){Xe.kind==="confirm"&&Xe.id==="unstop"&&Ge(null);return}if(oS(Pe)){const At=Are(Pe,Xe,R.current.answers);At&&Et(At);return}if(Pe==="retry"){U.start("make",{draw:!1,shot:((Ut=R.current.answers.source)==null?void 0:Ut.door)==="shot"});return}if(Xe.kind==="confirm"){if(Pe==="set-start"){Xe.id==="draw-set"?(w({type:"set-drawn"}),X({first:!0})):w({type:"set-declined"});return}if(Pe==="set-more"){Xe.id==="more"?(w({type:"ask-more"}),X({more:!0})):w({type:"decline-more"});return}if(Pe==="set-done"){Xe.id==="retry-failed"?X({roles:rt.current.filter(At=>At.state==="failed").map(At=>At.role)}):ae();return}Xe.id==="draw"||Xe.id==="again"?U.start("again"):Xe.id==="use"?U.use():Xe.id==="another-shot"&&ue.current("shot")}},[st,Et,U.start,U.use,X,ae,ft,bt,qt,Yt,Ie]),Wt=Pe=>{Pe.trim()?!E.current&&ke.target.kind!=="off"&&(E.current=ke.target):E.current=null,S(Pe)},Mn=Pe=>{const Xe=Bt(Pe);return Xe&&(E.current=null,S("")),Xe};function Bt(Pe){var Xe;{const Lt=Pe.trim();if(!Lt)return!1;j(null);const Ut=E.current??ke.target;if(Ut.kind==="source"){if(TP(Lt))return Et({source:{door:"words",text:Lt.slice(0,kd)}}),!0;const At=wre(Lt),_t=Object.keys(At);return _t.length>0?(Et({source:{door:"guided"},...Object.fromEntries(_t.map(Ae=>[Ae,{pick:At[Ae]}]))}),!0):(et(Lt,SS(ES(Lt,"source")??"vague","source"),"source"),!0)}if(Ut.kind==="row"&&zp(Ut.id)){const At=ES(Lt,"row");if(At)return et(Lt,SS(At,"row"),Ut.id),!0;const _t=(Xe=R.current.answers[Ut.id])==null?void 0:Xe.pick;return Et({[Ut.id]:{..._t?{pick:_t}:{},words:Lt.slice(0,kd)}}),!0}if(Ut.kind==="name")return w({type:"name",text:NP(Lt)??Lt}),!0;if(Ut.kind==="add"||Ut.kind==="change"){if(m.job||U.starting)return!1;const At=Yre(Lt),_t=ase(m);return At.kind==="rename"?(w({type:"name",text:At.name}),et(Lt,ve.renamed(At.name),_t),!0):At.kind!=="change"?(et(Lt,At.say,_t),At.kind!=="refuse"):(Ut.kind==="add"?U.start("change",{ask:Lt,draw:!1}):qre(m,Lt)?U.start("again"):U.start("change",{ask:Lt}),!0)}return!1}}const re=s.useCallback(Pe=>{m.job||(Pe==="name"?A(!0):oS(Pe)&&(Pe==="shot"&&Ke(""),fS(m)?B(Pe):g({type:"edit",id:Pe})))},[m]),ue=s.useRef(re);ue.current=re;const de=s.useCallback((Pe,Xe)=>{Pe==="name"&&(Xe.trim()&&w({type:"name",text:Xe.trim()}),A(!1))},[]),_e=s.useCallback(()=>{A(!1),g({type:"cancel-edit"})},[]),Fe=$r(m),xt=G&&I.job?_w({status:I.job.status,step:I.job.current,done:I.job.done.length,total:I.job.roles.length,error:I.job.error}):void 0,yt=m.job?J8(m):U.saving?"Saving":xt,kt=[];let ot=null;const ht=Pe=>({view:"place",label:"The place",state:Pe==="place"?"current":"approved",hash:(Fe==null?void 0:Fe.hash)??void 0,photo:!1,drawing:!1,approved:!0,error:!1});if(O){const Pe=G?(tt=I.job)==null?void 0:tt.current:null,Xe=((Ct=[...xe].reverse().find(_t=>_t.state==="shown"))==null?void 0:Ct.role)??null,Lt=Le??Pe??Xe??"place",Ut=((be=xe[0])==null?void 0:be.role)==="hero"&&xe[0].state==="shown";Ut||kt.push(ht(Lt));for(const[_t,Ae]of xe.entries())kt.push({view:Ae.role,label:Xa[Ae.role],state:Lt===Ae.role?"current":Ae.state==="shown"?"approved":"todo",hash:Ae.hash,photo:!1,drawing:Ae.state==="drawing",approved:Ae.state==="shown",error:Ae.state==="failed"}),Ut&&_t===0&&kt.push(ht(Lt));const At=kt.find(_t=>_t.view===Lt)??kt[0];ot={hash:At.hash,drawing:At.drawing}}else if(Fe!=null&&Fe.hash&&Fe.hero){const Pe=Le==="place"?"place":"hero";kt.push({view:"hero",label:Xa.hero,state:Pe==="hero"?"current":"approved",hash:Fe.hero,photo:!1,drawing:!1,approved:!0,error:!1},ht(Pe))}const je=!f&&(!!p.answers.source||m.versions.length>0);return{title:f?ve.editTitle:ve.title,turns:Pt,working:yt,busy:U.saving,resumed:!!h,memoryKey:l,stage:ot?{hash:ot.hash,alt:`${m.name.trim()||(Fe==null?void 0:Fe.reading.name)||"The scene"}, in use`,drawing:ot.drawing||!!m.job&&m.job.phase==="drawing",doing:xt??J8(m),items:kt,onPick:Pe=>ce(Pe)}:{hash:(Le==="place"?Fe==null?void 0:Fe.hash:AP(Fe))??void 0,alt:`Preview of ${m.name.trim()||(Fe==null?void 0:Fe.reading.name)||"the scene"}`,drawing:!!m.job&&m.job.phase==="drawing",since:((it=m.job)==null?void 0:it.since)??void 0,doing:J8(m),takes:m.job?void 0:Ire(m),onTake:U.putBack,items:kt,onPick:Pe=>ce(Pe)},composer:{placeholder:ke.placeholder,label:ke.label,action:ke.action,disabled:ke.target.kind==="off",why:ke.target.kind==="off"&&ke.target.why||null,working:ke.working,onStop:m.job?()=>{j(null),U.stop().then(Pe=>{Pe||j(ve.stopLost)})}:G&&O?()=>{se(!0),Ee.stopSceneExamples(t.id,O).then(()=>I.again()).catch(()=>{se(!1),j(ve.stopLost)})}:void 0,stopping:!!((wt=m.job)!=null&&wt.stopping)||pe,focusKey:L,onAttachFiles:ke.attach?Pe=>void st(Pe):void 0,attachLabel:ve.attachLabel},text:k,onText:Wt,onSend:Mn,onAnswer:an,onEdit:re,onSaveEdit:de,onCancelEdit:_e,confirmingEdit:D!==null,confirmEdit:()=>{D&&g({type:"edit",id:D}),B(null)},cancelConfirm:()=>B(null),onRestore:(Pe,Xe)=>U.putBack(Xe),onRetry:Pe=>X({roles:[Pe]}),onDescribe:()=>T(String(Date.now())),onStarter:Pe=>{Wt(Pe),T(String(Date.now()))},onPaste:(Tt==null?void 0:Tt.id)==="source"||(Tt==null?void 0:Tt.id)==="photos"?Pe=>void st(Pe):void 0,canDraw:at,begun:je,unsaved:m.saved?!1:f?mS(m,a):je,running:!!m.job||G,saved:!!O,finish:ae,keptAsDraft:!f&&MP(m),leave:()=>{U.stop(),P.current=!0,P9(l),dl(l)}}}function fue({brand:e,applyBrand:t,sceneId:n,seed:r,conversation:a,storageKey:i,caps:l,onClose:u,onStartOver:f,onSaved:h,onDone:p,finish:g}){const m=due({brand:e,applyBrand:t,sceneId:n,seed:r,conversation:a,storageKey:i,caps:l,onSaved:h,onDone:p,finish:g}),[w,y]=s.useState(!1),[b,k]=s.useState(!1),S=m.turns[m.turns.length-1],E=(S==null?void 0:S.kind)==="question"?S.question.id:null;s.useEffect(()=>Hp({open:E}),[E]),s.useEffect(()=>()=>Hp(null),[]);const C=!!n,A=()=>{if(m.busy){k(!0);return}if(m.saved){m.finish();return}if(m.running||m.keptAsDraft){u();return}if(m.unsaved){y(!0);return}m.leave(),u()};s.useEffect(()=>{!b||m.busy||(k(!1),A())},[b,m.busy]);const L=!C&&m.begun&&!m.saved?o.jsx(Xn,{label:ve.startOver,tone:"quiet",title:ve.startOverTitle,body:ve.startOverBody,busy:!1,onConfirm:()=>{m.leave(),f()}}):null;return o.jsx(Zy,{onClose:A,surface:{kind:"scene",glyph:o.jsx(dC,{size:32}),title:m.title,turns:m.turns,busy:m.busy,working:m.working,memoryKey:m.memoryKey,resumed:m.resumed,stage:m.stage,stageEmpty:{lead:ve.emptyLead,hint:ve.emptyHint},composer:m.composer,text:m.text,onText:m.onText,onSend:m.onSend,onAnswer:m.onAnswer,onEdit:m.onEdit,onSaveEdit:m.onSaveEdit,onCancelEdit:m.onCancelEdit,onRestore:m.onRestore,onRetry:m.onRetry,onDescribe:m.onDescribe,onStarter:m.onStarter,onPaste:m.onPaste,headAction:L,overlay:o.jsxs(o.Fragment,{children:[o.jsx(Xn,{label:ve.changeIt,title:ve.changeTitle,body:ve.changeBody,busy:!1,open:m.confirmingEdit,onOpenChange:T=>{T||m.cancelConfirm()},onConfirm:m.confirmEdit}),o.jsx(Xn,{label:C?ve.discard:ve.leave,title:C?ve.discardTitle:ve.leaveTitle,body:C?ve.discardBody:ve.leaveBody,busy:!1,open:w,onOpenChange:T=>{T||y(!1)},onConfirm:()=>{y(!1),m.leave(),u()}})]})}})}const lv=e=>{const t=/^asset:([a-f0-9]{32})$/.exec(String(e??""));return t?t[1]:null};function hue(e,t){var l;const r=(((l=e.json)==null?void 0:l.scenes)??[]).find(u=>(u==null?void 0:u.id)===t);if(!r)return null;const a={name:String(r.name??""),prompt:String(r.prompt??""),lighting:String(r.lighting??""),subject:r.subject==="product"||r.subject==="person"?r.subject:"either",description:String(r.description??""),...r.promptName?{promptName:String(r.promptName)}:{},...r.camera?{camera:String(r.camera)}:{},...r.figure?{figure:String(r.figure)}:{},...r.figure&&r.figureTreatment?{figureTreatment:String(r.figureTreatment)}:{},...Array.isArray(r.keywords)?{keywords:r.keywords.map(String)}:{},...Array.isArray(r.collections)?{collections:r.collections.map(String)}:{},...Array.isArray(r.verticals)?{verticals:r.verticals.map(String)}:{}},i=(Array.isArray(r.refs)?r.refs:[]).map(u=>lv(u==null?void 0:u.file)).filter(Boolean);return Tre({place:String(r.instruction??""),pictures:i,reading:a,hash:lv(r.preview)??null,anchor:r.anchor===!0,...pue(r),name:a.name})}function pue(e){const t=(Array.isArray(e.examples)?e.examples:[]).find(a=>(a==null?void 0:a.role)==="hero"&&(a==null?void 0:a.from)===e.preview),n=lv(t==null?void 0:t.file);if(!n)return{};const r={...t.product?{product:String(t.product)}:{},...t.presenter?{presenter:String(t.presenter)}:{}};return{hero:n,heroWith:r}}function mue(){return[...crypto.getRandomValues(new Uint8Array(6))].map(t=>t.toString(16).padStart(2,"0")).join("")}function L9(){const{sceneId:e=null,convoId:t=null}=aa(),{key:n,state:r}=Un(),{brand:a}=cn(),{applyBrand:i}=Nn(),l=Bn(),{announce:u,caps:f}=ey();qc(e?"Edit scene":"Create scene");const[h]=s.useState(()=>e?hue(a,e):null),p=typeof(r==null?void 0:r.from)=="string"?r.from:null,g=p&&(yl(mt.hub,p.split("?")[0])||yl(mt.set,p.split("?")[0])),m=s.useCallback(()=>{var k;p&&(((k=window.history.state)==null?void 0:k.idx)??0)>0?l(-1):l(p??(e?zr(a,e):pl(a)),{replace:!0})},[l,p,e,a]),w=s.useMemo(()=>t??mue(),[t,n]);s.useEffect(()=>{t||e&&!h||l(e?$w(a,e,w):ml(a,w),{replace:!0,state:r})},[t,w,e,h,a,l,r]);const y=s.useRef(null),b=s.useMemo(()=>t?vse(a.id,t):null,[a.id,t]);return e&&!h?o.jsx(Ja,{to:zr(a,e),replace:!0}):b?o.jsx(Ja,{to:zr(a,b),replace:!0}):o.jsx(fue,{brand:a,applyBrand:i,sceneId:e,seed:h,conversation:w,storageKey:`scenri:scene-studio:${a.id}:${w}`,caps:f?{canRead:f.canAnalyze,canDraw:f.canGenerate}:null,onClose:m,onStartOver:()=>l(ml(a),{replace:!0,state:r}),onSaved:(k,S)=>{y.current={made:k,how:S}},finish:g?ve.useInAShot:ve.openScene,onDone:(k,S)=>{var E,C;if(!(S!=null&&S.existing)&&!mf(a,k)){l(pl(a),{replace:!0});return}if(!(S!=null&&S.existing)){const A=mf(a,k),L=((E=y.current)==null?void 0:E.made.id)===k?y.current.made:null;u({kind:"scene",id:k,name:(L==null?void 0:L.name)??(A==null?void 0:A.name)??"",verticals:(L==null?void 0:L.verticals)??(A==null?void 0:A.verticals)??[],how:((C=y.current)==null?void 0:C.how)??(e===k?"updated":"created")},{quiet:!(g&&p)})}g&&p?l(`${p.split("?")[0]}?scene=${encodeURIComponent(k)}&compose=1`,{replace:!0}):l(zr(a,k),{replace:!0})}},w)}function y$(){const{brand:e}=cn(),t=Bn(),n=Sr(e);return s.useCallback(r=>{t(`${n}?product=${encodeURIComponent(r)}&compose=1${Ec()}`)},[n,t])}function gue({product:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,onDelete:u,onRename:f,bookmarked:h,onBookmark:p,chosen:g,batching:m,onPick:w,batch:y,size:b="grid"}){var S,E;const k=s.useMemo(()=>y?m2({kind:"product",count:y.count,openLabel:"Open",onOpen:()=>n==null?void 0:n(e.id),href:a,onDeselect:()=>w==null?void 0:w(e.id),onAct:y.onAct,onKeep:y.onKeep,allKept:y.allKept}):Cl({onOpen:n?()=>n(e.id):void 0,href:a,use:r?{label:"Use in a shot",run:()=>r(e.id)}:void 0,select:w?{run:()=>w(e.id)}:void 0,keep:p?{on:!!h,run:()=>p(e.id)}:void 0,onRename:f?()=>f(e.id):void 0,remove:u?{label:"Delete product",run:()=>u(e.id)}:void 0}),[n,r,u,f,w,p,h,a,e.id,y]);return o.jsx(Td,{id:e.id,previewUrl:Jr((E=(S=e.shots)==null?void 0:S[0])==null?void 0:E.file),title:Do(e,"tooltip"),primary:Do(e,"card"),secondary:"",useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,menu:k,bookmarked:h,onBookmark:p,chosen:g,batching:m,onPick:w,size:b})}function vue(e){return o.jsx(t2,{...e})}const b$=s.memo(gue);function wue({product:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,bookmarked:u,onBookmark:f,size:h="grid"}){const p=vf(e.category)??e.category,{contentArriving:g}=Nn(),m=s.useMemo(()=>Cl({onOpen:n?()=>n(e.id):void 0,href:a,use:r?{label:"Use in a shot",run:()=>r(e.id)}:void 0,keep:f?{on:!!u,run:()=>f(e.id)}:void 0}),[n,r,f,u,a,e.id]);return o.jsx(Td,{id:e.id,previewUrl:e.previewUrl,pending:!e.previewUrl&&g,title:`${Do(e,"tooltip")} · ${p}`,primary:Do(e,"card"),secondary:"",useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,menu:m,bookmarked:u,onBookmark:f,size:h})}const x$=s.memo(wue),yue=8,w6="__bookmarked";function bue(){var Et;const{brand:e,products:t,productsLoaded:n,refreshProducts:r}=cn(),a=((Et=uR())==null?void 0:Et.importing)??!1,{demoProducts:i,applyBrand:l,refreshBrands:u}=Nn(),{push:f}=rr(),h=n&&t.length===0,p=Bn(),g=y$(),m=Vl(),{q:w,setQ:y,facets:b,setFacets:k,clearSearch:S,clear:E}=f1(["category","bookmarked"]),C=b.category,A=b.bookmarked==="1",[L,T]=s.useState(()=>Sd("product",e.id)),M=Qe=>T(d2("product",e.id,Qe)),j=Oy(`${e.id}|${w}|${C??""}|${A?"1":""}`),[P,R]=Ma(qr.wallDensity,yd),H=Jc(P),D=s.useCallback(Qe=>R(Qe),[R]),B=s.useMemo(()=>e2(H),[H]),V=Qm(H),U=s.useMemo(()=>{const Qe=a?t.filter(st=>{var rt;return(((rt=st.shots)==null?void 0:rt.length)??0)>0}):t;return WM(Qe).map(st=>({product:st,category:Jw(st),own:!0}))},[t,a]),K=s.useMemo(()=>i.map(Qe=>({product:Qe,category:Qe.category,own:!1})),[i]),O=s.useMemo(()=>[...U,...K],[U,K]),F=s.useMemo(()=>O.reduce((Qe,st)=>Qe+(L.includes(st.product.id)?1:0),0),[O,L]),I=A&&F===0,G=I&&h,z=I&&!h,Y=s.useMemo(()=>{const Qe=new Map;for(const{category:st}of O)st&&Qe.set(st,(Qe.get(st)??0)+1);return Qe},[O]),Z=s.useMemo(()=>gf.filter(Qe=>Y.has(Qe.key)),[Y]),ee=O.length>0?"tabs":"none",pe=s.useCallback(Qe=>p(Ea(e,Qe)),[p,e]),[se,xe]=s.useState(null),[J,te]=s.useState(!1),[X,ae]=s.useState(null),[Le,ce]=s.useState(!1),[Se,Ze]=s.useState(null),[gt,Ke]=s.useState(!1),nt=s.useCallback(Qe=>{const st=t.find(rt=>rt.id===Qe);st&&xe(st)},[t]),$e=Qe=>Qe.origin==="catalog"||Qe.id.startsWith("cat-"),ne=s.useCallback(Qe=>{const st=t.find(rt=>rt.id===Qe);!st||$e(st)||(Ze(null),ae(st))},[t]),Q=async Qe=>{if(!(!X||Le)){ce(!0),Ze(null);try{l(await Ee.updateProduct(e.id,X.id,{name:Qe})),ae(null)}catch(st){const rt=ln(st,"Could not rename this product");Ze([rt.title,rt.detail].filter(Boolean).join(" "))}finally{ce(!1)}}},We=async()=>{if(!se||J)return;te(!0);const Qe=se.origin==="catalog"||se.id.startsWith("cat-");try{Qe?(await Ee.deleteCatalogProduct(e.id,se.id),await r()):l(await d4(e.id,se.id)),j.forget(se.id),xe(null)}catch(st){(st==null?void 0:st.status)===404?(await Promise.all([u(),r()]),j.forget(se.id),xe(null)):f(ln(st,"Could not delete this product"))}finally{te(!1)}},Ne=s.useCallback(Qe=>Qe.filter(({product:st})=>G||!A||L.includes(st.id)).filter(({category:st})=>!C||st===C).filter(({product:st,category:rt})=>Ho([xy(st),vf(rt)].filter(Boolean).join(" "),w)).map(({product:st})=>st),[C,w,A,L,G]),ie=s.useMemo(()=>Ne(U),[Ne,U]),q=s.useMemo(()=>Ne(K),[Ne,K]),{visible:oe,remaining:Re,showMore:ze}=kf(ie,`${C??""}|${A?"keepers":""}|${w}`),[Ye,Ie]=s.useState(null);s.useEffect(()=>{if(!Ye||Re<=0)return;const Qe=Ye.closest(".sc-home"),st=new IntersectionObserver(rt=>{rt.some(qt=>qt.isIntersecting)&&ze()},{root:Qe,rootMargin:"200% 0px"});return st.observe(Ye),()=>st.disconnect()},[Ye,Re,ze]);const De={key:"category",label:"Category",everyLabel:"All products",everyCount:O.length,selected:A?w6:C,onSelect:Qe=>k(Qe===w6?{bookmarked:"1",category:null}:{bookmarked:null,category:Qe}),options:[{value:w6,label:"Keepers",count:F},...Z.map(Qe=>({value:Qe.key,label:Qe.label,count:Y.get(Qe.key)??0}))]},Ge=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>m("product"),children:[o.jsx(pr,{size:12})," Add product"]}),ft=h,bt=t.length>0,at=o.jsx(g2,{title:"Products",filters:o.jsx(v2,{mode:ee,group:De}),density:o.jsx(Jm,{value:H,onChange:D}),search:O.length>=yue&&o.jsx(Fd,{value:w,onChange:y,noun:"products",total:O.length})}),Zt=Qe=>{const st=t.find(qt=>qt.id===Qe);return st&&st.origin==="catalog"||Qe.startsWith("cat-")?Ee.deleteCatalogProduct(e.id,Qe):d4(e.id,Qe)},jt=()=>{const Qe=[...j.ids];Qe.length===1?nt(Qe[0]):Ke(!0)},Ft=[...j.ids],Pt=Ft.length>0&&Ft.every(Qe=>L.includes(Qe)),Tt=()=>T(Sy("product",e.id,Ft,!Pt)),ke=p2(j.ids.size,Pt,"products"),et=async()=>{if(J)return;const Qe=[...j.ids];te(!0);try{const{failed:st,error:rt}=await Qp(Qe,Zt);await Promise.all([u(),r()]),j.retain(st),Ke(!1),rt&&f(ln(rt,"Could not delete these products"))}finally{te(!1)}};return o.jsx(a1.Provider,{value:V,children:o.jsxs(ds,{children:[o.jsxs("main",{className:"sc-looks sc-products",id:"main","data-hero":ft||void 0,onClick:j.onBlank,children:[n&&!ft&&at,!n&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":V,style:B,"aria-hidden":!0,children:o.jsx(vue,{size:"grid",count:8})}),bt&&oe.length>0&&o.jsxs("section",{className:"sc-owned",children:[o.jsx("div",{className:"sc-sec-head",children:o.jsx("h2",{className:"sc-sec-title",children:"Your products"})}),o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:oe.map(Qe=>o.jsx(b$,{product:Qe,variant:"use",size:"grid",onOpen:pe,href:Ea(e,Qe.id),onUse:g,bookmarked:L.includes(Qe.id),onBookmark:M,onDelete:nt,onRename:$e(Qe)?void 0:ne,chosen:j.ids.has(Qe.id),batching:j.batching==="product",onPick:j.picking("product")?st=>j.toggle("product",st):void 0,batch:j.kind==="product"&&j.ids.has(Qe.id)?{count:j.ids.size,onAct:jt,onKeep:Tt,allKept:Pt}:null},Qe.id))}),Re>0&&o.jsx("div",{ref:Ie,"aria-hidden":!0}),Re>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:ze,children:["Show ",Math.min(Re,60)," more"]})}),X&&o.jsx(Dy,{title:"Rename product",name:X.name,maxLength:500,busy:Le,error:Se,onConfirm:Qe=>void Q(Qe),onDismiss:()=>{Le||ae(null)}}),se&&o.jsx(Xn,{label:"Delete product",title:`Delete ${se.name}?`,body:ji("product",1),open:!0,busy:J,onOpenChange:Qe=>{!Qe&&!J&&xe(null)},onConfirm:()=>void We()}),gt&&o.jsx(Xn,{label:cs("product",j.ids.size).menu,title:`${cs("product",j.ids.size).menu}?`,body:ji("product",j.ids.size),open:!0,busy:J,onOpenChange:Qe=>{!Qe&&!J&&Ke(!1)},onConfirm:()=>void et()})]}),ft&&o.jsx(No,{shape:"cold",title:o.jsxs(o.Fragment,{children:["Bring in a ",o.jsx("em",{children:"product"})]}),body:"Upload a few clean shots, or import your store, and it stays exact in every image you make.",action:Ge}),bt&&oe.length>0&&q.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri products"})}),ft&&K.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Iy,{label:"Or borrow one of ours"}),at]}),n&&q.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:q.map(Qe=>o.jsx(x$,{product:Qe,variant:"use",size:"grid",onUse:g,onOpen:pe,href:Ea(e,Qe.id),bookmarked:L.includes(Qe.id),onBookmark:M},Qe.id))}),n&&z&&o.jsx(No,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a product from its card and it stays here.",mark:Ty,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>k({bookmarked:null}),children:"Browse every product"})}),n&&!z&&ie.length===0&&q.length===0&&o.jsx(w2,{noun:"products",q:w,facet:A?"Keepers":C?vf(C):null,onClearSearch:S,onClearAll:E})]}),o.jsxs("div",{className:"sc-wall-dock",children:[j.kind==="product"&&j.ids.size>0&&o.jsx(Hy,{count:j.ids.size,loaded:oe.length,tool:cs("product",j.ids.size).tool,icon:cs("product",j.ids.size).icon,danger:!0,onAct:jt,keep:{label:ke.tool,filled:Pt,onAct:Tt},onClear:j.clear,onSelectAll:()=>j.selectAll("product",oe.map(Qe=>Qe.id))}),o.jsx($y,{})]})]})})}function xue({refs:e,cap:t,note:n,addLabel:r,busy:a,onAdd:i,onPromote:l,onRemove:u}){const[f,h]=s.useState(null),p=s.useMemo(()=>e.find(A=>A.file===f)??e[0],[e,f]);s.useEffect(()=>{var A;e.length&&!e.some(L=>L.file===f)&&h(((A=e[0])==null?void 0:A.file)??null)},[e,f]);const g=p?e.findIndex(A=>A.file===p.file):-1,m=!!l&&g>0,w=!!u&&!!p&&e.length>1,y=!!(r&&i&&e.length>0),b=e.length>1||y,{shellRef:k,railRef:S,page:E}=AL(e.length),C=A=>{const L=A==null?void 0:A[0];L&&(i==null||i(L))};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-refstage",children:p?o.jsx("div",{className:"sc-refstage-frame",children:o.jsx("img",{src:p.url,alt:""})}):i?o.jsxs("label",{className:"sc-refstage-blank sc-refstage-drop","data-busy":a||void 0,onDragOver:A=>{A.preventDefault(),A.dataTransfer.dropEffect="copy"},onDrop:A=>{A.preventDefault(),C(A.dataTransfer.files)},children:[o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:a,onChange:A=>{C(A.target.files),A.target.value=""}}),a?o.jsx(Pr,{size:"2"}):o.jsx(pr,{size:22,weight:"bold"}),o.jsx("span",{children:"Add a reference"})]}):o.jsx("span",{className:"sc-refstage-blank",children:o.jsx(Ta,{size:22})})}),b&&o.jsxs("div",{className:"sc-refrail-shell",ref:k,children:[o.jsxs("div",{className:"sc-refrail-track",children:[o.jsx("button",{type:"button",className:"sc-refrail-arrow prev","aria-label":"Previous references",onClick:()=>E(-1),children:o.jsx($a,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-refrail-arrow next","aria-label":"Next references",onClick:()=>E(1),children:o.jsx(Al,{size:13,weight:"bold"})}),o.jsx("div",{className:"sc-refrail",ref:S,children:e.map((A,L)=>o.jsx("button",{type:"button",className:"sc-refrail-item","data-on":(p==null?void 0:p.file)===A.file?"":void 0,"data-spare":L>=t?"":void 0,"aria-label":`Reference ${L+1}`,"aria-pressed":(p==null?void 0:p.file)===A.file,onClick:()=>h(A.file),children:o.jsx("img",{src:A.url,alt:"",loading:"lazy"})},A.file))})]}),y&&o.jsxs("label",{className:"sc-refrail-item sc-refrail-add","data-busy":a||void 0,children:[o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:a,onChange:A=>{C(A.target.files),A.target.value=""}}),a?o.jsx(Pr,{size:"1"}):o.jsx(pr,{size:16,weight:"bold"}),o.jsx("span",{className:"sc-vh",children:r})]})]}),(m||w)&&o.jsx("div",{className:"sc-refacts",children:o.jsxs("span",{className:"sc-refacts-pair",children:[m&&o.jsxs("button",{type:"button",className:"sc-refact sc-refact-lead",onClick:()=>l==null?void 0:l(p.file),children:[o.jsx(GI,{size:14,weight:"bold"}),"Use first"]}),w&&o.jsx("button",{type:"button",className:"sc-refact sc-refact-aside",onClick:()=>u==null?void 0:u(p.file),children:"Remove"})]})}),o.jsx("p",{className:"sc-lookpage-note",children:n})]})}function kue({value:e,onChange:t,onBlur:n,label:r,placeholder:a,className:i="sc-lookpage-titleedit"}){const l=s.useRef(null),u=f=>{f&&(f.style.height="auto",f.style.height=`${f.scrollHeight}px`)};return s.useEffect(()=>u(l.current),[e]),o.jsx("textarea",{ref:l,className:i,rows:1,dir:"auto","aria-label":r,placeholder:a,value:e,onChange:f=>{u(f.currentTarget),t(f.target.value)},onBlur:n,onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),f.currentTarget.blur())}})}function Sue({value:e,onChange:t}){const n=vf(e)??"Other",r=e&&gf.some(a=>a.key===e)?e:"other";return o.jsxs(Cs,{children:[o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-pdetails-field sc-catpick","aria-label":`Category: ${n}`,children:[n,o.jsx(bl,{size:11,weight:"bold"})]})}),o.jsx(As,{align:"center",sideOffset:8,children:o.jsx(Ep,{value:r,children:gf.map(a=>o.jsx(Wu,{value:a.key,onSelect:()=>t(a.key),children:a.label},a.key))})})]})}const y6='mm|cm|inches|inch|in|m|"';function $9(e){if(!e)return;const t=e.toLowerCase();return t==='"'||t==="inch"||t==="inches"?"in":t==="mm"||t==="cm"||t==="m"||t==="in"?t:void 0}function Af(e){const t=Number(e.trim().replace(",","."));return e.trim()&&Number.isFinite(t)&&t>0?String(t):""}const m1=["height","width","depth"],cv={height:"Height",width:"Width",depth:"Depth"};function k$(e){var f,h,p,g,m,w;const t={unit:"cm",height:"",width:"",depth:""},n=e.trim();if(!n||!new RegExp(y6,"i").test(n))return t;const r={},a=(y,b)=>{if(r[b])return;const k=n.match(new RegExp(`(\\d+(?:[.,]\\d+)?)\\s*(${y6})?\\s*(?:${y})\\b`,"i"));if(!k)return;const S=Af(k[1]);S&&(r[b]={value:S,unit:$9(k[2])})};a("tall|high","height"),a("across|wide","width"),a("long","width"),a("deep","depth");const i=m1.filter(y=>r[y]);if(i.length){const y=new Set(i.map(b=>{var k;return(k=r[b])==null?void 0:k.unit}).filter(b=>!!b));return y.size>1?t:{unit:[...y][0]??"cm",height:((f=r.height)==null?void 0:f.value)??"",width:((h=r.width)==null?void 0:h.value)??"",depth:((p=r.depth)==null?void 0:p.value)??""}}const l=[];for(const y of n.matchAll(new RegExp(`(\\d+(?:[.,]\\d+)?)\\s*(${y6})?`,"gi"))){const b=Af(y[1]);b&&l.push({value:b,unit:$9(y[2])})}if(!l.length)return t;const u=l.map(y=>y.unit).filter(y=>!!y);return!u.length||new Set(u).size>1?t:{unit:u[u.length-1],height:((g=l[0])==null?void 0:g.value)??"",width:((m=l[1])==null?void 0:m.value)??"",depth:((w=l[2])==null?void 0:w.value)??""}}function Eue(e){const t=k$(e),n=m1.flatMap(i=>t[i]?[`${cv[i]} ${t[i]} ${t.unit}`]:[]);if(n.length)return n;const r=e.trim();if(!r)return[];const a=r.replace(/^about\s+/i,"");return[a.charAt(0).toUpperCase()+a.slice(1)]}const Cue={height:"tall",width:"across",depth:"deep"};function jue(e){return m1.map(t=>{const n=Af(e[t]);return n?`${n} ${e.unit} ${Cue[t]}`:""}).filter(Boolean).join(" and ")}function Aue(e,t){return m1.every(n=>Af(e[n])===Af(t[n]))}function Nue({size:e,category:t,busy:n,error:r,onSave:a,onDismiss:i}){const l=t??"other",u=(e==null?void 0:e.text)??"",[f]=s.useState(()=>k$(u)),[h,p]=s.useState(f),[g,m]=s.useState(l),w=(S,E)=>S.trim().toLowerCase()===E.trim().toLowerCase(),y=Aue(h,f)?u:jue(h),b=()=>{if(!n){if(w(y,u)&&g===l)return i();a({size:y,category:g})}},k=(e==null?void 0:e.by)==="person"?"Yours. Clear it to go back to the size read from its photo.":(e==null?void 0:e.by)==="record"?"From your store's listing.":e?"Read from its photo.":"Not read yet.";return o.jsxs(Ws,{className:"sc-newdlg sc-pdetails",maxWidth:"min(460px, 94vw)",onDismiss:i,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(Ns,{className:"sc-newdlg-title",children:"Details"}),o.jsx(Ms,{asChild:!0,children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx("span",{"aria-hidden":!0,children:"×"})})})]}),o.jsxs("div",{className:"sc-newdlg-body",children:[o.jsxs("div",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Category"}),o.jsx(Sue,{value:g,onChange:m}),o.jsx("span",{className:"sc-pdetails-hint",children:"Where it is filed, so it surfaces with that kind of product."})]}),o.jsxs("div",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Size"}),o.jsx("div",{className:"sc-size",children:m1.map(S=>o.jsxs("label",{className:"sc-size-dim",children:[o.jsx("span",{className:"sc-size-name",children:cv[S]}),o.jsxs("span",{className:"sc-size-box",children:[o.jsx("input",{className:"sc-pdetails-field",inputMode:"decimal","aria-label":cv[S],value:h[S],onChange:E=>p({...h,[S]:E.target.value}),onKeyDown:E=>E.key==="Enter"&&b()}),o.jsx("span",{className:"sc-size-unit","aria-hidden":!0,children:h.unit})]})]},S))}),o.jsx("span",{className:"sc-pdetails-hint",children:k})]}),r&&o.jsx("p",{className:"sc-assetform-err",children:r})]}),o.jsxs("div",{className:"sc-newdlg-foot",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:i,children:"Cancel"}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary","data-busy":n||void 0,onClick:b,children:n?"Saving":"Save"})]})]})}const Mue=3;function Rue(e){const t=e,n=(t.brand??t.vendor??"").trim();return!n||e.name.toLowerCase().startsWith(n.toLowerCase())?null:n}function Pue(e){return e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"").replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/\s+/g," ").trim()}function Lue(e,t){if(e.length<=t)return e;const n=e.slice(0,t+1).search(/[.!?](\s|$)/);if(n>40)return e.slice(0,n+1);const r=e.lastIndexOf(" ",t);return`${e.slice(0,r>40?r:t).trimEnd()}…`}function $ue(){var Ie;const{productId:e=""}=aa(),{brand:t,products:n,productsLoaded:r,refreshProducts:a}=cn(),{demoProducts:i,demoProductsLoaded:l,applyBrand:u,refreshBrands:f}=Nn(),h=Bn(),p=y$(),{push:g}=rr(),[m,w]=s.useState(!1),[y,b]=s.useState(!1),[k,S]=s.useState(null),E=s.useRef(null),C=s.useRef({}),A=s.useRef(!1),L=y2(),T=n.find(De=>De.id===e),[M,j]=s.useState(null);s.useEffect(()=>{if((T==null?void 0:T.origin)!=="catalog"){j(null);return}let De=!0;return Ee.libraryProduct(t.id,T.id).then(Ge=>{De&&j(Ge.product)}).catch(()=>{}),()=>{De=!1}},[t.id,T]);const P=M&&T&&M.id===T.id?{...M,...T,shots:M.shots}:T,R=s.useMemo(()=>P?void 0:i.find(De=>De.id===e),[P,i,e]);qc((Ie=P??R)==null?void 0:Ie.name);const[H,D]=s.useState([]);s.useEffect(()=>{if(!R){D([]);return}let De=!0;return Ee.demoProductFrames(R.id).then(Ge=>{De&&D(Ge.frames)}).catch(()=>{De&&D([])}),()=>{De=!1}},[R==null?void 0:R.id]);const B=s.useRef(R==null?void 0:R.id);B.current=R==null?void 0:R.id,h2(()=>{const De=R==null?void 0:R.id;De&&Ee.demoProductFrames(De).then(Ge=>{B.current===De&&D(ft=>xi(ft,Ge.frames))}).catch(()=>{})});const[V,U]=s.useState((P==null?void 0:P.name)??"");s.useEffect(()=>{U((P==null?void 0:P.name)??"")},[P==null?void 0:P.id]);const K=Fy(t.id,[e??""]),[O,F]=s.useState(null),[I,G]=s.useState(!1),[z,Y]=s.useState(!1),[Z,ee]=s.useState(null),pe=!!(P??R);s.useEffect(()=>{if(F(null),!pe||!e)return;let De=!0;return Ee.productSize(t.id,e).then(Ge=>{De&&F(Ge.size)}).catch(()=>{}),()=>{De=!1}},[t.id,e,pe]);const se=async De=>{if(!e)return!1;const Ge=L();Y(!0),ee(null);try{const ft=await Ee.setProductSize(t.id,e,De);return Ge()&&(F(ft.size),G(!1)),!0}catch(ft){return ee(String(ft.message??ft)),!1}finally{Y(!1)}},xe=((P==null?void 0:P.origin)??"manual")==="manual",J=async(De,Ge)=>{Ge&&De&&typeof De=="object"&&"json"in De?u(De):await a()},te=De=>{if(!P||A.current)return;C.current={...C.current,...De},E.current&&clearTimeout(E.current);const Ge=t.id,ft=P.id,bt=xe;E.current=setTimeout(()=>{E.current=null;const at=C.current;C.current={},(bt?Ee.updateProduct(Ge,ft,at):Ee.updateCatalogProduct(Ge,ft,at)).then(jt=>J(jt,bt)).catch(jt=>S(String(jt.message??jt)))},500)},X=async De=>{const Ge=(O==null?void 0:O.text)??"",ft=De.size.trim().toLowerCase()!==Ge.trim().toLowerCase();ft&&!await se(De.size)||(De.category!==(gt??"other")&&te({category:De.category}),ft||G(!1))},ae=async De=>{const Ge=xe;w(!0),S(null);try{await J(await De,Ge)}catch(ft){S(String(ft.message??ft))}finally{w(!1)}},Le=async()=>{if(!P||A.current)return;A.current=!0,E.current&&clearTimeout(E.current),E.current=null,C.current={};const De=L(),Ge=td(t),ft=P.origin==="catalog"||P.id.startsWith("cat-");b(!0),S(null);try{ft?(await Ee.deleteCatalogProduct(t.id,P.id),await a()):u(await d4(t.id,P.id))}catch(bt){if((bt==null?void 0:bt.status)!==404){A.current=!1,De()&&(S(String(bt.message??bt)),b(!1));return}await Promise.all([f(),a()])}De()&&h(Ge,{replace:!0})};if(!P&&!R&&(!l||!r))return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage sc-productpage",id:"main",children:[o.jsxs("div",{className:"sc-refskeleton sc-wait-late","aria-hidden":!0,children:[o.jsx("span",{className:"sc-refskeleton-title"}),o.jsx("span",{className:"sc-refskeleton-stage"}),o.jsxs("span",{className:"sc-refskeleton-rail",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]})]}),o.jsx("p",{className:"sc-vh",role:"status",children:"Loading this product"})]})});if(!P&&!R)return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage",id:"main",children:[o.jsx("h1",{children:"This product isn't here anymore"}),o.jsx("p",{className:"sc-lookpage-lede",children:"It may have been removed, or the link is out of date."}),o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx(Vn,{className:"sc-btn sc-btn-primary",to:td(t),children:"Browse products"})})]})});const ce=R?"none":xe?"full":"fields",Se=P??R,Ze=(P==null?void 0:P.id)??R.id,gt=P?Jw(P):(R==null?void 0:R.category)??null,Ke=Rue(Se),nt=De=>{const Ge=Jr(De.file);return Ge?[{file:De.file,url:Ge,angle:De.angle}]:[]},$e=R?H.map(De=>({file:De.angle,url:De.url,angle:De.angle})):((P==null?void 0:P.shots)??[]).flatMap(nt),ne=De=>{const Ge=$e.map(bt=>bt.file),ft=Ge.indexOf(De)+1;ae(Ee.setProductShots(t.id,Ze,Ge.filter(bt=>bt!==De))).then(()=>g({kind:"success",title:"Reference removed",detail:`Reference ${ft} of ${Ge.length}`,action:{label:"Undo",onClick:()=>void ae(Ee.setProductShots(t.id,Ze,Ge))}}))},Q=R?"Our reference set. Yours replaces it.":$e.length===0?xe?"No reference yet.":"No reference yet. Images from your store are still arriving.":$e.length===1?"One angle. A shot has to guess at every side it can't see.":$e.length===2?"Two angles. A third pins the shape.":"The first three build every shot. Remove any that show a different colour or version.",We=ce==="none"?null:"Add image",Ne=P!=null&&P.descriptionHtml?Lue(Pue(P.descriptionHtml),200):"",ie=(R==null?void 0:R.description)||Ne||null,q=Eue((O==null?void 0:O.text)??""),oe=R?[R.subcategory]:[P==null?void 0:P.variant,P==null?void 0:P.material,q.length?null:P==null?void 0:P.dimensions],Re=vf(gt),ze=oe.filter(Boolean),Ye=R?i.filter(De=>De.id!==Ze).slice(0,8):n.filter(De=>De.id!==Ze).slice(0,8);return o.jsx(ds,{children:o.jsxs("main",{className:"sc-lookpage sc-productpage",id:"main",children:[o.jsx(_y,{to:td(t),wall:"Products",where:R?"Scenri library":xe?"Yours":"From your store"}),Ke&&o.jsx("p",{className:"sc-lookpage-house",children:o.jsx("em",{className:"sc-accent",children:Ke})}),ce==="full"?o.jsx(kue,{label:"Product name",value:V,onChange:De=>{U(De),te({name:De})}}):o.jsx("h1",{dir:"auto",children:Se.name}),(Re||q.length>0)&&o.jsxs("div",{className:"sc-lookpage-marks",children:[Re&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Filed under",children:o.jsx("li",{className:"sc-chip","data-static":!0,children:Re})}),q.length>0&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Size",children:q.map(De=>o.jsx("li",{className:"sc-chip","data-static":!0,children:De},De))})]}),ie&&o.jsx("p",{className:"sc-lookpage-lede",children:ie}),ze.length>0&&o.jsx("p",{className:"sc-lookpage-facts",children:ze.join(" · ")}),o.jsxs("div",{className:"sc-lookpage-acts",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>p(Ze),children:"Use in a shot"}),o.jsx(Vy,{kind:"product",brandId:t.id,id:Ze}),ce!=="none"&&o.jsx(fr,{label:"Edit details",children:o.jsx("button",{type:"button",className:"sc-icon-btn","aria-label":"Edit details","aria-haspopup":"dialog",onClick:()=>{ee(null),G(!0)},children:o.jsx(jd,{size:17})})})]}),k&&o.jsx("p",{className:"sc-assetform-err",children:k}),o.jsx(xue,{refs:$e,cap:Mue,note:Q,addLabel:We,busy:m,onAdd:ce==="none"?void 0:De=>void ae(VG(t.id,Ze,De)),onPromote:ce==="none"?void 0:De=>void ae(Ee.setProductShots(t.id,Ze,[De,...$e.map(Ge=>Ge.file).filter(Ge=>Ge!==De)])),onRemove:ce==="none"?void 0:ne}),K.length>0&&o.jsx(od,{label:`Shots featuring ${Se.name}`,children:K.map(De=>o.jsx(Xw,{node:De,to:zm(t,null,De.id)},De.id))}),Ye.length>0&&o.jsx(od,{label:R?"Other products in the library":"Other products",children:Ye.map(De=>R?o.jsx(x$,{product:De,variant:"navigate",size:"slider",onOpen:Ge=>h(Ea(t,Ge)),href:Ea(t,De.id)},De.id):o.jsx(b$,{product:De,variant:"navigate",size:"slider",onOpen:Ge=>h(Ea(t,Ge)),href:Ea(t,De.id)},De.id))}),I&&o.jsx(Nue,{size:O,category:gt,busy:z,error:Z,onSave:De=>void X(De),onDismiss:()=>G(!1)}),P&&o.jsx("div",{className:"sc-ownedbits",children:o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx(Xn,{label:"Delete product",title:`Delete ${P.name}?`,body:ji("product",1),busy:y,onConfirm:()=>void Le()})})})]})})}function Tue(e,t){const n=new Map(e);let r=0,a=0,i=0;const l=[];for(const f of t){n.set(f.id,f.status);const h=e.get(f.id);if(h!==f.status){if(h===void 0){f.status==="running"&&(r+=1);continue}f.status==="done"?a+=1:f.status==="error"?l.push(f.error):f.status==="cancelled"&&(i+=1)}}const u=[];return r&&u.push(r===1?"Generating shot.":`Generating ${r} shots.`),a&&u.push(a===1?"Shot ready.":`${a} shots ready.`),l.length===1?u.push(`Shot failed${l[0]?`: ${l[0]}`:"."}`):l.length&&u.push(`${l.length} shots failed.`),i&&u.push(i===1?"Shot cancelled.":`${i} shots cancelled.`),{messages:u,next:n}}const Due=[{label:"Generate",keys:["cmd","enter"]},{label:"Jump to the prompt",keys:["/"]},{label:"Product menu",keys:["$"]},{label:"Scene menu",keys:["/"]},{label:"Presenter menu",keys:["@"]},{label:"Colour menu",keys:["#"]},{label:"Previous or next shot",keys:["←","→"]},{label:"Previous or next in the history",keys:["↑","↓"]},{label:"Refine this shot",keys:["b"]},{label:"Keep or unkeep",keys:["k"]},{label:"Open the shot",keys:["enter"]},{label:"Close, or stop refining",keys:["esc"]},{label:"Assets panel",keys:["."]},{label:"This list",keys:["?"]}];function Hue({open:e,onOpenChange:t}){return o.jsx(jw,{open:e,onOpenChange:t,children:o.jsxs(Aw,{maxWidth:"360px","aria-describedby":void 0,children:[o.jsx(Nw,{children:"Shortcuts"}),o.jsx("div",{className:"sc-keys",children:Due.map(n=>o.jsxs("div",{className:"sc-krow",children:[o.jsx("span",{children:n.label}),o.jsx("span",{className:"sc-ksp"}),n.keys.map(r=>o.jsx("kbd",{children:r},r))]},n.label))})]})})}function qy({img:e,ready:t,index:n=0,since:r,onDone:a}){const i=s.useRef(null),[l,u]=s.useState(!1);return s.useLayoutEffect(()=>{const f=i.current;if(!f||t)return;const h=j4(f,U0(f),n,null),p=f.getBoundingClientRect();h.size(p.width,p.height),h.draw(performance.now()/1e3);const g=m=>h.draw(m);return PM(g),()=>LM(g)},[t]),s.useLayoutEffect(()=>{const f=i.current,h=e.current;if(!f||!h||!t)return;const p=f.getBoundingClientRect(),g=performance.now(),m=r??g,w=cX(f,h,U0(f),n,p.width,p.height,m/1e3);let y=Math.min(w.ms,g-m);w.draw(y/w.ms);let b=g,k=requestAnimationFrame(function S(E){y+=Math.min(50,Math.max(0,E-b)),b=E;const C=Math.min(1,y/w.ms);w.draw(C),C<1?k=requestAnimationFrame(S):u(!0)});return()=>cancelAnimationFrame(k)},[t]),s.useEffect(()=>{l&&a()},[l,a]),o.jsx("canvas",{ref:i,className:"sc-arrival","aria-hidden":!0})}const b6=R4,Oue=P4;function Iue({src:e,fallback:t,alt:n="",aspect:r,guess:a=!0,arrival:i,index:l=0}){const[u,f]=s.useState(!1),h=u&&t?t:e,[p,g]=s.useState(!1),[m,w]=s.useState(!1),[y,b]=s.useState(()=>b6(h)),[k,S]=s.useState(h);h!==k&&(S(h),g(!1),w(!1),b(b6(h)));const E=s.useRef(null),C=s.useCallback(()=>{Oue(h),g(!0)},[h]),A=s.useCallback(j=>{E.current=j,j!=null&&j.complete&&j.naturalWidth&&C()},[C]);s.useLayoutEffect(()=>{const j=E.current;j!=null&&j.complete&&j.naturalWidth&&C()},[C]);const[L,T]=s.useState(()=>!i||hf()?null:b6(h)?T9(h)!==void 0?"run":null:"hold");L==="hold"&&p&&(S$.set(h,performance.now()),T("run"));const M=s.useCallback(()=>T(null),[]);return o.jsx("span",{className:"sc-cellimg","data-loaded":p||void 0,"data-cached":y||void 0,"data-guess":a||void 0,"data-broken":m||void 0,style:r?{"--sc-cell-ar":r}:void 0,children:m?o.jsx(Ta,{className:"sc-cellimg-broken",size:24,weight:"regular","aria-hidden":!0}):o.jsxs(o.Fragment,{children:[!p&&!y&&L!=="hold"&&o.jsx("span",{className:"sc-placeholder"}),o.jsx("img",{ref:A,src:h,alt:n,loading:y?"eager":"lazy",decoding:y?"sync":"async",onLoad:()=>C(),onError:()=>{t&&!u?f(!0):w(!0)}}),L&&o.jsx(qy,{img:E,ready:L==="run",index:l,since:T9(h),onDone:M})]})})}const S$=new Map,T9=e=>{const t=S$.get(e);return t!==void 0&&performance.now()-t<2e3?t:void 0};function E$({name:e}){return o.jsx(ad,{name:e})}function Fue({node:e,chosen:t,picking:n,batching:r,armed:a,menu:i,onPick:l,onBranch:u,onToggleKeep:f,onArchive:h,onDelete:p}){const g=Dr(e),m=Ww(),w=(b,k)=>VM(b,k,m),y=()=>{const b=e.images[0];if(!b)return;const k=e.promptHead.slice(0,40).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"")||"shot",S=document.createElement("a");S.href=Tr(b),S.download=`${k}.png`,S.click()};return o.jsxs(o.Fragment,{children:[!r&&o.jsx("span",{className:"sc-cell-veil","aria-hidden":!0}),n&&w(t?"Deselect":"Select",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-pick","data-on":t||void 0,"aria-pressed":t,"aria-label":t?"Deselect shot":"Select shot",onClick:()=>l==null?void 0:l(e.id),children:o.jsx(Kn,{size:13,weight:"bold"})})),a&&!n&&o.jsxs("span",{className:"sc-cell-ctl sc-cell-pick","data-on":!0,title:"Being refined",children:[o.jsx(Kn,{size:13,weight:"bold"}),o.jsx("span",{className:"sc-vh",children:"Being refined"})]}),o.jsx("div",{className:"sc-shot-tools",children:f&&o.jsxs("div",{className:"sc-corner",children:[i.length>0&&o.jsxs(Cs,{children:[w("More",o.jsx(js,{children:o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-more","aria-label":`More for ${g}`,children:o.jsx(Lv,{size:16,weight:"bold"})})})),o.jsx(As,{align:"end",sideOffset:4,collisionPadding:12,children:i.map(b=>o.jsxs("span",{style:{display:"contents"},children:[b.separated&&o.jsx(kc,{}),o.jsxs(qn,{color:b.danger?"red":void 0,onSelect:b.onSelect,children:[o.jsx(E$,{name:b.icon}),b.label]})]},b.key))})]}),u&&!r&&w("Refine",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-branch","data-on":a||void 0,"aria-label":`Refine ${g}`,onClick:()=>u(e.id),children:o.jsx(OE,{size:15,weight:"bold"})})),e.images[0]&&w("Download",o.jsx("button",{type:"button",className:"sc-cell-ctl","aria-label":`Download ${g}`,onClick:y,children:o.jsx(yE,{size:15})})),e.archived?p&&w("Delete permanently",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-danger","aria-label":`Delete ${g} permanently`,onClick:()=>p(e),children:o.jsx(Nl,{size:15})})):h&&w("Archive",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-danger","aria-label":`Archive ${g}`,onClick:()=>h(e),children:o.jsx(dm,{size:15})})),w(e.kept?"Remove from Keepers":"Add to Keepers",o.jsx("button",{type:"button",className:`sc-cell-ctl sc-cell-keep${e.kept?" sc-cell-star":""}`,"data-on":e.kept||void 0,"aria-pressed":e.kept,"aria-label":e.kept?`Remove ${g} from Keepers`:`Add ${g} to Keepers`,onClick:()=>f(e),children:o.jsx(eo,{size:15,weight:e.kept?"fill":"regular"})}))]})})]})}function C$(e,t){return e>1?`Remove ${e} shots from ${t}`:`Remove from ${t}`}function Wh(e,t,n){return e>1?n(e):t}function _ue(e,{chosen:t,batching:n,versions:r,onOpen:a,onBranch:i,onPick:l,onVersions:u,onToggleKeep:f,onArchive:h,onDeletePermanently:p,shotHref:g,inSet:m,filedIn:w,onRemoveFromSet:y,batch:b}){const k=[{key:"open",icon:"open",label:"Open",onSelect:()=>a(e.id)}];g&&k.push({key:"open-tab",icon:"open-tab",label:"Open in new tab",onSelect:()=>window.open(g(e.id),"_blank")}),i&&!n&&k.push({key:"branch",icon:"refine",label:"Refine",onSelect:()=>i(e.id)});const S=!!(n&&t&&b&&b.count>0),E=!!(S&&b&&b.count>1);l&&k.push({key:"pick",icon:"select",label:t?E?"Deselect this shot":"Deselect":"Select",onSelect:()=>l(e.id)});const C=M=>M?"Remove from Keepers":"Add to Keepers",A=(M,j)=>M?`Remove ${j} shots from Keepers`:`Add ${j} shots to Keepers`;S&&b?k.push({key:"keep",icon:b.allKept?"kept":"keep",label:Wh(b.count,C(b.allKept),M=>A(b.allKept,M)),onSelect:b.onKeep,separated:E}):f&&k.push({key:"keep",icon:e.kept?"kept":"keep",label:C(e.kept),onSelect:()=>f(e)});const L=S?b==null?void 0:b.onRemoveFromSet:y,T=S?m?[m]:[]:m?[m]:w??[];if(L)for(const M of T)k.push({key:`unset-${M.id}`,icon:"unset",label:C$(S&&b?b.count:1,M.name),onSelect:()=>L(M)});return r>0&&u&&!n&&k.push({key:"versions",icon:"versions",label:`Show ${r} version${r===1?"":"s"}`,onSelect:()=>u(e.id)}),S&&b?(k.push({key:"archive",icon:b.archived?"restore":"archive",label:b.archived?Wh(b.count,"Restore",M=>`Restore ${M} shots`):Wh(b.count,"Archive",M=>`Archive ${M} shots`),onSelect:b.archived?b.onRestore:b.onArchive,danger:!b.archived,separated:!0}),b.archived&&k.push({key:"delete",icon:"delete",label:Wh(b.count,"Delete permanently",M=>`Delete ${M} shots permanently`),onSelect:b.onDelete,danger:!0,separated:!0})):(h&&k.push({key:"archive",icon:e.archived?"restore":"archive",label:e.archived?"Restore":"Archive",onSelect:()=>h(e),danger:!e.archived,separated:!0}),p&&e.archived&&k.push({key:"delete",icon:"delete",label:"Delete permanently",onSelect:()=>p(e),danger:!0,separated:!0})),k}function j$(e,t){var r,a,i,l;const n=(i=(a=(r=e.brief)==null?void 0:r.rendered)==null?void 0:a.sizes)==null?void 0:i[t];return n&&n[0]>0&&n[1]>0?{aspect:n[0]/n[1],guess:!1}:{aspect:gi((l=e.brief)==null?void 0:l.format),guess:!0}}const Vue=s.memo(function({node:t,selected:n,armed:r,chosen:a,picking:i,batching:l,versions:u,handlers:f,inSet:h,filedIn:p,pickedMeta:g}){const m=_ue(t,{chosen:a,batching:l,versions:u,onOpen:f.onOpen,shotHref:f.shotHref,onBranch:f.onBranch,onPick:f.onPick,onVersions:f.onVersions,onToggleKeep:f.onToggleKeep,onArchive:f.onArchive,onDeletePermanently:f.onDeleteAsk,inSet:h,filedIn:p,onRemoveFromSet:f.onRemoveFromSet?w=>{var y;return(y=f.onRemoveFromSet)==null?void 0:y.call(f,t,w)}:void 0,batch:l&&a&&g&&f.onKeepPicked?{...g,onKeep:f.onKeepPicked,onArchive:f.onArchivePicked??(()=>{}),onRestore:f.onRestorePicked??(()=>{}),onDelete:f.onDeletePickedAsk??(()=>{}),onRemoveFromSet:f.onRemovePickedFromSet}:null});return o.jsxs(Xf,{children:[o.jsx(Qf,{children:o.jsxs("div",{className:"sc-cell","data-fb-node":t.id,"data-selected":n,"data-armed":r||void 0,"data-batching":l||void 0,"data-picked":a||void 0,children:[o.jsx(Vn,{className:"sc-cell-open",to:f.shotHref(t.id),"aria-label":l?`${a?"Deselect":"Select"} ${Dr(t)}`:`Open ${Dr(t)}`,onClick:w=>{var y;l&&(w.preventDefault(),(y=f.onPick)==null||y.call(f,t.id))},children:o.jsx(Iue,{src:gn(t.images[0],"tile"),fallback:Tr(t.images[0]),arrival:Zue(t),index:t.batchIndex,...j$(t,0)})}),o.jsx(Fue,{node:t,chosen:a,picking:i,batching:l,armed:r,menu:m,onPick:f.onPick,onBranch:f.onBranch,onToggleKeep:f.onToggleKeep,onArchive:f.onArchive,onDelete:f.onDeleteAsk})]})}),o.jsx(Jf,{children:m.map(w=>o.jsxs("span",{style:{display:"contents"},children:[w.separated&&o.jsx(_m,{}),o.jsxs(e1,{color:w.danger?"red":void 0,onSelect:w.onSelect,children:[o.jsx(E$,{name:w.icon}),w.label]})]},w.key))})]})});function Zue(e){const t=Ga(Ya(e));return Number.isFinite(t)&&Date.now()-(t+(e.durationMs??0))<9e4}const zue=s.memo(function({node:t,selected:n,shotHref:r,onCancel:a}){var i;return o.jsxs("div",{className:"sc-cell","data-running":"true","data-fb-node":t.id,"data-selected":n,style:{"--sc-cell-ar":gi((i=t.brief)==null?void 0:i.format)},children:[o.jsxs(Vn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${Dr(t)}, still rendering`,children:[o.jsx(Pa,{index:t.batchIndex,since:Ya(t)}),o.jsx(EL,{since:Ya(t)})]}),a&&o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-cancel",onClick:()=>a(t),children:"Cancel"})]})}),Bue=s.memo(function({node:t,selected:n,shotHref:r,engineName:a,onRetry:i,onArchive:l}){var h;const u=t.status==="cancelled",f=u?rM():co(t.error,a==null?void 0:a(t.engineId));return o.jsxs("div",{className:"sc-cell","data-fb-node":t.id,"data-cancelled":u||void 0,"data-failed":!u||void 0,"data-selected":n,style:(h=t.brief)!=null&&h.format?{"--sc-cell-ar":gi(t.brief.format)}:void 0,children:[o.jsx(Vn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${Dr(t)}`}),o.jsx("span",{className:"sc-cell-failed",children:o.jsx(KN,{failure:f,density:"tile",onRetry:()=>i(t),dismiss:l?{label:t.archived?"Restore":"Dismiss",onClick:()=>l(t)}:void 0})})]})}),Uue=40,Wue=1,D9=64,Kue=e=>e>Uue,Gue=e=>Math.floor(e/D9)*D9,Yue=112;function Kh(e,t,n){const r=Math.max(0,n-2),a=t&&t>0?t:4/5,i=Math.round(r/a)+2;return(e==="failed"&&n<=200?Math.max(i,Yue):i)+sd}function H9(e){const t=new Array(e.length+1);let n=0;for(let r=0;r<e.length;r++)t[r]=n,n+=e[r];return t[e.length]=n,t}function que(e,t,n){const r=e.length-1;if(r<=0||n<=t)return[0,0];let a=0,i=r;for(;a<i;){const u=a+i>>1;e[u+1]<=t?a=u+1:i=u}const l=a;for(a=l,i=r;a<i;){const u=a+i>>1;e[u]<n?a=u+1:i=u}return[l,a]}function O9(e,t){const n=Array.from({length:Math.max(1,t)},()=>[]);for(let r=0;r<e;r++)n[r%n.length].push(r);return n}function Xue(e,t){const n=t*Wue;return[e-n,e+t+n]}function Xy(e){const t=e.getBoundingClientRect().top,n=e.querySelector(".sc-toolbar");return n?Math.max(t,n.getBoundingClientRect().bottom):t}function Que(e,t){const[n,r]=s.useState(()=>({top:0,height:typeof window>"u"?0:window.innerHeight})),a=s.useRef(null),i=s.useRef(null),l=s.useRef((h,p=0)=>{i.current=h?{anchor:h,until:p}:null}).current,u=s.useRef(()=>{}),f=s.useRef(()=>u.current()).current;return s.useLayoutEffect(()=>{if(!e)return;const h=e.closest(".sc-canvas");if(!h)return;let p=0,g=0;const m=()=>{var S;const k=i.current;if(k&&performance.now()<k.until){a.current=k.anchor;return}i.current=null,a.current=h.scrollTop>0?Jue(e,Xy(h),(S=a.current)==null?void 0:S.id):null},w=()=>{if(p=0,t){const k=e.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop,S={top:Gue(h.scrollTop-k),height:h.clientHeight};r(E=>E.top===S.top&&E.height===S.height?E:S)}m(),cancelAnimationFrame(g),g=requestAnimationFrame(m)},y=()=>{p||(p=requestAnimationFrame(w))};u.current=w,w(),h.addEventListener("scroll",y,{passive:!0});const b=new ResizeObserver(y);return b.observe(h),b.observe(e),()=>{cancelAnimationFrame(p),cancelAnimationFrame(g),u.current=()=>{},h.removeEventListener("scroll",y),b.disconnect()}},[e,t]),{...n,anchor:a,resync:f,hold:l}}function Jue(e,t,n){let r=null,a=null;for(const l of e.querySelectorAll(".sc-cell[data-fb-node]")){const u=l.getBoundingClientRect();if(u.bottom<=t||u.height===0)continue;const f=l.getAttribute("data-fb-node");if(!f)continue;const h={id:f,top:u.top,left:u.left};if(u.top>=t-1){const p=!!r&&Math.abs(u.top-r.top)<=1;(!r||u.top<r.top-1||p&&r.id!==n&&(f===n||u.left<r.left))&&(r=h)}else(!a||u.left<a.left)&&(a=h)}const i=r??a;return i?{id:i.id,offset:i.top-t}:null}function ede(e,t,n){const r=s.useRef(new Map),[,a]=s.useState(0),i=s.useRef(null),l=s.useRef(new Set);return s.useLayoutEffect(()=>{if(!t)return;let u=0;const f=new ResizeObserver(h=>{let p=!1;for(const g of h){const m=g.target.getAttribute("data-fb-node");if(!m)continue;const w=g.target;if(w.offsetHeight<=2||w.offsetWidth<=2)continue;const y=(w.offsetHeight-2)/(w.offsetWidth-2),b=r.current.get(m);(b===void 0||Math.abs(b-y)>.004)&&(r.current.set(m,y),p=!0)}p&&!u&&(u=requestAnimationFrame(()=>{u=0,a(g=>g+1)}))});return i.current=f,()=>{cancelAnimationFrame(u),f.disconnect(),i.current=null,l.current=new Set}},[t]),s.useLayoutEffect(()=>{const u=i.current;if(!(!t||!u||!e)){for(const f of l.current)f.isConnected||(u.unobserve(f),l.current.delete(f));for(const f of e.querySelectorAll(".sc-cell[data-fb-node]"))l.current.has(f)||(l.current.add(f),u.observe(f))}}),s.useCallback(u=>{const f=r.current.get(u);return f===void 0?void 0:Math.round(f*Math.max(0,n-2))+2+sd},[n])}function tde({nodes:e,selectedId:t,onOpen:n,shotHref:r,onRetry:a,onCancel:i,onToggleKeep:l,onArchive:u,onDeletePermanently:f,picked:h,onPick:p,empty:g,sending:m,onBranch:w,branchingFrom:y,onVersions:b,engineName:k,tile:S,pending:E,onNearEnd:C,inSet:A,setsFor:L,onRemoveFromSet:T,onKeepPicked:M,onArchivePicked:j,onRestorePicked:P,onDeletePicked:R,onRemovePickedFromSet:H}){const D=e.filter(q=>q.kind!=="root"),B=!!p,V=B&&((h==null?void 0:h.size)??0)>0,U=s.useMemo(()=>{if(!h||h.size===0)return null;let q=0,oe=0,Re=0;for(const ze of e)!h.has(ze.id)||ze.kind==="root"||(q+=1,ze.kept&&(oe+=1),ze.archived&&(Re+=1));return{count:h.size,allKept:q>0&&oe===q,archived:q>0&&Re===q}},[e,h]),[K,O]=s.useState(null),[F,I]=s.useState(!1),[G,z]=s.useState(null),{tile:Y,cols:Z}=VX(FX(G),S,_X()<HX),[ee,pe]=s.useState(null);s.useEffect(()=>{if(!ee||!C)return;const q=ee.closest(".sc-canvas"),oe=new IntersectionObserver(Re=>{Re.some(ze=>ze.isIntersecting)&&C()},{root:q,rootMargin:"200% 0px"});return oe.observe(ee),()=>oe.disconnect()},[ee,C]);const se=s.useRef({onOpen:n,shotHref:r,onRetry:a,onCancel:i,onToggleKeep:l,onArchive:u,onBranch:w,onPick:p,onVersions:b,engineName:k,onRemoveFromSet:T,onKeepPicked:M,onArchivePicked:j,onRestorePicked:P,onDeletePicked:R,onRemovePickedFromSet:H});se.current={onOpen:n,shotHref:r,onRetry:a,onCancel:i,onToggleKeep:l,onArchive:u,onBranch:w,onPick:p,onVersions:b,engineName:k,onRemoveFromSet:T,onKeepPicked:M,onArchivePicked:j,onRestorePicked:P,onDeletePicked:R,onRemovePickedFromSet:H};const xe=!!f,J=!!R,te=s.useMemo(()=>({onOpen:q=>se.current.onOpen(q),shotHref:q=>se.current.shotHref(q),onRetry:q=>se.current.onRetry(q),onCancel:i?q=>{var oe,Re;return(Re=(oe=se.current).onCancel)==null?void 0:Re.call(oe,q)}:void 0,onToggleKeep:l?q=>{var oe,Re;return(Re=(oe=se.current).onToggleKeep)==null?void 0:Re.call(oe,q)}:void 0,onArchive:u?q=>{var oe,Re;return(Re=(oe=se.current).onArchive)==null?void 0:Re.call(oe,q)}:void 0,onBranch:w?q=>{var oe,Re;return(Re=(oe=se.current).onBranch)==null?void 0:Re.call(oe,q)}:void 0,onPick:p?q=>{var oe,Re;return(Re=(oe=se.current).onPick)==null?void 0:Re.call(oe,q)}:void 0,onVersions:b?q=>{var oe,Re;return(Re=(oe=se.current).onVersions)==null?void 0:Re.call(oe,q)}:void 0,onDeleteAsk:xe?q=>O(q):void 0,engineName:k?q=>{var oe,Re;return(Re=(oe=se.current).engineName)==null?void 0:Re.call(oe,q)}:void 0,onRemoveFromSet:T?(q,oe)=>{var Re,ze;return(ze=(Re=se.current).onRemoveFromSet)==null?void 0:ze.call(Re,q,oe)}:void 0,onKeepPicked:M?()=>{var q,oe;return(oe=(q=se.current).onKeepPicked)==null?void 0:oe.call(q)}:void 0,onArchivePicked:j?()=>{var q,oe;return(oe=(q=se.current).onArchivePicked)==null?void 0:oe.call(q)}:void 0,onRestorePicked:P?()=>{var q,oe;return(oe=(q=se.current).onRestorePicked)==null?void 0:oe.call(q)}:void 0,onDeletePickedAsk:J?()=>I(!0):void 0,onRemovePickedFromSet:H?q=>{var oe,Re;return(Re=(oe=se.current).onRemovePickedFromSet)==null?void 0:Re.call(oe,q)}:void 0}),[!!i,!!l,!!u,!!w,!!p,!!b,xe,J,!!k,!!T,!!M,!!j,!!P,!!H]),X=[...m?Array.from({length:Math.max(1,m.count)},(q,oe)=>({key:`sending-${oe}`,node:null,said:m.said,slot:oe})):[],...D.map(q=>({key:q.id,node:q}))],ae=q=>q.status==="cancelled"||q.status==="error"||q.images.length===0,Le=q=>{const oe=q.node;return oe?oe.status==="running"?o.jsx(zue,{node:oe,selected:oe.id===t,shotHref:te.shotHref,onCancel:te.onCancel},oe.id):ae(oe)?o.jsx(Bue,{node:oe,selected:oe.id===t,shotHref:te.shotHref,engineName:te.engineName,onRetry:te.onRetry,onArchive:te.onArchive},oe.id):o.jsx(Vue,{node:oe,selected:oe.id===t,armed:oe.id===y,chosen:(h==null?void 0:h.has(oe.id))??!1,picking:B,batching:V,versions:oe.childCount,handlers:te,inSet:A,filedIn:L==null?void 0:L(oe.id),pickedMeta:U},oe.id):o.jsxs("div",{className:"sc-cell","data-running":"true","data-sending":"true",style:m!=null&&m.format?{"--sc-cell-ar":gi(m.format)}:void 0,children:[o.jsx(Pa,{index:q.slot,appear:!0}),o.jsx("span",{className:"sc-cell-tag",children:"sending"}),o.jsx("span",{className:"sc-cell-said",dir:"auto",children:q.said})]},q.key)},ce=q=>{var Re,ze;const oe=q.node;return oe?oe.status==="running"?Kh("running",gi((Re=oe.brief)==null?void 0:Re.format),Y):ae(oe)?Kh("failed",(ze=oe.brief)!=null&&ze.format?gi(oe.brief.format):3/2,Y):Kh("done",j$(oe,0).aspect,Y):Kh("sending",void 0,Y)},Se=Kue(X.length),Ze=Que(G,Se),gt=ede(G,Se,Y),Ke=ek(Z),nt=`${Ke}:${Y}`,$e=s.useRef(nt),ne=s.useRef({items:X,heightOf:gt,estimate:ce});ne.current={items:X,heightOf:gt,estimate:ce};const Q=s.useRef(null);if(s.useLayoutEffect(()=>{const q=$e.current;$e.current=nt;const oe=Ze.anchor.current,Re=G==null?void 0:G.closest(".sc-canvas");if(!(q===nt||!oe||!G||!Re)){if(Q.current={anchor:oe,until:performance.now()+nde},Ze.hold(oe,Q.current.until),!I9(G,Re,oe)){const{items:ze,heightOf:Ye,estimate:Ie}=ne.current,De=ze.findIndex(at=>{var Zt;return((Zt=at.node)==null?void 0:Zt.id)===oe.id});if(De<0)return;const Ge=O9(ze.length,Ke)[De%Ke],ft=H9(Ge.map(at=>(ze[at].node&&Ye(ze[at].node.id))??Ie(ze[at]))),bt=G.getBoundingClientRect().top+ft[Math.floor(De/Ke)];Re.scrollTop+=bt-Xy(Re)-oe.offset}Ze.resync()}},[nt,Ke,G,Ze.anchor,Ze.resync,Ze.hold]),s.useLayoutEffect(()=>{const q=Q.current,oe=G==null?void 0:G.closest(".sc-canvas");if(!(!q||!G||!oe)){if(performance.now()>q.until){Q.current=null;return}I9(G,oe,q.anchor)}}),s.useEffect(()=>{const q=G==null?void 0:G.closest(".sc-canvas");if(!q)return;const oe=()=>{Q.current=null,Ze.hold(null)},Re=["wheel","touchstart","keydown","pointerdown"];for(const ze of Re)q.addEventListener(ze,oe,{passive:!0});return()=>{for(const ze of Re)q.removeEventListener(ze,oe)}},[G,Ze.hold]),E&&j5(D)&&!m){const q=Math.max(1,Math.min(Z,8));return o.jsx("div",{className:"sc-feed","aria-busy":"true",ref:z,style:{"--sc-tile":`${Y}px`,"--sc-cols":q},children:Array.from({length:q},(oe,Re)=>o.jsx("div",{className:"sc-feed-col",children:Array.from({length:2},(ze,Ye)=>o.jsx("div",{className:"sc-cell sc-wait-late","data-placeholder":"true",children:o.jsx("span",{className:"sc-placeholder"})},`pending-${Re}-${Ye}`))},`col-${q}-${Re}`))})}if(j5(D)&&!m)return o.jsx(o.Fragment,{children:g??o.jsx("p",{className:"sc-feed-empty",children:"Nothing here yet."})});const We=ek(Z),Ne=O9(X.length,We),ie=Se?Xue(Ze.top,Ze.height):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-feed",ref:z,style:{"--sc-tile":`${Y}px`,"--sc-cols":We},children:Ne.map((q,oe)=>{const Re=`col-${We}-${oe}`;if(!ie)return o.jsx("div",{className:"sc-feed-col",children:q.map(Ge=>Le(X[Ge]))},Re);const ze=q.map(Ge=>(X[Ge].node&&gt(X[Ge].node.id))??ce(X[Ge])),Ye=H9(ze),[Ie,De]=que(Ye,ie[0],ie[1]);return o.jsxs("div",{className:"sc-feed-col",children:[Ie>0&&o.jsx("div",{className:"sc-feed-pad",style:{height:Ye[Ie]},"aria-hidden":!0}),q.slice(Ie,De).map(Ge=>Le(X[Ge])),De<q.length&&o.jsx("div",{className:"sc-feed-pad",style:{height:Ye[q.length]-Ye[De]},"aria-hidden":!0})]},Re)})}),C&&o.jsx("div",{className:"sc-feed-end",ref:pe,"aria-hidden":!0}),o.jsx(Bf,{open:!!K||F,onOpenChange:q=>{q||(O(null),I(!1))},children:o.jsxs(Uf,{maxWidth:"420px",children:[o.jsx(Wf,{children:F?`Delete ${(U==null?void 0:U.count)??0} shot${((U==null?void 0:U.count)??0)===1?"":"s"} permanently?`:"Delete this shot permanently?"}),o.jsx(Kf,{size:"2",children:"This cannot be undone."}),o.jsxs(Vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Yf,{children:o.jsx(Sa,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Gf,{children:o.jsx(Sa,{color:"red",onClick:()=>{F?R==null||R():K&&(f==null||f(K)),O(null),I(!1)},children:"Delete permanently"})})]})]})})]})}const nde=800;function I9(e,t,n){const r=e.querySelector(`.sc-cell[data-fb-node="${CSS.escape(n.id)}"]`);if(!r)return!1;const a=r.getBoundingClientRect().top-Xy(t)-n.offset;return Math.abs(a)>=1&&(t.scrollTop+=a),!0}function rde(e){return e==="open"||e==="result"?"open":"compact"}function uv({name:e,kind:t,count:n,mode:r,onToggle:a,action:i,children:l}){const u=rde(r);return o.jsxs("div",{className:"sc-agroup","data-mode":r,"data-kind":t,children:[o.jsxs("div",{className:"sc-agroup-h",children:[o.jsxs("button",{type:"button",className:"sc-agroup-t","aria-expanded":r==="open",onClick:a,children:[o.jsx("b",{children:e}),n!==void 0&&n>0&&o.jsx("span",{className:"sc-agroup-n",children:n}),o.jsx(bl,{size:11,className:"sc-agroup-caret","aria-hidden":"true"})]}),i]}),o.jsx("div",{className:"sc-agroup-body",children:o.jsx("div",{className:"sc-agroup-content",children:o.jsx("div",{className:"sc-agroup-layer",children:l(u)},u)})})]})}function A$({candidate:e,on:t,named:n,disabled:r,title:a,onClick:i}){const l=o.jsxs("button",{type:"button",className:"sc-acard","data-on":t||void 0,"aria-label":e.full,"aria-pressed":t,"aria-disabled":r||void 0,title:r?void 0:e.full,onClick:r?void 0:i,children:[o.jsxs("span",{className:"sc-acard-thumb",children:[e.thumb?o.jsx("img",{src:e.thumb,alt:"",loading:"lazy","data-crop":e.crop}):o.jsx("span",{className:"sc-aswatch",style:{display:"grid",placeItems:"center"},children:o.jsx(Ta,{size:14})}),o.jsx("span",{className:"sc-acard-tick","aria-hidden":!0,children:o.jsx(Kn,{size:10,weight:"bold"})})]}),n&&o.jsxs("span",{className:"sc-acard-label",children:[e.bookmarked&&o.jsxs(o.Fragment,{children:[o.jsx(eo,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Kept. "})]}),e.label]})]});return o.jsx(uL,{why:r?a:null,children:l})}function x6({kind:e,title:t,items:n,attached:r,mode:a,onToggle:i,onPick:l,onUnpick:u,full:f,moreLabel:h,createLabel:p,onCreate:g}){const m=s.useMemo(()=>new Set(r),[r]),[w,y]=s.useState(Xp);return s.useEffect(()=>{a!=="open"&&y(Xp)},[a]),a==="result"&&n.length===0?null:o.jsx(uv,{name:t,kind:e,count:n.length,mode:a,onToggle:()=>i(e),action:o.jsx("button",{type:"button",className:"sc-aadd",title:p,"aria-label":p,onClick:g,children:o.jsx(pr,{size:10})}),children:b=>{const{visible:k,more:S}=sie(n,m,b==="open"?w:tv);return o.jsxs("div",{className:b==="open"?"sc-acard-grid":"sc-arow",children:[k.map(E=>o.jsx(A$,{candidate:E,on:m.has(E.id),named:b==="open",disabled:!!f&&!m.has(E.id),title:f??void 0,onClick:()=>m.has(E.id)?u(E.id):l(E.id)},E.id)),b==="open"&&S>0&&o.jsxs("button",{type:"button",className:"sc-amore-tile",onClick:()=>y(E=>E+Y0),"aria-label":`Show ${Math.min(S,Y0)} more ${h}`,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",S]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})}})}const F9=220,_9="cubic-bezier(0.32, 0.72, 0, 1)";function k6(e){const t=[];for(const n of e.querySelectorAll(".sc-agroup")){const r=n.querySelector(":scope > .sc-agroup-body");r&&t.push({group:n,body:r,height:r.getBoundingClientRect().height,marginBottom:Number.parseFloat(getComputedStyle(n).marginBottom)||0})}return t}function sde(e,t){const n=s.useRef(null),r=()=>{const a=e.current;if(!(!a||window.matchMedia("(prefers-reduced-motion: reduce)").matches)){for(const i of k6(a))for(const l of[...i.body.getAnimations(),...i.group.getAnimations()])l.finish();n.current=k6(a)}};return s.useLayoutEffect(()=>{const a=n.current;n.current=null;const i=e.current;if(!(!a||!i))for(const l of k6(i)){const u=a.find(f=>f.group===l.group);if(u){if(Math.abs(u.height-l.height)>.5){const{body:f}=l;f.style.overflow="hidden";const h=f.animate([{height:`${u.height}px`},{height:`${l.height}px`}],{duration:F9,easing:_9}),p=()=>{f.style.overflow=""};h.onfinish=p,h.oncancel=p}Math.abs(u.marginBottom-l.marginBottom)>.5&&l.group.animate([{marginBottom:`${u.marginBottom}px`},{marginBottom:`${l.marginBottom}px`}],{duration:F9,easing:_9})}}},[t]),r}function ade({brand:e,shots:t,shotsTotal:n,attached:r=vL,full:a,onToken:i,offToken:l,onTemplate:u,offTemplate:f,onClose:h}){const p=d1(),g=Vl(),{applyBrand:m}=Nn(),{push:w}=rr(),[y,b]=EG(qr.assetsExpanded,null),k=s.useRef(null),S=sde(k,y),E=Z=>{S(),b(ee=>ee===Z?null:Z)},[C,A]=s.useState(""),L=C.trim().length>0,T=Z=>{S(),A(""),b(Z)},M=Z=>L?"result":y===null?"idle":y===Z?"open":"collapsed",j=s.useMemo(()=>new Set(Ci(e.id)),[e.id]),P=s.useMemo(()=>{const Z=ee=>{const pe=hl(ee,p);return f2(ee,pe,{currentId:null,query:"",bookmarked:j,shown:pe.length}).items};return{product:Z("product"),presenter:Z("presenter"),scene:Z("scene")}},[p,j]),R=s.useMemo(()=>({product:dd(P.product,C),presenter:dd(P.presenter,C),scene:dd(P.scene,C)}),[P,C]),H=s.useMemo(()=>{var Z;return ra((Z=e.json)==null?void 0:Z.palette)},[e]),D=s.useMemo(()=>L?H.filter(Z=>Ho(`${Z.name} ${Z.hex}`,C)):H,[H,C,L]),B=Z=>{(async()=>{var pe;const ee=dR((pe=e.json)==null?void 0:pe.palette,Z);if(ee.swatch){if(ee.added)try{const se=await Ee.updateBrand(e.id,{...e.json??{},palette:ee.palette},e.json);m(se)}catch(se){w(ln(se,"Could not save the brand"));return}T("colors")}})()},V=Z=>{(async()=>{var pe;const ee=ZQ((pe=e.json)==null?void 0:pe.palette,Z);if(ee.removed)try{const se=await Ee.updateBrand(e.id,{...e.json??{},palette:ee.palette},e.json);m(se)}catch(se){w(ln(se,"Could not save the brand"))}})()},U=M("shots")==="open",K=Ny(e.id,"",U),O=s.useMemo(()=>{const Z=new Set,ee=[];for(const pe of[...t,...K.items])pe.status!=="done"||pe.images.length===0||Z.has(pe.id)||(Z.add(pe.id),ee.push(pe));return ee},[t,K.items]),F=Math.max(n??0,K.total,O.length),[I,G]=s.useState(Xp);s.useEffect(()=>{U||G(Xp)},[U]);const z=()=>{G(Z=>Z+Y0),K.hasMore&&O.length<I+2*Y0&&K.loadMore()},Y=L&&!R.product.length&&!R.presenter.length&&!R.scene.length&&!D.length;return o.jsxs("aside",{ref:k,className:"sc-assets","aria-label":"Assets",children:[o.jsxs("div",{className:"sc-assets-head",children:[o.jsx("b",{children:"Assets"}),o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:h,"aria-label":"Close assets",style:{width:28,height:28},children:o.jsx(jn,{size:12})})]}),o.jsx("div",{className:"sc-assets-searchbar",children:o.jsxs("div",{className:"sc-assets-search",children:[o.jsx(hd,{size:12}),o.jsx("input",{value:C,onChange:Z=>A(Z.target.value),onKeyDown:Z=>{Z.key==="Escape"&&C&&(Z.stopPropagation(),A(""))},placeholder:"Search assets","aria-label":"Search assets in this panel"}),L&&o.jsx("button",{type:"button",className:"sc-assets-clear",onClick:()=>A(""),"aria-label":"Clear search",children:o.jsx(jn,{size:11})})]})}),Y&&o.jsxs("p",{className:"sc-assets-zero",children:["Nothing here matches “",C.trim(),"”."]}),o.jsx(x6,{kind:"product",title:"Products",items:R.product,attached:r.product,mode:M("product"),onToggle:E,onPick:Z=>i({t:"product",id:Z}),onUnpick:Z=>l({t:"product",id:Z}),full:a,moreLabel:"products",createLabel:"Add product",onCreate:()=>g("product",{onCreated:Z=>{Z.kind==="product"&&(T("product"),i({t:"product",id:Z.id}))}})}),o.jsx(x6,{kind:"presenter",title:"Presenters",items:R.presenter,attached:r.presenter,mode:M("presenter"),onToggle:E,onPick:Z=>i({t:"character",id:Z}),onUnpick:Z=>l({t:"character",id:Z}),full:a,moreLabel:"presenters",createLabel:"Create presenter",onCreate:()=>g("presenter",{onCreated:()=>T("presenter")})}),o.jsx(x6,{kind:"scene",title:"Scenes",items:R.scene,attached:r.scene?[r.scene]:[],mode:M("scene"),onToggle:E,onPick:u,onUnpick:()=>f(),full:a,moreLabel:"scenes",createLabel:"Create scene",onCreate:()=>g("scene",{onCreated:Z=>{Z.kind==="scene"&&T("scene")}})}),!(L&&D.length===0)&&o.jsx(uv,{name:"Brand colors",count:D.length,mode:M("colors"),onToggle:()=>E("colors"),action:o.jsx(bd,{className:"sc-aadd",triggerStyle:{background:"none"},value:n2(H),presets:H.map(Z=>Z.hex),commitMode:"close",align:"end",label:"Add colour",onChange:B,children:o.jsx(pr,{size:10})}),children:Z=>o.jsx("div",{className:"sc-arow",children:(Z==="open"?D:D.slice(0,tv)).map(ee=>{const pe=r.color.includes(ee.hex.toLowerCase());return o.jsxs("div",{className:"sc-aswatch-tile","data-on":pe||void 0,children:[o.jsxs("button",{type:"button",title:`${ee.name} ${ee.hex}`,"aria-pressed":pe,onClick:()=>pe?l({t:"color",hex:ee.hex,name:ee.name}):i({t:"color",hex:ee.hex,name:ee.name}),children:[o.jsx("span",{className:"sc-aswatch",style:{background:ee.hex}}),o.jsx("span",{className:"sc-acard-tick","aria-hidden":!0,children:o.jsx(Kn,{size:10,weight:"bold"})})]}),Z==="open"&&o.jsx("button",{type:"button",className:"sc-aswatch-x","aria-label":`Remove ${ee.name}`,title:"Remove",onClick:()=>V(ee.hex),children:o.jsx(jn,{size:10,weight:"bold"})})]},ee.hex)})})}),O.length>0&&!L&&o.jsx(uv,{name:"Recent shots",count:F,mode:M("shots"),onToggle:()=>E("shots"),children:Z=>o.jsxs("div",{className:Z==="open"?"sc-acard-grid":"sc-arow",children:[O.slice(0,Z==="open"?I:tv).map((ee,pe)=>{const se=ee.images[0],xe=r.ref.includes(se);return o.jsx(A$,{candidate:{label:`Shot ${F-pe}`,full:`Shot ${F-pe} · as reference`,thumb:gn(se,"micro")},on:xe,named:Z==="open",disabled:!!a&&!xe,title:a??void 0,onClick:()=>xe?l({t:"ref",imageHash:se}):i({t:"ref",imageHash:se,label:"Shot"})},ee.id)}),Z==="open"&&(O.length>I||K.hasMore)&&o.jsxs("button",{type:"button",className:"sc-amore-tile",onClick:z,"aria-label":`Show ${Y0} more shots`,"aria-busy":K.loading||void 0,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",Math.max(1,F-Math.min(O.length,I))]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})})]})}function ode({sets:e,active:t,ungrouped:n,ungroupedCount:r,onPlaceAll:a,onPlaceUngrouped:i,onOpenSet:l,onNewSet:u,onResetNewSet:f,onRenameSet:h,onDeleteSet:p,askCreate:g,lens:m,lensCounts:w,onLens:y,q:b,onQ:k,searchTotal:S,sort:E,onSort:C,tile:A,onTile:L,assets:T,onAssets:M,showAssets:j}){const P=t?t.id:n?"__ungrouped__":"__all__",R=t?t.name:n?"Not in a set":"All shots",H=!!t||n,D=Nr(la),[B,V]=s.useState(!1),[U,K]=s.useState(!1),[O,F]=s.useState(!1),[I,G]=s.useState(""),z=s.useRef(null),Y=s.useRef(!1),Z=()=>{Y.current=!0,K(!0),G(""),V(!0)},ee=()=>{t&&(Y.current=!1,K(!1),G(t.name),V(!0))};s.useEffect(()=>{g&&Z()},[g]);const pe=()=>{const ae=I.trim();if(!ae)return;const Le=Y.current;Y.current=!1,K(!1),V(!1),Le?u(ae):h==null||h(ae)},se=ae=>{if(ae){V(!0);return}const Le=Y.current;Y.current=!1,K(!1),V(!1),Le&&(f==null||f())},xe=HN.map(ae=>({value:ae.id==="all"?null:ae.id,label:ae.label,count:w==null?void 0:w[ae.id]})),J=o.jsxs(o.Fragment,{children:[o.jsxs(Ep,{value:P,children:[o.jsx(Wu,{value:"__all__",onSelect:a,children:"All shots"}),o.jsxs(Wu,{value:"__ungrouped__",onSelect:i,children:["Not in a set",r>0?` · ${r}`:""]}),e.length>0&&o.jsx(kc,{}),e.map(ae=>o.jsx(Wu,{value:ae.id,onSelect:()=>l(ae),children:ae.name},ae.id))]}),o.jsx(kc,{}),o.jsx(qn,{onSelect:()=>{f==null||f(),Z()},children:"New set"}),t&&h&&o.jsx(qn,{onSelect:ee,children:"Rename"}),t&&p&&o.jsx(qn,{color:"red",onSelect:()=>F(!0),children:"Delete set"})]}),te=o.jsx(Ep,{value:E,onValueChange:ae=>C(ae),children:DN.map(ae=>o.jsx(Wu,{value:ae.id,children:ae.label},ae.id))}),X=H||E!=="newest";return o.jsxs("div",{className:"sc-toolbar",children:[o.jsxs("div",{className:"sc-toolbar-scope",children:[!D&&o.jsxs("div",{className:"sc-toolbar-where",children:[H&&o.jsx("button",{type:"button",className:"sc-toolbar-back","aria-label":"All shots",onClick:a,children:o.jsx($a,{size:16})}),o.jsxs(Cs,{children:[o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-place","data-on":H||void 0,"aria-label":R,children:[o.jsx($v,{className:"sc-toolbar-place-ic",size:16}),o.jsx("span",{className:"sc-toolbar-place-t",children:R}),o.jsx(bl,{size:10,className:"sc-caret"})]})}),o.jsx(As,{align:"start",children:J})]})]}),o.jsx(jw,{open:B,onOpenChange:se,children:o.jsxs(Aw,{maxWidth:"360px","aria-describedby":void 0,onOpenAutoFocus:ae=>{ae.preventDefault();const Le=z.current;Le&&(Le.focus(),Le.select())},children:[o.jsx(Nw,{children:U?"Name this set":"Rename set"}),o.jsx("input",{ref:z,className:"sc-in",style:{width:"100%",marginTop:8},value:I,"aria-label":"Set name",onChange:ae=>G(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&pe()}}),o.jsxs(Vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Sa,{variant:"soft",color:"gray",onClick:()=>se(!1),children:"Cancel"}),o.jsx(Sa,{onClick:pe,disabled:!I.trim(),children:"Save"})]})]})}),o.jsx(Bf,{open:O,onOpenChange:F,children:o.jsxs(Uf,{maxWidth:"420px",children:[o.jsx(Wf,{children:"Delete this set?"}),o.jsx(Kf,{size:"2",children:"Shots stay in the library. Only the set goes."}),o.jsxs(Vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Yf,{children:o.jsx(Sa,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Gf,{children:o.jsx(Sa,{color:"red",onClick:()=>{p==null||p(),F(!1)},children:"Delete set"})})]})]})}),o.jsx(Ay,{"aria-label":"Shot lenses",activeKey:m==="all"?null:m,items:xe,onSelect:ae=>y(ae??"all")})]}),o.jsxs("div",{className:"sc-toolbar-actions",children:[o.jsx(Fd,{value:b,onChange:k,noun:"shots",total:S}),D?o.jsxs(Cs,{children:[o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-btn sc-toolbar-view","data-on":X||void 0,"aria-label":`Set and sort: ${R}`,children:[o.jsx(Tv,{size:15}),X&&o.jsx("span",{className:"sc-toolbar-view-dot","aria-hidden":!0})]})}),o.jsxs(As,{align:"end",children:[o.jsx(i4,{children:"Set"}),J,o.jsx(kc,{}),o.jsx(i4,{children:"Sort"}),te]})]}):o.jsxs(Cs,{children:[o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-btn","aria-label":"Sort shots",children:[o.jsx(YI,{size:14}),o.jsx("span",{className:"sc-toolbar-btn-t",children:"Sort"}),o.jsx(bl,{size:10})]})}),o.jsx(As,{align:"end",children:te})]}),o.jsx(BX,{value:A,onChange:L}),j&&o.jsx("button",{type:"button",className:"sc-icon-btn sc-toolbar-assets","data-on":T||void 0,onClick:M,"aria-label":"Assets panel","aria-pressed":T,title:"Assets panel (.)",children:o.jsx(yF,{size:15,mirrored:!0})})]})]})}function ide(e){const{push:t}=rr(),n=s.useCallback(l=>Ee.archiveNode(l.id,!0).then(u=>(e(u),t({kind:"success",title:"Archived",detail:Dr(l),action:{label:"Undo",onClick:()=>void Ee.archiveNode(l.id,!1).then(e)}}),!0)).catch(u=>(t(ln(u,"Could not archive this shot")),!1)),[e,t]),r=s.useCallback(l=>Ee.archiveNode(l.id,!1).then(u=>(e(u),!0)).catch(u=>(t(ln(u,"Could not restore this shot")),!1)),[e,t]),a=s.useCallback(l=>Promise.all(l.map(u=>Ee.archiveNode(u,!0))).then(u=>{for(const f of u)e(f);return t({kind:"success",title:`Archived ${u.length} shot${u.length===1?"":"s"}`,action:{label:"Undo",onClick:()=>{Promise.all(u.map(f=>Ee.archiveNode(f.id,!1))).then(f=>{for(const h of f)e(h)})}}}),!0}).catch(u=>(t(ln(u,"Could not archive these shots")),!1)),[e,t]),i=s.useCallback(l=>Promise.all(l.map(u=>Ee.archiveNode(u,!1))).then(u=>{for(const f of u)e(f);return!0}).catch(u=>(t(ln(u,"Could not restore these shots")),!1)),[e,t]);return{archive:n,archiveBatch:a,unarchive:r,unarchiveBatch:i}}function lde(e){const{push:t}=rr(),n=s.useCallback(a=>Ee.deleteNode(a.id).then(()=>e([a.id])).catch(i=>t(ln(i,"Could not delete this shot"))),[e,t]),r=s.useCallback(a=>Ee.deleteNodesBatch(a).then(()=>e(a)).catch(i=>t(ln(i,"Could not delete these shots"))),[e,t]);return{remove:n,removeBatch:r}}function cde(e,{demoProducts:t,presenters:n,scenes:r}){var f,h,p,g;const a=((f=e.brief)==null?void 0:f.tokens)??[],i=(h=a.find(m=>(m==null?void 0:m.t)==="product"))==null?void 0:h.id,l=(p=a.find(m=>(m==null?void 0:m.t)==="character"))==null?void 0:p.id,u=(g=a.find(m=>(m==null?void 0:m.t)==="template"))==null?void 0:g.id;return{product:i?t.find(m=>m.id===i):void 0,presenter:l?n.find(m=>m.id===l):void 0,scene:u?r.find(m=>m.id===u):void 0}}function ude(e,t){const{product:n,presenter:r,scene:a}=cde(e,t);return{productName:n?Do(n,"chip"):null,productPreviewUrl:(n==null?void 0:n.previewUrl)??null,productId:(n==null?void 0:n.id)??null,presenterName:(r==null?void 0:r.name)??null,presenterPreviewUrl:r?ki(r).src:null,presenterId:(r==null?void 0:r.id)??null,sceneName:a?El(a,"chip"):null,scenePreviewUrl:(a==null?void 0:a.previewUrl)??null,sceneId:(a==null?void 0:a.id)??null}}function dde(e){const t=s.useRef(null),n=s.useRef(0),r=s.useRef(null),a=s.useRef(0),i=s.useCallback(()=>{const h=t.current;h&&(n.current=h.scrollWidth/3)},[]);s.useEffect(()=>{const h=t.current;if(!h||!e)return;i(),h.scrollLeft=n.current;const p=new ResizeObserver(()=>{const g=n.current;i(),g<=0&&n.current>0&&(h.scrollLeft=n.current)});p.observe(h);for(const g of h.children)p.observe(g);return()=>p.disconnect()},[e,i]);const l=s.useCallback(()=>{const h=t.current,p=n.current;!h||p<=0||(h.scrollLeft<p*.5?(h.scrollLeft+=p,r.current!==null&&(r.current+=p)):h.scrollLeft>p*1.5&&(h.scrollLeft-=p,r.current!==null&&(r.current-=p)))},[]),u=s.useCallback(()=>{r.current=null,cancelAnimationFrame(a.current)},[]);s.useEffect(()=>{const h=t.current;if(!h)return;let p=0;const g=()=>{p||(p=requestAnimationFrame(()=>{p=0,l()}))},m=y=>{Math.abs(y.deltaY)<=Math.abs(y.deltaX)||(y.preventDefault(),u(),h.scrollLeft+=y.deltaY)},w=y=>{y.target.closest(".sc-shelf-arrow")||u()};return h.addEventListener("scroll",g,{passive:!0}),h.addEventListener("wheel",m,{passive:!1}),h.addEventListener("pointerdown",w),()=>{p&&cancelAnimationFrame(p),u(),h.removeEventListener("scroll",g),h.removeEventListener("wheel",m),h.removeEventListener("pointerdown",w)}},[u,l]);const f=s.useCallback(h=>{const p=t.current,g=p==null?void 0:p.firstElementChild;if(!p||!g)return;const m=g.offsetWidth||232,w=Number.parseFloat(getComputedStyle(p).columnGap)||0,y=m+w,b=r.current??p.scrollLeft;r.current=b+y*h;const k=()=>{u()};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){p.scrollLeft=r.current,k(),l();return}cancelAnimationFrame(a.current);let S=0;const E=()=>{const C=r.current;if(C===null)return;const A=C-p.scrollLeft;if(S+=1,Math.abs(A)<.5||S>45){p.scrollLeft=C,k(),l();return}p.scrollLeft+=A*.16,a.current=requestAnimationFrame(E)};a.current=requestAnimationFrame(E)},[u,l]);return{ref:t,page:f}}function fde(e){const t=[...e];for(let n=t.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[t[n],t[r]]=[t[r],t[n]]}return t}function hde({entries:e,catalogs:t,stagedId:n,onUse:r,productHref:a,presenterHref:i,sceneHref:l}){const u=s.useMemo(()=>fde(e).slice(0,10),[e]),{ref:f,page:h}=dde(u.length);return o.jsxs("div",{className:"sc-canvas-empty",children:[o.jsxs("h3",{children:["Your first ",o.jsx("em",{children:"shot"})]}),o.jsx("p",{children:"Describe what you want in the prompt below, or open one of these."}),u.length>0&&o.jsxs("div",{className:"sc-shelf",children:[o.jsx("button",{type:"button",className:"sc-shelf-arrow prev","aria-label":"Previous examples",onClick:()=>h(-1),children:o.jsx($a,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-shelf-arrow next","aria-label":"More examples",onClick:()=>h(1),children:o.jsx(Al,{size:13,weight:"bold"})}),o.jsx("div",{className:"sc-shelf-row",ref:f,children:[0,1,2].map(p=>u.map(g=>o.jsx(yL,{entry:g,size:"grid",hideRecipe:!0,decorative:p!==1,active:n===g.id,onOpen:()=>r(g),productHref:a,presenterHref:i,sceneHref:l,...ude(g,t)},`${p}-${g.id}`)))})]})]})}function N0({text:e,onAll:t,actionLabel:n="Show all shots"}){return o.jsxs("div",{className:"sc-feed-empty",children:[o.jsx("p",{children:e}),t&&o.jsx("button",{type:"button",className:"sc-btn",onClick:t,children:n})]})}function pde({count:e,sets:t,activeSet:n,onAdd:r,onRemove:a,onNew:i,onClear:l,onKeep:u,onArchiveBatch:f,allKept:h,archivedLens:p,pickedIds:g,onRestoreBatch:m,onDeleteBatch:w,loaded:y,onSelectAll:b}){const[k,S]=s.useState(!1);return o.jsxs("div",{className:"sc-picked","data-lens":p?"archived":void 0,role:"toolbar","aria-label":"Selection",children:[o.jsxs("span",{className:"sc-picked-meta",children:[o.jsxs("span",{className:"sc-picked-n",role:"status",children:[e,o.jsx("span",{className:"sc-vh",children:" selected"})]}),y>1&&o.jsx("button",{type:"button",className:"sc-picked-all",onClick:e<y?b:l,children:e<y?"Select all":"Deselect all"})]}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-tools",children:p?o.jsxs(o.Fragment,{children:[o.jsx(Du,{label:"Restore",onClick:()=>m(g),children:o.jsx(ef,{size:17})}),o.jsx(Du,{label:`Delete ${e} permanently`,tone:"danger",onClick:()=>S(!0),children:o.jsx(Nl,{size:17})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Du,{label:h?"Remove from keepers":"Keep",onClick:u,children:o.jsx(eo,{size:17,weight:h?"fill":"regular"})}),o.jsxs(Cs,{children:[o.jsx(fr,{label:"Add to set",children:o.jsx(js,{children:o.jsx("button",{type:"button",className:"sc-picked-tool","aria-label":"Add to set",children:o.jsx($v,{size:17})})})}),o.jsxs(As,{children:[t.filter(E=>E.id!==(n==null?void 0:n.id)).map(E=>o.jsx(qn,{onSelect:()=>r(E),children:E.name},E.id)),t.some(E=>E.id!==(n==null?void 0:n.id))&&o.jsx(kc,{}),o.jsx(qn,{onSelect:i,children:"New set…"})]})]}),n&&a&&o.jsx(Du,{label:C$(e,n.name),onClick:a,children:o.jsx(SE,{size:17})}),o.jsx(Du,{label:"Archive",tone:"danger",onClick:()=>f(g),children:o.jsx(dm,{size:17})})]})}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-exit",children:o.jsx(Du,{label:"Done",onClick:l,children:o.jsx(jn,{size:16,weight:"bold"})})}),p&&o.jsx(Xn,{label:`Delete ${e} permanently`,title:`Delete ${e} shot${e===1?"":"s"} permanently?`,body:"This cannot be undone.",busy:!1,open:k,onOpenChange:S,onConfirm:()=>w(g)})]})}function Du({label:e,tone:t,onClick:n,children:r}){return o.jsx(fr,{label:e,children:o.jsx("button",{type:"button",className:"sc-picked-tool","data-tone":t,"aria-label":e,onClick:n,children:r})})}function mde(e,t){return[e,t.lens??"all",t.set??"",t.ungrouped?"ungrouped":"",t.lineage??"",t.token??"",(t.q??"").trim(),t.sort??"newest",t.limit??""].join("|")}function gde(e){switch(e){case"oldest":return(t,n)=>Ku(n,t);case"cost":return(t,n)=>n.costUsd-t.costUsd||Ku(t,n);case"keepers":return(t,n)=>Number(n.kept)-Number(t.kept)||Ku(t,n);default:return Ku}}function N$(e,t,n){return e.kind==="root"?!1:t.lineage?n.inLineage?n.inLineage(e):!1:t.set?n.inSet?n.inSet(e.id):!1:t.ungrouped?n.inAnySet?!n.inAnySet(e.id):!1:!0}function vde(e,t){return t==="archived"?e.archived:t==="keepers"?!e.archived&&e.kept:!e.archived}function V9(e,t,n){var r;return(r=t.q)!=null&&r.trim()?null:N$(e,t,n)&&vde(e,t.lens)}function Z9(e){return!e||e.kind==="root"?{all:0,keepers:0,archived:0}:{all:e.archived?0:1,keepers:!e.archived&&e.kept?1:0,archived:e.archived?1:0}}function S6(e,t,n,r){if(!r)return e;const a=Z9(t),i=Z9(n),l={...e,all:e.all+i.all-a.all,keepers:e.keepers+i.keepers-a.keepers,archived:e.archived+i.archived-a.archived};return l.all===e.all&&l.keepers===e.keepers&&l.archived===e.archived?e:l}function wde(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}function dv(e,t){const n=e.findIndex(a=>a.id===t.id);if(n===-1||wde(e[n],t))return e;const r=[...e];return r[n]=t,r}function z9(e,t){const n=new Set(t);return e.some(r=>n.has(r.id))?e.filter(r=>!n.has(r.id)):e}function yde(e,t,n,r){if(e.some(u=>u.id===t.id))return dv(e,t);const a=gde(n);let i=0;for(;i<e.length&&a(e[i],t)<=0;)i++;if(i===e.length&&!r)return e;const l=[...e];return l.splice(i,0,t),l}function bde(e,t){const n=new Set(e.map(a=>a.id)),r=t.filter(a=>!n.has(a.id));return r.length?[...e,...r]:e}function xde(e,t){const n=new Set(t.map(r=>r.id));return[...t,...e.filter(r=>!n.has(r.id))]}function M$(e,t){const n=new Set(t.map(a=>a.id)),r=[];for(const a of e)a.status==="running"&&!n.has(a.id)&&r.push(a.id);return r}function kde(e,t){const n=t,r={...e};for(const a of Object.keys(e))a in n&&(r[a]=n[a]);return r}const E6=60;function Sde(e,t,n){const{shotsEpoch:r}=cn(),a=`${mde(e,t)}#${r}`,[i,l]=s.useState(()=>{const M=QS(a);return M?{...M,error:null}:{brandId:e,key:"",items:[],next:null,counts:null,error:null}}),[u,f]=s.useState(0),[h,p]=s.useState(!1),g=s.useRef(i);g.current=i;const m=s.useRef(t);m.current=t;const w=s.useRef(n);w.current=n;const y=s.useRef(!1);s.useEffect(()=>{const M=new AbortController;p(!0);const j=QS(a);return j&&g.current.key!==a&&l({...j,error:null}),Ee.feed(e,{...m.current,limit:E6},M.signal).then(P=>{M.signal.aborted||l({brandId:e,key:a,items:P.items,next:P.next,counts:P.counts??null,error:null})}).catch(P=>{if(M.signal.aborted)return;const R=String((P==null?void 0:P.message)??P);l(H=>H.key===a?{...H,error:R}:{brandId:e,key:a,items:[],next:null,counts:null,error:R})}).finally(()=>{M.signal.aborted||p(!1)}),()=>M.abort()},[e,a,u]),s.useEffect(()=>{i.key&&!i.error&&vie(i)},[i]);const b=s.useCallback(()=>f(M=>M+1),[]),k=s.useCallback(()=>{const M=g.current;if(M.key!==a||!M.next||y.current)return;y.current=!0,p(!0);const j=M.next;Ee.feed(e,{...m.current,limit:E6,cursor:j}).then(P=>{l(R=>R.key!==a?R:{...R,items:bde(R.items,P.items),next:P.next,counts:P.counts??R.counts})}).catch(()=>{}).finally(()=>{y.current=!1,p(!1)})},[e,a]),S=s.useCallback(async()=>{const M=await Ee.feed(e,{...m.current,limit:E6});l(j=>j.key!==a?j:{...j,items:xde(j.items,M.items),next:j.items.length?j.next:M.next,counts:M.counts??j.counts,error:null})},[e,a]),E=s.useCallback(M=>{l(j=>{const P=j.items.find(V=>V.id===M.id);if(!P)return j;const R=m.current,D=V9(M,R,w.current)===!1?z9(j.items,[M.id]):dv(j.items,M),B=j.counts?S6(j.counts,P,M,!0):j.counts;return D===j.items&&B===j.counts?j:{...j,items:D,counts:B}})},[]),C=s.useCallback((M,j)=>{let P=!1;l(R=>{let H=R.items,D=R.counts;const B=m.current;for(const V of M){if(H.some(F=>F.id===V.id)){H=dv(H,V);continue}const U=V9(V,B,w.current);if(U===null){P=!0;continue}const K=N$(V,B,w.current);U&&(H=yde(H,V,B.sort,R.next===null));const O=(j==null?void 0:j.get(V.id))??null;D&&(D=S6(D,O,V,K))}return H===R.items&&D===R.counts?R:{...R,items:H,counts:D}}),P&&S().catch(()=>{})},[S]),A=s.useCallback(M=>{l(j=>{const P=j.items.filter(H=>M.includes(H.id));if(!P.length)return j;let R=j.counts;if(R)for(const H of P)R=S6(R,H,null,!0);return{...j,items:z9(j.items,M),counts:R}})},[]),L=i.brandId===e?i.items:[],T=s.useMemo(()=>new Map(L.map(M=>[M.id,M])),[L]);return{items:L,byId:T,counts:i.brandId===e?i.counts:null,ready:i.key===a&&!i.error,loading:h,complete:i.key===a&&i.next===null,error:i.key===a?i.error:null,loadMore:k,patch:E,insert:C,drop:A,refresh:S,retry:b}}function Ede(){const e=mn(mt.hubShot),t=mn(mt.setShot);return(e==null?void 0:e.params.shotId)??(t==null?void 0:t.params.shotId)??null}function B9(e,t){const n=e?t.get(e)??null:null,[r,a]=s.useState(null);return s.useEffect(()=>{if(!e||n)return;let i=!0;return Ee.node(e).then(l=>i&&a({id:e,node:l})).catch(()=>i&&a({id:e,node:null})),()=>{i=!1}},[e,n]),e?n?{node:n,missing:!1}:(r==null?void 0:r.id)===e?{node:r.node,missing:r.node===null}:{node:null,missing:!1}:{node:null,missing:!1}}function R$({set:e}){const{engines:t,scenes:n,presenters:r,demoProducts:a,showcase:i,showcaseLoaded:l}=Nn(),{brand:u,workspace:f,root:h,recent:p,sets:g,membership:m,loaded:w,refresh:y,applySet:b,dropSet:k,insertSet:S,applyMembership:E,applyNodes:C,subscribeActivity:A,products:L}=cn(),T=n,M=d1(),j=Bn(),[P,R]=jl(),H=Ede(),[D,B]=s.useState(null),[V,U]=s.useState(!1);s.useEffect(()=>{const le=()=>U(!0);return window.addEventListener("scenri:shortcuts",le),()=>window.removeEventListener("scenri:shortcuts",le)},[]);const{open:K,toggle:O,setOpen:F}=Mse(),I=Nr("(min-width: 1280px)"),G=I&&K,[z,Y]=s.useState(null),[Z,ee]=s.useState(vL),[pe,se]=s.useState(null),[xe,J]=s.useState(null),te=s.useRef(!1);s.useEffect(()=>{if(!te.current||H)return;te.current=!1;const le=requestAnimationFrame(()=>{var He;return(He=De.current)==null?void 0:He.focus()});return()=>cancelAnimationFrame(le)},[H,xe]);const[X,ae]=s.useState(null),[Le,ce]=s.useState(new Set),[Se,Ze]=Ih("tab","all"),[gt,Ke]=Ih("in",""),[nt,$e]=Ih("branch",""),[ne,Q]=Ih("lineage",""),[We,Ne]=Ma(qr.tileSize,YM),ie=qM(We),{q,setQ:oe,clearSearch:Re}=f1([]),[ze,Ye]=Ma(qr.feedSort,"newest"),Ie=KG(ze)?ze:"newest",De=s.useRef(null),{push:Ge}=rr(),{poke:ft}=ia(),[bt,at]=s.useState(null),Zt=(f==null?void 0:f.id)??"",jt=e?L0(u,e):Sr(u),Ft=s.useCallback(le=>{const He=P.toString();return`${jt}/shots/${le}${He?`?${He}`:""}`},[jt,P]),Pt=s.useCallback((le,He=!1)=>j(Ft(le),{replace:He}),[j,Ft]),Tt=s.useCallback(()=>{const le=new URLSearchParams(P);le.delete("panel");const He=le.toString();j(`${jt}${He?`?${He}`:""}`,{replace:!0})},[jt,j,P]),ke=GG(Se)?Se:"all",et=!e&&gt==="ungrouped";s.useEffect(()=>{Se==="ungrouped"&&(Ze(null),Ke("ungrouped"))},[Se,Ze,Ke]);const Et=s.useMemo(()=>{const le=new Map;for(const He of g)for(const lt of m[He.id]??[])le.has(lt)||le.set(lt,[]),le.get(lt).push(He);return le},[g,m]),Qe=s.useMemo(()=>({lens:ke,set:e==null?void 0:e.id,ungrouped:et||void 0,lineage:ne||void 0,q:q.trim()||void 0,sort:Ie}),[ke,e==null?void 0:e.id,et,ne,q,Ie]),st=s.useRef(m);st.current=m;const rt=s.useRef(Et);rt.current=Et;const qt=s.useRef(new Set),Yt=s.useMemo(()=>({inSet:le=>e?(st.current[e.id]??[]).includes(le):!1,inAnySet:le=>rt.current.has(le),inLineage:le=>le.id===ne||le.parentId!==null&&qt.current.has(le.parentId)}),[e==null?void 0:e.id,ne]),an=Sde(u.id,Qe,Yt),{items:Wt,byId:Mn,counts:Bt}=an,re=s.useRef(an);re.current=an,qt.current=s.useMemo(()=>new Set(Wt.map(le=>le.id)),[Wt]);const ue=s.useRef(new Map);s.useEffect(()=>{for(const le of Wt)ue.current.set(le.id,le)},[Wt]);const de=s.useRef(new Set),_e=s.useRef(null),[Fe,xt]=s.useState("");s.useEffect(()=>A(le=>{const{messages:He,next:lt}=Tue(_e.current??new Map,le),en=_e.current===null;if(_e.current=lt,!en&&He.length){const un=He.join(" ");xt(gr=>gr===un?`${un} `:un)}const nn=re.current;let Zn=!1;const Tn=[],Pn=new Map;for(const un of le){if(nn.byId.has(un.id))nn.patch(un);else if(ue.current.has(un.id)){const gr=ue.current.get(un.id);gr&&Pn.set(un.id,gr),Tn.push(un)}else un.kind!=="root"&&(Zn=!0);ue.current.set(un.id,un)}Tn.length&&nn.insert(Tn,Pn),Zn&&nn.ready&&nn.refresh().catch(()=>{});for(const un of M$(nn.byId.values(),le))de.current.has(un)||(de.current.add(un),Ee.node(un).then(gr=>{const ua=re.current.byId.get(un);ua&&re.current.patch(kde(ua,gr))}).catch(gr=>{(gr==null?void 0:gr.status)===404&&re.current.drop([un])}).finally(()=>de.current.delete(un)))}),[A]);const yt=w&&an.ready,kt=B9(ne||null,Mn);s.useEffect(()=>{!ne||!kt.missing||(Q(null),Ge({kind:"info",title:"That shot is no longer available",detail:"Showing everything instead."}))},[ne,kt.missing,Q,Ge]);const ot=s.useMemo(()=>{var en,nn;const le=L.length?L:((en=u.json)==null?void 0:en.products)??[],He=((nn=u.json)==null?void 0:nn.characters)??[],lt=M.scenes;return{product:Zn=>{const Tn=le.find(Pn=>Pn.id===Zn)??a.find(Pn=>Pn.id===Zn);return Tn?Do(Tn,"chip"):null},person:Zn=>{var Tn,Pn;return((Tn=He.find(un=>un.id===Zn))==null?void 0:Tn.name)??((Pn=r.find(un=>un.id===Zn))==null?void 0:Pn.name)??null},scene:Zn=>{const Tn=lt.find(Pn=>Pn.id===Zn);return Tn?El(Tn,"chip"):null}}},[L,a,u,r,M.scenes]),ht=s.useMemo(()=>{const le=D?Mn.get(D):void 0;return le||(Wt.find(He=>He.status!=="error")??Wt[0]??null)},[Mn,Wt,D]),je=B9(nt||null,Mn),me=s.useMemo(()=>{const le=je.node;return!le||le.kind==="root"?null:le.status==="running"||le.status==="done"&&le.images.length>0?le:null},[je.node]),tt=(me==null?void 0:me.images[0])??null,Ct=s.useCallback(()=>$e(null),[$e]),be=s.useRef(null),it=s.useCallback((...le)=>{if(be.current){for(const lt of le)be.current.add(lt);return}const He=new Set(le);be.current=He,queueMicrotask(()=>{be.current=null,R(lt=>{const en=new URLSearchParams(lt);for(const nn of He)en.delete(nn);return en},{replace:!0})})},[R]),wt=s.useCallback(()=>it("scene","setup","presenter","product","ref","view","fresh"),[it]);s.useEffect(()=>{!nt||!yt||(je.node&&!me?(Ct(),Ge({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})):je.missing&&(Ct(),Ge({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})))},[nt,je.node,je.missing,me,yt,Ct,Ge]);const Pe=s.useCallback(le=>{var He;$e(le),(He=De.current)==null||He.focus()},[$e]),Xe=le=>B(le),Lt=le=>H||/\/shots\//.test(window.location.pathname)?Pt(le,!0):Xe(le),Ut=s.useCallback(le=>{for(const He of le)ue.current.set(He.id,He);re.current.insert(le),C(le),ft()},[C,ft]),At=s.useCallback(async()=>{try{await y(),await re.current.refresh(),Y(null)}catch(le){Y(String(le.message??le))}},[y]),_t=s.useCallback(le=>C([le]),[C]),{archive:Ae,archiveBatch:Ve,unarchive:Je,unarchiveBatch:_}=ide(_t),fe=s.useCallback(le=>re.current.drop(le),[]),{remove:we,removeBatch:Ue}=lde(fe);s.useEffect(()=>{H&&B(H)},[H]);const Me=s.useRef(new Set),ct=async le=>{var He,lt;if(le.status==="running")return le.id;if(Me.current.has(le.id))return null;if(le.status==="error"||le.status==="cancelled"){Me.current.add(le.id);try{const en=await Ee.retryNode(le.id);return C([en]),ft(),en.id}catch(en){return Ge(ln(en,"Could not run this again")),null}finally{Me.current.delete(le.id)}}Me.current.add(le.id);try{const en=await Ee.node(le.id),nn=await Ee.addNode({projectId:Zt,parentId:le.parentId,kind:le.kind==="edit"?"edit":"generation",prompt:en.prompt,engineId:le.engineId,count:1,brief:le.brief,...le.kind==="edit"&&((He=le.brief)!=null&&He.sourceImage)?{sourceImage:le.brief.sourceImage}:{}});return Ut((lt=nn.siblings)!=null&&lt.length?nn.siblings:[nn]),(nn==null?void 0:nn.id)??null}catch(en){return Ge(ln(en,"Could not run this again")),null}finally{Me.current.delete(le.id)}},Ot=async le=>{try{await Ee.cancelNode(le.id),C([{...le,status:"cancelled"}]),ft()}catch(He){Ge(ln(He,"Could not cancel this shot"))}},zt=s.useCallback(le=>{var He,lt,en;le!=null&&le.scene&&((He=De.current)==null||He.applyScene(le.scene)),le!=null&&le.scenesPanel&&((lt=De.current)==null||lt.openAttach("Scenes")),(en=De.current)==null||en.focus()},[]);s.useEffect(()=>{var He;if(P.get("compose")===null)return;const le=P.get("attach")==="all";zt(),le&&((He=De.current)==null||He.showAttach()),it("compose",...le?["attach"]:[])},[P,zt,it]);const Rt=P.get("showcase"),kn=s.useRef(null);s.useEffect(()=>{if(!Rt||!l||kn.current===Rt)return;kn.current=Rt;const le=i.find(He=>He.id===Rt);le?(J(Y4(le)),Ge({kind:"info",title:`Starting from "${le.title}"`})):Ge({kind:"info",title:"That example is no longer available",detail:"Starting from scratch instead."}),R(He=>{const lt=new URLSearchParams(He);return lt.delete("showcase"),lt},{replace:!0})},[Rt,l,i,R,Ge]);const Jt=async(le,He=!le.kept)=>{C([{...le,kept:He}]);try{C([await Ee.keep(le.id,He)])}catch(lt){C([le]),Ge(ln(lt,"Could not update keeper status"))}},Sn=s.useMemo(()=>[...Le].map(le=>Mn.get(le)).filter(le=>!!le),[Mn,Le]),Qn=async()=>{const le=!(Sn.length>0&&Sn.every(lt=>lt.kept)),He=Sn.filter(lt=>lt.kept!==le);C(He.map(lt=>({...lt,kept:le})));try{C(await Promise.all(He.map(lt=>Ee.keep(lt.id,le))))}catch(lt){C(He),Ge(ln(lt,"Could not update keeper status"))}},dn=le=>{const He=le.map(lt=>Mn.get(lt)).filter(lt=>!!lt&&!lt.archived);He.length&&C(He.map(lt=>({...lt,archived:!0}))),ce(new Set),Ve(le).then(lt=>{lt||C(He)})},mr=le=>{const He=le.map(lt=>Mn.get(lt)).filter(lt=>!!lt&&lt.archived);He.length&&C(He.map(lt=>({...lt,archived:!1}))),ce(new Set),_(le).then(lt=>{lt||C(He)})},Kt=s.useCallback((le,He)=>{st.current={...st.current,[le]:He},E(le,He)},[E]),wr=async le=>{try{const He=await Ee.addToSet(le.id,[...Le]);Kt(le.id,He.nodeIds),ce(new Set),(e||et)&&re.current.refresh()}catch(He){Ge(ln(He,"Could not add to the set"))}},Hr=async(le,He)=>{const lt=st.current[le.id]??[],en=lt.filter(nn=>!He.includes(nn));Kt(le.id,en),ce(nn=>{if(!He.some(Tn=>nn.has(Tn)))return nn;const Zn=new Set(nn);for(const Tn of He)Zn.delete(Tn);return Zn}),(e==null?void 0:e.id)===le.id&&re.current.drop(He);try{const nn=await Ee.removeFromSet(le.id,He);Kt(le.id,nn.nodeIds),et&&re.current.refresh()}catch(nn){Kt(le.id,lt),((e==null?void 0:e.id)===le.id||et)&&re.current.refresh(),Ge(ln(nn,"Could not remove from the set"))}},wn=le=>Hr(le,[...Le]),_o=(le,He)=>Hr(He,[le.id]),Rn=s.useRef([]),[Ks,Ps]=s.useState(!1);s.useEffect(()=>{Ks&&Ps(!1)},[Ks]);const on=async(le,He)=>{const lt=He.trim();if(lt)try{const en=await Ee.createSet(u.id,lt);if(S(en),le.length>0){const nn=await Ee.addToSet(en.id,le);Kt(en.id,nn.nodeIds)}ce(new Set),j(L0(u,en))}catch(en){Ge(ln(en,"Could not create the set"))}},yn=()=>{const le=Rn.current;return Rn.current=[],le},Wn=async le=>{if(!e)return;const He=le.trim();if(!(!He||He===e.name))try{const lt=await Ee.renameSet(e.id,He);b(lt),j(L0(u,lt),{replace:!0}),y()}catch(lt){Ge(ln(lt,"Could not rename the set"))}},Ur=async()=>{if(e)try{await Ee.deleteSet(e.id),k(e.id),j(Sr(u),{replace:!0}),y()}catch(le){Ge(ln(le,"Could not delete the set"))}},Jn=async le=>{var un;const He=((un=/\/shots\/([^/?#]+)/.exec(window.location.pathname))==null?void 0:un[1])??null,lt=He?Mn.get(He)??null:ht;if(!lt)return;if(le==="left"||le==="right"){const{prev:gr,next:ua}=f4(Wt,lt.id),Or=le==="left"?gr:ua;Or&&Lt(Or.id);return}const en=await Ee.lineage(lt.id).catch(()=>null);if(!en)return;const nn=en.history??[...en.ancestors,lt,...en.children.slice(0,1)],{prev:Zn,next:Tn}=f4(nn.filter(gr=>gr.id===lt.id||gr.images[0]),lt.id),Pn=le==="up"?Zn:Tn;Pn&&Lt(Pn.id)};s.useEffect(()=>{const le=He=>{var Tn,Pn;if(He.defaultPrevented)return;const lt=document.activeElement,en=((lt==null?void 0:lt.tagName)??"").toUpperCase(),nn=en==="INPUT"||en==="TEXTAREA"||en==="SELECT"||!!(lt!=null&&lt.closest('[contenteditable="true"]'))||!!(lt!=null&&lt.closest('[role="separator"]')),Zn=!!(lt!=null&&lt.closest('button, a[href], [role="button"], [role="tab"], [role="menuitem"]'));if(He.key==="Enter"&&(He.metaKey||He.ctrlKey)){if(H||Cde(lt))return;(Tn=De.current)==null||Tn.submit(),He.preventDefault();return}if(!nn){if(He.key==="?"){U(!0),He.preventDefault();return}if(He.key==="/"&&!H){(Pn=De.current)==null||Pn.focus(),He.preventDefault();return}if(He.key==="Escape"&&V){U(!1),He.preventDefault();return}if(He.key==="Escape"&&H){Tt(),He.preventDefault();return}if(He.key==="Escape"&&Le.size>0){ce(new Set),He.preventDefault();return}if(He.key==="Escape"&&nt){Ct(),He.preventDefault();return}if(ht){if(He.key==="b"&&ht.kind!=="root"&&ht.status==="done"&&ht.images.length>0){Pe(ht.id),He.preventDefault();return}if(He.key==="k"&&ht.kind!=="root"&&ht.status==="done"){Jt(ht),He.preventDefault();return}He.key==="ArrowLeft"?(Jn("left"),He.preventDefault()):He.key==="ArrowRight"?(Jn("right"),He.preventDefault()):He.key==="ArrowUp"?(Jn("up"),He.preventDefault()):He.key==="ArrowDown"?(Jn("down"),He.preventDefault()):He.key==="Enter"&&!H&&ht.kind!=="root"&&!Zn?Pt(ht.id):He.key==="."&&!H&&I&&O()}}};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[ht,H,V,Le.size,nt,Pe,$e,h,I]);const Fn=le=>ce(He=>{const lt=new Set(He);return lt.delete(le)||lt.add(le),lt}),es=yt&&Bt!==null&&Bt.total===0,ca=G||es&&I,Vo=es?o.jsx(hde,{entries:i,catalogs:{demoProducts:a,presenters:r,scenes:T},stagedId:X,productHref:le=>Ea(u,le),presenterHref:le=>Ra(u,le),sceneHref:le=>zr(u,le),onUse:le=>{ae(le.id),J(Y4(le))}}):q.trim()?o.jsx(N0,{text:`No shots match “${q.trim()}”.`,onAll:Re,actionLabel:"Clear search"}):ke==="keepers"?o.jsx(N0,{text:"No keepers yet. Star a shot and it lands here.",onAll:()=>Ze(null)}):ke==="archived"?o.jsx(N0,{text:"Nothing archived.",onAll:()=>Ze(null)}):e?o.jsx(N0,{text:"Nothing in this set yet. Pick shots on All, then add them here."}):et?o.jsx(N0,{text:"Every shot is already in a set.",onAll:()=>Ke(null)}):null,ms=s.useRef(0);!q.trim()&&Bt&&(ms.current=Bt[ke]);const[Gs,Zo]=Ma(qr.feedCounts,null);s.useEffect(()=>{if(!Bt)return;const le={brandId:u.id,all:Bt.all,keepers:Bt.keepers,archived:Bt.archived};Zo(He=>He&&He.brandId===le.brandId&&He.all===le.all&&He.keepers===le.keepers&&He.archived===le.archived?He:le)},[u.id,Bt,Zo]);const Ys=s.useMemo(()=>Bt?{all:Bt.all,keepers:Bt.keepers,archived:Bt.archived}:(Gs==null?void 0:Gs.brandId)===u.id?{all:Gs.all,keepers:Gs.keepers,archived:Gs.archived}:null,[Bt,Gs,u.id]),uo={byId:Mn,items:Wt,loadMore:an.loadMore,complete:an.complete,rootId:h,recent:p,loaded:yt,setsFor:le=>Et.get(le)??[],brand:u,engines:t,projectId:Zt,close:Tt,select:Lt,retry:le=>{ct(le).then(He=>{He&&Lt(He)})},cancel:le=>void Ot(le),keep:le=>void Jt(le),reload:At,remix:le=>{var Zn;const He=(Zn=le.brief)==null?void 0:Zn.tokens,lt=le.prompt??le.promptHead,en=He!=null&&He.length||!lt?le.brief:{...le.brief,tokens:[{t:"text",v:lt}]},nn=en!=null&&en.tokens?{...en,tokens:ap(u,en.tokens)}:en;J({...nn,_at:Date.now()}),nn&&Hw(u.id,{tokens:ly(nn),tplFields:nn.templateFields??{}}),Tt(),Ge({kind:"info",title:"Starting from this shot",detail:"Its prompt, chips and settings are in the composer. Change anything, then Generate."}),te.current=!0},branch:le=>{Pe(le.id),Tt()},archive:le=>Ae(le).then(He=>{He&&Tt()}),unarchive:le=>Je(le).then(()=>{}),delete:le=>void we(le).then(()=>Tt()),landed:Ut,refined:(le,He)=>{He==="edit"&&$e(le)},subscribeActivity:A,tokenNames:ot};return o.jsxs("div",{className:"sc-work","data-assets":ca,children:[o.jsxs("main",{className:"sc-canvas",id:"main","data-page-scroll":"","data-firstrun":es||void 0,onClick:le=>{if(Le.size===0&&!D)return;const He=le.target;He.closest(".sc-cell")||He.closest("button, a, input, select, textarea, label, [role], [contenteditable]")||(ce(new Set),B(null))},children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:Fe}),(z||an.error)&&o.jsx("div",{className:"sc-canvas-alert",children:o.jsx(Tw,{failure:co(z??an.error??""),action:an.error&&!z?o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:an.retry,children:"Try again"}):void 0})}),(!es||e)&&o.jsx(ode,{sets:g,active:e,ungrouped:et,ungroupedCount:(Bt==null?void 0:Bt.ungrouped)??0,onPlaceAll:()=>e?j(Sr(u)):Ke(null),onPlaceUngrouped:()=>e?j(`${Sr(u)}?in=ungrouped`):Ke("ungrouped"),onOpenSet:le=>j(L0(u,le)),onNewSet:le=>void on(yn(),le),onResetNewSet:()=>{Rn.current=[]},onRenameSet:le=>void Wn(le),onDeleteSet:()=>void Ur(),askCreate:Ks,lens:ke,lensCounts:Ys,onLens:le=>Ze(le==="all"?null:le),q,onQ:oe,searchTotal:q.trim()?ms.current:(Bt==null?void 0:Bt[ke])??0,sort:Ie,onSort:Ye,tile:ie,onTile:Ne,assets:G,onAssets:O,showAssets:I}),ne&&kt.node&&o.jsxs("div",{className:"sc-lineage-bar",children:[o.jsx("button",{type:"button",className:"sc-crumb-back",onClick:()=>Q(null),children:"All shots"}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("b",{dir:"auto",children:Dr(kt.node)}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("span",{className:"sc-crumb-here",children:"versions"})]}),o.jsx(tde,{nodes:Wt,selectedId:D,onOpen:Pt,shotHref:Ft,onRetry:le=>void ct(le),onCancel:le=>void Ot(le),onToggleKeep:le=>void Jt(le),onArchive:le=>le.archived?Je(le):Ae(le),onDeletePermanently:we,engineName:le=>{var He;return(He=t.find(lt=>lt.id===le))==null?void 0:He.displayName},picked:Le,onPick:Fn,sending:bt,onBranch:Pe,branchingFrom:(me==null?void 0:me.id)??null,onVersions:Q,tile:ie,empty:yt?Vo:null,pending:!yt&&!an.error,onNearEnd:an.complete?void 0:an.loadMore,inSet:e,setsFor:le=>Et.get(le)??[],onRemoveFromSet:(le,He)=>void _o(le,He),onKeepPicked:()=>void Qn(),onArchivePicked:()=>dn([...Le]),onRestorePicked:()=>mr([...Le]),onDeletePicked:()=>void Ue([...Le]).then(()=>ce(new Set)),onRemovePickedFromSet:le=>void wn(le)})]}),ca&&o.jsx("div",{className:"sc-assets-backdrop",onClick:()=>F(!1),"aria-hidden":!0}),o.jsx(Hue,{open:V,onOpenChange:U}),I&&o.jsx(ade,{brand:u,shots:p,shotsTotal:(Ys==null?void 0:Ys.all)??0,attached:Z,full:pe,onToken:le=>{var He;return(He=De.current)==null?void 0:He.insertToken(le)},offToken:le=>{var He;return(He=De.current)==null?void 0:He.removeToken(le)},onTemplate:le=>{var He;return(He=De.current)==null?void 0:He.applyScene(le)},offTemplate:()=>{var le;return(le=De.current)==null?void 0:le.removeTemplate()},onClose:()=>F(!1)}),o.jsxs(wL,{full:!ca,children:[o.jsx($y,{}),Le.size>0&&o.jsx(pde,{count:Le.size,sets:g,activeSet:e,onAdd:le=>void wr(le),onRemove:e?()=>void wn(e):void 0,onNew:()=>{Rn.current=[...Le],Ps(!0)},onClear:()=>ce(new Set),onKeep:()=>void Qn(),onArchiveBatch:le=>dn(le),allKept:Sn.length>0&&Sn.every(le=>le.kept),archivedLens:ke==="archived",pickedIds:[...Le],onRestoreBatch:le=>mr(le),onDeleteBatch:le=>void Ue(le).then(()=>ce(new Set)),loaded:Wt.length,onSelectAll:()=>ce(new Set(Wt.map(le=>le.id)))}),o.jsx(Py,{ref:De,projectId:Zt||null,brand:u,engines:t,parentId:h,initialBrief:xe,suppressDraftRestore:Rt!==null,startScene:P.get("scene")??void 0,startSetup:P.get("setup")??void 0,startPresenter:P.get("presenter")??void 0,startProduct:P.get("product")??void 0,startRef:P.get("ref")??void 0,startView:P.get("view")??void 0,startFresh:P.get("fresh")==="1",onSeedsSpent:wt,openAttachTab:P.get("attach")==="scenes"?"Scenes":P.get("attach")==="products"?"Products":void 0,target:me,onClearTarget:Ct,onRestoreBranchId:$e,guided:!0,setSlug:(e==null?void 0:e.slug)??null,onSending:at,onAttached:ee,onCeiling:se,sourceImage:tt??void 0,onQueued:(le,He,lt,en)=>{J(null),R(Pn=>{const un=new URLSearchParams(Pn);return un.delete("scene"),un.delete("attach"),un.delete("presenter"),un.delete("product"),un},{replace:!0});const nn=()=>at(null),Zn=()=>{He!=="edit"||!le||R(Pn=>{const un=new URLSearchParams(Pn);return un.set("branch",le),un},{replace:!0})},Tn=()=>{Ut(en??[]),Zn(),nn()};e&&le?Ee.addToSet(e.id,lt!=null&&lt.length?lt:[le]).then(Pn=>Kt(e.id,Pn.nodeIds)).catch(Pn=>Ge(ln(Pn,"Could not add to the set"))).finally(Tn):Tn()}})]}),o.jsx(Zc,{context:uo})]})}const U9='[aria-modal="true"], [role="alertdialog"], .rt-BaseDialogContent, .sc-newdlg-layer';function Cde(e){return e!=null&&e.closest(U9)?!0:!!(e!=null&&e.closest("[data-radix-popper-content-wrapper]"))&&!!document.querySelector(U9)}const fv=new Map,jde=4e3;function Ade(e){fv.set(e,performance.now())}function Nde(e){const t=fv.get(e);if(t!==void 0&&performance.now()-t<jde)return t;fv.delete(e)}function Mde(e){var t;return gi((t=e.brief)==null?void 0:t.format)}function Rde(e){var n,r,a;const t=(a=(r=(n=e.brief)==null?void 0:n.rendered)==null?void 0:r.sizes)==null?void 0:a[0];return t&&t[0]>0&&t[1]>0?t:null}const Pde=e=>({"--sc-pic-ar":e[0]/e[1],"--sc-pic-w":`${e[0]}px`});function Lde({node:e,onRetry:t,onCancel:n,engineName:r,menu:a}){const[i,l]=s.useState(null),[,u]=s.useState(0);s.useEffect(()=>{if(e.status!=="running")return;const S=setInterval(()=>u(E=>E+1),1e3);return()=>clearInterval(S)},[e.status]),e.status==="running"&&C6.add(e.id);const[,f]=s.useState(0),h=s.useRef(null),[p,g]=s.useState(null),m=s.useCallback(()=>{C6.delete(e.id),f(S=>S+1)},[e.id]);if(s.useEffect(()=>{e.status!=="done"&&(q0=null)},[e.status]),s.useEffect(()=>()=>{q0=null},[]),e.kind==="root")return o.jsx(Z0,{className:"sc-frame",p:"8",children:o.jsxs(Vs,{direction:"column",align:"center",gap:"2",py:"6",children:[o.jsx(Lc,{className:"sc-display",size:"7",align:"center",children:"Blank canvas, full brand."}),o.jsx(Lc,{color:"gray",size:"2",align:"center",children:"Pick a Template below (engineered briefs, your product attached) or describe a visual."})]})});if(e.status==="running")return o.jsxs("div",{className:"sc-stage-wait",style:{"--sc-wait-ar":Mde(e)},children:[o.jsx(Pa,{since:Ya(e),from:$de(e.id)}),o.jsxs("div",{className:"sc-stage-wait-say",children:[o.jsx("span",{className:"sc-stage-wait-t",role:"timer","aria-label":`${Vw(Ya(e))}, ${Gm(Ya(e))} seconds`,children:Dc(Ya(e))}),n&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:n,children:"Cancel"})]})]});if(e.status==="cancelled"||e.status==="error"){const E=e.status==="cancelled"?rM():co(e.error,r);return o.jsx(KN,{failure:E,density:"stage",onRetry:t})}const w=e.status==="done"?e.images[0]:void 0,y=w?Rde(e)??(i==null?void 0:i.size)??null:null,b=!!w&&!!y&&e.status==="done"&&C6.has(e.id)&&!hf(),k=w?o.jsxs(Z0,{className:y?"sc-frame sc-stage-pic":"sc-frame sc-stage-free",style:y?Pde(y):void 0,"data-arriving":b||void 0,children:[o.jsx(Tde,{hash:w,alt:e.promptHead,imgRef:h,bare:b,onPainted:(S,E,C)=>{l({hash:S,size:[E,C]}),g(S),q0=S}}),b&&o.jsx(qy,{img:h,ready:p===w,onDone:m})]}):o.jsx(Vs,{justify:"center",children:o.jsx(Z0,{className:"sc-frame",style:{display:"inline-block",maxWidth:"100%"}})});return a?o.jsxs(Xf,{children:[o.jsx(Qf,{children:k}),a]}):k}const C6=new Set;let q0=null;function $de(e){const t=Nde(e);return t!==void 0&&q0?{src:Tr(q0),at:t}:void 0}function Tde({hash:e,alt:t,onPainted:n,imgRef:r,bare:a}){const[i,l]=s.useState(null),u=s.useRef(null),f=i===e,h=g=>{!(g!=null&&g.complete)||!g.naturalWidth||g.src!==new URL(Tr(e),location.href).href||u.current!==e&&(u.current=e,l(e),n==null||n(e,g.naturalWidth,g.naturalHeight))},p=u.current&&u.current!==e?Tr(u.current):gn(e,"tile");return o.jsxs(Z0,{position:"relative",style:{lineHeight:0},children:[!f&&!a&&o.jsx("img",{className:"sc-stage-under",src:p,alt:"","aria-hidden":!0,decoding:"async"}),o.jsx("img",{ref:g=>{r&&(r.current=g),h(g)},src:Tr(e),alt:t,className:"sc-stage-img","data-ready":f||void 0,onLoad:g=>h(g.currentTarget)})]})}const Dde=e=>((e==null?void 0:e.tokens)??[]).filter(t=>t&&typeof t.t=="string");function P$(e,t){return Dde(e.brief).map(r=>{var a;switch(r.t){case"text":return typeof r.v=="string"?r.v:"";case"product":return t.product(String(r.id))??"a product";case"character":return t.person(String(r.id))??"a presenter";case"template":return t.scene(String(r.id))??"a scene";case"color":return String(r.name??r.hex??"");case"ref":return"the attached reference";case"mark":return((a=t.mark)==null?void 0:a.call(t,String(r.imageHash)))??"the brand mark";default:return""}}).join(" ").replace(/\s+/g," ").replace(/\s+([.,!?;:])/g,"$1").trim()||e.prompt||e.promptHead||""}const hv=new Set;function L$({id:e}){return hv.add(e),null}function $$({id:e,src:t,active:n}){const r=s.useRef(null),[a,i]=s.useState(!1),[,l]=s.useState(0),u=s.useCallback(()=>{hv.delete(e),l(f=>f+1)},[e]);return!hv.has(e)||hf()?o.jsx("img",{src:t,alt:"",className:"sc-thumb",loading:"lazy",decoding:"async","data-active":n,width:52,height:52}):o.jsxs("span",{className:"sc-thumb sc-thumb-wait","data-active":n,children:[o.jsx("img",{ref:f=>{r.current=f,f!=null&&f.complete&&f.naturalWidth&&!a&&i(!0)},src:t,alt:"",className:"sc-thumb-landing",decoding:"async",onLoad:()=>i(!0)}),o.jsx(qy,{img:r,ready:a,onDone:u})]})}const Hde=e=>e===0?"Original":`Refinement ${e}`,Ode=e=>e===0?"the original":`Refinement ${e}`,Ide=(e,t)=>e.createdAt.localeCompare(t.createdAt)||e.id.localeCompare(t.id),Fde=e=>e.status==="cancelled"?"Stopped":"Did not finish";function _de(e,t,n){const r=new Set(e.map(m=>m.id)),a=new Map(n.map(m=>[m.id,m]));a.set(t.id,t);const i=[...a.values()].filter(m=>!r.has(m.id)&&m.parentId!==null&&r.has(m.parentId)),l=(i.length?[...e,...i].sort(Ide):e).map(m=>a.get(m.id)??m),f=(l.some(m=>m.id===t.id)?l:[...l,t]).filter(m=>m.id===t.id||m.images[0]||m.status==="running"||m.parentId===t.id&&(m.status==="error"||m.status==="cancelled"));let h=0;const p=f.map(m=>{const w=m.images[0]?"ready":m.status==="running"?"pending":"failed";if(w==="failed"&&m.kind==="edit")return{node:m,index:-1,label:Fde(m),from:null,state:w};const y=m.kind==="edit"?++h:0;return{node:m,index:y,label:Hde(y),from:null,state:w}}),g=new Map(p.map((m,w)=>[m.node.id,w]));return p.map((m,w)=>{if(w===0||!m.node.parentId||m.node.parentId===p[w-1].node.id)return m;const y=g.get(m.node.parentId);return y===void 0||p[y].index<0?m:{...m,from:Ode(p[y].index)}})}function Vde(e,t){var n;return((n=e.find(r=>r.state==="pending"&&r.node.parentId===t))==null?void 0:n.node)??null}function T$(e,t){const n=e.find(a=>a.node.id===t);if(!n)return"";if(n.index<0)return n.label;const r=Math.max(0,...e.map(a=>a.index));return n.index===0?"Original":`Refinement ${n.index} of ${r}`}const Gh=28;function Zde({trail:e,activeId:t,names:n,onSelect:r}){var w;const a=s.useRef(null),i=s.useMemo(()=>e.map(y=>P$(y.node,n)),[e,n]),l=Id(),u=(y,b,k)=>l.open({key:y.node.id,src:gn(y.node.images[0],"tile"),label:y.label,said:i[b],from:y.from,el:k,id:y.node.id});s.useEffect(()=>{var y,b;(b=(y=a.current)==null?void 0:y.querySelector('[aria-pressed="true"]'))==null||b.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[t]);const[f,h]=s.useState(null);s.useEffect(()=>{const y=a.current;if(!y)return;const b=()=>{const E=y.scrollWidth-y.clientWidth;if(E<=1)return h(null);const C=y.scrollLeft;h(C<=1?"end":C>=E-1?"start":"both")},k=()=>{const E=y.querySelector("[data-pending]")??y.querySelector('[aria-pressed="true"]');if(!E)return;const C=E.getBoundingClientRect(),A=y.getBoundingClientRect();C.left<A.left+Gh?y.scrollLeft-=A.left+Gh-C.left:C.right>A.right-Gh&&(y.scrollLeft+=C.right-(A.right-Gh))};b(),y.addEventListener("scroll",b,{passive:!0});const S=new ResizeObserver(()=>{k(),b()});return S.observe(y),()=>{y.removeEventListener("scroll",b),S.disconnect()}},[e.length]),s.useEffect(()=>{const y=a.current;if(!y)return;const b=k=>{y.scrollWidth<=y.clientWidth||Math.abs(k.deltaY)<=Math.abs(k.deltaX)||(k.preventDefault(),y.scrollLeft+=k.deltaY)};return y.addEventListener("wheel",b,{passive:!1}),()=>y.removeEventListener("wheel",b)},[]);const p=y=>{var E,C;const b=[...((E=a.current)==null?void 0:E.querySelectorAll(".sc-trail-tile:not([aria-disabled])"))??[]],k=b.indexOf(document.activeElement);let S=-1;if(y.key==="ArrowRight")S=Math.min(b.length-1,k+1);else if(y.key==="ArrowLeft")S=Math.max(0,k-1);else if(y.key==="Home")S=0;else if(y.key==="End")S=b.length-1;else return;y.preventDefault(),y.stopPropagation(),(C=b[S])==null||C.focus()},g=e.some(y=>y.node.id===t)?t:(w=e[0])==null?void 0:w.node.id,m=T$(e,t);return o.jsxs("div",{className:"sc-trail",children:[m&&o.jsx("span",{className:"sc-trail-say",children:m}),o.jsx("nav",{ref:a,className:"sc-thumbs","aria-label":"History of this shot","data-more":f??void 0,onKeyDown:p,children:e.map((y,b)=>{const k=y.node,S=k.id===t,E=y.state==="pending";return o.jsx("button",{type:"button",className:"sc-thumb-btn sc-trail-tile","data-original":y.index===0&&e.length>1?"":void 0,"aria-label":`${i[b]?`${y.label}: ${i[b]}`:y.label}${E?", still rendering":""}`,"aria-pressed":S,"data-pending":E||void 0,tabIndex:k.id===g?0:-1,onClick:()=>{l.closeNow(),r(k.id)},onPointerEnter:C=>C.pointerType==="mouse"&&y.state==="ready"&&u(y,b,C.currentTarget),onPointerLeave:C=>C.pointerType==="mouse"&&l.close(),onFocus:C=>Xm(C.currentTarget)&&y.state==="ready"&&u(y,b,C.currentTarget),children:y.state==="ready"?o.jsx($$,{id:k.id,src:gn(k.images[0],"micro"),active:S}):E?o.jsxs("span",{className:"sc-thumb sc-thumb-wait","data-active":S,children:[o.jsx(Pa,{since:Ya(k)}),o.jsx(L$,{id:k.id})]}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":S,children:o.jsx(zc,{size:14})})},k.id)})}),l.shown&&o.jsx(Od,{anchor:l.shown.el,kind:"shot",src:l.shown.src,label:l.shown.label,noun:l.shown.said,note:l.shown.from?`From ${l.shown.from}`:null,onOpen:()=>{var b;const y=(b=l.shown)==null?void 0:b.id;l.closeNow(),y&&r(y)},onHoverIn:l.keep,onHoverOut:l.close,onClose:l.closeNow},l.shown.key)]})}const zde=200,W9=32;function Bde({shots:e,activeId:t,onSelect:n,onEndReached:r,complete:a}){var y;const i=s.useRef(null),l=Id(),u=(b,k)=>l.open({key:b.id,src:gn(b.images[0],"tile"),label:Dr(b),el:k,id:b.id}),f=s.useRef(!1);s.useLayoutEffect(()=>{var k;const b=(k=i.current)==null?void 0:k.querySelector('[aria-pressed="true"]');b&&(b.scrollIntoView({block:"center",behavior:f.current?"smooth":"auto"}),f.current=!0)},[t]);const h=s.useRef(null),p=()=>{const b=i.current,k=h.current;if(!b||!k)return;const S=b.scrollHeight-b.clientHeight,E=b.scrollTop;k.style.setProperty("--sc-shotrail-start",S>1?Math.min(1,E/W9).toFixed(3):"0"),k.style.setProperty("--sc-shotrail-end",S>1?Math.min(1,(S-E)/W9).toFixed(3):"0")};s.useLayoutEffect(()=>{const b=i.current;if(!b)return;p();const k=new ResizeObserver(p);return k.observe(b),()=>k.disconnect()},[e.length]);const g=()=>{p();const b=i.current;!b||a||b.scrollTop+b.clientHeight>=b.scrollHeight-zde&&r()},m=b=>{var C,A;const k=[...((C=i.current)==null?void 0:C.querySelectorAll(".sc-shotrail-tile:not([aria-disabled])"))??[]],S=k.indexOf(document.activeElement);let E=-1;if(b.key==="ArrowDown")E=Math.min(k.length-1,S+1);else if(b.key==="ArrowUp")E=Math.max(0,S-1);else if(b.key==="Home")E=0;else if(b.key==="End")E=k.length-1;else return;b.preventDefault(),b.stopPropagation(),(A=k[E])==null||A.focus()},w=e.some(b=>b.id===t)?t:(y=e[0])==null?void 0:y.id;return o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:h,className:"sc-shotrail-shell",children:o.jsx("nav",{ref:i,className:"sc-shotrail","aria-label":"Shots in this view",onScroll:g,onKeyDown:m,children:e.map(b=>{const k=b.id===t,S=b.status==="running",E=b.status==="done"&&!!b.images[0];return o.jsx("button",{type:"button",className:"sc-thumb-btn sc-shotrail-tile","aria-label":S?`${Dr(b)}, still rendering`:Dr(b),"aria-pressed":k,tabIndex:b.id===w?0:-1,onClick:()=>{l.closeNow(),n(b.id)},onPointerEnter:C=>C.pointerType==="mouse"&&E&&u(b,C.currentTarget),onPointerLeave:C=>C.pointerType==="mouse"&&l.close(),onFocus:C=>Xm(C.currentTarget)&&E&&u(b,C.currentTarget),children:E?o.jsx($$,{id:b.id,src:gn(b.images[0],"micro"),active:k}):S?o.jsxs("span",{className:"sc-thumb sc-thumb-wait","data-active":k,children:[o.jsx(Pa,{since:Ya(b)}),o.jsx(L$,{id:b.id})]}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":k,children:o.jsx(zc,{size:14})})},b.id)})})}),l.shown&&o.jsx(Od,{anchor:l.shown.el,kind:"shot",noun:"Shot",side:"beside",src:l.shown.src,label:l.shown.label,onOpen:()=>{var k;const b=(k=l.shown)==null?void 0:k.id;l.closeNow(),b&&n(b)},onHoverIn:l.keep,onHoverOut:l.close,onClose:l.closeNow},l.shown.key)]})}const Ude=60;function Wde({onLeft:e,onRight:t}){const n=s.useRef(null);return{onPointerDown:r=>{r.pointerType!=="mouse"&&(n.current={id:r.pointerId,x:r.clientX,y:r.clientY})},onPointerUp:r=>{const a=n.current;if(n.current=null,!a||a.id!==r.pointerId)return;const i=r.clientX-a.x,l=r.clientY-a.y;Math.abs(i)<Ude||Math.abs(i)<2*Math.abs(l)||(i<0?e():t())},onPointerCancel:()=>{n.current=null}}}function Kde(e){const t=Bn(),n=Id(),{shown:r,closeNow:a}=n,[i,l]=s.useState(null),u=i??r,f=()=>{l(null),a()};s.useEffect(()=>{if(!i)return;const w=y=>{const b=y.target;b!=null&&b.closest(".sc-chip-preview")||b!=null&&b.closest(e)||l(null)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i,e]);const[h,p]=s.useState(null),g=w=>({"data-open":(u==null?void 0:u.key)===w.key||void 0,"aria-haspopup":"dialog",onPointerEnter:y=>y.pointerType==="mouse"&&!i&&n.open({...w,el:y.currentTarget}),onPointerLeave:y=>y.pointerType==="mouse"&&n.close(),onFocus:y=>Xm(y.currentTarget)&&!i&&n.open({...w,el:y.currentTarget}),onClick:y=>{if((i==null?void 0:i.key)===w.key){f();return}a(),l({...w,el:y.currentTarget})}}),m=o.jsxs(o.Fragment,{children:[u&&o.jsx(Od,{anchor:u.el,kind:u.kind,src:$n(u.src,"tile"),label:u.label,onOpen:()=>{const w=u;f(),w.to?t(w.to):p({src:$n(w.src,"full"),kind:w.kind,label:w.label})},onHoverIn:n.keep,onHoverOut:()=>!i&&n.close(),onClose:f},u.key),h&&o.jsx(Ed,{src:h.src,kind:h.kind,label:h.label,onClose:()=>p(null)})]});return{bind:g,isOpen:w=>(u==null?void 0:u.key)===w,surface:m}}function Gde({brief:e,prompt:t,brand:n,saidRef:r,expanded:a,clamped:i}){var T,M;const{scenes:l,presenters:u,demoProducts:f}=Nn(),h=Kde(".sc-ingredient"),p=(e==null?void 0:e.tokens)??[],g=((T=n==null?void 0:n.json)==null?void 0:T.products)??[],m=((M=n==null?void 0:n.json)==null?void 0:M.characters)??[],w=Qc(n),y=r1(n==null?void 0:n.json),[b,k]=s.useState({});s.useEffect(()=>{for(const j of p){if((j==null?void 0:j.t)!=="template")continue;const P=w.find(H=>H.id===j.id);if(!(P!=null&&P.previewUrl)||ud(P.previewColor))continue;const R=`t${j.id}`;cL(P.previewUrl).then(H=>{const D=ud(H??void 0);D&&k(B=>B[R]?B:{...B,[R]:D})})}});const S={products:g,demoProducts:f,cast:m,presenters:u,scenes:[...w,...l]},E=j=>{var R,H;const P=rL(j,S);if((P==null?void 0:P.kind)==="product"){const{product:D,demo:B}=P;return{key:`p${j.id}`,kind:"product",label:(D==null?void 0:D.name)??(B==null?void 0:B.name)??"product",thumb:D?Vm((H=(R=D==null?void 0:D.shots)==null?void 0:R[0])==null?void 0:H.file,"micro"):(B==null?void 0:B.previewUrl)??null,to:n&&(D||B)?Ea(n,j.id):void 0}}if((P==null?void 0:P.kind)==="presenter"){const{character:D,presenter:B}=P,V=(B==null?void 0:B.id)??(D==null?void 0:D.presenterId)??((D==null?void 0:D.origin)==="custom"?D.id:void 0),U=D?Kw(D):B?ki(B):{src:null};return{key:`h${j.id}`,kind:"presenter",label:D!=null&&D.supersededBy?`${D.name}, edited since`:(D==null?void 0:D.name)??(B==null?void 0:B.name)??"someone",thumb:U.src,crop:U.crop,to:n&&V?Ra(n,V):void 0}}if((P==null?void 0:P.kind)==="scene"){const D=P.scene;return{key:`t${j.id}`,kind:"scene",label:(D==null?void 0:D.name)??"a scene no longer in the catalog",thumb:(D==null?void 0:D.previewUrl)??null,to:n&&D?zr(n,D.id):void 0,tint:ud(D==null?void 0:D.previewColor),custom:P.custom}}if((j==null?void 0:j.t)==="color")return{key:`c${j.hex}`,kind:"color",label:j.name??j.hex,swatch:j.hex};if((j==null?void 0:j.t)==="ref")return{key:`r${j.imageHash}`,kind:"ref",label:j.label??"reference image",thumb:gn(j.imageHash,"micro"),previewHash:j.imageHash};if((j==null?void 0:j.t)==="mark"){const D=y.find(B=>B.hash===j.imageHash);return{key:`m${j.imageHash}`,kind:"mark",label:D?qm(n==null?void 0:n.json,D):"brand mark",thumb:gn(j.imageHash,"micro"),previewHash:j.imageHash}}return null},C=j=>{const P=o.jsxs(o.Fragment,{children:[j.thumb?o.jsx("img",{src:j.thumb,alt:"","data-crop":j.crop}):j.swatch?o.jsx("i",{style:{background:j.swatch}}):null,j.label]}),R=j.tint??(j.custom?b[j.key]:void 0),H=R?{"--tint":R}:void 0,D=(j.previewHash?gn(j.previewHash,"tile"):$n(j.thumb,"tile"))??(j.to?"":null);if(D!==null&&fp(j.kind)){const B=j.kind,V=h.isOpen(j.key),U={key:j.key,src:D,kind:B,label:j.label,to:j.to};return o.jsx("button",{type:"button",className:"sc-ingredient","data-kind":j.kind,"data-tinted":R?"":void 0,style:H,title:V?void 0:`${j.label}. Preview.`,"aria-label":`${j.label}. Preview.`,...h.bind(U),children:P},j.key)}return o.jsx("span",{className:"sc-ingredient","data-kind":j.kind,"data-tinted":R?"":void 0,style:H,title:`${j.kind}: ${j.label}`,children:P},j.key)},A=[];for(const j of p){if(j.t==="text"){const R=j.v.trim();R&&A.push(R);continue}const P=E(j);P&&A.push(C(P))}if(!A.length&&!t)return null;const L=A.flatMap((j,P)=>P?[" ",j]:[j]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:r,className:"sc-brief-said","data-expanded":a||void 0,"data-clamped":i||void 0,dir:"auto",children:L.length?L:t||""}),h.surface]})}const Yde=256,ll=new Map;function pv(e,t){for(ll.delete(e),ll.set(e,t);ll.size>Yde;)ll.delete(ll.keys().next().value)}function D$(e,t){const n=new Map(e.map(a=>[a.id,a])),r=[];for(let a=t.parentId?n.get(t.parentId):void 0;a;a=a.parentId?n.get(a.parentId):void 0)r.unshift(a);return{ancestors:r,siblings:e.filter(a=>a.parentId===t.parentId),children:e.filter(a=>a.parentId===t.id),history:e}}function qde(e,t){pv(e,t);for(const n of t.history??[])n.id!==e&&pv(n.id,D$(t.history??[],n))}function K9(e){const t=e.parentId?ll.get(e.parentId):void 0,n=t==null?void 0:t.history;if(!n)return;const r=n.some(a=>a.id===e.id)?n.map(a=>a.id===e.id?e:a):[...n,e];for(const a of r)pv(a.id,D$(r,a))}function Xde(e){var i;const[t,n]=s.useState(()=>{const l=ll.get(e.id);return l?{id:e.id,lineage:l}:null});s.useEffect(()=>{let l=!0;return Ee.lineage(e.id).then(u=>{l&&(qde(e.id,u),n({id:e.id,lineage:u}))}).catch(()=>{}),()=>{l=!1}},[e.id,e.childCount,e.status,e.parentId]);const r=(t==null?void 0:t.id)===e.id?t.lineage:ll.get(e.id)??null;if(!r)return{ancestors:[],children:[],siblings:[e],sibIndex:0,parentShot:null,history:null,rootId:e.id,loaded:!1};const a=r.siblings.some(l=>l.id===e.id)?r.siblings:[e,...r.siblings];return{ancestors:r.ancestors,children:r.children,siblings:a,sibIndex:a.findIndex(l=>l.id===e.id),parentShot:r.ancestors[r.ancestors.length-1]??null,history:r.history??null,rootId:((i=r.ancestors[0])==null?void 0:i.id)??e.id,loaded:!0}}const Qde=32,cl=new Map;function Jde(e){for(cl.delete(e.id),cl.set(e.id,e);cl.size>Qde;)cl.delete(cl.keys().next().value)}function e0e(e){const[t,n]=s.useState(()=>cl.get(e.id)??null);return s.useEffect(()=>{const r=cl.get(e.id);if(r){n(r);return}let a=!0;return Ee.node(e.id).then(i=>{a&&(Jde(i),n(i))}).catch(()=>{}),()=>{a=!1}},[e.id]),(t==null?void 0:t.id)===e.id?t:cl.get(e.id)??null}const t0e="(max-width: 1023px)",H$=380,O$=480,G9=380,Hu=e=>Math.min(O$,Math.max(H$,Math.round(e)));function n0e({node:e,rootId:t,items:n,loadMore:r,complete:a,brand:i,engines:l,projectId:u,onClose:f,onSelect:h,onRetry:p,onCancel:g,onKeep:m,onLanded:w,onRemix:y,onArchive:b,onUnarchive:k,onDelete:S,onRefined:E,subscribeActivity:C,tokenNames:A}){const{ancestors:L,children:T,history:M}=Xde(e),j=e0e(e),P=s.useMemo(()=>l.find(ke=>ke.id===e.engineId),[l,e.engineId]),{push:R}=rr(),[H,D]=Ma(qr.ovlPanelW,G9),B=s.useRef(0),V=s.useRef(0),U=s.useRef(null),K=s.useMemo(()=>{var ke;return(((ke=e.brief)==null?void 0:ke.tokens)??[]).some(et=>(et==null?void 0:et.t)&&et.t!=="text"&&et.t!=="format")},[e.brief]),O=s.useMemo(()=>{const ke=r1(i.json);return{...A,mark:et=>{const Et=ke.find(Qe=>Qe.hash===et);return Et?qm(i.json,Et):null}}},[A,i]),F=s.useMemo(()=>P$(j??e,O),[j,e,O]),[I,G]=s.useState(!1),[z,Y]=s.useState(!1),[Z,ee]=s.useState(!1),[pe,se]=s.useState(!1),[xe,J]=s.useState(!1),[te,X]=s.useState(!1);s.useEffect(()=>{ee(!1),X(!1),se(!1)},[e.id]),s.useEffect(()=>{if(!Z)return;const ke=setTimeout(()=>ee(!1),1400);return()=>clearTimeout(ke)},[Z]),s.useEffect(()=>{if(!te)return;const ke=setTimeout(()=>X(!1),1400);return()=>clearTimeout(ke)},[te]);const[ae,Le]=s.useState(null);Ly(ae,"--sc-ovl-dock-h");const ce=s.useRef(null),[Se,Ze]=s.useState(!1),[gt,Ke]=s.useState(!1);s.useEffect(()=>Ze(!1),[e.id]),s.useLayoutEffect(()=>{const ke=ce.current;if(!ke||Se)return;const et=()=>Ke(ke.scrollHeight>ke.clientHeight+1);et();const Et=new ResizeObserver(et);return Et.observe(ke),()=>Et.disconnect()},[F,Se]);const[nt,$e]=s.useState([]);s.useEffect(()=>{if(!(!C||nt.length===0))return C(ke=>{const et=new Map(ke.map(Et=>[Et.id,Et]));$e(Et=>{const Qe=Et.map(st=>et.get(st.id)??st);return Qe.some((st,rt)=>st!==Et[rt])?Qe:Et})})},[C,nt.length]);const ne=s.useMemo(()=>_de(M??[...L,e,...T.slice(0,6)],e,nt.length?[...n,...nt]:n),[M,L,e,T,n,nt]),Q=s.useMemo(()=>Vde(ne,e.id),[ne,e.id]);s.useEffect(()=>{const ke=nt.find(et=>et.status==="done"&&et.images[0]);ke&&($e(et=>et.filter(Et=>Et.id!==ke.id)),K9(ke),e.id===ke.parentId&&h(ke.id))},[nt,e.id,h]);const We=s.useMemo(()=>ne.find(ke=>ke.node.id===e.id)??null,[ne,e.id]),Ne=Nr(t0e),ie=ne.length>1&&Ne?T$(ne,e.id):e.kind!=="edit"?"Shot":M&&We?We.label:"Refinement",q=s.useMemo(()=>f4(n,e.id),[n,e.id]);s.useEffect(()=>{q.at>=0&&!a&&n.length-q.at<=6&&r()},[q.at,n.length,a,r]);const oe=ke=>{const et=ke>0?q.next:q.prev;et&&h(et.id)},Re=Id(),ze=(ke,et)=>ke!=null&&ke.images[0]?{onPointerEnter:Et=>{Et.pointerType==="mouse"&&Re.open({key:ke.id,src:gn(ke.images[0],"tile"),label:Dr(ke),noun:et,el:Et.currentTarget,id:ke.id})},onPointerLeave:Et=>{Et.pointerType==="mouse"&&Re.close()}}:{},Ye=Wde({onLeft:()=>oe(1),onRight:()=>oe(-1)});s.useEffect(()=>{const ke=Re.shown;if(!ke)return;const et=ke.noun==="Next shot"?q.next:q.prev;et!=null&&et.images[0]?Re.open({key:et.id,src:gn(et.images[0],"tile"),label:Dr(et),noun:ke.noun,el:ke.el,id:et.id}):Re.closeNow()},[e.id]),s.useEffect(()=>{var Qe,st;const ke=ne.findIndex(rt=>rt.node.id===e.id),Et=[(Qe=ne[ke-1])==null?void 0:Qe.node,(st=ne[ke+1])==null?void 0:st.node,q.prev,q.next].filter(rt=>!!(rt!=null&&rt.images[0])).map(rt=>{var Yt;const qt=new Image;return qt.decoding="async",qt.src=gn(rt.images[0],"tile"),(Yt=qt.decode)==null||Yt.call(qt).catch(()=>{}),qt});return()=>{for(const rt of Et)rt.src=""}},[ne,e.id,q.prev,q.next]);const Ie=e.images[0],De=e.promptHead.slice(0,40).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"")||"shot",Ge=async(ke=!1)=>{if(!z){Y(!0);try{const et=fetch(Tr(Ie)).then(Et=>{if(!Et.ok)throw new Error(`HTTP ${Et.status}`);return Et.blob()});await navigator.clipboard.write([new ClipboardItem({"image/png":et})]),ke?R({kind:"success",title:"Copied to clipboard"}):ee(!0)}catch(et){R(ln(et,"Copy failed"))}finally{Y(!1)}}},ft=async()=>{if(!pe){se(!0);try{await(e.archived?k(e):b(e))}finally{se(!1)}}},bt=async()=>{if(!xe){J(!0);try{const ke=e.brief?ly(e.brief):null;if(!ke||ke.every(et=>et.t==="text"&&!et.v.trim()))await navigator.clipboard.writeText(F);else{const et=st=>{var rt;switch(st.t){case"text":return st.v;case"product":return O.product(st.id)??"a product";case"character":return O.person(st.id)??"a presenter";case"template":return O.scene(st.id)??"a scene";case"color":return st.name??st.hex;case"ref":return"reference image";case"mark":return((rt=O.mark)==null?void 0:rt.call(O,st.imageHash))??"brand mark"}},{text:Et,html:Qe}=Ste(ke,et);await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([Et],{type:"text/plain"}),"text/html":new Blob([Qe],{type:"text/html"})})])}X(!0)}catch(ke){R(ln(ke,"Copy failed"))}finally{J(!1)}}};s.useEffect(()=>{const ke=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=ke}},[]);const at=[{key:"download",label:"Download",icon:o.jsx(yE,{size:14}),onClick:()=>{const ke=document.createElement("a");ke.href=Tr(Ie),ke.download=`${De}.png`,ke.click()}},{key:"keep",label:e.kept?"Remove from keepers":"Keep",icon:o.jsx(eo,{size:14,weight:e.kept?"fill":"regular"}),onClick:()=>m(e),tint:e.kept?"var(--sc-star)":void 0,on:e.kept},{key:"copy",label:"Copy image",icon:Z?o.jsx(Kn,{size:14,weight:"bold"}):o.jsx(Yx,{size:14}),onClick:()=>void Ge(),onMenu:()=>void Ge(!0),busy:z,said:Z?"Copied":void 0}],Zt=[{key:"archive",label:e.archived?"Restore":"Archive",icon:e.archived?o.jsx(ef,{size:14}):o.jsx(dm,{size:14}),onClick:()=>void ft(),busy:pe},...e.archived?[{key:"delete",label:"Delete permanently",icon:o.jsx(gm,{size:14}),onClick:()=>G(!0),tint:"var(--sc-red)",dialog:!0}]:[]],jt=e.status==="done"&&e.images.length>0,Ft=!jt&&e.kind!=="edit"&&!!e.brief,Pt=jt?[...at,...Zt]:Zt,Tt=jt?o.jsx(Jf,{children:Pt.map(ke=>o.jsxs(e1,{onSelect:ke.onMenu??ke.onClick,disabled:ke.busy,color:ke.tint?"red":void 0,children:[ke.icon,ke.label]},ke.key))}):void 0;return Br.createPortal(o.jsx(Nd,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:ke=>{var et;ke.preventDefault(),(et=U.current)==null||et.focus({preventScroll:!0})},children:o.jsxs("div",{ref:U,tabIndex:-1,className:"sc-ovl","data-fb":"shot-overlay","data-fb-node":e.id,role:"dialog","aria-modal":"true","aria-label":Dr(e),"data-rail":n.length>1?"":void 0,style:{"--sc-ovl-panel-w":`${Hu(H)}px`},children:[n.length>1&&o.jsx(Bde,{shots:n,activeId:e.id,onSelect:h,onEndReached:r,complete:a}),o.jsxs("header",{className:"sc-ovl-bar",children:[o.jsxs("div",{className:"sc-ovl-bar-l",children:[o.jsx(fr,{label:"Close (esc)",children:o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:f,"aria-label":"Close",children:o.jsx(jn,{size:13})})}),q.at>=0&&n.length>1&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!q.prev,onClick:()=>q.prev&&h(q.prev.id),"aria-label":"Previous shot",...ze(q.prev,"Previous shot"),children:o.jsx($a,{size:13})}),o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!q.next,onClick:()=>q.next&&h(q.next.id),"aria-label":"Next shot",...ze(q.next,"Next shot"),children:o.jsx(Al,{size:13})})]})]}),Pt.length>0&&o.jsxs("div",{className:"sc-ovl-bar-r",children:[o.jsx("div",{className:"sc-ovl-acts",children:Pt.map(ke=>o.jsx(fr,{label:ke.said??ke.label,open:!!ke.said,children:o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:ke.onClick,"aria-label":ke.label,"aria-pressed":ke.on===void 0?void 0:ke.on,"data-on":ke.on||void 0,"aria-haspopup":ke.dialog?"dialog":void 0,"aria-busy":ke.busy||void 0,"data-busy":ke.busy||void 0,style:ke.tint?{color:ke.tint}:void 0,children:ke.icon})},ke.key))}),o.jsxs(Cs,{children:[o.jsx(fr,{label:"More actions",children:o.jsx(js,{children:o.jsx("button",{type:"button",className:"sc-icon-btn sc-ovl-overflow","aria-label":"More actions",children:o.jsx(Pv,{size:18,weight:"bold"})})})}),o.jsx(As,{align:"end",sideOffset:6,children:Pt.map(ke=>o.jsxs(qn,{onSelect:ke.onMenu??ke.onClick,disabled:ke.busy,color:ke.tint?"red":void 0,children:[ke.icon,ke.label]},ke.key))})]})]})]}),o.jsx(Bf,{open:I,onOpenChange:G,children:o.jsxs(Uf,{maxWidth:"420px",children:[o.jsx(Wf,{children:"Delete this shot permanently?"}),o.jsx(Kf,{size:"2",children:"This cannot be undone."}),o.jsxs(Vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Yf,{children:o.jsx(Sa,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Gf,{children:o.jsx(Sa,{color:"red",onClick:()=>S(e),children:"Delete permanently"})})]})]})}),Re.shown&&o.jsx(Od,{anchor:Re.shown.el,kind:"shot",noun:Re.shown.noun,src:Re.shown.src,label:Re.shown.label,onOpen:()=>{var et;const ke=(et=Re.shown)==null?void 0:et.id;Re.closeNow(),ke&&h(ke)},onHoverIn:Re.keep,onHoverOut:Re.close,onClose:Re.closeNow},Re.shown.key),o.jsxs("div",{className:"sc-ovl-stage","data-takes":ne.length>1?"":void 0,...Ye,children:[o.jsx(Lde,{node:e,onRetry:()=>p(e),onCancel:()=>g(e),engineName:P==null?void 0:P.displayName,menu:Tt}),ne.length>1?o.jsx(Zde,{trail:ne,activeId:e.id,names:O,onSelect:h}):o.jsx("div",{className:"sc-trail sc-trail-empty","aria-hidden":!0})]}),o.jsx("div",{className:"sc-ovl-resize",role:"separator","aria-orientation":"vertical","aria-label":"Resize the details panel","aria-valuemin":H$,"aria-valuemax":O$,"aria-valuenow":Hu(H),tabIndex:0,onPointerDown:ke=>{ke.button===0&&(ke.preventDefault(),ke.stopPropagation(),ke.currentTarget.setPointerCapture(ke.pointerId))},onPointerMove:ke=>{if(!ke.currentTarget.hasPointerCapture(ke.pointerId))return;const et=ke.currentTarget.closest(".sc-ovl");B.current=ke.clientX,!V.current&&(V.current=requestAnimationFrame(()=>{V.current=0,et==null||et.style.setProperty("--sc-ovl-panel-w",`${Hu(window.innerWidth-B.current)}px`)}))},onPointerUp:ke=>{ke.currentTarget.hasPointerCapture(ke.pointerId)&&(ke.currentTarget.releasePointerCapture(ke.pointerId),D(Hu(window.innerWidth-ke.clientX)))},onDoubleClick:ke=>{ke.stopPropagation(),D(G9)},onKeyDown:ke=>{ke.key==="ArrowLeft"?D(et=>Hu(et+16)):ke.key==="ArrowRight"&&D(et=>Hu(et-16))}}),o.jsxs("aside",{className:"sc-ovl-meta",children:[o.jsxs("div",{className:"sc-ovl-scroll",children:[o.jsxs("div",{className:"sc-ovl-head",children:[o.jsx("b",{children:ie}),e.archived&&o.jsx("small",{className:"sc-ovl-flag",children:"archived"}),jt&&e.costUsd>0&&o.jsxs("small",{className:"sc-ovl-spend",title:"Of your API budget",children:["$",e.costUsd.toFixed(2)]})]}),e.kind!=="root"&&(F||K)&&o.jsxs("div",{className:"sc-ovl-sec sc-ovl-brief",children:[o.jsxs("div",{className:"sc-ovl-brief-head",children:[o.jsx("span",{className:"sc-eyebrow",children:"Prompt"}),o.jsx(fr,{label:te?"Copied":"Copy the prompt",open:te||void 0,children:o.jsx("button",{type:"button",className:"sc-icon-btn sc-ovl-copy","aria-label":"Copy the prompt","aria-busy":xe||void 0,"data-busy":xe?"":void 0,onClick:()=>void bt(),children:te?o.jsx(Kn,{size:14,weight:"bold"}):o.jsx(Yx,{size:14})})})]}),o.jsx("div",{className:"sc-brief-record",children:o.jsx(Gde,{brief:e.brief,prompt:(j==null?void 0:j.prompt)??e.promptHead,brand:i,saidRef:ce,expanded:Se,clamped:gt&&!Se})}),(gt||Se)&&o.jsx("button",{type:"button",className:"sc-s sc-ovl-more","aria-expanded":Se,onClick:()=>Ze(ke=>!ke),children:Se?o.jsxs(o.Fragment,{children:[o.jsx(XI,{size:12})," Show less"]}):o.jsxs(o.Fragment,{children:[o.jsx(bl,{size:12})," Show more"]})})]}),(jt||Ft)&&o.jsxs("div",{className:"sc-sugg",children:[Ft&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>y(e),title:"Put this prompt back in the composer, to change and run again",children:[o.jsx(jd,{size:12})," Edit the prompt"]}),jt&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>p(e),title:"Run the same setup again for a different take",children:[o.jsx(ef,{size:12})," Try again"]}),jt&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>y(e),title:"Start a new shot from this setup: same prompt, chips, shape and count, ready to change",children:[o.jsx(pp,{size:12})," Reuse setup"]})]})]}),(jt||e.status==="running")&&o.jsx("div",{className:"sc-ovl-edit sc-dock",ref:Le,children:o.jsx(Py,{variant:"overlay",projectId:u,brand:i,engines:l,parentId:t,target:e,holdFor:e.status==="running"?e:Q,sourceImage:Ie,persistDraft:!1,onQueued:(ke,et,Et,Qe)=>{w(Qe??[]);const st=et==="edit"?Qe==null?void 0:Qe.find(rt=>rt.id===ke):void 0;st?(Ade(st.id),K9(st),$e(rt=>[...rt.filter(qt=>qt.id!==st.id),st]),h(st.id)):ke&&h(ke),ke&&(E==null||E(ke,et))}})})]})]})}),document.body)}function Y9(){const{shotId:e}=aa(),t=vH(),{push:n}=rr(),r=e?t.byId.get(e)??null:null,[a,i]=s.useState(null);s.useEffect(()=>{if(!e||r)return;let g=!0;return Ee.node(e).then(m=>g&&i({id:e,node:m.kind==="root"?null:m})).catch(()=>g&&i({id:e,node:null})),()=>{g=!1}},[e,r]);const l=s.useRef(a);l.current=a,s.useEffect(()=>{if(!e||r)return;let g=!0;const m=t.subscribeActivity(w=>{const y=w.find(k=>k.id===e);if(y)return i({id:e,node:y});const b=l.current;(b==null?void 0:b.id)!==e||!b.node||!M$([b.node],w).length||Ee.node(e).then(k=>g&&i({id:e,node:k.kind==="root"?null:k})).catch(()=>{})});return()=>{g=!1,m()}},[e,r,t.subscribeActivity]);const u=r??(a!==null&&a.id===e?a.node:null),f=!r&&a!==null&&a.id===e&&a.node===null,h=s.useRef(null);u&&(h.current=u);const p=u??(f?null:h.current);return s.useEffect(()=>{f&&(n({kind:"info",title:"That shot is no longer available",detail:"Back to the feed."}),t.close())},[f,t.close,n]),p?o.jsx(n0e,{node:p,rootId:t.rootId,items:t.items,loadMore:t.loadMore,complete:t.complete,brand:t.brand,engines:t.engines,projectId:t.projectId,onClose:t.close,onSelect:t.select,onRetry:t.retry,onCancel:t.cancel,onKeep:t.keep,onLanded:t.landed,onRefined:t.refined,subscribeActivity:t.subscribeActivity,tokenNames:t.tokenNames,onRemix:t.remix,onArchive:()=>t.archive(p),onUnarchive:()=>t.unarchive(p),onDelete:()=>t.delete(p)}):f?null:o.jsx("div",{className:"sc-ovl-wait",role:"status","aria-label":"Loading",children:o.jsx(Pr,{size:"3"})})}const q9=10;function r0e(){const{status:e,recent:t,history:n,featured:r,running:a,releasesUrl:i,notesFor:l,markSeen:u}=eu(),{hash:f}=Un(),h=f.startsWith("#v")?n.findIndex(S=>`#v${S.version}`===f)+1:0,[p,g]=s.useState(q9),m=Math.min(n.length,Math.max(p,t.length,h)),w=m<n.length,y=s.useRef(null),b=S=>{var E;y.current=S?((E=n[m])==null?void 0:E.version)??null:null,g(m+q9)};s.useEffect(()=>{var E,C;const S=y.current;y.current=null,!(!S||w)&&((C=(E=document.getElementById(`v${S}`))==null?void 0:E.querySelector("h2"))==null||C.focus())},[m,w]),s.useEffect(()=>{e==="ready"&&u()},[e,u]);const k=s.useRef(null);return s.useEffect(()=>{let S=0;const E=requestAnimationFrame(()=>{S=window.setTimeout(()=>{var C;return(C=k.current)==null?void 0:C.focus({preventScroll:!0})},0)});return()=>{cancelAnimationFrame(E),window.clearTimeout(S)}},[]),s.useEffect(()=>{var S;e!=="ready"||!f||(S=document.getElementById(decodeURIComponent(f.slice(1))))==null||S.scrollIntoView({block:"start"})},[e,f]),o.jsx(ds,{children:o.jsxs("main",{className:"sc-wn-page",id:"main","aria-labelledby":"sc-wn-title",children:[o.jsxs("header",{className:"sc-wn-page-head",children:[o.jsx("h1",{id:"sc-wn-title",ref:k,tabIndex:-1,children:"What's new"}),o.jsx("p",{children:"What changed in Scenri, newest first."})]}),e==="failed"?o.jsx("p",{className:"sc-wn-txt",children:ER}):e==="ready"&&n.length===0?o.jsx("p",{className:"sc-wn-txt",children:CR}):o.jsxs(o.Fragment,{children:[o.jsx("ol",{className:"sc-wn-list",children:n.slice(0,m).map(S=>o.jsx(s0e,{current:S.version===a,entry:S,lead:S.version===(r==null?void 0:r.version),notes:l(S.version)},S.version))}),w&&o.jsx(a0e,{count:m,onMore:b})]}),e==="ready"&&i&&o.jsxs("footer",{className:"sc-wn-page-foot",children:[o.jsx("p",{children:"Every version, and every fix the notes here leave out, is in the full release notes."}),o.jsxs("a",{className:"sc-wn-link",href:i,target:"_blank",rel:"noopener noreferrer",children:["Full release notes",o.jsx("span",{className:"sc-vh",children:" on GitHub, opens in a new tab"}),o.jsx(Ac,{size:13,"aria-hidden":"true"})]})]})]})})}function s0e({entry:e,lead:t,current:n,notes:r}){const a=!!e.announce,i=jR(e),[l,u]=s.useState(!1);return o.jsxs("li",{className:"sc-wn-row",id:`v${e.version}`,"data-kind":a?"headline":"small","data-lead":t||void 0,children:[o.jsx(MR,{entry:e,current:n}),o.jsxs("div",{className:"sc-wn-what",children:[e.title&&o.jsx("h2",{className:"sc-wn-row-hed",tabIndex:-1,children:e.title}),i&&o.jsx(AR,{picture:i,eager:t,onOpen:()=>u(!0)}),o.jsx(vee,{sections:e.sections}),r&&o.jsx(yee,{href:r,version:e.version})]}),l&&i&&o.jsx(gee,{src:i.src,alt:i.alt,onClose:()=>u(!1)})]})}function a0e({count:e,onMore:t}){const n=s.useRef(null),r=s.useRef(t);return r.current=t,s.useEffect(()=>{const a=n.current;if(!a||typeof IntersectionObserver>"u")return;const i=new IntersectionObserver(l=>l.some(u=>u.isIntersecting)&&r.current(!1),{rootMargin:"0px 0px 480px 0px"});return i.observe(a),()=>i.disconnect()},[e]),o.jsx("div",{className:"sc-wn-more",children:o.jsx("button",{ref:n,type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>r.current(document.activeElement===n.current),children:"Show older updates"})})}function o0e(){const e=D7();return o.jsx(Vs,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(Tw,{failure:{kind:"unknown",title:"This page could not be shown.",fix:"Reloading usually brings it back.",raw:String((e==null?void 0:e.message)??e??""),retryable:!0},action:o.jsx(Sa,{size:"1",variant:"soft",color:"gray",onClick:()=>window.location.reload(),children:"Reload"})})})}function i0e(){const{setSlug:e=""}=aa(),{pathname:t,search:n}=Un(),{brand:r,sets:a,loaded:i,refresh:l}=cn(),u=Bn(),f=mn({path:mt.set,end:!1}),h=a.find(m=>m.slug===e)??a.find(m=>m.id===e)??null;qc(h==null?void 0:h.name);const[p,g]=s.useState(null);if(s.useEffect(()=>{if(!i||h)return;if(p===e){u(Sr(r),{replace:!0});return}let m=!0;return l().finally(()=>m&&g(e)),()=>{m=!1}},[i,h,e,p,r,u,l]),s.useEffect(()=>{h&&g(null)},[h]),!i||!h)return null;if(h.slug!==e){const m=f?t.slice(f.pathnameBase.length):"";return o.jsx(Ja,{to:L0(r,h)+m+n,replace:!0})}return o.jsx(R$,{set:h},h.id)}function l0e(){const{pathname:e,search:t}=Un();return o.jsx(Ja,{to:rY(e,t),replace:!0})}function c0e(){const{brandSlug:e}=aa();return o.jsx(Ja,{to:`/${e}?settings=brand`,replace:!0})}function u0e(){const{sceneId:e}=aa();return o.jsxs(o.Fragment,{children:[o.jsx(Pie,{},e),o.jsx(Zc,{})]})}function d0e(){const{presenterId:e}=aa();return o.jsxs(o.Fragment,{children:[o.jsx(Fie,{},e),o.jsx(Zc,{},e)]})}function f0e(){const{productId:e}=aa();return o.jsx($ue,{},e)}const h0e=fO([{element:o.jsx(Fse,{}),errorElement:o.jsx(o0e,{}),children:[{index:!0,element:o.jsx(Lee,{})},{path:mt.setup,element:o.jsx(Wse,{})},{path:mt.legacy,element:o.jsx(l0e,{})},{path:mt.brand,element:o.jsx(Rse,{}),children:[{index:!0,element:o.jsx(bie,{})},{path:mt.hub,element:o.jsx(R$,{set:null}),children:[{path:mt.hubShot,element:o.jsx(Y9,{})}]},{path:mt.set,element:o.jsx(i0e,{}),children:[{path:mt.setShot,element:o.jsx(Y9,{})}]},{path:mt.kit,element:o.jsx(c0e,{})},{path:mt.whatsNew,element:o.jsx(r0e,{})},{path:mt.products,element:o.jsx(bue,{})},{path:mt.product,element:o.jsx(f0e,{})},{path:mt.scenes,element:o.jsx(Cie,{}),children:[{path:mt.sceneStudio,element:o.jsx(L9,{})}]},{path:mt.scene,element:o.jsx(u0e,{}),children:[{path:mt.sceneEdit,element:o.jsx(L9,{})}]},{path:mt.presenters,element:o.jsx(Iie,{}),children:[{path:mt.presenterStudio,element:o.jsx(tue,{})}]},{path:mt.presenter,element:o.jsx(d0e,{}),children:[{path:mt.presenterEdit,element:o.jsx(Uce,{})}]}]},{path:mt.notFound,element:o.jsx(Ja,{to:mt.root,replace:!0})}]}]),j6=localStorage.getItem("sc-theme")??localStorage.getItem("bt-theme");document.documentElement.dataset.theme=j6==="light"||j6==="dark"?j6:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";wX();const p0e={color:"currentColor",size:"1em",weight:"regular",mirrored:!1,"aria-hidden":!0};JT.createRoot(document.getElementById("root")).render(o.jsx(zn.StrictMode,{children:o.jsx(_7.Provider,{value:p0e,children:o.jsx(PG,{children:o.jsx(IG,{children:o.jsx(HH,{router:h0e})})})})}));