scenri 0.20.0 → 0.20.1

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 tx=e=>{throw TypeError(e)};var nx=(e,t,n)=>t.has(e)||tx("Cannot "+n);var as=(e,t,n)=>(nx(e,t,"read from private field"),n?n.call(e):t.get(e)),rx=(e,t,n)=>t.has(e)?tx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ug=(e,t,n,r)=>(nx(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function HT(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 B9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wg={exports:{}},f0={},Kg={exports:{}},xn={};/**
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 sx;function OT(){if(sx)return xn;sx=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"),m=Symbol.iterator;function g(z){return z===null||typeof z!="object"?null:(z=m&&z[m]||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,q,Z){this.props=z,this.context=q,this.refs=b,this.updater=Z||w}k.prototype.isReactComponent={},k.prototype.setState=function(z,q){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,q,"setState")},k.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function S(){}S.prototype=k.prototype;function E(z,q,Z){this.props=z,this.context=q,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,q,Z){var Q,me={},te=null,he=null;if(q!=null)for(Q in q.ref!==void 0&&(he=q.ref),q.key!==void 0&&(te=""+q.key),q)L.call(q,Q)&&!M.hasOwnProperty(Q)&&(me[Q]=q[Q]);var re=arguments.length-2;if(re===1)me.children=Z;else if(1<re){for(var ee=Array(re),J=0;J<re;J++)ee[J]=arguments[J+2];me.children=ee}if(z&&z.defaultProps)for(Q in re=z.defaultProps,re)me[Q]===void 0&&(me[Q]=re[Q]);return{$$typeof:e,type:z,key:te,ref:he,props:me,_owner:T.current}}function R(z,q){return{$$typeof:e,type:z.type,key:q,ref:z.ref,props:z.props,_owner:z._owner}}function P(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function H(z){var q={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Z){return q[Z]})}var D=/\/+/g;function B(z,q){return typeof z=="object"&&z!==null&&z.key!=null?H(""+z.key):q.toString(36)}function V(z,q,Z,Q,me){var te=typeof z;(te==="undefined"||te==="boolean")&&(z=null);var he=!1;if(z===null)he=!0;else switch(te){case"string":case"number":he=!0;break;case"object":switch(z.$$typeof){case e:case t:he=!0}}if(he)return he=z,me=me(he),z=Q===""?"."+B(he,0):Q,A(me)?(Z="",z!=null&&(Z=z.replace(D,"$&/")+"/"),V(me,q,Z,"",function(J){return J})):me!=null&&(P(me)&&(me=R(me,Z+(!me.key||he&&he.key===me.key?"":(""+me.key).replace(D,"$&/")+"/")+z)),q.push(me)),1;if(he=0,Q=Q===""?".":Q+":",A(z))for(var re=0;re<z.length;re++){te=z[re];var ee=Q+B(te,re);he+=V(te,q,Z,ee,me)}else if(ee=g(z),typeof ee=="function")for(z=ee.call(z),re=0;!(te=z.next()).done;)te=te.value,ee=Q+B(te,re++),he+=V(te,q,Z,ee,me);else if(te==="object")throw q=String(z),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return he}function K(z,q,Z){if(z==null)return z;var Q=[],me=0;return V(z,Q,"","",function(te){return q.call(Z,te,me++)}),Q}function U(z){if(z._status===-1){var q=z._result;q=q(),q.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=q)}if(z._status===1)return z._result.default;throw z._result}var I={current:null},_={transition:null},O={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:_,ReactCurrentOwner:T};function Y(){throw Error("act(...) is not supported in production builds of React.")}return xn.Children={map:K,forEach:function(z,q,Z){K(z,function(){q.apply(this,arguments)},Z)},count:function(z){var q=0;return K(z,function(){q++}),q},toArray:function(z){return K(z,function(q){return q})||[]},only:function(z){if(!P(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},xn.Component=k,xn.Fragment=n,xn.Profiler=a,xn.PureComponent=E,xn.StrictMode=r,xn.Suspense=f,xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,xn.act=Y,xn.cloneElement=function(z,q,Z){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var Q=y({},z.props),me=z.key,te=z.ref,he=z._owner;if(q!=null){if(q.ref!==void 0&&(te=q.ref,he=T.current),q.key!==void 0&&(me=""+q.key),z.type&&z.type.defaultProps)var re=z.type.defaultProps;for(ee in q)L.call(q,ee)&&!M.hasOwnProperty(ee)&&(Q[ee]=q[ee]===void 0&&re!==void 0?re[ee]:q[ee])}var ee=arguments.length-2;if(ee===1)Q.children=Z;else if(1<ee){re=Array(ee);for(var J=0;J<ee;J++)re[J]=arguments[J+2];Q.children=re}return{$$typeof:e,type:z.type,key:me,ref:te,props:Q,_owner:he}},xn.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},xn.createElement=j,xn.createFactory=function(z){var q=j.bind(null,z);return q.type=z,q},xn.createRef=function(){return{current:null}},xn.forwardRef=function(z){return{$$typeof:u,render:z}},xn.isValidElement=P,xn.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:U}},xn.memo=function(z,q){return{$$typeof:h,type:z,compare:q===void 0?null:q}},xn.startTransition=function(z){var q=_.transition;_.transition={};try{z()}finally{_.transition=q}},xn.unstable_act=Y,xn.useCallback=function(z,q){return I.current.useCallback(z,q)},xn.useContext=function(z){return I.current.useContext(z)},xn.useDebugValue=function(){},xn.useDeferredValue=function(z){return I.current.useDeferredValue(z)},xn.useEffect=function(z,q){return I.current.useEffect(z,q)},xn.useId=function(){return I.current.useId()},xn.useImperativeHandle=function(z,q,Z){return I.current.useImperativeHandle(z,q,Z)},xn.useInsertionEffect=function(z,q){return I.current.useInsertionEffect(z,q)},xn.useLayoutEffect=function(z,q){return I.current.useLayoutEffect(z,q)},xn.useMemo=function(z,q){return I.current.useMemo(z,q)},xn.useReducer=function(z,q,Z){return I.current.useReducer(z,q,Z)},xn.useRef=function(z){return I.current.useRef(z)},xn.useState=function(z){return I.current.useState(z)},xn.useSyncExternalStore=function(z,q,Z){return I.current.useSyncExternalStore(z,q,Z)},xn.useTransition=function(){return I.current.useTransition()},xn.version="18.3.1",xn}var ax;function uv(){return ax||(ax=1,Kg.exports=OT()),Kg.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 ox;function IT(){if(ox)return f0;ox=1;var e=uv(),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,m={},g=null,w=null;h!==void 0&&(g=""+h),f.key!==void 0&&(g=""+f.key),f.ref!==void 0&&(w=f.ref);for(p in f)r.call(f,p)&&!i.hasOwnProperty(p)&&(m[p]=f[p]);if(u&&u.defaultProps)for(p in f=u.defaultProps,f)m[p]===void 0&&(m[p]=f[p]);return{$$typeof:t,type:u,key:g,ref:w,props:m,_owner:a.current}}return f0.Fragment=n,f0.jsx=l,f0.jsxs=l,f0}var ix;function FT(){return ix||(ix=1,Wg.exports=IT()),Wg.exports}var o=FT(),s=uv();const zn=B9(s),Oc=HT({__proto__:null,default:zn},[s]);var mh={},Gg={exports:{}},Hs={},Yg={exports:{}},qg={};/**
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 lx;function _T(){return lx||(lx=1,(function(e){function t(_,O){var Y=_.length;_.push(O);e:for(;0<Y;){var z=Y-1>>>1,q=_[z];if(0<a(q,O))_[z]=O,_[Y]=q,Y=z;else break e}}function n(_){return _.length===0?null:_[0]}function r(_){if(_.length===0)return null;var O=_[0],Y=_.pop();if(Y!==O){_[0]=Y;e:for(var z=0,q=_.length,Z=q>>>1;z<Z;){var Q=2*(z+1)-1,me=_[Q],te=Q+1,he=_[te];if(0>a(me,Y))te<q&&0>a(he,me)?(_[z]=he,_[te]=Y,z=te):(_[z]=me,_[Q]=Y,z=Q);else if(te<q&&0>a(he,Y))_[z]=he,_[te]=Y,z=te;else break e}}return O}function a(_,O){var Y=_.sortIndex-O.sortIndex;return Y!==0?Y:_.id-O.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,m=null,g=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(_){for(var O=n(h);O!==null;){if(O.callback===null)r(h);else if(O.startTime<=_)r(h),O.sortIndex=O.expirationTime,t(f,O);else break;O=n(h)}}function A(_){if(b=!1,C(_),!y)if(n(f)!==null)y=!0,U(L);else{var O=n(h);O!==null&&I(A,O.startTime-_)}}function L(_,O){y=!1,b&&(b=!1,S(j),j=-1),w=!0;var Y=g;try{for(C(O),m=n(f);m!==null&&(!(m.expirationTime>O)||_&&!H());){var z=m.callback;if(typeof z=="function"){m.callback=null,g=m.priorityLevel;var q=z(m.expirationTime<=O);O=e.unstable_now(),typeof q=="function"?m.callback=q:m===n(f)&&r(f),C(O)}else r(f);m=n(f)}if(m!==null)var Z=!0;else{var Q=n(h);Q!==null&&I(A,Q.startTime-O),Z=!1}return Z}finally{m=null,g=Y,w=!1}}var T=!1,M=null,j=-1,R=5,P=-1;function H(){return!(e.unstable_now()-P<R)}function D(){if(M!==null){var _=e.unstable_now();P=_;var O=!0;try{O=M(!0,_)}finally{O?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,K=V.port2;V.port1.onmessage=D,B=function(){K.postMessage(null)}}else B=function(){k(D,0)};function U(_){M=_,T||(T=!0,B())}function I(_,O){j=k(function(){_(e.unstable_now())},O)}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(_){_.callback=null},e.unstable_continueExecution=function(){y||w||(y=!0,U(L))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(_){switch(g){case 1:case 2:case 3:var O=3;break;default:O=g}var Y=g;g=O;try{return _()}finally{g=Y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,O){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var Y=g;g=_;try{return O()}finally{g=Y}},e.unstable_scheduleCallback=function(_,O,Y){var z=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?z+Y:z):Y=z,_){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=Y+q,_={id:p++,callback:O,priorityLevel:_,startTime:Y,expirationTime:q,sortIndex:-1},Y>z?(_.sortIndex=Y,t(h,_),n(f)===null&&_===n(h)&&(b?(S(j),j=-1):b=!0,I(A,Y-z))):(_.sortIndex=q,t(f,_),y||w||(y=!0,U(L))),_},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(_){var O=g;return function(){var Y=g;g=O;try{return _.apply(this,arguments)}finally{g=Y}}}})(qg)),qg}var cx;function VT(){return cx||(cx=1,Yg.exports=_T()),Yg.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 ux;function ZT(){if(ux)return Hs;ux=1;var e=uv(),t=VT();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={},m={};function g(c){return f.call(m,c)?!0:f.call(p,c)?!1:h.test(c)?m[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?g(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"),R=Symbol.for("react.profiler"),P=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"),K=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),_=Symbol.iterator;function O(c){return c===null||typeof c!="object"?null:(c=_&&c[_]||c["@@iterator"],typeof c=="function"?c:null)}var Y=Object.assign,z;function q(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 Q(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(ze){var x=ze}Reflect.construct(c,[],d)}else{try{d.call()}catch(ze){x=ze}c.call(d.prototype)}else{try{throw Error()}catch(ze){x=ze}c()}}catch(ze){if(ze&&x&&typeof ze.stack=="string"){for(var N=ze.stack.split(`
35
+ `),$=x.stack.split(`
36
+ `),W=N.length-1,pe=$.length-1;1<=W&&0<=pe&&N[W]!==$[pe];)pe--;for(;1<=W&&0<=pe;W--,pe--)if(N[W]!==$[pe]){if(W!==1||pe!==1)do if(W--,pe--,0>pe||N[W]!==$[pe]){var be=`
37
+ `+N[W].replace(" at new "," at ");return c.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",c.displayName)),be}while(1<=W&&0<=pe);break}}}finally{Z=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?q(c):""}function me(c){switch(c.tag){case 5:return q(c.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return c=Q(c.type,!1),c;case 11:return c=Q(c.type.render,!1),c;case 1:return c=Q(c.type,!0),c;default:return""}}function te(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 R: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 P: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 K:return d=c.displayName||null,d!==null?d:te(c.type)||"Memo";case U:d=c._payload,c=c._init;try{return te(c(d))}catch{}}return null}function he(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 te(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 re(c){switch(typeof c){case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function ee(c){var d=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function J(c){var d=ee(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=J(c))}function Me(c){if(!c)return!1;var d=c._valueTracker;if(!d)return!0;var v=d.getValue(),x="";return c&&(x=ee(c)?c.checked?"true":"false":c.value),c=x,c!==v?(d.setValue(c),!0):!1}function ue(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 Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:v??c._wrapperState.initialChecked})}function Be(c,d){var v=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;v=re(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 vt(c,d){d=d.checked,d!=null&&C(c,"checked",d,!1)}function Ue(c,d){vt(c,d);var v=re(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")?De(c,d.type,v):d.hasOwnProperty("defaultValue")&&De(c,d.type,re(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(c.defaultChecked=!!d.defaultChecked)}function Xe(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 De(c,d,v){(d!=="number"||ue(c.ownerDocument)!==c)&&(v==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+v&&(c.defaultValue=""+v))}var G=Array.isArray;function oe(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=""+re(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 Y({},d,{value:void 0,defaultValue:void 0,children:""+c._wrapperState.initialValue})}function Oe(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(G(v)){if(1<v.length)throw Error(n(93));v=v[0]}d=v}d==null&&(d=""),v=d}c._wrapperState={initialValue:re(v)}}function ie(c,d){var v=re(d.value),x=re(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 X(c){var d=c.textContent;d===c._wrapperState.initialValue&&d!==""&&d!==null&&(c.value=d)}function se(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"?se(d):c==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var _e,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(_e=_e||document.createElement("div"),_e.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=_e.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;d.firstChild;)c.appendChild(d.firstChild)}});function ge(c,d){if(d){var v=c.firstChild;if(v&&v===c.lastChild&&v.nodeType===3){v.nodeValue=d;return}}c.textContent=d}var Qe={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},at=["Webkit","ms","Moz","O"];Object.keys(Qe).forEach(function(c){at.forEach(function(d){d=d+c.charAt(0).toUpperCase()+c.substring(1),Qe[d]=Qe[c]})});function wt(c,d,v){return d==null||typeof d=="boolean"||d===""?"":v||typeof d!="number"||d===0||Qe.hasOwnProperty(c)&&Qe[c]?(""+d).trim():d+"px"}function Et(c,d){c=c.style;for(var v in d)if(d.hasOwnProperty(v)){var x=v.indexOf("--")===0,N=wt(v,d[v],x);v==="float"&&(v="cssFloat"),x?c.setProperty(v,N):c[v]=N}}var ot=Y({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 It(c,d){if(d){if(ot[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 Mt(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 Zt=null;function Rt(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var Tt=null,Ee=null,Je=null;function St(c){if(c=Xd(c)){if(typeof Tt!="function")throw Error(n(280));var d=c.stateNode;d&&(d=R1(d),Tt(c.stateNode,c.type,d))}}function qe(c){Ee?Je?Je.push(c):Je=[c]:Ee=c}function st(){if(Ee){var c=Ee,d=Je;if(Je=Ee=null,St(c),d)for(c=0;c<d.length;c++)St(d[c])}}function rt(c,d){return c(d)}function Xt(){}var Gt=!1;function sn(c,d,v){if(Gt)return c(d,v);Gt=!0;try{return rt(c,d,v)}finally{Gt=!1,(Ee!==null||Je!==null)&&(Xt(),st())}}function Ut(c,d){var v=c.stateNode;if(v===null)return null;var x=R1(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 An=!1;if(u)try{var Bt={};Object.defineProperty(Bt,"passive",{get:function(){An=!0}}),window.addEventListener("test",Bt,Bt),window.removeEventListener("test",Bt,Bt)}catch{An=!1}function ne(c,d,v,x,N,$,W,pe,be){var ze=Array.prototype.slice.call(arguments,3);try{d.apply(v,ze)}catch(dt){this.onError(dt)}}var ce=!1,de=null,Ve=!1,Ie=null,mt={onError:function(c){ce=!0,de=c}};function bt(c,d,v,x,N,$,W,pe,be){ce=!1,de=null,ne.apply(mt,arguments)}function kt(c,d,v,x,N,$,W,pe,be){if(bt.apply(this,arguments),ce){if(ce){var ze=de;ce=!1,de=null}else throw Error(n(198));Ve||(Ve=!0,Ie=ze)}}function nt(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 yt(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 Ce(c){if(nt(c)!==c)throw Error(n(188))}function xe(c){var d=c.alternate;if(!d){if(d=nt(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 Ce(N),c;if($===x)return Ce(N),d;$=$.sibling}throw Error(n(188))}if(v.return!==x.return)v=N,x=$;else{for(var W=!1,pe=N.child;pe;){if(pe===v){W=!0,v=N,x=$;break}if(pe===x){W=!0,x=N,v=$;break}pe=pe.sibling}if(!W){for(pe=$.child;pe;){if(pe===v){W=!0,v=$,x=N;break}if(pe===x){W=!0,x=$,v=N;break}pe=pe.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 et(c){return c=xe(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 ke=t.unstable_scheduleCallback,it=t.unstable_cancelCallback,ft=t.unstable_shouldYield,$e=t.unstable_requestPaint,Ke=t.unstable_now,Pt=t.unstable_getCurrentPriorityLevel,Yt=t.unstable_ImmediatePriority,jt=t.unstable_UserBlockingPriority,Ft=t.unstable_NormalPriority,Ne=t.unstable_LowPriority,Fe=t.unstable_IdlePriority,tt=null,F=null;function fe(c){if(F&&typeof F.onCommitFiberRoot=="function")try{F.onCommitFiberRoot(tt,c,void 0,(c.current.flags&128)===128)}catch{}}var ye=Math.clz32?Math.clz32:ct,Ze=Math.log,Pe=Math.LN2;function ct(c){return c>>>=0,c===0?32:31-(Ze(c)/Pe|0)|0}var Ot=64,_t=4194304;function Lt(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 vn(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 pe=W&~N;pe!==0?x=Lt(pe):($&=W,$!==0&&(x=Lt($)))}else W=v&~N,W!==0?x=Lt(W):$!==0&&(x=Lt($));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-ye(d),N=1<<v,x|=c[v],d&=~N;return x}function qt(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 Nn(c,d){for(var v=c.suspendedLanes,x=c.pingedLanes,N=c.expirationTimes,$=c.pendingLanes;0<$;){var W=31-ye($),pe=1<<W,be=N[W];be===-1?((pe&v)===0||(pe&x)!==0)&&(N[W]=qt(pe,d)):be<=d&&(c.expiredLanes|=pe),$&=~pe}}function Qn(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function un(){var c=Ot;return Ot<<=1,(Ot&4194240)===0&&(Ot=64),c}function Jn(c){for(var d=[],v=0;31>v;v++)d.push(c);return d}function tn(c,d,v){c.pendingLanes|=d,d!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,d=31-ye(d),c[d]=v}function gr(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-ye(v),$=1<<N;d[N]=0,x[N]=-1,c[N]=-1,v&=~$}}function Or(c,d){var v=c.entangledLanes|=d;for(c=c.entanglements;v;){var x=31-ye(v),N=1<<x;N&d|c[x]&d&&(c[x]|=d),v&=~N}}var wn=0;function oa(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var Tn,ia,Ws,an,yn,Wn=!1,wr=[],hr=null,Mn=null,ps=null,lo=new Map,co=new Map,yr=[],Mi="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 Ta(c,d){switch(c){case"focusin":case"focusout":hr=null;break;case"dragenter":case"dragleave":Mn=null;break;case"mouseover":case"mouseout":ps=null;break;case"pointerover":case"pointerout":lo.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":co.delete(d.pointerId)}}function uo(c,d,v,x,N,$){return c===null||c.nativeEvent!==$?(c={blockedOn:d,domEventName:v,eventSystemFlags:x,nativeEvent:$,targetContainers:[N]},d!==null&&(d=Xd(d),d!==null&&ia(d)),c):(c.eventSystemFlags|=x,d=c.targetContainers,N!==null&&d.indexOf(N)===-1&&d.push(N),c)}function le(c,d,v,x,N){switch(d){case"focusin":return hr=uo(hr,c,d,v,x,N),!0;case"dragenter":return Mn=uo(Mn,c,d,v,x,N),!0;case"mouseover":return ps=uo(ps,c,d,v,x,N),!0;case"pointerover":var $=N.pointerId;return lo.set($,uo(lo.get($)||null,c,d,v,x,N)),!0;case"gotpointercapture":return $=N.pointerId,co.set($,uo(co.get($)||null,c,d,v,x,N)),!0}return!1}function Te(c){var d=Ul(c.target);if(d!==null){var v=nt(d);if(v!==null){if(d=v.tag,d===13){if(d=yt(v),d!==null){c.blockedOn=d,yn(c.priority,function(){Ws(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 lt(c){if(c.blockedOn!==null)return!1;for(var d=c.targetContainers;0<d.length;){var v=Jc(c.domEventName,c.eventSystemFlags,d[0],c.nativeEvent);if(v===null){v=c.nativeEvent;var x=new v.constructor(v.type,v);Zt=x,v.target.dispatchEvent(x),Zt=null}else return d=Xd(v),d!==null&&ia(d),c.blockedOn=v,!1;d.shift()}return!0}function Wt(c,d,v){lt(c)&&v.delete(d)}function ln(){Wn=!1,hr!==null&&lt(hr)&&(hr=null),Mn!==null&&lt(Mn)&&(Mn=null),ps!==null&&lt(ps)&&(ps=null),lo.forEach(Wt),co.forEach(Wt)}function _n(c,d){c.blockedOn===d&&(c.blockedOn=null,Wn||(Wn=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ln)))}function On(c){function d(N){return _n(N,c)}if(0<wr.length){_n(wr[0],c);for(var v=1;v<wr.length;v++){var x=wr[v];x.blockedOn===c&&(x.blockedOn=null)}}for(hr!==null&&_n(hr,c),Mn!==null&&_n(Mn,c),ps!==null&&_n(ps,c),lo.forEach(d),co.forEach(d),v=0;v<yr.length;v++)x=yr[v],x.blockedOn===c&&(x.blockedOn=null);for(;0<yr.length&&(v=yr[0],v.blockedOn===null);)Te(v),v.blockedOn===null&&yr.shift()}var Rn=A.ReactCurrentBatchConfig,bn=!0;function Ur(c,d,v,x){var N=wn,$=Rn.transition;Rn.transition=null;try{wn=1,fo(c,d,v,x)}finally{wn=N,Rn.transition=$}}function Vl(c,d,v,x){var N=wn,$=Rn.transition;Rn.transition=null;try{wn=4,fo(c,d,v,x)}finally{wn=N,Rn.transition=$}}function fo(c,d,v,x){if(bn){var N=Jc(c,d,v,x);if(N===null)D2(c,d,x,ms,v),Ta(c,x);else if(le(N,c,d,v,x))x.stopPropagation();else if(Ta(c,x),d&4&&-1<Mi.indexOf(c)){for(;N!==null;){var $=Xd(N);if($!==null&&Tn($),$=Jc(c,d,v,x),$===null&&D2(c,d,x,ms,v),$===N)break;N=$}N!==null&&x.stopPropagation()}else D2(c,d,x,null,v)}}var ms=null;function Jc(c,d,v,x){if(ms=null,c=Rt(x),c=Ul(c),c!==null)if(d=nt(c),d===null)c=null;else if(v=d.tag,v===13){if(c=yt(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 ms=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(Pt()){case Yt:return 1;case jt:return 4;case Ft:case Ne:return 16;case Fe:return 536870912;default:return 16}default:return 16}}var ho=null,Zl=null,eu=null;function m1(){if(eu)return eu;var c,d=Zl,v=d.length,x,N="value"in ho?ho.value:ho.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 eu=N.slice(c,1<x?1-x:void 0)}function Ri(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 tu(){return!0}function g1(){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 pe in c)c.hasOwnProperty(pe)&&(v=c[pe],this[pe]=v?v($):$[pe]);return this.isDefaultPrevented=($.defaultPrevented!=null?$.defaultPrevented:$.returnValue===!1)?tu:g1,this.isPropagationStopped=g1,this}return Y(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=tu)},stopPropagation:function(){var v=this.nativeEvent;v&&(v.stopPropagation?v.stopPropagation():typeof v.cancelBubble!="unknown"&&(v.cancelBubble=!0),this.isPropagationStopped=tu)},persist:function(){},isPersistent:tu}),d}var po={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pi=vs(po),Li=Y({},po,{view:0,detail:0}),v1=vs(Li),nu,zl,$i,Bl=Y({},Li,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:es,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!==$i&&($i&&c.type==="mousemove"?(nu=c.screenX-$i.screenX,zl=c.screenY-$i.screenY):zl=nu=0,$i=c),nu)},movementY:function(c){return"movementY"in c?c.movementY:zl}}),_d=vs(Bl),w1=Y({},Bl,{dataTransfer:0}),ve=vs(w1),ht=Y({},Li,{relatedTarget:0}),en=vs(ht),hn=Y({},po,{animationName:0,elapsedTime:0,pseudoElement:0}),nn=vs(hn),jn=Y({},po,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),Wr=vs(jn),In=Y({},po,{data:0}),sr=vs(In),or={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Da={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"},y1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Dn(c){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(c):(c=y1[c])?!!d[c]:!1}function es(){return Dn}var ws=Y({},Li,{key:function(c){if(c.key){var d=or[c.key]||c.key;if(d!=="Unidentified")return d}return c.type==="keypress"?(c=Ri(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?Da[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:es,charCode:function(c){return c.type==="keypress"?Ri(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?Ri(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),E2=vs(ws),Vd=Y({},Bl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ru=vs(Vd),b1=Y({},Li,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:es}),Ha=vs(b1),x1=Y({},po,{propertyName:0,elapsedTime:0,pseudoElement:0}),k1=vs(x1),M$=Y({},Bl,{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}),R$=vs(M$),P$=[9,13,27,32],C2=u&&"CompositionEvent"in window,Zd=null;u&&"documentMode"in document&&(Zd=document.documentMode);var L$=u&&"TextEvent"in window&&!Zd,Ky=u&&(!C2||Zd&&8<Zd&&11>=Zd),Gy=" ",Yy=!1;function qy(c,d){switch(c){case"keyup":return P$.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xy(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var su=!1;function $$(c,d){switch(c){case"compositionend":return Xy(d);case"keypress":return d.which!==32?null:(Yy=!0,Gy);case"textInput":return c=d.data,c===Gy&&Yy?null:c;default:return null}}function T$(c,d){if(su)return c==="compositionend"||!C2&&qy(c,d)?(c=m1(),eu=Zl=ho=null,su=!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 Ky&&d.locale!=="ko"?null:d.data;default:return null}}var D$={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 Qy(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d==="input"?!!D$[c.type]:d==="textarea"}function Jy(c,d,v,x){qe(x),d=A1(d,"onChange"),0<d.length&&(v=new Pi("onChange","change",null,v,x),c.push({event:v,listeners:d}))}var zd=null,Bd=null;function H$(c){vb(c,0)}function S1(c){var d=cu(c);if(Me(d))return c}function O$(c,d){if(c==="change")return d}var eb=!1;if(u){var j2;if(u){var A2="oninput"in document;if(!A2){var tb=document.createElement("div");tb.setAttribute("oninput","return;"),A2=typeof tb.oninput=="function"}j2=A2}else j2=!1;eb=j2&&(!document.documentMode||9<document.documentMode)}function nb(){zd&&(zd.detachEvent("onpropertychange",rb),Bd=zd=null)}function rb(c){if(c.propertyName==="value"&&S1(Bd)){var d=[];Jy(d,Bd,c,Rt(c)),sn(H$,d)}}function I$(c,d,v){c==="focusin"?(nb(),zd=d,Bd=v,zd.attachEvent("onpropertychange",rb)):c==="focusout"&&nb()}function F$(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return S1(Bd)}function _$(c,d){if(c==="click")return S1(d)}function V$(c,d){if(c==="input"||c==="change")return S1(d)}function Z$(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var Oa=typeof Object.is=="function"?Object.is:Z$;function Ud(c,d){if(Oa(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)||!Oa(c[N],d[N]))return!1}return!0}function sb(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function ab(c,d){var v=sb(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=sb(v)}}function ob(c,d){return c&&d?c===d?!0:c&&c.nodeType===3?!1:d&&d.nodeType===3?ob(c,d.parentNode):"contains"in c?c.contains(d):c.compareDocumentPosition?!!(c.compareDocumentPosition(d)&16):!1:!1}function ib(){for(var c=window,d=ue();d instanceof c.HTMLIFrameElement;){try{var v=typeof d.contentWindow.location.href=="string"}catch{v=!1}if(v)c=d.contentWindow;else break;d=ue(c.document)}return d}function N2(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 z$(c){var d=ib(),v=c.focusedElem,x=c.selectionRange;if(d!==v&&v&&v.ownerDocument&&ob(v.ownerDocument.documentElement,v)){if(x!==null&&N2(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=ab(v,$);var W=ab(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 B$=u&&"documentMode"in document&&11>=document.documentMode,au=null,M2=null,Wd=null,R2=!1;function lb(c,d,v){var x=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;R2||au==null||au!==ue(x)||(x=au,"selectionStart"in x&&N2(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}),Wd&&Ud(Wd,x)||(Wd=x,x=A1(M2,"onSelect"),0<x.length&&(d=new Pi("onSelect","select",null,d,v),c.push({event:d,listeners:x}),d.target=au)))}function E1(c,d){var v={};return v[c.toLowerCase()]=d.toLowerCase(),v["Webkit"+c]="webkit"+d,v["Moz"+c]="moz"+d,v}var ou={animationend:E1("Animation","AnimationEnd"),animationiteration:E1("Animation","AnimationIteration"),animationstart:E1("Animation","AnimationStart"),transitionend:E1("Transition","TransitionEnd")},P2={},cb={};u&&(cb=document.createElement("div").style,"AnimationEvent"in window||(delete ou.animationend.animation,delete ou.animationiteration.animation,delete ou.animationstart.animation),"TransitionEvent"in window||delete ou.transitionend.transition);function C1(c){if(P2[c])return P2[c];if(!ou[c])return c;var d=ou[c],v;for(v in d)if(d.hasOwnProperty(v)&&v in cb)return P2[c]=d[v];return c}var ub=C1("animationend"),db=C1("animationiteration"),fb=C1("animationstart"),hb=C1("transitionend"),pb=new Map,mb="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 Ti(c,d){pb.set(c,d),i(d,[c])}for(var L2=0;L2<mb.length;L2++){var $2=mb[L2],U$=$2.toLowerCase(),W$=$2[0].toUpperCase()+$2.slice(1);Ti(U$,"on"+W$)}Ti(ub,"onAnimationEnd"),Ti(db,"onAnimationIteration"),Ti(fb,"onAnimationStart"),Ti("dblclick","onDoubleClick"),Ti("focusin","onFocus"),Ti("focusout","onBlur"),Ti(hb,"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 Kd="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(" "),K$=new Set("cancel close invalid load scroll toggle".split(" ").concat(Kd));function gb(c,d,v){var x=c.type||"unknown-event";c.currentTarget=v,kt(x,d,void 0,c),c.currentTarget=null}function vb(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 pe=x[W],be=pe.instance,ze=pe.currentTarget;if(pe=pe.listener,be!==$&&N.isPropagationStopped())break e;gb(N,pe,ze),$=be}else for(W=0;W<x.length;W++){if(pe=x[W],be=pe.instance,ze=pe.currentTarget,pe=pe.listener,be!==$&&N.isPropagationStopped())break e;gb(N,pe,ze),$=be}}}if(Ve)throw c=Ie,Ve=!1,Ie=null,c}function er(c,d){var v=d[V2];v===void 0&&(v=d[V2]=new Set);var x=c+"__bubble";v.has(x)||(wb(d,c,2,!1),v.add(x))}function T2(c,d,v){var x=0;d&&(x|=4),wb(v,c,x,d)}var j1="_reactListening"+Math.random().toString(36).slice(2);function Gd(c){if(!c[j1]){c[j1]=!0,r.forEach(function(v){v!=="selectionchange"&&(K$.has(v)||T2(v,!1,c),T2(v,!0,c))});var d=c.nodeType===9?c:c.ownerDocument;d===null||d[j1]||(d[j1]=!0,T2("selectionchange",!1,d))}}function wb(c,d,v,x){switch(gs(d)){case 1:var N=Ur;break;case 4:N=Vl;break;default:N=fo}v=N.bind(null,d,v,c),N=void 0,!An||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 D2(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 pe=x.stateNode.containerInfo;if(pe===N||pe.nodeType===8&&pe.parentNode===N)break;if(W===4)for(W=x.return;W!==null;){var be=W.tag;if((be===3||be===4)&&(be=W.stateNode.containerInfo,be===N||be.nodeType===8&&be.parentNode===N))return;W=W.return}for(;pe!==null;){if(W=Ul(pe),W===null)return;if(be=W.tag,be===5||be===6){x=$=W;continue e}pe=pe.parentNode}}x=x.return}sn(function(){var ze=$,dt=Rt(v),gt=[];e:{var ut=pb.get(c);if(ut!==void 0){var $t=Pi,Ht=c;switch(c){case"keypress":if(Ri(v)===0)break e;case"keydown":case"keyup":$t=E2;break;case"focusin":Ht="focus",$t=en;break;case"focusout":Ht="blur",$t=en;break;case"beforeblur":case"afterblur":$t=en;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=_d;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$t=ve;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$t=Ha;break;case ub:case db:case fb:$t=nn;break;case hb:$t=k1;break;case"scroll":$t=v1;break;case"wheel":$t=R$;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=ru}var Vt=(d&4)!==0,vr=!Vt&&c==="scroll",Le=Vt?ut!==null?ut+"Capture":null:ut;Vt=[];for(var je=ze,He;je!==null;){He=je;var xt=He.stateNode;if(He.tag===5&&xt!==null&&(He=xt,Le!==null&&(xt=Ut(je,Le),xt!=null&&Vt.push(Yd(je,xt,He)))),vr)break;je=je.return}0<Vt.length&&(ut=new $t(ut,Ht,null,v,dt),gt.push({event:ut,listeners:Vt}))}}if((d&7)===0){e:{if(ut=c==="mouseover"||c==="pointerover",$t=c==="mouseout"||c==="pointerout",ut&&v!==Zt&&(Ht=v.relatedTarget||v.fromElement)&&(Ul(Ht)||Ht[Vo]))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=ze,Ht=Ht?Ul(Ht):null,Ht!==null&&(vr=nt(Ht),Ht!==vr||Ht.tag!==5&&Ht.tag!==6)&&(Ht=null)):($t=null,Ht=ze),$t!==Ht)){if(Vt=_d,xt="onMouseLeave",Le="onMouseEnter",je="mouse",(c==="pointerout"||c==="pointerover")&&(Vt=ru,xt="onPointerLeave",Le="onPointerEnter",je="pointer"),vr=$t==null?ut:cu($t),He=Ht==null?ut:cu(Ht),ut=new Vt(xt,je+"leave",$t,v,dt),ut.target=vr,ut.relatedTarget=He,xt=null,Ul(dt)===ze&&(Vt=new Vt(Le,je+"enter",Ht,v,dt),Vt.target=He,Vt.relatedTarget=vr,xt=Vt),vr=xt,$t&&Ht)t:{for(Vt=$t,Le=Ht,je=0,He=Vt;He;He=iu(He))je++;for(He=0,xt=Le;xt;xt=iu(xt))He++;for(;0<je-He;)Vt=iu(Vt),je--;for(;0<He-je;)Le=iu(Le),He--;for(;je--;){if(Vt===Le||Le!==null&&Vt===Le.alternate)break t;Vt=iu(Vt),Le=iu(Le)}Vt=null}else Vt=null;$t!==null&&yb(gt,ut,$t,Vt,!1),Ht!==null&&vr!==null&&yb(gt,vr,Ht,Vt,!0)}}e:{if(ut=ze?cu(ze):window,$t=ut.nodeName&&ut.nodeName.toLowerCase(),$t==="select"||$t==="input"&&ut.type==="file")var zt=O$;else if(Qy(ut))if(eb)zt=V$;else{zt=F$;var Qt=I$}else($t=ut.nodeName)&&$t.toLowerCase()==="input"&&(ut.type==="checkbox"||ut.type==="radio")&&(zt=_$);if(zt&&(zt=zt(c,ze))){Jy(gt,zt,v,dt);break e}Qt&&Qt(c,ut,ze),c==="focusout"&&(Qt=ut._wrapperState)&&Qt.controlled&&ut.type==="number"&&De(ut,"number",ut.value)}switch(Qt=ze?cu(ze):window,c){case"focusin":(Qy(Qt)||Qt.contentEditable==="true")&&(au=Qt,M2=ze,Wd=null);break;case"focusout":Wd=M2=au=null;break;case"mousedown":R2=!0;break;case"contextmenu":case"mouseup":case"dragend":R2=!1,lb(gt,v,dt);break;case"selectionchange":if(B$)break;case"keydown":case"keyup":lb(gt,v,dt)}var Jt;if(C2)e:{switch(c){case"compositionstart":var rn="onCompositionStart";break e;case"compositionend":rn="onCompositionEnd";break e;case"compositionupdate":rn="onCompositionUpdate";break e}rn=void 0}else su?qy(c,v)&&(rn="onCompositionEnd"):c==="keydown"&&v.keyCode===229&&(rn="onCompositionStart");rn&&(Ky&&v.locale!=="ko"&&(su||rn!=="onCompositionStart"?rn==="onCompositionEnd"&&su&&(Jt=m1()):(ho=dt,Zl="value"in ho?ho.value:ho.textContent,su=!0)),Qt=A1(ze,rn),0<Qt.length&&(rn=new sr(rn,c,null,v,dt),gt.push({event:rn,listeners:Qt}),Jt?rn.data=Jt:(Jt=Xy(v),Jt!==null&&(rn.data=Jt)))),(Jt=L$?$$(c,v):T$(c,v))&&(ze=A1(ze,"onBeforeInput"),0<ze.length&&(dt=new sr("onBeforeInput","beforeinput",null,v,dt),gt.push({event:dt,listeners:ze}),dt.data=Jt))}vb(gt,d)})}function Yd(c,d,v){return{instance:c,listener:d,currentTarget:v}}function A1(c,d){for(var v=d+"Capture",x=[];c!==null;){var N=c,$=N.stateNode;N.tag===5&&$!==null&&(N=$,$=Ut(c,v),$!=null&&x.unshift(Yd(c,$,N)),$=Ut(c,d),$!=null&&x.push(Yd(c,$,N))),c=c.return}return x}function iu(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function yb(c,d,v,x,N){for(var $=d._reactName,W=[];v!==null&&v!==x;){var pe=v,be=pe.alternate,ze=pe.stateNode;if(be!==null&&be===x)break;pe.tag===5&&ze!==null&&(pe=ze,N?(be=Ut(v,$),be!=null&&W.unshift(Yd(v,be,pe))):N||(be=Ut(v,$),be!=null&&W.push(Yd(v,be,pe)))),v=v.return}W.length!==0&&c.push({event:d,listeners:W})}var G$=/\r\n?/g,Y$=/\u0000|\uFFFD/g;function bb(c){return(typeof c=="string"?c:""+c).replace(G$,`
38
+ `).replace(Y$,"")}function N1(c,d,v){if(d=bb(d),bb(c)!==d&&v)throw Error(n(425))}function M1(){}var H2=null,O2=null;function I2(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 F2=typeof setTimeout=="function"?setTimeout:void 0,q$=typeof clearTimeout=="function"?clearTimeout:void 0,xb=typeof Promise=="function"?Promise:void 0,X$=typeof queueMicrotask=="function"?queueMicrotask:typeof xb<"u"?function(c){return xb.resolve(null).then(c).catch(Q$)}:F2;function Q$(c){setTimeout(function(){throw c})}function _2(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),On(d);return}x--}else v!=="$"&&v!=="$?"&&v!=="$!"||x++;v=N}while(v);On(d)}function Di(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 kb(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 lu=Math.random().toString(36).slice(2),mo="__reactFiber$"+lu,qd="__reactProps$"+lu,Vo="__reactContainer$"+lu,V2="__reactEvents$"+lu,J$="__reactListeners$"+lu,eT="__reactHandles$"+lu;function Ul(c){var d=c[mo];if(d)return d;for(var v=c.parentNode;v;){if(d=v[Vo]||v[mo]){if(v=d.alternate,d.child!==null||v!==null&&v.child!==null)for(c=kb(c);c!==null;){if(v=c[mo])return v;c=kb(c)}return d}c=v,v=c.parentNode}return null}function Xd(c){return c=c[mo]||c[Vo],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function cu(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(n(33))}function R1(c){return c[qd]||null}var Z2=[],uu=-1;function Hi(c){return{current:c}}function tr(c){0>uu||(c.current=Z2[uu],Z2[uu]=null,uu--)}function Gn(c,d){uu++,Z2[uu]=c.current,c.current=d}var Oi={},ts=Hi(Oi),Ps=Hi(!1),Wl=Oi;function du(c,d){var v=c.type.contextTypes;if(!v)return Oi;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 Ls(c){return c=c.childContextTypes,c!=null}function P1(){tr(Ps),tr(ts)}function Sb(c,d,v){if(ts.current!==Oi)throw Error(n(168));Gn(ts,d),Gn(Ps,v)}function Eb(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,he(c)||"Unknown",N));return Y({},v,x)}function L1(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Oi,Wl=ts.current,Gn(ts,c),Gn(Ps,Ps.current),!0}function Cb(c,d,v){var x=c.stateNode;if(!x)throw Error(n(169));v?(c=Eb(c,d,Wl),x.__reactInternalMemoizedMergedChildContext=c,tr(Ps),tr(ts),Gn(ts,c)):tr(Ps),Gn(Ps,v)}var Zo=null,$1=!1,z2=!1;function jb(c){Zo===null?Zo=[c]:Zo.push(c)}function tT(c){$1=!0,jb(c)}function Ii(){if(!z2&&Zo!==null){z2=!0;var c=0,d=wn;try{var v=Zo;for(wn=1;c<v.length;c++){var x=v[c];do x=x(!0);while(x!==null)}Zo=null,$1=!1}catch(N){throw Zo!==null&&(Zo=Zo.slice(c+1)),ke(Yt,Ii),N}finally{wn=d,z2=!1}}return null}var fu=[],hu=0,T1=null,D1=0,la=[],ca=0,Kl=null,zo=1,Bo="";function Gl(c,d){fu[hu++]=D1,fu[hu++]=T1,T1=c,D1=d}function Ab(c,d,v){la[ca++]=zo,la[ca++]=Bo,la[ca++]=Kl,Kl=c;var x=zo;c=Bo;var N=32-ye(x)-1;x&=~(1<<N),v+=1;var $=32-ye(d)+N;if(30<$){var W=N-N%5;$=(x&(1<<W)-1).toString(32),x>>=W,N-=W,zo=1<<32-ye(d)+N|v<<N|x,Bo=$+c}else zo=1<<$|v<<N|x,Bo=c}function B2(c){c.return!==null&&(Gl(c,1),Ab(c,1,0))}function U2(c){for(;c===T1;)T1=fu[--hu],fu[hu]=null,D1=fu[--hu],fu[hu]=null;for(;c===Kl;)Kl=la[--ca],la[ca]=null,Bo=la[--ca],la[ca]=null,zo=la[--ca],la[ca]=null}var Ks=null,Gs=null,ar=!1,Ia=null;function Nb(c,d){var v=ha(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 Mb(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,Ks=c,Gs=Di(d.firstChild),!0):!1;case 6:return d=c.pendingProps===""||d.nodeType!==3?null:d,d!==null?(c.stateNode=d,Ks=c,Gs=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(v=Kl!==null?{id:zo,overflow:Bo}:null,c.memoizedState={dehydrated:d,treeContext:v,retryLane:1073741824},v=ha(18,null,null,0),v.stateNode=d,v.return=c,c.child=v,Ks=c,Gs=null,!0):!1;default:return!1}}function W2(c){return(c.mode&1)!==0&&(c.flags&128)===0}function K2(c){if(ar){var d=Gs;if(d){var v=d;if(!Mb(c,d)){if(W2(c))throw Error(n(418));d=Di(v.nextSibling);var x=Ks;d&&Mb(c,d)?Nb(x,v):(c.flags=c.flags&-4097|2,ar=!1,Ks=c)}}else{if(W2(c))throw Error(n(418));c.flags=c.flags&-4097|2,ar=!1,Ks=c}}}function Rb(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;Ks=c}function H1(c){if(c!==Ks)return!1;if(!ar)return Rb(c),ar=!0,!1;var d;if((d=c.tag!==3)&&!(d=c.tag!==5)&&(d=c.type,d=d!=="head"&&d!=="body"&&!I2(c.type,c.memoizedProps)),d&&(d=Gs)){if(W2(c))throw Pb(),Error(n(418));for(;d;)Nb(c,d),d=Di(d.nextSibling)}if(Rb(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){Gs=Di(c.nextSibling);break e}d--}else v!=="$"&&v!=="$!"&&v!=="$?"||d++}c=c.nextSibling}Gs=null}}else Gs=Ks?Di(c.stateNode.nextSibling):null;return!0}function Pb(){for(var c=Gs;c;)c=Di(c.nextSibling)}function pu(){Gs=Ks=null,ar=!1}function G2(c){Ia===null?Ia=[c]:Ia.push(c)}var nT=A.ReactCurrentBatchConfig;function Qd(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 pe=N.refs;W===null?delete pe[$]:pe[$]=W},d._stringRef=$,d)}if(typeof c!="string")throw Error(n(284));if(!v._owner)throw Error(n(290,c))}return c}function O1(c,d){throw c=Object.prototype.toString.call(d),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":c))}function Lb(c){var d=c._init;return d(c._payload)}function $b(c){function d(Le,je){if(c){var He=Le.deletions;He===null?(Le.deletions=[je],Le.flags|=16):He.push(je)}}function v(Le,je){if(!c)return null;for(;je!==null;)d(Le,je),je=je.sibling;return null}function x(Le,je){for(Le=new Map;je!==null;)je.key!==null?Le.set(je.key,je):Le.set(je.index,je),je=je.sibling;return Le}function N(Le,je){return Le=Wi(Le,je),Le.index=0,Le.sibling=null,Le}function $(Le,je,He){return Le.index=He,c?(He=Le.alternate,He!==null?(He=He.index,He<je?(Le.flags|=2,je):He):(Le.flags|=2,je)):(Le.flags|=1048576,je)}function W(Le){return c&&Le.alternate===null&&(Le.flags|=2),Le}function pe(Le,je,He,xt){return je===null||je.tag!==6?(je=Fg(He,Le.mode,xt),je.return=Le,je):(je=N(je,He),je.return=Le,je)}function be(Le,je,He,xt){var zt=He.type;return zt===M?dt(Le,je,He.props.children,xt,He.key):je!==null&&(je.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===U&&Lb(zt)===je.type)?(xt=N(je,He.props),xt.ref=Qd(Le,je,He),xt.return=Le,xt):(xt=ih(He.type,He.key,He.props,null,Le.mode,xt),xt.ref=Qd(Le,je,He),xt.return=Le,xt)}function ze(Le,je,He,xt){return je===null||je.tag!==4||je.stateNode.containerInfo!==He.containerInfo||je.stateNode.implementation!==He.implementation?(je=_g(He,Le.mode,xt),je.return=Le,je):(je=N(je,He.children||[]),je.return=Le,je)}function dt(Le,je,He,xt,zt){return je===null||je.tag!==7?(je=nc(He,Le.mode,xt,zt),je.return=Le,je):(je=N(je,He),je.return=Le,je)}function gt(Le,je,He){if(typeof je=="string"&&je!==""||typeof je=="number")return je=Fg(""+je,Le.mode,He),je.return=Le,je;if(typeof je=="object"&&je!==null){switch(je.$$typeof){case L:return He=ih(je.type,je.key,je.props,null,Le.mode,He),He.ref=Qd(Le,null,je),He.return=Le,He;case T:return je=_g(je,Le.mode,He),je.return=Le,je;case U:var xt=je._init;return gt(Le,xt(je._payload),He)}if(G(je)||O(je))return je=nc(je,Le.mode,He,null),je.return=Le,je;O1(Le,je)}return null}function ut(Le,je,He,xt){var zt=je!==null?je.key:null;if(typeof He=="string"&&He!==""||typeof He=="number")return zt!==null?null:pe(Le,je,""+He,xt);if(typeof He=="object"&&He!==null){switch(He.$$typeof){case L:return He.key===zt?be(Le,je,He,xt):null;case T:return He.key===zt?ze(Le,je,He,xt):null;case U:return zt=He._init,ut(Le,je,zt(He._payload),xt)}if(G(He)||O(He))return zt!==null?null:dt(Le,je,He,xt,null);O1(Le,He)}return null}function $t(Le,je,He,xt,zt){if(typeof xt=="string"&&xt!==""||typeof xt=="number")return Le=Le.get(He)||null,pe(je,Le,""+xt,zt);if(typeof xt=="object"&&xt!==null){switch(xt.$$typeof){case L:return Le=Le.get(xt.key===null?He:xt.key)||null,be(je,Le,xt,zt);case T:return Le=Le.get(xt.key===null?He:xt.key)||null,ze(je,Le,xt,zt);case U:var Qt=xt._init;return $t(Le,je,He,Qt(xt._payload),zt)}if(G(xt)||O(xt))return Le=Le.get(He)||null,dt(je,Le,xt,zt,null);O1(je,xt)}return null}function Ht(Le,je,He,xt){for(var zt=null,Qt=null,Jt=je,rn=je=0,_r=null;Jt!==null&&rn<He.length;rn++){Jt.index>rn?(_r=Jt,Jt=null):_r=Jt.sibling;var Fn=ut(Le,Jt,He[rn],xt);if(Fn===null){Jt===null&&(Jt=_r);break}c&&Jt&&Fn.alternate===null&&d(Le,Jt),je=$(Fn,je,rn),Qt===null?zt=Fn:Qt.sibling=Fn,Qt=Fn,Jt=_r}if(rn===He.length)return v(Le,Jt),ar&&Gl(Le,rn),zt;if(Jt===null){for(;rn<He.length;rn++)Jt=gt(Le,He[rn],xt),Jt!==null&&(je=$(Jt,je,rn),Qt===null?zt=Jt:Qt.sibling=Jt,Qt=Jt);return ar&&Gl(Le,rn),zt}for(Jt=x(Le,Jt);rn<He.length;rn++)_r=$t(Jt,Le,rn,He[rn],xt),_r!==null&&(c&&_r.alternate!==null&&Jt.delete(_r.key===null?rn:_r.key),je=$(_r,je,rn),Qt===null?zt=_r:Qt.sibling=_r,Qt=_r);return c&&Jt.forEach(function(Ki){return d(Le,Ki)}),ar&&Gl(Le,rn),zt}function Vt(Le,je,He,xt){var zt=O(He);if(typeof zt!="function")throw Error(n(150));if(He=zt.call(He),He==null)throw Error(n(151));for(var Qt=zt=null,Jt=je,rn=je=0,_r=null,Fn=He.next();Jt!==null&&!Fn.done;rn++,Fn=He.next()){Jt.index>rn?(_r=Jt,Jt=null):_r=Jt.sibling;var Ki=ut(Le,Jt,Fn.value,xt);if(Ki===null){Jt===null&&(Jt=_r);break}c&&Jt&&Ki.alternate===null&&d(Le,Jt),je=$(Ki,je,rn),Qt===null?zt=Ki:Qt.sibling=Ki,Qt=Ki,Jt=_r}if(Fn.done)return v(Le,Jt),ar&&Gl(Le,rn),zt;if(Jt===null){for(;!Fn.done;rn++,Fn=He.next())Fn=gt(Le,Fn.value,xt),Fn!==null&&(je=$(Fn,je,rn),Qt===null?zt=Fn:Qt.sibling=Fn,Qt=Fn);return ar&&Gl(Le,rn),zt}for(Jt=x(Le,Jt);!Fn.done;rn++,Fn=He.next())Fn=$t(Jt,Le,rn,Fn.value,xt),Fn!==null&&(c&&Fn.alternate!==null&&Jt.delete(Fn.key===null?rn:Fn.key),je=$(Fn,je,rn),Qt===null?zt=Fn:Qt.sibling=Fn,Qt=Fn);return c&&Jt.forEach(function(DT){return d(Le,DT)}),ar&&Gl(Le,rn),zt}function vr(Le,je,He,xt){if(typeof He=="object"&&He!==null&&He.type===M&&He.key===null&&(He=He.props.children),typeof He=="object"&&He!==null){switch(He.$$typeof){case L:e:{for(var zt=He.key,Qt=je;Qt!==null;){if(Qt.key===zt){if(zt=He.type,zt===M){if(Qt.tag===7){v(Le,Qt.sibling),je=N(Qt,He.props.children),je.return=Le,Le=je;break e}}else if(Qt.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===U&&Lb(zt)===Qt.type){v(Le,Qt.sibling),je=N(Qt,He.props),je.ref=Qd(Le,Qt,He),je.return=Le,Le=je;break e}v(Le,Qt);break}else d(Le,Qt);Qt=Qt.sibling}He.type===M?(je=nc(He.props.children,Le.mode,xt,He.key),je.return=Le,Le=je):(xt=ih(He.type,He.key,He.props,null,Le.mode,xt),xt.ref=Qd(Le,je,He),xt.return=Le,Le=xt)}return W(Le);case T:e:{for(Qt=He.key;je!==null;){if(je.key===Qt)if(je.tag===4&&je.stateNode.containerInfo===He.containerInfo&&je.stateNode.implementation===He.implementation){v(Le,je.sibling),je=N(je,He.children||[]),je.return=Le,Le=je;break e}else{v(Le,je);break}else d(Le,je);je=je.sibling}je=_g(He,Le.mode,xt),je.return=Le,Le=je}return W(Le);case U:return Qt=He._init,vr(Le,je,Qt(He._payload),xt)}if(G(He))return Ht(Le,je,He,xt);if(O(He))return Vt(Le,je,He,xt);O1(Le,He)}return typeof He=="string"&&He!==""||typeof He=="number"?(He=""+He,je!==null&&je.tag===6?(v(Le,je.sibling),je=N(je,He),je.return=Le,Le=je):(v(Le,je),je=Fg(He,Le.mode,xt),je.return=Le,Le=je),W(Le)):v(Le,je)}return vr}var mu=$b(!0),Tb=$b(!1),I1=Hi(null),F1=null,gu=null,Y2=null;function q2(){Y2=gu=F1=null}function X2(c){var d=I1.current;tr(I1),c._currentValue=d}function Q2(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 vu(c,d){F1=c,Y2=gu=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&d)!==0&&($s=!0),c.firstContext=null)}function ua(c){var d=c._currentValue;if(Y2!==c)if(c={context:c,memoizedValue:d,next:null},gu===null){if(F1===null)throw Error(n(308));gu=c,F1.dependencies={lanes:0,firstContext:c}}else gu=gu.next=c;return d}var Yl=null;function J2(c){Yl===null?Yl=[c]:Yl.push(c)}function Db(c,d,v,x){var N=d.interleaved;return N===null?(v.next=v,J2(d)):(v.next=N.next,N.next=v),d.interleaved=v,Uo(c,x)}function Uo(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 Fi=!1;function eg(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hb(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 Wo(c,d){return{eventTime:c,lane:d,tag:0,payload:null,callback:null,next:null}}function _i(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,Uo(c,v)}return N=x.interleaved,N===null?(d.next=d,J2(x)):(d.next=N.next,N.next=d),x.interleaved=d,Uo(c,v)}function _1(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,Or(c,v)}}function Ob(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 V1(c,d,v,x){var N=c.updateQueue;Fi=!1;var $=N.firstBaseUpdate,W=N.lastBaseUpdate,pe=N.shared.pending;if(pe!==null){N.shared.pending=null;var be=pe,ze=be.next;be.next=null,W===null?$=ze:W.next=ze,W=be;var dt=c.alternate;dt!==null&&(dt=dt.updateQueue,pe=dt.lastBaseUpdate,pe!==W&&(pe===null?dt.firstBaseUpdate=ze:pe.next=ze,dt.lastBaseUpdate=be))}if($!==null){var gt=N.baseState;W=0,dt=ze=be=null,pe=$;do{var ut=pe.lane,$t=pe.eventTime;if((x&ut)===ut){dt!==null&&(dt=dt.next={eventTime:$t,lane:0,tag:pe.tag,payload:pe.payload,callback:pe.callback,next:null});e:{var Ht=c,Vt=pe;switch(ut=d,$t=v,Vt.tag){case 1:if(Ht=Vt.payload,typeof Ht=="function"){gt=Ht.call($t,gt,ut);break e}gt=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=Vt.payload,ut=typeof Ht=="function"?Ht.call($t,gt,ut):Ht,ut==null)break e;gt=Y({},gt,ut);break e;case 2:Fi=!0}}pe.callback!==null&&pe.lane!==0&&(c.flags|=64,ut=N.effects,ut===null?N.effects=[pe]:ut.push(pe))}else $t={eventTime:$t,lane:ut,tag:pe.tag,payload:pe.payload,callback:pe.callback,next:null},dt===null?(ze=dt=$t,be=gt):dt=dt.next=$t,W|=ut;if(pe=pe.next,pe===null){if(pe=N.shared.pending,pe===null)break;ut=pe,pe=ut.next,ut.next=null,N.lastBaseUpdate=ut,N.shared.pending=null}}while(!0);if(dt===null&&(be=gt),N.baseState=be,N.firstBaseUpdate=ze,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);Ql|=W,c.lanes=W,c.memoizedState=gt}}function Ib(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 Jd={},go=Hi(Jd),e0=Hi(Jd),t0=Hi(Jd);function ql(c){if(c===Jd)throw Error(n(174));return c}function tg(c,d){switch(Gn(t0,d),Gn(e0,c),Gn(go,Jd),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(go),Gn(go,d)}function wu(){tr(go),tr(e0),tr(t0)}function Fb(c){ql(t0.current);var d=ql(go.current),v=Re(d,c.type);d!==v&&(Gn(e0,c),Gn(go,v))}function ng(c){e0.current===c&&(tr(go),tr(e0))}var ir=Hi(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 rg=[];function sg(){for(var c=0;c<rg.length;c++)rg[c]._workInProgressVersionPrimary=null;rg.length=0}var z1=A.ReactCurrentDispatcher,ag=A.ReactCurrentBatchConfig,Xl=0,lr=null,Rr=null,Ir=null,B1=!1,n0=!1,r0=0,rT=0;function ns(){throw Error(n(321))}function og(c,d){if(d===null)return!1;for(var v=0;v<d.length&&v<c.length;v++)if(!Oa(c[v],d[v]))return!1;return!0}function ig(c,d,v,x,N,$){if(Xl=$,lr=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,z1.current=c===null||c.memoizedState===null?iT:lT,c=v(x,N),n0){$=0;do{if(n0=!1,r0=0,25<=$)throw Error(n(301));$+=1,Ir=Rr=null,d.updateQueue=null,z1.current=cT,c=v(x,N)}while(n0)}if(z1.current=K1,d=Rr!==null&&Rr.next!==null,Xl=0,Ir=Rr=lr=null,B1=!1,d)throw Error(n(300));return c}function lg(){var c=r0!==0;return r0=0,c}function vo(){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 da(){if(Rr===null){var c=lr.alternate;c=c!==null?c.memoizedState:null}else c=Rr.next;var d=Ir===null?lr.memoizedState:Ir.next;if(d!==null)Ir=d,Rr=c;else{if(c===null)throw Error(n(310));Rr=c,c={memoizedState:Rr.memoizedState,baseState:Rr.baseState,baseQueue:Rr.baseQueue,queue:Rr.queue,next:null},Ir===null?lr.memoizedState=Ir=c:Ir=Ir.next=c}return Ir}function s0(c,d){return typeof d=="function"?d(c):d}function cg(c){var d=da(),v=d.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=c;var x=Rr,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 pe=W=null,be=null,ze=$;do{var dt=ze.lane;if((Xl&dt)===dt)be!==null&&(be=be.next={lane:0,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null}),x=ze.hasEagerState?ze.eagerState:c(x,ze.action);else{var gt={lane:dt,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null};be===null?(pe=be=gt,W=x):be=be.next=gt,lr.lanes|=dt,Ql|=dt}ze=ze.next}while(ze!==null&&ze!==$);be===null?W=x:be.next=pe,Oa(x,d.memoizedState)||($s=!0),d.memoizedState=x,d.baseState=W,d.baseQueue=be,v.lastRenderedState=x}if(c=v.interleaved,c!==null){N=c;do $=N.lane,lr.lanes|=$,Ql|=$,N=N.next;while(N!==c)}else N===null&&(v.lanes=0);return[d.memoizedState,v.dispatch]}function ug(c){var d=da(),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);Oa($,d.memoizedState)||($s=!0),d.memoizedState=$,d.baseQueue===null&&(d.baseState=$),v.lastRenderedState=$}return[$,x]}function _b(){}function Vb(c,d){var v=lr,x=da(),N=d(),$=!Oa(x.memoizedState,N);if($&&(x.memoizedState=N,$s=!0),x=x.queue,dg(Bb.bind(null,v,x,c),[c]),x.getSnapshot!==d||$||Ir!==null&&Ir.memoizedState.tag&1){if(v.flags|=2048,a0(9,zb.bind(null,v,x,N,d),void 0,null),Fr===null)throw Error(n(349));(Xl&30)!==0||Zb(v,d,N)}return N}function Zb(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 zb(c,d,v,x){d.value=v,d.getSnapshot=x,Ub(d)&&Wb(c)}function Bb(c,d,v){return v(function(){Ub(d)&&Wb(c)})}function Ub(c){var d=c.getSnapshot;c=c.value;try{var v=d();return!Oa(c,v)}catch{return!0}}function Wb(c){var d=Uo(c,1);d!==null&&Za(d,c,1,-1)}function Kb(c){var d=vo();return typeof c=="function"&&(c=c()),d.memoizedState=d.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s0,lastRenderedState:c},d.queue=c,c=c.dispatch=oT.bind(null,lr,c),[d.memoizedState,c]}function a0(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 Gb(){return da().memoizedState}function U1(c,d,v,x){var N=vo();lr.flags|=c,N.memoizedState=a0(1|d,v,void 0,x===void 0?null:x)}function W1(c,d,v,x){var N=da();x=x===void 0?null:x;var $=void 0;if(Rr!==null){var W=Rr.memoizedState;if($=W.destroy,x!==null&&og(x,W.deps)){N.memoizedState=a0(d,v,$,x);return}}lr.flags|=c,N.memoizedState=a0(1|d,v,$,x)}function Yb(c,d){return U1(8390656,8,c,d)}function dg(c,d){return W1(2048,8,c,d)}function qb(c,d){return W1(4,2,c,d)}function Xb(c,d){return W1(4,4,c,d)}function Qb(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 Jb(c,d,v){return v=v!=null?v.concat([c]):null,W1(4,4,Qb.bind(null,d,c),v)}function fg(){}function e3(c,d){var v=da();d=d===void 0?null:d;var x=v.memoizedState;return x!==null&&d!==null&&og(d,x[1])?x[0]:(v.memoizedState=[c,d],c)}function t3(c,d){var v=da();d=d===void 0?null:d;var x=v.memoizedState;return x!==null&&d!==null&&og(d,x[1])?x[0]:(c=c(),v.memoizedState=[c,d],c)}function n3(c,d,v){return(Xl&21)===0?(c.baseState&&(c.baseState=!1,$s=!0),c.memoizedState=v):(Oa(v,d)||(v=un(),lr.lanes|=v,Ql|=v,c.baseState=!0),d)}function sT(c,d){var v=wn;wn=v!==0&&4>v?v:4,c(!0);var x=ag.transition;ag.transition={};try{c(!1),d()}finally{wn=v,ag.transition=x}}function r3(){return da().memoizedState}function aT(c,d,v){var x=Bi(c);if(v={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null},s3(c))a3(d,v);else if(v=Db(c,d,v,x),v!==null){var N=bs();Za(v,c,x,N),o3(v,d,x)}}function oT(c,d,v){var x=Bi(c),N={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null};if(s3(c))a3(d,N);else{var $=c.alternate;if(c.lanes===0&&($===null||$.lanes===0)&&($=d.lastRenderedReducer,$!==null))try{var W=d.lastRenderedState,pe=$(W,v);if(N.hasEagerState=!0,N.eagerState=pe,Oa(pe,W)){var be=d.interleaved;be===null?(N.next=N,J2(d)):(N.next=be.next,be.next=N),d.interleaved=N;return}}catch{}finally{}v=Db(c,d,N,x),v!==null&&(N=bs(),Za(v,c,x,N),o3(v,d,x))}}function s3(c){var d=c.alternate;return c===lr||d!==null&&d===lr}function a3(c,d){n0=B1=!0;var v=c.pending;v===null?d.next=d:(d.next=v.next,v.next=d),c.pending=d}function o3(c,d,v){if((v&4194240)!==0){var x=d.lanes;x&=c.pendingLanes,v|=x,d.lanes=v,Or(c,v)}}var K1={readContext:ua,useCallback:ns,useContext:ns,useEffect:ns,useImperativeHandle:ns,useInsertionEffect:ns,useLayoutEffect:ns,useMemo:ns,useReducer:ns,useRef:ns,useState:ns,useDebugValue:ns,useDeferredValue:ns,useTransition:ns,useMutableSource:ns,useSyncExternalStore:ns,useId:ns,unstable_isNewReconciler:!1},iT={readContext:ua,useCallback:function(c,d){return vo().memoizedState=[c,d===void 0?null:d],c},useContext:ua,useEffect:Yb,useImperativeHandle:function(c,d,v){return v=v!=null?v.concat([c]):null,U1(4194308,4,Qb.bind(null,d,c),v)},useLayoutEffect:function(c,d){return U1(4194308,4,c,d)},useInsertionEffect:function(c,d){return U1(4,2,c,d)},useMemo:function(c,d){var v=vo();return d=d===void 0?null:d,c=c(),v.memoizedState=[c,d],c},useReducer:function(c,d,v){var x=vo();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=aT.bind(null,lr,c),[x.memoizedState,c]},useRef:function(c){var d=vo();return c={current:c},d.memoizedState=c},useState:Kb,useDebugValue:fg,useDeferredValue:function(c){return vo().memoizedState=c},useTransition:function(){var c=Kb(!1),d=c[0];return c=sT.bind(null,c[1]),vo().memoizedState=c,[d,c]},useMutableSource:function(){},useSyncExternalStore:function(c,d,v){var x=lr,N=vo();if(ar){if(v===void 0)throw Error(n(407));v=v()}else{if(v=d(),Fr===null)throw Error(n(349));(Xl&30)!==0||Zb(x,d,v)}N.memoizedState=v;var $={value:v,getSnapshot:d};return N.queue=$,Yb(Bb.bind(null,x,$,c),[c]),x.flags|=2048,a0(9,zb.bind(null,x,$,v,d),void 0,null),v},useId:function(){var c=vo(),d=Fr.identifierPrefix;if(ar){var v=Bo,x=zo;v=(x&~(1<<32-ye(x)-1)).toString(32)+v,d=":"+d+"R"+v,v=r0++,0<v&&(d+="H"+v.toString(32)),d+=":"}else v=rT++,d=":"+d+"r"+v.toString(32)+":";return c.memoizedState=d},unstable_isNewReconciler:!1},lT={readContext:ua,useCallback:e3,useContext:ua,useEffect:dg,useImperativeHandle:Jb,useInsertionEffect:qb,useLayoutEffect:Xb,useMemo:t3,useReducer:cg,useRef:Gb,useState:function(){return cg(s0)},useDebugValue:fg,useDeferredValue:function(c){var d=da();return n3(d,Rr.memoizedState,c)},useTransition:function(){var c=cg(s0)[0],d=da().memoizedState;return[c,d]},useMutableSource:_b,useSyncExternalStore:Vb,useId:r3,unstable_isNewReconciler:!1},cT={readContext:ua,useCallback:e3,useContext:ua,useEffect:dg,useImperativeHandle:Jb,useInsertionEffect:qb,useLayoutEffect:Xb,useMemo:t3,useReducer:ug,useRef:Gb,useState:function(){return ug(s0)},useDebugValue:fg,useDeferredValue:function(c){var d=da();return Rr===null?d.memoizedState=c:n3(d,Rr.memoizedState,c)},useTransition:function(){var c=ug(s0)[0],d=da().memoizedState;return[c,d]},useMutableSource:_b,useSyncExternalStore:Vb,useId:r3,unstable_isNewReconciler:!1};function Fa(c,d){if(c&&c.defaultProps){d=Y({},d),c=c.defaultProps;for(var v in c)d[v]===void 0&&(d[v]=c[v]);return d}return d}function hg(c,d,v,x){d=c.memoizedState,v=v(x,d),v=v==null?d:Y({},d,v),c.memoizedState=v,c.lanes===0&&(c.updateQueue.baseState=v)}var G1={isMounted:function(c){return(c=c._reactInternals)?nt(c)===c:!1},enqueueSetState:function(c,d,v){c=c._reactInternals;var x=bs(),N=Bi(c),$=Wo(x,N);$.payload=d,v!=null&&($.callback=v),d=_i(c,$,N),d!==null&&(Za(d,c,N,x),_1(d,c,N))},enqueueReplaceState:function(c,d,v){c=c._reactInternals;var x=bs(),N=Bi(c),$=Wo(x,N);$.tag=1,$.payload=d,v!=null&&($.callback=v),d=_i(c,$,N),d!==null&&(Za(d,c,N,x),_1(d,c,N))},enqueueForceUpdate:function(c,d){c=c._reactInternals;var v=bs(),x=Bi(c),N=Wo(v,x);N.tag=2,d!=null&&(N.callback=d),d=_i(c,N,x),d!==null&&(Za(d,c,x,v),_1(d,c,x))}};function i3(c,d,v,x,N,$,W){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(x,$,W):d.prototype&&d.prototype.isPureReactComponent?!Ud(v,x)||!Ud(N,$):!0}function l3(c,d,v){var x=!1,N=Oi,$=d.contextType;return typeof $=="object"&&$!==null?$=ua($):(N=Ls(d)?Wl:ts.current,x=d.contextTypes,$=(x=x!=null)?du(c,N):Oi),d=new d(v,$),c.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=G1,c.stateNode=d,d._reactInternals=c,x&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=N,c.__reactInternalMemoizedMaskedChildContext=$),d}function c3(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&&G1.enqueueReplaceState(d,d.state,null)}function pg(c,d,v,x){var N=c.stateNode;N.props=v,N.state=c.memoizedState,N.refs={},eg(c);var $=d.contextType;typeof $=="object"&&$!==null?N.context=ua($):($=Ls(d)?Wl:ts.current,N.context=du(c,$)),N.state=c.memoizedState,$=d.getDerivedStateFromProps,typeof $=="function"&&(hg(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&&G1.enqueueReplaceState(N,N.state,null),V1(c,v,N,x),N.state=c.memoizedState),typeof N.componentDidMount=="function"&&(c.flags|=4194308)}function yu(c,d){try{var v="",x=d;do v+=me(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 mg(c,d,v){return{value:c,source:null,stack:v??null,digest:d??null}}function gg(c,d){try{console.error(d.value)}catch(v){setTimeout(function(){throw v})}}var uT=typeof WeakMap=="function"?WeakMap:Map;function u3(c,d,v){v=Wo(-1,v),v.tag=3,v.payload={element:null};var x=d.value;return v.callback=function(){th||(th=!0,Pg=x),gg(c,d)},v}function d3(c,d,v){v=Wo(-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(){gg(c,d)}}var $=c.stateNode;return $!==null&&typeof $.componentDidCatch=="function"&&(v.callback=function(){gg(c,d),typeof x!="function"&&(Zi===null?Zi=new Set([this]):Zi.add(this));var W=d.stack;this.componentDidCatch(d.value,{componentStack:W!==null?W:""})}),v}function f3(c,d,v){var x=c.pingCache;if(x===null){x=c.pingCache=new uT;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=ET.bind(null,c,d,v),d.then(c,c))}function h3(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 p3(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=Wo(-1,1),d.tag=2,_i(v,d,1))),v.lanes|=1),c):(c.flags|=65536,c.lanes=N,c)}var dT=A.ReactCurrentOwner,$s=!1;function ys(c,d,v,x){d.child=c===null?Tb(d,null,v,x):mu(d,c.child,v,x)}function m3(c,d,v,x,N){v=v.render;var $=d.ref;return vu(d,N),x=ig(c,d,v,x,$,N),v=lg(),c!==null&&!$s?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~N,Ko(c,d,N)):(ar&&v&&B2(d),d.flags|=1,ys(c,d,x,N),d.child)}function g3(c,d,v,x,N){if(c===null){var $=v.type;return typeof $=="function"&&!Ig($)&&$.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(d.tag=15,d.type=$,v3(c,d,$,x,N)):(c=ih(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:Ud,v(W,x)&&c.ref===d.ref)return Ko(c,d,N)}return d.flags|=1,c=Wi($,x),c.ref=d.ref,c.return=d,d.child=c}function v3(c,d,v,x,N){if(c!==null){var $=c.memoizedProps;if(Ud($,x)&&c.ref===d.ref)if($s=!1,d.pendingProps=x=$,(c.lanes&N)!==0)(c.flags&131072)!==0&&($s=!0);else return d.lanes=c.lanes,Ko(c,d,N)}return vg(c,d,v,x,N)}function w3(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(xu,Ys),Ys|=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(xu,Ys),Ys|=c,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=$!==null?$.baseLanes:v,Gn(xu,Ys),Ys|=x}else $!==null?(x=$.baseLanes|v,d.memoizedState=null):x=v,Gn(xu,Ys),Ys|=x;return ys(c,d,N,v),d.child}function y3(c,d){var v=d.ref;(c===null&&v!==null||c!==null&&c.ref!==v)&&(d.flags|=512,d.flags|=2097152)}function vg(c,d,v,x,N){var $=Ls(v)?Wl:ts.current;return $=du(d,$),vu(d,N),v=ig(c,d,v,x,$,N),x=lg(),c!==null&&!$s?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~N,Ko(c,d,N)):(ar&&x&&B2(d),d.flags|=1,ys(c,d,v,N),d.child)}function b3(c,d,v,x,N){if(Ls(v)){var $=!0;L1(d)}else $=!1;if(vu(d,N),d.stateNode===null)q1(c,d),l3(d,v,x),pg(d,v,x,N),x=!0;else if(c===null){var W=d.stateNode,pe=d.memoizedProps;W.props=pe;var be=W.context,ze=v.contextType;typeof ze=="object"&&ze!==null?ze=ua(ze):(ze=Ls(v)?Wl:ts.current,ze=du(d,ze));var dt=v.getDerivedStateFromProps,gt=typeof dt=="function"||typeof W.getSnapshotBeforeUpdate=="function";gt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(pe!==x||be!==ze)&&c3(d,W,x,ze),Fi=!1;var ut=d.memoizedState;W.state=ut,V1(d,x,W,N),be=d.memoizedState,pe!==x||ut!==be||Ps.current||Fi?(typeof dt=="function"&&(hg(d,v,dt,x),be=d.memoizedState),(pe=Fi||i3(d,v,pe,x,ut,be,ze))?(gt||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=be),W.props=x,W.state=be,W.context=ze,x=pe):(typeof W.componentDidMount=="function"&&(d.flags|=4194308),x=!1)}else{W=d.stateNode,Hb(c,d),pe=d.memoizedProps,ze=d.type===d.elementType?pe:Fa(d.type,pe),W.props=ze,gt=d.pendingProps,ut=W.context,be=v.contextType,typeof be=="object"&&be!==null?be=ua(be):(be=Ls(v)?Wl:ts.current,be=du(d,be));var $t=v.getDerivedStateFromProps;(dt=typeof $t=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(pe!==gt||ut!==be)&&c3(d,W,x,be),Fi=!1,ut=d.memoizedState,W.state=ut,V1(d,x,W,N);var Ht=d.memoizedState;pe!==gt||ut!==Ht||Ps.current||Fi?(typeof $t=="function"&&(hg(d,v,$t,x),Ht=d.memoizedState),(ze=Fi||i3(d,v,ze,x,ut,Ht,be)||!1)?(dt||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(x,Ht,be),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(x,Ht,be)),typeof W.componentDidUpdate=="function"&&(d.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof W.componentDidUpdate!="function"||pe===c.memoizedProps&&ut===c.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||pe===c.memoizedProps&&ut===c.memoizedState||(d.flags|=1024),d.memoizedProps=x,d.memoizedState=Ht),W.props=x,W.state=Ht,W.context=be,x=ze):(typeof W.componentDidUpdate!="function"||pe===c.memoizedProps&&ut===c.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||pe===c.memoizedProps&&ut===c.memoizedState||(d.flags|=1024),x=!1)}return wg(c,d,v,x,$,N)}function wg(c,d,v,x,N,$){y3(c,d);var W=(d.flags&128)!==0;if(!x&&!W)return N&&Cb(d,v,!1),Ko(c,d,$);x=d.stateNode,dT.current=d;var pe=W&&typeof v.getDerivedStateFromError!="function"?null:x.render();return d.flags|=1,c!==null&&W?(d.child=mu(d,c.child,null,$),d.child=mu(d,null,pe,$)):ys(c,d,pe,$),d.memoizedState=x.state,N&&Cb(d,v,!0),d.child}function x3(c){var d=c.stateNode;d.pendingContext?Sb(c,d.pendingContext,d.pendingContext!==d.context):d.context&&Sb(c,d.context,!1),tg(c,d.containerInfo)}function k3(c,d,v,x,N){return pu(),G2(N),d.flags|=256,ys(c,d,v,x),d.child}var yg={dehydrated:null,treeContext:null,retryLane:0};function bg(c){return{baseLanes:c,cachePool:null,transitions:null}}function S3(c,d,v){var x=d.pendingProps,N=ir.current,$=!1,W=(d.flags&128)!==0,pe;if((pe=W)||(pe=c!==null&&c.memoizedState===null?!1:(N&2)!==0),pe?($=!0,d.flags&=-129):(c===null||c.memoizedState!==null)&&(N|=1),Gn(ir,N&1),c===null)return K2(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):$=lh(W,x,0,null),c=nc(c,x,v,null),$.return=d,c.return=d,$.sibling=c,d.child=$,d.child.memoizedState=bg(v),d.memoizedState=yg,c):xg(d,W));if(N=c.memoizedState,N!==null&&(pe=N.dehydrated,pe!==null))return fT(c,d,W,x,pe,N,v);if($){$=x.fallback,W=d.mode,N=c.child,pe=N.sibling;var be={mode:"hidden",children:x.children};return(W&1)===0&&d.child!==N?(x=d.child,x.childLanes=0,x.pendingProps=be,d.deletions=null):(x=Wi(N,be),x.subtreeFlags=N.subtreeFlags&14680064),pe!==null?$=Wi(pe,$):($=nc($,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?bg(v):{baseLanes:W.baseLanes|v,cachePool:null,transitions:W.transitions},$.memoizedState=W,$.childLanes=c.childLanes&~v,d.memoizedState=yg,x}return $=c.child,c=$.sibling,x=Wi($,{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 xg(c,d){return d=lh({mode:"visible",children:d},c.mode,0,null),d.return=c,c.child=d}function Y1(c,d,v,x){return x!==null&&G2(x),mu(d,c.child,null,v),c=xg(d,d.pendingProps.children),c.flags|=2,d.memoizedState=null,c}function fT(c,d,v,x,N,$,W){if(v)return d.flags&256?(d.flags&=-257,x=mg(Error(n(422))),Y1(c,d,W,x)):d.memoizedState!==null?(d.child=c.child,d.flags|=128,null):($=x.fallback,N=d.mode,x=lh({mode:"visible",children:x.children},N,0,null),$=nc($,N,W,null),$.flags|=2,x.return=d,$.return=d,x.sibling=$,d.child=x,(d.mode&1)!==0&&mu(d,c.child,null,W),d.child.memoizedState=bg(W),d.memoizedState=yg,$);if((d.mode&1)===0)return Y1(c,d,W,null);if(N.data==="$!"){if(x=N.nextSibling&&N.nextSibling.dataset,x)var pe=x.dgst;return x=pe,$=Error(n(419)),x=mg($,x,void 0),Y1(c,d,W,x)}if(pe=(W&c.childLanes)!==0,$s||pe){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,Uo(c,N),Za(x,c,N,-1))}return Og(),x=mg(Error(n(421))),Y1(c,d,W,x)}return N.data==="$?"?(d.flags|=128,d.child=c.child,d=CT.bind(null,c),N._reactRetry=d,null):(c=$.treeContext,Gs=Di(N.nextSibling),Ks=d,ar=!0,Ia=null,c!==null&&(la[ca++]=zo,la[ca++]=Bo,la[ca++]=Kl,zo=c.id,Bo=c.overflow,Kl=d),d=xg(d,x.children),d.flags|=4096,d)}function E3(c,d,v){c.lanes|=d;var x=c.alternate;x!==null&&(x.lanes|=d),Q2(c.return,d,v)}function kg(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 C3(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&&E3(c,v,d);else if(c.tag===19)E3(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),kg(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}kg(d,!0,v,null,$);break;case"together":kg(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function q1(c,d){(d.mode&1)===0&&c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2)}function Ko(c,d,v){if(c!==null&&(d.dependencies=c.dependencies),Ql|=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=Wi(c,c.pendingProps),d.child=v,v.return=d;c.sibling!==null;)c=c.sibling,v=v.sibling=Wi(c,c.pendingProps),v.return=d;v.sibling=null}return d.child}function hT(c,d,v){switch(d.tag){case 3:x3(d),pu();break;case 5:Fb(d);break;case 1:Ls(d.type)&&L1(d);break;case 4:tg(d,d.stateNode.containerInfo);break;case 10:var x=d.type._context,N=d.memoizedProps.value;Gn(I1,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?S3(c,d,v):(Gn(ir,ir.current&1),c=Ko(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 C3(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,w3(c,d,v)}return Ko(c,d,v)}var j3,Sg,A3,N3;j3=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}},Sg=function(){},A3=function(c,d,v,x){var N=c.memoizedProps;if(N!==x){c=d.stateNode,ql(go.current);var $=null;switch(v){case"input":N=Se(c,N),x=Se(c,x),$=[];break;case"select":N=Y({},N,{value:void 0}),x=Y({},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=M1)}It(v,x);var W;v=null;for(ze in N)if(!x.hasOwnProperty(ze)&&N.hasOwnProperty(ze)&&N[ze]!=null)if(ze==="style"){var pe=N[ze];for(W in pe)pe.hasOwnProperty(W)&&(v||(v={}),v[W]="")}else ze!=="dangerouslySetInnerHTML"&&ze!=="children"&&ze!=="suppressContentEditableWarning"&&ze!=="suppressHydrationWarning"&&ze!=="autoFocus"&&(a.hasOwnProperty(ze)?$||($=[]):($=$||[]).push(ze,null));for(ze in x){var be=x[ze];if(pe=N!=null?N[ze]:void 0,x.hasOwnProperty(ze)&&be!==pe&&(be!=null||pe!=null))if(ze==="style")if(pe){for(W in pe)!pe.hasOwnProperty(W)||be&&be.hasOwnProperty(W)||(v||(v={}),v[W]="");for(W in be)be.hasOwnProperty(W)&&pe[W]!==be[W]&&(v||(v={}),v[W]=be[W])}else v||($||($=[]),$.push(ze,v)),v=be;else ze==="dangerouslySetInnerHTML"?(be=be?be.__html:void 0,pe=pe?pe.__html:void 0,be!=null&&pe!==be&&($=$||[]).push(ze,be)):ze==="children"?typeof be!="string"&&typeof be!="number"||($=$||[]).push(ze,""+be):ze!=="suppressContentEditableWarning"&&ze!=="suppressHydrationWarning"&&(a.hasOwnProperty(ze)?(be!=null&&ze==="onScroll"&&er("scroll",c),$||pe===be||($=[])):($=$||[]).push(ze,be))}v&&($=$||[]).push("style",v);var ze=$;(d.updateQueue=ze)&&(d.flags|=4)}},N3=function(c,d,v,x){v!==x&&(d.flags|=4)};function o0(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 rs(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 pT(c,d,v){var x=d.pendingProps;switch(U2(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rs(d),null;case 1:return Ls(d.type)&&P1(),rs(d),null;case 3:return x=d.stateNode,wu(),tr(Ps),tr(ts),sg(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(c===null||c.child===null)&&(H1(d)?d.flags|=4:c===null||c.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Ia!==null&&(Tg(Ia),Ia=null))),Sg(c,d),rs(d),null;case 5:ng(d);var N=ql(t0.current);if(v=d.type,c!==null&&d.stateNode!=null)A3(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 rs(d),null}if(c=ql(go.current),H1(d)){x=d.stateNode,v=d.type;var $=d.memoizedProps;switch(x[mo]=d,x[qd]=$,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<Kd.length;N++)er(Kd[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":Be(x,$),er("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!$.multiple},er("invalid",x);break;case"textarea":Oe(x,$),er("invalid",x)}It(v,$),N=null;for(var W in $)if($.hasOwnProperty(W)){var pe=$[W];W==="children"?typeof pe=="string"?x.textContent!==pe&&($.suppressHydrationWarning!==!0&&N1(x.textContent,pe,c),N=["children",pe]):typeof pe=="number"&&x.textContent!==""+pe&&($.suppressHydrationWarning!==!0&&N1(x.textContent,pe,c),N=["children",""+pe]):a.hasOwnProperty(W)&&pe!=null&&W==="onScroll"&&er("scroll",x)}switch(v){case"input":ae(x),Xe(x,$,!0);break;case"textarea":ae(x),X(x);break;case"select":case"option":break;default:typeof $.onClick=="function"&&(x.onclick=M1)}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=se(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[mo]=d,c[qd]=x,j3(c,d,!1,!1),d.stateNode=c;e:{switch(W=Mt(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<Kd.length;N++)er(Kd[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":Be(c,x),N=Se(c,x),er("invalid",c);break;case"option":N=x;break;case"select":c._wrapperState={wasMultiple:!!x.multiple},N=Y({},x,{value:void 0}),er("invalid",c);break;case"textarea":Oe(c,x),N=We(c,x),er("invalid",c);break;default:N=x}It(v,N),pe=N;for($ in pe)if(pe.hasOwnProperty($)){var be=pe[$];$==="style"?Et(c,be):$==="dangerouslySetInnerHTML"?(be=be?be.__html:void 0,be!=null&&Ye(c,be)):$==="children"?typeof be=="string"?(v!=="textarea"||be!=="")&&ge(c,be):typeof be=="number"&&ge(c,""+be):$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&$!=="autoFocus"&&(a.hasOwnProperty($)?be!=null&&$==="onScroll"&&er("scroll",c):be!=null&&C(c,$,be,W))}switch(v){case"input":ae(c),Xe(c,x,!1);break;case"textarea":ae(c),X(c);break;case"option":x.value!=null&&c.setAttribute("value",""+re(x.value));break;case"select":c.multiple=!!x.multiple,$=x.value,$!=null?oe(c,!!x.multiple,$,!1):x.defaultValue!=null&&oe(c,!!x.multiple,x.defaultValue,!0);break;default:typeof N.onClick=="function"&&(c.onclick=M1)}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 rs(d),null;case 6:if(c&&d.stateNode!=null)N3(c,d,c.memoizedProps,x);else{if(typeof x!="string"&&d.stateNode===null)throw Error(n(166));if(v=ql(t0.current),ql(go.current),H1(d)){if(x=d.stateNode,v=d.memoizedProps,x[mo]=d,($=x.nodeValue!==v)&&(c=Ks,c!==null))switch(c.tag){case 3:N1(x.nodeValue,v,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&N1(x.nodeValue,v,(c.mode&1)!==0)}$&&(d.flags|=4)}else x=(v.nodeType===9?v:v.ownerDocument).createTextNode(x),x[mo]=d,d.stateNode=x}return rs(d),null;case 13:if(tr(ir),x=d.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(ar&&Gs!==null&&(d.mode&1)!==0&&(d.flags&128)===0)Pb(),pu(),d.flags|=98560,$=!1;else if($=H1(d),x!==null&&x.dehydrated!==null){if(c===null){if(!$)throw Error(n(318));if($=d.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(n(317));$[mo]=d}else pu(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;rs(d),$=!1}else Ia!==null&&(Tg(Ia),Ia=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?Pr===0&&(Pr=3):Og())),d.updateQueue!==null&&(d.flags|=4),rs(d),null);case 4:return wu(),Sg(c,d),c===null&&Gd(d.stateNode.containerInfo),rs(d),null;case 10:return X2(d.type._context),rs(d),null;case 17:return Ls(d.type)&&P1(),rs(d),null;case 19:if(tr(ir),$=d.memoizedState,$===null)return rs(d),null;if(x=(d.flags&128)!==0,W=$.rendering,W===null)if(x)o0($,!1);else{if(Pr!==0||c!==null&&(c.flags&128)!==0)for(c=d.child;c!==null;){if(W=Z1(c),W!==null){for(d.flags|=128,o0($,!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&&Ke()>ku&&(d.flags|=128,x=!0,o0($,!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),o0($,!0),$.tail===null&&$.tailMode==="hidden"&&!W.alternate&&!ar)return rs(d),null}else 2*Ke()-$.renderingStartTime>ku&&v!==1073741824&&(d.flags|=128,x=!0,o0($,!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=Ke(),d.sibling=null,v=ir.current,Gn(ir,x?v&1|2:v&1),d):(rs(d),null);case 22:case 23:return Hg(),x=d.memoizedState!==null,c!==null&&c.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Ys&1073741824)!==0&&(rs(d),d.subtreeFlags&6&&(d.flags|=8192)):rs(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function mT(c,d){switch(U2(d),d.tag){case 1:return Ls(d.type)&&P1(),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return wu(),tr(Ps),tr(ts),sg(),c=d.flags,(c&65536)!==0&&(c&128)===0?(d.flags=c&-65537|128,d):null;case 5:return ng(d),null;case 13:if(tr(ir),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(n(340));pu()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return tr(ir),null;case 4:return wu(),null;case 10:return X2(d.type._context),null;case 22:case 23:return Hg(),null;case 24:return null;default:return null}}var X1=!1,ss=!1,gT=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function bu(c,d){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(x){pr(c,d,x)}else v.current=null}function Eg(c,d,v){try{v()}catch(x){pr(c,d,x)}}var M3=!1;function vT(c,d){if(H2=bn,c=ib(),N2(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,pe=-1,be=-1,ze=0,dt=0,gt=c,ut=null;t:for(;;){for(var $t;gt!==v||N!==0&&gt.nodeType!==3||(pe=W+N),gt!==$||x!==0&&gt.nodeType!==3||(be=W+x),gt.nodeType===3&&(W+=gt.nodeValue.length),($t=gt.firstChild)!==null;)ut=gt,gt=$t;for(;;){if(gt===c)break t;if(ut===v&&++ze===N&&(pe=W),ut===$&&++dt===x&&(be=W),($t=gt.nextSibling)!==null)break;gt=ut,ut=gt.parentNode}gt=$t}v=pe===-1||be===-1?null:{start:pe,end:be}}else v=null}v=v||{start:0,end:0}}else v=null;for(O2={focusedElem:c,selectionRange:v},bn=!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 Vt=Ht.memoizedProps,vr=Ht.memoizedState,Le=d.stateNode,je=Le.getSnapshotBeforeUpdate(d.elementType===d.type?Vt:Fa(d.type,Vt),vr);Le.__reactInternalSnapshotBeforeUpdate=je}break;case 3:var He=d.stateNode.containerInfo;He.nodeType===1?He.textContent="":He.nodeType===9&&He.documentElement&&He.removeChild(He.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xt){pr(d,d.return,xt)}if(c=d.sibling,c!==null){c.return=d.return,Dt=c;break}Dt=d.return}return Ht=M3,M3=!1,Ht}function i0(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&&Eg(d,v,$)}N=N.next}while(N!==x)}}function Q1(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 Cg(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 R3(c){var d=c.alternate;d!==null&&(c.alternate=null,R3(d)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(d=c.stateNode,d!==null&&(delete d[mo],delete d[qd],delete d[V2],delete d[J$],delete d[eT])),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 P3(c){return c.tag===5||c.tag===3||c.tag===4}function L3(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||P3(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 jg(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=M1));else if(x!==4&&(c=c.child,c!==null))for(jg(c,d,v),c=c.sibling;c!==null;)jg(c,d,v),c=c.sibling}function Ag(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(Ag(c,d,v),c=c.sibling;c!==null;)Ag(c,d,v),c=c.sibling}var Kr=null,_a=!1;function Vi(c,d,v){for(v=v.child;v!==null;)$3(c,d,v),v=v.sibling}function $3(c,d,v){if(F&&typeof F.onCommitFiberUnmount=="function")try{F.onCommitFiberUnmount(tt,v)}catch{}switch(v.tag){case 5:ss||bu(v,d);case 6:var x=Kr,N=_a;Kr=null,Vi(c,d,v),Kr=x,_a=N,Kr!==null&&(_a?(c=Kr,v=v.stateNode,c.nodeType===8?c.parentNode.removeChild(v):c.removeChild(v)):Kr.removeChild(v.stateNode));break;case 18:Kr!==null&&(_a?(c=Kr,v=v.stateNode,c.nodeType===8?_2(c.parentNode,v):c.nodeType===1&&_2(c,v),On(c)):_2(Kr,v.stateNode));break;case 4:x=Kr,N=_a,Kr=v.stateNode.containerInfo,_a=!0,Vi(c,d,v),Kr=x,_a=N;break;case 0:case 11:case 14:case 15:if(!ss&&(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)&&Eg(v,d,W),N=N.next}while(N!==x)}Vi(c,d,v);break;case 1:if(!ss&&(bu(v,d),x=v.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=v.memoizedProps,x.state=v.memoizedState,x.componentWillUnmount()}catch(pe){pr(v,d,pe)}Vi(c,d,v);break;case 21:Vi(c,d,v);break;case 22:v.mode&1?(ss=(x=ss)||v.memoizedState!==null,Vi(c,d,v),ss=x):Vi(c,d,v);break;default:Vi(c,d,v)}}function T3(c){var d=c.updateQueue;if(d!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new gT),d.forEach(function(x){var N=jT.bind(null,c,x);v.has(x)||(v.add(x),x.then(N,N))})}}function Va(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,pe=W;e:for(;pe!==null;){switch(pe.tag){case 5:Kr=pe.stateNode,_a=!1;break e;case 3:Kr=pe.stateNode.containerInfo,_a=!0;break e;case 4:Kr=pe.stateNode.containerInfo,_a=!0;break e}pe=pe.return}if(Kr===null)throw Error(n(160));$3($,W,N),Kr=null,_a=!1;var be=N.alternate;be!==null&&(be.return=null),N.return=null}catch(ze){pr(N,d,ze)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)D3(d,c),d=d.sibling}function D3(c,d){var v=c.alternate,x=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(Va(d,c),wo(c),x&4){try{i0(3,c,c.return),Q1(3,c)}catch(Vt){pr(c,c.return,Vt)}try{i0(5,c,c.return)}catch(Vt){pr(c,c.return,Vt)}}break;case 1:Va(d,c),wo(c),x&512&&v!==null&&bu(v,v.return);break;case 5:if(Va(d,c),wo(c),x&512&&v!==null&&bu(v,v.return),c.flags&32){var N=c.stateNode;try{ge(N,"")}catch(Vt){pr(c,c.return,Vt)}}if(x&4&&(N=c.stateNode,N!=null)){var $=c.memoizedProps,W=v!==null?v.memoizedProps:$,pe=c.type,be=c.updateQueue;if(c.updateQueue=null,be!==null)try{pe==="input"&&$.type==="radio"&&$.name!=null&&vt(N,$),Mt(pe,W);var ze=Mt(pe,$);for(W=0;W<be.length;W+=2){var dt=be[W],gt=be[W+1];dt==="style"?Et(N,gt):dt==="dangerouslySetInnerHTML"?Ye(N,gt):dt==="children"?ge(N,gt):C(N,dt,gt,ze)}switch(pe){case"input":Ue(N,$);break;case"textarea":ie(N,$);break;case"select":var ut=N._wrapperState.wasMultiple;N._wrapperState.wasMultiple=!!$.multiple;var $t=$.value;$t!=null?oe(N,!!$.multiple,$t,!1):ut!==!!$.multiple&&($.defaultValue!=null?oe(N,!!$.multiple,$.defaultValue,!0):oe(N,!!$.multiple,$.multiple?[]:"",!1))}N[qd]=$}catch(Vt){pr(c,c.return,Vt)}}break;case 6:if(Va(d,c),wo(c),x&4){if(c.stateNode===null)throw Error(n(162));N=c.stateNode,$=c.memoizedProps;try{N.nodeValue=$}catch(Vt){pr(c,c.return,Vt)}}break;case 3:if(Va(d,c),wo(c),x&4&&v!==null&&v.memoizedState.isDehydrated)try{On(d.containerInfo)}catch(Vt){pr(c,c.return,Vt)}break;case 4:Va(d,c),wo(c);break;case 13:Va(d,c),wo(c),N=c.child,N.flags&8192&&($=N.memoizedState!==null,N.stateNode.isHidden=$,!$||N.alternate!==null&&N.alternate.memoizedState!==null||(Rg=Ke())),x&4&&T3(c);break;case 22:if(dt=v!==null&&v.memoizedState!==null,c.mode&1?(ss=(ze=ss)||dt,Va(d,c),ss=ze):Va(d,c),wo(c),x&8192){if(ze=c.memoizedState!==null,(c.stateNode.isHidden=ze)&&!dt&&(c.mode&1)!==0)for(Dt=c,dt=c.child;dt!==null;){for(gt=Dt=dt;Dt!==null;){switch(ut=Dt,$t=ut.child,ut.tag){case 0:case 11:case 14:case 15:i0(4,ut,ut.return);break;case 1:bu(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(Vt){pr(x,v,Vt)}}break;case 5:bu(ut,ut.return);break;case 22:if(ut.memoizedState!==null){I3(gt);continue}}$t!==null?($t.return=ut,Dt=$t):I3(gt)}dt=dt.sibling}e:for(dt=null,gt=c;;){if(gt.tag===5){if(dt===null){dt=gt;try{N=gt.stateNode,ze?($=N.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none"):(pe=gt.stateNode,be=gt.memoizedProps.style,W=be!=null&&be.hasOwnProperty("display")?be.display:null,pe.style.display=wt("display",W))}catch(Vt){pr(c,c.return,Vt)}}}else if(gt.tag===6){if(dt===null)try{gt.stateNode.nodeValue=ze?"":gt.memoizedProps}catch(Vt){pr(c,c.return,Vt)}}else if((gt.tag!==22&&gt.tag!==23||gt.memoizedState===null||gt===c)&&gt.child!==null){gt.child.return=gt,gt=gt.child;continue}if(gt===c)break e;for(;gt.sibling===null;){if(gt.return===null||gt.return===c)break e;dt===gt&&(dt=null),gt=gt.return}dt===gt&&(dt=null),gt.sibling.return=gt.return,gt=gt.sibling}}break;case 19:Va(d,c),wo(c),x&4&&T3(c);break;case 21:break;default:Va(d,c),wo(c)}}function wo(c){var d=c.flags;if(d&2){try{e:{for(var v=c.return;v!==null;){if(P3(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&&(ge(N,""),x.flags&=-33);var $=L3(c);Ag(c,$,N);break;case 3:case 4:var W=x.stateNode.containerInfo,pe=L3(c);jg(c,pe,W);break;default:throw Error(n(161))}}catch(be){pr(c,c.return,be)}c.flags&=-3}d&4096&&(c.flags&=-4097)}function wT(c,d,v){Dt=c,H3(c)}function H3(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||X1;if(!W){var pe=N.alternate,be=pe!==null&&pe.memoizedState!==null||ss;pe=X1;var ze=ss;if(X1=W,(ss=be)&&!ze)for(Dt=N;Dt!==null;)W=Dt,be=W.child,W.tag===22&&W.memoizedState!==null?F3(N):be!==null?(be.return=W,Dt=be):F3(N);for(;$!==null;)Dt=$,H3($),$=$.sibling;Dt=N,X1=pe,ss=ze}O3(c)}else(N.subtreeFlags&8772)!==0&&$!==null?($.return=N,Dt=$):O3(c)}}function O3(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:ss||Q1(5,d);break;case 1:var x=d.stateNode;if(d.flags&4&&!ss)if(v===null)x.componentDidMount();else{var N=d.elementType===d.type?v.memoizedProps:Fa(d.type,v.memoizedProps);x.componentDidUpdate(N,v.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var $=d.updateQueue;$!==null&&Ib(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}Ib(d,W,v)}break;case 5:var pe=d.stateNode;if(v===null&&d.flags&4){v=pe;var be=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":be.autoFocus&&v.focus();break;case"img":be.src&&(v.src=be.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var ze=d.alternate;if(ze!==null){var dt=ze.memoizedState;if(dt!==null){var gt=dt.dehydrated;gt!==null&&On(gt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}ss||d.flags&512&&Cg(d)}catch(ut){pr(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 I3(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 F3(c){for(;Dt!==null;){var d=Dt;try{switch(d.tag){case 0:case 11:case 15:var v=d.return;try{Q1(4,d)}catch(be){pr(d,v,be)}break;case 1:var x=d.stateNode;if(typeof x.componentDidMount=="function"){var N=d.return;try{x.componentDidMount()}catch(be){pr(d,N,be)}}var $=d.return;try{Cg(d)}catch(be){pr(d,$,be)}break;case 5:var W=d.return;try{Cg(d)}catch(be){pr(d,W,be)}}}catch(be){pr(d,d.return,be)}if(d===c){Dt=null;break}var pe=d.sibling;if(pe!==null){pe.return=d.return,Dt=pe;break}Dt=d.return}}var yT=Math.ceil,J1=A.ReactCurrentDispatcher,Ng=A.ReactCurrentOwner,fa=A.ReactCurrentBatchConfig,Hn=0,Fr=null,br=null,Gr=0,Ys=0,xu=Hi(0),Pr=0,l0=null,Ql=0,eh=0,Mg=0,c0=null,Ts=null,Rg=0,ku=1/0,Go=null,th=!1,Pg=null,Zi=null,nh=!1,zi=null,rh=0,u0=0,Lg=null,sh=-1,ah=0;function bs(){return(Hn&6)!==0?Ke():sh!==-1?sh:sh=Ke()}function Bi(c){return(c.mode&1)===0?1:(Hn&2)!==0&&Gr!==0?Gr&-Gr:nT.transition!==null?(ah===0&&(ah=un()),ah):(c=wn,c!==0||(c=window.event,c=c===void 0?16:gs(c.type)),c)}function Za(c,d,v,x){if(50<u0)throw u0=0,Lg=null,Error(n(185));tn(c,v,x),((Hn&2)===0||c!==Fr)&&(c===Fr&&((Hn&2)===0&&(eh|=v),Pr===4&&Ui(c,Gr)),Ds(c,x),v===1&&Hn===0&&(d.mode&1)===0&&(ku=Ke()+500,$1&&Ii()))}function Ds(c,d){var v=c.callbackNode;Nn(c,d);var x=vn(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?tT(V3.bind(null,c)):jb(V3.bind(null,c)),X$(function(){(Hn&6)===0&&Ii()}),v=null;else{switch(oa(x)){case 1:v=Yt;break;case 4:v=jt;break;case 16:v=Ft;break;case 536870912:v=Fe;break;default:v=Ft}v=Y3(v,_3.bind(null,c))}c.callbackPriority=d,c.callbackNode=v}}function _3(c,d){if(sh=-1,ah=0,(Hn&6)!==0)throw Error(n(327));var v=c.callbackNode;if(Su()&&c.callbackNode!==v)return null;var x=vn(c,c===Fr?Gr:0);if(x===0)return null;if((x&30)!==0||(x&c.expiredLanes)!==0||d)d=oh(c,x);else{d=x;var N=Hn;Hn|=2;var $=z3();(Fr!==c||Gr!==d)&&(Go=null,ku=Ke()+500,ec(c,d));do try{kT();break}catch(pe){Z3(c,pe)}while(!0);q2(),J1.current=$,Hn=N,br!==null?d=0:(Fr=null,Gr=0,d=Pr)}if(d!==0){if(d===2&&(N=Qn(c),N!==0&&(x=N,d=$g(c,N))),d===1)throw v=l0,ec(c,0),Ui(c,x),Ds(c,Ke()),v;if(d===6)Ui(c,x);else{if(N=c.current.alternate,(x&30)===0&&!bT(N)&&(d=oh(c,x),d===2&&($=Qn(c),$!==0&&(x=$,d=$g(c,$))),d===1))throw v=l0,ec(c,0),Ui(c,x),Ds(c,Ke()),v;switch(c.finishedWork=N,c.finishedLanes=x,d){case 0:case 1:throw Error(n(345));case 2:tc(c,Ts,Go);break;case 3:if(Ui(c,x),(x&130023424)===x&&(d=Rg+500-Ke(),10<d)){if(vn(c,0)!==0)break;if(N=c.suspendedLanes,(N&x)!==x){bs(),c.pingedLanes|=c.suspendedLanes&N;break}c.timeoutHandle=F2(tc.bind(null,c,Ts,Go),d);break}tc(c,Ts,Go);break;case 4:if(Ui(c,x),(x&4194240)===x)break;for(d=c.eventTimes,N=-1;0<x;){var W=31-ye(x);$=1<<W,W=d[W],W>N&&(N=W),x&=~$}if(x=N,x=Ke()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*yT(x/1960))-x,10<x){c.timeoutHandle=F2(tc.bind(null,c,Ts,Go),x);break}tc(c,Ts,Go);break;case 5:tc(c,Ts,Go);break;default:throw Error(n(329))}}}return Ds(c,Ke()),c.callbackNode===v?_3.bind(null,c):null}function $g(c,d){var v=c0;return c.current.memoizedState.isDehydrated&&(ec(c,d).flags|=256),c=oh(c,d),c!==2&&(d=Ts,Ts=v,d!==null&&Tg(d)),c}function Tg(c){Ts===null?Ts=c:Ts.push.apply(Ts,c)}function bT(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(!Oa($(),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 Ui(c,d){for(d&=~Mg,d&=~eh,c.suspendedLanes|=d,c.pingedLanes&=~d,c=c.expirationTimes;0<d;){var v=31-ye(d),x=1<<v;c[v]=-1,d&=~x}}function V3(c){if((Hn&6)!==0)throw Error(n(327));Su();var d=vn(c,0);if((d&1)===0)return Ds(c,Ke()),null;var v=oh(c,d);if(c.tag!==0&&v===2){var x=Qn(c);x!==0&&(d=x,v=$g(c,x))}if(v===1)throw v=l0,ec(c,0),Ui(c,d),Ds(c,Ke()),v;if(v===6)throw Error(n(345));return c.finishedWork=c.current.alternate,c.finishedLanes=d,tc(c,Ts,Go),Ds(c,Ke()),null}function Dg(c,d){var v=Hn;Hn|=1;try{return c(d)}finally{Hn=v,Hn===0&&(ku=Ke()+500,$1&&Ii())}}function Jl(c){zi!==null&&zi.tag===0&&(Hn&6)===0&&Su();var d=Hn;Hn|=1;var v=fa.transition,x=wn;try{if(fa.transition=null,wn=1,c)return c()}finally{wn=x,fa.transition=v,Hn=d,(Hn&6)===0&&Ii()}}function Hg(){Ys=xu.current,tr(xu)}function ec(c,d){c.finishedWork=null,c.finishedLanes=0;var v=c.timeoutHandle;if(v!==-1&&(c.timeoutHandle=-1,q$(v)),br!==null)for(v=br.return;v!==null;){var x=v;switch(U2(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&P1();break;case 3:wu(),tr(Ps),tr(ts),sg();break;case 5:ng(x);break;case 4:wu();break;case 13:tr(ir);break;case 19:tr(ir);break;case 10:X2(x.type._context);break;case 22:case 23:Hg()}v=v.return}if(Fr=c,br=c=Wi(c.current,null),Gr=Ys=d,Pr=0,l0=null,Mg=eh=Ql=0,Ts=c0=null,Yl!==null){for(d=0;d<Yl.length;d++)if(v=Yl[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}Yl=null}return c}function Z3(c,d){do{var v=br;try{if(q2(),z1.current=K1,B1){for(var x=lr.memoizedState;x!==null;){var N=x.queue;N!==null&&(N.pending=null),x=x.next}B1=!1}if(Xl=0,Ir=Rr=lr=null,n0=!1,r0=0,Ng.current=null,v===null||v.return===null){Pr=1,l0=d,br=null;break}e:{var $=c,W=v.return,pe=v,be=d;if(d=Gr,pe.flags|=32768,be!==null&&typeof be=="object"&&typeof be.then=="function"){var ze=be,dt=pe,gt=dt.tag;if((dt.mode&1)===0&&(gt===0||gt===11||gt===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=h3(W);if($t!==null){$t.flags&=-257,p3($t,W,pe,$,d),$t.mode&1&&f3($,ze,d),d=$t,be=ze;var Ht=d.updateQueue;if(Ht===null){var Vt=new Set;Vt.add(be),d.updateQueue=Vt}else Ht.add(be);break e}else{if((d&1)===0){f3($,ze,d),Og();break e}be=Error(n(426))}}else if(ar&&pe.mode&1){var vr=h3(W);if(vr!==null){(vr.flags&65536)===0&&(vr.flags|=256),p3(vr,W,pe,$,d),G2(yu(be,pe));break e}}$=be=yu(be,pe),Pr!==4&&(Pr=2),c0===null?c0=[$]:c0.push($),$=W;do{switch($.tag){case 3:$.flags|=65536,d&=-d,$.lanes|=d;var Le=u3($,be,d);Ob($,Le);break e;case 1:pe=be;var je=$.type,He=$.stateNode;if(($.flags&128)===0&&(typeof je.getDerivedStateFromError=="function"||He!==null&&typeof He.componentDidCatch=="function"&&(Zi===null||!Zi.has(He)))){$.flags|=65536,d&=-d,$.lanes|=d;var xt=d3($,pe,d);Ob($,xt);break e}}$=$.return}while($!==null)}U3(v)}catch(zt){d=zt,br===v&&v!==null&&(br=v=v.return);continue}break}while(!0)}function z3(){var c=J1.current;return J1.current=K1,c===null?K1:c}function Og(){(Pr===0||Pr===3||Pr===2)&&(Pr=4),Fr===null||(Ql&268435455)===0&&(eh&268435455)===0||Ui(Fr,Gr)}function oh(c,d){var v=Hn;Hn|=2;var x=z3();(Fr!==c||Gr!==d)&&(Go=null,ec(c,d));do try{xT();break}catch(N){Z3(c,N)}while(!0);if(q2(),Hn=v,J1.current=x,br!==null)throw Error(n(261));return Fr=null,Gr=0,Pr}function xT(){for(;br!==null;)B3(br)}function kT(){for(;br!==null&&!ft();)B3(br)}function B3(c){var d=G3(c.alternate,c,Ys);c.memoizedProps=c.pendingProps,d===null?U3(c):br=d,Ng.current=null}function U3(c){var d=c;do{var v=d.alternate;if(c=d.return,(d.flags&32768)===0){if(v=pT(v,d,Ys),v!==null){br=v;return}}else{if(v=mT(v,d),v!==null){v.flags&=32767,br=v;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{Pr=6,br=null;return}}if(d=d.sibling,d!==null){br=d;return}br=d=c}while(d!==null);Pr===0&&(Pr=5)}function tc(c,d,v){var x=wn,N=fa.transition;try{fa.transition=null,wn=1,ST(c,d,v,x)}finally{fa.transition=N,wn=x}return null}function ST(c,d,v,x){do Su();while(zi!==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(gr(c,$),c===Fr&&(br=Fr=null,Gr=0),(v.subtreeFlags&2064)===0&&(v.flags&2064)===0||nh||(nh=!0,Y3(Ft,function(){return Su(),null})),$=(v.flags&15990)!==0,(v.subtreeFlags&15990)!==0||$){$=fa.transition,fa.transition=null;var W=wn;wn=1;var pe=Hn;Hn|=4,Ng.current=null,vT(c,v),D3(v,c),z$(O2),bn=!!H2,O2=H2=null,c.current=v,wT(v),$e(),Hn=pe,wn=W,fa.transition=$}else c.current=v;if(nh&&(nh=!1,zi=c,rh=N),$=c.pendingLanes,$===0&&(Zi=null),fe(v.stateNode),Ds(c,Ke()),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(th)throw th=!1,c=Pg,Pg=null,c;return(rh&1)!==0&&c.tag!==0&&Su(),$=c.pendingLanes,($&1)!==0?c===Lg?u0++:(u0=0,Lg=c):u0=0,Ii(),null}function Su(){if(zi!==null){var c=oa(rh),d=fa.transition,v=wn;try{if(fa.transition=null,wn=16>c?16:c,zi===null)var x=!1;else{if(c=zi,zi=null,rh=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 pe=$.deletions;if(pe!==null){for(var be=0;be<pe.length;be++){var ze=pe[be];for(Dt=ze;Dt!==null;){var dt=Dt;switch(dt.tag){case 0:case 11:case 15:i0(8,dt,$)}var gt=dt.child;if(gt!==null)gt.return=dt,Dt=gt;else for(;Dt!==null;){dt=Dt;var ut=dt.sibling,$t=dt.return;if(R3(dt),dt===ze){Dt=null;break}if(ut!==null){ut.return=$t,Dt=ut;break}Dt=$t}}}var Ht=$.alternate;if(Ht!==null){var Vt=Ht.child;if(Vt!==null){Ht.child=null;do{var vr=Vt.sibling;Vt.sibling=null,Vt=vr}while(Vt!==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:i0(9,$,$.return)}var Le=$.sibling;if(Le!==null){Le.return=$.return,Dt=Le;break e}Dt=$.return}}var je=c.current;for(Dt=je;Dt!==null;){W=Dt;var He=W.child;if((W.subtreeFlags&2064)!==0&&He!==null)He.return=W,Dt=He;else e:for(W=je;Dt!==null;){if(pe=Dt,(pe.flags&2048)!==0)try{switch(pe.tag){case 0:case 11:case 15:Q1(9,pe)}}catch(zt){pr(pe,pe.return,zt)}if(pe===W){Dt=null;break e}var xt=pe.sibling;if(xt!==null){xt.return=pe.return,Dt=xt;break e}Dt=pe.return}}if(Hn=N,Ii(),F&&typeof F.onPostCommitFiberRoot=="function")try{F.onPostCommitFiberRoot(tt,c)}catch{}x=!0}return x}finally{wn=v,fa.transition=d}}return!1}function W3(c,d,v){d=yu(v,d),d=u3(c,d,1),c=_i(c,d,1),d=bs(),c!==null&&(tn(c,1,d),Ds(c,d))}function pr(c,d,v){if(c.tag===3)W3(c,c,v);else for(;d!==null;){if(d.tag===3){W3(d,c,v);break}else if(d.tag===1){var x=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(Zi===null||!Zi.has(x))){c=yu(v,c),c=d3(d,c,1),d=_i(d,c,1),c=bs(),d!==null&&(tn(d,1,c),Ds(d,c));break}}d=d.return}}function ET(c,d,v){var x=c.pingCache;x!==null&&x.delete(d),d=bs(),c.pingedLanes|=c.suspendedLanes&v,Fr===c&&(Gr&v)===v&&(Pr===4||Pr===3&&(Gr&130023424)===Gr&&500>Ke()-Rg?ec(c,0):Mg|=v),Ds(c,d)}function K3(c,d){d===0&&((c.mode&1)===0?d=1:(d=_t,_t<<=1,(_t&130023424)===0&&(_t=4194304)));var v=bs();c=Uo(c,d),c!==null&&(tn(c,d,v),Ds(c,v))}function CT(c){var d=c.memoizedState,v=0;d!==null&&(v=d.retryLane),K3(c,v)}function jT(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),K3(c,v)}var G3;G3=function(c,d,v){if(c!==null)if(c.memoizedProps!==d.pendingProps||Ps.current)$s=!0;else{if((c.lanes&v)===0&&(d.flags&128)===0)return $s=!1,hT(c,d,v);$s=(c.flags&131072)!==0}else $s=!1,ar&&(d.flags&1048576)!==0&&Ab(d,D1,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;q1(c,d),c=d.pendingProps;var N=du(d,ts.current);vu(d,v),N=ig(null,d,x,c,N,v);var $=lg();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,Ls(x)?($=!0,L1(d)):$=!1,d.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,eg(d),N.updater=G1,d.stateNode=N,N._reactInternals=d,pg(d,x,c,v),d=wg(null,d,x,!0,$,v)):(d.tag=0,ar&&$&&B2(d),ys(null,d,N,v),d=d.child),d;case 16:x=d.elementType;e:{switch(q1(c,d),c=d.pendingProps,N=x._init,x=N(x._payload),d.type=x,N=d.tag=NT(x),c=Fa(x,c),N){case 0:d=vg(null,d,x,c,v);break e;case 1:d=b3(null,d,x,c,v);break e;case 11:d=m3(null,d,x,c,v);break e;case 14:d=g3(null,d,x,Fa(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:Fa(x,N),vg(c,d,x,N,v);case 1:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Fa(x,N),b3(c,d,x,N,v);case 3:e:{if(x3(d),c===null)throw Error(n(387));x=d.pendingProps,$=d.memoizedState,N=$.element,Hb(c,d),V1(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=yu(Error(n(423)),d),d=k3(c,d,x,v,N);break e}else if(x!==N){N=yu(Error(n(424)),d),d=k3(c,d,x,v,N);break e}else for(Gs=Di(d.stateNode.containerInfo.firstChild),Ks=d,ar=!0,Ia=null,v=Tb(d,null,x,v),d.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(pu(),x===N){d=Ko(c,d,v);break e}ys(c,d,x,v)}d=d.child}return d;case 5:return Fb(d),c===null&&K2(d),x=d.type,N=d.pendingProps,$=c!==null?c.memoizedProps:null,W=N.children,I2(x,N)?W=null:$!==null&&I2(x,$)&&(d.flags|=32),y3(c,d),ys(c,d,W,v),d.child;case 6:return c===null&&K2(d),null;case 13:return S3(c,d,v);case 4:return tg(d,d.stateNode.containerInfo),x=d.pendingProps,c===null?d.child=mu(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:Fa(x,N),m3(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(I1,x._currentValue),x._currentValue=W,$!==null)if(Oa($.value,W)){if($.children===N.children&&!Ps.current){d=Ko(c,d,v);break e}}else for($=d.child,$!==null&&($.return=d);$!==null;){var pe=$.dependencies;if(pe!==null){W=$.child;for(var be=pe.firstContext;be!==null;){if(be.context===x){if($.tag===1){be=Wo(-1,v&-v),be.tag=2;var ze=$.updateQueue;if(ze!==null){ze=ze.shared;var dt=ze.pending;dt===null?be.next=be:(be.next=dt.next,dt.next=be),ze.pending=be}}$.lanes|=v,be=$.alternate,be!==null&&(be.lanes|=v),Q2($.return,v,d),pe.lanes|=v;break}be=be.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,pe=W.alternate,pe!==null&&(pe.lanes|=v),Q2(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,vu(d,v),N=ua(N),x=x(N),d.flags|=1,ys(c,d,x,v),d.child;case 14:return x=d.type,N=Fa(x,d.pendingProps),N=Fa(x.type,N),g3(c,d,x,N,v);case 15:return v3(c,d,d.type,d.pendingProps,v);case 17:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Fa(x,N),q1(c,d),d.tag=1,Ls(x)?(c=!0,L1(d)):c=!1,vu(d,v),l3(d,x,N),pg(d,x,N,v),wg(null,d,x,!0,c,v);case 19:return C3(c,d,v);case 22:return w3(c,d,v)}throw Error(n(156,d.tag))};function Y3(c,d){return ke(c,d)}function AT(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 ha(c,d,v,x){return new AT(c,d,v,x)}function Ig(c){return c=c.prototype,!(!c||!c.isReactComponent)}function NT(c){if(typeof c=="function")return Ig(c)?1:0;if(c!=null){if(c=c.$$typeof,c===D)return 11;if(c===K)return 14}return 2}function Wi(c,d){var v=c.alternate;return v===null?(v=ha(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 ih(c,d,v,x,N,$){var W=2;if(x=c,typeof c=="function")Ig(c)&&(W=1);else if(typeof c=="string")W=5;else e:switch(c){case M:return nc(v.children,N,$,d);case j:W=8,N|=8;break;case R:return c=ha(12,v,d,N|2),c.elementType=R,c.lanes=$,c;case B:return c=ha(13,v,d,N),c.elementType=B,c.lanes=$,c;case V:return c=ha(19,v,d,N),c.elementType=V,c.lanes=$,c;case I:return lh(v,N,$,d);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case P:W=10;break e;case H:W=9;break e;case D:W=11;break e;case K:W=14;break e;case U:W=16,x=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return d=ha(W,v,d,N),d.elementType=c,d.type=x,d.lanes=$,d}function nc(c,d,v,x){return c=ha(7,c,x,d),c.lanes=v,c}function lh(c,d,v,x){return c=ha(22,c,x,d),c.elementType=I,c.lanes=v,c.stateNode={isHidden:!1},c}function Fg(c,d,v){return c=ha(6,c,null,d),c.lanes=v,c}function _g(c,d,v){return d=ha(4,c.children!==null?c.children:[],c.key,d),d.lanes=v,d.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},d}function MT(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=Jn(0),this.expirationTimes=Jn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jn(0),this.identifierPrefix=x,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function Vg(c,d,v,x,N,$,W,pe,be){return c=new MT(c,d,v,pe,be),d===1?(d=1,$===!0&&(d|=8)):d=0,$=ha(3,null,null,d),c.current=$,$.stateNode=c,$.memoizedState={element:x,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},eg($),c}function RT(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 q3(c){if(!c)return Oi;c=c._reactInternals;e:{if(nt(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(Ls(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(Ls(v))return Eb(c,v,d)}return d}function X3(c,d,v,x,N,$,W,pe,be){return c=Vg(v,x,!0,c,N,$,W,pe,be),c.context=q3(null),v=c.current,x=bs(),N=Bi(v),$=Wo(x,N),$.callback=d??null,_i(v,$,N),c.current.lanes=N,tn(c,N,x),Ds(c,x),c}function ch(c,d,v,x){var N=d.current,$=bs(),W=Bi(N);return v=q3(v),d.context===null?d.context=v:d.pendingContext=v,d=Wo($,W),d.payload={element:c},x=x===void 0?null:x,x!==null&&(d.callback=x),c=_i(N,d,W),c!==null&&(Za(c,N,W,$),_1(c,N,W)),W}function uh(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 Q3(c,d){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v<d?v:d}}function Zg(c,d){Q3(c,d),(c=c.alternate)&&Q3(c,d)}function PT(){return null}var J3=typeof reportError=="function"?reportError:function(c){console.error(c)};function zg(c){this._internalRoot=c}dh.prototype.render=zg.prototype.render=function(c){var d=this._internalRoot;if(d===null)throw Error(n(409));ch(c,d,null,null)},dh.prototype.unmount=zg.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var d=c.containerInfo;Jl(function(){ch(null,c,null,null)}),d[Vo]=null}};function dh(c){this._internalRoot=c}dh.prototype.unstable_scheduleHydration=function(c){if(c){var d=an();c={blockedOn:null,target:c,priority:d};for(var v=0;v<yr.length&&d!==0&&d<yr[v].priority;v++);yr.splice(v,0,c),v===0&&Te(c)}};function Bg(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function fh(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function ex(){}function LT(c,d,v,x,N){if(N){if(typeof x=="function"){var $=x;x=function(){var ze=uh(W);$.call(ze)}}var W=X3(d,x,c,0,null,!1,!1,"",ex);return c._reactRootContainer=W,c[Vo]=W.current,Gd(c.nodeType===8?c.parentNode:c),Jl(),W}for(;N=c.lastChild;)c.removeChild(N);if(typeof x=="function"){var pe=x;x=function(){var ze=uh(be);pe.call(ze)}}var be=Vg(c,0,!1,null,null,!1,!1,"",ex);return c._reactRootContainer=be,c[Vo]=be.current,Gd(c.nodeType===8?c.parentNode:c),Jl(function(){ch(d,be,v,x)}),be}function hh(c,d,v,x,N){var $=v._reactRootContainer;if($){var W=$;if(typeof N=="function"){var pe=N;N=function(){var be=uh(W);pe.call(be)}}ch(d,W,c,N)}else W=LT(v,d,c,N,x);return uh(W)}Tn=function(c){switch(c.tag){case 3:var d=c.stateNode;if(d.current.memoizedState.isDehydrated){var v=Lt(d.pendingLanes);v!==0&&(Or(d,v|1),Ds(d,Ke()),(Hn&6)===0&&(ku=Ke()+500,Ii()))}break;case 13:Jl(function(){var x=Uo(c,1);if(x!==null){var N=bs();Za(x,c,1,N)}}),Zg(c,1)}},ia=function(c){if(c.tag===13){var d=Uo(c,134217728);if(d!==null){var v=bs();Za(d,c,134217728,v)}Zg(c,134217728)}},Ws=function(c){if(c.tag===13){var d=Bi(c),v=Uo(c,d);if(v!==null){var x=bs();Za(v,c,d,x)}Zg(c,d)}},an=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(Ue(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=R1(x);if(!N)throw Error(n(90));Me(x),Ue(x,N)}}}break;case"textarea":ie(c,v);break;case"select":d=v.value,d!=null&&oe(c,!!v.multiple,d,!1)}},rt=Dg,Xt=Jl;var $T={usingClientEntryPoint:!1,Events:[Xd,cu,R1,qe,st,Dg]},d0={findFiberByHostInstance:Ul,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},TT={bundleType:d0.bundleType,version:d0.version,rendererPackageName:d0.rendererPackageName,rendererConfig:d0.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=et(c),c===null?null:c.stateNode},findFiberByHostInstance:d0.findFiberByHostInstance||PT,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 ph=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ph.isDisabled&&ph.supportsFiber)try{tt=ph.inject(TT),F=ph}catch{}}return Hs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$T,Hs.createPortal=function(c,d){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bg(d))throw Error(n(200));return RT(c,d,null,v)},Hs.createRoot=function(c,d){if(!Bg(c))throw Error(n(299));var v=!1,x="",N=J3;return d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(x=d.identifierPrefix),d.onRecoverableError!==void 0&&(N=d.onRecoverableError)),d=Vg(c,1,!1,null,null,v,!1,x,N),c[Vo]=d.current,Gd(c.nodeType===8?c.parentNode:c),new zg(d)},Hs.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=et(d),c=c===null?null:c.stateNode,c},Hs.flushSync=function(c){return Jl(c)},Hs.hydrate=function(c,d,v){if(!fh(d))throw Error(n(200));return hh(null,c,d,!0,v)},Hs.hydrateRoot=function(c,d,v){if(!Bg(c))throw Error(n(405));var x=v!=null&&v.hydratedSources||null,N=!1,$="",W=J3;if(v!=null&&(v.unstable_strictMode===!0&&(N=!0),v.identifierPrefix!==void 0&&($=v.identifierPrefix),v.onRecoverableError!==void 0&&(W=v.onRecoverableError)),d=X3(d,null,c,1,v??null,N,!1,$,W),c[Vo]=d.current,Gd(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 dh(d)},Hs.render=function(c,d,v){if(!fh(d))throw Error(n(200));return hh(null,c,d,!1,v)},Hs.unmountComponentAtNode=function(c){if(!fh(c))throw Error(n(40));return c._reactRootContainer?(Jl(function(){hh(null,null,c,!1,function(){c._reactRootContainer=null,c[Vo]=null})}),!0):!1},Hs.unstable_batchedUpdates=Dg,Hs.unstable_renderSubtreeIntoContainer=function(c,d,v,x){if(!fh(v))throw Error(n(200));if(c==null||c._reactInternals===void 0)throw Error(n(38));return hh(c,d,v,!1,x)},Hs.version="18.3.1-next-f1338f8080-20240426",Hs}var dx;function U9(){if(dx)return Gg.exports;dx=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(),Gg.exports=ZT(),Gg.exports}var fx;function zT(){if(fx)return mh;fx=1;var e=U9();return mh.createRoot=e.createRoot,mh.hydrateRoot=e.hydrateRoot,mh}var BT=zT();/**
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 W9=e=>{throw TypeError(e)},K9=(e,t,n)=>t.has(e)||W9("Cannot "+n),ma=(e,t,n)=>(K9(e,t,"read from private field"),n?n.call(e):t.get(e)),N0=(e,t,n)=>t.has(e)?W9("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),yo=(e,t,n,r)=>(K9(e,t,"write to private field"),t.set(e,n),n),rm=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,sm=/^[\\/]{2}/;function G9(e,t){return t+e.replace(/\\/g,"/")}var hx="popstate";function px(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function UT(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 q0("",{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 KT(t,n,null,e)}function dn(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 WT(){return Math.random().toString(36).substring(2,10)}function mx(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 q0(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Io(t):t,state:n,key:t&&t.key||r||WT(),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 Io(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 KT(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 m(){u="POP";let k=p(),S=k==null?null:k-h;h=k,f&&f({action:u,location:b.location,delta:S})}function g(k,S){u="PUSH";let E=px(k)?k:q0(b.location,k,S);h=p()+1;let C=mx(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=px(k)?k:q0(b.location,k,S);h=p();let C=mx(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 Y9(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(hx,m),f=k,()=>{a.removeEventListener(hx,m),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:g,replace:w,go(k){return l.go(k)}};return b}function Y9(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),dn(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:Es(t);return a=a.replace(/ $/,"%20"),!n&&sm.test(a)&&(a=r+a),new URL(a,r)}var M0,gx=class{constructor(e){if(N0(this,M0,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(ma(this,M0).has(e))return ma(this,M0).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){ma(this,M0).set(e,t)}};M0=new WeakMap;var GT=new Set(["lazy","caseSensitive","path","id","index","children"]);function YT(e){return GT.has(e)}var qT=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function XT(e){return qT.has(e)}function QT(e){return e.index===!0}function X0(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(dn(i.index!==!0||!i.children,"Cannot specify children on an index route"),dn(a||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),QT(i)){let h={...i,id:f};return r[f]=vx(h,t(h)),h}else{let h={...i,id:f,children:void 0};return r[f]=vx(h,t(h)),i.children&&(h.children=X0(i.children,t,u,r,a)),h}})}function vx(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function q9(e,t,n="/"){return za(e,t,n,!1)}function za(e,t,n,r,a){let i=typeof t=="string"?Io(t):t,l=ta(i.pathname||"/",n);if(l==null)return null;let u=a??Gh(e),f=null,h=n7(l);for(let p=0;f==null&&p<u.length;++p)f=lD(u[p],h,r);return f}function X9(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 Gh(e){let t=Q9(e);return JT(t),t}function Q9(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;dn(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 m=Ea([r,p.relativePath]),g=n.concat(p);l.children&&l.children.length>0&&(dn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),Q9(l.children,t,g,m,f)),!(l.path==null&&!l.index)&&t.push({path:m,score:oD(m,l.index),routesMeta:g.map((w,y)=>{let[b,k]=t7(w.relativePath,w.caseSensitive,y===g.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 J9(l.path))i(l,u,!0,h)}),t}function J9(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=J9(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 JT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:iD(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var eD=/^:[\w-]+$/,tD=3,nD=2,rD=1,sD=10,aD=-2,wx=e=>e==="*";function oD(e,t){let n=e.split("/"),r=n.length;return n.some(wx)&&(r+=aD),t&&(r+=nD),n.filter(a=>!wx(a)).reduce((a,i)=>a+(eD.test(i)?tD:i===""?rD:sD),r)}function iD(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 lD(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)||"/",m={path:f.relativePath,caseSensitive:f.caseSensitive,end:h},g=f.matcher&&f.compiledParams?e7(m,p,f.matcher,f.compiledParams):vl(m,p),w=f.route;if(!g&&h&&n&&!r[r.length-1].route.index&&(g=vl({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},p)),!g)return null;Object.assign(a,g.params),l.push({params:a,pathname:Ea([i,g.pathname]),pathnameBase:dD(Ea([i,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(i=Ea([i,g.pathnameBase]))}return l}function fs(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[,m,g,w]=p;let y=t[m];return dn(g==="?"||y!=null,`Missing ":${m}" param`),encodeURIComponent(a(y))+w}return l.replace(/\?$/g,"")}).filter(l=>!!l);return r+i.join("/")}function vl(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=t7(e.path,e.caseSensitive,e.end);return e7(e,t,n,r)}function e7(e,t,n,r){let a=t.match(n);if(!a)return null;let i=a[0],l=dd(i,1),u=a.slice(1);return{params:r.reduce((h,{paramName:p,isOptional:m},g)=>{if(p==="*"){let y=u[g]||"";l=dd(i.slice(0,i.length-y.length),1)}const w=u[g];return m&&!w?h[p]=void 0:h[p]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:l,pattern:e}}function t7(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 m=p.charAt(h+l.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 n7(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 ta(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 cD({basename:e,pathname:t}){return t==="/"?e:Ea([e,t])}var dv=e=>rm.test(e);function uD(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Io(e):e,i;return n?(n=fv(n),n.startsWith("/")||n.startsWith("\\")?i=yx(n.substring(1),"/"):i=yx(n,t)):i=t,{pathname:i,search:fD(r),hash:hD(a)}}function yx(e,t){let n=dd(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Xg(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 r7(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function am(e){let t=r7(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Af(e,t,n,r=!1){let a;typeof e=="string"?a=Io(e):(a={...e},dn(!a.pathname||!a.pathname.includes("?"),Xg("?","pathname","search",a)),dn(!a.pathname||!a.pathname.includes("#"),Xg("#","pathname","hash",a)),dn(!a.search||!a.search.includes("#"),Xg("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,u;if(l==null)u=n;else{let m=t.length-1;if(!r&&l.startsWith("..")){let g=l.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}u=m>=0?t[m]:"/"}let f=uD(a,u),h=l&&l!=="/"&&l.endsWith("/"),p=(i||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||p)&&(f.pathname+="/"),f}var fv=e=>e.replace(/[\\/]{2,}/g,"/"),Ea=e=>fv(e.join("/"));function dd(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 dD=e=>dd(e).replace(/^\/*/,"/"),fD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,hD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,pD=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Nf=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 Q0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Mf(e){let t=e.map(n=>n.route.path).filter(Boolean);return Ea(t)||"/"}var s7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function a7(e,t){let n=e;if(typeof n!="string"||!rm.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(s7)try{let i=new URL(window.location.href),l=sm.test(n)?new URL(G9(n,i.protocol)):new URL(n),u=ta(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 ll=Symbol("Uninstrumented");function mD(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=zu(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=zu(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[ll]??i,u=zu(n[a],l,(...f)=>bx(f[0]));u&&(a==="loader"&&l.hydrate===!0&&(u.hydrate=!0),u[ll]=l,r[a]=u)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let i=a[ll]??a,l=zu(n.middleware,i,(...u)=>bx(u[0]));return l?(l[ll]=i,l):a})),r}function gD(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[ll]??e.navigate,a=zu(n.navigate,r,(...i)=>{let[l,u]=i;return{to:typeof l=="number"||typeof l=="string"?l:l?Es(l):".",...xx(e,u??{})}});a&&(a[ll]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[ll]??e.fetch,a=zu(n.fetch,r,(...i)=>{let[l,,u,f]=i;return{href:u??".",fetcherKey:l,...xx(e,f??{})}});a&&(a[ll]=r,e.fetch=a)}return e}function zu(e,t,n){return e.length===0?null:async(...r)=>{let a=await o7(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function o7(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=o7(e,t,n,r-1),i=await l,dn(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 bx(e){let{request:t,context:n,params:r,pattern:a}=e;return{request:vD(t),params:{...r},pattern:a,context:wD(n)}}function xx(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 vD(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function wD(e){if(bD(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var yD=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function bD(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")===yD}var kx=new URL("http://localhost");function hv(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),kx)}catch{return kx}}function Qg(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function xD(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 Yu(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&&!Qg(a,n),u=!Qg(i,n);if(r==="reject"){if(l||u)throw new Error("External navigation is not allowed")}else if(u&&(a==null||!xD(e,a)||!Qg(a,i)))throw new Error("External navigation is not allowed")}var i7=["POST","PUT","PATCH","DELETE"],kD=new Set(i7),SD=["GET",...i7],ED=new Set(SD),l7=new Set([301,302,303,307,308]),CD=new Set([307,308]),Jg={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},jD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},h0={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},AD=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),c7="remix-router-transitions",u7=Symbol("ResetLoaderData"),cc,Du,Xi,Hu,ND=class{constructor(e){N0(this,cc),N0(this,Du),N0(this,Xi),N0(this,Hu),yo(this,cc,e),yo(this,Du,Gh(e))}get stableRoutes(){return ma(this,cc)}get activeRoutes(){return ma(this,Xi)??ma(this,cc)}get branches(){return ma(this,Hu)??ma(this,Du)}get hasHMRRoutes(){return ma(this,Xi)!=null}setRoutes(e){yo(this,cc,e),yo(this,Du,Gh(e))}setHmrRoutes(e){yo(this,Xi,e),yo(this,Hu,Gh(e))}commitHmrRoutes(){ma(this,Xi)&&(yo(this,cc,ma(this,Xi)),yo(this,Du,ma(this,Hu)),yo(this,Xi,void 0),yo(this,Hu,void 0))}};cc=new WeakMap;Du=new WeakMap;Xi=new WeakMap;Hu=new WeakMap;function MD(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";dn(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||AD,i=a;if(e.instrumentations){let ne=e.instrumentations;i=ce=>({...a(ce),...mD(ne.map(de=>de.route).filter(Boolean),ce)})}let l={},u=new ND(X0(e.routes,i,void 0,l)),f=e.basename||"/";f.startsWith("/")||(f=`/${f}`);let h=e.dataStrategy||TD,p={...e.future},m=null,g=new Set,w=null,y=null,b=null,k=null,S=e.hydrationData!=null,E=za(u.activeRoutes,e.history.location,f,!1,u.branches),C=!1,A=null,L,T;if(E==null&&!e.patchRoutesOnNavigation){let ne=va(404,{pathname:e.history.location.pathname}),{matches:ce,route:de}=gh(u.activeRoutes);L=!0,T=!L,E=ce,A={[de.id]:ne}}else if(E&&!e.hydrationData&&Gt(E,u.activeRoutes,e.history.location.pathname).active&&(E=null),E)if(E.some(ne=>ne.route.lazy))L=!1,T=!L;else if(!E.some(ne=>pv(ne.route)))L=!0,T=!L;else{let ne=e.hydrationData?e.hydrationData.loaderData:null,ce=e.hydrationData?e.hydrationData.errors:null,de=E;if(ce){let Ve=E.findIndex(Ie=>ce[Ie.route.id]!==void 0);de=de.slice(0,Ve+1)}T=!1,L=!0,de.forEach(Ve=>{let Ie=d7(Ve.route,ne,ce);T=T||Ie.renderFallback,L=L&&!Ie.shouldLoad})}else{L=!1,T=!L,E=[];let ne=Gt(null,u.activeRoutes,e.history.location.pathname);ne.active&&ne.matches&&(C=!0,E=ne.matches)}let M,j={historyAction:e.history.action,location:e.history.location,matches:E,initialized:L,renderFallback:T,navigation:Jg,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},R="POP",P=null,H=!1,D,B=!1,V=new Map,K=null,U=!1,I=!1,_=new Set,O=new Map,Y=0,z=-1,q=new Map,Z=new Set,Q=new Map,me=new Map,te=new Set,he=new Map,re,ee=null;function J(){if(m=e.history.listen(({action:ne,location:ce,delta:de})=>{if(re){re(),re=void 0;return}nr(he.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 Ve=Je({currentLocation:j.location,nextLocation:ce,historyAction:ne});if(Ve&&de!=null){let Ie=new Promise(mt=>{re=mt});e.history.go(de*-1),Ee(Ve,{state:"blocked",location:ce,proceed(){Ee(Ve,{state:"proceeding",proceed:void 0,reset:void 0,location:ce}),Ie.then(()=>e.history.go(de))},reset(){let mt=new Map(j.blockers);mt.set(Ve,h0),ue({blockers:mt})}}),P==null||P.resolve(),P=null;return}return Ue(ne,ce)}),n){JD(t,V);let ne=()=>eH(t,V);t.addEventListener("pagehide",ne),K=()=>t.removeEventListener("pagehide",ne)}return j.initialized||Ue("POP",j.location,{initialHydration:!0}),M}function ae(){m&&m(),K&&K(),g.clear(),D&&D.abort(),j.fetchers.forEach((ne,ce)=>wt(j.fetchers,ce)),j.blockers.forEach((ne,ce)=>Tt(ce))}function Me(ne){if(g.add(ne),w){let{newErrors:ce}=w;w=null,ne(j,{deletedFetchers:[],newErrors:ce,viewTransitionOpts:void 0,flushSync:!1})}return()=>g.delete(ne)}function ue(ne,ce={}){ne.matches&&(ne.matches=ne.matches.map(Ie=>{let mt=l[Ie.route.id],bt=Ie.route;return bt.element!==mt.element||bt.errorElement!==mt.errorElement||bt.hydrateFallbackElement!==mt.hydrateFallbackElement?{...Ie,route:mt}:Ie})),j={...j,...ne};let de=[],Ve=[];j.fetchers.forEach((Ie,mt)=>{Ie.state==="idle"&&(te.has(mt)?de.push(mt):Ve.push(mt))}),te.forEach(Ie=>{!j.fetchers.has(Ie)&&!O.has(Ie)&&de.push(Ie)}),g.size===0&&(w={newErrors:ne.errors??null}),[...g].forEach(Ie=>Ie(j,{deletedFetchers:de,newErrors:ne.errors??null,viewTransitionOpts:ce.viewTransitionOpts,flushSync:ce.flushSync===!0})),de.forEach(Ie=>wt(j.fetchers,Ie)),Ve.forEach(Ie=>j.fetchers.delete(Ie))}function Se(ne,ce,{flushSync:de}={}){var Ce,xe;let Ve=j.actionData!=null&&j.navigation.formMethod!=null&&is(j.navigation.formMethod)&&j.navigation.state==="loading"&&((Ce=ne.state)==null?void 0:Ce._isRedirect)!==!0,Ie;ce.actionData?Object.keys(ce.actionData).length>0?Ie=ce.actionData:Ie=null:Ve?Ie=j.actionData:Ie=null;let mt=ce.loaderData?Lx(j.loaderData,ce.loaderData,ce.matches||[],ce.errors):j.loaderData,bt=j.blockers;bt.size>0&&(bt=new Map(bt),bt.forEach((et,Ct)=>bt.set(Ct,h0)));let kt=U?!1:Xt(ne,ce.matches||j.matches),nt=H===!0||j.navigation.formMethod!=null&&is(j.navigation.formMethod)&&((xe=ne.state)==null?void 0:xe._isRedirect)!==!0;u.commitHmrRoutes(),U||R==="POP"||(R==="PUSH"?e.history.push(ne,ne.state):R==="REPLACE"&&e.history.replace(ne,ne.state));let yt;if(R==="POP"){let et=V.get(j.location.pathname);et&&et.has(ne.pathname)?yt={currentLocation:j.location,nextLocation:ne}:V.has(ne.pathname)&&(yt={currentLocation:ne,nextLocation:j.location})}else if(B){let et=V.get(j.location.pathname);et?et.add(ne.pathname):(et=new Set([ne.pathname]),V.set(j.location.pathname,et)),yt={currentLocation:j.location,nextLocation:ne}}ue({...ce,actionData:Ie,loaderData:mt,historyAction:R,location:ne,initialized:!0,renderFallback:!1,navigation:Jg,revalidation:"idle",restoreScrollPosition:kt,preventScrollReset:nt,blockers:bt},{viewTransitionOpts:yt,flushSync:de===!0}),R="POP",H=!1,B=!1,U=!1,I=!1,P==null||P.resolve(),P=null,ee==null||ee.resolve(),ee=null}async function Be(ne,ce){if(P==null||P.resolve(),P=null,typeof ne=="number"){P||(P=Hx());let ke=P.promise;return e.history.go(ne),ke}let de=C6(j.location,j.matches,f,ne,ce==null?void 0:ce.fromRouteId,ce==null?void 0:ce.relative),{path:Ve,submission:Ie,error:mt}=Sx(!1,de,ce),bt;if(ce!=null&&ce.mask){let ke=typeof ce.mask=="string"?Io(ce.mask):{...j.location.mask,...ce.mask};if(bt={pathname:ke.pathname??"",search:ke.search??"",hash:ke.hash??""},sm.test(bt.pathname))throw new Error("External navigation is not allowed");bt.pathname.startsWith("\\")&&(bt.pathname=bt.pathname.replace(/^\\+/,"/")),Yu(typeof ce.mask=="string"?ce.mask:Es(ce.mask),Es(bt),e.history.createURL("/"),"reject")}let kt=j.location,nt=q0(kt,Ve,ce&&ce.state,void 0,bt);nt={...nt,...e.history.encodeLocation(nt)},Yu(ne==null?e.history.createHref(j.location):typeof ne=="string"?ne:Es(ne),e.history.createHref(nt.mask||nt),e.history.createURL("/"),"reject");let yt=ce&&ce.replace!=null?ce.replace:void 0,Ce="PUSH";yt===!0?Ce="REPLACE":yt===!1||Ie!=null&&is(Ie.formMethod)&&Ie.formAction===j.location.pathname+j.location.search&&(Ce="REPLACE");let xe=ce&&"preventScrollReset"in ce?ce.preventScrollReset===!0:void 0,et=(ce&&ce.flushSync)===!0,Ct=Je({currentLocation:kt,nextLocation:nt,historyAction:Ce});if(Ct){Ee(Ct,{state:"blocked",location:nt,proceed(){Ee(Ct,{state:"proceeding",proceed:void 0,reset:void 0,location:nt}),Be(ne,ce)},reset(){let ke=new Map(j.blockers);ke.set(Ct,h0),ue({blockers:ke})}});return}await Ue(Ce,nt,{submission:Ie,pendingError:mt,preventScrollReset:xe,replace:ce&&ce.replace,enableViewTransition:ce&&ce.viewTransition,flushSync:et,callSiteDefaultShouldRevalidate:ce&&ce.defaultShouldRevalidate})}function vt(){ee||(ee=Hx()),_e(),ue({revalidation:"loading"});let ne=ee.promise;return j.navigation.state==="submitting"?ne:j.navigation.state==="idle"?(Ue(j.historyAction,j.location,{startUninterruptedRevalidation:!0}),ne):(Ue(R||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation,enableViewTransition:B===!0}),ne)}async function Ue(ne,ce,de){D&&D.abort(),D=null,R=ne,U=(de&&de.startUninterruptedRevalidation)===!0,rt(j.location,j.matches),H=(de&&de.preventScrollReset)===!0,B=(de&&de.enableViewTransition)===!0;let Ve=u.activeRoutes,Ie=de!=null&&de.initialHydration&&j.matches&&j.matches.length>0&&!C?j.matches:za(Ve,ce,f,!1,u.branches),mt=(de&&de.flushSync)===!0;if(Ie&&j.initialized&&!I&&zD(j.location,ce)&&!(de&&de.submission&&is(de.submission.formMethod))){Se(ce,{matches:Ie},{flushSync:mt});return}let bt=Gt(Ie,Ve,ce.pathname);if(bt.active&&bt.matches&&(Ie=bt.matches),!Ie){let{error:ft,notFoundMatches:$e,route:Ke}=St(ce.pathname);Se(ce,{matches:$e,loaderData:{},errors:{[Ke.id]:ft}},{flushSync:mt});return}let kt=de&&de.overrideNavigation?{...de.overrideNavigation,matches:Ie,historyAction:ne}:void 0;D=new AbortController;let nt=Ou(e.history,ce,D.signal,de&&de.submission),yt=e.getContext?await e.getContext():new gx,Ce;if(de&&de.pendingError)Ce=[rl(Ie).route.id,{type:"error",error:de.pendingError}];else if(de&&de.submission&&is(de.submission.formMethod)){let ft=await Xe(nt,ce,de.submission,Ie,ne,yt,bt.active,de&&de.initialHydration===!0,{replace:de.replace,flushSync:mt});if(ft.shortCircuited)return;if(ft.pendingActionResult){let[$e,Ke]=ft.pendingActionResult;if(Xs(Ke)&&Q0(Ke.error)&&Ke.error.status===404){D=null,Se(ce,{matches:ft.matches,loaderData:{},errors:{[$e]:Ke.error}});return}}Ie=ft.matches||Ie,Ce=ft.pendingActionResult,kt=e8(ce,Ie,ne,de.submission),mt=!1,bt.active=!1,nt=Ou(e.history,nt.url,nt.signal)}let{shortCircuited:xe,matches:et,loaderData:Ct,errors:ke,workingFetchers:it}=await De(nt,ce,Ie,ne,yt,bt.active,kt,de&&de.submission,de&&de.fetcherSubmission,de&&de.replace,de&&de.initialHydration===!0,mt,Ce,de&&de.callSiteDefaultShouldRevalidate);xe||(D=null,Se(ce,{matches:et||Ie,...$x(Ce),loaderData:Ct,errors:ke,...it?{fetchers:it}:{}}))}async function Xe(ne,ce,de,Ve,Ie,mt,bt,kt,nt={}){_e();let yt=XD(ce,Ve,Ie,de);if(ue({navigation:yt},{flushSync:nt.flushSync===!0}),bt){let et=await sn(Ve,ce.pathname,ne.signal);if(et.type==="aborted")return{shortCircuited:!0};if(et.type==="error"){if(et.partialMatches.length===0){let{matches:ke,route:it}=gh(u.activeRoutes);return{matches:ke,pendingActionResult:[it.id,{type:"error",error:et.error}]}}let Ct=rl(et.partialMatches).route.id;return{matches:et.partialMatches,pendingActionResult:[Ct,{type:"error",error:et.error}]}}else if(et.matches)Ve=et.matches;else{let{notFoundMatches:Ct,error:ke,route:it}=St(ce.pathname);return{matches:Ct,pendingActionResult:[it.id,{type:"error",error:ke}]}}}let Ce,xe=Yh(Ve,ce);if(!xe.route.action&&!xe.route.lazy)Ce={type:"error",error:va(405,{method:ne.method,pathname:ce.pathname,routeId:xe.route.id})};else{let et=qu(i,l,ne,ce,Ve,xe,kt?[]:r,mt),Ct=await se(ne,ce,et,mt,null);if(Ce=Ct[xe.route.id],!Ce){for(let ke of Ve)if(Ct[ke.route.id]){Ce=Ct[ke.route.id];break}}if(ne.signal.aborted)return{shortCircuited:!0}}if(vc(Ce)){let et;return nt&&nt.replace!=null?et=nt.replace:et=Mx(Ce.response.headers.get("Location"),new URL(ne.url),f,e.history)===j.location.pathname+j.location.search,await X(ne,Ce,!0,{submission:de,replace:et}),{shortCircuited:!0}}if(Xs(Ce)){let et=rl(Ve,xe.route.id);return(nt&&nt.replace)!==!0&&(R="PUSH"),{matches:Ve,pendingActionResult:[et.route.id,Ce,xe.route.id]}}return{matches:Ve,pendingActionResult:[xe.route.id,Ce]}}async function De(ne,ce,de,Ve,Ie,mt,bt,kt,nt,yt,Ce,xe,et,Ct){let ke=bt||e8(ce,de,Ve,kt),it=kt||nt||Dx(ke),ft=!U&&!Ce;if(mt){if(ft){let ct=G(et);ue({navigation:ke,...ct!==void 0?{actionData:ct}:{}},{flushSync:xe})}let Pe=await sn(de,ce.pathname,ne.signal);if(Pe.type==="aborted")return{shortCircuited:!0};if(Pe.type==="error"){if(Pe.partialMatches.length===0){let{matches:Ot,route:_t}=gh(u.activeRoutes);return{matches:Ot,loaderData:{},errors:{[_t.id]:Pe.error}}}let ct=rl(Pe.partialMatches).route.id;return{matches:Pe.partialMatches,loaderData:{},errors:{[ct]:Pe.error}}}else if(Pe.matches)de=Pe.matches;else{let{error:ct,notFoundMatches:Ot,route:_t}=St(ce.pathname);return{matches:Ot,loaderData:{},errors:{[_t.id]:ct}}}}let $e=u.activeRoutes,{dsMatches:Ke,revalidatingFetchers:Pt}=Ex(ne,Ie,i,l,e.history,j,de,it,ce,Ce?[]:r,Ce===!0,I,_,te,Q,Z,$e,f,e.patchRoutesOnNavigation!=null,u.branches,et,Ct);if(z=++Y,!e.dataStrategy&&!Ke.some(Pe=>Pe.shouldLoad)&&!Ke.some(Pe=>Pe.route.middleware&&Pe.route.middleware.length>0)&&Pt.length===0){let Pe=new Map(j.fetchers),ct=Mt(Pe);return Se(ce,{matches:de,loaderData:{},errors:et&&Xs(et[1])?{[et[0]]:et[1].error}:null,...$x(et),...ct?{fetchers:Pe}:{}},{flushSync:xe}),{shortCircuited:!0}}if(ft){let Pe={};if(!mt){Pe.navigation=ke;let ct=G(et);ct!==void 0&&(Pe.actionData=ct)}Pt.length>0&&(Pe.fetchers=oe(Pt)),ue(Pe,{flushSync:xe})}Pt.forEach(Pe=>{ot(Pe.key),Pe.controller&&O.set(Pe.key,Pe.controller)});let Yt=()=>Pt.forEach(Pe=>ot(Pe.key));D&&D.signal.addEventListener("abort",Yt);let{loaderResults:jt,fetcherResults:Ft}=await Re(Ke,Pt,ne,ce,Ie);if(ne.signal.aborted)return{shortCircuited:!0};D&&D.signal.removeEventListener("abort",Yt),Pt.forEach(Pe=>O.delete(Pe.key));let Ne=vh(jt);if(Ne)return await X(ne,Ne.result,!0,{replace:yt}),{shortCircuited:!0};if(Ne=vh(Ft),Ne)return Z.add(Ne.key),await X(ne,Ne.result,!0,{replace:yt}),{shortCircuited:!0};let Fe=new Map(j.fetchers),{loaderData:tt,errors:F}=Px(j,de,jt,et,Pt,Ft,Fe);Ce&&j.errors&&(F={...j.errors,...F});let fe=Mt(Fe),ye=Zt(z,Fe),Ze=fe||ye||Pt.length>0;return{matches:de,loaderData:tt,errors:F,...Ze?{workingFetchers:Fe}:{}}}function G(ne){if(ne&&!Xs(ne[1]))return{[ne[0]]:ne[1].data};if(j.actionData)return Object.keys(j.actionData).length===0?null:j.actionData}function oe(ne){let ce=new Map(j.fetchers);return ne.forEach(de=>{let Ve=ce.get(de.key),Ie=p0(void 0,Ve?Ve.data:void 0);ce.set(de.key,Ie)}),ce}async function We(ne,ce,de,Ve){ot(ne);let Ie=(Ve&&Ve.flushSync)===!0,mt=u.activeRoutes,bt=C6(j.location,j.matches,f,de,ce,Ve==null?void 0:Ve.relative),kt=za(mt,bt,f,!1,u.branches),nt=Gt(kt,mt,bt);if(nt.active&&nt.matches&&(kt=nt.matches),!kt){ge(ne,ce,va(404,{pathname:bt}),{flushSync:Ie});return}let{path:yt,submission:Ce,error:xe}=Sx(!0,bt,Ve);if(xe){ge(ne,ce,xe,{flushSync:Ie});return}let et=e.getContext?await e.getContext():new gx,Ct=(Ve&&Ve.preventScrollReset)===!0;if(Ce&&is(Ce.formMethod)){await Oe(ne,ce,yt,kt,et,nt.active,Ie,Ct,Ce,Ve&&Ve.defaultShouldRevalidate);return}Q.set(ne,{routeId:ce,path:yt}),await ie(ne,ce,yt,kt,et,nt.active,Ie,Ct,Ce)}async function Oe(ne,ce,de,Ve,Ie,mt,bt,kt,nt,yt){_e(),Q.delete(ne);let Ce=j.fetchers.get(ne);Ye(ne,QD(nt,Ce),{flushSync:bt});let xe=new AbortController,et=Ou(e.history,de,xe.signal,nt);if(mt){let qt=await sn(Ve,new URL(et.url).pathname,et.signal,ne);if(qt.type==="aborted")return;if(qt.type==="error"){ge(ne,ce,qt.error,{flushSync:bt});return}else if(qt.matches)Ve=qt.matches;else{ge(ne,ce,va(404,{pathname:de}),{flushSync:bt});return}}let Ct=Yh(Ve,de);if(!Ct.route.action&&!Ct.route.lazy){let qt=va(405,{method:nt.formMethod,pathname:de,routeId:ce});ge(ne,ce,qt,{flushSync:bt});return}O.set(ne,xe);let ke=Y,it=qu(i,l,et,de,Ve,Ct,r,Ie),ft=await se(et,de,it,Ie,ne),$e=ft[Ct.route.id];if(!$e){for(let qt of it)if(ft[qt.route.id]){$e=ft[qt.route.id];break}}if(et.signal.aborted){O.get(ne)===xe&&O.delete(ne);return}if(te.has(ne)){if(vc($e)||Xs($e)){Ye(ne,ko(void 0));return}}else{if(vc($e))if(O.delete(ne),z>ke){Ye(ne,ko(void 0));return}else return Z.add(ne),Ye(ne,p0(nt)),X(et,$e,!1,{fetcherSubmission:nt,preventScrollReset:kt});if(Xs($e)){ge(ne,ce,$e.error);return}}let Ke=j.navigation.location||j.location,Pt=Ou(e.history,Ke,xe.signal),Yt=u.activeRoutes,jt=j.navigation.state!=="idle"?za(Yt,j.navigation.location,f,!1,u.branches):j.matches;dn(jt,"Didn't find any matches after fetcher action");let Ft=++Y;q.set(ne,Ft);let{dsMatches:Ne,revalidatingFetchers:Fe}=Ex(Pt,Ie,i,l,e.history,j,jt,nt,Ke,r,!1,I,_,te,Q,Z,Yt,f,e.patchRoutesOnNavigation!=null,u.branches,[Ct.route.id,$e],yt),tt=p0(nt,$e.data),F=new Map(j.fetchers);F.set(ne,tt),Fe.filter(qt=>qt.key!==ne).forEach(qt=>{let Nn=qt.key,Qn=F.get(Nn),un=p0(void 0,Qn?Qn.data:void 0);F.set(Nn,un),ot(Nn),qt.controller&&O.set(Nn,qt.controller)}),ue({fetchers:F});let fe=()=>Fe.forEach(qt=>ot(qt.key));xe.signal.addEventListener("abort",fe);let{loaderResults:ye,fetcherResults:Ze}=await Re(Ne,Fe,Pt,Ke,Ie);if(xe.signal.aborted)return;xe.signal.removeEventListener("abort",fe),q.delete(ne),O.delete(ne),Fe.forEach(qt=>O.delete(qt.key));let Pe=j.fetchers.has(ne),ct=qt=>{if(!Pe)return qt;let Nn=new Map(qt.fetchers);return Nn.set(ne,ko($e.data)),{...qt,fetchers:Nn}},Ot=vh(ye);if(Ot)return j=ct(j),X(Pt,Ot.result,!1,{preventScrollReset:kt});if(Ot=vh(Ze),Ot)return Z.add(Ot.key),j=ct(j),X(Pt,Ot.result,!1,{preventScrollReset:kt});let _t=new Map(j.fetchers);Pe&&_t.set(ne,ko($e.data));let{loaderData:Lt,errors:vn}=Px(j,jt,ye,void 0,Fe,Ze,_t);Zt(Ft,_t),j.navigation.state==="loading"&&Ft>z?(dn(R,"Expected pending action"),D&&D.abort(),Se(j.navigation.location,{matches:jt,loaderData:Lt,errors:vn,fetchers:_t})):(ue({errors:vn,loaderData:Lx(j.loaderData,Lt,jt,vn),fetchers:_t}),I=!1)}async function ie(ne,ce,de,Ve,Ie,mt,bt,kt,nt){let yt=j.fetchers.get(ne);Ye(ne,p0(nt,yt?yt.data:void 0),{flushSync:bt});let Ce=new AbortController,xe=Ou(e.history,de,Ce.signal);if(mt){let $e=await sn(Ve,new URL(xe.url).pathname,xe.signal,ne);if($e.type==="aborted")return;if($e.type==="error"){ge(ne,ce,$e.error,{flushSync:bt});return}else if($e.matches)Ve=$e.matches;else{ge(ne,ce,va(404,{pathname:de}),{flushSync:bt});return}}let et=Yh(Ve,de);O.set(ne,Ce);let Ct=Y,ke=qu(i,l,xe,de,Ve,et,r,Ie),it=await se(xe,de,ke,Ie,ne),ft=it[et.route.id];if(!ft){for(let $e of Ve)if(it[$e.route.id]){ft=it[$e.route.id];break}}if(O.get(ne)===Ce&&O.delete(ne),!xe.signal.aborted){if(te.has(ne)){Ye(ne,ko(void 0));return}if(vc(ft))if(z>Ct){Ye(ne,ko(void 0));return}else{Z.add(ne),await X(xe,ft,!1,{preventScrollReset:kt});return}if(Xs(ft)){ge(ne,ce,ft.error);return}Ye(ne,ko(ft.data))}}async function X(ne,ce,de,{submission:Ve,fetcherSubmission:Ie,preventScrollReset:mt,replace:bt}={}){de||(P==null||P.resolve(),P=null),ce.response.headers.has("X-Remix-Revalidate")&&(I=!0);let kt=ce.response.headers.get("Location");dn(kt,"Expected a Location header on the redirect Response");let nt=kt,yt=new URL(ne.url);kt=Mx(kt,yt,f,e.history),Yu(nt,kt,yt,"allow-explicit");let Ce=q0(j.location,kt,{_isRedirect:!0});if(n){let ft=!1;if(ce.response.headers.has("X-Remix-Reload-Document"))ft=!0;else if(dv(kt)){const $e=Y9(t,kt,!0);ft=$e.origin!==t.location.origin||ta($e.pathname,f)==null}if(ft){bt?t.location.replace(kt):t.location.assign(kt);return}}D=null;let xe=bt===!0||ce.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:et,formAction:Ct,formEncType:ke}=j.navigation;!Ve&&!Ie&&et&&Ct&&ke&&(Ve=Dx(j.navigation));let it=Ve||Ie;if(CD.has(ce.response.status)&&it&&is(it.formMethod))await Ue(xe,Ce,{submission:{...it,formAction:kt},preventScrollReset:mt||H,enableViewTransition:de?B:void 0});else{let ft=e8(Ce,[],xe,Ve);await Ue(xe,Ce,{overrideNavigation:ft,fetcherSubmission:Ie,preventScrollReset:mt||H,enableViewTransition:de?B:void 0})}}async function se(ne,ce,de,Ve,Ie){var kt;let mt,bt={};try{mt=await HD(h,ne,ce,de,Ie,Ve,!1)}catch(nt){return de.filter(yt=>yt.shouldLoad).forEach(yt=>{bt[yt.route.id]={type:"error",error:nt}}),bt}if(ne.signal.aborted)return bt;if(!is(ne.method))for(let nt of de){if(((kt=mt[nt.route.id])==null?void 0:kt.type)==="error")break;!mt.hasOwnProperty(nt.route.id)&&!j.loaderData.hasOwnProperty(nt.route.id)&&(!j.errors||!j.errors.hasOwnProperty(nt.route.id))&&nt.shouldCallHandler()&&(mt[nt.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${nt.route.id}`)})}for(let[nt,yt]of Object.entries(mt))if(KD(yt)){let Ce=yt.result;bt[nt]={type:"redirect",response:_D(Ce,ne,nt,de,f)}}else bt[nt]=await FD(yt);return bt}async function Re(ne,ce,de,Ve,Ie){let mt=se(de,Ve,ne,Ie,null),bt=Promise.all(ce.map(async yt=>{if(yt.matches&&yt.match&&yt.request&&yt.controller){let xe=(await se(yt.request,yt.path,yt.matches,Ie,yt.key))[yt.match.route.id];return{[yt.key]:xe}}else return Promise.resolve({[yt.key]:{type:"error",error:va(404,{pathname:yt.path})}})})),kt=await mt,nt=(await bt).reduce((yt,Ce)=>Object.assign(yt,Ce),{});return{loaderResults:kt,fetcherResults:nt}}function _e(){I=!0,Q.forEach((ne,ce)=>{O.has(ce)&&_.add(ce),ot(ce)})}function Ye(ne,ce,de={}){let Ve=new Map(j.fetchers);Ve.set(ne,ce),ue({fetchers:Ve},{flushSync:(de&&de.flushSync)===!0})}function ge(ne,ce,de,Ve={}){let Ie=rl(j.matches,ce),mt=new Map(j.fetchers);wt(mt,ne),ue({errors:{[Ie.route.id]:de},fetchers:mt},{flushSync:(Ve&&Ve.flushSync)===!0})}function Qe(ne){return me.set(ne,(me.get(ne)||0)+1),te.has(ne)&&te.delete(ne),j.fetchers.get(ne)||jD}function at(ne,ce){ot(ne,ce==null?void 0:ce.reason),Ye(ne,ko(null))}function wt(ne,ce){let de=j.fetchers.get(ce);O.has(ce)&&!(de&&de.state==="loading"&&q.has(ce))&&ot(ce),Q.delete(ce),q.delete(ce),Z.delete(ce),te.delete(ce),_.delete(ce),ne.delete(ce)}function Et(ne){let ce=(me.get(ne)||0)-1;ce<=0?(me.delete(ne),te.add(ne)):me.set(ne,ce),ue({fetchers:new Map(j.fetchers)})}function ot(ne,ce){let de=O.get(ne);de&&(de.abort(ce),O.delete(ne))}function It(ne,ce){for(let de of ne){let Ve=ce.get(de);dn(Ve,`Expected fetcher: ${de}`);let Ie=ko(Ve.data);ce.set(de,Ie)}}function Mt(ne){let ce=[],de=!1;for(let Ve of Z){let Ie=ne.get(Ve);dn(Ie,`Expected fetcher: ${Ve}`),Ie.state==="loading"&&(Z.delete(Ve),ce.push(Ve),de=!0)}return It(ce,ne),de}function Zt(ne,ce){let de=[];for(let[Ve,Ie]of q)if(Ie<ne){let mt=ce.get(Ve);dn(mt,`Expected fetcher: ${Ve}`),mt.state==="loading"&&(ot(Ve),q.delete(Ve),de.push(Ve))}return It(de,ce),de.length>0}function Rt(ne,ce){let de=j.blockers.get(ne)||h0;return he.get(ne)!==ce&&he.set(ne,ce),de}function Tt(ne){j.blockers.delete(ne),he.delete(ne)}function Ee(ne,ce){let de=j.blockers.get(ne)||h0;dn(de.state==="unblocked"&&ce.state==="blocked"||de.state==="blocked"&&ce.state==="blocked"||de.state==="blocked"&&ce.state==="proceeding"||de.state==="blocked"&&ce.state==="unblocked"||de.state==="proceeding"&&ce.state==="unblocked",`Invalid blocker state transition: ${de.state} -> ${ce.state}`);let Ve=new Map(j.blockers);Ve.set(ne,ce),ue({blockers:Ve})}function Je({currentLocation:ne,nextLocation:ce,historyAction:de}){if(he.size===0)return;he.size>1&&nr(!1,"A router only supports one blocker at a time");let Ve=Array.from(he.entries()),[Ie,mt]=Ve[Ve.length-1],bt=j.blockers.get(Ie);if(!(bt&&bt.state==="proceeding")&&mt({currentLocation:ne,nextLocation:ce,historyAction:de}))return Ie}function St(ne){let ce=va(404,{pathname:ne}),de=u.activeRoutes,{matches:Ve,route:Ie}=gh(de);return{notFoundMatches:Ve,route:Ie,error:ce}}function qe(ne,ce,de){if(y=ne,k=ce,b=de||null,!S&&j.navigation===Jg){S=!0;let Ve=Xt(j.location,j.matches);Ve!=null&&ue({restoreScrollPosition:Ve})}return()=>{y=null,k=null,b=null}}function st(ne,ce){return b&&b(ne,ce.map(Ve=>X9(Ve,j.loaderData)))||ne.key}function rt(ne,ce){if(y&&k){let de=st(ne,ce);y[de]=k()}}function Xt(ne,ce){if(y){let de=st(ne,ce),Ve=y[de];if(typeof Ve=="number")return Ve}return null}function Gt(ne,ce,de){if(e.patchRoutesOnNavigation){let Ve=u.branches;if(ne){if(Object.keys(ne[0].params).length>0)return{active:!0,matches:za(ce,de,f,!0,Ve)}}else return{active:!0,matches:za(ce,de,f,!0,Ve)||[]}}return{active:!1,matches:null}}async function sn(ne,ce,de,Ve){if(!e.patchRoutesOnNavigation)return{type:"success",matches:ne};let Ie=ne;for(;;){let mt=l;try{await e.patchRoutesOnNavigation({signal:de,path:ce,matches:Ie,fetcherKey:Ve,patch:(yt,Ce)=>{de.aborted||Cx(yt,Ce,u,mt,i,!1)}})}catch(yt){return{type:"error",error:yt,partialMatches:Ie}}if(de.aborted)return{type:"aborted"};let bt=u.branches,kt=za(u.activeRoutes,ce,f,!1,bt),nt=null;if(kt){if(Object.keys(kt[0].params).length===0)return{type:"success",matches:kt};if(nt=za(u.activeRoutes,ce,f,!0,bt),!(nt&&Ie.length<nt.length&&Ut(Ie,nt.slice(0,Ie.length))))return{type:"success",matches:kt}}if(nt||(nt=za(u.activeRoutes,ce,f,!0,bt)),!nt||Ut(Ie,nt))return{type:"success",matches:null};Ie=nt}}function Ut(ne,ce){return ne.length===ce.length&&ne.every((de,Ve)=>de.route.id===ce[Ve].route.id)}function An(ne){l={},u.setHmrRoutes(X0(ne,i,void 0,l))}function Bt(ne,ce,de=!1){Cx(ne,ce,u,l,i,de),u.hasHMRRoutes||ue({})}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:J,subscribe:Me,enableScrollRestoration:qe,navigate:Be,fetch:We,revalidate:vt,createHref:ne=>e.history.createHref(ne),createURL:ne=>e.history.createURL(ne),encodeLocation:ne=>e.history.encodeLocation(ne),getFetcher:Qe,resetFetcher:at,deleteFetcher:Et,dispose:ae,getBlocker:Rt,deleteBlocker:Tt,patchRoutes:Bt,_internalFetchControllers:O,_internalSetRoutes:An,_internalSetStateDoNotUseOrYouWillBreakYourApp(ne){ue(ne)}},e.instrumentations&&(M=gD(M,e.instrumentations.map(ne=>ne.router).filter(Boolean))),M}function RD(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function C6(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=Af(r||".",am(l),ta(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=gv(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),m=p.getAll("index");p.delete("index"),m.filter(w=>w).forEach(w=>p.append("index",w));let g=p.toString();f.search=g?`?${g}`:""}}return n!=="/"&&(f.pathname=cD({basename:n,pathname:f.pathname})),Es(f)}function Sx(e,t,n){if(!n||!RD(n))return{path:t};if(n.formMethod&&!qD(n.formMethod))return{path:t,error:va(405,{method:n.formMethod})};let r=()=>({path:t,error:va(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),l=w7(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!is(i))return r();let m=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((g,[w,y])=>`${g}${w}=${y}
50
+ `,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:l,formEncType:n.formEncType,formData:void 0,json:void 0,text:m}}}else if(n.formEncType==="application/json"){if(!is(i))return r();try{let m=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:m,text:void 0}}}catch{return r()}}}dn(typeof FormData=="function","FormData is not available in this environment");let u,f;if(n.formData)u=N6(n.formData),f=n.formData;else if(n.body instanceof FormData)u=N6(n.body),f=n.body;else if(n.body instanceof URLSearchParams)u=n.body,f=Rx(u);else if(n.body==null)u=new URLSearchParams,f=new FormData;else try{u=new URLSearchParams(n.body),f=Rx(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(is(h.formMethod))return{path:t,submission:h};let p=Io(t);return e&&p.search&&gv(p.search)&&u.append("index",""),p.search=`?${u}`,{path:Es(p),submission:h}}function Ex(e,t,n,r,a,i,l,u,f,h,p,m,g,w,y,b,k,S,E,C,A,L){var U;let T=A?Xs(A[1])?A[1].error:A[1].data:void 0,M=a.createURL(i.location),j=a.createURL(f),R;if(p&&i.errors){let I=Object.keys(i.errors)[0];R=l.findIndex(_=>_.route.id===I)}else if(A&&Xs(A[1])){let I=A[0];R=l.findIndex(_=>_.route.id===I)-1}let P=A?A[1].statusCode:void 0,H=P&&P>=400,D={currentUrl:M,currentParams:((U=i.matches[0])==null?void 0:U.params)||{},nextUrl:j,nextParams:l[0].params,...u,actionResult:T,actionStatus:P},B=Mf(l),V=l.map((I,_)=>{let{route:O}=I,Y=null;if(R!=null&&_>R)Y=!1;else if(O.lazy)Y=!0;else if(!pv(O))Y=!1;else if(p){let{shouldLoad:Q}=d7(O,i.loaderData,i.errors);Y=Q}else PD(i.loaderData,i.matches[_],I)&&(Y=!0);if(Y!==null)return j6(n,r,e,f,B,I,h,t,Y);let z=!1;typeof L=="boolean"?z=L:H?z=!1:(m||M.pathname+M.search===j.pathname+j.search||M.search!==j.search||LD(i.matches[_],I))&&(z=!0);let q={...D,defaultShouldRevalidate:z},Z=F0(I,q);return j6(n,r,e,f,B,I,h,t,Z,q,L)}),K=[];return y.forEach((I,_)=>{if(p||!l.some(te=>te.route.id===I.routeId)||w.has(_))return;let O=i.fetchers.get(_),Y=O&&O.state!=="idle"&&O.data===void 0,z=za(k,I.path,S??"/",!1,C);if(!z){if(E&&Y)return;K.push({key:_,routeId:I.routeId,path:I.path,matches:null,match:null,request:null,controller:null});return}if(b.has(_))return;let q=Yh(z,I.path),Z=new AbortController,Q=Ou(a,I.path,Z.signal),me=null;if(g.has(_))g.delete(_),me=qu(n,r,Q,I.path,z,q,h,t);else if(Y)m&&(me=qu(n,r,Q,I.path,z,q,h,t));else{let te;typeof L=="boolean"?te=L:H?te=!1:te=m;let he={...D,defaultShouldRevalidate:te};F0(q,he)&&(me=qu(n,r,Q,I.path,z,q,h,t,he))}me&&K.push({key:_,routeId:I.routeId,path:I.path,matches:me,match:q,request:Q,controller:Z})}),{dsMatches:V,revalidatingFetchers:K}}function pv(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function d7(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!pv(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 PD(e,t,n){let r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a}function LD(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function F0(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Cx(e,t,n,r,a,i){let l;if(e){let h=r[e];dn(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(m=>f7(h,m));p?f.push({existingRoute:p,newRoute:h}):u.push(h)}),u.length>0){let h=X0(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:m}=f[h],g=p,[w]=X0([m],a,[],{},!0);Object.assign(g,{element:w.element?w.element:g.element,errorElement:w.errorElement?w.errorElement:g.errorElement,hydrateFallbackElement:w.hydrateFallbackElement?w.hydrateFallbackElement:g.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function f7(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=>f7(r,l))}))??!1:!1}var jx=new WeakMap,h7=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let a=n[t.id];if(dn(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let i=a.lazy[e];if(!i)return;let l=jx.get(a);l||(l={},jx.set(a,l));let u=l[e];if(u)return u;let f=(async()=>{let h=YT(e),m=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(m)nr(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let g=await i();g!=null&&(Object.assign(a,{[e]:g}),Object.assign(a,r(a)))}typeof a.lazy=="object"&&(a.lazy[e]=void 0,Object.values(a.lazy).every(g=>g===void 0)&&(a.lazy=void 0))})();return l[e]=f,f},Ax=new WeakMap;function $D(e,t,n,r,a){let i=n[e.id];if(dn(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=Ax.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let m=(async()=>{dn(typeof e.lazy=="function","No lazy route function found");let g=await e.lazy(),w={};for(let y in g){let b=g[y];if(b===void 0)continue;let k=XT(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 Ax.set(i,m),m.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:m}}let l=Object.keys(e.lazy),u=[],f;for(let p of l){if(a&&a.includes(p))continue;let m=h7({key:p,route:e,manifest:n,mapRouteProperties:r});m&&(u.push(m),p===t&&(f=m))}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 Nx(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 TD(e){return e.matches.some(t=>t.route.middleware)?p7(e,()=>Nx(e)):Nx(e)}function p7(e,t){return DD(e,t,r=>{if(YD(r))throw r;return r},UD,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=rl(l,l[u].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function DD(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 m7(l,u,t,n,r,a)}async function m7(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,m,g=async()=>{if(m)throw new Error("You may only call `next()` once per middleware");try{return m={value:await m7(e,t,n,r,a,i,l+1)},m.value}catch(w){return m={value:await i(w,h,m)},m.value}};try{let w=await p(e,g),y=w!=null?r(w):void 0;return a(y)?y:m?y??m.value:(m={value:await g()},m.value)}catch(w){return await i(w,h,m)}}function g7(e,t,n,r,a){let i=h7({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),l=$D(r.route,is(n.method)?"action":"loader",t,e,a);return{middleware:i,route:l.lazyRoutePromise,handler:l.lazyHandlerPromise}}function j6(e,t,n,r,a,i,l,u,f,h=null,p){let m=!1,g=g7(e,t,n,i,l);return{...i,_lazyPromises:g,shouldLoad:f,shouldRevalidateArgs:h,shouldCallHandler(w){return m=!0,h?typeof p=="boolean"?F0(i,{...h,defaultShouldRevalidate:p}):typeof w=="boolean"?F0(i,{...h,defaultShouldRevalidate:w}):F0(i,h):f},resolve(w){let{lazy:y,loader:b,middleware:k}=i.route,S=m||f||w&&!is(n.method)&&(y||b),E=k&&k.length>0&&!b&&!y;return S&&(is(n.method)||!E)?OD({request:n,path:r,pattern:a,match:i,lazyHandlerPromise:g==null?void 0:g.handler,lazyRoutePromise:g==null?void 0:g.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:g7(e,t,n,h,l),resolve:()=>Promise.resolve({type:"data",result:void 0})}:j6(e,t,n,r,Mf(a),h,l,u,!0,f))}async function HD(e,t,n,r,a,i,l){r.some(p=>{var m;return(m=p._lazyPromises)==null?void 0:m.middleware})&&await Promise.all(r.map(p=>{var m;return(m=p._lazyPromises)==null?void 0:m.middleware}));let u={request:t,url:v7(t,n),pattern:Mf(r),params:r[0].params,context:i,matches:r},h=await e({...u,fetcherKey:a,runClientMiddleware:p=>{let m=u;return p7(m,()=>p({...m,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(p=>{var m,g;return[(m=p._lazyPromises)==null?void 0:m.handler,(g=p._lazyPromises)==null?void 0:g.route]}))}catch{}return h}async function OD({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:i,handlerOverride:l,scopedContext:u}){let f,h,p=is(e.method),m=p?"action":"loader",g=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 "${m}" [routeId: ${r.route.id}]`)):w({request:e,url:v7(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([g(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([g(y),i]);else if(m==="action"){let b=new URL(e.url),k=b.pathname+b.search;throw va(405,{method:e.method,pathname:k,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(w)f=await g(w);else{let y=new URL(e.url),b=y.pathname+y.search;throw va(404,{pathname:b})}}catch(w){return{type:"error",result:w}}finally{h&&e.signal.removeEventListener("abort",h)}return f}async function ID(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 FD(e){var r,a,i,l,u;let{result:t,type:n}=e;if(mv(t)){let f;try{f=await ID(t)}catch(h){return{type:"error",error:h}}return n==="error"?{type:"error",error:new Nf(t.status,t.statusText,f),statusCode:t.status,headers:t.headers}:{type:"data",data:f,statusCode:t.status,headers:t.headers}}return n==="error"?Tx(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:BD(t),statusCode:Q0(t)?t.status:void 0,headers:(i=t.init)!=null&&i.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:Q0(t)?t.status:void 0}:Tx(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 _D(e,t,n,r,a){let i=e.headers.get("Location");if(dn(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!dv(i)){let l=r.slice(0,r.findIndex(u=>u.route.id===n)+1);i=C6(new URL(t.url),l,a,i),e.headers.set("Location",i)}return e}var VD=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function A6(e){try{return VD.includes(new URL(e).protocol)}catch{return!1}}function Mx(e,t,n,r){if(dv(e)){let a=e,i=sm.test(a)?new URL(G9(a,t.protocol)):new URL(a);if(A6(i.toString()))throw new Error("Invalid redirect location");let l=ta(i.pathname,n)!=null;if(i.origin===t.origin&&l)return fv(i.pathname)+i.search+i.hash}try{let a=r.createURL(e);if(A6(a.toString()))throw new Error("Invalid redirect location")}catch{}return e}function Ou(e,t,n,r){let a=e.createURL(w7(t)).toString(),i={signal:n};if(r&&is(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=N6(r.formData):i.body=r.formData}return new Request(a,i)}function v7(e,t){let n=new URL(e.url),r=typeof t=="string"?Io(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 N6(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Rx(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function ZD(e,t,n,r=!1,a=!1){let i={},l=null,u,f=!1,h={},p=n&&Xs(n[1])?n[1].error:void 0;return e.forEach(m=>{if(!(m.route.id in t))return;let g=m.route.id,w=t[g];if(dn(!vc(w),"Cannot handle redirect results in processLoaderData"),Xs(w)){let y=w.error;if(p!==void 0&&(y=p,p=void 0),l=l||{},a)l[g]=y;else{let b=rl(e,g);l[b.route.id]==null&&(l[b.route.id]=y)}r||(i[g]=u7),f||(f=!0,u=Q0(w.error)?w.error.status:500),w.headers&&(h[g]=w.headers)}else i[g]=w.data,w.statusCode&&w.statusCode!==200&&!f&&(u=w.statusCode),w.headers&&(h[g]=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 Px(e,t,n,r,a,i,l){let{loaderData:u,errors:f}=ZD(t,n,r);return a.filter(h=>!h.matches||h.matches.some(p=>p.shouldLoad)).forEach(h=>{let{key:p,match:m,controller:g}=h;if(g&&g.signal.aborted)return;let w=i[p];if(dn(w,"Did not find corresponding fetcher result"),Xs(w)){let y=rl(e.matches,m==null?void 0:m.route.id);f&&f[y.route.id]||(f={...f,[y.route.id]:w.error}),l.delete(p)}else if(vc(w))dn(!1,"Unhandled fetcher revalidation redirect");else{let y=ko(w.data);l.set(p,y)}}),{loaderData:u,errors:f}}function Lx(e,t,n,r){let a=Object.entries(t).filter(([,i])=>i!==u7).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 $x(e){return e?Xs(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function rl(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 gh(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 va(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 Nf(e||500,l,new Error(u),!0)}function vh(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(vc(a))return{key:r,result:a}}}function w7(e){let t=typeof e=="string"?Io(e):e;return Es({...t,hash:""})}function zD(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function BD(e){var t,n;return new Nf(((t=e.init)==null?void 0:t.status)??500,((n=e.init)==null?void 0:n.statusText)??"Internal Server Error",e.data)}function UD(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&WD(n))}function WD(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function KD(e){return mv(e.result)&&l7.has(e.result.status)}function Xs(e){return e.type==="error"}function vc(e){return(e&&e.type)==="redirect"}function Tx(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function mv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function GD(e){return l7.has(e)}function YD(e){return mv(e)&&GD(e.status)&&e.headers.has("Location")}function qD(e){return ED.has(e.toUpperCase())}function is(e){return kD.has(e.toUpperCase())}function gv(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Yh(e,t){let n=typeof t=="string"?Io(t).search:t.search;if(e[e.length-1].route.index&&gv(n||""))return e[e.length-1];let r=r7(e);return r[r.length-1]}function Dx(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 e8(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 XD(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 p0(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 QD(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 ko(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 JD(e,t){try{let n=e.sessionStorage.getItem(c7);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 eH(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(c7,JSON.stringify(n))}catch(r){nr(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function Hx(){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 Ic=s.createContext(null);Ic.displayName="DataRouter";var Ed=s.createContext(null);Ed.displayName="DataRouterState";var y7=s.createContext(!1);function b7(){return s.useContext(y7)}var vv=s.createContext({isTransitioning:!1});vv.displayName="ViewTransition";var x7=s.createContext(new Map);x7.displayName="Fetchers";var tH=s.createContext(null);tH.displayName="Await";var Rs=s.createContext(null);Rs.displayName="Navigation";var om=s.createContext(null);om.displayName="Location";var Ma=s.createContext({outlet:null,matches:[],isDataRoute:!1});Ma.displayName="Route";var wv=s.createContext(null);wv.displayName="RouteError";var k7="REACT_ROUTER_ERROR",nH="REDIRECT",rH="ROUTE_ERROR_RESPONSE";function sH(e){if(e.startsWith(`${k7}:${nH}:{`))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 aH(e){if(e.startsWith(`${k7}:${rH}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Nf(t.status,t.statusText,t.data)}catch{}}function oH(e,{relative:t}={}){dn(Fc(),"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}=Rf(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:Ea([n,i])),r.createHref({pathname:u,search:l,hash:a})}function Fc(){return s.useContext(om)!=null}function Un(){return dn(Fc(),"useLocation() may be used only in the context of a <Router> component."),s.useContext(om).location}function pn(e){dn(Fc(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Un();return s.useMemo(()=>vl(e,n7(t)),[t,e])}var S7="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function E7(e){s.useContext(Rs).static||s.useLayoutEffect(e)}function Bn(){let{isDataRoute:e}=s.useContext(Ma);return e?bH():iH()}function iH(){dn(Fc(),"useNavigate() may be used only in the context of a <Router> component.");let e=s.useContext(Ic),{basename:t,navigator:n}=s.useContext(Rs),{matches:r}=s.useContext(Ma),{pathname:a}=Un(),i=JSON.stringify(am(r)),l=s.useRef(!1);return E7(()=>{l.current=!0}),s.useCallback((f,h={})=>{if(nr(l.current,S7),!l.current)return;if(typeof f=="number"){n.go(f);return}let p=Af(f,JSON.parse(i),a,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Ea([t,p.pathname])),Yu(typeof f=="string"?f:Es(f),n.createHref(p),hv(n),"reject"),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,i,a,e])}var C7=s.createContext(null);function lH(){return s.useContext(C7)}function cH(e){let t=s.useContext(Ma).outlet;return s.useMemo(()=>t&&s.createElement(C7.Provider,{value:e},t),[t,e])}function na(){let{matches:e}=s.useContext(Ma),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Rf(e,{relative:t}={}){let{matches:n}=s.useContext(Ma),{pathname:r}=Un(),a=JSON.stringify(am(n));return s.useMemo(()=>Af(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function uH(e,t,n){dn(Fc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=s.useContext(Rs),{matches:a}=s.useContext(Ma),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||"";M7(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(),m;m=p;let g=m.pathname||"/",w=g;if(f!=="/"){let k=f.replace(/^\//,"").split("/");w="/"+g.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})):q9(e,{pathname:w});return nr(h||y!=null,`No routes matched location "${m.pathname}${m.search}${m.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 "${m.pathname}${m.search}${m.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.`),mH(y&&y.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Ea([f,r.encodeLocation?r.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:Ea([f,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n)}function dH(){let e=N7(),t=Q0(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 fH=s.createElement(dH,null),j7=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=aH(e.digest);n&&(e=n)}let t=e!==void 0?s.createElement(Ma.Provider,{value:this.props.routeContext},s.createElement(wv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?s.createElement(hH,{error:e},t):t}};j7.contextType=y7;var t8=new WeakMap;function hH({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=sH(t.digest);if(a){let i=t8.get(t);if(i)throw i;let l=a7(a.location,n),u=l.absoluteURL||l.to;if(Yu(a.location,u,hv(r),"allow-explicit"),A6(u))throw new Error("Invalid redirect location");if(s7&&!t8.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 t8.set(t,f),f}return s.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function pH({routeContext:e,match:t,children:n}){let r=s.useContext(Ic);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),s.createElement(Ma.Provider,{value:e},n)}function mH(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(m=>m.route.id&&(i==null?void 0:i[m.route.id])!==void 0);dn(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 m=a[p];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(u=p),m.route.id){let{loaderData:g,errors:w}=r,y=m.route.loader&&!g.hasOwnProperty(m.route.id)&&(!w||w[m.route.id]===void 0);if(m.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,m)=>{var g,w;f(p,{location:r.location,params:((w=(g=r.matches)==null?void 0:g[0])==null?void 0:w.params)??{},pattern:Mf(r.matches),errorInfo:m})}:void 0;return a.reduceRight((p,m,g)=>{let w,y=!1,b=null,k=null;r&&(w=i&&m.route.id?i[m.route.id]:void 0,b=m.route.errorElement||fH,l&&(u<0&&g===0?(M7("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,k=null):u===g&&(y=!0,k=m.route.hydrateFallbackElement||null)));let S=t.concat(a.slice(0,g+1)),E=()=>{let C;return w?C=b:y?C=k:m.route.Component?C=s.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=p,s.createElement(pH,{match:m,routeContext:{outlet:p,matches:S,isDataRoute:r!=null},children:C})};return r&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?s.createElement(j7,{location:r.location,revalidation:r.revalidation,component:b,error:w,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):E()},null)}function yv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gH(e){let t=s.useContext(Ic);return dn(t,yv(e)),t}function bv(e){let t=s.useContext(Ed);return dn(t,yv(e)),t}function vH(e){let t=s.useContext(Ma);return dn(t,yv(e)),t}function xv(e){let t=vH(e),n=t.matches[t.matches.length-1];return dn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function wH(){return xv("useRouteId")}function yH(){let e=bv("useNavigation");return s.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function A7(){let{matches:e,loaderData:t}=bv("useMatches");return s.useMemo(()=>e.map(n=>X9(n,t)),[e,t])}function N7(){var r;let e=s.useContext(wv),t=bv("useRouteError"),n=xv("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function bH(){let{router:e}=gH("useNavigate"),t=xv("useNavigate"),n=s.useRef(!1);return E7(()=>{n.current=!0}),s.useCallback(async(a,i={})=>{nr(n.current,S7),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var Ox={};function M7(e,t,n){!t&&!Ox[e]&&(Ox[e]=!0,nr(!1,n))}var Ix={};function Fx(e,t){!e&&!Ix[t]&&(Ix[t]=!0,console.warn(t))}var xH="useOptimistic",_x=Oc[xH],kH=()=>{};function SH(e){return _x?_x(e):[e,kH]}function EH(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 CH=["HydrateFallback","hydrateFallbackElement"],jH=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 AH({router:e,flushSync:t,onError:n,useTransitions:r}){r=b7()||r;let[i,l]=s.useState(e.state),[u,f]=SH(i),[h,p]=s.useState(),[m,g]=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:R,newErrors:P,flushSync:H,viewTransitionOpts:D})=>{P&&n&&Object.values(P).forEach(V=>{var K;return n(V,{location:j.location,params:((K=j.matches[0])==null?void 0:K.params)??{},pattern:Mf(j.matches)})}),j.fetchers.forEach((V,K)=>{V.data!==void 0&&C.current.set(K,V.data)}),R.forEach(V=>C.current.delete(V)),Fx(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(Fx(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=>Vx(V,j)),l(j)});return}if(t&&H){t(()=>{b&&(w==null||w.resolve(),b.skipTransition()),g({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),g({isTransitioning:!1})})}),t(()=>k(V));return}b?(w==null||w.resolve(),b.skipTransition(),E({state:j,currentLocation:D.currentLocation,nextLocation:D.nextLocation})):(p(j),g({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(()=>{m.isTransitioning&&!m.flushSync&&y(new jH)},[m]),s.useEffect(()=>{if(w&&h&&e.window){let j=h,R=w.promise,P=e.window.document.startViewTransition(async()=>{r===!1?l(j):s.startTransition(()=>{r===!0&&f(H=>Vx(H,j)),l(j)}),await R});P.finished.finally(()=>{y(void 0),k(void 0),p(void 0),g({isTransitioning:!1})}),k(P)}},[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(()=>{!m.isTransitioning&&S&&(p(S.state),g({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),E(void 0))},[m.isTransitioning,S]);let L=s.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:j=>e.navigate(j),push:(j,R,P)=>e.navigate(j,{state:R,preventScrollReset:P==null?void 0:P.preventScrollReset}),replace:(j,R,P)=>e.navigate(j,{replace:!0,state:R,preventScrollReset:P==null?void 0:P.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(Ic.Provider,{value:M},s.createElement(Ed.Provider,{value:u},s.createElement(x7.Provider,{value:C.current},s.createElement(vv.Provider,{value:m},s.createElement(RH,{basename:T,location:u.location,navigationType:u.historyAction,navigator:L,useTransitions:r},s.createElement(NH,{routes:e.routes,manifest:e.manifest,future:e.future,state:u,isStatic:!1,onError:n})))))),null)}function Vx(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 NH=s.memo(MH);function MH({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:i}){return uH(e,void 0,{manifest:t,state:r,isStatic:a,onError:i})}function Xa({to:e,replace:t,state:n,relative:r}){dn(Fc(),"<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(Ma),{pathname:u}=Un(),f=Bn(),h=Af(e,am(l),u,r==="path");Yu(typeof e=="string"?e:Es(e),i.createHref(h),hv(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 _c(e){return cH(e.context)}function RH({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,useTransitions:l}){dn(!Fc(),"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=Io(n));let{pathname:h="/",search:p="",hash:m="",state:g=null,key:w="default",mask:y}=n,b=s.useMemo(()=>{let k=ta(h,u);return k==null?null:{location:{pathname:k,search:p,hash:m,state:g,key:w,mask:y},navigationType:r}},[u,h,p,m,g,w,r,y]);return nr(b!=null,`<Router basename="${u}"> is not able to match the URL "${h}${p}${m}" 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(om.Provider,{children:t,value:b}))}var qh="get",Xh="application/x-www-form-urlencoded";function im(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function PH(e){return im(e)&&e.tagName.toLowerCase()==="button"}function LH(e){return im(e)&&e.tagName.toLowerCase()==="form"}function $H(e){return im(e)&&e.tagName.toLowerCase()==="input"}function TH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function DH(e,t){return e.button===0&&(!t||t==="_self")&&!TH(e)}function M6(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 HH(e,t){let n=M6(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}var wh=null;function OH(){if(wh===null)try{new FormData(document.createElement("form"),0),wh=!1}catch{wh=!0}return wh}var IH=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function n8(e){return e!=null&&!IH.has(e)?(nr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Xh}"`),null):e}function FH(e,t){let n,r,a,i,l;if(LH(e)){let u=e.getAttribute("action");r=u?ta(u,t):null,n=e.getAttribute("method")||qh,a=n8(e.getAttribute("enctype"))||Xh,i=new FormData(e)}else if(PH(e)||$H(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?ta(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||qh,a=n8(e.getAttribute("formenctype"))||n8(u.getAttribute("enctype"))||Xh,i=new FormData(u,e),!OH()){let{name:h,type:p,value:m}=e;if(p==="image"){let g=h?`${h}.`:"";i.append(`${g}x`,"0"),i.append(`${g}y`,"0")}else h&&i.append(h,m)}}else{if(im(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=qh,r=null,a=Xh,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 _H={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},VH=/[&><\u2028\u2029]/g;function Zx(e){return e.replace(VH,t=>_H[t])}function kv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function R7(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&&ta(a.pathname,t)==="/"?a.pathname=`${dd(t)}/_root.${r}`:a.pathname=`${dd(a.pathname)}.${r}`,a}async function ZH(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 zH(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 BH(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let l=await ZH(i,n);return l.links?l.links():[]}return[]}));return GH(r.flat(1).filter(zH).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function zx(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 m;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 g=f.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function UH(e,t,{includeHydrateFallback:n}={}){return WH(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 WH(e){return[...new Set(e)]}function KH(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function GH(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(KH(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function Sv(){let e=s.useContext(Ic);return kv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function YH(){let e=s.useContext(Ed);return kv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var lm=s.createContext(void 0);lm.displayName="FrameworkContext";function cm(){let e=s.useContext(lm);return kv(e,"You must render this element inside a <HydratedRouter> element"),e}function qH(e,t){let n=s.useContext(lm),[r,a]=s.useState(!1),[i,l]=s.useState(!1),{onFocus:u,onBlur:f,onMouseEnter:h,onMouseLeave:p,onTouchStart:m}=t,g=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 g.current&&k.observe(g.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,g,{}]:[i,g,{onFocus:m0(u,w),onBlur:m0(f,y),onMouseEnter:m0(h,w),onMouseLeave:m0(p,y),onTouchStart:m0(m,w)}]:[!1,g,{}]}function m0(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function XH({page:e,...t}){let n=b7(),{nonce:r}=cm(),{router:a}=Sv(),i=s.useMemo(()=>q9(a.routes,e,a.basename),[a.routes,e,a.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?s.createElement(JH,{page:e,matches:i,...t}):s.createElement(eO,{page:e,matches:i,...t})):null}function QH(e){let{manifest:t,routeModules:n}=cm(),[r,a]=s.useState([]);return s.useEffect(()=>{let i=!1;return BH(e,t,n).then(l=>{i||a(l)}),()=>{i=!0}},[e,t,n]),r}function JH({page:e,matches:t,...n}){let r=Un(),{future:a}=cm(),{basename:i}=Sv(),l=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let u=R7(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 eO({page:e,matches:t,...n}){let r=Un(),{future:a,manifest:i,routeModules:l}=cm(),{basename:u}=Sv(),{loaderData:f,matches:h}=YH(),p=s.useMemo(()=>zx(e,t,h,i,r,"data"),[e,t,h,i,r]),m=s.useMemo(()=>zx(e,t,h,i,r,"assets"),[e,t,h,i,r]),g=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=R7(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(()=>UH(m,i),[m,i]),y=QH(m);return s.createElement(s.Fragment,null,g.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 tO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var nO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{nO&&(window.__reactRouterVersion="7.18.3")}catch{}function rO(e,t){return MD({basename:t==null?void 0:t.basename,getContext:t==null?void 0:t.getContext,future:t==null?void 0:t.future,history:UT({window:t==null?void 0:t.window}),hydrationData:sO(),routes:e,mapRouteProperties:EH,hydrationRouteProperties:CH,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 sO(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:aO(e.errors)}),e}function aO(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 Nf(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(typeof a.__subType=="string"&&pD.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 Zn=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:m,viewTransition:g,defaultShouldRevalidate:w,...y},b){let{basename:k,navigator:S,useTransitions:E}=s.useContext(Rs),C=typeof p=="string"&&rm.test(p),A=a7(p,k);p=A.to;let L=oH(p,{relative:a}),T=Un(),M=null;if(u){let K=Af(u,[],T.mask?T.mask.pathname:"/",!0);k!=="/"&&(K.pathname=K.pathname==="/"?k:Ea([k,K.pathname])),M=S.createHref(K)}let[j,R,P]=qH(r,y),H=cO(p,{replace:l,mask:u,state:f,target:h,preventScrollReset:m,relative:a,viewTransition:g,defaultShouldRevalidate:w,useTransitions:E});function D(K){t&&t(K),K.defaultPrevented||H(K)}let B=!(A.isExternal||i),V=s.createElement("a",{...y,...P,href:(B?M:void 0)||A.absoluteURL||L,onClick:B?D:t,ref:tO(b,R),target:h,"data-discover":!C&&n==="render"?"true":void 0});return j&&!C?s.createElement(s.Fragment,null,V,s.createElement(XH,{page:L})):V});Zn.displayName="Link";var oO=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 m=Rf(l,{relative:h.relative}),g=Un(),w=s.useContext(Ed),{navigator:y,basename:b}=s.useContext(Rs),k=w!=null&&gO(m)&&u===!0,S=y.encodeLocation?y.encodeLocation(m).pathname:m.pathname,E=g.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=ta(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,R;typeof r=="function"?R=r(M):R=[r,L?"active":null,T?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let P=typeof i=="function"?i(M):i;return s.createElement(Zn,{...h,"aria-current":j,className:R,ref:p,style:P,to:l,viewTransition:u},typeof f=="function"?f(M):f)});oO.displayName="NavLink";var iO=s.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:l=qh,action:u,onSubmit:f,relative:h,preventScrollReset:p,viewTransition:m,defaultShouldRevalidate:g,...w},y)=>{let{useTransitions:b}=s.useContext(Rs),k=fO(),S=hO(u,{relative:h}),E=l.toLowerCase()==="get"?"get":"post",C=typeof u=="string"&&rm.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:m,defaultShouldRevalidate:g});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})});iO.displayName="Form";function P7({getKey:e,storageKey:t,...n}){let r=s.useContext(lm),{basename:a}=s.useContext(Rs),i=Un(),l=A7();pO({getKey:e,storageKey:t});let u=s.useMemo(()=>{if(!r||!e)return null;let h=P6(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 m=Math.random().toString(32).slice(2);window.history.replaceState({key:m},"")}try{let g=JSON.parse(sessionStorage.getItem(h)||"{}")[p||window.history.state.key];typeof g=="number"&&window.scrollTo(0,g)}catch(m){console.error(m),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})(${Zx(JSON.stringify(t||R6))}, ${Zx(JSON.stringify(u))})`}})}P7.displayName="ScrollRestoration";function L7(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ev(e){let t=s.useContext(Ic);return dn(t,L7(e)),t}function lO(e){let t=s.useContext(Ed);return dn(t,L7(e)),t}function cO(e,{target:t,replace:n,mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:u,defaultShouldRevalidate:f,useTransitions:h}={}){let p=Bn(),m=Un(),g=Rf(e,{relative:l});return s.useCallback(w=>{if(DH(w,t)){w.preventDefault();let y=n!==void 0?n:Es(m)===Es(g),b=()=>p(e,{replace:y,mask:r,state:a,preventScrollReset:i,relative:l,viewTransition:u,defaultShouldRevalidate:f});h?s.startTransition(()=>b()):b()}},[m,p,g,n,r,a,t,e,i,l,u,f,h])}function El(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(M6(e)),n=s.useRef(!1),r=Un(),a=s.useMemo(()=>HH(r.search,n.current?null:t.current),[r.search]),i=Bn(),l=s.useCallback((u,f)=>{const h=M6(typeof u=="function"?u(new URLSearchParams(a)):u);n.current=!0,i("?"+h,f)},[i,a]);return[a,l]}var uO=0,dO=()=>`__${String(++uO)}__`;function fO(){let{router:e}=Ev("useSubmit"),{basename:t}=s.useContext(Rs),n=wH(),r=e.fetch,a=e.navigate;return s.useCallback(async(i,l={})=>{let{action:u,method:f,encType:h,formData:p,body:m}=FH(i,t);if(l.navigate===!1){let g=l.fetcherKey||dO();await r(g,n,l.action||u,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:p,body:m,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:m,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 hO(e,{relative:t}={}){let{basename:n}=s.useContext(Rs),r=s.useContext(Ma);dn(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...Rf(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(m=>m).forEach(m=>u.append("index",m));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:Ea([n,i.pathname])),Es(i)}var R6="react-router-scroll-positions",yh={};function P6(e,t,n,r){let a=null;return r&&(n!=="/"?a=r({...e,pathname:ta(e.pathname,n)||e.pathname},t):a=r(e,t)),a==null&&(a=e.key),a}function pO({getKey:e,storageKey:t}={}){let{router:n}=Ev("useScrollRestoration"),{restoreScrollPosition:r,preventScrollReset:a}=lO("useScrollRestoration"),{basename:i}=s.useContext(Rs),l=Un(),u=A7(),f=yH();s.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),mO(s.useCallback(()=>{if(f.state==="idle"){let h=P6(l,u,i,e);yh[h]=window.scrollY}try{sessionStorage.setItem(t||R6,JSON.stringify(yh))}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||R6);h&&(yh=JSON.parse(h))}catch{}},[t]),s.useLayoutEffect(()=>{let h=n==null?void 0:n.enableScrollRestoration(yh,()=>window.scrollY,e?(p,m)=>P6(p,m,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 mO(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 gO(e,{relative:t}={}){let n=s.useContext(vv);dn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ev("useViewTransitionState"),a=Rf(e,{relative:t});if(!n.isTransitioning)return!1;let i=ta(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=ta(n.nextLocation.pathname,r)||n.nextLocation.pathname;return vl(a.pathname,l)!=null||vl(a.pathname,i)!=null}const vO=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"}))]]),wO=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"}))]]),yO=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"}))]]),bO=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"}))]]),xO=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"}))]]),kO=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"}))]]),SO=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"}))]]),EO=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"}))]]),CO=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"}))]]),jO=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"}))]]),AO=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"}))]]),NO=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"}))]]),MO=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"}))]]),RO=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"}))]]),PO=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"}))]]),LO=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"}))]]),$O=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"}))]]),TO=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"}))]]),DO=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"}))]]),HO=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"}))]]),OO=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"}))]]),IO=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"}))]]),FO=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"}))]]),_O=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"}))]]),VO=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"}))]]),ZO=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"}))]]),zO=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"}))]]),BO=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"}))]]),UO=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"}))]]),WO=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"}))]]),KO=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"}))]]),GO=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"}))]]),YO=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"}))]]),qO=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"}))]]),XO=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"}))]]),QO=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"}))]]),JO=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"}))]]),eI=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"}))]]),tI=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"}))]]),nI=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"}))]]),rI=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"}))]]),sI=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"}))]]),aI=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"}))]]),oI=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"}))]]),iI=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"}))]]),lI=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"}))]]),cI=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"}))]]),uI=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"}))]]),dI=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"}))]]),fI=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"}))]]),hI=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"}))]]),pI=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"}))]]),mI=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"}))]]),gI=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"}))]]),vI=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"}))]]),wI=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"}))]]),yI=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"}))]]),bI=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"}))]]),xI=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"}))]]),kI=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"}))]]),SI=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"}))]]),EI=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"}))]]),CI=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"}))]]),jI=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"}))]]),AI=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"}))]]),NI=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"}))]]),MI=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"}))]]),RI=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"}))]]),PI=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"}))]]),LI=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"}))]]),$I=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"}))]]),TI=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"}))]]),DI=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"}))]]),HI=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"}))]]),OI=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}),Nt=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:m,weight:g="regular",mirrored:w=!1,...y}=s.useContext($7);return s.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:a??m,height:a??m,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??g))});Nt.displayName="IconBase";const T7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:vO}));T7.displayName="ApertureIcon";const D7=T7,H7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:wO}));H7.displayName="ArchiveIcon";const um=H7,O7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:yO}));O7.displayName="ArrowCircleUpIcon";const I7=O7,F7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:bO}));F7.displayName="ArrowClockwiseIcon";const _7=F7,V7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:xO}));V7.displayName="ArrowCounterClockwiseIcon";const J0=V7,Z7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:kO}));Z7.displayName="ArrowLeftIcon";const Cv=Z7,z7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:SO}));z7.displayName="ArrowLineUpIcon";const II=z7,B7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:EO}));B7.displayName="ArrowRightIcon";const wa=B7,U7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:CO}));U7.displayName="ArrowSquareOutIcon";const Cc=U7,W7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:jO}));W7.displayName="ArrowUpIcon";const K7=W7,G7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:AO}));G7.displayName="ArrowsClockwiseIcon";const hp=G7,Y7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:NO}));Y7.displayName="ArrowsDownUpIcon";const FI=Y7,q7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:MO}));q7.displayName="ArrowsOutSimpleIcon";const _I=q7,X7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:RO}));X7.displayName="BellIcon";const r8=X7,Q7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:PO}));Q7.displayName="CaretDownIcon";const wl=Q7,J7=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:LO}));J7.displayName="CaretLeftIcon";const Ra=J7,eE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:$O}));eE.displayName="CaretRightIcon";const Cl=eE,tE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:TO}));tE.displayName="CaretUpIcon";const VI=tE,nE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:DO}));nE.displayName="ChartBarIcon";const ZI=nE,rE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:HO}));rE.displayName="CheckIcon";const Kn=rE,sE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:OO}));sE.displayName="CircleIcon";const zI=sE,aE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:IO}));aE.displayName="CircleHalfIcon";const BI=aE,oE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:FO}));oE.displayName="CopyIcon";const pp=oE,iE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:_O}));iE.displayName="CopySimpleIcon";const Bx=iE,lE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:VO}));lE.displayName="DeviceMobileIcon";const UI=lE,cE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:ZO}));cE.displayName="DotsThreeIcon";const jv=cE,uE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:zO}));uE.displayName="DotsThreeVerticalIcon";const Av=uE,dE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:BO}));dE.displayName="DownloadSimpleIcon";const fE=dE,hE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:UO}));hE.displayName="FilmSlateIcon";const dm=hE,pE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:WO}));pE.displayName="FolderSimpleIcon";const Nv=pE,mE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:KO}));mE.displayName="FolderSimpleMinusIcon";const gE=mE,vE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:GO}));vE.displayName="FrameCornersIcon";const wE=vE,yE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:YO}));yE.displayName="GearSixIcon";const WI=yE,bE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:qO}));bE.displayName="GiftIcon";const KI=bE,xE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:XO}));xE.displayName="GithubLogoIcon";const GI=xE,kE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:QO}));kE.displayName="GraduationCapIcon";const YI=kE,SE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:JO}));SE.displayName="HandWavingIcon";const qI=SE,EE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:eI}));EE.displayName="HouseIcon";const XI=EE,CE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:tI}));CE.displayName="IdentificationBadgeIcon";const fm=CE,jE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:nI}));jE.displayName="ImageIcon";const QI=jE,AE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:rI}));AE.displayName="ImageSquareIcon";const Pa=AE,NE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:sI}));NE.displayName="InfinityIcon";const ME=NE,RE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:aI}));RE.displayName="InfoIcon";const hm=RE,PE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:oI}));PE.displayName="KeyIcon";const LE=PE,$E=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:iI}));$E.displayName="KeyboardIcon";const JI=$E,TE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:lI}));TE.displayName="LightningIcon";const ef=TE,DE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:cI}));DE.displayName="MagnifyingGlassIcon";const fd=DE,HE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:uI}));HE.displayName="MegaphoneIcon";const eF=HE,OE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:dI}));OE.displayName="MinusIcon";const tF=OE,IE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:fI}));IE.displayName="MountainsIcon";const nF=IE,FE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:hI}));FE.displayName="PackageIcon";const pm=FE,_E=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:pI}));_E.displayName="PaletteIcon";const rF=_E,VE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:mI}));VE.displayName="PaperclipIcon";const sF=VE,ZE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:gI}));ZE.displayName="PencilSimpleIcon";const Cd=ZE,zE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:vI}));zE.displayName="PencilSimpleLineIcon";const aF=zE,BE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:wI}));BE.displayName="PlusIcon";const mr=BE,UE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:yI}));UE.displayName="PlusCircleIcon";const oF=UE,WE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:bI}));WE.displayName="PowerIcon";const iF=WE,KE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:xI}));KE.displayName="QuestionIcon";const lF=KE,GE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:kI}));GE.displayName="SidebarSimpleIcon";const cF=GE,YE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:SI}));YE.displayName="SlidersHorizontalIcon";const Mv=YE,qE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:EI}));qE.displayName="StackIcon";const XE=qE,QE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:CI}));QE.displayName="StarIcon";const Qa=QE,JE=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:jI}));JE.displayName="StorefrontIcon";const eC=JE,tC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:AI}));tC.displayName="SunHorizonIcon";const nC=tC,rC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:NI}));rC.displayName="TrashIcon";const jl=rC,sC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:MI}));sC.displayName="TrashSimpleIcon";const mm=sC,aC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:RI}));aC.displayName="UploadSimpleIcon";const Rv=aC,oC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:PI}));oC.displayName="UserIcon";const uF=oC,iC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:LI}));iC.displayName="UserCircleIcon";const dF=iC,lC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:$I}));lC.displayName="UserPlusIcon";const fF=lC,cC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:TI}));cC.displayName="WarningIcon";const gm=cC,uC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:DI}));uC.displayName="WarningCircleIcon";const Vc=uC,dC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:HI}));dC.displayName="XIcon";const Cn=dC,fC=s.forwardRef((e,t)=>s.createElement(Nt,{ref:t,...e,weights:OI}));fC.displayName="XCircleIcon";const hF=fC;var Br=U9(),pF=Object.defineProperty,Pv=(e,t)=>pF(e,"name",{value:t,configurable:!0});function L6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Pv(L6,"setRef");function hC(...e){return t=>{let n=!1;const r=e.map(a=>{const i=L6(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():L6(e[a],null)}}}}Pv(hC,"composeRefs");function fn(...e){return s.useCallback(hC(...e),e)}Pv(fn,"useComposedRefs");var mF=Object.defineProperty,ro=(e,t)=>mF(e,"name",{value:t,configurable:!0});function Ja(e){const t=s.forwardRef((n,r)=>{let{children:a,...i}=n,l=null,u=!1;const f=[];$6(a)&&typeof bh=="function"&&(a=bh(a._payload)),s.Children.forEach(a,g=>{var w;if(vC(g)){u=!0;const y=g;let b="child"in y.props?y.props.child:y.props.children;$6(b)&&typeof bh=="function"&&(b=bh(b._payload)),l=gF(y,b),f.push((w=l==null?void 0:l.props)==null?void 0:w.children)}else f.push(g)}),l?l=s.cloneElement(l,void 0,f):!u&&s.Children.count(a)===1&&s.isValidElement(a)&&(l=a);const h=l?gC(l):void 0,p=fn(r,h);if(!l){if(a||a===0)throw new Error(u?yF(e):wF(e));return a}const m=mC(i,l.props??{});return l.type!==s.Fragment&&(m.ref=r?p:h),s.cloneElement(l,m)});return t.displayName=`${e}.Slot`,t}ro(Ja,"createSlot");var Zc=Ja("Slot"),pC=Symbol.for("radix.slottable");function Lv(e){const t=ro(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=pC,t}ro(Lv,"createSlottable");var vm=Lv("Slottable"),gF=ro((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 mC(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}}ro(mC,"mergeProps");function gC(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)}ro(gC,"getElementRef");function vC(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pC}ro(vC,"isSlottable");var vF=Symbol.for("react.lazy");function $6(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===vF&&"_payload"in e&&wC(e._payload)}ro($6,"isLazyComponent");function wC(e){return typeof e=="object"&&e!==null&&"then"in e}ro(wC,"isPromiseLike");var wF=ro(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),yF=ro(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),bh=Oc[" use ".trim().toString()],bF=Object.defineProperty,xF=(e,t)=>bF(e,"name",{value:t,configurable:!0}),kF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gn=kF.reduce((e,t)=>{const n=Ja(`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 $v(e,t){e&&Br.flushSync(()=>e.dispatchEvent(t))}xF($v,"dispatchDiscreteCustomEvent");var SF=Object.defineProperty,EF=(e,t)=>SF(e,"name",{value:t,configurable:!0}),yC=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"}),CF=s.forwardRef(EF(function(t,n){return o.jsx(gn.span,{...t,ref:n,style:{...yC,...t.style}})},"VisuallyHidden")),bC=CF,jF=Object.defineProperty,ya=(e,t)=>jF(e,"name",{value:t,configurable:!0});function AF(e,t){const n=s.createContext(t);n.displayName=e+"Context";const r=ya(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 ya(a,"useContext"),[r,a]}ya(AF,"createContext");function Vs(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=ya(m=>{var S;const{scope:g,children:w,...y}=m,b=((S=g==null?void 0:g[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(m,g,w={}){var S;const{optional:y=!1}=w,b=((S=g==null?void 0:g[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(`\`${m}\` must be used within \`${i}\``)}return ya(p,"useContext"),[h,p]}ya(r,"createContext");const a=ya(()=>{const i=n.map(l=>s.createContext(l));return ya(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,xC(a,...t)]}ya(Vs,"createContextScope");function xC(...e){const t=e[0];if(e.length===1)return t;const n=ya(()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return ya(function(i){const l=r.reduce((u,{useScope:f,scopeName:h})=>{const m=f(i)[`__scope${h}`];return{...u,...m}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}ya(xC,"composeContextScopes");var NF=Object.defineProperty,Zr=(e,t)=>NF(e,"name",{value:t,configurable:!0});function wm(e){const t=e+"CollectionProvider",[n,r]=Vs(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=Ja(u),h=s.forwardRef((b,k)=>{const{scope:S,children:E}=b,C=i(u,S),A=fn(k,C.collectionRef);return o.jsx(f,{ref:A,children:E})});h.displayName=u;const p=e+"CollectionItemSlot",m="data-radix-collection-item",g=Ja(p),w=s.forwardRef((b,k)=>{const{scope:S,children:E,...C}=b,A=s.useRef(null),L=fn(k,A),T=i(p,S);return s.useEffect(()=>(T.itemMap.set(A,{ref:A,...C}),()=>void T.itemMap.delete(A))),o.jsx(g,{[m]:"",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(`[${m}]`));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(wm,"createCollection");var Ux=new WeakMap,xr,qs,s8=(qs=class extends Map{constructor(n){super(n);rx(this,xr);Ug(this,xr,[...super.keys()]),Ux.set(this,!0)}set(n,r){return Ux.get(this)&&(this.has(n)?as(this,xr)[as(this,xr).indexOf(n)]=n:as(this,xr).push(n)),super.set(n,r),this}insert(n,r,a){const i=this.has(r),l=as(this,xr).length,u=Tv(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 m=[...as(this,xr)];let g,w=!1;for(let y=f;y<p;y++)if(f===y){let b=m[y];m[y]===r&&(b=m[y+1]),i&&this.delete(r),g=this.get(b),this.set(r,a)}else{!w&&m[y-1]===r&&(w=!0);const b=m[w?y:y-1],k=g;g=this.get(b),this.delete(b),this.set(b,k)}return this}with(n,r,a){const i=new qs(this);return i.insert(n,r,a),i}before(n){const r=as(this,xr).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,a){const i=as(this,xr).indexOf(n);return i===-1?this:this.insert(i,r,a)}after(n){let r=as(this,xr).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=as(this,xr).indexOf(n);return i===-1?this:this.insert(i+1,r,a)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Ug(this,xr,[]),super.clear()}delete(n){const r=super.delete(n);return r&&as(this,xr).splice(as(this,xr).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Qh(as(this,xr),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Qh(as(this,xr),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return as(this,xr).indexOf(n)}keyAt(n){return Qh(as(this,xr),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 qs(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 qs(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 qs(r)}toReversed(){const n=new qs;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 qs(r)}slice(n,r){const a=new qs;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}},xr=new WeakMap,Zr(qs,"OrderedDict"),qs);function Qh(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=kC(e,t);return n===-1?void 0:e[n]}Zr(Qh,"at");function kC(e,t){const n=e.length,r=Tv(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}Zr(kC,"toSafeIndex");function Tv(e){return e!==e||e===0?0:Math.trunc(e)}Zr(Tv,"toSafeInteger");function MF(e){const t=e+"CollectionProvider",[n,r]=Vs(t),[a,i]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new s8,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,R]=s.useState(null),P=fn(M,R),[H,D]=T;return s.useEffect(()=>{if(!j)return;const B=CC(()=>{});return B.observe(j,{childList:!0,subtree:!0}),()=>{B.disconnect()}},[j]),o.jsx(a,{scope:A,itemMap:H,setItemMap:D,collectionRef:P,collectionRefObject:M,collectionElement:j,children:L})},"CollectionProviderImpl");f.displayName=t+"Impl";const h=e+"CollectionSlot",p=Ja(h),m=s.forwardRef((C,A)=>{const{scope:L,children:T}=C,M=i(h,L),j=fn(A,M.collectionRef);return o.jsx(p,{ref:j,children:T})});m.displayName=h;const g=e+"CollectionItemSlot",w="data-radix-collection-item",y=Ja(g),b=s.forwardRef((C,A)=>{const{scope:L,children:T,...M}=C,j=s.useRef(null),[R,P]=s.useState(null),H=fn(A,j,P),D=i(g,L),{setItemMap:B}=D,V=s.useRef(M);SC(V.current,M)||(V.current=M);const K=V.current;return s.useEffect(()=>{const U=K;return B(I=>R?I.has(R)?I.set(R,{...U,element:R}).toSorted(T6):(I.set(R,{...U,element:R}),I.toSorted(T6)):I),()=>{B(I=>!R||!I.has(R)?I:(I.delete(R),new s8(I)))}},[R,K,B]),o.jsx(y,{[w]:"",ref:H,children:T})});b.displayName=g;function k(){return s.useState(new s8)}Zr(k,"useInitCollection");function S(C){const{itemMap:A}=i(e+"CollectionConsumer",C);return A}return Zr(S,"useCollection"),[{Provider:l,Slot:m,ItemSlot:b},{createCollectionScope:r,useCollection:S,useInitCollection:k}]}Zr(MF,"createCollection");function SC(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(SC,"shallowEqual");function EC(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Zr(EC,"isElementPreceding");function T6(e,t){return!e[1].element||!t[1].element?0:EC(e[1].element,t[1].element)?-1:1}Zr(T6,"sortByDocumentPosition");function CC(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Zr(CC,"getChildListObserver");var RF=Object.defineProperty,jd=(e,t)=>RF(e,"name",{value:t,configurable:!0}),jC=!!(typeof window<"u"&&window.document&&window.document.createElement);function At(e,t,{checkForDefaultPrevented:n=!0}={}){return jd(function(a){if(e==null||e(a),n===!1||!a||!a.defaultPrevented)return t==null?void 0:t(a)},"handleEvent")}jd(At,"composeEventHandlers");function PF(e){var t;if(!jC)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}jd(PF,"getOwnerWindow");function D6(e){if(!jC)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}jd(D6,"getOwnerDocument");function AC(e,t=!1){const{activeElement:n}=D6(e);if(!(n!=null&&n.nodeName))return null;if(NC(n)&&n.contentDocument)return AC(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const a=D6(n).getElementById(r);if(a)return a}}return n}jd(AC,"getActiveElement");function NC(e){return e.tagName==="IFRAME"}jd(NC,"isFrame");var Cr=globalThis!=null&&globalThis.document?s.useLayoutEffect:()=>{},LF=Object.defineProperty,$F=(e,t)=>LF(e,"name",{value:t,configurable:!0}),Wx=Oc[" useEffectEvent ".trim().toString()],Kx=Oc[" useInsertionEffect ".trim().toString()];function MC(e){if(typeof Wx=="function")return Wx(e);const t=s.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Kx=="function"?Kx(()=>{t.current=e}):Cr(()=>{t.current=e}),s.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}$F(MC,"useEffectEvent");var TF=Object.defineProperty,Pf=(e,t)=>TF(e,"name",{value:t,configurable:!0}),DF=Oc[" useInsertionEffect ".trim().toString()]||Cr;function gi({prop:e,defaultProp:t,onChange:n=Pf(()=>{},"onChange"),caller:r}){const[a,i,l]=RC({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:a,h=s.useCallback(p=>{var m;if(u){const g=PC(p)?p(e):p;g!==e&&((m=l.current)==null||m.call(l,g))}else i(p)},[u,e,i,l]);return[f,h]}Pf(gi,"useControllableState");function RC({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),a=s.useRef(n),i=s.useRef(t);return DF(()=>{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]}Pf(RC,"useUncontrolledState");function PC(e){return typeof e=="function"}Pf(PC,"isFunction");var Gx=Symbol("RADIX:SYNC_STATE");function HF(e,t,n,r){const{prop:a,defaultProp:i,onChange:l,caller:u}=t,f=a!==void 0,h=MC(l),p=[{...n,state:i}];r&&p.push(r);const[m,g]=s.useReducer((k,S)=>{if(S.type===Gx)return{...k,state:S.state};const E=e(k,S);return f&&!Object.is(E.state,k.state)&&h(E.state),E},...p),w=m.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?{...m,state:a}:m,[m,a]);return s.useEffect(()=>{f&&!Object.is(a,m.state)&&g({type:Gx,state:a})},[a,m.state,f]),[b,g]}Pf(HF,"useControllableStateReducer");var OF=Object.defineProperty,vi=(e,t)=>OF(e,"name",{value:t,configurable:!0});function LC(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}vi(LC,"useStateMachine");var hs=vi(e=>{const{present:t,children:n}=e,r=$C(t),a=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),i=TC(r.ref,DC(a));return typeof n=="function"||r.isPresent?s.cloneElement(a,{ref:i}):null},"Presence");function $C(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]=LC(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??Iu(r.current),l.current=void 0):i.current="none"},[f]),Cr(()=>{const p=r.current,m=a.current;if(m!==e){const w=i.current,y=Iu(p);e?(l.current=y,h("MOUNT")):y==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(m&&w!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),Cr(()=>{if(t){let p;const m=t.ownerDocument.defaultView??window,g=vi(y=>{const k=Iu(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=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),w=vi(y=>{y.target===t&&(i.current=Iu(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{m.clearTimeout(p),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:s.useCallback(p=>{if(p){const m=getComputedStyle(p);r.current=m,l.current=Iu(m)}else r.current=null;n(p)},[])}}vi($C,"usePresence");function H6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}vi(H6,"setRef");function TC(...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=H6(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():H6(r[l],null)}}},[])}vi(TC,"useStableComposedRefs");function Iu(e){return(e==null?void 0:e.animationName)||"none"}vi(Iu,"getAnimationName");function DC(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)}vi(DC,"getElementRef");var IF=Object.defineProperty,FF=(e,t)=>IF(e,"name",{value:t,configurable:!0}),_F=Oc[" useId ".trim().toString()]||(()=>{}),VF=0;function Ca(e){const[t,n]=s.useState(_F());return Cr(()=>{e||n(r=>r??String(VF++))},[e]),e||(t?`radix-${t}`:"")}FF(Ca,"useId");var ZF=Object.defineProperty,HC=(e,t)=>ZF(e,"name",{value:t,configurable:!0}),OC=s.createContext(void 0),zF=HC(e=>{const{dir:t,children:n}=e;return o.jsx(OC.Provider,{value:t,children:n})},"DirectionProvider");function Lf(e){const t=s.useContext(OC);return e||t||"ltr"}HC(Lf,"useDirection");var BF=zF,UF=Object.defineProperty,WF=(e,t)=>UF(e,"name",{value:t,configurable:!0});function Sr(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)}),[])}WF(Sr,"useCallbackRef");var KF=Object.defineProperty,Vr=(e,t)=>KF(e,"name",{value:t,configurable:!0}),O6="dismissableLayer.update",GF="dismissableLayer.pointerDownOutside",YF="dismissableLayer.focusOutside",Yx,IC=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),$f=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,m=s.useContext(IC),[g,w]=s.useState(null),y=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=s.useState({}),k=fn(n,w),S=Array.from(m.layers),[E]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=E?S.indexOf(E):-1,A=g?S.indexOf(g):-1,L=m.layersWithOutsidePointerEventsDisabled.size>0,T=A>=C,M=s.useRef(!1),j=_C(D=>{l==null||l(D),f==null||f(D),D.defaultPrevented||h==null||h()},{ownerDocument:y,deferPointerDownOutside:a,isDeferredPointerDownOutsideRef:M,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(D=>{if(!(D instanceof Node))return!1;const B=[...m.branches].some(V=>V.contains(D));return T&&!B},[m.branches,T])}),R=VC(D=>{if(a&&M.current)return;const B=D.target;[...m.branches].some(K=>K.contains(B))||(u==null||u(D),f==null||f(D),D.defaultPrevented||h==null||h())},y),P=g?A===S.length-1:!1,H=Sr(D=>{D.key==="Escape"&&(i==null||i(D),!D.defaultPrevented&&h&&(D.preventDefault(),h()))});return s.useEffect(()=>{if(P)return y.addEventListener("keydown",H,{capture:!0}),()=>y.removeEventListener("keydown",H,{capture:!0})},[y,P,H]),s.useEffect(()=>{if(g)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Yx=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),I6(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=Yx))}},[g,y,r,m]),s.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),I6())},[g,m]),s.useEffect(()=>{const D=Vr(()=>b({}),"handleUpdate");return document.addEventListener(O6,D),()=>document.removeEventListener(O6,D)},[]),o.jsx(gn.div,{...p,ref:k,style:{pointerEvents:L?T?"auto":"none":void 0,...t.style},onFocusCapture:At(t.onFocusCapture,R.onFocusCapture),onBlurCapture:At(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:At(t.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function FC(){const e=s.useContext(IC),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Vr(FC,"useDismissableLayerSurface");var qF=Vr(()=>!0,"IS_TRUE");function _C(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:i,shouldHandlePointerDownOutside:l=qF}=t,u=Sr(e),f=s.useRef(!1),h=s.useRef(!1),p=s.useRef(new Map),m=s.useRef(()=>{});return s.useEffect(()=>{function g(){h.current=!1,a.current=!1,p.current.clear()}Vr(g,"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&&m.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",m.current);const T=w();g(),T||Dv(GF,u,L,{discrete:!0})};if(Vr(A,"handleAndDispatchPointerDownOutsideEvent"),!l(C.target)){n.removeEventListener("click",m.current),g(),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",m.current),m.current=A,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),g();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",m.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(_C,"usePointerDownOutside");function VC(e,t=globalThis==null?void 0:globalThis.document){const n=Sr(e),r=s.useRef(!1);return s.useEffect(()=>{const a=Vr(i=>{i.target&&!r.current&&Dv(YF,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(VC,"useFocusOutside");function I6(){const e=new CustomEvent(O6);document.dispatchEvent(e)}Vr(I6,"dispatchUpdate");function Dv(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?$v(a,i):a.dispatchEvent(i)}Vr(Dv,"handleAndDispatchCustomEvent");var XF=Object.defineProperty,Ss=(e,t)=>XF(e,"name",{value:t,configurable:!0}),a8="focusScope.autoFocusOnMount",o8="focusScope.autoFocusOnUnmount",qx={bubbles:!1,cancelable:!0},Ad=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=Sr(i),m=Sr(l),g=s.useRef(null),w=fn(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)?g.current=L:Xo(g.current,{select:!0})},S=function(A){if(y.paused||!f)return;const L=A.relatedTarget;L!==null&&(f.contains(L)||Xo(g.current,{select:!0}))},E=function(A){if(document.activeElement===document.body)for(const T of A)T.removedNodes.length>0&&Xo(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){Xx.add(y);const k=document.activeElement;if(!f.contains(k)){const E=new CustomEvent(a8,qx);f.addEventListener(a8,p),f.dispatchEvent(E),E.defaultPrevented||(ZC(KC(Hv(f)),{select:!0}),document.activeElement===k&&Xo(f))}return()=>{f.removeEventListener(a8,p),setTimeout(()=>{const E=new CustomEvent(o8,qx);f.addEventListener(o8,m),f.dispatchEvent(E),E.defaultPrevented||Xo(k??document.body,{select:!0}),f.removeEventListener(o8,m),Xx.remove(y)},0)}}},[f,p,m,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]=zC(C);A&&L?!k.shiftKey&&E===L?(k.preventDefault(),r&&Xo(A,{select:!0})):k.shiftKey&&E===A&&(k.preventDefault(),r&&Xo(L,{select:!0})):E===C&&k.preventDefault()}},[r,a,y.paused]);return o.jsx(gn.div,{tabIndex:-1,...u,ref:w,onKeyDown:b})},"FocusScope"));function ZC(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Xo(r,{select:t}),document.activeElement!==n)return}Ss(ZC,"focusFirst");function zC(e){const t=Hv(e),n=F6(t,e),r=F6(t.reverse(),e);return[n,r]}Ss(zC,"getTabbableEdges");function Hv(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(Hv,"getTabbableCandidates");function F6(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):BC(r,{upTo:t})))return r}Ss(F6,"findVisible");function BC(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(BC,"isHidden");function UC(e){return e instanceof HTMLInputElement&&"select"in e}Ss(UC,"isSelectableInput");function Xo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&UC(e)&&t&&e.select()}}Ss(Xo,"focus");var Xx=WC();function WC(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=_6(e,t),e.unshift(t)},remove(t){var n;e=_6(e,t),(n=e[0])==null||n.resume()}}}Ss(WC,"createFocusScopesStack");function _6(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ss(_6,"arrayRemove");function KC(e){return e.filter(t=>t.tagName!=="A")}Ss(KC,"removeLinks");var QF=Object.defineProperty,JF=(e,t)=>QF(e,"name",{value:t,configurable:!0}),Tf=s.forwardRef(JF(function(t,n){var f;const{container:r,...a}=t,[i,l]=s.useState(!1);Cr(()=>l(!0),[]);const u=r||i&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return u?Br.createPortal(o.jsx(gn.div,{...a,ref:n}),u):null},"Portal")),e_=Object.defineProperty,Ov=(e,t)=>e_(e,"name",{value:t,configurable:!0}),xh=0,bo=null;function t_(e){return Nd(),e.children}Ov(t_,"FocusGuards");function Nd(){s.useEffect(()=>{bo||(bo={start:V6(),end:V6()});const{start:e,end:t}=bo;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),xh++,()=>{xh===1&&(bo==null||bo.start.remove(),bo==null||bo.end.remove(),bo=null),xh=Math.max(0,xh-1)}},[])}Ov(Nd,"useFocusGuards");function V6(){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}Ov(V6,"createFocusGuard");var Eo=function(){return Eo=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},Eo.apply(this,arguments)};function GC(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 n_(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 Jh="right-scroll-bar-position",ep="width-before-scroll-bar",r_="with-scroll-bars-hidden",s_="--removed-body-scroll-bar-size";function i8(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function a_(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 o_=typeof window<"u"?s.useLayoutEffect:s.useEffect,Qx=new WeakMap;function i_(e,t){var n=a_(null,function(r){return e.forEach(function(a){return i8(a,r)})});return o_(function(){var r=Qx.get(n);if(r){var a=new Set(r),i=new Set(e),l=n.current;a.forEach(function(u){i.has(u)||i8(u,null)}),i.forEach(function(u){a.has(u)||i8(u,l)})}Qx.set(n,e)},[e]),n}function l_(e){return e}function c_(e,t){t===void 0&&(t=l_);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 u_(e){e===void 0&&(e={});var t=c_(null);return t.options=Eo({async:!0,ssr:!1},e),t}var YC=function(e){var t=e.sideCar,n=GC(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,Eo({},n))};YC.isSideCarExport=!0;function d_(e,t){return e.useMedium(t),YC}var qC=u_(),l8=function(){},ym=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:l8,onWheelCapture:l8,onTouchMoveCapture:l8}),a=r[0],i=r[1],l=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,m=e.shards,g=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=GC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=g,T=i_([n,t]),M=Eo(Eo({},A),a);return s.createElement(s.Fragment,null,p&&s.createElement(L,{sideCar:qC,removeScrollBar:h,shards:m,noRelative:w,noIsolation:y,inert:b,setCallbacks:i,allowPinchZoom:!!k,lockRef:n,gapMode:C}),l?s.cloneElement(s.Children.only(u),Eo(Eo({},M),{ref:T})):s.createElement(E,Eo({},M,{className:f,ref:T}),u))});ym.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ym.classNames={fullWidth:ep,zeroRight:Jh};var f_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function h_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=f_();return t&&e.setAttribute("nonce",t),e}function p_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function m_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var g_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=h_())&&(p_(t,n),m_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},v_=function(){var e=g_();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},XC=function(){var e=v_(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},w_={left:0,top:0,right:0,gap:0},c8=function(e){return parseInt(e||"",10)||0},y_=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[c8(n),c8(r),c8(a)]},b_=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return w_;var t=y_(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])}},x_=XC(),Xu="data-scroll-locked",k_=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(r_,` {
54
+ overflow: hidden `).concat(r,`;
55
+ padding-right: `).concat(u,"px ").concat(r,`;
56
+ }
57
+ body[`).concat(Xu,`] {
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(Jh,` {
71
+ right: `).concat(u,"px ").concat(r,`;
72
+ }
73
+
74
+ .`).concat(ep,` {
75
+ margin-right: `).concat(u,"px ").concat(r,`;
76
+ }
77
+
78
+ .`).concat(Jh," .").concat(Jh,` {
79
+ right: 0 `).concat(r,`;
80
+ }
81
+
82
+ .`).concat(ep," .").concat(ep,` {
83
+ margin-right: 0 `).concat(r,`;
84
+ }
85
+
86
+ body[`).concat(Xu,`] {
87
+ `).concat(s_,": ").concat(u,`px;
88
+ }
89
+ `)},Jx=function(){var e=parseInt(document.body.getAttribute(Xu)||"0",10);return isFinite(e)?e:0},S_=function(){s.useEffect(function(){return document.body.setAttribute(Xu,(Jx()+1).toString()),function(){var e=Jx()-1;e<=0?document.body.removeAttribute(Xu):document.body.setAttribute(Xu,e.toString())}},[])},E_=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;S_();var i=s.useMemo(function(){return b_(a)},[a]);return s.createElement(x_,{styles:k_(i,!t,a,n?"":"!important")})},Z6=!1;if(typeof window<"u")try{var kh=Object.defineProperty({},"passive",{get:function(){return Z6=!0,!0}});window.addEventListener("test",kh,kh),window.removeEventListener("test",kh,kh)}catch{Z6=!1}var Eu=Z6?{passive:!1}:!1,C_=function(e){return e.tagName==="TEXTAREA"},QC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!C_(e)&&n[t]==="visible")},j_=function(e){return QC(e,"overflowY")},A_=function(e){return QC(e,"overflowX")},e5=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=JC(e,r);if(a){var i=ej(e,r),l=i[1],u=i[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},N_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},M_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},JC=function(e,t){return e==="v"?j_(t):A_(t)},ej=function(e,t){return e==="v"?N_(t):M_(t)},R_=function(e,t){return e==="h"&&t==="rtl"?-1:1},P_=function(e,t,n,r,a){var i=R_(e,window.getComputedStyle(t).direction),l=i*r,u=n.target,f=t.contains(u),h=!1,p=l>0,m=0,g=0;do{if(!u)break;var w=ej(e,u),y=w[0],b=w[1],k=w[2],S=b-k-i*y;(y||S)&&JC(e,u)&&(m+=S,g+=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(m)<1||!p&&Math.abs(g)<1)&&(h=!0),h},Sh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},t5=function(e){return[e.deltaX,e.deltaY]},n5=function(e){return e&&"current"in e?e.current:e},L_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$_=function(e){return`
90
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
91
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
92
+ `)},T_=0,Cu=[];function D_(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),a=s.useState(T_++)[0],i=s.useState(XC)[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=n_([e.lockRef.current],(e.shards||[]).map(n5),!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=Sh(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(),R=j&&j.anchorNode,P=R?R===T||R.contains(T):!1;if(P)return!1;var H=e5(M,T);if(!H)return!0;if(H?L=M:(L=M==="v"?"h":"v",H=e5(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 P_(D,k,b,D==="h"?C:A)},[]),f=s.useCallback(function(b){var k=b;if(!(!Cu.length||Cu[Cu.length-1]!==i)){var S="deltaY"in k?t5(k):Sh(k),E=t.current.filter(function(L){return L.name===k.type&&(L.target===k.target||k.target===L.shadowParent)&&L_(L.delta,S)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var C=(l.current.shards||[]).map(n5).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:H_(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=Sh(b),r.current=void 0},[]),m=s.useCallback(function(b){h(b.type,t5(b),b.target,u(b,e.lockRef.current))},[]),g=s.useCallback(function(b){h(b.type,Sh(b),b.target,u(b,e.lockRef.current))},[]);s.useEffect(function(){return Cu.push(i),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",f,Eu),document.addEventListener("touchmove",f,Eu),document.addEventListener("touchstart",p,Eu),function(){Cu=Cu.filter(function(b){return b!==i}),document.removeEventListener("wheel",f,Eu),document.removeEventListener("touchmove",f,Eu),document.removeEventListener("touchstart",p,Eu)}},[]);var w=e.removeScrollBar,y=e.inert;return s.createElement(s.Fragment,null,y?s.createElement(i,{styles:$_(a)}):null,w?s.createElement(E_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function H_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const O_=d_(qC,D_);var Df=s.forwardRef(function(e,t){return s.createElement(ym,Eo({},e,{ref:t,sideCar:O_}))});Df.classNames=ym.classNames;var I_=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ju=new WeakMap,Eh=new WeakMap,Ch={},u8=0,tj=function(e){return e&&(e.host||tj(e.parentNode))},F_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=tj(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})},__=function(e,t,n,r){var a=F_(t,Array.isArray(e)?e:[e]);Ch[n]||(Ch[n]=new WeakMap);var i=Ch[n],l=[],u=new Set,f=new Set(a),h=function(m){!m||u.has(m)||(u.add(m),h(m.parentNode))};a.forEach(h);var p=function(m){!m||f.has(m)||Array.prototype.forEach.call(m.children,function(g){if(u.has(g))p(g);else try{var w=g.getAttribute(r),y=w!==null&&w!=="false",b=(ju.get(g)||0)+1,k=(i.get(g)||0)+1;ju.set(g,b),i.set(g,k),l.push(g),b===1&&y&&Eh.set(g,!0),k===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",g,S)}})};return p(t),u.clear(),u8++,function(){l.forEach(function(m){var g=ju.get(m)-1,w=i.get(m)-1;ju.set(m,g),i.set(m,w),g||(Eh.has(m)||m.removeAttribute(r),Eh.delete(m)),w||m.removeAttribute(n)}),u8--,u8||(ju=new WeakMap,ju=new WeakMap,Eh=new WeakMap,Ch={})}},bm=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=I_(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),__(r,a,n,"aria-hidden")):function(){return null}},V_=Object.defineProperty,ra=(e,t)=>V_(e,"name",{value:t,configurable:!0}),Iv="Dialog",[nj,rj]=Vs(Iv),[Z_,so]=nj(Iv),Al=ra(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]=gi({prop:r,defaultProp:a??!1,onChange:i,caller:Iv}),[m,g]=s.useState(0),[w,y]=s.useState(0);return o.jsx(Z_,{scope:t,triggerRef:u,contentRef:f,contentId:Ca(),titleId:Ca(),descriptionId:Ca(),titlePresent:m>0,descriptionPresent:w>0,setTitleCount:g,setDescriptionCount:y,open:h,onOpenChange:p,onOpenToggle:s.useCallback(()=>p(b=>!b),[p]),modal:l,children:n})},"Dialog"),z_="DialogTrigger",Fv=s.forwardRef(ra(function(t,n){const{__scopeDialog:r,...a}=t,i=so(z_,r),l=fn(n,i.triggerRef);return o.jsx(gn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":xm(i.open),...a,ref:l,onClick:At(t.onClick,i.onOpenToggle)})},"DialogTrigger")),sj="DialogPortal",[B_,aj]=nj(sj,{forceMount:void 0}),Nl=ra(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=so(sj,t);return o.jsx(B_,{scope:t,forceMount:n,children:s.Children.map(r,l=>o.jsx(hs,{present:n||i.open,children:o.jsx(Tf,{asChild:!0,container:a,children:l})}))})},"DialogPortal"),z6="DialogOverlay",Ml=s.forwardRef(ra(function(t,n){const r=aj(z6,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,l=so(z6,t.__scopeDialog);return l.modal?o.jsx(hs,{present:a||l.open,children:o.jsx(W_,{...i,ref:n})}):null},"DialogOverlay")),U_=Ja("DialogOverlay.RemoveScroll"),W_=s.forwardRef(ra(function(t,n){const{__scopeDialog:r,...a}=t,i=so(z6,r),l=FC(),u=fn(n,l);return o.jsx(Df,{as:U_,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(gn.div,{"data-state":xm(i.open),...a,ref:u,style:{pointerEvents:"auto",...a.style}})})},"DialogOverlayImpl")),tf="DialogContent",Rl=s.forwardRef(ra(function(t,n){const r=aj(tf,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,l=so(tf,t.__scopeDialog);return o.jsx(hs,{present:a||l.open,children:l.modal?o.jsx(K_,{...i,ref:n}):o.jsx(G_,{...i,ref:n})})},"DialogContent")),K_=s.forwardRef(ra(function(t,n){const r=so(tf,t.__scopeDialog),a=s.useRef(null),i=fn(n,r.contentRef,a);return s.useEffect(()=>{const l=a.current;if(l)return bm(l)},[]),o.jsx(oj,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:At(t.onCloseAutoFocus,l=>{var u;l.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:At(t.onPointerDownOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&l.preventDefault()}),onFocusOutside:At(t.onFocusOutside,l=>l.preventDefault())})},"DialogContentModal")),G_=s.forwardRef(ra(function(t,n){const r=so(tf,t.__scopeDialog),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(oj,{...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")),oj=s.forwardRef(ra(function(t,n){const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=t,f=so(tf,r);return Nd(),o.jsx(o.Fragment,{children:o.jsx(Ad,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx($f,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionPresent?f.descriptionId:void 0,"aria-labelledby":f.titlePresent?f.titleId:void 0,"data-state":xm(f.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>f.onOpenChange(!1)})})})},"DialogContentImpl")),Y_="DialogTitle",Pl=s.forwardRef(ra(function(t,n){const{__scopeDialog:r,...a}=t,i=so(Y_,r),{setTitleCount:l}=i;return Cr(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),o.jsx(gn.h2,{id:i.titleId,...a,ref:n})},"DialogTitle")),q_="DialogDescription",_v=s.forwardRef(ra(function(t,n){const{__scopeDialog:r,...a}=t,i=so(q_,r),{setDescriptionCount:l}=i;return Cr(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),o.jsx(gn.p,{id:i.descriptionId,...a,ref:n})},"DialogDescription")),X_="DialogClose",Hf=s.forwardRef(ra(function(t,n){const{__scopeDialog:r,...a}=t,i=so(X_,r);return o.jsx(gn.button,{type:"button",...a,ref:n,onClick:At(t.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function xm(e){return e?"open":"closed"}ra(xm,"getState");var Q_=Object.defineProperty,Ei=(e,t)=>Q_(e,"name",{value:t,configurable:!0}),J_="AlertDialog",[eV,Jde]=Vs(J_,[rj]),Ci=rj(),tV=Ei(e=>{const{__scopeAlertDialog:t,...n}=e,r=Ci(t);return o.jsx(Al,{...r,...n,modal:!0})},"AlertDialog"),nV=s.forwardRef(Ei(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ci(r);return o.jsx(Fv,{...i,...a,ref:n})},"AlertDialogTrigger")),rV=Ei(e=>{const{__scopeAlertDialog:t,...n}=e,r=Ci(t);return o.jsx(Nl,{...r,...n})},"AlertDialogPortal"),sV=s.forwardRef(Ei(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ci(r);return o.jsx(Ml,{...i,...a,ref:n})},"AlertDialogOverlay")),aV="AlertDialogContent",[oV,iV]=eV(aV),lV=s.forwardRef(Ei(function(t,n){const{__scopeAlertDialog:r,children:a,...i}=t,l=Ci(r),u=s.useRef(null),f=fn(n,u),h=s.useRef(null);return o.jsx(oV,{scope:r,cancelRef:h,children:o.jsx(Rl,{role:"alertdialog",...l,...i,ref:f,onOpenAutoFocus:At(i.onOpenAutoFocus,p=>{var m;p.preventDefault(),(m=h.current)==null||m.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:a})})},"AlertDialogContent")),cV=s.forwardRef(Ei(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ci(r);return o.jsx(Pl,{...i,...a,ref:n})},"AlertDialogTitle")),uV=s.forwardRef(Ei(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ci(r);return o.jsx(_v,{...i,...a,ref:n})},"AlertDialogDescription")),dV=s.forwardRef(Ei(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ci(r);return o.jsx(Hf,{...i,...a,ref:n})},"AlertDialogAction")),fV="AlertDialogCancel",hV=s.forwardRef(Ei(function(t,n){const{__scopeAlertDialog:r,...a}=t,{cancelRef:i}=iV(fV,r),l=Ci(r),u=fn(n,i);return o.jsx(Hf,{...l,...a,ref:u})},"AlertDialogCancel")),pV=tV,mV=nV,gV=rV,vV=sV,wV=lV,yV=dV,bV=hV,xV=cV,kV=uV,SV=Object.defineProperty,EV=(e,t)=>SV(e,"name",{value:t,configurable:!0});function ij(e){const[t,n]=s.useState(void 0);return Cr(()=>{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}EV(ij,"useSize");const CV=["top","right","bottom","left"],yl=Math.min,ai=Math.max,mp=Math.round,jh=Math.floor,oi=e=>({x:e,y:e}),jV={left:"right",right:"left",bottom:"top",top:"bottom"};function lj(e,t,n){return ai(e,yl(t,n))}function wi(e,t){return typeof e=="function"?e(t):e}function bl(e){return e.split("-")[0]}function Md(e){return e.split("-")[1]}function Vv(e){return e==="x"?"y":"x"}function Zv(e){return e==="y"?"height":"width"}function jo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function zv(e){return Vv(jo(e))}function AV(e,t,n){n===void 0&&(n=!1);const r=Md(e),a=zv(e),i=Zv(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=gp(l)),[l,gp(l)]}function NV(e){const t=gp(e);return[B6(e),t,B6(t)]}function B6(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const r5=["left","right"],s5=["right","left"],MV=["top","bottom"],RV=["bottom","top"];function PV(e,t,n){switch(e){case"top":case"bottom":return n?t?s5:r5:t?r5:s5;case"left":case"right":return t?MV:RV;default:return[]}}function LV(e,t,n,r){const a=Md(e);let i=PV(bl(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map(B6)))),i}function gp(e){const t=bl(e);return jV[t]+e.slice(t.length)}function $V(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 cj(e){return typeof e!="number"?$V(e):{top:e,right:e,bottom:e,left:e}}function vp(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 a5(e,t,n){let{reference:r,floating:a}=e;const i=jo(t),l=zv(t),u=Zv(l),f=bl(t),h=i==="y",p=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=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:m};break;case"left":w={x:r.x-a.width,y:m};break;default:w={x:r.x,y:r.y}}const y=Md(t);return y&&(w[l]+=g*(y==="end"?1:-1)*(n&&h?-1:1)),w}async function TV(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:m="floating",altBoundary:g=!1,padding:w=0}=wi(t,e),y=cj(w),k=u[g?m==="floating"?"reference":"floating":m],S=vp(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=m==="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=vp(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 DV=50,HV=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:TV},f=await(l.isRTL==null?void 0:l.isRTL(t));let h=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:m}=a5(h,r,f),g=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:m,initialPlacement:r,placement:g,strategy:a,middlewareData:y,rects:h,platform:u,elements:{reference:e,floating:t}});p=C??p,m=A??m,y[S]={...y[S],...L},T&&w<DV&&(w++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(h=T.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:p,y:m}=a5(h,g,f)),b=-1)}return{x:p,y:m,placement:g,strategy:a,middlewareData:y}},OV=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}=wi(e,t)||{};if(h==null)return{};const m=cj(p),g={x:n,y:r},w=zv(a),y=Zv(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]-g[w]-i.floating[y],L=g[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,R=M/2-b[y]/2-1,P=yl(m[S],R),H=yl(m[E],R),D=M-b[y]-H,B=M/2-b[y]/2+j,V=lj(P,B,D),K=!f.arrow&&Md(a)!=null&&B!==V&&i.reference[y]/2-(B<P?P:H)-b[y]/2<0,U=K?B<P?B-P:B-D:0;return{[w]:g[w]+U,data:{[w]:V,centerOffset:B-V-U,...K&&{alignmentOffset:U}},reset:K}}}),IV=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:m=!0,fallbackPlacements:g,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...k}=wi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=bl(a),E=jo(u),C=bl(u)===u,A=await(f.isRTL==null?void 0:f.isRTL(h.floating)),L=g||(C||!b?[gp(u)]:NV(u)),T=y!=="none";!g&&T&&L.push(...LV(u,b,y,A));const M=[u,...L],j=await f.detectOverflow(t,k),R=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&R.push(j[S]),m){const V=AV(a,l,A);R.push(j[V[0]],j[V[1]])}if(P=[...P,{placement:a,overflows:R}],!R.every(V=>V<=0)){var H,D;const V=(((H=i.flip)==null?void 0:H.index)||0)+1,K=M[V];if(K&&(!(m==="alignment"?E!==jo(K):!1)||P.every(_=>jo(_.placement)===E?_.overflows[0]>0:!0)))return{data:{index:V,overflows:P},reset:{placement:K}};let U=(D=P.filter(I=>I.overflows[0]<=0).sort((I,_)=>I.overflows[1]-_.overflows[1])[0])==null?void 0:D.placement;if(!U)switch(w){case"bestFit":{var B;const I=(B=P.filter(_=>{if(T){const O=jo(_.placement);return O===E||O==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(O=>O>0).reduce((O,Y)=>O+Y,0)]).sort((_,O)=>_[1]-O[1])[0])==null?void 0:B[0];I&&(U=I);break}case"initialPlacement":U=u;break}if(a!==U)return{reset:{placement:U}}}return{}}}};function o5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function i5(e){return CV.some(t=>e[t]>=0)}const FV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=wi(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),u=o5(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:i5(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),u=o5(l,n.floating);return{data:{escapedOffsets:u,escaped:i5(u)}}}default:return{}}}}},uj=new Set(["left","top"]);async function _V(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=bl(n),u=Md(n),f=jo(n)==="y",h=uj.has(l)?-1:1,p=i&&f?-1:1,m=wi(t,e);let{mainAxis:g,crossAxis:w,alignmentAxis:y}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof y=="number"&&(w=u==="end"?y*-1:y),f?{x:w*p,y:g*h}:{x:g*h,y:w*p}}const VV=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 _V(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}}}}},ZV=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}=wi(e,t),p={x:n,y:r},m=await i.detectOverflow(t,h),g=jo(a),w=Vv(g);let y=p[w],b=p[g];const k=(E,C)=>lj(C+m[E==="y"?"top":"left"],C,C-m[E==="y"?"bottom":"right"]);l&&(y=k(w,y)),u&&(b=k(g,b));const S=f.fn({...t,[w]:y,[g]:b});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[w]:l,[g]:u}}}}}},zV=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:m=!0}=wi(e,t),g={x:a,y:i},w=jo(l),y=Vv(w);let b=g[y],k=g[w];const S=wi(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(m){var C,A;const L=y==="y"?"width":"height",T=uj.has(bl(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}}}},BV=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}=wi(e,t),f=await a.detectOverflow(t,u),h=bl(n),p=Md(n),m=jo(n)==="y",{width:g,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=g-f.left-f.right,E=yl(w-f[y],k),C=yl(g-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&&(m?M=g-2*ai(f.left,f.right):T=w-2*ai(f.top,f.bottom)),await l({...t,availableWidth:M,availableHeight:T});const j=await a.getDimensions(i.floating);return g!==j.width||w!==j.height?{reset:{rects:!0}}:{}}}};function km(){return typeof window<"u"}function Rd(e){return dj(e)?(e.nodeName||"").toLowerCase():"#document"}function Is(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ji(e){var t;return(t=(dj(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dj(e){return km()?e instanceof Node||e instanceof Is(e).Node:!1}function $o(e){return km()?e instanceof Element||e instanceof Is(e).Element:!1}function Ll(e){return km()?e instanceof HTMLElement||e instanceof Is(e).HTMLElement:!1}function l5(e){return!km()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Is(e).ShadowRoot}function Sm(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=To(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function UV(e){return/^(table|td|th)$/.test(Rd(e))}function Em(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const WV=/transform|translate|scale|rotate|perspective|filter/,KV=/paint|layout|strict|content/,rc=e=>!!e&&e!=="none";let d8;function Bv(e){const t=$o(e)?To(e):e;return rc(t.transform)||rc(t.translate)||rc(t.scale)||rc(t.rotate)||rc(t.perspective)||!Uv()&&(rc(t.backdropFilter)||rc(t.filter))||WV.test(t.willChange||"")||KV.test(t.contain||"")}function GV(e){let t=jc(e);for(;Ll(t)&&!nf(t);){if(Bv(t))return t;if(Em(t))return null;t=jc(t)}return null}function Uv(){return d8==null&&(d8=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),d8}function nf(e){return/^(html|body|#document)$/.test(Rd(e))}function To(e){return Is(e).getComputedStyle(e)}function Cm(e){return $o(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jc(e){if(Rd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||l5(e)&&e.host||ji(e);return l5(t)?t.host:t}function fj(e){const t=jc(e);return nf(t)?(e.ownerDocument||e).body:Ll(t)&&Sm(t)?t:fj(t)}function rf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=fj(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=Is(a);if(i){const u=U6(l);return t.concat(l,l.visualViewport||[],Sm(a)?a:[],u&&n?rf(u):[])}else return t.concat(a,rf(a,[],n))}function U6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hj(e){const t=To(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Ll(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=mp(n)!==i||mp(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function Wv(e){return $o(e)?e:e.contextElement}function Qu(e){const t=Wv(e);if(!Ll(t))return oi(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=hj(t);let l=(i?mp(n.width):n.width)/r,u=(i?mp(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const YV=oi(0);function pj(e){const t=Is(e);return!Uv()||!t.visualViewport?YV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qV(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Is(e)}function Ac(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=Wv(e);let l=oi(1);t&&(r?$o(r)&&(l=Qu(r)):l=Qu(e));const u=qV(i,n,r)?pj(i):oi(0);let f=(a.left+u.x)/l.x,h=(a.top+u.y)/l.y,p=a.width/l.x,m=a.height/l.y;if(i&&r){const g=Is(i),w=$o(r)?Is(r):r;let y=g,b=U6(y);for(;b&&w!==y;){const k=Qu(b),S=b.getBoundingClientRect(),E=To(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,m*=k.y,f+=C,h+=A,y=Is(b),b=U6(y)}}return vp({width:p,height:m,x:f,y:h})}function jm(e,t){const n=Cm(e).scrollLeft;return t?t.left+n:Ac(ji(e)).left+n}function mj(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-jm(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function XV(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=ji(r),u=t?Em(t.floating):!1;if(r===l||u&&i)return n;let f={scrollLeft:0,scrollTop:0},h=oi(1);const p=oi(0),m=Ll(r);if((m||!i)&&((Rd(r)!=="body"||Sm(l))&&(f=Cm(r)),m)){const w=Ac(r);h=Qu(r),p.x=w.x+r.clientLeft,p.y=w.y+r.clientTop}const g=l&&!m&&!i?mj(l,f):oi(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+p.x+g.x,y:n.y*h.y-f.scrollTop*h.y+p.y+g.y}}function QV(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function JV(e){const t=Cm(e),n=e.ownerDocument.body,r=ai(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=ai(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+jm(e);const l=-t.scrollTop;return To(n).direction==="rtl"&&(i+=ai(e.clientWidth,n.clientWidth)-r),{width:r,height:a,x:i,y:l}}const eZ=25;function tZ(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",a=Is(e),i=ji(e),l=a.visualViewport;let u=i.clientWidth,f=i.clientHeight,h=0,p=0;if(l){const g=!Uv()||t==="fixed";r?g||(h=-l.offsetLeft,p=-l.offsetTop):(u=l.width,f=l.height,g&&(h=l.offsetLeft,p=l.offsetTop))}if(jm(i)<=0){const g=i.ownerDocument,w=g.body,y=getComputedStyle(w),b=g.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<=eZ&&(u-=S)}return{width:u,height:f,x:h,y:p}}function nZ(e,t){const n=Ac(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Qu(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 c5(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=tZ(e,n,t);else if(t==="document")r=JV(ji(e));else if($o(t))r=nZ(t,n);else{const a=pj(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return vp(r)}function rZ(e,t){const n=t.get(e);if(n)return n;let r=rf(e,[],!1).filter(u=>$o(u)&&Rd(u)!=="body"),a=null;const i=To(e).position==="fixed";let l=i?jc(e):e;for(;$o(l)&&!nf(l);){const u=To(l),f=Bv(l),h=a?a.position:i?"fixed":"";!f&&(h==="fixed"||h==="absolute"&&u.position==="static")?r=r.filter(m=>m!==l):a=u,l=jc(l)}return t.set(e,r),r}function sZ(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Em(t)?[]:rZ(t,this._c):[].concat(n),r],u=c5(t,l[0],a);let f=u.top,h=u.right,p=u.bottom,m=u.left;for(let g=1;g<l.length;g++){const w=c5(t,l[g],a);f=ai(w.top,f),h=yl(w.right,h),p=yl(w.bottom,p),m=ai(w.left,m)}return{width:h-m,height:p-f,x:m,y:f}}function aZ(e){const{width:t,height:n}=hj(e);return{width:t,height:n}}function oZ(e,t,n){const r=Ll(t),a=ji(t),i=n==="fixed",l=Ac(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const f=oi(0);if((r||!i)&&((Rd(t)!=="body"||Sm(a))&&(u=Cm(t)),r)){const g=Ac(t,!0,i,t);f.x=g.x+t.clientLeft,f.y=g.y+t.clientTop}!r&&a&&(f.x=jm(a));const h=a&&!r&&!i?mj(a,u):oi(0),p=l.left+u.scrollLeft-f.x-h.x,m=l.top+u.scrollTop-f.y-h.y;return{x:p,y:m,width:l.width,height:l.height}}function f8(e){return To(e).position==="static"}function u5(e,t){if(!Ll(e)||To(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ji(e)===n&&(n=n.ownerDocument.body),n}function gj(e,t){const n=Is(e);if(Em(e))return n;if(!Ll(e)){let a=jc(e);for(;a&&!nf(a);){if($o(a)&&!f8(a))return a;a=jc(a)}return n}let r=u5(e,t);for(;r&&UV(r)&&f8(r);)r=u5(r,t);return r&&nf(r)&&f8(r)&&!Bv(r)?n:r||GV(e)||n}const iZ=async function(e){const t=this.getOffsetParent||gj,n=this.getDimensions,r=await n(e.floating);return{reference:oZ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lZ(e){return To(e).direction==="rtl"}const cZ={convertOffsetParentRelativeRectToViewportRelativeRect:XV,getDocumentElement:ji,getClippingRect:sZ,getOffsetParent:gj,getElementRects:iZ,getClientRects:QV,getDimensions:aZ,getScale:Qu,isElement:$o,isRTL:lZ};function vj(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uZ(e,t,n){let r=null,a;const i=ji(e);function l(){var p;clearTimeout(a),(p=r)==null||p.disconnect(),r=null}function u(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),l();const g=e.getBoundingClientRect(),{left:w,top:y,width:b,height:k}=g;if(p||t(),!b||!k)return;const S=jh(y),E=jh(i.clientWidth-(w+b)),C=jh(i.clientHeight-(y+k)),A=jh(w),T={rootMargin:-S+"px "+-E+"px "+-C+"px "+-A+"px",threshold:ai(0,yl(1,m))||1};let M=!0;function j(R){const P=R[0].intersectionRatio;if(!vj(g,e.getBoundingClientRect()))return u();if(P!==m){if(!M)return u();P?u(!1,P):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=Is(e),h=()=>u(n);return f.addEventListener("resize",h),u(!0),()=>{f.removeEventListener("resize",h),l()}}function wj(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=Wv(e),p=a||i?[...h?rf(h):[],...t?rf(t):[]]:[];p.forEach(S=>{a&&S.addEventListener("scroll",n),i&&S.addEventListener("resize",n)});const m=h&&u?uZ(h,n,i):null;let g=-1,w=null;l&&(w=new ResizeObserver(S=>{let[E]=S;E&&E.target===h&&w&&t&&(w.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=w)==null||C.observe(t)})),n()}),h&&!f&&w.observe(h),t&&w.observe(t));let y,b=f?Ac(e):null;f&&k();function k(){const S=Ac(e);b&&!vj(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)}),m==null||m(),(S=w)==null||S.disconnect(),w=null,f&&cancelAnimationFrame(y)}}const yj=VV,bj=ZV,xj=IV,dZ=BV,fZ=FV,W6=OV,hZ=zV,kj=(e,t,n)=>{const r=new Map,a=n??{},i={...cZ,...a.platform,_c:r};return HV(e,t,{...a,platform:i})};var pZ=typeof document<"u",mZ=function(){},tp=pZ?s.useLayoutEffect:mZ;function wp(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(!wp(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)&&!wp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Sj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function d5(e,t){const n=Sj(e);return Math.round(t*n)/n}function h8(e){const t=s.useRef(e);return tp(()=>{t.current=e}),t}function gZ(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,m]=s.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,w]=s.useState(r);wp(g,r)||w(r);const[y,b]=s.useState(null),[k,S]=s.useState(null),E=s.useCallback(_=>{_!==T.current&&(T.current=_,b(_))},[]),C=s.useCallback(_=>{_!==M.current&&(M.current=_,S(_))},[]),A=i||y,L=l||k,T=s.useRef(null),M=s.useRef(null),j=s.useRef(p),R=f!=null,P=h8(f),H=h8(a),D=h8(h),B=s.useCallback(()=>{if(!T.current||!M.current)return;const _={placement:t,strategy:n,middleware:g};H.current&&(_.platform=H.current),kj(T.current,M.current,_).then(O=>{const Y={...O,isPositioned:D.current!==!1};V.current&&!wp(j.current,Y)&&(j.current=Y,Br.flushSync(()=>{m(Y)}))})},[g,t,n,H,D]);tp(()=>{h===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,m(_=>({..._,isPositioned:!1})))},[h]);const V=s.useRef(!1);tp(()=>(V.current=!0,()=>{V.current=!1}),[]),tp(()=>{if(A&&(T.current=A),L&&(M.current=L),A&&L){if(P.current)return P.current(A,L,B);B()}},[A,L,B,P,R]);const K=s.useMemo(()=>({reference:T,floating:M,setReference:E,setFloating:C}),[E,C]),U=s.useMemo(()=>({reference:A,floating:L}),[A,L]),I=s.useMemo(()=>{const _={position:n,left:0,top:0};if(!U.floating)return _;const O=d5(U.floating,p.x),Y=d5(U.floating,p.y);return u?{..._,transform:"translate("+O+"px, "+Y+"px)",...Sj(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Y}},[n,u,U.floating,p.x,p.y]);return s.useMemo(()=>({...p,update:B,refs:K,elements:U,floatingStyles:I}),[p,B,K,U,I])}const vZ=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?W6({element:r.current,padding:a}).fn(n):{}:r?W6({element:r,padding:a}).fn(n):{}}}},wZ=(e,t)=>{const n=yj(e);return{name:n.name,fn:n.fn,options:[e,t]}},yZ=(e,t)=>{const n=bj(e);return{name:n.name,fn:n.fn,options:[e,t]}},bZ=(e,t)=>({fn:hZ(e).fn,options:[e,t]}),xZ=(e,t)=>{const n=xj(e);return{name:n.name,fn:n.fn,options:[e,t]}},kZ=(e,t)=>{const n=dZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},SZ=(e,t)=>{const n=fZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},EZ=(e,t)=>{const n=vZ(e);return{name:n.name,fn:n.fn,options:[e,t]}};var CZ=Object.defineProperty,jZ=(e,t)=>CZ(e,"name",{value:t,configurable:!0}),AZ=s.forwardRef(jZ(function(t,n){const{children:r,width:a=10,height:i=5,...l}=t;return o.jsx(gn.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")),NZ=AZ,MZ=Object.defineProperty,ii=(e,t)=>MZ(e,"name",{value:t,configurable:!0}),Ej="Popper",[Cj,$l]=Vs(Ej),[RZ,jj]=Cj(Ej),PZ=ii(e=>{const{__scopePopper:t,children:n}=e,[r,a]=s.useState(null),[i,l]=s.useState(void 0);return o.jsx(RZ,{scope:t,anchor:r,onAnchorChange:a,placementState:i,setPlacementState:l,children:n})},"Popper"),LZ="PopperAnchor",$Z=s.forwardRef(ii(function(t,n){const{__scopePopper:r,virtualRef:a,...i}=t,l=jj(LZ,r),u=s.useRef(null),f=l.onAnchorChange,h=s.useCallback(b=>{u.current=b,b&&f(b)},[f]),p=fn(n,h),m=s.useRef(null);s.useEffect(()=>{if(!a)return;const b=m.current;m.current=a.current,b!==m.current&&f(m.current)});const g=l.placementState&&Am(l.placementState),w=g==null?void 0:g[0],y=g==null?void 0:g[1];return a?null:o.jsx(gn.div,{"data-radix-popper-side":w,"data-radix-popper-align":y,...i,ref:p})},"PopperAnchor")),Aj="PopperContent",[TZ,DZ]=Cj(Aj),HZ=s.forwardRef(ii(function(t,n){var ee,J,ae,Me,ue,Se,Be;const{__scopePopper:r,side:a="bottom",sideOffset:i=0,align:l="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:m=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:b,...k}=t,S=jj(Aj,r),[E,C]=s.useState(null),A=fn(n,C),[L,T]=s.useState(null),M=ij(L),j=(M==null?void 0:M.width)??0,R=(M==null?void 0:M.height)??0,P=a+(l!=="center"?"-"+l:""),H=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},D=Array.isArray(p)?p:[p],B=D.length>0,V={padding:H,boundary:D.filter(Nj),altBoundary:B},{refs:K,floatingStyles:U,placement:I,isPositioned:_,middlewareData:O}=gZ({strategy:"fixed",placement:P,whileElementsMounted:ii((...vt)=>wj(...vt,{animationFrame:y==="always"}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[wZ({mainAxis:i+R,alignmentAxis:u}),h&&yZ({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?bZ():void 0,...V}),h&&xZ({...V}),kZ({...V,apply:ii(({elements:vt,rects:Ue,availableWidth:Xe,availableHeight:De})=>{const{width:G,height:oe}=Ue.reference,We=vt.floating.style;We.setProperty("--radix-popper-available-width",`${Xe}px`),We.setProperty("--radix-popper-available-height",`${De}px`),We.setProperty("--radix-popper-anchor-width",`${G}px`),We.setProperty("--radix-popper-anchor-height",`${oe}px`)},"apply")}),L&&EZ({element:L,padding:f}),_Z({arrowWidth:j,arrowHeight:R}),w&&SZ({strategy:"referenceHidden",...V,boundary:B?V.boundary:void 0})]}),Y=S.setPlacementState;Cr(()=>(Y(I),()=>{Y(void 0)}),[I,Y]);const[z,q]=Am(I),Z=Sr(b);Cr(()=>{_&&(Z==null||Z())},[_,Z]);const Q=(ee=O.arrow)==null?void 0:ee.x,me=(J=O.arrow)==null?void 0:J.y,te=((ae=O.arrow)==null?void 0:ae.centerOffset)!==0,[he,re]=s.useState();return Cr(()=>{E&&re(window.getComputedStyle(E).zIndex)},[E]),o.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:_?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(Me=O.transformOrigin)==null?void 0:Me.x,(ue=O.transformOrigin)==null?void 0:ue.y].join(" "),...((Se=O.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(TZ,{scope:r,placedSide:z,placedAlign:q,onArrowChange:T,arrowX:Q,arrowY:me,shouldHideArrow:te,children:o.jsx(gn.div,{"data-side":z,"data-align":q,...k,ref:A,style:{...k.style,animation:_?(Be=k.style)==null?void 0:Be.animation:"none"}})})})},"PopperContent")),OZ="PopperArrow",IZ={top:"bottom",right:"left",bottom:"top",left:"right"},FZ=s.forwardRef(ii(function(t,n){const{__scopePopper:r,...a}=t,i=DZ(OZ,r),l=IZ[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(NZ,{...a,ref:n,style:{...a.style,display:"block"}})})},"PopperArrow"));function Nj(e){return e!==null}ii(Nj,"isNotNull");var _Z=ii(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]=Am(n),m={start:"0%",center:"50%",end:"100%"}[p],g=(((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?m:`${g}px`,b=`${-f}px`):h==="top"?(y=l?m:`${g}px`,b=`${r.floating.height+f}px`):h==="right"?(y=`${-f}px`,b=l?m:`${w}px`):h==="left"&&(y=`${r.floating.width+f}px`,b=l?m:`${w}px`),{data:{x:y,y:b}}}}),"transformOrigin");function Am(e){const[t,n="center"]=e.split("-");return[t,n]}ii(Am,"getSideAndAlignFromPlacement");var Nm=PZ,Of=$Z,Mm=HZ,VZ=FZ,ZZ=Object.defineProperty,Kv=(e,t)=>ZZ(e,"name",{value:t,configurable:!0}),p8=!1;function Mj(){const[e,t]=s.useState(p8);return s.useEffect(()=>{p8||(p8=!0,t(!0))},[]),e}Kv(Mj,"useIsHydrated");var Rj=Oc[" useSyncExternalStore ".trim().toString()];function Pj(){return()=>{}}Kv(Pj,"subscribe");function Lj(){return Rj(Pj,()=>!0,()=>!1)}Kv(Lj,"useIsHydratedModern");var zZ=typeof Rj=="function"?Lj:Mj,BZ=Object.defineProperty,zc=(e,t)=>BZ(e,"name",{value:t,configurable:!0}),m8="rovingFocusGroup.onEntryFocus",UZ={bubbles:!1,cancelable:!0},Rm="RovingFocusGroup",[K6,$j,WZ]=wm(Rm),[KZ,Tj]=Vs(Rm,[WZ]),[GZ,YZ]=KZ(Rm),qZ=s.forwardRef(zc(function(t,n){return o.jsx(K6.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(K6.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(XZ,{...t,ref:n})})})},"RovingFocusGroup")),XZ=s.forwardRef(zc(function(t,n){const{__scopeRovingFocusGroup:r,orientation:a,loop:i=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:m=!1,...g}=t,w=s.useRef(null),y=fn(n,w),b=Lf(l),[k,S]=gi({prop:u,defaultProp:f??null,onChange:h,caller:Rm}),[E,C]=s.useState(!1),A=Sr(p),L=$j(r),T=s.useRef(!1),[M,j]=s.useState(0);return s.useEffect(()=>{const R=w.current;if(R)return R.addEventListener(m8,A),()=>R.removeEventListener(m8,A)},[A]),o.jsx(GZ,{scope:r,orientation:a,dir:b,loop:i,currentTabStopId:k,onItemFocus:s.useCallback(R=>S(R),[S]),onItemShiftTab:s.useCallback(()=>C(!0),[]),onFocusableItemAdd:s.useCallback(()=>j(R=>R+1),[]),onFocusableItemRemove:s.useCallback(()=>j(R=>R-1),[]),children:o.jsx(gn.div,{tabIndex:E||M===0?-1:0,"data-orientation":a,...g,ref:y,style:{outline:"none",...t.style},onMouseDown:At(t.onMouseDown,()=>{T.current=!0}),onFocus:At(t.onFocus,R=>{const P=!T.current;if(R.target===R.currentTarget&&P&&!E){const H=new CustomEvent(m8,UZ);if(R.currentTarget.dispatchEvent(H),!H.defaultPrevented){const D=L().filter(I=>I.focusable),B=D.find(I=>I.active),V=D.find(I=>I.id===k),U=[B,V,...D].filter(Boolean).map(I=>I.ref.current);Gv(U,m)}}T.current=!1}),onBlur:At(t.onBlur,()=>C(!1))})})},"RovingFocusGroupImpl")),QZ="RovingFocusGroupItem",JZ=s.forwardRef(zc(function(t,n){const{__scopeRovingFocusGroup:r,focusable:a=!0,active:i=!1,tabStopId:l,children:u,...f}=t,h=Ca(),p=l||h,m=YZ(QZ,r),g=m.currentTabStopId===p,w=$j(r),{onFocusableItemAdd:y,onFocusableItemRemove:b,currentTabStopId:k}=m,S=zZ();return Cr(()=>{if(!(!S||!a))return y(),()=>b()},[S,a,y,b]),s.useEffect(()=>{if(!(S||!a))return y(),()=>b()},[S,a,y,b]),o.jsx(K6.ItemSlot,{scope:r,id:p,focusable:a,active:i,children:o.jsx(gn.span,{tabIndex:g?0:-1,"data-orientation":m.orientation,...f,ref:n,onMouseDown:At(t.onMouseDown,E=>{a?m.onItemFocus(p):E.preventDefault()}),onFocus:At(t.onFocus,()=>m.onItemFocus(p)),onKeyDown:At(t.onKeyDown,E=>{if(E.key==="Tab"&&E.shiftKey){m.onItemShiftTab();return}if(E.target!==E.currentTarget)return;const C=Hj(E,m.orientation,m.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=m.loop?Oj(L,T+1):L.slice(T+1)}setTimeout(()=>Gv(L))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:k!=null}):u})})},"RovingFocusGroupItem")),ez={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dj(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}zc(Dj,"getDirectionAwareKey");function Hj(e,t,n){const r=Dj(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ez[r]}zc(Hj,"getFocusIntent");function Gv(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}zc(Gv,"focusFirst");function Oj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}zc(Oj,"wrapArray");var tz=qZ,nz=JZ,rz=Object.defineProperty,Pn=(e,t)=>rz(e,"name",{value:t,configurable:!0}),G6=["Enter"," "],sz=["ArrowDown","PageUp","Home"],Ij=["ArrowUp","PageDown","End"],az=[...sz,...Ij],oz={ltr:[...G6,"ArrowRight"],rtl:[...G6,"ArrowLeft"]},iz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Pm="Menu",[sf,lz,cz]=wm(Pm),[Bc,Lm]=Vs(Pm,[cz,$l,Tj]),Yv=$l(),Fj=Tj(),[uz,Uc]=Bc(Pm),[dz,If]=Bc(Pm),fz=Pn(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:l=!0}=e,u=Yv(t),[f,h]=s.useState(null),p=s.useRef(!1),m=Sr(i),g=Lf(a);return s.useEffect(()=>{const w=Pn(()=>{p.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},"handleKeyDown"),y=Pn(()=>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=Pn(()=>m(!1),"handleBlur");return window.addEventListener("blur",w),()=>window.removeEventListener("blur",w)},[n,m]),o.jsx(Nm,{...u,children:o.jsx(uz,{scope:t,open:n,onOpenChange:m,content:f,onContentChange:h,children:o.jsx(dz,{scope:t,onClose:s.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:g,modal:l,children:r})})})},"Menu"),_j=s.forwardRef(Pn(function(t,n){const{__scopeMenu:r,...a}=t,i=Yv(r);return o.jsx(Of,{...i,...a,ref:n})},"MenuAnchor")),Vj="MenuPortal",[hz,Zj]=Bc(Vj,{forceMount:void 0}),pz=Pn(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=Uc(Vj,t);return o.jsx(hz,{scope:t,forceMount:n,children:o.jsx(hs,{present:n||i.open,children:o.jsx(Tf,{asChild:!0,container:a,children:r})})})},"MenuPortal"),Ga="MenuContent",[mz,qv]=Bc(Ga),gz=s.forwardRef(Pn(function(t,n){const r=Zj(Ga,t.__scopeMenu),{forceMount:a=r.forceMount,...i}=t,l=Uc(Ga,t.__scopeMenu),u=If(Ga,t.__scopeMenu);return o.jsx(sf.Provider,{scope:t.__scopeMenu,children:o.jsx(hs,{present:a||l.open,children:o.jsx(sf.Slot,{scope:t.__scopeMenu,children:u.modal?o.jsx(vz,{...i,ref:n}):o.jsx(wz,{...i,ref:n})})})})},"MenuContent")),vz=s.forwardRef(Pn(function(t,n){const r=Uc(Ga,t.__scopeMenu),a=s.useRef(null),i=fn(n,a);return s.useEffect(()=>{const l=a.current;if(l)return bm(l)},[]),o.jsx(Xv,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:At(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),wz=s.forwardRef(Pn(function(t,n){const r=Uc(Ga,t.__scopeMenu);return o.jsx(Xv,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),yz=Ja("MenuContent.ScrollLock"),Xv=s.forwardRef(Pn(function(t,n){const{__scopeMenu:r,loop:a=!1,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:w,onDismiss:y,disableOutsideScroll:b,...k}=t,S=Uc(Ga,r),E=If(Ga,r),C=Yv(r),A=Fj(r),L=lz(r),[T,M]=s.useState(null),j=s.useRef(null),R=fn(n,j,S.onContentChange),P=s.useRef(0),H=s.useRef(""),D=s.useRef(0),B=s.useRef(null),V=s.useRef("right"),K=s.useRef(0),U=b?Df:s.Fragment,I=b?{as:yz,allowPinchZoom:!0}:void 0,_=Pn(Y=>{var re,ee;const z=H.current+Y,q=L().filter(J=>!J.disabled),Z=document.activeElement,Q=(re=q.find(J=>J.ref.current===Z))==null?void 0:re.textValue,me=q.map(J=>J.textValue),te=qj(me,z,Q),he=(ee=q.find(J=>J.textValue===te))==null?void 0:ee.ref.current;Pn((function J(ae){H.current=ae,window.clearTimeout(P.current),ae!==""&&(P.current=window.setTimeout(()=>J(""),1e3))}),"updateSearch")(z),he&&setTimeout(()=>he.focus())},"handleTypeaheadSearch");s.useEffect(()=>()=>window.clearTimeout(P.current),[]),Nd();const O=s.useCallback(Y=>{var q,Z;return V.current===((q=B.current)==null?void 0:q.side)&&Qj(Y,(Z=B.current)==null?void 0:Z.area)},[]);return o.jsx(mz,{scope:r,searchRef:H,onItemEnter:s.useCallback(Y=>{O(Y)&&Y.preventDefault()},[O]),onItemLeave:s.useCallback(Y=>{var z;O(Y)||((z=j.current)==null||z.focus(),M(null))},[O]),onTriggerLeave:s.useCallback(Y=>{O(Y)&&Y.preventDefault()},[O]),pointerGraceTimerRef:D,onPointerGraceIntentChange:s.useCallback(Y=>{B.current=Y},[]),children:o.jsx(U,{...I,children:o.jsx(Ad,{asChild:!0,trapped:i,onMountAutoFocus:At(l,Y=>{var z;Y.preventDefault(),(z=j.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:o.jsx($f,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:w,onDismiss:y,children:o.jsx(tz,{asChild:!0,...A,dir:E.dir,orientation:"vertical",loop:a,currentTabStopId:T,onCurrentTabStopIdChange:M,onEntryFocus:At(h,Y=>{E.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Mm,{role:"menu","aria-orientation":"vertical","data-state":Jv(S.open),"data-radix-menu-content":"",dir:E.dir,...C,...k,ref:R,style:{outline:"none",...k.style},onKeyDown:At(k.onKeyDown,Y=>{const q=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,Z=Y.ctrlKey||Y.altKey||Y.metaKey,Q=Y.key.length===1;q&&(Y.key==="Tab"&&Y.preventDefault(),!Z&&Q&&_(Y.key));const me=j.current;if(Y.target!==me||!az.includes(Y.key))return;Y.preventDefault();const he=L().filter(re=>!re.disabled).map(re=>re.ref.current);Ij.includes(Y.key)&&he.reverse(),Gj(he)}),onBlur:At(t.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(P.current),H.current="")}),onPointerMove:At(t.onPointerMove,hd(Y=>{const z=Y.target,q=K.current!==Y.clientX;if(Y.currentTarget.contains(z)&&q){const Z=Y.clientX>K.current?"right":"left";V.current=Z,K.current=Y.clientX}}))})})})})})})},"MenuContentImpl")),zj=s.forwardRef(Pn(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(gn.div,{role:"group",...a,ref:n})},"MenuGroup")),bz=s.forwardRef(Pn(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(gn.div,{...a,ref:n})},"MenuLabel")),Y6="MenuItem",f5="menu.itemSelect",Qv=s.forwardRef(Pn(function(t,n){const{disabled:r=!1,onSelect:a,...i}=t,l=s.useRef(null),u=If(Y6,t.__scopeMenu),f=qv(Y6,t.__scopeMenu),h=fn(n,l),p=s.useRef(!1),m=Pn(()=>{const g=l.current;if(!r&&g){const w=new CustomEvent(f5,{bubbles:!0,cancelable:!0});g.addEventListener(f5,y=>a==null?void 0:a(y),{once:!0}),$v(g,w),w.defaultPrevented?p.current=!1:u.onClose()}},"handleSelect");return o.jsx(Bj,{...i,ref:h,disabled:r,onClick:At(t.onClick,m),onPointerDown:g=>{var w;(w=t.onPointerDown)==null||w.call(t,g),p.current=!0},onPointerUp:At(t.onPointerUp,g=>{var w;p.current||(w=g.currentTarget)==null||w.click()}),onKeyDown:At(t.onKeyDown,g=>{r||g.target!==g.currentTarget||f.searchRef.current!==""&&g.key===" "||G6.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})},"MenuItem")),Bj=s.forwardRef(Pn(function(t,n){const{__scopeMenu:r,disabled:a=!1,textValue:i,...l}=t,u=qv(Y6,r),f=Fj(r),h=s.useRef(null),p=fn(n,h),[m,g]=s.useState(!1),[w,y]=s.useState("");return s.useEffect(()=>{const b=h.current;b&&y((b.textContent??"").trim())},[l.children]),o.jsx(sf.ItemSlot,{scope:r,disabled:a,textValue:i??w,children:o.jsx(nz,{asChild:!0,...f,focusable:!a,children:o.jsx(gn.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:p,onPointerMove:At(t.onPointerMove,hd(b=>{a?u.onItemLeave(b):(u.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:At(t.onPointerLeave,hd(b=>u.onItemLeave(b))),onFocus:At(t.onFocus,()=>g(!0)),onBlur:At(t.onBlur,()=>g(!1))})})})},"MenuItemImpl")),xz=s.forwardRef(Pn(function(t,n){const{checked:r=!1,onCheckedChange:a,...i}=t;return o.jsx(Wj,{scope:t.__scopeMenu,checked:r,children:o.jsx(Qv,{role:"menuitemcheckbox","aria-checked":af(r)?"mixed":r,...i,ref:n,"data-state":$m(r),onSelect:At(i.onSelect,()=>a==null?void 0:a(af(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),kz="MenuRadioGroup",[Sz,Ez]=Bc(kz,{value:void 0,onValueChange:Pn(()=>{},"onValueChange")}),Cz=s.forwardRef(Pn(function(t,n){const{value:r,onValueChange:a,...i}=t,l=Sr(a);return o.jsx(Sz,{scope:t.__scopeMenu,value:r,onValueChange:l,children:o.jsx(zj,{...i,ref:n})})},"MenuRadioGroup")),jz="MenuRadioItem",Az=s.forwardRef(Pn(function(t,n){const{value:r,...a}=t,i=Ez(jz,t.__scopeMenu),l=r===i.value;return o.jsx(Wj,{scope:t.__scopeMenu,checked:l,children:o.jsx(Qv,{role:"menuitemradio","aria-checked":l,...a,ref:n,"data-state":$m(l),onSelect:At(a.onSelect,()=>{var u;return(u=i.onValueChange)==null?void 0:u.call(i,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Uj="MenuItemIndicator",[Wj,Nz]=Bc(Uj,{checked:!1}),Mz=s.forwardRef(Pn(function(t,n){const{__scopeMenu:r,forceMount:a,...i}=t,l=Nz(Uj,r);return o.jsx(hs,{present:a||af(l.checked)||l.checked===!0,children:o.jsx(gn.span,{...i,ref:n,"data-state":$m(l.checked)})})},"MenuItemIndicator")),Rz=s.forwardRef(Pn(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(gn.div,{role:"separator","aria-orientation":"horizontal",...a,ref:n})},"MenuSeparator")),Pz="MenuSub",[e0e,Kj]=Bc(Pz),Ah="MenuSubTrigger",Lz=s.forwardRef(Pn(function(t,n){const r=Uc(Ah,t.__scopeMenu),a=If(Ah,t.__scopeMenu),i=Kj(Ah,t.__scopeMenu),l=qv(Ah,t.__scopeMenu),u=s.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=l,p={__scopeMenu:t.__scopeMenu},m=s.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);s.useEffect(()=>m,[m]),s.useEffect(()=>{const w=f.current;return()=>{window.clearTimeout(w),h(null)}},[f,h]);const g=fn(n,i.onTriggerChange);return o.jsx(_j,{asChild:!0,...p,children:o.jsx(Bj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?i.contentId:void 0,"data-state":Jv(r.open),...t,ref:g,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:At(t.onPointerMove,hd(w=>{l.onItemEnter(w),!w.defaultPrevented&&!t.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),m()},100))})),onPointerLeave:At(t.onPointerLeave,hd(w=>{var b,k;m();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:At(t.onKeyDown,w=>{var b;t.disabled||w.target!==w.currentTarget||l.searchRef.current!==""&&w.key===" "||oz[a.dir].includes(w.key)&&(r.onOpenChange(!0),(b=r.content)==null||b.focus(),w.preventDefault())})})})},"MenuSubTrigger")),$z="MenuSubContent",Tz=s.forwardRef(Pn(function(t,n){const r=Zj(Ga,t.__scopeMenu),{forceMount:a=r.forceMount,align:i="start",...l}=t,u=Uc(Ga,t.__scopeMenu),f=If(Ga,t.__scopeMenu),h=Kj($z,t.__scopeMenu),p=s.useRef(null),m=fn(n,p);return o.jsx(sf.Provider,{scope:t.__scopeMenu,children:o.jsx(hs,{present:a||u.open,children:o.jsx(sf.Slot,{scope:t.__scopeMenu,children:o.jsx(Xv,{id:h.contentId,"aria-labelledby":h.triggerId,...l,ref:m,align:i,side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{var w;f.isUsingKeyboardRef.current&&((w=p.current)==null||w.focus()),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:At(t.onFocusOutside,g=>{g.target!==h.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:At(t.onEscapeKeyDown,g=>{f.onClose(),g.preventDefault()}),onKeyDown:At(t.onKeyDown,g=>{var b;const w=g.currentTarget.contains(g.target),y=iz[f.dir].includes(g.key);w&&y&&(u.onOpenChange(!1),(b=h.trigger)==null||b.focus(),g.preventDefault())})})})})})},"MenuSubContent"));function Jv(e){return e?"open":"closed"}Pn(Jv,"getOpenState");function af(e){return e==="indeterminate"}Pn(af,"isIndeterminate");function $m(e){return af(e)?"indeterminate":e?"checked":"unchecked"}Pn($m,"getCheckedState");function Gj(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Pn(Gj,"focusFirst");function Yj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Pn(Yj,"wrapArray");function qj(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=Yj(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}Pn(qj,"getNextMatch");function Xj(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,m=f.x,g=f.y;p>r!=g>r&&n<(m-h)*(r-p)/(g-p)+h&&(a=!a)}return a}Pn(Xj,"isPointInPolygon");function Qj(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Xj(n,t)}Pn(Qj,"isPointerInGraceArea");function hd(e){return t=>t.pointerType==="mouse"?e(t):void 0}Pn(hd,"whenMouse");var Jj=fz,eA=_j,tA=pz,nA=gz,rA=zj,sA=bz,aA=Qv,oA=xz,iA=Cz,lA=Az,cA=Mz,uA=Rz,dA=Lz,fA=Tz,Dz=Object.defineProperty,Qr=(e,t)=>Dz(e,"name",{value:t,configurable:!0}),ew="ContextMenu",[Hz,t0e]=Vs(ew,[Lm]),Zs=Lm(),[Oz,hA]=Hz(ew),Iz=Qr(e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,dir:i,modal:l=!0}=e,u=s.useRef(!1),[f,h]=gi({prop:a,defaultProp:!1,onChange:r,caller:ew}),p=Zs(t);return o.jsx(Oz,{scope:t,open:f,onOpenChange:h,modal:l,hasInteractedRef:u,children:o.jsx(Jj,{...p,dir:i,open:f,onOpenChange:h,modal:l,children:n})})},"ContextMenu"),Fz="ContextMenuTrigger",_z=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,disabled:a=!1,...i}=t,l=hA(Fz,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]),m=s.useRef(0),g=s.useCallback(()=>window.clearTimeout(m.current),[]),w=Qr(y=>{l.hasInteractedRef.current=!0,h({x:y.clientX,y:y.clientY}),l.onOpenChange(!0)},"handleOpen");return s.useEffect(()=>g,[g]),s.useEffect(()=>void(a&&g()),[a,g]),o.jsxs(o.Fragment,{children:[o.jsx(eA,{...u,virtualRef:p}),o.jsx(gn.span,{"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,...i,ref:n,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:a?t.onContextMenu:At(t.onContextMenu,y=>{g(),w(y),y.preventDefault()}),onPointerDown:a?t.onPointerDown:At(t.onPointerDown,R0(y=>{g(),l.open&&l.onOpenChange(!1),m.current=window.setTimeout(()=>w(y),700)})),onPointerMove:a?t.onPointerMove:At(t.onPointerMove,R0(g)),onPointerCancel:a?t.onPointerCancel:At(t.onPointerCancel,R0(g)),onPointerUp:a?t.onPointerUp:At(t.onPointerUp,R0(g))})]})},"ContextMenuTrigger")),Vz=Qr(e=>{const{__scopeContextMenu:t,...n}=e,r=Zs(t);return o.jsx(tA,{...r,...n})},"ContextMenuPortal"),Zz="ContextMenuContent",zz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=hA(Zz,r),l=Zs(r),u=s.useRef(!1);return o.jsx(nA,{...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")),Bz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(rA,{...i,...a,ref:n})},"ContextMenuGroup")),Uz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(sA,{...i,...a,ref:n})},"ContextMenuLabel")),Wz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(aA,{...i,...a,ref:n})},"ContextMenuItem")),Kz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(oA,{...i,...a,ref:n})},"ContextMenuCheckboxItem")),Gz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(iA,{...i,...a,ref:n})},"ContextMenuRadioGroup")),Yz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(lA,{...i,...a,ref:n})},"ContextMenuRadioItem")),qz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(cA,{...i,...a,ref:n})},"ContextMenuItemIndicator")),Xz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(uA,{...i,...a,ref:n})},"ContextMenuSeparator")),Qz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(dA,{...i,...a,ref:n})},"ContextMenuSubTrigger")),Jz=s.forwardRef(Qr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Zs(r);return o.jsx(fA,{...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 R0(e){return t=>t.pointerType!=="mouse"?e(t):void 0}Qr(R0,"whenTouchOrPen");var eB=Iz,tB=_z,pA=Vz,nB=zz,rB=Bz,sB=Uz,aB=Wz,oB=Kz,iB=Gz,lB=Yz,mA=qz,cB=Xz,uB=Qz,dB=Jz,fB=Object.defineProperty,zs=(e,t)=>fB(e,"name",{value:t,configurable:!0}),tw="DropdownMenu",[hB,n0e]=Vs(tw,[Lm]),Bs=Lm(),[pB,gA]=hB(tw),mB=zs(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,f=Bs(t),h=s.useRef(null),[p,m]=gi({prop:a,defaultProp:i??!1,onChange:l,caller:tw});return o.jsx(pB,{scope:t,triggerId:Ca(),triggerRef:h,contentId:Ca(),open:p,onOpenChange:m,onOpenToggle:s.useCallback(()=>m(g=>!g),[m]),modal:u,children:o.jsx(Jj,{...f,open:p,onOpenChange:m,dir:r,modal:u,children:n})})},"DropdownMenu"),gB="DropdownMenuTrigger",vB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,disabled:a=!1,...i}=t,l=gA(gB,r),u=Bs(r),f=fn(n,l.triggerRef);return o.jsx(eA,{asChild:!0,...u,children:o.jsx(gn.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:At(t.onPointerDown,h=>{!a&&h.button===0&&h.ctrlKey===!1&&(l.onOpenToggle(),l.open||h.preventDefault())}),onKeyDown:At(t.onKeyDown,h=>{a||(["Enter"," "].includes(h.key)&&l.onOpenToggle(),h.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})},"DropdownMenuTrigger")),wB=zs(e=>{const{__scopeDropdownMenu:t,...n}=e,r=Bs(t);return o.jsx(tA,{...r,...n})},"DropdownMenuPortal"),yB="DropdownMenuContent",bB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=gA(yB,r),l=Bs(r),u=s.useRef(!1);return o.jsx(nA,{id:i.contentId,"aria-labelledby":i.triggerId,...l,...a,ref:n,onCloseAutoFocus:At(t.onCloseAutoFocus,f=>{var h;u.current||(h=i.triggerRef.current)==null||h.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:At(t.onInteractOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,m=h.button===2||p;(!i.modal||m)&&(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")),xB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(rA,{...i,...a,ref:n})},"DropdownMenuGroup")),kB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(sA,{...i,...a,ref:n})},"DropdownMenuLabel")),SB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(aA,{...i,...a,ref:n})},"DropdownMenuItem")),EB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(oA,{...i,...a,ref:n})},"DropdownMenuCheckboxItem")),CB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(iA,{...i,...a,ref:n})},"DropdownMenuRadioGroup")),jB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(lA,{...i,...a,ref:n})},"DropdownMenuRadioItem")),AB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(cA,{...i,...a,ref:n})},"DropdownMenuItemIndicator")),NB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(uA,{...i,...a,ref:n})},"DropdownMenuSeparator")),MB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(dA,{...i,...a,ref:n})},"DropdownMenuSubTrigger")),RB=s.forwardRef(zs(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Bs(r);return o.jsx(fA,{...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")),PB=mB,LB=vB,vA=wB,$B=bB,TB=xB,DB=kB,HB=SB,OB=EB,IB=CB,FB=jB,wA=AB,_B=NB,VB=MB,ZB=RB,zB=Object.defineProperty,BB=(e,t)=>zB(e,"name",{value:t,configurable:!0});function yA(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])}BB(yA,"usePrevious");var UB=Object.defineProperty,WB=(e,t)=>UB(e,"name",{value:t,configurable:!0});function yp(e,[t,n]){return Math.min(n,Math.max(t,e))}WB(yp,"clamp");var KB=Object.defineProperty,Fo=(e,t)=>KB(e,"name",{value:t,configurable:!0}),nw="Popover",[bA,r0e]=Vs(nw,[$l]),Tm=$l(),[GB,Tl]=bA(nw),YB=Fo(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!1}=e,u=Tm(t),f=s.useRef(null),[h,p]=s.useState(!1),[m,g]=gi({prop:r,defaultProp:a??!1,onChange:i,caller:nw});return o.jsx(Nm,{...u,children:o.jsx(GB,{scope:t,contentId:Ca(),triggerRef:f,open:m,onOpenChange:g,onOpenToggle:s.useCallback(()=>g(w=>!w),[g]),hasCustomAnchor:h,onCustomAnchorAdd:s.useCallback(()=>p(!0),[]),onCustomAnchorRemove:s.useCallback(()=>p(!1),[]),modal:l,children:n})})},"Popover"),qB="PopoverAnchor",XB=s.forwardRef(Fo(function(t,n){const{__scopePopover:r,...a}=t,i=Tl(qB,r),l=Tm(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=i;return s.useEffect(()=>(u(),()=>f()),[u,f]),o.jsx(Of,{...l,...a,ref:n})},"PopoverAnchor")),QB="PopoverTrigger",JB=s.forwardRef(Fo(function(t,n){const{__scopePopover:r,...a}=t,i=Tl(QB,r),l=Tm(r),u=fn(n,i.triggerRef),f=o.jsx(gn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":rw(i.open),...a,ref:u,onClick:At(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?f:o.jsx(Of,{asChild:!0,...l,children:f})},"PopoverTrigger")),xA="PopoverPortal",[eU,tU]=bA(xA,{forceMount:void 0}),nU=Fo(e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=Tl(xA,t);return o.jsx(eU,{scope:t,forceMount:n,children:o.jsx(hs,{present:n||i.open,children:o.jsx(Tf,{asChild:!0,container:a,children:r})})})},"PopoverPortal"),of="PopoverContent",rU=s.forwardRef(Fo(function(t,n){const r=tU(of,t.__scopePopover),{forceMount:a=r.forceMount,...i}=t,l=Tl(of,t.__scopePopover);return o.jsx(hs,{present:a||l.open,children:l.modal?o.jsx(aU,{...i,ref:n}):o.jsx(oU,{...i,ref:n})})},"PopoverContent")),sU=Ja("PopoverContent.RemoveScroll"),aU=s.forwardRef(Fo(function(t,n){const r=Tl(of,t.__scopePopover),a=s.useRef(null),i=fn(n,a),l=s.useRef(!1);return s.useEffect(()=>{const u=a.current;if(u)return bm(u)},[]),o.jsx(Df,{as:sU,allowPinchZoom:!0,children:o.jsx(kA,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:At(t.onCloseAutoFocus,u=>{var f;u.preventDefault(),l.current||(f=r.triggerRef.current)==null||f.focus()}),onPointerDownOutside:At(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:At(t.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),oU=s.forwardRef(Fo(function(t,n){const r=Tl(of,t.__scopePopover),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(kA,{...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")),kA=s.forwardRef(Fo(function(t,n){const{__scopePopover:r,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:m,...g}=t,w=Tl(of,r),y=Tm(r);return Nd(),o.jsx(Ad,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx($f,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:m,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>w.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(Mm,{"data-state":rw(w.open),role:"dialog",id:w.contentId,...y,...g,ref:n,style:{...g.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")),iU="PopoverClose",lU=s.forwardRef(Fo(function(t,n){const{__scopePopover:r,...a}=t,i=Tl(iU,r);return o.jsx(gn.button,{type:"button",...a,ref:n,onClick:At(t.onClick,()=>i.onOpenChange(!1))})},"PopoverClose"));function rw(e){return e?"open":"closed"}Fo(rw,"getState");var cU=YB,uU=XB,dU=JB,fU=nU,hU=rU,pU=lU,mU=Object.defineProperty,En=(e,t)=>mU(e,"name",{value:t,configurable:!0});function SA(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}En(SA,"useStateMachine");var EA="ScrollArea",[CA,s0e]=Vs(EA),[gU,La]=CA(EA),vU=s.forwardRef(En(function(t,n){const{__scopeScrollArea:r,type:a="hover",dir:i,scrollHideDelay:l=600,...u}=t,[f,h]=s.useState(null),[p,m]=s.useState(null),[g,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,R]=s.useState(!1),P=fn(n,h),H=Lf(i);return o.jsx(gU,{scope:r,type:a,dir:H,scrollHideDelay:l,scrollArea:f,viewport:p,onViewportChange:m,content:g,onContentChange:w,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:T,onScrollbarXEnabledChange:M,scrollbarY:k,onScrollbarYChange:S,scrollbarYEnabled:j,onScrollbarYEnabledChange:R,onCornerWidthChange:C,onCornerHeightChange:L,children:o.jsx(gn.div,{dir:H,...u,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})},"ScrollArea")),wU="ScrollAreaViewport",yU=s.forwardRef(En(function(t,n){const{__scopeScrollArea:r,children:a,nonce:i,...l}=t,u=La(wU,r),f=s.useRef(null),h=fn(n,f,u.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx(bU,{nonce:i}),o.jsx(gn.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")),bU=s.memo(En(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),Ai="ScrollAreaScrollbar",xU=s.forwardRef(En(function(t,n){const{forceMount:r,...a}=t,i=La(Ai,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(kU,{...a,ref:n,forceMount:r}):i.type==="scroll"?o.jsx(SU,{...a,ref:n,forceMount:r}):i.type==="auto"?o.jsx(jA,{...a,ref:n,forceMount:r}):i.type==="always"?o.jsx(sw,{...a,ref:n,"data-state":"visible"}):null},"ScrollAreaScrollbar")),kU=s.forwardRef(En(function(t,n){const{forceMount:r,...a}=t,i=La(Ai,t.__scopeScrollArea),[l,u]=s.useState(!1);return s.useEffect(()=>{const f=i.scrollArea;let h=0;if(f){const p=En(()=>{window.clearTimeout(h),u(!0)},"handlePointerEnter"),m=En(()=>{h=window.setTimeout(()=>u(!1),i.scrollHideDelay)},"handlePointerLeave");return f.addEventListener("pointerenter",p),f.addEventListener("pointerleave",m),()=>{window.clearTimeout(h),f.removeEventListener("pointerenter",p),f.removeEventListener("pointerleave",m)}}},[i.scrollArea,i.scrollHideDelay]),o.jsx(hs,{present:r||l,children:o.jsx(jA,{"data-state":l?"visible":"hidden",...a,ref:n})})},"ScrollAreaScrollbarHover")),SU=s.forwardRef(En(function(t,n){const{forceMount:r,...a}=t,i=La(Ai,t.__scopeScrollArea),l=t.orientation==="horizontal",u=_f(()=>h("SCROLL_END"),100),[f,h]=SA("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,m=l?"scrollLeft":"scrollTop";if(p){let g=p[m];const w=En(()=>{const y=p[m];g!==y&&(h("SCROLL"),u()),g=y},"handleScroll");return p.addEventListener("scroll",w),()=>p.removeEventListener("scroll",w)}},[i.viewport,l,h,u]),o.jsx(hs,{present:r||f!=="hidden",children:o.jsx(sw,{"data-state":f==="hidden"?"hidden":"visible",...a,ref:n,onPointerEnter:At(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:At(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),jA=s.forwardRef(En(function(t,n){const r=La(Ai,t.__scopeScrollArea),{forceMount:a,...i}=t,[l,u]=s.useState(!1),f=t.orientation==="horizontal",h=_f(()=>{if(r.viewport){const p=r.viewport.offsetWidth<r.viewport.scrollWidth,m=r.viewport.offsetHeight<r.viewport.scrollHeight;u(f?p:m)}},10);return Nc(r.viewport,h),Nc(r.content,h),o.jsx(hs,{present:a||l,children:o.jsx(sw,{"data-state":l?"visible":"hidden",...i,ref:n})})},"ScrollAreaScrollbarAuto")),sw=s.forwardRef(En(function(t,n){const{orientation:r="vertical",...a}=t,i=La(Ai,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=aw(f.viewport,f.content),m={...a,sizes:f,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:En(w=>l.current=w,"onThumbChange"),onThumbPointerUp:En(()=>u.current=0,"onThumbPointerUp"),onThumbPointerDown:En(w=>u.current=w,"onThumbPointerDown")};function g(w,y){return RA(w,u.current,f,y)}return En(g,"getScrollPosition"),r==="horizontal"?o.jsx(EU,{...m,ref:n,onThumbPositionChange:()=>{if(i.viewport&&l.current){const w=i.viewport.scrollLeft,y=X6(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=g(w,i.dir))}}):r==="vertical"?o.jsx(CU,{...m,ref:n,onThumbPositionChange:()=>{if(i.viewport&&l.current){const w=i.viewport.scrollTop,y=X6(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=g(w))}}):null},"ScrollAreaScrollbarVisible")),EU=s.forwardRef(En(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,l=La(Ai,t.__scopeScrollArea),[u,f]=s.useState(),h=s.useRef(null),p=fn(n,h,l.onScrollbarXChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(NA,{"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":Ff(r)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,g)=>{if(l.viewport){const w=l.viewport.scrollLeft+m.deltaX;t.onWheelScroll(w),iw(w,g)&&m.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&a({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:lf(u.paddingLeft),paddingEnd:lf(u.paddingRight)}})}})},"ScrollAreaScrollbarX")),CU=s.forwardRef(En(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,l=La(Ai,t.__scopeScrollArea),[u,f]=s.useState(),h=s.useRef(null),p=fn(n,h,l.onScrollbarYChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(NA,{"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":Ff(r)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,g)=>{if(l.viewport){const w=l.viewport.scrollTop+m.deltaY;t.onWheelScroll(w),iw(w,g)&&m.preventDefault()}},onResize:()=>{h.current&&l.viewport&&u&&a({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:lf(u.paddingTop),paddingEnd:lf(u.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[jU,AA]=CA(Ai),NA=s.forwardRef(En(function(t,n){const{__scopeScrollArea:r,sizes:a,hasThumb:i,onThumbChange:l,onThumbPointerUp:u,onThumbPointerDown:f,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:m,onResize:g,...w}=t,y=La(Ai,r),[b,k]=s.useState(null),S=fn(n,k),E=s.useRef(null),C=s.useRef(""),A=y.viewport,L=a.content-a.viewport,T=Sr(m),M=Sr(h),j=_f(g,10);function R(P){if(E.current){const H=P.clientX-E.current.left,D=P.clientY-E.current.top;p({x:H,y:D})}}return En(R,"handleDragScroll"),s.useEffect(()=>{const P=En(H=>{const D=H.target;(b==null?void 0:b.contains(D))&&T(H,L)},"handleWheel");return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[A,b,L,T]),s.useEffect(M,[a,M]),Nc(b,j),Nc(y.content,j),o.jsx(jU,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:Sr(l),onThumbPointerUp:Sr(u),onThumbPositionChange:M,onThumbPointerDown:Sr(f),children:o.jsx(gn.div,{...w,ref:S,style:{position:"absolute",...w.style},onPointerDown:At(t.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),E.current=b.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),R(P))}),onPointerMove:At(t.onPointerMove,R),onPointerUp:At(t.onPointerUp,P=>{const H=P.target;H.hasPointerCapture(P.pointerId)&&H.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=C.current,y.viewport&&(y.viewport.style.scrollBehavior=""),E.current=null})})})},"ScrollAreaScrollbarImpl")),q6="ScrollAreaThumb",AU=s.forwardRef(En(function(t,n){const{forceMount:r,...a}=t,i=AA(q6,t.__scopeScrollArea);return o.jsx(hs,{present:r||i.hasThumb,children:o.jsx(NU,{ref:n,...a})})},"ScrollAreaThumb")),NU=s.forwardRef(En(function(t,n){const{__scopeScrollArea:r,style:a,...i}=t,l=La(q6,r),u=AA(q6,r),{onThumbPositionChange:f}=u,h=fn(n,u.onThumbChange),p=s.useRef(void 0),m=_f(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const g=l.viewport;if(g){const w=En(()=>{if(m(),!p.current){const y=PU(g,f);p.current=y,f()}},"handleScroll");return f(),g.addEventListener("scroll",w),()=>g.removeEventListener("scroll",w)}},[l.viewport,m,f]),o.jsx(gn.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:At(t.onPointerDownCapture,g=>{const y=g.target.getBoundingClientRect(),b=g.clientX-y.left,k=g.clientY-y.top;u.onThumbPointerDown({x:b,y:k})}),onPointerUp:At(t.onPointerUp,u.onThumbPointerUp)})},"ScrollAreaThumbImpl")),MA="ScrollAreaCorner",MU=s.forwardRef(En(function(t,n){const r=La(MA,t.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(RU,{...t,ref:n}):null},"ScrollAreaCorner")),RU=s.forwardRef(En(function(t,n){const{__scopeScrollArea:r,...a}=t,i=La(MA,r),[l,u]=s.useState(0),[f,h]=s.useState(0),p=!!(l&&f),{onCornerWidthChange:m,onCornerHeightChange:g}=i;return Nc(i.scrollbarX,()=>{var y;const w=((y=i.scrollbarX)==null?void 0:y.offsetHeight)||0;i.onCornerHeightChange(w),h(w)}),Nc(i.scrollbarY,()=>{var y;const w=((y=i.scrollbarY)==null?void 0:y.offsetWidth)||0;i.onCornerWidthChange(w),u(w)}),s.useEffect(()=>()=>{m(0),g(0)},[m,g]),p?o.jsx(gn.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 lf(e){return e?parseInt(e,10):0}En(lf,"toInt");function aw(e,t){const n=e/t;return isNaN(n)?0:n}En(aw,"getThumbRatio");function Ff(e){const t=aw(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}En(Ff,"getThumbSize");function RA(e,t,n,r="ltr"){const a=Ff(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,m=r==="ltr"?[0,p]:[p*-1,0];return ow([f,h],m)(e)}En(RA,"getScrollPositionFromPointer");function X6(e,t,n="ltr"){const r=Ff(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=yp(e,f);return ow([0,l],[0,u])(h)}En(X6,"getThumbOffsetFromScroll");function ow(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])}}En(ow,"linearScale");function iw(e,t){return e>0&&e<t}En(iw,"isScrollingWithinScrollbarBounds");var PU=En((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return En((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 _f(e,t){const n=Sr(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])}En(_f,"useDebounceCallback");function Nc(e,t){const n=Sr(t);Cr(()=>{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])}En(Nc,"useResizeObserver");var PA=vU,LA=yU,Q6=xU,J6=AU,LU=MU,$U=Object.defineProperty,Vn=(e,t)=>$U(e,"name",{value:t,configurable:!0}),TU=[" ","Enter","ArrowUp","ArrowDown"],DU=[" ","Enter"],pd="Select",[Dm,lw,HU]=wm(pd),[Wc,a0e]=Vs(pd,[HU,$l]),cw=$l(),[OU,Dl]=Wc(pd),[IU,FU]=Wc(pd);function $A(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:l,defaultValue:u,onValueChange:f,dir:h,name:p,autoComplete:m,disabled:g,required:w,form:y,internal_do_not_use_render:b}=e,k=cw(t),[S,E]=s.useState(null),[C,A]=s.useState(null),[L,T]=s.useState(!1),M=Lf(h),[j,R]=gi({prop:r,defaultProp:a??!1,onChange:i,caller:pd}),[P,H]=gi({prop:l,defaultProp:u,onChange:f,caller:pd}),D=s.useRef(null),B=s.useRef(P);s.useEffect(()=>{const q=y?S==null?void 0:S.ownerDocument.getElementById(y):S==null?void 0:S.form;if(q instanceof HTMLFormElement){const Z=Vn(()=>H(B.current),"reset");return q.addEventListener("reset",Z),()=>q.removeEventListener("reset",Z)}},[y,S,H]);const V=S?!!y||!!S.closest("form"):!0,[K,U]=s.useState(new Set),I=Ca(),_=Array.from(K).map(q=>q.props.value).join(";"),O=s.useCallback(q=>{U(Z=>new Set(Z).add(q))},[]),Y=s.useCallback(q=>{U(Z=>{const Q=new Set(Z);return Q.delete(q),Q})},[]),z={required:w,trigger:S,onTriggerChange:E,valueNode:C,onValueNodeChange:A,valueNodeHasChildren:L,onValueNodeHasChildrenChange:T,contentId:I,value:P,onValueChange:H,open:j,onOpenChange:R,dir:M,triggerPointerDownPosRef:D,disabled:g,name:p,autoComplete:m,form:y,nativeOptions:K,nativeSelectKey:_,isFormControl:V};return o.jsx(Nm,{...k,children:o.jsx(OU,{scope:t,...z,children:o.jsx(Dm.Provider,{scope:t,children:o.jsx(IU,{scope:t,onNativeOptionAdd:O,onNativeOptionRemove:Y,children:HA(b)?b(z):n})})})})}Vn($A,"SelectProvider");var _U=Vn(e=>{const{__scopeSelect:t,children:n,...r}=e;return o.jsx($A,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:a})=>o.jsxs(o.Fragment,{children:[n,a?o.jsx(vW,{__scopeSelect:t}):null]})})},"Select"),VU="SelectTrigger",ZU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,disabled:a=!1,...i}=t,l=cw(r),u=Dl(VU,r),f=u.disabled||a,h=fn(n,u.onTriggerChange),p=lw(r),m=s.useRef("touch"),[g,w,y]=uw(k=>{const S=p().filter(A=>!A.disabled),E=S.find(A=>A.value===u.value),C=dw(S,k,E);C!==void 0&&u.onValueChange(C.value)}),b=Vn(k=>{f||(u.onOpenChange(!0),y()),k&&(u.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})},"handleOpen");return o.jsx(Of,{asChild:!0,...l,children:o.jsx(gn.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":Vf(u.value)?"":void 0,...i,ref:h,onClick:At(i.onClick,k=>{k.currentTarget.focus(),m.current!=="mouse"&&b(k)}),onPointerDown:At(i.onPointerDown,k=>{m.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:At(i.onKeyDown,k=>{const S=g.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&w(k.key),!(S&&k.key===" ")&&TU.includes(k.key)&&(b(),k.preventDefault())})})})},"SelectTrigger")),zU="SelectValue",BU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,className:a,style:i,children:l,placeholder:u="",...f}=t,h=Dl(zU,r),{onValueNodeHasChildrenChange:p}=h,m=l!==void 0,g=fn(n,h.onValueNodeChange);Cr(()=>{p(m)},[p,m]);const w=Vf(h.value);return o.jsx(gn.span,{...f,asChild:w?!1:f.asChild,ref:g,style:{pointerEvents:"none"},children:o.jsx(s.Fragment,{children:w?u:l},w?"placeholder":"value")})},"SelectValue")),UU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,children:a,...i}=t;return o.jsx(gn.span,{"aria-hidden":!0,...i,ref:n,children:a||"▼"})},"SelectIcon")),WU="SelectPortal",[KU,GU]=Wc(WU,{forceMount:void 0}),YU=Vn(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return o.jsx(KU,{scope:e.__scopeSelect,forceMount:n,children:o.jsx(Tf,{asChild:!0,...r})})},"SelectPortal"),Mc="SelectContent",qU=s.forwardRef(Vn(function(t,n){const r=GU(Mc,t.__scopeSelect),{forceMount:a=r.forceMount,...i}=t,l=Dl(Mc,t.__scopeSelect),[u,f]=s.useState();return Cr(()=>{f(new DocumentFragment)},[]),o.jsx(hs,{present:a||l.open,children:({present:h})=>h?o.jsx(JU,{...i,ref:n}):o.jsx(XU,{...i,fragment:u})})},"SelectContent")),XU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,children:a,fragment:i}=t;return i?Br.createPortal(o.jsx(TA,{scope:r,children:o.jsx(Dm.Slot,{scope:r,children:o.jsx("div",{ref:n,children:a})})}),i):null},"SelectContentFragment")),Ba=10,[TA,Hm]=Wc(Mc),QU=Ja("SelectContent.RemoveScroll"),JU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r}=t,{position:a="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:u,side:f,sideOffset:h,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:b,hideWhenDetached:k,avoidCollisions:S,...E}=t,C=Dl(Mc,r),[A,L]=s.useState(null),[T,M]=s.useState(null),j=fn(n,L),[R,P]=s.useState(null),[H,D]=s.useState(null),B=lw(r),[V,K]=s.useState(!1),U=s.useRef(!1);s.useEffect(()=>{if(A)return bm(A)},[A]),Nd();const I=s.useCallback(re=>{const[ee,...J]=B().map(ue=>ue.ref.current),[ae]=J.slice(-1),Me=document.activeElement;for(const ue of re)if(ue===Me||(ue==null||ue.scrollIntoView({block:"nearest"}),ue===ee&&T&&(T.scrollTop=0),ue===ae&&T&&(T.scrollTop=T.scrollHeight),ue==null||ue.focus(),document.activeElement!==Me))return},[B,T]),_=s.useCallback(()=>I([R,A]),[I,R,A]);s.useEffect(()=>{V&&_()},[V,_]);const{onOpenChange:O,triggerPointerDownPosRef:Y}=C;s.useEffect(()=>{if(A){let re={x:0,y:0};const ee=Vn(ae=>{var Me,ue;re={x:Math.abs(Math.round(ae.pageX)-(((Me=Y.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((ue=Y.current)==null?void 0:ue.y)??0))}},"handlePointerMove"),J=Vn(ae=>{re.x<=10&&re.y<=10?ae.preventDefault():ae.composedPath().includes(A)||O(!1),document.removeEventListener("pointermove",ee),Y.current=null},"handlePointerUp");return Y.current!==null&&(document.addEventListener("pointermove",ee),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ee),document.removeEventListener("pointerup",J,{capture:!0})}}},[A,O,Y]),s.useEffect(()=>{const re=Vn(()=>O(!1),"close");return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[O]);const[z,q]=uw(re=>{const ee=B().filter(Me=>!Me.disabled),J=ee.find(Me=>Me.ref.current===document.activeElement),ae=dw(ee,re,J);ae&&setTimeout(()=>{var Me;return(Me=ae.ref.current)==null?void 0:Me.focus()})}),Z=s.useCallback((re,ee,J)=>{const ae=!U.current&&!J;(C.value!==void 0&&C.value===ee||ae)&&(P(re),ae&&(U.current=!0))},[C.value]),Q=s.useCallback(()=>A==null?void 0:A.focus(),[A]),me=s.useCallback((re,ee,J)=>{const ae=!U.current&&!J;(C.value!==void 0&&C.value===ee||ae)&&D(re)},[C.value]),te=a==="popper"?h5:eW,he=te===h5?{side:f,sideOffset:h,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:b,hideWhenDetached:k,avoidCollisions:S}:{};return o.jsx(TA,{scope:r,content:A,viewport:T,onViewportChange:M,itemRefCallback:Z,selectedItem:R,onItemLeave:Q,itemTextRefCallback:me,focusSelectedItem:_,selectedItemText:H,position:a,isPositioned:V,searchRef:z,children:o.jsx(Df,{as:QU,allowPinchZoom:!0,children:o.jsx(Ad,{asChild:!0,trapped:C.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:At(i,re=>{var ee;(ee=C.trigger)==null||ee.focus({preventScroll:!0}),re.preventDefault()}),children:o.jsx($f,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:o.jsx(te,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:re=>re.preventDefault(),...E,...he,onPlaced:()=>K(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:At(E.onKeyDown,re=>{const ee=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ee&&re.key.length===1&&q(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let ae=B().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(re.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Me=re.target,ue=ae.indexOf(Me);ae=ae.slice(ue+1)}setTimeout(()=>I(ae)),re.preventDefault()}})})})})})})},"SelectContentImpl")),eW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,onPlaced:a,...i}=t,l=Dl(Mc,r),u=Hm(Mc,r),[f,h]=s.useState(null),[p,m]=s.useState(null),g=fn(n,m),w=lw(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(),R=p.getBoundingClientRect(),P=l.valueNode.getBoundingClientRect(),H=E.getBoundingClientRect();if(l.dir!=="rtl"){const Me=H.left-R.left,ue=P.left-Me,Se=j.left-ue,Be=j.width+Se,vt=Math.max(Be,R.width),Ue=window.innerWidth-Ba,Xe=yp(ue,[Ba,Math.max(Ba,Ue-vt)]);f.style.minWidth=Be+"px",f.style.left=Xe+"px"}else{const Me=R.right-H.right,ue=window.innerWidth-P.right-Me,Se=window.innerWidth-j.right-ue,Be=j.width+Se,vt=Math.max(Be,R.width),Ue=window.innerWidth-Ba,Xe=yp(ue,[Ba,Math.max(Ba,Ue-vt)]);f.style.minWidth=Be+"px",f.style.right=Xe+"px"}const D=w(),B=window.innerHeight-Ba*2,V=k.scrollHeight,K=window.getComputedStyle(p),U=parseInt(K.borderTopWidth,10),I=parseInt(K.paddingTop,10),_=parseInt(K.borderBottomWidth,10),O=parseInt(K.paddingBottom,10),Y=U+I+V+O+_,z=Math.min(S.offsetHeight*5,Y),q=window.getComputedStyle(k),Z=parseInt(q.paddingTop,10),Q=parseInt(q.paddingBottom,10),me=j.top+j.height/2-Ba,te=B-me,he=S.offsetHeight/2,re=S.offsetTop+he,ee=U+I+re,J=Y-ee;if(ee<=me){const Me=D.length>0&&S===D[D.length-1].ref.current;f.style.bottom="0px";const ue=p.clientHeight-k.offsetTop-k.offsetHeight,Se=Math.max(te,he+(Me?Q:0)+ue+_),Be=ee+Se;f.style.height=Be+"px"}else{const Me=D.length>0&&S===D[0].ref.current;f.style.top="0px";const Se=Math.max(me,U+k.offsetTop+(Me?Z:0)+he)+J;f.style.height=Se+"px",k.scrollTop=ee-me+k.offsetTop}f.style.margin=`${Ba}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]);Cr(()=>A(),[A]);const[L,T]=s.useState();Cr(()=>{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(tW,{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(gn.div,{...i,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),h5=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,align:a="start",collisionPadding:i=Ba,...l}=t,u=cw(r);return o.jsx(Mm,{...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")),[tW,nW]=Wc(Mc,{}),p5="SelectViewport",rW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,nonce:a,...i}=t,l=Hm(p5,r),u=nW(p5,r),f=fn(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(Dm.Slot,{scope:r,children:o.jsx(gn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:At(i.onScroll,p=>{const m=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=u;if(w!=null&&w.current&&g){const y=Math.abs(h.current-m.scrollTop);if(y>0){const b=window.innerHeight-Ba*2,k=parseFloat(g.style.minHeight),S=parseFloat(g.style.height),E=Math.max(k,S);if(E<b){const C=E+y,A=Math.min(b,C),L=C-A;g.style.height=A+"px",g.style.bottom==="0px"&&(m.scrollTop=L>0?L:0,g.style.justifyContent="flex-end")}}}h.current=m.scrollTop})})})]})},"SelectViewport")),sW="SelectGroup",[aW,oW]=Wc(sW),iW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t,i=Ca();return o.jsx(aW,{scope:r,id:i,children:o.jsx(gn.div,{role:"group","aria-labelledby":i,...a,ref:n})})},"SelectGroup")),lW="SelectLabel",cW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t,i=oW(lW,r);return o.jsx(gn.div,{id:i.id,...a,ref:n})},"SelectLabel")),e4="SelectItem",[uW,DA]=Wc(e4),dW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,value:a,disabled:i=!1,textValue:l,...u}=t,f=Dl(e4,r),h=Hm(e4,r),p=f.value===a,[m,g]=s.useState(l??""),[w,y]=s.useState(!1),b=Sr(A=>{var L;return(L=h.itemRefCallback)==null?void 0:L.call(h,A,a,i)}),k=fn(n,b),S=Ca(),E=s.useRef("touch"),C=Vn(()=>{i||(f.onValueChange(a),f.onOpenChange(!1))},"handleSelect");return o.jsx(uW,{scope:r,value:a,disabled:i,textId:S,isSelected:p,onItemTextChange:s.useCallback(A=>{g(L=>L||((A==null?void 0:A.textContent)??"").trim())},[]),children:o.jsx(Dm.ItemSlot,{scope:r,value:a,disabled:i,textValue:m,children:o.jsx(gn.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:At(u.onFocus,()=>y(!0)),onBlur:At(u.onBlur,()=>y(!1)),onClick:At(u.onClick,()=>{E.current!=="mouse"&&C()}),onPointerUp:At(u.onPointerUp,()=>{E.current==="mouse"&&C()}),onPointerDown:At(u.onPointerDown,A=>{E.current=A.pointerType}),onPointerMove:At(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:At(u.onPointerLeave,A=>{var L;A.currentTarget===document.activeElement&&((L=h.onItemLeave)==null||L.call(h))}),onKeyDown:At(u.onKeyDown,A=>{var T;i||A.target!==A.currentTarget||((T=h.searchRef)==null?void 0:T.current)!==""&&A.key===" "||(DU.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})},"SelectItem")),Nh="SelectItemText",fW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,className:a,style:i,...l}=t,u=Dl(Nh,r),f=Hm(Nh,r),h=DA(Nh,r),p=FU(Nh,r),[m,g]=s.useState(null),w=Sr(C=>{var A;return(A=f.itemTextRefCallback)==null?void 0:A.call(f,C,h.value,h.disabled)}),y=fn(n,g,h.onItemTextChange,w),b=m==null?void 0:m.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 Cr(()=>(S(k),()=>E(k)),[S,E,k]),o.jsxs(o.Fragment,{children:[o.jsx(gn.span,{id:h.textId,...l,ref:y}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Vf(u.value)?Br.createPortal(l.children,u.valueNode):null]})},"SelectItemText")),hW="SelectItemIndicator",pW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t;return DA(hW,r).isSelected?o.jsx(gn.span,{"aria-hidden":!0,...a,ref:n}):null},"SelectItemIndicator")),mW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t;return o.jsx(gn.div,{"aria-hidden":!0,...a,ref:n})},"SelectSeparator")),gW="SelectBubbleInput",vW=s.forwardRef(Vn(function({__scopeSelect:t,...n},r){const a=Dl(gW,t),{value:i,onValueChange:l,required:u,disabled:f,name:h,autoComplete:p,form:m}=a,{nativeOptions:g,nativeSelectKey:w}=a,y=s.useRef(null),b=fn(r,y),k=i??"",S=yA(k),E=Array.from(g).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(gn.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:h,autoComplete:p,disabled:f,form:m,onChange:C=>l(C.target.value),...n,style:{...yC,...n.style},ref:b,defaultValue:k,children:[Vf(i)&&!E?o.jsx("option",{value:""}):null,Array.from(g)]},w)},"SelectBubbleInput"));function HA(e){return typeof e=="function"}Vn(HA,"isFunction");function Vf(e){return e===""||e===void 0}Vn(Vf,"shouldShowPlaceholder");function uw(e){const t=Sr(e),n=s.useRef(""),r=s.useRef(0),a=s.useCallback(l=>{const u=n.current+l;t(u),Vn((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]}Vn(uw,"useTypeaheadSearch");function dw(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=OA(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}Vn(dw,"findNextItem");function OA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Vn(OA,"wrapArray");var wW=Object.defineProperty,$r=(e,t)=>wW(e,"name",{value:t,configurable:!0}),[fw,o0e]=Vs("Tooltip",[$l]),Om=$l(),yW="TooltipProvider",bW=700,t4="tooltip.open",[xW,hw]=fw(yW),kW=$r(e=>{const{__scopeTooltip:t,delayDuration:n=bW,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(xW,{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"),n4="Tooltip",[SW,Zf]=fw(n4),EW=$r(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:l,delayDuration:u}=e,f=hw(n4,e.__scopeTooltip),h=Om(t),[p,m]=s.useState(null),[g,w]=s.useState(void 0),y=Ca(),b=s.useRef(0),k=l??f.disableHoverableContent,S=u??f.delayDuration,E=s.useRef(!1),[C,A]=gi({prop:r,defaultProp:a??!1,onChange:$r(P=>{P?(f.onOpen(),document.dispatchEvent(new CustomEvent(t4))):f.onClose(),i==null||i(P)},"onChange"),caller:n4}),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 R=g??y;return o.jsx(Nm,{...h,children:o.jsx(SW,{scope:t,contentId:R,setContentId:w,open:C,stateAttribute:L,trigger:p,onTriggerChange:m,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"),m5="TooltipTrigger",CW=s.forwardRef($r(function(t,n){const{__scopeTooltip:r,...a}=t,i=Zf(m5,r),l=hw(m5,r),u=Om(r),f=s.useRef(null),h=fn(n,f,i.onTriggerChange),p=s.useRef(!1),m=s.useRef(!1),g=s.useCallback(()=>p.current=!1,[]);return s.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),o.jsx(Of,{asChild:!0,...u,children:o.jsx(gn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...a,ref:h,onPointerMove:At(t.onPointerMove,w=>{w.pointerType!=="touch"&&!m.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),m.current=!0)}),onPointerLeave:At(t.onPointerLeave,()=>{i.onTriggerLeave(),m.current=!1}),onPointerDown:At(t.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:At(t.onFocus,()=>{p.current||i.onOpen()}),onBlur:At(t.onBlur,i.onClose),onClick:At(t.onClick,i.onClose)})})},"TooltipTrigger")),IA="TooltipPortal",[jW,AW]=fw(IA,{forceMount:void 0}),NW=$r(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,i=Zf(IA,t);return o.jsx(jW,{scope:t,forceMount:n,children:o.jsx(hs,{present:n||i.open,children:o.jsx(Tf,{asChild:!0,container:a,children:r})})})},"TooltipPortal"),cf="TooltipContent",MW=s.forwardRef($r(function(t,n){const r=AW(cf,t.__scopeTooltip),{forceMount:a=r.forceMount,side:i="top",...l}=t,u=Zf(cf,t.__scopeTooltip);return o.jsx(hs,{present:a||u.open,children:u.disableHoverableContent?o.jsx(FA,{side:i,...l,ref:n}):o.jsx(RW,{side:i,...l,ref:n})})},"TooltipContent")),RW=s.forwardRef($r(function(t,n){const r=Zf(cf,t.__scopeTooltip),a=hw(cf,t.__scopeTooltip),i=s.useRef(null),l=fn(n,i),[u,f]=s.useState(null),{trigger:h,onClose:p}=r,m=i.current,{onPointerInTransitChange:g}=a,w=s.useCallback(()=>{f(null),g(!1)},[g]),y=s.useCallback((b,k)=>{const S=b.currentTarget,E={x:b.clientX,y:b.clientY},C=_A(E,S.getBoundingClientRect()),A=VA(E,C),L=ZA(k.getBoundingClientRect()),T=BA([...A,...L]);f(T),g(!0)},[g]);return s.useEffect(()=>()=>w(),[w]),s.useEffect(()=>{if(h&&m){const b=$r(S=>y(S,m),"handleTriggerLeave"),k=$r(S=>y(S,h),"handleContentLeave");return h.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{h.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[h,m,y,w]),s.useEffect(()=>{if(u){const b=$r(k=>{const S=k.target,E={x:k.clientX,y:k.clientY},C=(h==null?void 0:h.contains(S))||(m==null?void 0:m.contains(S)),A=!zA(E,u);C?w():A&&(w(),p())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[h,m,u,p,w]),o.jsx(FA,{...t,ref:l})},"TooltipContentHoverable")),PW=Lv("TooltipContent"),FA=s.forwardRef($r(function(t,n){const{__scopeTooltip:r,children:a,"aria-label":i,id:l,onEscapeKeyDown:u,onPointerDownOutside:f,...h}=t,p=Zf(cf,r),m=Om(r),{onClose:g}=p;s.useEffect(()=>(document.addEventListener(t4,g),()=>document.removeEventListener(t4,g)),[g]),s.useEffect(()=>{if(p.trigger){const y=$r(b=>{b.target instanceof Node&&b.target.contains(p.trigger)&&g()},"handleScroll");return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[p.trigger,g]);const{setContentId:w}=p;return Cr(()=>(w(l),()=>{w(void 0)}),[l,w]),o.jsx($f,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:y=>y.preventDefault(),onDismiss:g,children:o.jsxs(Mm,{"data-state":p.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:p.contentId,...m,...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(PW,{children:a}),i?o.jsx(bC,{id:p.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl")),LW=s.forwardRef($r(function(t,n){const{__scopeTooltip:r,...a}=t,i=Om(r);return o.jsx(VZ,{...i,...a,ref:n})},"TooltipArrow"));function _A(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")}}$r(_A,"getExitSideFromRect");function VA(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}$r(VA,"getPaddedExitPoints");function ZA(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}]}$r(ZA,"getPointsFromRect");function zA(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,m=f.x,g=f.y;p>r!=g>r&&n<(m-h)*(r-p)/(g-p)+h&&(a=!a)}return a}$r(zA,"isPointInPolygon");function BA(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),UA(t)}$r(BA,"getHull");function UA(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)}$r(UA,"getHullPresorted");var $W=kW,TW=EW,DW=CW,HW=NW,OW=MW,IW=LW,g8={exports:{}};/*!
93
+ Copyright (c) 2018 Jed Watson.
94
+ Licensed under the MIT License (MIT), see
95
+ http://jedwatson.github.io/classnames
96
+ */var g5;function FW(){return g5||(g5=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})()})(g8)),g8.exports}var _W=FW();const Kt=B9(_W),ao={asChild:{type:"boolean"}},Ro={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}},pw={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}},VW=["1","2","3","4"],WA={...ao,align:{type:"enum",className:"rt-r-align",values:["start","center"],default:"center"},size:{type:"enum",className:"rt-r-size",values:VW,default:"3",responsive:!0},width:Ro.width,minWidth:Ro.minWidth,maxWidth:{...Ro.maxWidth,default:"600px"},...pw},KA=["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"],Hl={color:{type:"enum",values:KA,default:void 0}},mw={color:{type:"enum",values:KA,default:""}},Kc={highContrast:{type:"boolean",className:"rt-high-contrast",default:void 0}},ZW=["normal","start","end","both"],GA={trim:{type:"enum",className:"rt-r-lt",values:ZW,responsive:!0}},zW=["left","center","right"],YA={align:{type:"enum",className:"rt-r-ta",values:zW,responsive:!0}},BW=["wrap","nowrap","pretty","balance"],qA={wrap:{type:"enum",className:"rt-r-tw",values:BW,responsive:!0}},XA={truncate:{type:"boolean",className:"rt-truncate"}},UW=["light","regular","medium","bold"],QA={weight:{type:"enum",className:"rt-r-weight",values:UW,responsive:!0}},WW=["h1","h2","h3","h4","h5","h6"],KW=["1","2","3","4","5","6","7","8","9"],GW={as:{type:"enum",values:WW,default:"h1"},...ao,size:{type:"enum",className:"rt-r-size",values:KW,default:"6",responsive:!0},...QA,...YA,...GA,...XA,...qA,...Hl,...Kc},YW=["initial","xs","sm","md","lg","xl"],gw=new Set(YW);function JA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _0(e){return typeof e=="object"&&e!==null&&Object.keys(e).some(t=>gw.has(t))}function Qi({className:e,customProperties:t,...n}){const r=bp({allowArbitraryValues:!0,className:e,...n}),a=qW({customProperties:t,...n});return[r,a]}function bp({allowArbitraryValues:e,value:t,className:n,propValues:r,parseValue:a=i=>i}){const i=[];if(t){if(typeof t=="string"&&r.includes(t))return v5(n,t,a);if(_0(t)){const l=t;for(const u in l){if(!JA(l,u)||!gw.has(u))continue;const f=l[u];if(f!==void 0){if(r.includes(f)){const h=v5(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 v5(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 qW({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]))),_0(t)){const i=t;for(const l in i){if(!JA(i,l)||!gw.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 xp(...e){let t={};for(const n of e)n&&(t={...t,...n});return Object.keys(t).length?t:void 0}function XW(...e){return Object.assign({},...e)}function Nr(e,...t){let n,r;const a={...e},i=XW(...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)&&!_0(u)&&(u=f.default),a[l]=u,"className"in f&&f.className){delete a[l];const h="responsive"in f;if(!u||_0(u)&&!h)continue;if(_0(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=bp({allowArbitraryValues:!1,value:u,className:f.className,propValues:f.values,parseValue:f.parseValue});n=Kt(n,p);continue}if(f.type==="string"||f.type==="enum | string"){const p=f.type==="string"?[]:f.values,[m,g]=Qi({className:f.className,customProperties:f.customProperties,propValues:p,parseValue:f.parseValue,value:u});r=xp(r,g),n=Kt(n,m);continue}if(f.type==="boolean"&&u){n=Kt(n,f.className);continue}}}return a.className=Kt(n,e.className),a.style=xp(r,e.style),a}const sc=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],_o={m:{type:"enum | string",values:sc,responsive:!0,className:"rt-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:sc,responsive:!0,className:"rt-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:sc,responsive:!0,className:"rt-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:sc,responsive:!0,className:"rt-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:sc,responsive:!0,className:"rt-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:sc,responsive:!0,className:"rt-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:sc,responsive:!0,className:"rt-r-ml",customProperties:["--ml"]}},vw=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="h1",color:l,...u}=Nr(e,GW,_o);return s.createElement(Zc,{"data-accent-color":l,...u,ref:t,className:Kt("rt-Heading",r)},a?n:s.createElement(i,null,n))});vw.displayName="Heading";const QW=["span","div","label","p"],JW=["1","2","3","4","5","6","7","8","9"],eK={as:{type:"enum",values:QW,default:"span"},...ao,size:{type:"enum",className:"rt-r-size",values:JW,responsive:!0},...QA,...YA,...GA,...XA,...qA,...Hl,...Kc},Rc=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="span",color:l,...u}=Nr(e,eK,_o);return s.createElement(Zc,{"data-accent-color":l,...u,ref:t,className:Kt("rt-Text",r)},a?n:s.createElement(i,null,n))});Rc.displayName="Text";function tK(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 nK=["none","small","medium","large","full"],Im={radius:{type:"enum",values:nK,default:void 0}},Qs={hasBackground:{default:!0},appearance:{default:"inherit"},accentColor:{default:"indigo"},grayColor:{default:"auto"},panelBackground:{default:"translucent"},radius:{default:"medium"},scaling:{default:"100%"}},Au=()=>{},kp=s.createContext(void 0);function ww(){const e=s.useContext(kp);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const oo=s.forwardRef((e,t)=>s.useContext(kp)===void 0?s.createElement($W,{delayDuration:200},s.createElement(BF,{dir:"ltr"},s.createElement(eN,{...e,ref:t}))):s.createElement(yw,{...e,ref:t}));oo.displayName="Theme";const eN=s.forwardRef((e,t)=>{const{appearance:n=Qs.appearance.default,accentColor:r=Qs.accentColor.default,grayColor:a=Qs.grayColor.default,panelBackground:i=Qs.panelBackground.default,radius:l=Qs.radius.default,scaling:u=Qs.scaling.default,hasBackground:f=Qs.hasBackground.default,...h}=e,[p,m]=s.useState(n);s.useEffect(()=>m(n),[n]);const[g,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(yw,{...h,ref:t,isRoot:!0,hasBackground:f,appearance:p,accentColor:g,grayColor:y,panelBackground:k,radius:E,scaling:A,onAppearanceChange:m,onAccentColorChange:w,onGrayColorChange:b,onPanelBackgroundChange:S,onRadiusChange:C,onScalingChange:L})});eN.displayName="ThemeRoot";const yw=s.forwardRef((e,t)=>{const n=s.useContext(kp),{asChild:r,isRoot:a,hasBackground:i,appearance:l=(n==null?void 0:n.appearance)??Qs.appearance.default,accentColor:u=(n==null?void 0:n.accentColor)??Qs.accentColor.default,grayColor:f=(n==null?void 0:n.resolvedGrayColor)??Qs.grayColor.default,panelBackground:h=(n==null?void 0:n.panelBackground)??Qs.panelBackground.default,radius:p=(n==null?void 0:n.radius)??Qs.radius.default,scaling:m=(n==null?void 0:n.scaling)??Qs.scaling.default,onAppearanceChange:g=Au,onAccentColorChange:w=Au,onGrayColorChange:y=Au,onPanelBackgroundChange:b=Au,onRadiusChange:k=Au,onScalingChange:S=Au,...E}=e,C=r?Zc:"div",A=f==="auto"?tK(u):f,L=e.appearance==="light"||e.appearance==="dark",T=i===void 0?a||L:i;return s.createElement(kp.Provider,{value:s.useMemo(()=>({appearance:l,accentColor:u,grayColor:f,resolvedGrayColor:A,panelBackground:h,radius:p,scaling:m,onAppearanceChange:g,onAccentColorChange:w,onGrayColorChange:y,onPanelBackgroundChange:b,onRadiusChange:k,onScalingChange:S}),[l,u,f,A,h,p,m,g,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":m,ref:t,...E,className:Kt("radix-themes",{light:l==="light",dark:l==="dark"},E.className)}))});yw.displayName="ThemeImpl";const Ni=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},zf=e=>s.createElement(pV,{...e});zf.displayName="AlertDialog.Root";const tN=s.forwardRef(({children:e,...t},n)=>s.createElement(mV,{...t,ref:n,asChild:!0},Ni(e)));tN.displayName="AlertDialog.Trigger";const Bf=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=WA,{className:i}=Nr({align:e},{align:r}),{className:l,forceMount:u,container:f,...h}=Nr(t,a);return s.createElement(gV,{container:f,forceMount:u},s.createElement(oo,{asChild:!0},s.createElement(vV,{className:"rt-BaseDialogOverlay rt-AlertDialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-AlertDialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${i}`},s.createElement(wV,{...h,ref:n,className:Kt("rt-BaseDialogContent","rt-AlertDialogContent",l)}))))))});Bf.displayName="AlertDialog.Content";const Uf=s.forwardRef((e,t)=>s.createElement(xV,{asChild:!0},s.createElement(vw,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));Uf.displayName="AlertDialog.Title";const Wf=s.forwardRef((e,t)=>s.createElement(kV,{asChild:!0},s.createElement(Rc,{as:"p",size:"3",...e,asChild:!1,ref:t})));Wf.displayName="AlertDialog.Description";const Kf=s.forwardRef(({children:e,...t},n)=>s.createElement(yV,{...t,ref:n,asChild:!0},Ni(e)));Kf.displayName="AlertDialog.Action";const Gf=s.forwardRef(({children:e,...t},n)=>s.createElement(bV,{...t,ref:n,asChild:!0},Ni(e)));Gf.displayName="AlertDialog.Cancel";function rK(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 sK=["1","2","3"],aK=["solid","soft","surface","outline"],oK={...ao,size:{type:"enum",className:"rt-r-size",values:sK,default:"1",responsive:!0},variant:{type:"enum",className:"rt-variant",values:aK,default:"soft"},...mw,...Kc,...Im},nN=s.forwardRef((e,t)=>{const{asChild:n,className:r,color:a,radius:i,...l}=Nr(e,oK,_o),u=n?Zc:"span";return s.createElement(u,{"data-accent-color":a,"data-radius":i,...l,ref:t,className:Kt("rt-reset","rt-Badge",r)})});nN.displayName="Badge";const rN=Zc,iK=["div","span"],lK=["none","inline","inline-block","block","contents"],cK={as:{type:"enum",values:iK,default:"div"},...ao,display:{type:"enum",className:"rt-r-display",values:lK,responsive:!0}},ac=["0","1","2","3","4","5","6","7","8","9"],uK={p:{type:"enum | string",className:"rt-r-p",customProperties:["--p"],values:ac,responsive:!0},px:{type:"enum | string",className:"rt-r-px",customProperties:["--pl","--pr"],values:ac,responsive:!0},py:{type:"enum | string",className:"rt-r-py",customProperties:["--pt","--pb"],values:ac,responsive:!0},pt:{type:"enum | string",className:"rt-r-pt",customProperties:["--pt"],values:ac,responsive:!0},pr:{type:"enum | string",className:"rt-r-pr",customProperties:["--pr"],values:ac,responsive:!0},pb:{type:"enum | string",className:"rt-r-pb",customProperties:["--pb"],values:ac,responsive:!0},pl:{type:"enum | string",className:"rt-r-pl",customProperties:["--pl"],values:ac,responsive:!0}},v8=["visible","hidden","clip","scroll","auto"],dK=["static","relative","absolute","fixed","sticky"],g0=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],fK=["0","1"],hK=["0","1"],pK=["start","center","end","baseline","stretch"],mK=["start","center","end","baseline","stretch"],sN={...uK,...Ro,...pw,position:{type:"enum",className:"rt-r-position",values:dK,responsive:!0},inset:{type:"enum | string",className:"rt-r-inset",customProperties:["--inset"],values:g0,responsive:!0},top:{type:"enum | string",className:"rt-r-top",customProperties:["--top"],values:g0,responsive:!0},right:{type:"enum | string",className:"rt-r-right",customProperties:["--right"],values:g0,responsive:!0},bottom:{type:"enum | string",className:"rt-r-bottom",customProperties:["--bottom"],values:g0,responsive:!0},left:{type:"enum | string",className:"rt-r-left",customProperties:["--left"],values:g0,responsive:!0},overflow:{type:"enum",className:"rt-r-overflow",values:v8,responsive:!0},overflowX:{type:"enum",className:"rt-r-ox",values:v8,responsive:!0},overflowY:{type:"enum",className:"rt-r-oy",values:v8,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:fK,responsive:!0},flexGrow:{type:"enum | string",className:"rt-r-fg",customProperties:["--flex-grow"],values:hK,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:pK,responsive:!0},justifySelf:{type:"enum",className:"rt-r-js",values:mK,responsive:!0}},V0=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=Nr(e,cK,sN,_o);return s.createElement(r?rN:a,{...i,ref:t,className:Kt("rt-Box",n)})});V0.displayName="Box";const gK=["1","2","3","4"],vK=["classic","solid","soft","surface","outline","ghost"],w5={...ao,size:{type:"enum",className:"rt-r-size",values:gK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:vK,default:"solid"},...mw,...Kc,...Im,loading:{type:"boolean",className:"rt-loading",default:!1}},w8=["0","1","2","3","4","5","6","7","8","9"],wK={gap:{type:"enum | string",className:"rt-r-gap",customProperties:["--gap"],values:w8,responsive:!0},gapX:{type:"enum | string",className:"rt-r-cg",customProperties:["--column-gap"],values:w8,responsive:!0},gapY:{type:"enum | string",className:"rt-r-rg",customProperties:["--row-gap"],values:w8,responsive:!0}},yK=["div","span"],bK=["none","inline-flex","flex"],xK=["row","column","row-reverse","column-reverse"],kK=["start","center","end","baseline","stretch"],SK=["start","center","end","between"],EK=["nowrap","wrap","wrap-reverse"],CK={as:{type:"enum",values:yK,default:"div"},...ao,display:{type:"enum",className:"rt-r-display",values:bK,responsive:!0},direction:{type:"enum",className:"rt-r-fd",values:xK,responsive:!0},align:{type:"enum",className:"rt-r-ai",values:kK,responsive:!0},justify:{type:"enum",className:"rt-r-jc",values:SK,parseValue:jK,responsive:!0},wrap:{type:"enum",className:"rt-r-fw",values:EK,responsive:!0},...wK};function jK(e){return e==="between"?"space-between":e}const _s=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=Nr(e,CK,sN,_o);return s.createElement(r?rN:a,{...i,ref:t,className:Kt("rt-Flex",n)})});_s.displayName="Flex";const AK=["1","2","3"],NK={size:{type:"enum",className:"rt-r-size",values:AK,default:"2",responsive:!0},loading:{type:"boolean",default:!0}},Lr=s.forwardRef((e,t)=>{const{className:n,children:r,loading:a,...i}=Nr(e,NK,_o);if(!a)return r;const l=s.createElement("span",{...i,ref:t,className:Kt("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(_s,{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(_s,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,l))))});Lr.displayName="Spinner";const MK=bC;function aN(e,t){if(e!==void 0)return typeof e=="string"?t(e):Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r)]))}function RK(e){return e==="3"?"3":"2"}function PK(e){switch(e){case"1":return"1";case"2":case"3":return"2";case"4":return"3"}}const oN=s.forwardRef((e,t)=>{const{size:n=w5.size.default}=e,{className:r,children:a,asChild:i,color:l,radius:u,disabled:f=e.loading,...h}=Nr(e,w5,_o),p=i?Zc:"button";return s.createElement(p,{"data-disabled":f||void 0,"data-accent-color":l,"data-radius":u,...h,ref:t,className:Kt("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(MK,null,a),s.createElement(_s,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,s.createElement(Lr,{size:aN(n,PK)})))):a)});oN.displayName="BaseButton";const ba=s.forwardRef(({className:e,...t},n)=>s.createElement(oN,{...t,ref:n,className:Kt("rt-Button",e)}));ba.displayName="Button";const LK=["1","2","3"],$K=["soft","surface","outline"],y5={...ao,size:{type:"enum",className:"rt-r-size",values:LK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:$K,default:"soft"},...mw,...Kc},iN=s.createContext({}),r4=s.forwardRef((e,t)=>{const{size:n=y5.size.default}=e,{asChild:r,children:a,className:i,color:l,...u}=Nr(e,y5,_o),f=r?Zc:"div";return s.createElement(f,{"data-accent-color":l,...u,className:Kt("rt-CalloutRoot",i),ref:t},s.createElement(iN.Provider,{value:s.useMemo(()=>({size:n}),[n])},a))});r4.displayName="Callout.Root";const TK=s.forwardRef(({className:e,...t},n)=>s.createElement("div",{...t,className:Kt("rt-CalloutIcon",e),ref:n}));TK.displayName="Callout.Icon";const s4=s.forwardRef(({className:e,...t},n)=>{const{size:r}=s.useContext(iN);return s.createElement(Rc,{as:"p",size:aN(r,RK),...t,asChild:!1,ref:n,className:Kt("rt-CalloutText",e)})});s4.displayName="Callout.Text";const DK=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"})));DK.displayName="ThickDividerHorizontalIcon";const Pd=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"})));Pd.displayName="ThickCheckIcon";const lN=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"})));lN.displayName="ChevronDownIcon";const bw=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"})));bw.displayName="ThickChevronRightIcon";const HK=["1","2","3"],v0={...ao,size:{values:HK,default:"1"},...Im,scrollbars:{default:"both"}};function OK(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 oc=_o.m.values;function IK(e){const[t,n]=Qi({className:"rt-r-m",customProperties:["--margin"],propValues:oc,value:e.m}),[r,a]=Qi({className:"rt-r-mx",customProperties:["--margin-left","--margin-right"],propValues:oc,value:e.mx}),[i,l]=Qi({className:"rt-r-my",customProperties:["--margin-top","--margin-bottom"],propValues:oc,value:e.my}),[u,f]=Qi({className:"rt-r-mt",customProperties:["--margin-top"],propValues:oc,value:e.mt}),[h,p]=Qi({className:"rt-r-mr",customProperties:["--margin-right"],propValues:oc,value:e.mr}),[m,g]=Qi({className:"rt-r-mb",customProperties:["--margin-bottom"],propValues:oc,value:e.mb}),[w,y]=Qi({className:"rt-r-ml",customProperties:["--margin-left"],propValues:oc,value:e.ml});return[Kt(t,r,i,u,h,m,w),xp(n,a,l,f,p,g,y)]}const Yf=s.forwardRef((e,t)=>{const{rest:n,...r}=OK(e),[a,i]=IK(r),{asChild:l,children:u,className:f,style:h,type:p,scrollHideDelay:m=p!=="scroll"?0:void 0,dir:g,size:w=v0.size.default,radius:y=v0.radius.default,scrollbars:b=v0.scrollbars.default,...k}=n;return s.createElement(PA,{type:p,scrollHideDelay:m,className:Kt("rt-ScrollAreaRoot",a,f),style:xp(i,h),asChild:l},rK({asChild:l,children:u},S=>s.createElement(s.Fragment,null,s.createElement(LA,{...k,ref:t,className:"rt-ScrollAreaViewport"},S),s.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),b!=="vertical"?s.createElement(Q6,{"data-radius":y,orientation:"horizontal",className:Kt("rt-ScrollAreaScrollbar",bp({className:"rt-r-size",value:w,propValues:v0.size.values}))},s.createElement(J6,{className:"rt-ScrollAreaThumb"})):null,b!=="horizontal"?s.createElement(Q6,{"data-radius":y,orientation:"vertical",className:Kt("rt-ScrollAreaScrollbar",bp({className:"rt-r-size",value:w,propValues:v0.size.values}))},s.createElement(J6,{className:"rt-ScrollAreaThumb"})):null,b==="both"?s.createElement(LU,{className:"rt-ScrollAreaCorner"}):null)))});Yf.displayName="ScrollArea";const FK=["1","2"],_K=["solid","soft"],Ao={size:{type:"enum",className:"rt-r-size",values:FK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:_K,default:"solid"},...Hl,...Kc},cN={...ao,...Hl},uN={...Hl},dN={...Hl},qf=e=>s.createElement(eB,{...e});qf.displayName="ContextMenu.Root";const Xf=s.forwardRef(({children:e,...t},n)=>s.createElement(tB,{...t,ref:n,asChild:!0},Ni(e)));Xf.displayName="ContextMenu.Trigger";const fN=s.createContext({}),Qf=s.forwardRef((e,t)=>{const n=ww(),{size:r=Ao.size.default,variant:a=Ao.variant.default,highContrast:i=Ao.highContrast.default}=e,{className:l,children:u,color:f,container:h,forceMount:p,...m}=Nr(e,Ao),g=f||n.accentColor;return s.createElement(pA,{container:h,forceMount:p},s.createElement(oo,{asChild:!0},s.createElement(nB,{"data-accent-color":g,alignOffset:-Number(r)*4,collisionPadding:10,...m,asChild:!1,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-ContextMenuContent",l)},s.createElement(Yf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-ContextMenuViewport")},s.createElement(fN.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:g,highContrast:i}),[r,a,g,i])},u))))))});Qf.displayName="ContextMenu.Content";const VK=s.forwardRef(({className:e,...t},n)=>s.createElement(sB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuLabel","rt-ContextMenuLabel",e)}));VK.displayName="ContextMenu.Label";const Jf=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=cN.color.default,shortcut:i,...l}=e;return s.createElement(aB,{"data-accent-color":a,...l,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-ContextMenuItem",n)},s.createElement(vm,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},i))});Jf.displayName="ContextMenu.Item";const ZK=s.forwardRef(({className:e,...t},n)=>s.createElement(rB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuGroup","rt-ContextMenuGroup",e)}));ZK.displayName="ContextMenu.Group";const zK=s.forwardRef(({className:e,...t},n)=>s.createElement(iB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuRadioGroup","rt-ContextMenuRadioGroup",e)}));zK.displayName="ContextMenu.RadioGroup";const BK=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=dN.color.default,...i}=e;return s.createElement(lB,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-ContextMenuItem","rt-ContextMenuRadioItem",r)},s.createElement(vm,null,n),s.createElement(mA,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(Pd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})))});BK.displayName="ContextMenu.RadioItem";const UK=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=uN.color.default,...l}=e;return s.createElement(oB,{...l,asChild:!1,ref:t,"data-accent-color":i,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-ContextMenuItem","rt-ContextMenuCheckboxItem",r)},s.createElement(vm,null,n),s.createElement(mA,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(Pd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},a))});UK.displayName="ContextMenu.CheckboxItem";const WK=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(uB,{...a,asChild:!1,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-ContextMenuItem","rt-ContextMenuSubTrigger",n)},r,s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},s.createElement(bw,{className:"rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon"})))});WK.displayName="ContextMenu.SubTrigger";const KK=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(fN),{className:l,children:u,container:f,forceMount:h,...p}=Nr({size:n,variant:r,color:a,highContrast:i,...e},Ao);return s.createElement(pA,{container:f,forceMount:h},s.createElement(oo,{asChild:!0},s.createElement(dB,{"data-accent-color":a,alignOffset:-Number(n)*4,sideOffset:1,collisionPadding:10,...p,asChild:!1,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-ContextMenuContent","rt-ContextMenuSubContent",l)},s.createElement(Yf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-ContextMenuViewport")},u)))))});KK.displayName="ContextMenu.SubContent";const Fm=s.forwardRef(({className:e,...t},n)=>s.createElement(cB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuSeparator","rt-ContextMenuSeparator",e)}));Fm.displayName="ContextMenu.Separator";const xw=e=>s.createElement(Al,{...e,modal:!0});xw.displayName="Dialog.Root";const GK=s.forwardRef(({children:e,...t},n)=>s.createElement(Fv,{...t,ref:n,asChild:!0},Ni(e)));GK.displayName="Dialog.Trigger";const kw=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=WA,{className:i}=Nr({align:e},{align:r}),{className:l,forceMount:u,container:f,...h}=Nr(t,a);return s.createElement(Nl,{container:f,forceMount:u},s.createElement(oo,{asChild:!0},s.createElement(Ml,{className:"rt-BaseDialogOverlay rt-DialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-DialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${i}`},s.createElement(Rl,{...h,ref:n,className:Kt("rt-BaseDialogContent","rt-DialogContent",l)}))))))});kw.displayName="Dialog.Content";const Sw=s.forwardRef((e,t)=>s.createElement(Pl,{asChild:!0},s.createElement(vw,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));Sw.displayName="Dialog.Title";const YK=s.forwardRef((e,t)=>s.createElement(_v,{asChild:!0},s.createElement(Rc,{as:"p",size:"3",...e,asChild:!1,ref:t})));YK.displayName="Dialog.Description";const qK=s.forwardRef(({children:e,...t},n)=>s.createElement(Hf,{...t,ref:n,asChild:!0},Ni(e)));qK.displayName="Dialog.Close";const Cs=e=>s.createElement(PB,{...e});Cs.displayName="DropdownMenu.Root";const js=s.forwardRef(({children:e,...t},n)=>s.createElement(LB,{...t,ref:n,asChild:!0},Ni(e)));js.displayName="DropdownMenu.Trigger";const hN=s.createContext({}),As=s.forwardRef((e,t)=>{const n=ww(),{size:r=Ao.size.default,variant:a=Ao.variant.default,highContrast:i=Ao.highContrast.default}=e,{className:l,children:u,color:f,container:h,forceMount:p,...m}=Nr(e,Ao),g=f||n.accentColor;return s.createElement(vA,{container:h,forceMount:p},s.createElement(oo,{asChild:!0},s.createElement($B,{"data-accent-color":g,align:"start",sideOffset:4,collisionPadding:10,...m,asChild:!1,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",l)},s.createElement(Yf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},s.createElement(hN.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:g,highContrast:i}),[r,a,g,i])},u))))))});As.displayName="DropdownMenu.Content";const a4=s.forwardRef(({className:e,...t},n)=>s.createElement(DB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e)}));a4.displayName="DropdownMenu.Label";const qn=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=cN.color.default,shortcut:i,...l}=e;return s.createElement(HB,{"data-accent-color":a,...l,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",n)},s.createElement(vm,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});qn.displayName="DropdownMenu.Item";const XK=s.forwardRef(({className:e,...t},n)=>s.createElement(TB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e)}));XK.displayName="DropdownMenu.Group";const Sp=s.forwardRef(({className:e,...t},n)=>s.createElement(IB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e)}));Sp.displayName="DropdownMenu.RadioGroup";const Bu=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=dN.color.default,...i}=e;return s.createElement(FB,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",r)},n,s.createElement(wA,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(Pd,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Bu.displayName="DropdownMenu.RadioItem";const QK=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=uN.color.default,...l}=e;return s.createElement(OB,{...l,asChild:!1,ref:t,"data-accent-color":i,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",r)},n,s.createElement(wA,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(Pd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},a))});QK.displayName="DropdownMenu.CheckboxItem";const JK=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(VB,{...a,asChild:!1,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",n)},r,s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s.createElement(bw,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});JK.displayName="DropdownMenu.SubTrigger";const eG=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(hN),{className:l,children:u,container:f,forceMount:h,...p}=Nr({size:n,variant:r,color:a,highContrast:i,...e},Ao);return s.createElement(vA,{container:f,forceMount:h},s.createElement(oo,{asChild:!0},s.createElement(ZB,{"data-accent-color":a,alignOffset:-Number(n)*4,sideOffset:1,collisionPadding:10,...p,asChild:!1,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",l)},s.createElement(Yf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},u)))))});eG.displayName="DropdownMenu.SubContent";const bc=s.forwardRef(({className:e,...t},n)=>s.createElement(_B,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e)}));bc.displayName="DropdownMenu.Separator";const tG=["1","2","3","4"],nG={...ao,size:{type:"enum",className:"rt-r-size",values:tG,default:"2",responsive:!0},width:Ro.width,minWidth:Ro.minWidth,maxWidth:{...Ro.maxWidth,default:"480px"},...pw},md=e=>s.createElement(cU,{...e});md.displayName="Popover.Root";const gd=s.forwardRef(({children:e,...t},n)=>s.createElement(dU,{...t,ref:n,asChild:!0},Ni(e)));gd.displayName="Popover.Trigger";const vd=s.forwardRef((e,t)=>{const{className:n,forceMount:r,container:a,...i}=Nr(e,nG);return s.createElement(fU,{container:a,forceMount:r},s.createElement(oo,{asChild:!0},s.createElement(hU,{align:"start",sideOffset:8,collisionPadding:10,...i,ref:t,className:Kt("rt-PopperContent","rt-PopoverContent",n)})))});vd.displayName="Popover.Content";const rG=s.forwardRef(({children:e,...t},n)=>s.createElement(pU,{...t,ref:n,asChild:!0},Ni(e)));rG.displayName="Popover.Close";const sG=s.forwardRef(({children:e,...t},n)=>s.createElement(uU,{...t,ref:n}));sG.displayName="Popover.Anchor";const aG=["1","2","3"],Ew={size:{type:"enum",className:"rt-r-size",values:aG,default:"2",responsive:!0}},oG=["classic","surface","soft","ghost"],iG={variant:{type:"enum",className:"rt-variant",values:oG,default:"surface"},...Hl,...Im,placeholder:{type:"string"}},lG=["solid","soft"],cG={variant:{type:"enum",className:"rt-variant",values:lG,default:"solid"},...Hl,...Kc},Cw=s.createContext({}),pN=e=>{const{children:t,size:n=Ew.size.default,...r}=e;return s.createElement(_U,{...r},s.createElement(Cw.Provider,{value:s.useMemo(()=>({size:n}),[n])},t))};pN.displayName="Select.Root";const mN=s.forwardRef((e,t)=>{const n=s.useContext(Cw),{children:r,className:a,color:i,radius:l,placeholder:u,...f}=Nr({size:n==null?void 0:n.size,...e},{size:Ew.size},iG,_o);return s.createElement(ZU,{asChild:!0},s.createElement("button",{"data-accent-color":i,"data-radius":l,...f,ref:t,className:Kt("rt-reset","rt-SelectTrigger",a)},s.createElement("span",{className:"rt-SelectTriggerInner"},s.createElement(BU,{placeholder:u},r)),s.createElement(UU,{asChild:!0},s.createElement(lN,{className:"rt-SelectIcon"}))))});mN.displayName="Select.Trigger";const gN=s.forwardRef((e,t)=>{const n=s.useContext(Cw),{className:r,children:a,color:i,container:l,...u}=Nr({size:n==null?void 0:n.size,...e},{size:Ew.size},cG),f=ww(),h=i||f.accentColor;return s.createElement(YU,{container:l},s.createElement(oo,{asChild:!0},s.createElement(qU,{"data-accent-color":h,sideOffset:4,...u,asChild:!1,ref:t,className:Kt({"rt-PopperContent":u.position==="popper"},"rt-SelectContent",r)},s.createElement(PA,{type:"auto",className:"rt-ScrollAreaRoot"},s.createElement(rW,{asChild:!0,className:"rt-SelectViewport"},s.createElement(LA,{className:"rt-ScrollAreaViewport",style:{overflowY:void 0}},a)),s.createElement(Q6,{className:"rt-ScrollAreaScrollbar rt-r-size-1",orientation:"vertical"},s.createElement(J6,{className:"rt-ScrollAreaThumb"}))))))});gN.displayName="Select.Content";const vN=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(dW,{...a,asChild:!1,ref:t,className:Kt("rt-SelectItem",n)},s.createElement(pW,{className:"rt-SelectItemIndicator"},s.createElement(Pd,{className:"rt-SelectItemIndicatorIcon"})),s.createElement(fW,null,r))});vN.displayName="Select.Item";const uG=s.forwardRef(({className:e,...t},n)=>s.createElement(iW,{...t,asChild:!1,ref:n,className:Kt("rt-SelectGroup",e)}));uG.displayName="Select.Group";const dG=s.forwardRef(({className:e,...t},n)=>s.createElement(cW,{...t,asChild:!1,ref:n,className:Kt("rt-SelectLabel",e)}));dG.displayName="Select.Label";const fG=s.forwardRef(({className:e,...t},n)=>s.createElement(mW,{...t,asChild:!1,ref:n,className:Kt("rt-SelectSeparator",e)}));fG.displayName="Select.Separator";const hG={content:{type:"ReactNode",required:!0},width:Ro.width,minWidth:Ro.minWidth,maxWidth:{...Ro.maxWidth,default:"360px"}},jw=s.forwardRef((e,t)=>{const{children:n,className:r,open:a,defaultOpen:i,onOpenChange:l,delayDuration:u,disableHoverableContent:f,content:h,container:p,forceMount:m,...g}=Nr(e,hG),w={open:a,defaultOpen:i,onOpenChange:l,delayDuration:u,disableHoverableContent:f};return s.createElement(TW,{...w},s.createElement(DW,{asChild:!0},n),s.createElement(HW,{container:p,forceMount:m},s.createElement(oo,{asChild:!0},s.createElement(OW,{sideOffset:4,collisionPadding:10,...g,asChild:!1,ref:t,className:Kt("rt-TooltipContent",r)},s.createElement(Rc,{as:"p",className:"rt-TooltipText",size:"1"},h),s.createElement(IW,{className:"rt-TooltipArrow"})))))});jw.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 wN(e,t){try{const n=localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}}const o4="scenri:pref-changed";function yN(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}try{window.dispatchEvent(new CustomEvent(o4,{detail:{key:e,value:t}}))}catch{}}function i4(e,t){try{const n=localStorage.getItem(e);return n===null?null:(localStorage.setItem(t,n),localStorage.removeItem(e),n)}catch{return null}}function ja(e,t){const[n,r]=s.useState(()=>wN(e,t)),a=s.useRef(n);return s.useEffect(()=>{Object.is(a.current,n)||(a.current=n,yN(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(o4,i),()=>window.removeEventListener(o4,i)},[e]),[n,r]}function pG(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 y8(e,t){const[n,r]=ja(e,t),[a,i]=s.useState(null);return[a??n,u=>{i(null),r(u)},i,a]}const mG=()=>wN(qr.lastBrand,null),gG=e=>yN(qr.lastBrand,e),l4="sc-theme",vG="bt-theme",wG=()=>window.matchMedia("(prefers-color-scheme: light)").matches,bN=s.createContext({choice:"system",mode:"dark",setChoice:()=>{},toggle:()=>{}}),yG=()=>s.useContext(bN);function bG(){const e=localStorage.getItem(l4)??i4(vG,l4);return e==="light"||e==="dark"||e==="system"?e:"system"}function xG({children:e}){const[t,n]=s.useState(bG),[r,a]=s.useState(()=>wG()?"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(l4,t)},[i,t]);const l=s.useMemo(()=>({choice:t,mode:i,setChoice:n,toggle:()=>n(i==="dark"?"light":"dark")}),[t,i]);return o.jsx(bN.Provider,{value:l,children:o.jsx(oo,{appearance:i,accentColor:"gray",grayColor:"gray",radius:"large",scaling:"100%",children:e})})}const xN=s.createContext({push:()=>{}}),rr=()=>s.useContext(xN),kG=3,SG=140,Z0=e=>{var t;return!!(e.action||(t=e.actions)!=null&&t.length)},EG=e=>{var t;return((t=e.actions)!=null&&t.length?e.actions:e.action?[e.action]:[]).slice(0,2)};function b8(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 CG(e,t,n){const r=n>1?` (${n} times)`:"";return`${e}${r}${t?` ${t}`:""}`}const jG=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function AG({kind:e}){if(e==="info")return null;const t=e==="success"?Kn:e==="warning"?gm:Vc;return o.jsx(t,{className:"sc-toast-ic",size:16,weight:"regular","aria-hidden":"true"})}function NG({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)},[]),m=s.useCallback(E=>{const C=E.kind==="error"?u.current:l.current;if(!C)return;const A=CG(E.title,E.detail,E.count);C.textContent=A,window.setTimeout(()=>{C.textContent===A&&(C.textContent="")},1e3)},[]),g=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)),SG+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(()=>g(E),C),i.current.set(E,A)},[g]),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=!jG();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 R=j-M;R&&(L.style.transition="none",L.style.transform=`translateY(${R}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(P=>P.id===A.id?j:P));const R=i.current.get(A.id);R&&R.handle==null?R.remaining=b8(j):w(A.id,b8(j)),j.quiet||m(j);return}const L={...E,id:r.current++,count:1},T=[...a.current,L],M=j=>!j.leaving;for(;T.filter(M).length>kG;){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 R=T.splice(j,1)[0],P=i.current.get(R.id);(P==null?void 0:P.handle)!=null&&window.clearTimeout(P.handle),i.current.delete(R.id)}p(T),w(L.id,b8(L)),L.quiet||m(L)},[m,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(xN.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:b5,onMouseDown:b5,children:t.map(E=>{const C=EG(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(AG,{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:()=>g(E.id),"aria-label":"Dismiss",children:o.jsx(Cn,{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(),g(E.id)},children:A.label},A.label))}):null]})]})},E.id)})})]}),document.body)]})}function b5(e){e.stopPropagation(),e.type==="mousedown"&&e.target instanceof Element&&e.target.closest("button")&&e.preventDefault()}async function Ge(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 MG=(e,t,n)=>Ge("DELETE",`/api/brands/${e}/${t}/${n}`),c4=(e,t)=>MG(e,"products",t);async function kN(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 RG=e=>`/api/brands/${e}/export`;async function PG(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 uf(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 Ep(e){if(!e||typeof e!="object")return e;const{products:t,scenes:n,characters:r,...a}=e;return a}function LG(e,t,n){try{return fetch(`/api/brands/${e}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({brand:Ep(t),keepAssets:!0,base:Ep(n)}),keepalive:!0}).then(r=>r.ok?r.json():null).catch(()=>null)}catch{return Promise.resolve(null)}}const Dr=e=>`/api/images/${e}`,Jr=e=>e!=null&&e.startsWith("asset:")?Dr(e.slice(6)):null,SN={large:960,tile:640,small:320,micro:160},mn=(e,t)=>`${Dr(e)}/thumb?w=${SN[t]}`,_m=(e,t)=>e!=null&&e.startsWith("asset:")?mn(e.slice(6),t):null,$G=/^\/api\/images\/([a-f0-9]{32})(?:\/thumb\?w=\d+)?$/,TG=/^(\/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 Ln(e,t){if(!e)return e;const n=$G.exec(e);if(n)return t==="full"?Dr(n[1]):mn(n[1],t);const r=TG.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=${SN[t]}`}function wc(e){const t=Ln(e,"tile"),n=Ln(e,"large");if(!(!t||!n||t===n))return`${t} 640w, ${n} 960w`}const EN={large:"(max-width: 720px) 50vw, 360px",compact:"(max-width: 720px) 50vw, 240px"};function x5(e){return e.every(t=>t.kind==="root")}let CN=new Map;function DG(e){const t=new Map;for(const n of e)for(const r of n.legacyNames??[])r!==n.name&&t.set(r,n.name);CN=t}function HG(e){var r;const t=e.promptHead??"",n=(r=/^\[([^\]]+)\]/.exec(t))==null?void 0:r[1];if(n)return CN.get(n)??n;if(t.startsWith("Remove all overlaid marketing text")||t.startsWith("Remove ALL text"))return"Text lift"}function Hr(e){const t=HG(e);return t||(e.promptHead??"").trim().split(/\s+/).slice(0,6).join(" ")||(e.kind==="edit"?"Edit":"Generation")}const jN=[{id:"newest",label:"Newest first"},{id:"oldest",label:"Oldest first"},{id:"cost",label:"Highest cost"},{id:"keepers",label:"Keepers first"}];function OG(e){return jN.some(t=>t.id===e)}const AN=[{id:"all",label:"All"},{id:"keepers",label:"Keepers"},{id:"archived",label:"Archived"}];function IG(e){return AN.some(t=>t.id===e)}function FG(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 u4(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 Uu=(e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id),Ae={brands:()=>Ge("GET","/api/brands"),createBrand:e=>Ge("POST","/api/brands",{brand:e}),brandFromUrl:e=>Ge("POST","/api/brands/from-url",{url:e}),updateBrand:(e,t,n)=>Ge("PUT",`/api/brands/${e}`,{brand:Ep(t),keepAssets:!0,base:Ep(n)}),deleteBrand:e=>Ge("DELETE",`/api/brands/${e}`),guide:()=>Ge("GET","/api/guide"),guideIntent:e=>Ge("POST","/api/guide",e,void 0,{keepalive:!0}),refreshBrandFromUrl:(e,t)=>Ge("POST",`/api/brands/${e}/refresh-from-url`,t?{url:t}:{}),updateLogo:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/logos/${t}`,n),deleteLogo:(e,t)=>Ge("DELETE",`/api/brands/${e}/logos/${t}`),projects:e=>Ge("GET",`/api/projects?brandId=${encodeURIComponent(e)}`),createProject:(e,t)=>Ge("POST","/api/projects",{brandId:e,name:t}),tree:e=>Ge("GET",`/api/projects/${e}/tree`),activity:e=>Ge("GET",`/api/brands/${e}/activity`),workspace:e=>Ge("GET",`/api/brands/${e}/workspace`),feed:(e,t,n)=>Ge("GET",`/api/brands/${e}/feed${FG(t)}`,void 0,n),node:e=>Ge("GET",`/api/nodes/${e}`),lineage:e=>Ge("GET",`/api/nodes/${e}/lineage`),usage:e=>Ge("GET",`/api/brands/${e}/usage`),sets:e=>Ge("GET",`/api/brands/${e}/sets`),createSet:(e,t)=>Ge("POST",`/api/brands/${e}/sets`,{name:t}),renameSet:(e,t)=>Ge("PATCH",`/api/sets/${e}`,{name:t}),deleteSet:e=>Ge("DELETE",`/api/sets/${e}`),addToSet:(e,t)=>Ge("POST",`/api/sets/${e}/nodes`,{nodeIds:t}),removeFromSet:(e,t)=>Ge("POST",`/api/sets/${e}/nodes/remove`,{nodeIds:t}),engines:()=>Ge("GET","/api/engines"),codexStatus:(e={})=>Ge("GET",`/api/engines/codex/status${e.force?"?force=1":""}`),repairCodexEnv:e=>Ge("POST","/api/engines/codex/repair-env",{keys:e}),restoreCodexEnv:()=>Ge("POST","/api/engines/codex/restore-env"),installCodex:()=>Ge("POST","/api/engines/codex/install"),loginCodex:()=>Ge("POST","/api/engines/codex/login"),setCap:(e,t)=>Ge("PUT","/api/caps",{engineId:e,capUsd:t}),addNode:e=>Ge("POST","/api/nodes",e),cancelNode:e=>Ge("POST",`/api/nodes/${e}/cancel`),retryNode:e=>Ge("POST",`/api/nodes/${e}/retry`),scenes:()=>Ge("GET","/api/scenes"),presenters:()=>Ge("GET","/api/presenters"),presenterFrames:e=>Ge("GET",`/api/presenter-previews/${e}`),demoProducts:()=>Ge("GET","/api/demo-products"),demoProductFrames:e=>Ge("GET",`/api/demo-product-previews/${e}`),showcase:()=>Ge("GET","/api/showcase"),previewBrief:(e,t,n,r)=>Ge("POST","/api/brief/preview",{brief:e,engineId:t,brandId:n,...r?{parentId:r}:{}}),keep:(e,t)=>Ge("POST",`/api/nodes/${e}/keep`,{kept:t}),archiveNode:(e,t)=>Ge("POST",`/api/nodes/${e}/archive`,{archived:t}),deleteNode:e=>Ge("DELETE",`/api/nodes/${e}`),deleteNodesBatch:e=>Ge("POST","/api/nodes/delete-batch",{nodeIds:e}),settings:()=>Ge("GET","/api/settings"),saveSettings:e=>Ge("PUT","/api/settings",e),costs:()=>Ge("GET","/api/costs/summary"),home:()=>Ge("GET","/api/home"),reveal:()=>Ge("POST","/api/system/reveal"),version:()=>Ge("GET","/api/version"),updateStatus:()=>Ge("GET","/api/update/status"),updateCheck:()=>Ge("POST","/api/update/check"),updateApply:()=>Ge("POST","/api/update/apply"),updateRestart:()=>Ge("POST","/api/update/restart"),desktop:()=>Ge("GET","/api/desktop"),phone:(e=!1)=>Ge("GET",e?"/api/phone?fresh=1":"/api/phone"),phoneNewCode:()=>Ge("POST","/api/phone/code"),phoneHelp:()=>Ge("GET","/api/phone/help"),phoneAllow:()=>Ge("POST","/api/phone/allow"),desktopInstall:()=>Ge("POST","/api/desktop/install"),quit:()=>Ge("POST","/api/system/quit"),releaseNotes:()=>Ge("GET","/api/release/notes"),releaseSeen:e=>Ge("POST","/api/release/seen",{version:e}),releaseUsed:e=>Ge("POST","/api/release/used",{feature:e}),sceneFrames:e=>Ge("GET",`/api/scene-previews/${e}`),pickSceneView:(e,t)=>Ge("POST",`/api/scenes/${e}/views/${t}/pick`),deleteData:e=>Ge("DELETE",`/api/data?scope=${e}`),libraryProduct:(e,t)=>Ge("GET",`/api/brands/${e}/products-library/${encodeURIComponent(t)}`),productsLibrary:e=>Ge("GET",`/api/brands/${e}/products-library`),catalogImport:(e,t,n)=>Ge("POST",`/api/brands/${e}/catalog/import`,n?{url:t,urls:n}:{url:t}),catalogScan:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/scan`,t?{url:t}:{}),catalogDetails:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/details`,{urls:t}),catalogScanState:(e,t,n)=>Ge("GET",`/api/brands/${e}/catalog/scans/${t}`,void 0,n),cancelCatalogScan:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/scans/${t}/cancel`),catalogJob:(e,t)=>Ge("GET",`/api/brands/${e}/catalog/jobs/${t}`),catalogJobs:e=>Ge("GET",`/api/brands/${e}/catalog/jobs`),cancelCatalogJob:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/jobs/${t}/cancel`),deleteCatalogProduct:(e,t)=>Ge("DELETE",`/api/brands/${e}/catalog/products/${t}`),updateProduct:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/products/${t}`,n),updateCatalogProduct:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/catalog/products/${t}`,n),productSize:(e,t)=>Ge("GET",`/api/brands/${e}/products/${t}/size`),setProductSize:(e,t,n)=>Ge("PUT",`/api/brands/${e}/products/${t}/size`,{size:n}),setProductShots:(e,t,n)=>Ge("PUT",`/api/brands/${e}/products/${t}/shots`,{files:n}),assetBuildCapabilities:()=>Ge("GET","/api/asset-builds/capabilities"),startAssetBuild:(e,t)=>Ge("POST",`/api/brands/${e}/asset-builds`,t),assetBuild:(e,t)=>Ge("GET",`/api/brands/${e}/asset-builds/${t}`),assetBuilds:e=>Ge("GET",`/api/brands/${e}/asset-builds`),cancelAssetBuild:(e,t)=>Ge("POST",`/api/brands/${e}/asset-builds/${t}/cancel`),deleteAssetBuild:(e,t)=>Ge("DELETE",`/api/brands/${e}/asset-builds/${t}`),createProduct:(e,t)=>Ge("POST",`/api/brands/${e}/products`,t),createPresenterDraft:(e,t)=>Ge("POST",`/api/brands/${e}/presenter-drafts`,t),presenterDrafts:e=>Ge("GET",`/api/brands/${e}/presenter-drafts`),presenterDraft:(e,t)=>Ge("GET",`/api/brands/${e}/presenter-drafts/${t}`),updatePresenterDraft:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/presenter-drafts/${t}`,n),generateDraftView:(e,t,n,r={})=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/generate`,r),approveDraftView:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/approve`),redoDraftView:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/redo`),revertDraftView:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/revert`),stopDraft:(e,t)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/stop`),restoreDraftView:(e,t,n,r)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/restore`,{hash:r}),savePresenterDraft:(e,t)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/save`),deletePresenterDraft:(e,t)=>Ge("DELETE",`/api/brands/${e}/presenter-drafts/${t}`),createPresenter:(e,t)=>Ge("POST",`/api/brands/${e}/presenters`,t),updatePresenter:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/presenters/${t}`,n),deletePresenter:(e,t)=>Ge("DELETE",`/api/brands/${e}/presenters/${t}`),duplicatePresenter:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenters/${t}/duplicate`,{name:n}),editPresenter:(e,t)=>Ge("POST",`/api/brands/${e}/presenters/${t}/edit`),revertPresenter:(e,t)=>Ge("POST",`/api/brands/${e}/presenters/${t}/revert`),createScene:(e,t)=>Ge("POST",`/api/brands/${e}/scenes`,t),updateScene:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/scenes/${t}`,n),deleteScene:(e,t)=>Ge("DELETE",`/api/brands/${e}/scenes/${t}`),sceneExamples:(e,t)=>Ge("GET",`/api/brands/${e}/scenes/${t}/examples`),drawSceneExamples:(e,t,n)=>Ge("POST",`/api/brands/${e}/scenes/${t}/examples`,n),stopSceneExamples:(e,t)=>Ge("POST",`/api/brands/${e}/scenes/${t}/examples/stop`),removeSceneExample:(e,t,n)=>Ge("DELETE",`/api/brands/${e}/scenes/${t}/examples/${n}`),generateScenePreview:(e,t)=>Ge("POST",`/api/brands/${e}/scenes/${t}/preview`),rereadScene:(e,t,n)=>Ge("POST",`/api/brands/${e}/scenes/${t}/reread`,{correction:n}),startSceneStudioJob:(e,t)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs`,t),sceneStudioJob:(e,t)=>Ge("GET",`/api/brands/${e}/scene-studio/jobs/${t}`),cancelSceneStudioJob:(e,t)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs/${t}/cancel`),labelSceneStudioJob:(e,t,n)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs/${t}/label`,{label:n}),attachSceneStudioJob:(e,t,n)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs/${t}/attach`,{sceneId:n})},d4="scenri:guide-heading",_G=["first-shot","refine","product","presenter","scene","reuse"],VG=e=>_G.includes(e);function ZG(){try{const e=typeof window>"u"?null:window.sessionStorage.getItem(d4);if(!e)return null;if(e.startsWith("{")){const t=JSON.parse(e);return typeof t.brandId=="string"&&VG(t.task)?{brandId:t.brandId,task:t.task}:null}return{brandId:e,task:"first-shot"}}catch{return null}}function NN(e){try{e?window.sessionStorage.setItem(d4,JSON.stringify(e)):window.sessionStorage.removeItem(d4)}catch{}}const zG={loaded:!1,heading:null,eligible:!1,welcome:null,hidden:!0,done:{},lessons:{},progress:{},dismissed:[],active:null,activeNodes:[],activeDraftId:null,counts:null};let eo={...zG,heading:ZG()},k5=null,x8=null,S5=!1;const f4=new Set;function xc(e){eo=e;for(const t of f4)t()}function MN(e){const t=e;return{...t,lessons:t.lessons??{},progress:t.progress??{},loaded:!0,heading:eo.heading}}function Cp(){return x8??(x8=Ae.guide().then(e=>xc(MN(e))).catch(()=>{eo.loaded||xc({...eo,loaded:!0})}).finally(()=>{x8=null})),x8}function BG(){return!S5&&typeof document<"u"&&(S5=!0,document.addEventListener("visibilitychange",()=>{!document.hidden&&eo.loaded&&Cp()})),k5??(k5=Cp()),k5}function k8(){return Cp()}function UG(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 uc(e){const t=eo;return xc(UG(eo,e)),Ae.guideIntent(e).then(n=>xc(MN(n))).catch(()=>{xc(t),Cp()})}function WG(e){return f4.add(e),()=>f4.delete(e)}const RN=e=>`scenri:guide-via-bar:${e}`,h4=(e,t)=>t==="first-shot"||t==="reuse"?RN(e):`scenri:guide-via:${e}:${t}`;function PN(e,t){const n={brandId:e,task:t};NN(n),xc({...eo,heading:n})}function p4(){NN(null),eo.heading&&xc({...eo,heading:null})}function np(){return eo}function Aw(){return s.useSyncExternalStore(WG,np)}const pt={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:"*"},Do=e=>fs(pt.brand,{brandSlug:e.slug}),Ju=e=>fs(pt.products,{brandSlug:e.slug}),xa=(e,t)=>fs(pt.product,{brandSlug:e.slug,productId:t}),fl=e=>fs(pt.scenes,{brandSlug:e.slug}),zr=(e,t)=>fs(pt.scene,{brandSlug:e.slug,sceneId:t}),hl=(e,t)=>fs(pt.sceneStudio,{brandSlug:e.slug,convoId:t??void 0}),Nw=(e,t,n)=>fs(pt.sceneEdit,{brandSlug:e.slug,sceneId:t,convoId:n??void 0}),li=e=>fs(pt.presenters,{brandSlug:e.slug}),Aa=(e,t)=>fs(pt.presenter,{brandSlug:e.slug,presenterId:t}),pl=(e,t)=>fs(pt.presenterStudio,{brandSlug:e.slug,draftId:t??void 0}),Vm=(e,t)=>fs(pt.presenterEdit,{brandSlug:e.slug,presenterId:t}),Er=e=>fs(pt.hub,{brandSlug:e.slug}),P0=(e,t)=>fs(pt.set,{brandSlug:e.slug,setSlug:t.slug}),jp=e=>fs(pt.whatsNew,{brandSlug:e.slug}),Zm=(e,t,n)=>t?fs(pt.setShot,{brandSlug:e.slug,setSlug:t.slug,shotId:n}):fs(pt.hubShot,{brandSlug:e.slug,shotId:n});function KG(e,t=""){const[,,n,...r]=e.split("/");if(!n)return pt.root;const a=`/${n}${GG(r)}`;return t?a+t:a}function GG(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 S8="Scenri",E5=" - ",C5=40,YG=[["whatsnew","What's new"],["setup","Providers"],["settings","Settings"]],qG=[[pt.setup,"Set up",!1],[pt.hubShot,"Shot",!1],[pt.setShot,"Shot",!1],[pt.hub,"Create",!1],[pt.set,"Create",!0],[pt.kit,"Brand kit",!1],[pt.whatsNew,"What's new",!1],[pt.product,"Products",!0],[pt.products,"Products",!1],[pt.scene,"Scenes",!0],[pt.scenes,"Scenes",!1],[pt.presenter,"Presenters",!0],[pt.presenters,"Presenters",!1],[pt.brand,"Home",!1]];function XG(e){if(!e)return null;const t=e.replace(/[\u0000-\u001F\u007F-\u009F]/g," ").replace(/\s+/g," ").trim();return t?t.length>C5?`${t.slice(0,C5-1).trimEnd()}…`:t:null}function QG(e,t="",n=null){const r=new URLSearchParams(t);for(const[a,i]of YG)if(r.has(a))return i+E5+S8;for(const[a,i,l]of qG)if(vl(a,e))return((l?XG(n):null)??i)+E5+S8;return S8}const LN=s.createContext(null);function JG(){const{pathname:e,search:t}=Un(),[n,r]=s.useState(null);return s.useEffect(()=>{document.title=QG(e,t,n)},[e,t,n]),r}function Gc(e){const t=s.useContext(LN);s.useEffect(()=>{if(t)return t(e??null),()=>t(null)},[t,e])}const eY={scenes:[],collections:[],verticals:[],loaded:!1,error:!1};function tY(){const[e,t]=s.useState(eY),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ae.scenes().then(u=>{DG(u.scenes),l&&t({scenes:u.scenes,collections:u.collections,verticals:u.verticals,loaded:!0,error:!1})}).catch(()=>{l&&!a.current&&t(u=>({...u,loaded:!0,error:!0}))}),()=>{l=!1}},[n]);const i=s.useCallback(l=>{a.current=!!(l!=null&&l.quiet),a.current||t(u=>({...u,loaded:!1,error:!1})),r(u=>u+1)},[]);return{...e,refetch:i}}const nY={presenters:[],categories:[],styles:[],loaded:!1,error:!1};function rY(){const[e,t]=s.useState(nY),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ae.presenters().then(u=>{l&&t({presenters:u.presenters,categories:u.categories,styles:u.styles,loaded:!0,error:!1})}).catch(()=>{l&&!a.current&&t(u=>({...u,loaded:!0,error:!0}))}),()=>{l=!1}},[n]);const i=s.useCallback(l=>{a.current=!!(l!=null&&l.quiet),a.current||t(u=>({...u,loaded:!1,error:!1})),r(u=>u+1)},[]);return{...e,refetch:i}}const sY={demoProducts:[],categories:[],loaded:!1,error:!1};function aY(){const[e,t]=s.useState(sY),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ae.demoProducts().then(u=>{l&&t({demoProducts:u.demoProducts,categories:u.categories,loaded:!0,error:!1})}).catch(()=>{l&&!a.current&&t(u=>({...u,loaded:!0,error:!0}))}),()=>{l=!1}},[n]);const i=s.useCallback(l=>{a.current=!!(l!=null&&l.quiet),a.current||t(u=>({...u,loaded:!1,error:!1})),r(u=>u+1)},[]);return{...e,refetch:i}}const oY={showcase:[],categories:[],loaded:!1,error:!1};function iY(){const[e,t]=s.useState(oY),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ae.showcase().then(u=>{l&&t({showcase:u.showcase,categories:u.categories,loaded:!0,error:!1})}).catch(()=>{l&&!a.current&&t(u=>({...u,loaded:!0,error:!0}))}),()=>{l=!1}},[n]);const i=s.useCallback(l=>{a.current=!!(l!=null&&l.quiet),a.current||t(u=>({...u,loaded:!1,error:!1})),r(u=>u+1)},[]);return{...e,refetch:i}}const Mh=[{id:"brand",label:"Brand kit",Icon:rF,scope:"brand",sub:e=>`What every shot for ${e} can draw on.`},{id:"usage",label:"Usage",Icon:ZI,scope:"brand",sub:e=>`What ${e} has made, one square per day.`},{id:"engines",label:"Providers",Icon:ef,scope:"studio",sub:()=>"Where your images are made, and what each may spend."},{id:"appearance",label:"Appearance",Icon:BI,scope:"studio",sub:()=>"How Scenri looks on this device."},{id:"library",label:"Library",Icon:Nv,scope:"studio",sub:()=>"Your work, as plain files on this computer. Back them up like anything else."},{id:"phone",label:"Local access",Icon:UI,scope:"studio",sub:()=>"Open Scenri on your phone, tablet or another computer, or from your desktop.",feature:"local-access"},{id:"updates",label:"Updates",Icon:hp,scope:"studio",sub:()=>"How this copy of Scenri stays current."},{id:"about",label:"About",Icon:hm,scope:"studio",sub:()=>"The copy of Scenri you are running."},{id:"danger",label:"Danger zone",Icon:mm,scope:"apart",sub:()=>"These do not come back. Export from Library first if you are not certain."}],$N={brand:"brand",usage:"usage",engines:"engines",budget:"engines",general:"appearance",appearance:"appearance",library:"library",phone:"phone",updates:"updates",about:"about",danger:"danger"},lY="index",TN=e=>e!==null&&Object.prototype.hasOwnProperty.call($N,e),cY=e=>TN(e)?$N[e]:"brand",uY=e=>!TN(e),DN=["settings","setup","new","whatsnew","learn","welcome"];function Ol(){const{open:e}=Ar("settings");return s.useCallback(t=>e(t??lY),[e])}function dY(){const{open:e}=Ar("welcome");return s.useCallback(()=>e("1"),[e])}const m4={current:null};function HN(){const{open:e}=Ar("learn");return s.useCallback((t="lessons")=>e(t),[e])}const j5="codex-cli";function Il(){const{open:e}=Ar("setup");return s.useCallback((t=j5)=>{e(typeof t=="string"?t:j5)},[e])}function ON(e){var t;e.preventDefault(),(t=e.currentTarget)==null||t.focus({preventScroll:!0})}function IN({failure:e,density:t,onRetry:n,dismiss:r}){const a=Ol(),i=Il(),{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"}`,m=!u&&!!e.fix,g=!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(Vc,{size:u?15:21,weight:"fill"})}),o.jsxs("div",{className:"sc-fail-txt",children:[o.jsx("b",{children:e.title}),m&&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(J0,{size:u?12:14})," Try again"]}),r&&o.jsx("button",{type:"button",className:"sc-fail-alt",onClick:r.onClick,children:r.label})]}),g&&o.jsxs("details",{className:"sc-fail-raw",children:[o.jsx("summary",{children:"Details"}),o.jsx("pre",{children:e.raw})]})]})}function Mw({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(Vc,{size:16,weight:"fill"}):o.jsx(hm,{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 FN(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 jr=FN(()=>localStorage),Yc=FN(()=>sessionStorage),_N=720*60*60*1e3;function VN(e){return e?e.phase==="ready"?e.blockReason!=="dev"&&e.blockReason!=="unsupervised"&&e.blockReason!=="launcher-too-old":e.canApply:!1}function fY(e){return!!(e!=null&&e.available)&&e.blockReason!=="dev"}function hY(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:VN(e)}}const pY=1800*1e3,A5=300*1e3,E8=e=>new Promise(t=>setTimeout(t,e)),ZN="scenri:update-dismissed",mY=()=>Yc.get(ZN),gY=e=>Yc.set(ZN,e),zN=s.createContext(null);function zm(){const e=s.useContext(zN);if(!e)throw new Error("useUpdateCenter must be used inside UpdateCenterProvider");return e}function vY({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState(!1),[i,l]=s.useState(mY),u=s.useRef(void 0),[f,h]=s.useState(!1);s.useEffect(()=>{let R=!0;return Ae.version().then(P=>R&&h(P.thisComputer===!0)).catch(()=>{}),()=>{R=!1}},[]),s.useEffect(()=>{let R=!0;const P=async()=>{if(R){if(!document.hidden)try{const D=await Ae.updateStatus();R&&n(D)}catch{}R&&(u.current=window.setTimeout(P,pY))}};P();const H=()=>{document.hidden||!R||(window.clearTimeout(u.current),P())};return document.addEventListener("visibilitychange",H),window.addEventListener("focus",H),()=>{R=!1,window.clearTimeout(u.current),document.removeEventListener("visibilitychange",H),window.removeEventListener("focus",H)}},[]);const[p,m]=s.useState(null),g=s.useCallback(async()=>{a(!0);try{n(await Ae.updateCheck()),m(null)}catch(R){m(String((R==null?void 0:R.message)??R))}finally{a(!1)}},[]),w=s.useCallback(()=>{const R=t==null?void 0:t.latest;R&&(gY(R),l(R))},[t]),y=(t==null?void 0:t.latest)!=null&&t.latest===i,[b,k]=s.useState("idle"),[S,E]=s.useState(null),C=s.useCallback(async R=>{k("restarting");try{await Ae.updateRestart()}catch(H){if(typeof H.status=="number"){k("idle"),E(String((H==null?void 0:H.message)??H));return}}const P=Date.now()+3e4;for(;Date.now()<P;){await E8(800);try{if((await Ae.version()).version!==R){location.reload();return}}catch{}}k("idle"),E("The restart did not complete. Check the terminal Scenri runs in.")},[]),A=s.useCallback(async()=>{if(b!=="idle")return null;try{await Ae.quit()}catch(R){if(typeof R.status=="number")return String((R==null?void 0:R.message)??R)}return window.close(),setTimeout(()=>{window.closed||location.replace("about:blank")},300),null},[b]),L=s.useCallback(async()=>{if(b!=="idle")return;E(null);const R=t==null?void 0:t.current;try{if((t==null?void 0:t.phase)!=="ready"){k("applying"),await Ae.updateApply();const P=Date.now()+A5;let H=!1;for(;Date.now()<P;){await E8(1500);const D=await Ae.updateStatus();if(n(D),D.phase==="ready"){H=!0;break}if(D.phase==="error"){E(D.error??"The update could not be staged."),k("idle");return}}if(!H){E("Couldn't download the update. Try again."),k("idle");return}}await C(R)}catch(P){E(String((P==null?void 0:P.message)??P)),k("idle")}},[b,t,C]),T=s.useRef(!1);s.useEffect(()=>{if((t==null?void 0:t.phase)!=="staging"||b!=="idle"||T.current)return;T.current=!0;let R=!0;const P=Date.now()+A5;return(async()=>{for(;R&&Date.now()<P;){if(await E8(1500),!R)return;try{const D=await Ae.updateStatus();if(!R||(n(D),D.phase!=="staging"))return}catch{}}})().finally(()=>{T.current=!1}),()=>{R=!1}},[t==null?void 0:t.phase,b]);const{pathname:M}=Un(),j=M===pt.setup;return o.jsxs(zN.Provider,{value:{status:t,checking:r,checkNow:g,checkError:p,dismissed:y,dismiss:w,apply:L,quit:A,thisComputer:f,busy:b,applyError:S},children:[e,b!=="restarting"&&f&&fY(t)&&!y&&!j&&o.jsx(bY,{}),b==="restarting"&&o.jsx(wY,{version:(t==null?void 0:t.stagedVersion)??(t==null?void 0:t.latest)??null})]})}function wY({version:e}){return o.jsxs(yY,{children:[o.jsx(I7,{size:22}),o.jsx("b",{children:e?`Updating to Scenri ${e}`:"Updating Scenri"}),o.jsx("small",{children:"Restarting. This page reconnects by itself."})]})}function yY({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 bY(){const{status:e,dismiss:t,apply:n,busy:r,applyError:a}=zm(),i=Ol();if(!e)return null;const l=hY(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(KI,{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 xY(e,t){return!e||t.updatedAt>=e.updatedAt}function kY(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0||e[n]===t||!xY(e[n],t))return e;const r=e.slice();return r[n]=t,r}function SY(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 Rw=(e,t)=>`scenri:new-${e}-${t}`,EY=e=>Yc.get(e),CY=(e,t)=>Yc.set(e,t);function L0(e){Yc.del(e),jr.del(e)}function C8(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 N5=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function BN(e,t){const n=Rw(e,t),r=EY(n);if(!r)return null;let a;try{a=JSON.parse(r)}catch{return L0(n),null}if(typeof a!="object"||a===null)return L0(n),null;const i=a;if(i.v!==1||i.brandId!==e||i.kind!==t)return L0(n),null;const l=Date.now()-Date.parse(i.updatedAt??"");return!Number.isFinite(l)||l>_N?(L0(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:N5(i.facets),imageHashes:N5(i.imageHashes),importUrl:typeof i.importUrl=="string"?i.importUrl:"",pending:typeof i.pending=="string"?i.pending:null}}function j8(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};CY(Rw(e,t),JSON.stringify(r))}function Fu(e,t){L0(Rw(e,t))}function jY(e,t,n){const r=BN(e,t);(r==null?void 0:r.pending)===n&&Fu(e,t)}function AY(e,t){if(!e)return!1;if(e.pending===null)return!0;const n=t??"unknown";return n==="failed"||n==="cancelled"||n==="unknown"}const Wu=e=>`scenri:draft-${e}`;let g4=0;function NY(){return g4+=1,()=>{g4-=1}}const kc=()=>g4>0?"":"&fresh=1",MY=e=>jr.get(e),RY=(e,t)=>jr.set(e,t),rp=e=>jr.del(e);function A8(e,t){return e.some(n=>n.t==="text"?!!n.v.trim():n.t!=="template")||Object.values(t).some(n=>!!n.trim())}function M5(e){const t=MY(Wu(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 rp(Wu(e)),null;const a=Date.now()-Date.parse(r.updatedAt??"");return!Number.isFinite(a)||a>_N?(rp(Wu(e)),null):{v:1,brandId:e,updatedAt:r.updatedAt,tokens:r.tokens,tplFields:r.tplFields,setSlug:r.setSlug??null,...v4(r.lent)?{lent:v4(r.lent)}:{}}}function v4(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 Pw(e,t){const n=v4(t.lent),r={v:1,brandId:e,updatedAt:new Date().toISOString(),tokens:t.tokens,tplFields:t.tplFields,setSlug:t.setSlug??null,...n?{lent:n}:{}};RY(Wu(e),JSON.stringify(r))}function R5(e){rp(Wu(e))}const w4="scenri:draft-returned";function PY(e,t){Pw(e,t),window.dispatchEvent(new CustomEvent(w4,{detail:e}))}const UN="the engine",WN=/no engine here can draw/i,LY=[{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=>`${xo(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=>`${xo(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=>`${xo(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=>`${xo(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=>`${xo(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=>`${xo(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=>`${xo(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:WN,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=>`${xo(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=>`${xo(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=>`${xo(e)} finished without making a picture.`,fix:"Run it again. This usually clears on a second try.",retryable:!0}];function xo(e){return e===UN?"The engine":e}function io(e,t){const n=(e??"").trim(),r=(t??"").replace(/\s*\(BYOK\)\s*$/i,"").trim()||UN;if(!n)return{kind:"unknown",title:"This shot did not finish.",raw:"",retryable:!0};for(const a of LY){if(!a.re.test(n))continue;const i=a.title(r)||$Y(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 KN(){return{kind:"cancelled",title:"You stopped this shot.",fix:"The prompt is kept. Run it again whenever.",raw:"",retryable:!0}}function on(e,t,n){const r=e instanceof Error?e.message:typeof e=="string"?e:String((e==null?void 0:e.message)??e),a=io(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 $Y(e){const t=e.trim();if(!t)return t;const n=t[0].toUpperCase()+t.slice(1);return/[.!?]$/.test(n)?n:`${n}.`}const Bm=[{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"}],e1=e=>Bm.filter(e).map(t=>t.id),GN=e1(()=>!0),TY=e1(e=>e.tier==="core"),YN=e1(e=>e.tier==="supplementary"),Pc=Object.fromEntries(Bm.map(e=>[e.id,e.strip])),kn=Object.fromEntries(Bm.map(e=>[e.id,e.name])),Sc=e=>kn[e],qN=Object.fromEntries(Bm.map(e=>[e.id,e.from])),y4=new Set(e1(e=>e.gate===!0)),Qo=e=>y4.has(e)?void 0:"auto",z0=4,P5=25*1024*1024,ci=e=>e1(t=>{var n;return t.tier==="core"||!!e.extras||((n=e.views[t.id])==null?void 0:n.status)!=="empty"});function Um(e){return ci(e).find(t=>e.views[t].status!=="approved")??null}const DY=e=>Um(e)===null,ui=e=>e.views.portrait.status==="approved"||!!e.views.portrait.prior,Lc=e=>e.stage!=="idle"||!!e.activeView;function Lw(e){if(Lc(e))return null;const t=Um(e);if(!t)return null;const n=e.views[t];return n.status!=="empty"&&n.status!=="stale"||n.error?null:qN[t].every(r=>e.views[r].status==="approved")?t:null}function XN(e,t){return t??(Lc(e)?e.activeView:null)??Um(e)??"portrait"}function QN(e,t){return ci(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:Pc[n],state:a,hash:r.hash,photo:r.origin==="photo",drawing:e.activeView===n,approved:r.status==="approved",error:!!r.error}})}const HY={woman:"a woman",man:"a man",androgynous:"an androgynous person"},OY={woman:"her",man:"his",androgynous:"their"},Ap=/\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,IY=/^(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 FY(e){const t=e.trim().split(/[^\p{L}\p{N}']+/u).filter(Boolean);return t.some(n=>Ap.test(n))?t.every(n=>IY.test(n)||Ap.test(n)):!1}const $w=/\b(\d0s|\d{2}\s*(years|yo)|teen|twenties|thirties|forties|fifties|sixties|seventies|elderly|young|old(er)?|middle-aged|adult)\b/i,_Y=120,VY=18;function ZY(e){const t=e.match(/\d+/g);return t!=null&&t.length?t.every(n=>{const r=Number(n);return r>=VY&&r<=_Y}):!1}const zY=/\b(hair|bald|shaved|buzz|blonde?|brunette|redhead|ginger|greying|silver|auburn|platinum)\b/i,BY=/\b(skin|complexion|fair|pale|light|olive|tan|tanned|brown|deep|dark|ebony|black|white|freckled|golden)\b/i,UY=/\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,WY=/\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,KY=/\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,ga=e=>UY.test(e)||$w.test(e)||zY.test(e)||BY.test(e)||WY.test(e)||KY.test(e);function GY(e,t){const n=t.trim();if(!n)return"";const r=[],a=e.steer&&!Ap.test(n)?HY[e.steer]:"";if(a&&r.push(a),e.age&&!$w.test(n)){const l=e.steer?OY[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 YY(e,t){var r;const n=((r=e.analysis)==null?void 0:r.suitableCategories)??[];return!n.length||t.length?null:n}function JN(e){return GN.some(t=>{const n=e.views[t];return!!n.hash&&n.origin!=="photo"&&n.status!=="empty"})}function qY(e,t){if(Lc(e))return"Still drawing";for(const n of ci(e)){const r=e.views[n];if(r.status==="candidate")return`Decide on the ${Sc(n)} first`;if(r.status==="stale")return`Redo the ${Sc(n)} first`;if(r.status!=="approved")return`Use the ${Sc(n)} first`}return t.trim()?null:"Give them a name"}const eM=/\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 tM(e,t,n){if(!e.trim())return{blocked:"Say what should change."};if(!ui(n))return n.views.portrait.status!=="candidate"?{blocked:"Nothing to adjust yet."}:{view:"portrait",scope:"identity"};if(t==="portrait"||eM.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 ${Sc(t)} yet.`}:{view:t,scope:"view"}}function L5(e,t){return ui(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 XY(e,t,n){const r=e.trim(),a=tM(r||"this",t,n);if("blocked"in a)return r?{chip:null,hint:a.blocked,tone:"alert"}:{chip:null,hint:L5(t,n)};const i=ui(n)?a.scope==="identity"?"Changing the person":`Refining the ${kn[a.view]}`:"Adjusting the face";return{chip:{view:a.view,label:i},hint:L5(t,n)}}const $5=e=>e.charAt(0).toUpperCase()+e.slice(1);function QY(e){var p,m,g,w;if(e.source!=="photos"||e.stage==="analyzing")return null;const t=(p=e.readError)==null?void 0:p.trim();if(t){const y=io(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=(g=(m=e.analysis)==null?void 0:m.conflict)==null?void 0:g.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=ci(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(Sc).join(" and "):`${y.slice(0,-1).map(Sc).join(", ")} and ${Sc(y[y.length-1])}`,f=i.length?`${$5(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.":`${$5(u(l))} ${l.length===1?"is":"are"} drawn from them.`;return{text:[f,h].filter(Boolean).join(" ")}}const nM=e=>{var t;return(e.activeView?(t=e.views[e.activeView])==null?void 0:t.startedAt:void 0)??e.updatedAt};function rM(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 ${kn[t]}`}function Tw(e,t){return sM(t).some(n=>!!e.views[n].hash)}function sM(e){const t=new Set;for(let n=!0;n;){n=!1;for(const r of GN)r===e||t.has(r)||qN[r].some(a=>a===e||t.has(a))&&(t.add(r),n=!0)}return[...t]}function JY(e,t){const n=e.views[t].hash;return n?sM(t).some(r=>{const a=e.views[r];return!!a.hash&&!(a.conditionedOn??[]).includes(n)}):!1}function aM(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 eq=["hero","close","hands","angle","bold"],Ya={hero:"Hero",close:"Close-up",hands:"Hands",angle:"Another angle",bold:"A bold one"},ed={place:"Place",hero:"Hero",close:"Close-up",hands:"Hands",angle:"Angle",bold:"Bold"},T5={hero:"hero",close:"close-up",hands:"hands",angle:"other angle",bold:"bold one"},oM=(e,t)=>!!e&&e.status==="running"&&e.roles.includes(t)&&!e.done.includes(t)&&!e.failed.some(n=>n.role===t);function iM(e=[],t){const n=[];for(const r of eq){const a=e.find(l=>l.role===r);if(oM(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 tq(e,t=[],n){return e.filter(r=>!t.some(a=>a.role===r)&&!oM(n,r))}function nq(e=[]){return e.filter(t=>t.earlier).map(t=>t.role)}function Dw(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 T5?T5[e.step]:null;return`${n?`Drawing the ${n}`:"Drawing examples"}${t}`}return e.done===1?"One example drawn":`${e.done??0} examples drawn`}function df(e){const t=io(e);return t.kind==="unknown"?null:[t.title,t.fix].filter(Boolean).join(" ")}const lM=50;function Wa(e){return Date.parse(e.includes("T")?e:`${e.replace(" ","T")}Z`)}function Ka(e){return e.startedAt||e.createdAt}function Wm(e,t=Date.now()){const n=Wa(e);return Number.isNaN(n)?0:Math.max(0,Math.round((t-n)/1e3))}function Hw(e,t=Date.now()){const n=Wm(e,t);return n<20?"generating":n<60?"still generating":"taking longer than usual"}function $c(e,t=Date.now()){const n=Wm(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 cM(e,t=Date.now()){const n=Wm(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 uM(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 dM=e=>e.setNames.length>0?`${e.setNames.join(", ")} · `:"";function rq(e){const t=io(e);return t.kind==="restarted"?t.title:e??"failed"}function b4(e,t,n=Date.now(),r=1){const a=dM(e),i=r>1?`${r} shots`:"ready",l=e.status==="running"?`${a}${Hw(Ka(e),n)}`:e.status==="error"?`${a}${rq(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 · ${Hr(e)}`:Hr(e),subtitle:l,thumb:e.images[0]??null,percent:null,startedAt:e.status==="running"?Ka(e):e.createdAt,href:Zm(t,null,e.id)}}function sq(e,t,n=Date.now()){var f,h;const r=[...e].sort((p,m)=>(p.batchIndex??0)-(m.batchIndex??0)),a=r[0];if(r.length===1)return b4(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=b4({...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:`${dM(a)}${i.length} of ${r.length} shots`}:u}function aq(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 oq="content:library";function iq(e){return{id:oq,kind:"catalog",state:"running",title:"Downloading the Scenri library",subtitle:"Pictures for the examples, products and presenters, once",thumb:null,percent:null,startedAt:e,href:null}}function lq(e,t){const n=aq(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:uM(e),startedAt:e.createdAt,href:Ju(t)}}function cq(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"?Aa(t,e.assetId):zr(t,e.assetId):null}}function uq(e){if(e.kind==="examples"){const n=Dw(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 kn?kn[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 dq(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?Nw(t,e.sceneId,e.conversation):hl(t,e.conversation):e.attachTo?zr(t,e.attachTo):null:e.presenterId?Vm(t,e.presenterId):e.draftId?pl(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:uq(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 x4=e=>e.startsWith("scene:")||e.startsWith("presenter:")||e.startsWith("examples:");function D5(e,t){return e?e.split("?")[0].replace(/\/$/,"")===t.replace(/\/$/,""):!1}function H5(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(jr.get(`scenri:scene-studio:${n}:${i[1]}`)??"null"))==null?void 0:l.sceneId)===r}catch{return!1}}function fq(e,t=12){const n=e.filter(a=>a.state==="running"),r=e.filter(a=>a.state!=="running").sort((a,i)=>Wa(i.startedAt)-Wa(a.startedAt)).slice(0,t);return n.sort((a,i)=>Wa(a.startedAt)-Wa(i.startedAt)),[...n,...r]}function hq(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 pq(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)&&(x4(r.id)||r.id.startsWith("build:"))).map(r=>({...r,state:"error",subtitle:"Lost when Scenri restarted. Start it again."}))}function mq(e,t){return e.length===0?null:new Map([...t.map(n=>[n.id,n]),...e.map(n=>[n.id,n])])}function gq(e,t,n=lM){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)=>Wa(i.at)-Wa(a.at)).slice(0,n)}function vq(e,t){const n=e.filter(a=>!a.watched);if(!t)return n.length;const r=Wa(t);return n.filter(a=>Wa(a.at)>r).length}const fM=e=>`scenri:notifications-${e}`,hM=e=>`scenri:notifications-seen-${e}`,pM=e=>jr.get(e),mM=(e,t)=>jr.set(e,t);function O5(e){const t=pM(fM(e));if(!t)return[];try{const n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}}const I5=(e,t)=>mM(fM(e),JSON.stringify(t.slice(0,lM))),F5=e=>pM(hM(e)),wq=(e,t)=>mM(hM(e),t),gM=e=>`scenri:activity-running-${e}`;function yq(e){const t=Yc.get(gM(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 bq=(e,t)=>Yc.set(gM(e),JSON.stringify(t.filter(n=>n.state==="running")));function N8(e,t){return e===t?!0:e.length!==t.length?!1:JSON.stringify(e)===JSON.stringify(t)}const xq=1500,kq=5e3,vM=s.createContext(null);function sa(){const e=s.useContext(vM);if(!e)throw new Error("useTaskCenter must be used inside TaskCenterProvider");return e}let M8=null;function Sq({brand:e,onActivity:t,children:n}){const r=Bn(),{push:a}=rr(),{refreshBrands:i,noteContent:l}=$n(),u=e.id,[f,h]=s.useState([]),[p,m]=s.useState([]),[g,w]=s.useState([]),y=s.useRef(e);y.current=e;const b=s.useRef([]);b.current=p;const[k,S]=s.useState(()=>O5(u)),[E,C]=s.useState(()=>F5(u)),[A,L]=s.useState(!1),T=s.useRef(null),M=s.useRef(!1),j=s.useRef(null),R=s.useRef(new Set),P=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),K=s.useRef(A);K.current=A;const U=s.useRef(r);U.current=r;const{pathname:I}=Un(),_=s.useRef(!1);_.current=/\/(create|sets)(\/|$)/.test(I);const O=s.useRef(a);O.current=a;const Y=s.useRef(t);Y.current=t,s.useEffect(()=>{T.current=null,R.current=new Set,P.current=0,H.current=new Set,h([]),m([]),w([]),S(O5(u)),C(F5(u))},[u]);const z=s.useCallback(async()=>{var Xe,De;let te,he,re;try{const[{nodes:G,jobs:oe,studio:We=[],boot:Oe,content:ie},{builds:X}]=await Promise.all([Ae.activity(u),Ae.assetBuilds(u)]);if(y.current.id!==u)return;he=X,re=We,Oe&&j.current&&Oe!==j.current&&(M.current=!0),Oe&&(j.current=Oe),(Xe=Y.current)==null||Xe.call(Y,u,G),B.current(ie),ie!=null&&ie.arriving&&(M8??(M8=new Date().toISOString()));const se=new Map,Re=[];for(const Ye of G)Ye.batchId?se.set(Ye.batchId,[...se.get(Ye.batchId)??[],Ye]):Re.push(Ye);const _e=Date.now();te=[...Re.map(Ye=>b4(Ye,y.current,_e)),...[...se.values()].map(Ye=>sq(Ye,y.current,_e)),...oe.map(Ye=>lq(Ye,y.current)),...X.map(Ye=>cq(Ye,y.current)),...We.map(Ye=>dq(Ye,y.current)),...ie!=null&&ie.arriving&&M8?[iq(M8)]:[]]}catch{M.current=!0;return}const ee=he.filter(G=>G.finished&&G.assetId&&!H.current.has(G.id)),J=new Set(he.map(G=>G.id)),ae=b.current.some(G=>!G.finished&&!J.has(G.id)),Me=re.filter(G=>G.kind==="scene"&&G.status==="done"&&!!G.attachTo&&!H.current.has(G.id));for(const G of Me)H.current.add(G.id);const ue=re.filter(G=>G.kind==="examples"&&(G.done??0)>0).map(G=>`${G.id}:${G.done}`).filter(G=>!H.current.has(G));for(const G of ue)H.current.add(G);if(ee.length||ae||Me.length||ue.length){for(const G of ee)H.current.add(G.id),jY(u,G.kind,G.id);if(await D.current(),y.current.id!==u)return}m(G=>N8(G,he)?G:he),w(G=>N8(G,re)?G:re);const Se=T.current??mq(yq(u),te),Be=M.current?pq(Se,te):[];M.current=!1;const vt=hq(Se,[...te,...Be]);T.current=new Map(te.map(G=>[G.id,G])),bq(u,te),P.current=te.filter(G=>G.state==="running").length;const Ue=fq(te);if(h(G=>N8(G,Ue)?G:Ue),vt.length!==0&&(S(G=>{const oe=window.location.pathname,We=vt.map(ie=>x4(ie.id)&&(D5(ie.href,oe)||H5(ie,oe,u))?{...ie,watched:!0}:_.current&&ie.state!=="error"?{...ie,watched:!0}:ie),Oe=gq(G,We);return I5(u,Oe),Oe}),!K.current))for(const G of vt){if(R.current.has(G.id)||(R.current.add(G.id),G.state==="cancelled"))continue;if(x4(G.id)){const Oe=window.location.pathname;if(D5(G.href,Oe)||H5(G,Oe,u))continue;const ie=G.href,X=ie?[{label:"Open",onClick:()=>U.current(ie)}]:void 0;if(G.state==="error"){O.current({kind:"error",title:`${G.title} did not finish`,detail:G.subtitle,actions:X});continue}if(G.state==="partial"){O.current({kind:"warning",title:G.id.startsWith("examples:")?`Some ${G.title} examples did not draw`:`${G.title} did not fully finish`,detail:G.subtitle,actions:X});continue}O.current({kind:"success",title:G.id.startsWith("examples:")?`${G.title} examples are ready`:G.kind==="scene"&&!G.thumb?`${G.title} is changed`:`${G.title} is drawn`,detail:G.kind==="presenter"?G.subtitle:void 0,actions:X});continue}if(G.state!=="error"&&_.current&&G.kind!=="presenter"&&G.kind!=="scene")continue;const oe=G.href,We=oe?{label:"View",onClick:()=>U.current(oe)}:void 0;if(G.state==="error"){const Oe=_.current&&(G.kind==="generation"||G.kind==="edit");O.current({kind:"error",title:`${G.title} failed`,detail:G.subtitle,action:We,quiet:Oe});continue}if(G.kind==="presenter"||G.kind==="scene"){const Oe=G.id.startsWith("build:")?((De=he.find(X=>`build:${X.id}`===G.id))==null?void 0:De.assetId)??null:null,ie=Er(y.current);O.current({kind:"success",title:`${G.title} is ready`,detail:G.subtitle,actions:oe?[{label:G.kind==="presenter"?"View presenter":"View scene",onClick:()=>U.current(oe)},{label:"Use in a shot",onClick:()=>U.current(`${ie}?${G.kind==="presenter"?"presenter":"scene"}=${Oe}&compose=1${kc()}`)}]:void 0});continue}if(G.kind==="catalog"&&G.state==="partial"){O.current({kind:"warning",title:"Some products did not import",detail:G.subtitle,action:We});continue}O.current({kind:"success",title:G.kind==="catalog"?"Import finished":"Generation finished",detail:G.kind==="catalog"?G.title:void 0,action:We})}},[u]);s.useEffect(()=>{let te=null,he=!0,re=0;const ee=async ae=>{if(!he||ae!==re||(document.hidden||await z(),!he||ae!==re))return;const Me=!document.hidden&&P.current>0;te=setTimeout(()=>void ee(ae),Me?xq:kq)},J=()=>{te&&clearTimeout(te),te=null,re+=1,document.hidden||ee(re)};return V.current=J,ee(re),document.addEventListener("visibilitychange",J),window.addEventListener("focus",J),()=>{he=!1,V.current=null,te&&clearTimeout(te),document.removeEventListener("visibilitychange",J),window.removeEventListener("focus",J)}},[z]);const q=s.useCallback(()=>{var te;return(te=V.current)==null?void 0:te.call(V)},[]),Z=s.useCallback(()=>{const te=new Date().toISOString();C(te),wq(u,te)},[u]),Q=s.useCallback(()=>{S([]),I5(u,[]),Z()},[u,Z]),me=s.useMemo(()=>({tasks:f,running:f.filter(te=>te.state==="running").length,builds:p,studio:g,feed:k,unread:vq(k,E),markSeen:Z,clearFeed:Q,panelOpen:A,setPanelOpen:L,poke:q}),[f,p,g,k,E,Z,Q,A,q]);return o.jsx(vM.Provider,{value:me,children:n})}const wM=["primary","mark","wordmark","monochrome","alternate"],Ow=["light","dark","any"],Rh={primary:"Primary logo",mark:"Mark",wordmark:"Wordmark",monochrome:"Monochrome",alternate:"Alternate"},Eq=/^[a-f0-9]{32}$/,Cq=e=>{const t=String(e??"");if(!t.startsWith("asset:"))return null;const n=t.slice(6);return Eq.test(n)?n:null},jq=e=>wM.includes(e)?e:"primary",Aq=e=>Ow.includes(e)?e:"any";function t1(e){return(Array.isArray(e==null?void 0:e.logos)?e.logos:[]).filter(n=>n&&String(n.file??"").trim()).map(n=>{const r=Cq(n.file),a=String(n.clearSpace??"").trim();return{hash:r,file:String(n.file),role:jq(n.role),background:Aq(n.background),...a?{clearSpace:a}:{},attachable:r!==null}})}function n1(e){return t1(e).filter(t=>t.attachable)}function Km(e){return e.find(t=>t.role==="primary")??e[0]??null}function Nq(e){return Km(t1(e))}function Mq(e){const t=t1(e);return t.find(n=>n.role==="mark")??Km(t)}function Rq(e){const t=t1(e).filter(a=>a.hash),n=t.find(a=>a.role==="mark");if(n)return{mark:n,square:!0};const r=Km(t);return!r||r.role==="wordmark"?null:{mark:r,square:!1}}const Pq=1.6,Lq=(e,t)=>t>0&&e/t<=Pq;function $q(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 Tq=e=>e.length>0&&e.every(t=>t>=200);function Gm(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 Iw(e){const{brand:t}=cn(),{pathname:n}=Un(),r=!!pn(pt.brand),a=!!pn({path:pt.hub,end:!1}),i=!!pn({path:pt.set,end:!1}),l=a||i,u=!!pn({path:pt.products,end:!1}),f=!!pn({path:pt.scenes,end:!1}),h=!!pn({path:pt.presenters,end:!1}),p=m=>m?"fill":"regular";return[{key:"home",label:"Home",icon:o.jsx(XI,{size:e,weight:p(r)}),active:r,to:Do(t)},{key:"create",label:"Create",icon:o.jsx(oF,{size:e,weight:p(l)}),active:l,to:l?`${n}?compose=1`:`${Er(t)}?compose=1`},{key:"products",label:"Products",icon:o.jsx(pm,{size:e,weight:p(u)}),active:u,to:Ju(t)},{key:"presenters",label:"Presenters",icon:o.jsx(fm,{size:e,weight:p(h)}),active:h,to:li(t)},{key:"scenes",label:"Scenes",icon:o.jsx(dm,{size:e,weight:p(f)}),active:f,to:fl(t)}]}const ka=e=>{var t,n;return((n=(t=e.json)==null?void 0:t.meta)==null?void 0:n.name)??e.slug};function Dq(e){return([...e.trim()].find(n=>new RegExp("\\p{L}|\\p{N}","u").test(n))??"?").toUpperCase()}function Hq(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 _5=new Map;function Oq(e,t){const n=e.naturalWidth,r=e.naturalHeight,a=t||Lq(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=Tq($q(n,r).map(([f,h])=>u.getImageData(f,h,1,1).data[3])))}catch{}return{fits:a,bleed:i}}function yM({brand:e,size:t=20,round:n=!1}){var h,p,m;const[,r]=s.useReducer(g=>g+1,0),a=Rq(e.json),i=a?_m(a.mark.file,"micro"):null,l=i?_5.get(i):void 0,u=i&&(l!=null&&l.fits)?i:null,f=((m=(p=(h=e.json)==null?void 0:h.palette)==null?void 0:p.primary)==null?void 0:m.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:Hq(f)}},"aria-hidden":!0,children:[u?o.jsx("img",{src:u,alt:""}):Dq(ka(e)),i&&!l&&o.jsx("img",{src:i,alt:"",hidden:!0,onLoad:g=>{_5.set(i,Oq(g.currentTarget,!!(a!=null&&a.square))),r()}})]})}function Iq(){const e=Iw(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(Zn,{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 Fq({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 _q({mode:e,lead:t,running:n,unread:r,animate:a}){const i=Vq(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(Fq,{value:l?(t.percent??0)/100:0,indeterminate:!l,size:32}),t.thumb?o.jsx("img",{src:mn(t.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):o.jsx(r8,{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(r8,{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(r8,{size:18})})}function Vq(e){return s.useRef(e).current}const Np=new Set;let td=0;const bM=e=>{td=requestAnimationFrame(bM);for(const t of Np)t(e/1e3)};function xM(e){Np.add(e),td||(td=requestAnimationFrame(bM))}function kM(e){Np.delete(e),!Np.size&&td&&(cancelAnimationFrame(td),td=0)}function Zq(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 zq(e,t,n){const r=Zq(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 B0(e){const t=getComputedStyle(e),n=V5(t.getPropertyValue("--sc-fg").trim()||"#f5f5f5"),r=V5(t.getPropertyValue("--sc-raised").trim()||"#1a1a1a");return{ink:[0,1,2].map(a=>Math.round(n[a]*.22+r[a]*.78)),ground:r}}const k4=e=>(255<<24|e[2]<<16|e[1]<<8|e[0])>>>0,R8=(e,t,n)=>(.2126*e+.7152*t+.0722*n)/255,ff=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Bq(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 V5(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 Nu=2,Uq=8,SM=.55,EM=Math.PI*2,Wq=e=>e<0?0:e>1?1:e,CM=e=>e-Math.floor(e),Fw=e=>{const t=Wq(e);return t*t*(3-2*t)},Mp=(e,t,n)=>Fw((e-t)/(n-t)),_w=(e,t)=>4*(.35*e+.8*t)/EM;function Kq(e){const t=Math.min(1,Math.max(.3,e/240));return{short:e*t,gain:1+(1-t)*.6}}function jM(e,t){const n=Math.max(4,Math.round(e/Nu)),r=Math.max(4,Math.round(t/Nu)),a=n*Nu,i=r*Nu,{short:l,gain:u}=Kq(Math.min(a,i)),f=new Float32Array(n*r),h=new Float64Array(n*r),p=new Float64Array(n*r);for(let m=0,g=0;m<r;m++)for(let w=0;w<n;w++,g++){const y=((w+.5)*Nu-a/2)/l,b=-((m+.5)*Nu-i/2)/l,k=Math.hypot(y,b);f[g]=u*SM*Fw(k**1.2),h[g]=1/Math.max(k,1e-6)**1.2,p[g]=6*Math.atan2(b,y)/EM}return{w:n,h:r,shape:f,curl:h,arm:p,thr:zq(Uq,n,r)}}const Gq=.6,Yq=(e,t)=>t===null?1:Fw((e-t)/Gq);function S4(e,t,n,r){const a=e.getContext("2d"),i=k4(t.ink);let l=null,u=null,f=new Uint32Array(0);return{size(h,p){a&&(l=jM(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=Yq(h,r),m=_w(h,n),{shape:g,curl:w,arm:y,thr:b}=l;for(let k=0;k<f.length;k++)f[k]=g[k]*p*CM(w[k]+y[k]+m)>b[k]?i:0;a.putImageData(u,0,0)}}}function AM(e,t,n,r,a){const i=e.getContext("2d"),{w:l,h:u,shape:f,curl:h,arm:p,thr:m}=jM(r,a);e.width=l,e.height=u;const g=document.createElement("canvas");g.width=l,g.height=u;const w=g.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=R8(...n.ink)>R8(...n.ground),C=new Float32Array(l*u),A=new Float32Array(l*u);for(let P=0;P<C.length;P++){const H=P*4,D=R8(S[H],S[H+1],S[H+2]);C[P]=SM*(E?D:1-D);const B=C[P]>m[P]?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[P]=(1-V+m[P])/2}const L=Qq(A),T=k4(n.ink),M=k4(n.ground),j=i.createImageData(l,u),R=new Uint32Array(j.data.buffer);return(P,H,D)=>{for(let B=0;B<R.length;B++){if(L[B]<H){R[B]=0;continue}const V=f[B]*CM(h[B]+p[B]+D);R[B]=V+(C[B]-V)*P>m[B]?T:M}i.putImageData(j,0,0)}}const Rp=900;function qq(e,t,n,r,a,i,l){const u=AM(e,t,n,a,i),f=Rp/1e3;return{ms:Rp,draw(h){const p=Math.min(h,.6);u==null||u(Mp(h,0,.6),Mp(h,.35,1),_w(l+f*(p-p*p/1.2),r))}}}function Xq(e,t,n,r,a,i,l){const u=AM(e,t,n,a,i),f=Rp/1e3;return{ms:Rp,draw(h){const p=Math.max(0,h-.4);u==null||u(1-Mp(h,.4,1),1-Mp(h,0,.65),_w(l+f-f*(.36-p*p)/1.2,r))}}}function Qq(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 Jq=4;let Gi=null;function eX(e,t){var l;const n=performance.now()/1e3,r=Gi&&Date.now()-Gi.epoch<2500?Gi:null;if(e)return r||(Gi={perf:n,epoch:Date.now()}),((l=r??Gi)==null?void 0:l.perf)??n;if(!t)return null;const a=Wa(t);if(Number.isNaN(a))return null;const i=(Date.now()-a)/1e3;return i>Jq?null:Gi&&Math.abs(a-Gi.epoch)<2500?Gi.perf:n-Math.max(0,i)}const Ph=new Map;function Na({index:e=0,appear:t,since:n,from:r}){const a=s.useRef(null),i=s.useRef(null),[l]=s.useState(()=>eX(t,n)),[u]=s.useState(r),[f,h]=s.useState(()=>!!u&&!ff());return s.useLayoutEffect(()=>{const p=a.current;if(!(p!=null&&p.getContext("2d")))return;const m=ff(),g=i.current,w=u&&(g!=null&&g.complete)&&g.naturalWidth?u:null,y=m||w?null:l;let b=S4(p,B0(p),e,y),k=!0;const S=()=>{const P=p.getBoundingClientRect();P.width<2||P.height<2||(b.size(P.width,P.height),b.draw(performance.now()/1e3))};let E=null,C=0,A=0;const L=()=>{E=null,g&&(g.style.visibility="hidden"),h(!1),S()};if(w&&g){const P=p.getBoundingClientRect(),H=performance.now();for(const[B,V]of Ph)H-V>1e4&&Ph.delete(B);const D=Ph.get(w.at)??H;Ph.set(w.at,D),E=Xq(p,g,B0(p),e,P.width,P.height,D/1e3),C=H-D,A=H,C<E.ms?E.draw(C/E.ms):L()}else g?L():S();const T=P=>{if(E){const H=P*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(P)},M=new ResizeObserver(()=>{E||S()});M.observe(p);const j=new IntersectionObserver(([P])=>{k=P.isIntersecting});j.observe(p);const R=Bq(()=>{b=S4(p,B0(p),e,y),E||S()});return m||xM(T),()=>{kM(T),M.disconnect(),j.disconnect(),R()}},[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 Z5({onClose:e,onSeen:t,onOpenDetail:n}){const{tasks:r,feed:a,unread:i,clearFeed:l}=sa(),u=r.filter(S=>S.state==="running"),{brand:f}=cn(),{push:h}=rr(),p=rX(1e3),m=s.useRef(null),g=s.useRef(null),w=s.useRef(!1);s.useEffect(()=>{var S;!w.current||a.length>0||(w.current=!1,(S=m.current)==null||S.focus({preventScroll:!0}))},[a.length]);const y=()=>{w.current=!0,l()},b=S=>{var E;S.detail===0&&((E=g.current)==null||E.focus({preventScroll:!0})),t()},k=S=>{if(S.startsWith("node:")){Ae.cancelNode(S.slice(5)).catch(E=>h(on(E,"Could not cancel this shot")));return}if(S.startsWith("build:")){Ae.cancelAssetBuild(f.id,S.slice(6)).catch(E=>h(on(E,"Could not stop this build")));return}if(S.startsWith("scene:")){Ae.cancelSceneStudioJob(f.id,S.slice(6)).catch(E=>h(on(E,"Could not stop this scene")));return}if(S.startsWith("presenter:")){const E=S.split(":")[1]??"";Ae.stopDraft(f.id,E).catch(C=>h(on(C,"Could not stop this presenter")));return}S.startsWith("catalog:")&&Ae.cancelCatalogJob(f.id,S.slice(8)).catch(E=>h(on(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(tX,{task:S,now:p,onNavigate:e,onCancel:k,onOpenDetail:n},S.id))]}),a.length===0&&u.length===0?o.jsx("p",{ref:m,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:g,type:"button",className:"sc-notif-clear",onClick:y,children:"Clear all"})]})]}),a.length===0?o.jsx("p",{ref:m,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(nX,{item:S,now:p,onNavigate:e,onSeen:t},S.id))})]})]})}function NM({task:e}){return e.thumb?o.jsx("img",{src:mn(e.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):e.state==="running"?e.kind==="catalog"?o.jsx("span",{className:"sc-placeholder"}):o.jsx(Na,{}):e.state==="error"?o.jsx(Vc,{size:17,weight:"fill"}):e.state==="cancelled"?o.jsx(hF,{size:17,color:"var(--sc-fg3)"}):e.kind==="catalog"?o.jsx(eC,{size:17}):e.kind==="presenter"?o.jsx(fm,{size:17}):e.kind==="scene"?o.jsx(dm,{size:17}):o.jsx(Pa,{size:17})}function tX({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(NM,{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",children:o.jsx("div",{style:{width:`${e.percent}%`}})}):null]}),o.jsx("span",{className:"sc-notif-time",children:i?$c(e.startedAt,t):cM(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(Zn,{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 nX({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(NM,{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:cM(e.at,t)})]});return e.href?o.jsx(Zn,{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 rX(e){const[t,n]=s.useState(()=>Date.now());return s.useEffect(()=>{const r=setInterval(()=>n(Date.now()),e);return()=>clearInterval(r)},[e]),t}function Ld(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 MM({label:e,onClose:t,children:n}){const{sheet:r,grip:a}=Ld(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 RM(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 sX=new Set(["Shift","Control","Alt","AltGraph","Meta","CapsLock","Fn","FnLock","Hyper","Super","OS"]);let Pp=null;function z5(e){Pp!==e&&(Pp=e,document.documentElement.dataset.input=e)}function aX(){const e=n=>{n.isComposing||n.key==="Unidentified"||sX.has(n.key)||z5("keyboard")},t=()=>z5("pointer");return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",t,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",t,!0)}}function oX(){return Pp}function Ym(e){return Pp!=="pointer"&&e.matches(":focus-visible")}function fr({label:e,open:t,children:n}){return o.jsx(jw,{content:e,className:"sc-tip",maxWidth:"220px",...t?{open:!0}:{},children:LM(n)})}function PM(e,t,n){return n?t:o.jsx(fr,{label:e,children:t})}function LM(e){const t=e.props.onFocus;return s.cloneElement(e,{onFocus:n=>{t==null||t(n),oX()==="pointer"&&n.preventDefault()}})}function Us({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:m}=Ld(i);s.useEffect(()=>{e&&window.dispatchEvent(new CustomEvent("scenri:modal-open"))},[e]);const g=l??ON,w=u;return o.jsx(Al,{open:e,onOpenChange:y=>!y&&i(),children:o.jsxs(Nl,{children:[o.jsx(Ml,{className:"sc-newdlg-scrim","data-tone":h}),o.jsx(Rl,{className:"sc-newdlg-layer",...r?{}:{"aria-describedby":void 0},onOpenAutoFocus:g,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",...m,children:o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0})}),a]})})]})})}function Ns({className:e,children:t}){return o.jsx(Pl,{className:e,children:t})}const Ms=s.forwardRef(function({children:t,...n},r){return o.jsx(Hf,{asChild:!0,ref:r,...n,children:t})});function Tc({className:e,asChild:t,children:n}){return o.jsx(_v,{className:e,asChild:t,children:n})}const B5=300,iX={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 E4({brandId:e,jobId:t,onDismiss:n}){const[r,a]=s.useState(null),[i,l]=s.useState(!1);s.useEffect(()=>{let m=!1,g;const w=async()=>{try{const y=await Ae.catalogJob(e,t);if(m)return;a(y),y.finishedAt||(g=setTimeout(w,B5))}catch{m||(g=setTimeout(w,B5*3))}};return w(),()=>{m=!0,g&&clearTimeout(g)}},[e,t]);const u=!!r&&!r.finishedAt,f=r?uM(r):0,h=(r==null?void 0:r.errors)??[],p=async()=>{l(!0);try{await Ae.cancelCatalogJob(e,t)}catch{l(!1)}};return o.jsxs(Us,{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(Cn,{size:16})})})]}),o.jsx(Tc,{className:"sc-imp-sub",children:o.jsxs("span",{role:"status",children:[r?iX[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((m,g)=>o.jsx("li",{children:m.message},g))})]}),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 aa="(max-width: 767px)";function Mr(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 U5=new Map;function lX(e){let t=U5.get(e);if(!t){const n=window.matchMedia(e);t={mq:n,subscribe:r=>(n.addEventListener("change",r),()=>n.removeEventListener("change",r))},U5.set(e,t)}return t}function Vw(){const e=lX("(hover: none)");return s.useSyncExternalStore(e.subscribe,()=>e.mq.matches,()=>!1)}function cX(){const{tasks:e,running:t,unread:n,panelOpen:r,setPanelOpen:a,markSeen:i}=sa(),{brand:l}=cn(),u=Mr(aa),f=uX(),[h,p]=s.useState(null);s.useEffect(()=>p(null),[l.id]),RM(r,()=>a(!1));const m=e.find(k=>k.state==="running")??null,g=t>0?"busy":n>0?"new":"quiet",w="Activity"+(n?`, ${n} unread`:"")+(t?`, ${t} task${t===1?"":"s"} running`:""),y=g==="busy"&&m?`Rendering, ${$c(m.startedAt,Date.now())}`:"Activity",b=o.jsx(_q,{mode:g,lead:m,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":g,"data-on":r||void 0,"aria-label":w,"aria-expanded":r,onClick:()=>a(!r),children:b}),r?o.jsx(MM,{label:"Activity",onClose:()=>a(!1),children:o.jsx(Z5,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})}):null,h?o.jsx(E4,{brandId:l.id,jobId:h,onDismiss:()=>p(null)}):null]}):o.jsxs(o.Fragment,{children:[o.jsxs(md,{open:r,onOpenChange:a,children:[o.jsx(fr,{label:y,children:o.jsx(gd,{children:o.jsx("button",{type:"button",className:"sc-act-btn sc-notif-btn","data-mode":g,"aria-label":w,children:b})})}),o.jsx(vd,{align:"end",sideOffset:20,className:"sc-notif-pop","aria-label":"Activity",children:o.jsx(Z5,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})})]}),h?o.jsx(E4,{brandId:l.id,jobId:h,onDismiss:()=>p(null)}):null]})}function uX(){const[e,t]=s.useState(!1),n=s.useRef(!1);return s.useEffect(()=>{n.current||(n.current=!0,t(!0))},[]),e}function dX(){const e=Iw(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(Zn,{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 C4=s.createContext(null);function $M({label:e,className:t,offset:n=22,trigger:r,children:a}){const i=Mr(aa),[l,u]=s.useState(!1),f=s.useRef(null),h=()=>u(!1),p=s.useCallback(()=>{var m;return(m=f.current)==null?void 0:m.focus({preventScroll:!0})},[]);return RM(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(MM,{label:e,onClose:h,children:o.jsxs("div",{className:"sc-menu-sheet",children:[o.jsx("div",{className:"sc-menu-head",children:e}),o.jsx(C4.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:m=>{var g;(g=f.current)!=null&&g.contains(m.target)&&m.preventDefault()},onCloseAutoFocus:m=>{m.preventDefault();const g=document.activeElement;(!g||g===document.body)&&p()},children:[o.jsx("div",{className:"sc-menu-head",children:e}),o.jsx(C4.Provider,{value:{close:null,focusTrigger:p},children:a})]})]})}function nd({className:e="sc-menu-item",to:t,onSelect:n,disabled:r,children:a,...i}){const l=s.useContext(C4),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(Zn,{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(Zn,{to:t,children:a})}):o.jsx(qn,{className:e,onSelect:f,disabled:r,...i,children:a})}function TM(e,t){return[...e].sort((n,r)=>t(n).localeCompare(t(r),void 0,{sensitivity:"base"})||n.slug.localeCompare(r.slug))}function fX(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 TM(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())},m=s.useRef(null),g=l!==void 0;return o.jsxs(zf,{open:l,onOpenChange:w=>{w&&(h.current=!1),u==null||u(w)},children:[l===void 0&&o.jsx(tN,{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(Bf,{maxWidth:"420px",onOpenAutoFocus:()=>{g&&(m.current=document.activeElement)},onCloseAutoFocus:w=>{var y;!g||!((y=m.current)!=null&&y.isConnected)||(w.preventDefault(),m.current.focus())},children:[o.jsx(Uf,{children:t}),o.jsx(Wf,{size:"2",children:n}),o.jsxs(_s,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Gf,{children:o.jsx(ba,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Kf,{children:o.jsx(ba,{color:"red",onClick:p,disabled:r,children:e})})]})]})]})}function hX(){const{brand:e}=cn(),t=Ol(),n=Bn(),r=zm(),{push:a}=rr(),[i,l]=s.useState(!1),u=async()=>{const f=await r.quit();f&&a({kind:"warning",title:"Scenri is still working",detail:f})};return o.jsxs(o.Fragment,{children:[o.jsxs($M,{label:"Brands",className:"sc-menu-brand",trigger:o.jsx("button",{type:"button",className:"sc-org-btn","aria-label":`${ka(e)}, brand and settings`,children:o.jsx(yM,{brand:e,size:32,round:!0})}),children:[o.jsx(mX,{}),o.jsx("div",{className:"sc-menu-rule"}),o.jsxs(nd,{onSelect:()=>n("/setup"),children:[o.jsx(mr,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Set up a brand"})]}),o.jsxs(nd,{onSelect:()=>t(),children:[o.jsx(WI,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Settings"})]}),r.thisComputer&&o.jsxs(nd,{"data-quit":"",onSelect:()=>l(!0),children:[o.jsx(iF,{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 pX=7;function mX(){const{brands:e}=$n(),{brand:t}=cn(),n=Bn(),[r,a]=s.useState(""),i=g=>ka(g).trim().toLowerCase(),l=new Map;for(const g of e)l.set(i(g),(l.get(i(g))??0)+1);const u=e.length>=pX,f=r.trim(),h=u&&f?fX(e,f,ka):[],p=g=>{const w=g.id===t.id,y=(l.get(i(g))??0)>1;return o.jsxs(nd,{"data-current":w||void 0,"data-two-line":y||void 0,onSelect:w?void 0:()=>n(Do(g)),children:[o.jsx(yM,{brand:g,size:20,round:!0}),o.jsxs("span",{className:"sc-menu-brand-lb",children:[o.jsx("span",{dir:"auto",children:ka(g)}),y&&o.jsxs("span",{className:"sc-menu-brand-sub",children:["/",g.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"})]})]},g.id)},m=TM(e.filter(g=>g.id!==t.id),ka);return u?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"sc-menu-find",children:[o.jsx(fd,{size:16,"aria-hidden":"true"}),o.jsx("input",{type:"search",value:r,placeholder:"Find a brand","aria-label":"Find a brand",onChange:g=>a(g.target.value),onKeyDown:g=>{const w=h.find(y=>y.id!==t.id);g.key!=="Enter"||!w||(g.preventDefault(),n(Do(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),m.map(p)]})})]}):o.jsxs(o.Fragment,{children:[p(t),m.map(p)]})}function gX(){const e=Mr("(min-width: 1024px)"),t=HN(),[n]=El();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 yi(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 Zw(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 DM=["hero","close","hands","angle","bold"],j4=e=>Array.isArray(e)?e.map(t=>Jr(t==null?void 0:t.file)).filter(t=>!!t):[],zw=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 hf(e){return e.length<2?[...e]:e.slice().reverse()}function HM(e){const t=e.filter(n=>n.origin!=="catalog");return t.length===e.length?hf(e):[...hf(t),...e.filter(n=>n.origin==="catalog")]}function r1(e){return hf(zw(e).filter(t=>!t.supersededBy).map(OM))}function vX(e,t){const n=zw(e).find(r=>r.id===t);return n?OM(n):void 0}function Bw(e,t){var i;const n=zw(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 OM(e){var a;const t=j4(e.shots),n=j4(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 hf(t.map(yX))}function pf(e,t){return qc(e).find(n=>n.id===t)}const wX=["place",...DM];function yX(e){var l;const t=j4(e.refs),n=Jr(e.preview)??null,r=Array.isArray(e.examples)?e.examples.filter(u=>DM.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=wX.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 bX(e){const t=e.cover;return!t||t==="place"?"place":!e.examples||e.examples.some(n=>n.role===t&&!n.earlier)?t:"place"}function Lp(e,t){const n=new Set(e.map(r=>r.id));return[...e,...t.filter(r=>!n.has(r.id))]}function sp(e,t){return t.map(n=>n.t==="character"&&n.id?{...n,id:Bw(e,n.id)}:n)}function IM(){const{brand:e,products:t}=cn(),{scenes:n,presenters:r,demoProducts:a,showcase:i}=$n();return s.useMemo(()=>{const l={presenters:r1(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 Ln(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),m=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)}),g=h(l.presenters,y=>y.previewUrl??yi(y).src),w=h(l.scenes,y=>y.previewUrl);return{product:{url:m??p("product")??h(a,y=>y.previewUrl)??null,count:t.length,own:!!m},presenter:{url:g??p("character")??h(r,y=>y.previewUrl??yi(y).src)??null,count:l.presenters.length,own:!!g},scene:{url:w??h(n,y=>y.previewUrl)??p("template")??null,count:l.scenes.length,own:!!w}}},[e,t,n,r,a,i])}const xX=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:pm},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:fm},{kind:"scene",label:"Scene",line:"Where it takes place",noun:"scene",icon:dm}],W5=(e,t)=>e===0?"None yet":`${e} ${t}${e===1?"":"s"}`;function kX({suggest:e,onPick:t}){const n=s.useRef(null),{close:r}=Ar("new"),a=IM(),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(Us,{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(Cn,{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:xX.map(({kind:l,label:u,line:f,noun:h,icon:p})=>{const{url:m,count:g,own:w}=a[l];return o.jsxs("button",{type:"button",className:"sc-pick","data-kind":l,onClick:()=>t(l),"aria-label":`${u}. ${f}. ${W5(g,h)}.`,children:[o.jsxs("span",{className:"sc-pick-media",children:[m?o.jsx("img",{src:m,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:W5(g,h)})]},l)})})})]})}const rd=14,SX=768,bi=[{px:190,label:"Compact",cells:3,cols:6,min:200},{px:320,label:"Large",cells:2,cols:5,min:280}];function EX(e){let t=bi[0];for(const n of bi)Math.abs(n.px-e)<Math.abs(t.px-e)&&(t=n);return t}const FM=320;function _M(e){const t=typeof e=="number"&&Number.isFinite(e)?e:FM;let n=bi[0].px;for(const r of bi)Math.abs(r.px-t)<Math.abs(n-t)&&(n=r.px);return n}const wd=5;function Xc(e){const t=typeof e=="number"?e:wd;return t===7||t===5?t:t===6?5:wd}const CX={5:8,7:14};function jX(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 AX(){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 P8(e,t){return Math.max(1,Math.floor((e-rd*(t-1))/t))}function NX(e,t,n){if(e<=0)return{tile:t,cols:1};if(n)return{tile:Math.floor((e-rd)/2),cols:2};const r=bi[1],a=bi[0],i=Math.min(r.cols,Math.max(1,Math.floor((e+rd)/(r.min+rd))));if(EX(t).px===r.px)return{tile:P8(e,i),cols:i};let l=Math.min(a.cols,i+1);return l>1&&P8(e,l)<a.min&&(l=i),{tile:P8(e,l),cols:l}}function K5(e){return Math.max(1,e)}function qm(e){return Xc(e)===5?"large":"compact"}const s1=s.createContext("large");function VM(){return s.useContext(s1)}const MX=[{value:7,label:"Compact",hint:"More cards per row",cells:3},{value:5,label:"Large",hint:"Fewer, larger cards",cells:2}],RX=bi.map(e=>({value:e.px,label:e.label,hint:e.label==="Compact"?"More shots per row":"Fewer, larger shots",cells:e.cells}));function Xm({value:e,onChange:t}){return o.jsx(ZM,{label:"Grid size",value:Xc(e),options:MX,onChange:n=>t(n)})}function PX({value:e,onChange:t}){return o.jsx(ZM,{label:"Shot size",value:_M(e),options:RX,onChange:t})}function ZM({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(LX,{cells:i.cells})},i.value)})]})}function LX({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 Qm(e){const t=Xc(e),n=(t===5?bi[1]:bi[0]).min;return{"--sc-wall-cols":String(t),"--sc-tile-min":`${n}px`}}function sd({name:e}){const t={size:14,"aria-hidden":!0};switch(e){case"open":return o.jsx(wE,{...t});case"continue":return o.jsx(wa,{...t});case"open-tab":return o.jsx(Cc,{...t});case"refine":return o.jsx(ME,{...t});case"select":return o.jsx(Kn,{...t,weight:"bold"});case"keep":return o.jsx(Qa,{...t});case"kept":return o.jsx(Qa,{...t,weight:"fill"});case"unset":return o.jsx(gE,{...t});case"versions":return o.jsx(XE,{...t});case"archive":return o.jsx(um,{...t});case"restore":return o.jsx(J0,{...t});case"delete":case"discard":return o.jsx(jl,{...t});case"use":return o.jsx(mr,{...t});case"duplicate":return o.jsx(pp,{...t});case"rename":return o.jsx(aF,{...t});case"edit":return o.jsx(Cd,{...t});case"cover":return o.jsx(QI,{...t})}}const zM=new Set;function BM(e){return zM.has(e)}function UM(e){e&&zM.add(e)}function Sa({src:e,srcSet:t,sizes:n=EN.large,crop:r,wait:a,blank:i="sc-lookpage-ref-blank"}){const[l,u]=s.useState(null),[f,h]=s.useState(null),p=s.useRef(null),m=s.useCallback(()=>{UM(e),h(e)},[e]),g=s.useCallback(b=>{p.current=b,b!=null&&b.complete&&b.naturalWidth&&m()},[m]);if(s.useLayoutEffect(()=>{const b=p.current;b!=null&&b.complete&&b.naturalWidth&&m()},[m]),l===e)return o.jsx("span",{className:i,"aria-hidden":!0,children:o.jsx(Pa,{size:20})});const w=BM(e),y=w||f===e;return o.jsxs(o.Fragment,{children:[a&&!y&&o.jsx("span",{className:"sc-placeholder"}),o.jsx("img",{ref:g,src:e,...t?{srcSet:t,sizes:n}:{},alt:"",loading:w?"eager":"lazy",decoding:w?"sync":"async","data-reveal":"","data-ready":y||void 0,"data-cached":w||void 0,...r?{"data-crop":r}:{},onLoad:m,onError:()=>u(e)})]})}function Uw(){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(Pa,{size:20})})})})}function Ww({node:e,to:t}){return o.jsx(Zn,{className:"sc-lookcard","aria-label":`Open ${Hr(e)}`,to:t,children:o.jsx(Sa,{src:mn(e.images[0],"tile"),blank:"sc-lookcard-blank"})})}function ad({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 m=()=>{h||(h=requestAnimationFrame(()=>{h=0,p()}))},g=new ResizeObserver(()=>p());return g.observe(f),f.addEventListener("scroll",m,{passive:!0}),()=>{h&&cancelAnimationFrame(h),i.current=()=>{},g.disconnect(),f.removeEventListener("scroll",m)}},[]);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 m=f.scrollLeft,g=u*h,w=performance.now();a.current=!0;const y=b=>{const k=Math.min(1,(b-w)/420);f.scrollLeft=m+g*(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(Ra,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-slider-arrow next","aria-label":"Next",onClick:()=>l(1),children:o.jsx(Cl,{size:13,weight:"bold"})}),o.jsxs("div",{className:"sc-slider-track",ref:r,children:[t,t]})]})]})}function G5(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(sd,{name:r.icon}),r.label]})]},r.key))}function $X({id:e,previewUrl:t,pending:n,title:r,primary:a,secondary:i,useLabel:l,variant:u,onOpen:f,onUse:h,href:p,selected:m,onToggle:g,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=Vw(),R=VM(),P=(Q,me)=>PM(Q,me,j),H=u==="use"&&!!f&&!!h&&!C,D=b??[],B=D.find(Q=>Q.key==="delete"),V=D.length>0,K=Q=>{Q.preventDefault(),Q.stopPropagation(),A==null||A(e)};s.useEffect(()=>{if(!L)return;const Q=me=>{var te;(te=M.current)!=null&&te.contains(me.target)||T(!1)};return document.addEventListener("pointerdown",Q),()=>document.removeEventListener("pointerdown",Q)},[L]);const U=t?o.jsx(Sa,{src:Ln(t,"tile"),srcSet:wc(t),sizes:EN[R],wait:!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(Pa,{size:20})}),I=Q=>{Q.preventDefault(),Q.stopPropagation()},_=V?o.jsxs(Cs,{children:[P("More",o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-cell-ctl sc-lookcard-more","aria-label":`More for ${a}`,onClick:Q=>Q.stopPropagation(),onContextMenu:Q=>Q.stopPropagation(),children:[o.jsx(Av,{className:"sc-lookcard-more-vert",size:16,weight:"bold"}),o.jsx(jv,{className:"sc-lookcard-more-horiz",size:16,weight:"bold"})]})})),o.jsx(As,{side:"top",align:"end",sideOffset:4,collisionPadding:12,children:G5(D,qn,bc)})]}):null,O=_||B||y?o.jsxs("div",{className:"sc-corner",children:[_,B&&P(B.label,o.jsx("button",{type:"button",className:"sc-cell-ctl sc-lookcard-remove sc-cell-danger","aria-label":B.label,onClick:Q=>{I(Q),B.onSelect()},children:o.jsx(jl,{size:15})})),y&&P(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:Q=>{I(Q),y(e)},children:o.jsx(Qa,{size:15,weight:w?"fill":"regular"})}))]}):null,Y=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":m||void 0,"data-just-added":k||void 0,"aria-pressed":!!m,"aria-label":r,onClick:()=>g==null?void 0:g(e),children:[o.jsxs("span",{className:"sc-lookcard-media",children:[U,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"})})]}),Y]});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)},q=()=>{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(Zn,{className:"sc-lookcard-open",to:p,"aria-label":C?`${E?"Deselect":"Select"} ${a}`:r,onClick:Q=>{if(C&&A){K(Q);return}if(H&&j){if(!L){Q.preventDefault(),T(!0);return}T(!1)}},children:[U,!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:[U,!C&&o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0})]}),H&&o.jsx("button",{type:"button",className:"sc-lookcard-use",onClick:q,children:l}),A&&P(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:K,children:o.jsx(Kn,{size:13,weight:"bold"})}))]}),O,Y]});return D.length===0||j?Z:o.jsxs(qf,{children:[o.jsx(Xf,{children:Z}),o.jsx(Qf,{children:G5(D,Jf,Fm)})]})}function Jm({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 $d=s.memo($X),TX=/^(p|product|products|item|items|dp|sku)$/i;function DX(e){let t="";try{const r=new URL(e).pathname.split("/").filter(Boolean);t=[...r].reverse().find(a=>!TX.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 HX(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 L8=24,OX=12;function WM({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,m]=s.useState(()=>new Set(u)),[g,w]=s.useState(L8),[y,b]=s.useState(()=>{const Z=new Map;for(const Q of t.cards??[])Q.url&&Z.set(Q.url,{externalKey:Q.externalKey,title:Q.title,url:Q.url,images:Q.image?[{url:Q.image}]:[]});for(const Q of t.candidates)Q.url&&Z.set(Q.url,Q);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:DX(Z)})),[u]),R=s.useMemo(()=>j.filter(Z=>HX(Z.name,f)),[j,f]),P=s.useMemo(()=>R.slice(0,g),[R,g]);s.useEffect(()=>w(L8),[f]);const H=s.useRef([]),D=s.useRef(0),B=s.useRef(()=>{}),V=2,K=120,U=s.useCallback(()=>{for(;D.current<V&&H.current.length;){const Z=H.current.splice(Math.max(0,H.current.length-OX));if(!Z.length)return;D.current++,A(D.current),Ae.catalogDetails(e,Z).then(({products:Q})=>{if(!E.current)return;const me=new Map(S.current);for(const te of Q)te.url&&me.set(te.url,te);for(let te=0;te<Q.length&&te<Z.length;te++)me.has(Z[te])||me.set(Z[te],Q[te]);S.current=me,b(me)}).catch(()=>{for(const Q of Z)k.current.delete(Q)}).finally(()=>{D.current=Math.max(0,D.current-1),E.current&&(A(D.current),B.current())})}},[e]);B.current=U,s.useEffect(()=>{const Z=M.current;if(!Z)return;const Q=new IntersectionObserver(me=>{let te=!1;for(const he of me){if(!he.isIntersecting)continue;const re=he.target.dataset.fbId;if(Q.unobserve(he.target),!(!re||S.current.has(re)||k.current.has(re))){for(k.current.add(re),H.current.push(re);H.current.length>K;){const ee=H.current.shift();ee&&k.current.delete(ee)}te=!0}}te&&B.current()},{root:Z,rootMargin:"250% 0px"});for(const me of Z.querySelectorAll("[data-fb-id]"))Q.observe(me);return()=>Q.disconnect()},[g,f]),s.useEffect(()=>{if(!L||g>=R.length)return;const Z=L.closest(".sc-wizpick-grid"),Q=new IntersectionObserver(me=>{me.some(te=>te.isIntersecting)&&w(te=>te+L8)},{root:Z,rootMargin:"0px 0px 300% 0px"});return Q.observe(L),()=>Q.disconnect()},[L,g,R.length]);const I=s.useCallback(Z=>{m(Q=>{const me=new Set(Q);return me.delete(Z)||me.add(Z),me})},[]),_=R.length>0&&R.every(Z=>p.has(Z.url)),O=p.size===u.length,Y=()=>{m(Z=>{const Q=new Set(Z);for(const me of R)_?Q.delete(me.url):Q.add(me.url);return Q})},z=p.size,q=z===1?"1 product":`${z.toLocaleString()} products`;return o.jsxs(Us,{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(Cn,{size:16})})})]}),o.jsx(Tc,{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(fd,{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:Y,disabled:!R.length,children:_?"Select none":f?`Select these ${R.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:[P.map(Z=>{var me,te;const Q=y.get(Z.url);return o.jsx($d,{id:Z.url,previewUrl:((te=(me=Q==null?void 0:Q.images)==null?void 0:me[0])==null?void 0:te.url)??null,pending:!Q,title:(Q==null?void 0:Q.title)??Z.name,primary:(Q==null?void 0:Q.title)??Z.name,secondary:(Q==null?void 0:Q.price)!=null?`${Q.currency??""} ${Q.price}`.trim():(Q==null?void 0:Q.category)??"",useLabel:"Import",variant:"select",selected:p.has(Z.url),onToggle:I,size:"grid"},Z.url)}),g<R.length&&o.jsx("div",{className:"sc-wizpick-end",ref:T,"aria-hidden":!0}),!R.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:()=>O?i():a([...p]),children:n?"Importing":`Import ${q}`})]})]})}const $8=700,IX=45e3,FX=3e3;function KM(e,t){const[n,r]=s.useState(null),[a,i]=s.useState(!1),[l,u]=s.useState(!1),[f,h]=s.useState(null),[p,m]=s.useState(0),g=s.useRef(!0);s.useEffect(()=>(g.current=!0,()=>{g.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 Ae.catalogScan(e,t);if(S=A,b||!g.current){Ae.cancelCatalogScan(e,A).catch(()=>{});return}const L=Date.now()+IX,T=async()=>{if(!(b||!g.current)){if(Date.now()>L){E(null,{kind:"timeout"});return}try{const M=await Ae.catalogScanState(e,A,AbortSignal.timeout(FX));if(b||!g.current)return;if(M.status==="running"){k=setTimeout(T,$8);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||!g.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,$8)}}};k=setTimeout(T,$8)}catch{b||E(null,{kind:"error",reason:"The look for a shop could not start."})}})(),()=>{b=!0,k&&clearTimeout(k),S&&Ae.cancelCatalogScan(e,S).catch(()=>{})}},[e,t,p]);const w=s.useCallback(()=>m(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 mf=[{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"}]}],Kw=new Map(mf.map(e=>[e.key,e]));Kw.get("other");function gf(e){var t;return e?((t=Kw.get(e))==null?void 0:t.label)??e:null}function _X(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 Gw(e){return e.category&&Kw.has(e.category)?e.category:_X(e.productType,e.tags)??null}function VX({title:e,sub:t,error:n,footnote:r,primaryLabel:a,ready:i,blocked:l,busy:u,width:f="440px",onBack:h,onPrimary:p,onPasteFiles:m,children:g}){const{close:w}=Ar("new");return o.jsxs(Us,{maxWidth:f,onDismiss:w,onPaste:y=>{var k;if(!m)return;const b=Array.from(((k=y.clipboardData)==null?void 0:k.files)??[]).filter(S=>S.type.startsWith("image/"));b.length&&(y.preventDefault(),m(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(Ra,{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(Cn,{size:16})})})]}),t&&o.jsx("p",{className:"sc-newdlg-sub",children:t}),o.jsx("div",{className:"sc-newdlg-body",children:g}),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(Lr,{size:"1"}):null,a]}),r&&o.jsx("p",{className:"sc-dlg-foot",children:r})]})]})}function GM({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 Y5({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}=GM({onFiles:l,onReject:u,disabled:r||n});return o.jsxs("button",{type:"button",className:"sc-dropzone",disabled:r||n,onClick:()=>{var m;return(m=h.current)==null?void 0:m.click()},...p,children:[o.jsx("input",{ref:h,type:"file",accept:i,multiple:a,hidden:!0,onChange:m=>{const g=Array.from(m.target.files??[]);m.target.value="",g.length&&l(g)}}),n?o.jsx(Lr,{}):f,o.jsx("span",{className:"sc-dropzone-label",children:e}),t&&o.jsx("small",{children:t})]})}function YM({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(Y5,{label:n,hint:r,busy:a,onFiles:i,onReject:u,children:o.jsx(mr,{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:mn(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(Cn,{size:11,weight:"bold"})})]},h)),f>0&&o.jsx(Y5,{label:`${f} more`,busy:a,onFiles:i,onReject:u,children:o.jsx(mr,{size:15})})]})}let $0=null;const qM=(e,t)=>`${e}:${t}`;function ZX(e,t,n){$0={key:qM(e,t),fields:n}}function zX(e,t){if(!$0||$0.key!==qM(e,t))return null;const{fields:n}=$0;return $0=null,n}const q5={name:"",instruction:"",facets:[],imageHashes:[],importUrl:""};function BX(e,t,n){const r=n.restore??!1,[a,i]=s.useState(q5),[l,u]=s.useState(!1),[f,h]=s.useState(null),p=s.useRef(null),m=s.useRef(null),g=s.useRef(n.pendingState);g.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 R;if(r){const P=zX(e,t);if(P){i(P);return}}const M=BN(e,t),j=M!=null&&M.pending?g.current(M.pending):null;if(M!=null&&M.pending&&j==="unknown"&&((R=w.current)!=null&&R.call(w,M.name))){Fu(e,t);return}if(M&&!M.pending){Fu(e,t);return}M&&AY(M,j)&&(m.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(()=>{m.current&&C8(M)?j8(e,t,{...M,pending:m.current}):Fu(e,t)},400)},[e,t]),S=s.useCallback(M=>{i(j=>{const R={...j,...typeof M=="function"?M(j):M};return k(R),R})},[k]),E=s.useCallback(()=>{var j;p.current&&clearTimeout(p.current);const M=b.current;if(m.current&&C8(M)){j8(e,t,{...M,pending:m.current});return}Fu(e,t),C8(M)&&(ZX(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,R=[];for(const P of M.slice(0,j))R.push(await uf(P));S(P=>({imageHashes:[...new Set([...P.imageHashes,...R])].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(R=>R!==M)})),[S]),L=s.useCallback(M=>S(j=>({facets:j.facets.includes(M)?j.facets.filter(R=>R!==M):[...j.facets,M]})),[S]),T=s.useCallback(M=>{if(p.current&&clearTimeout(p.current),!M){Fu(e,t),m.current=null,i(q5);return}m.current=M,i(j=>(j8(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 X5=6,UX=3;function WX({onBack:e,onStarted:t,restore:n,onDiscarded:r}){var j,R;const{brand:a}=cn(),{applyBrand:i}=$n(),[l,u]=s.useState(!1),[f,h]=s.useState(!1),[p,m]=s.useState(!1),g=BX(a.id,"product",{max:X5,pendingState:()=>"unknown",restore:n,onDiscarded:r}),w=g.fields.imageHashes.length>0&&!g.uploading,y=g.uploading?"Photos are still uploading":w?void 0:"Add at least one photo",b=async()=>{u(!0),g.setErr(null);try{const{productId:P,...H}=await Ae.createProduct(a.id,{name:g.fields.name.trim(),imageHashes:g.fields.imageHashes,category:g.fields.facets[0]});i(H);const D=g.fields.name.trim()||"Product";g.submitted(null),t({kind:"product",id:P,name:D})}catch(P){g.setErr(String(P.message??P))}finally{u(!1)}},[k,S]=s.useState(null),{scan:E,scanning:C,settled:A}=KM(k?a.id:null,k??void 0),L=async P=>{const H=k??g.fields.importUrl.trim()??"";h(!0),g.setErr(null);try{await Ae.catalogImport(a.id,H,P),g.set({importUrl:""}),S(null),t({kind:"product",id:"",name:H})}catch(D){g.setErr(String(D.message??D))}finally{h(!1)}},T=()=>{var H,D;const P=g.fields.importUrl.trim()||(((D=(H=a.json)==null?void 0:H.meta)==null?void 0:D.website)??"");P&&(g.setErr(null),S(P))};s.useEffect(()=>{!k||!A||E&&E.verdict==="found"&&E.candidates.length||L()},[E,A,k]);const M=P=>{P.key==="Enter"&&(P.preventDefault(),w&&!l&&b())};return o.jsxs(VX,{title:"New product",error:g.err,footnote:"Added to this brand. No preview.",primaryLabel:"Add product",ready:w,blocked:y,busy:l,onBack:e,onPrimary:()=>void b(),onPasteFiles:P=>void g.addFiles(P),children:[o.jsxs("div",{className:"sc-assetform",children:[o.jsx(YM,{hashes:g.fields.imageHashes,max:X5,label:"Add packshots",hint:`Straight, well-lit packshots. The first ${UX} are the ones a shot attaches.`,busy:g.uploading,onAdd:P=>void g.addFiles(P),onRemove:g.removeHash,onReject:()=>g.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:g.fields.name,onChange:P=>g.set({name:P.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:mf.map(P=>o.jsx("button",{type:"button",className:"sc-chip","data-on":g.fields.facets[0]===P.key||void 0,"aria-pressed":g.fields.facets[0]===P.key,onClick:()=>g.set({facets:g.fields.facets[0]===P.key?[]:[P.key]}),children:P.label},P.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:((R=(j=a.json)==null?void 0:j.meta)==null?void 0:R.website)??"https://yourstore.com",value:g.fields.importUrl,onChange:P=>g.set({importUrl:P.target.value}),onKeyDown:P=>{P.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:()=>m(!0),children:"Import a catalog from a store URL"})}),E&&E.verdict==="found"&&E.candidates.length>0&&o.jsx(WM,{brandId:a.id,scan:E,busy:f,onImport:P=>void L(P),onImportAll:()=>void L(),onDismiss:()=>S(null)})]})}const T8="1",KX={product:"Product",presenter:"Presenter",scene:"Scene"},GX=["product","presenter","scene"],YX=e=>!!e&&GX.includes(e),XM=s.createContext(null);function QM(){const e=s.useContext(XM);if(!e)throw new Error("useCreateAsset must be used inside AssetCreateHost");return e}function Fl(){return QM().open}function JM(){const e=!!pn({path:pt.products,end:!1}),t=!!pn({path:pt.presenters,end:!1}),n=!!pn({path:pt.scenes,end:!1});return e?"product":t?"presenter":n?"scene":null}function Yw(){const{announce:e,caps:t}=QM();return{announce:e,caps:t}}function qX({children:e}){const{brand:t}=cn(),n=Bn(),r=Un(),{push:a}=rr(),{refreshBrands:i}=$n(),{builds:l,poke:u}=sa(),f=Ar("new"),h=f.value,p=JM(),m=!!pn({path:pt.presenterStudio}),g=!!pn({path:pt.presenterEdit}),w=!!pn({path:pt.sceneStudio}),y=!!pn({path:pt.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,R=f.close,P=s.useCallback((Z,Q)=>{if(L.current=Z==="choose"||!(Q!=null&&Q.onCreated)?null:{kind:Z,fn:Q.onCreated},Z==="presenter"){n(pl(t));return}if(Z==="scene"){n(hl(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"?T8:Z)},[M,n,t,r.pathname,r.search]);s.useEffect(()=>{h==="presenter"&&n(pl(t),{replace:!0}),h==="scene"&&n(hl(t),{replace:!0})},[h,n,t]);const H=s.useCallback(()=>{L.current=null,E(!1),R()},[R]),D=s.useCallback(Z=>{a({kind:"success",title:`${KX[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||m||g||w||y,V=Ar("setup").value,K=Ar("settings").value,U=!!V||!!K;s.useEffect(()=>{if(!B||U)return;let Z=!0,Q=null;const me=te=>Ae.assetBuildCapabilities().then(he=>Z&&k(he)).catch(()=>{Z&&te&&(Q=setTimeout(()=>me(!1),600))});return me(!0),()=>{Z=!1,Q&&clearTimeout(Q)}},[B,U]);const I=s.useCallback(Z=>{const Q=l.find(me=>me.id===Z);return Q?Q.stage==="failed"?"failed":Q.stage==="cancelled"?"cancelled":Q.stage==="done"?"done":"running":"unknown"},[l]),_=s.useCallback((Z,Q)=>{var re;const me=L.current;L.current=null,u();const te=!!(Q!=null&&Q.quiet);if(Z.kind==="product"){if(!Z.id){a({kind:"info",title:"Importing your catalog",detail:Z.name});return}(me==null?void 0:me.kind)==="product"&&me.fn(Z),a({kind:"success",title:`${Z.name} added`,actions:[{label:"Add details",onClick:()=>n(xa(t,Z.id))},{label:"Use in a shot",onClick:()=>n(`${Er(t)}?product=${Z.id}&compose=1${kc()}`)}]});return}if(Z.kind==="presenter"){if((me==null?void 0:me.kind)==="presenter"&&me.fn(Z),te)return;a({kind:"success",title:`${Z.name} added`,actions:[{label:"Use in a shot",onClick:()=>n(`${Er(t)}?presenter=${Z.id}&compose=1${kc()}`)}]});return}if(i(),(me==null?void 0:me.kind)==="scene"&&me.fn(Z),te)return;const he=(re=Z.verticals)!=null&&re.length?`Filed under ${Z.verticals.join(" and ")}.`:void 0;a({kind:"success",title:Z.how==="updated"?`${Z.name} changed`:`${Z.name} saved`,detail:he,actions:[{label:"Open",onClick:()=>n(zr(t,Z.id))},{label:"Use in a shot",onClick:()=>n(`${Er(t)}?scene=${Z.id}&compose=1${kc()}`)}]})},[t,n,u,a,i]),O=s.useCallback(Z=>{_(Z),H()},[H,_]),Y=s.useMemo(()=>({open:P,announce:_,caps:b}),[P,_,b]),z=YX(h)?h:null,q={onBack:S?()=>j(T8):void 0,onStarted:O,caps:b,pendingState:I,restore:C,onDiscarded:()=>z&&D(z)};return o.jsxs(XM.Provider,{value:Y,children:[e,h===T8&&o.jsx(kX,{suggest:p,onPick:Z=>{if(Z==="presenter"){n(pl(t),{replace:!0});return}if(Z==="scene"){n(hl(t),{replace:!0});return}E(!0),j(Z)}}),z==="product"&&o.jsx(WX,{...q},"product")]})}const XX=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:pm},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:fm},{kind:"scene",label:"Scene",line:"The place and its light",noun:"scene",icon:dm}],QX={product:"New product",presenter:"New presenter",scene:"New scene"};function JX(){var f;const e=Fl(),t=JM(),n=IM(),{showcase:r}=$n(),a=((f=r.find(h=>h.previewUrl))==null?void 0:f.previewUrl)??null,i=Iw(16).find(h=>h.key==="create"),l=i?`${i.to}&attach=all`:"",u=t?QX[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(mr,{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(Zn,{className:"sc-new-go",to:l,"aria-label":"New shot","data-attach-opener":"",children:[o.jsx(mr,{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($M,{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(wl,{size:12,weight:"bold",className:"sc-new-caret","aria-hidden":"true"})}),children:[o.jsxs(nd,{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:Ln(a,"tile"),alt:"",loading:"lazy",decoding:"async"}):o.jsx("span",{className:"sc-start-glyph",children:o.jsx(D7,{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"}),XX.map(h=>{const{url:p,count:m}=n[h.kind];return o.jsxs(nd,{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:[m===0?"None yet":m,o.jsx("span",{className:"sc-vh",children:` ${h.noun}${m===1?"":"s"} so far`})]})]},h.kind)})]})]})}const eQ=24,tQ=8;function nQ(){const e=Mr(aa),{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<=tQ:f>eQ)&&(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 eR=["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"],rQ=["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 sQ(e){return o.jsx("svg",{viewBox:"0 0 263.79 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:[...eR,...rQ].map(t=>o.jsx("path",{d:t},t))})}function aQ(e){return o.jsx("svg",{viewBox:"0 0 64 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:eR.map(t=>o.jsx("path",{d:t},t))})}function oQ(){const{brand:e}=cn();return nQ(),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(Zn,{className:"sc-wordmark","aria-label":"Scenri home",to:Do(e),children:o.jsx(sQ,{"aria-hidden":"true"})})}),o.jsx(dX,{}),o.jsxs("div",{className:"sc-topbar-end",children:[o.jsx(gX,{}),o.jsx(cX,{}),o.jsx(JX,{}),o.jsx(hX,{})]})]})}const iQ=60;function lQ(){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>iQ?`${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 tR=s.createContext(null);function nR(){return s.useContext(tR)}function cQ({brand:e,children:t}){const n=e.id,[r,a]=s.useState({products:[],loaded:!1}),i=s.useRef(null),{tasks:l}=sa(),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 m=s.useCallback(async()=>{const w=++h.current;try{const y=await Ae.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(()=>{m()},[m,e.updatedAt,u]),s.useEffect(()=>{if(!f)return;const w=setInterval(()=>void m(),2e3);return()=>clearInterval(w)},[f,m]);const g=s.useMemo(()=>({products:r.products,productsLoaded:r.loaded,importing:f,refreshProducts:m}),[r.products,r.loaded,f,m]);return o.jsx(tR.Provider,{value:g,children:t})}function uQ({feature:e}){const{isNew:t}=Qc();return t(e)?o.jsx("span",{className:"sc-tag sc-tag-new",children:"New"}):null}function cs({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 dQ={npx:"run with npx",global:"installed with npm",managed:"managed install",dev:"running from source",unknown:"local studio"};function fQ({version:e}){return o.jsxs(cs,{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}`:""," · ",dQ[(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 A4({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 Q5=()=>o.jsx("span",{className:"sc-setpop-tick","aria-hidden":!0,children:o.jsx(Kn,{size:12,weight:"bold"})});function ti({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 m=p.key==="ArrowDown"||p.key==="ArrowRight"?1:p.key==="ArrowUp"||p.key==="ArrowLeft"?-1:p.key==="Home"?"first":p.key==="End"?"last":null;if(m===null||!f.length)return;p.preventDefault();const g=f.indexOf(t),w=m==="first"?f[0]:m==="last"?f[f.length-1]:m===1?f[g<0||g===f.length-1?0:g+1]:f[g<=0?f.length-1:g-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 ni=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 m;(m=f.onClick)==null||m.call(f,p),r||i()},children:u})}),hQ=({children:e})=>o.jsx("p",{className:"sc-setpop-foot",children:e}),J5=[{id:"light",label:"Light"},{id:"dark",label:"Dark"},{id:"system",label:"System"}];function pQ(){const{choice:e,setChoice:t}=yG();return o.jsx(cs,{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(ti,{label:"Theme",className:"sc-seg",value:e,ids:J5.map(n=>n.id),onChange:n=>t(n),children:J5.map(n=>o.jsx(ni,{id:n.id,className:"sc-seg-o",on:e===n.id,label:n.label,onPick:()=>t(n.id),children:n.label},n.id))})]})})}function mQ({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=g=>{const w=g.trim().slice(0,l);f(""),!(!w||h)&&(e.some(y=>y.toLowerCase()===w.toLowerCase())||t([...e,w]))},m=!h&&a&&a.length>0?o.jsx("div",{className:"sc-chips-sugg",children:a.map(g=>o.jsx("button",{type:"button",className:"sc-chip",onClick:()=>p(g),"aria-label":`Never show ${g}`,children:g},g))}):null;return o.jsxs(o.Fragment,{children:[e.length===0&&m,o.jsxs("div",{className:"sc-chips",children:[e.map((g,w)=>o.jsxs("span",{className:"sc-chips-item",children:[o.jsx("span",{dir:"auto",children:g}),o.jsx("button",{type:"button",onClick:()=>t(e.filter((y,b)=>b!==w)),"aria-label":`Remove ${g}`,children:o.jsx(Cn,{size:10,weight:"bold"})})]},g)),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:g=>{const w=g.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:g=>{g.key==="Enter"?(g.preventDefault(),p(u)):g.key==="Backspace"&&!u&&e.length&&t(e.slice(0,-1))},onBlur:()=>p(u)})]}),e.length>0&&m]})}const gQ=["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"],ek=e=>e.trim().toLowerCase();function vQ(e){const t=new Set((e??[]).map(ek));return gQ.filter(n=>!t.has(ek(n)))}function wQ({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(mQ,{label:"Things this brand never shows",value:n,placeholder:"Or type your own",suggestions:vQ(n),max:24,onChange:r})})}function yQ(){const{brand:e}=cn(),{applyBrand:t}=$n(),{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({}),m=s.useRef(!1),g=s.useRef(!1),w=s.useCallback(()=>({...f.current.json??{},...u.current}),[]),y=s.useCallback(async()=>{if(!Object.keys(u.current).length)return;if(m.current){g.current=!0;return}m.current=!0,l("saving");const C=u.current;try{const A=await Ae.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(g.current?"pending":"idle")}catch(A){l("error"),n({...on(A,"Could not save the brand"),action:{label:"Retry",onClick:()=>void y()}})}finally{m.current=!1,g.current&&(g.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&&LG(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 qw(e){const t=s.useRef(e);t.current=e,s.useEffect(()=>()=>t.current(),[])}function bQ(e){return e==="saving"?"Saving…":e==="pending"?"Unsaved changes":e==="error"?"Not saved":"Saved"}function xQ({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=t1(i),h=Km(f)??void 0,p=f.filter(b=>b!==h),m=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})},g=async(b,k)=>{a(!0);try{await t.flush(),t.applyRow(await k())}catch(S){n(on(S,b))}finally{a(!1)}},w=b=>void g("Could not upload that mark",async()=>{const k=await kN(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}=GM({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(kQ,{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 g("Could not remove that mark",()=>Ae.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 g("Could not update that mark",()=>Ae.updateLogo(e.id,h.hash??"",{background:b.target.value})),"aria-label":"Sits on",children:Ow.map(b=>o.jsx("option",{value:b,children:b==="any"?"Any background":`On ${b}`},b))})]}),o.jsx(tk,{label:"Name",value:l.name??"",placeholder:e.slug,maxLength:120,onCommit:b=>m({name:b})}),o.jsx(tk,{label:"Tagline",value:l.tagline??"",placeholder:"Add a tagline",maxLength:200,onCommit:b=>m({tagline:b})}),p.map(b=>o.jsx(SQ,{mark:b,busy:r,onRole:k=>void g("Could not retag that mark",()=>Ae.updateLogo(e.id,b.hash??"",{role:k})),onBackground:k=>void g("Could not update that mark",()=>Ae.updateLogo(e.id,b.hash??"",{background:k})),onRemove:()=>void g("Could not remove that mark",()=>Ae.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(mr,{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 tk({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 qw(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 kQ({mark:e,name:t,busy:n,onUpload:r}){const[a,i]=s.useState(null);if(e){const l=e.hash?Dr(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(Rv,{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 SQ({mark:e,busy:t,onRole:n,onBackground:r,onRemove:a}){const i=e.hash?Dr(e.hash):e.file;return o.jsxs("div",{className:"sc-set-row",children:[o.jsx("span",{className:"txt",children:o.jsx("b",{children:Rh[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:Rh[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:wM.map(l=>o.jsx("option",{value:l,children:Rh[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:Ow.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 ${Rh[e.role]}`,children:o.jsx(mm,{size:13})})]})]})}const nk={primary:"Primary",secondary:"Secondary",accent:"Accent",neutral:"Neutral"},EQ=(e,t)=>t<=1?nk[e]:`${nk[e]} ${t}`;function CQ(e){return/^(Primary|Secondary|Accent|Neutral)( [2-9]\d*)?$/.test(String(e??"").trim())}const jQ=/^#[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 jQ.test(r)?r:null}const AQ=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;function NQ(e){const t=String(e??"").trim();return AQ.test(t)?ur(t):null}function ea(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||EQ(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 Xw(e,t){const n={},r=[],a=[],i=p=>{const m=p.name.trim();return m&&!CQ(m)?{hex:p.hex,name:m}:{hex:p.hex}};for(const p of e){const m=ur(p.hex);if(!m)continue;const g=i({...p,hex:m});p.slot==="neutral"?a.push(g):r.push(g)}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 rk=e=>e.slot!=="neutral";function e2(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 rR(e,t){const n=ur(t);if(!n)return{palette:e,added:!1,swatch:null};const r=ea(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=Xw(i,e),u=ea(l).find(f=>f.hex===n)??null;return{palette:l,added:!0,swatch:u}}function MQ(e,t){const n=ur(t);if(!n)return{palette:e,removed:!1};const r=ea(e),a=r.filter(i=>i.hex!==n);return a.length===r.length?{palette:e,removed:!1}:{palette:Xw(a,e),removed:!0}}function t2(){return(t2=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 sR(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 U0(e){var t=s.useRef(e),n=s.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var vf=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},W0=function(e){return"touches"in e},N4=function(e){return e&&e.ownerDocument.defaultView||self},sk=function(e,t,n){var r=e.getBoundingClientRect(),a=W0(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:vf((a.pageX-(r.left+N4(e).pageXOffset))/r.width),top:vf((a.pageY-(r.top+N4(e).pageYOffset))/r.height)}},ak=function(e){!W0(e)&&e.preventDefault()},aR=zn.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,a=sR(e,["onMove","onKey","onEnd"]),i=s.useRef(null),l=U0(t),u=U0(n),f=U0(r),h=s.useRef(null),p=s.useRef(!1),m=s.useMemo(function(){var k=function(C){ak(C),(W0(C)?C.touches.length>0:C.buttons>0)&&i.current?l(sk(i.current,C,h.current)):(E(!1),f())},S=function(){E(!1),f()};function E(C){var A=p.current,L=N4(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&&(ak(A),!(function(M,j){return j&&!W0(M)})(A,p.current)&&L)){if(W0(A)){p.current=!0;var T=A.changedTouches||[];T.length&&(h.current=T[0].identifier)}L.focus(),l(sk(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]),g=m[0],w=m[1],y=m[2],b=m[3];return s.useEffect(function(){return b},[b]),zn.createElement("div",t2({},a,{onTouchStart:g,onMouseDown:g,className:"react-colorful__interactive",ref:i,onKeyDown:w,onKeyUp:y,tabIndex:0,role:"slider"}))}),Qw=function(e){return e.filter(Boolean).join(" ")},oR=function(e){var t=e.color,n=e.left,r=e.top,a=r===void 0?.5:r,i=Qw(["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},RQ=function(e){return DQ(M4(e))},M4=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}},PQ=function(e){return TQ($Q(e))},LQ=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)}},R4=function(e){var t=LQ(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},$Q=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)}},Lh=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},TQ=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,i=a<1?Lh(Xr(255*a)):"";return"#"+Lh(t)+Lh(n)+Lh(r)+i},DQ=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}},HQ=zn.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,a=Qw(["react-colorful__hue",e.className]);return zn.createElement("div",{className:a},zn.createElement(aR,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:vf(t+360*i.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":Xr(t),"aria-valuemax":"360","aria-valuemin":"0"},zn.createElement(oR,{className:"react-colorful__hue-pointer",left:t/360,color:R4({h:t,s:100,v:100,a:1})})))}),OQ=zn.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,a={backgroundColor:R4({h:t.h,s:100,v:100,a:1})};return zn.createElement("div",{className:"react-colorful__saturation",style:a},zn.createElement(aR,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:vf(t.s+100*i.left,0,100),v:vf(t.v-100*i.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+Xr(t.s)+"%, Brightness "+Xr(t.v)+"%"},zn.createElement(oR,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:R4(t)})))}),iR=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},IQ=function(e,t){return e.toLowerCase()===t.toLowerCase()||iR(M4(e),M4(t))};function FQ(e,t,n,r){var a=U0(n),i=U0(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;iR(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 m=s.useCallback(function(w){f(function(y){return Object.assign({},y,w)})},[]),g=s.useCallback(function(){p.current&&(p.current=!1,i(h.current.color))},[i]);return[u,m,g]}var _Q=typeof window<"u"?s.useLayoutEffect:s.useEffect,VQ=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},ok=new WeakMap,ZQ=function(e){_Q(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(!ok.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=VQ();l&&i.setAttribute("nonce",l),ok.set(r,i),a.appendChild(i)}}},[])},zQ=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=sR(e,["className","colorModel","color","onChange","onChangeEnd"]),f=s.useRef(null);ZQ(f);var h=FQ(n,a,i,l),p=h[0],m=h[1],g=h[2],w=Qw(["react-colorful",t]);return zn.createElement("div",t2({},u,{ref:f,className:w}),zn.createElement(OQ,{hsva:p,onChange:m,onChangeEnd:g}),zn.createElement(HQ,{hue:p.h,onChange:m,onChangeEnd:g,className:"react-colorful__last-control"}))},BQ={defaultColor:"000",toHsva:RQ,fromHsva:function(e){return PQ({h:e.h,s:e.s,v:e.v,a:1})},equal:IQ},UQ=function(e){return zn.createElement(zQ,t2({},e,{colorModel:BQ}))};function yd({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 m=ur(e)??"#000000",[g,w]=s.useState(m),[y,b]=s.useState(!1);s.useEffect(()=>{y||w(m)},[m,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(g);T&&T!==m&&t(T)},C=[...new Set((r??[]).map(L=>ur(L)).filter(L=>!!L))],A=o.jsx(gd,{children:o.jsx("button",{type:"button",className:a??"sc-cp-trigger",style:{background:m,...i},"aria-label":n,...l,children:p})});return o.jsxs(md,{open:y,onOpenChange:E,children:[u?o.jsx(fr,{label:n,children:A}):A,o.jsxs(vd,{className:"sc-cp",align:h,sideOffset:6,width:"232px",children:[o.jsx(UQ,{color:g,onChange:k}),o.jsxs("div",{className:"sc-cp-foot",children:[o.jsx("span",{className:"sc-cp-preview",style:{background:g},"aria-hidden":!0}),o.jsx("input",{className:"sc-cp-hex",value:g,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(g)??m),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),f==="close"?S(g):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===g||void 0,title:L,"aria-label":L,onClick:()=>f==="close"?S(L):k(L)},L))})]})]})}function WQ({doc:e,suggestions:t}){var w;const n=(w=e.json)==null?void 0:w.palette,[r,a]=s.useState(()=>ea(n)),i=JSON.stringify(n??{});s.useEffect(()=>{a(ea(n))},[i]);const l=(y,b=0)=>{a(y),e.patch({palette:Xw(y,n)},{debounce:b})},u=(y,b,k=0)=>l(r.map((S,E)=>E===y?{...S,...b}:S),k),f=()=>l([...r,{hex:e2(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(KQ,{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}`),m=r.map((y,b)=>[y,b]),g=m.filter(([y])=>!rk(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."}),m.filter(([y])=>rk(y)).map(([y,b])=>p(y,b)),g.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"sc-pal-group",children:"Neutrals"}),g.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(mr,{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 KQ({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 qw(()=>{a!==e.hex&&l()}),o.jsxs("div",{className:"sc-pal-row",children:[o.jsx(yd,{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(mm,{size:13})})]})}function GQ({onSaveState:e}){var w,y;const{brand:t}=cn(),{push:n}=rr(),r=yQ();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 m=()=>{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})};qw(()=>{h.trim()!==f&&m()});const g=async()=>{var b,k,S;i(!0);try{await r.flush();const E=await Ae.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(on(E,"Could not read that website"))}finally{i(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(cs,{title:"Identity",sub:"The name and the mark.",children:o.jsx(xQ,{brand:t,doc:r})}),o.jsx(cs,{title:"Palette",sub:"Favoured on a shot that asks for the kit.",children:o.jsx("div",{className:"sc-set-block",children:o.jsx(WQ,{doc:r,suggestions:l})})}),o.jsx(cs,{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(wQ,{doc:r})})}),o.jsxs(cs,{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:m,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 g(),children:[a?o.jsx(Lr,{size:"1"}):o.jsx(_7,{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:RG(t.id),download:!0,onClick:()=>void r.flush(),children:"Export"})]})]})]})}const ml=e=>e.replace(/\s*\(BYOK\)\s*$/i,""),wf="codex-cli";function YQ(e,t){var n;return e.some(r=>r.id===t)?t:((n=e[0])==null?void 0:n.id)??wf}const qQ=e=>e.toFixed(3).replace(/0+$/,"").replace(/\.$/,"");function XQ(e){return e.free?e.localOnly?"Runs on your ChatGPT plan":"No cost per image":`$${qQ(e.perGeneration)} / image`}function QQ(e,t){if(t)return e.available?"Manage":"Connect";if(e.available)return e.id===wf?"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 JQ(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 eJ({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=m=>l(g=>({...g,[f.id]:m===null?"":String(m)})),p=JQ(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 Ae.setCap(f.id,p),h(p),t()}catch(m){h(f.cap),a(on(m,"Could not save that cap"))}};return r.length?o.jsx(cs,{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,m=p&&p>0?Math.min(100,Math.round((p-(h??0))/p*100)):0,g=`$${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:ml(f.displayName)}),o.jsx("small",{children:h===null?g:`${g} · ${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":`${ml(f.displayName)} monthly cap in dollars`})]})]}),p!==null&&o.jsx("div",{className:"sc-meter",children:o.jsx("i",{style:{width:`${m}%`}})})]},f.id)})}):o.jsx(cs,{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 tJ({onDone:e,thisComputer:t}){const{brand:n,resetShots:r}=cn(),{refresh:a}=$n(),i=Bn(),[l,u]=s.useState(!1),f=s.useCallback(async h=>{u(!0);try{await Ae.deleteData(h),e(),h==="shots"&&r(),h==="all"&&window.location.replace("/")}finally{u(!1)}},[e,r]);return o.jsxs(o.Fragment,{children:[o.jsx(cs,{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 ",ka(n),", its sets and every shot. Other brands stay."]})]}),o.jsx(Xn,{label:"Delete brand",title:`Delete ${ka(n)}?`,body:"The kit, its sets and every shot go with it. Exports you already downloaded stay yours.",busy:l,onConfirm:()=>{u(!0),Ae.deleteBrand(n.id).then(()=>a()).then(()=>i("/",{replace:!0})).finally(()=>u(!1))}})]})}),t&&o.jsxs(cs,{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 nJ(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 rJ({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 Ae.desktopInstall(),u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>u(!1),1600),t(await Ae.desktop())}catch(m){r(String((m==null?void 0:m.message)??m))}finally{i(!1)}}},p=nJ(e,n);return o.jsx(cs,{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 lR(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 sJ(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 aJ(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 oJ=[{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"}],cR=e=>oJ.find(t=>t.engineId===e),uR={"codex-cli":{Mark:lR,size:16,plate:"#FFFFFF",ink:"#000000"},openrouter:{Mark:sJ,size:18,plate:"#FFFFFF",ink:"#7624F4"},replicate:{Mark:aJ,size:15,plate:"#E42022",ink:"#FFFFFF"}},dR=e=>{const t=uR[e];return t?{plate:t.plate,ink:t.ink}:void 0},iJ={demo:zI};function fR({engineId:e,scale:t=1}){const n=uR[e];if(n){const a=Math.round(n.size*t);return o.jsx(n.Mark,{width:a,height:a})}const r=iJ[e]??ef;return o.jsx(r,{size:Math.round(15*t)})}const lJ=e=>[...e].sort((t,n)=>+(n.id===wf)-+(t.id===wf));function cJ({engines:e}){const t=Il(),r=e.filter(a=>a.available).length===0;return o.jsx(cs,{children:lJ(e).map(a=>{const i=cR(a.id),l=ml(a.displayName),u=QQ(a,!!i),f=a.available?"Connected":null,h=!f&&a.reason&&(!u||a.code==="unverified"),p=dR(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(fR,{engineId:a.id})}),o.jsxs("span",{className:"sc-eng-name",children:[o.jsx("b",{children:l}),o.jsx("small",{children:XQ(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 uJ=e=>e>1e9?`${(e/1e9).toFixed(1)} GB`:e>1e6?`${Math.round(e/1e6)} MB`:`${Math.round(e/1e3)} KB`,D8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function dJ(e){return e===0?0:e<3?1:e<6?2:e<12?3:4}function ik(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function lk(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 m=new Date(a);m.setDate(a.getDate()+p);const g=ik(m),w=e.get(g)??0;if(h+=w,l.push({key:g,level:dJ(w),title:w?`${w} run${w===1?"":"s"} on ${m.getDate()} ${D8[m.getMonth()]}`:`nothing on ${m.getDate()} ${D8[m.getMonth()]}`}),m.getDay()===0){const y=m.getMonth()!==f&&m.getDate()<=7;y&&(f=m.getMonth()),u.push({key:g,label:y?D8[m.getMonth()]:""})}}return{cells:l,months:u,sum:h,from:ik(a)}}function fJ({info:e,thisComputer:t}){const{push:n}=rr();return o.jsxs(cs,{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,`${uJ(e.bytes)} across ${e.images} images`].filter(Boolean).join(" · "):"…"})]}),t&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void Ae.reveal().catch(r=>n(on(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 hJ(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 Td=function(e,t){let a=e;const i=T0[t];let l=null,u=0,f=null;const h=[],p={},m=function(M,j){u=a*4+17,l=(function(R){const P=new Array(R);for(let H=0;H<R;H+=1){P[H]=new Array(R);for(let D=0;D<R;D+=1)P[H][D]=null}return P})(u),g(0,0),g(u-7,0),g(0,u-7),b(),y(),S(M,j),a>=7&&k(M),f==null&&(f=A(a,i,h)),E(f,j)},g=function(M,j){for(let R=-1;R<=7;R+=1)if(!(M+R<=-1||u<=M+R))for(let P=-1;P<=7;P+=1)j+P<=-1||u<=j+P||(0<=R&&R<=6&&(P==0||P==6)||0<=P&&P<=6&&(R==0||R==6)||2<=R&&R<=4&&2<=P&&P<=4?l[M+R][j+P]=!0:l[M+R][j+P]=!1)},w=function(){let M=0,j=0;for(let R=0;R<8;R+=1){m(!0,R);const P=qi.getLostPoint(p);(R==0||M>P)&&(M=P,j=R)}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 R=0;R<M.length;R+=1){const P=M[j],H=M[R];if(l[P][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[P+D][H+B]=!0:l[P+D][H+B]=!1}},k=function(M){const j=qi.getBCHTypeNumber(a);for(let R=0;R<18;R+=1){const P=!M&&(j>>R&1)==1;l[Math.floor(R/3)][R%3+u-8-3]=P}for(let R=0;R<18;R+=1){const P=!M&&(j>>R&1)==1;l[R%3+u-8-3][Math.floor(R/3)]=P}},S=function(M,j){const R=i<<3|j,P=qi.getBCHTypeInfo(R);for(let H=0;H<15;H+=1){const D=!M&&(P>>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&&(P>>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 R=-1,P=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 K=0;K<2;K+=1)if(l[P][V-K]==null){let U=!1;D<M.length&&(U=(M[D]>>>H&1)==1),B(P,V-K)&&(U=!U),l[P][V-K]=U,H-=1,H==-1&&(D+=1,H=7)}if(P+=R,P<0||u<=P){P-=R,R=-R;break}}},C=function(M,j){let R=0,P=0,H=0;const D=new Array(j.length),B=new Array(j.length);for(let I=0;I<j.length;I+=1){const _=j[I].dataCount,O=j[I].totalCount-_;P=Math.max(P,_),H=Math.max(H,O),D[I]=new Array(_);for(let Z=0;Z<D[I].length;Z+=1)D[I][Z]=255&M.getBuffer()[Z+R];R+=_;const Y=qi.getErrorCorrectPolynomial(O),q=yf(D[I],Y.getLength()-1).mod(Y);B[I]=new Array(Y.getLength()-1);for(let Z=0;Z<B[I].length;Z+=1){const Q=Z+q.getLength()-B[I].length;B[I][Z]=Q>=0?q.getAt(Q):0}}let V=0;for(let I=0;I<j.length;I+=1)V+=j[I].totalCount;const K=new Array(V);let U=0;for(let I=0;I<P;I+=1)for(let _=0;_<j.length;_+=1)I<D[_].length&&(K[U]=D[_][I],U+=1);for(let I=0;I<H;I+=1)for(let _=0;_<j.length;_+=1)I<B[_].length&&(K[U]=B[_][I],U+=1);return K},A=function(M,j,R){const P=ck.getRSBlocks(M,j),H=uk();for(let B=0;B<R.length;B+=1){const V=R[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<P.length;B+=1)D+=P[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,P)};p.addData=function(M,j){j=j||"Byte";let R=null;switch(j){case"Numeric":R=pJ(M);break;case"Alphanumeric":R=mJ(M);break;case"Byte":R=gJ(M);break;case"Kanji":R=vJ(M);break;default:throw"mode:"+j}h.push(R),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=ck.getRSBlocks(M,i),R=uk();for(let H=0;H<h.length;H++){const D=h[H];R.put(D.getMode(),4),R.put(D.getLength(),qi.getLengthInBits(D.getMode(),M)),D.write(R)}let P=0;for(let H=0;H<j.length;H++)P+=j[H].dataCount;if(R.getLengthInBits()<=P*8)break}a=M}m(!1,w())},p.createTableTag=function(M,j){M=M||2,j=typeof j>"u"?M*4:j;let R="";R+='<table style="',R+=" border-width: 0px; border-style: none;",R+=" border-collapse: collapse;",R+=" padding: 0px; margin: "+j+"px;",R+='">',R+="<tbody>";for(let P=0;P<p.getModuleCount();P+=1){R+="<tr>";for(let H=0;H<p.getModuleCount();H+=1)R+='<td style="',R+=" border-width: 0px; border-style: none;",R+=" border-collapse: collapse;",R+=" padding: 0px; margin: 0px;",R+=" width: "+M+"px;",R+=" height: "+M+"px;",R+=" background-color: ",R+=p.isDark(P,H)?"#000000":"#ffffff",R+=";",R+='"/>';R+="</tr>"}return R+="</tbody>",R+="</table>",R},p.createSvgTag=function(M,j,R,P){let H={};typeof arguments[0]=="object"&&(H=arguments[0],M=H.cellSize,j=H.margin,R=H.alt,P=H.title),M=M||2,j=typeof j>"u"?M*4:j,R=typeof R=="string"?{text:R}:R||{},R.text=R.text||null,R.id=R.text?R.id||"qrcode-description":null,P=typeof P=="string"?{text:P}:P||{},P.text=P.text||null,P.id=P.text?P.id||"qrcode-title":null;const D=p.getModuleCount()*M+j*2;let B,V,K,U,I="",_;for(_="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",I+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',I+=H.scalable?"":' width="'+D+'px" height="'+D+'px"',I+=' viewBox="0 0 '+D+" "+D+'" ',I+=' preserveAspectRatio="xMinYMin meet"',I+=P.text||R.text?' role="img" aria-labelledby="'+L([P.id,R.id].join(" ").trim())+'"':"",I+=">",I+=P.text?'<title id="'+L(P.id)+'">'+L(P.text)+"</title>":"",I+=R.text?'<description id="'+L(R.id)+'">'+L(R.text)+"</description>":"",I+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',I+='<path d="',K=0;K<p.getModuleCount();K+=1)for(U=K*M+j,B=0;B<p.getModuleCount();B+=1)p.isDark(K,B)&&(V=B*M+j,I+="M"+V+","+U+_);return I+='" stroke="transparent" fill="black"/>',I+="</svg>",I},p.createDataURL=function(M,j){M=M||2,j=typeof j>"u"?M*4:j;const R=p.getModuleCount()*M+j*2,P=j,H=R-j;return xJ(R,R,function(D,B){if(P<=D&&D<H&&P<=B&&B<H){const V=Math.floor((D-P)/M),K=Math.floor((B-P)/M);return p.isDark(K,V)?0:1}else return 1})},p.createImgTag=function(M,j,R){M=M||2,j=typeof j>"u"?M*4:j;const P=p.getModuleCount()*M+j*2;let H="";return H+="<img",H+=' src="',H+=p.createDataURL(M,j),H+='"',H+=' width="',H+=P,H+='"',H+=' height="',H+=P,H+='"',R&&(H+=' alt="',H+=L(R),H+='"'),H+="/>",H};const L=function(M){let j="";for(let R=0;R<M.length;R+=1){const P=M.charAt(R);switch(P){case"<":j+="&lt;";break;case">":j+="&gt;";break;case"&":j+="&amp;";break;case'"':j+="&quot;";break;default:j+=P;break}}return j},T=function(M){M=typeof M>"u"?2:M;const R=p.getModuleCount()*1+M*2,P=M,H=R-M;let D,B,V,K,U;const I={"██":"█","█ ":"▀"," █":"▄"," ":" "},_={"██":"▀","█ ":"▀"," █":" "," ":" "};let O="";for(D=0;D<R;D+=2){for(V=Math.floor((D-P)/1),K=Math.floor((D+1-P)/1),B=0;B<R;B+=1)U="█",P<=B&&B<H&&P<=D&&D<H&&p.isDark(V,Math.floor((B-P)/1))&&(U=" "),P<=B&&B<H&&P<=D+1&&D+1<H&&p.isDark(K,Math.floor((B-P)/1))?U+=" ":U+="█",O+=M<1&&D+1>=H?_[U]:I[U];O+=`
97
+ `}return R%2&&M>0?O.substring(0,O.length-R-1)+Array(R+1).join("▀"):O.substring(0,O.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 R=p.getModuleCount()*M+j*2,P=j,H=R-j;let D,B,V,K;const U=Array(M+1).join("██"),I=Array(M+1).join(" ");let _="",O="";for(D=0;D<R;D+=1){for(V=Math.floor((D-P)/M),O="",B=0;B<R;B+=1)K=1,P<=B&&B<H&&P<=D&&D<H&&p.isDark(V,Math.floor((B-P)/M))&&(K=0),O+=K?U:I;for(V=0;V<M;V+=1)_+=O+`
98
+ `}return _.substring(0,_.length-1)},p.renderTo2dContext=function(M,j){j=j||2;const R=p.getModuleCount();for(let P=0;P<R;P++)for(let H=0;H<R;H++)M.fillStyle=p.isDark(P,H)?"black":"white",M.fillRect(H*j,P*j,j,j)},p};Td.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};Td.createStringToBytes=function(e,t){const n=(function(){const a=yJ(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(),m=i(),g=String.fromCharCode(f<<8|h),w=p<<8|m;u[g]=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 os={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},T0={L:1,M:0,Q:3,H:2},Yi={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 Yi.PATTERN000:return function(u,f){return(u+f)%2==0};case Yi.PATTERN001:return function(u,f){return u%2==0};case Yi.PATTERN010:return function(u,f){return f%3==0};case Yi.PATTERN011:return function(u,f){return(u+f)%3==0};case Yi.PATTERN100:return function(u,f){return(Math.floor(u/2)+Math.floor(f/3))%2==0};case Yi.PATTERN101:return function(u,f){return u*f%2+u*f%3==0};case Yi.PATTERN110:return function(u,f){return(u*f%2+u*f%3)%2==0};case Yi.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=yf([1],0);for(let f=0;f<l;f+=1)u=u.multiply(yf([1,Ji.gexp(f)],0));return u},a.getLengthInBits=function(l,u){if(1<=u&&u<10)switch(l){case os.MODE_NUMBER:return 10;case os.MODE_ALPHA_NUM:return 9;case os.MODE_8BIT_BYTE:return 8;case os.MODE_KANJI:return 8;default:throw"mode:"+l}else if(u<27)switch(l){case os.MODE_NUMBER:return 12;case os.MODE_ALPHA_NUM:return 11;case os.MODE_8BIT_BYTE:return 16;case os.MODE_KANJI:return 10;default:throw"mode:"+l}else if(u<41)switch(l){case os.MODE_NUMBER:return 14;case os.MODE_ALPHA_NUM:return 13;case os.MODE_8BIT_BYTE:return 16;case os.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 m=0;m<u;m+=1)for(let g=0;g<u;g+=1){let w=0;const y=l.isDark(m,g);for(let b=-1;b<=1;b+=1)if(!(m+b<0||u<=m+b))for(let k=-1;k<=1;k+=1)g+k<0||u<=g+k||b==0&&k==0||y==l.isDark(m+b,g+k)&&(w+=1);w>5&&(f+=3+w-5)}for(let m=0;m<u-1;m+=1)for(let g=0;g<u-1;g+=1){let w=0;l.isDark(m,g)&&(w+=1),l.isDark(m+1,g)&&(w+=1),l.isDark(m,g+1)&&(w+=1),l.isDark(m+1,g+1)&&(w+=1),(w==0||w==4)&&(f+=3)}for(let m=0;m<u;m+=1)for(let g=0;g<u-6;g+=1)l.isDark(m,g)&&!l.isDark(m,g+1)&&l.isDark(m,g+2)&&l.isDark(m,g+3)&&l.isDark(m,g+4)&&!l.isDark(m,g+5)&&l.isDark(m,g+6)&&(f+=40);for(let m=0;m<u;m+=1)for(let g=0;g<u-6;g+=1)l.isDark(g,m)&&!l.isDark(g+1,m)&&l.isDark(g+2,m)&&l.isDark(g+3,m)&&l.isDark(g+4,m)&&!l.isDark(g+5,m)&&l.isDark(g+6,m)&&(f+=40);let h=0;for(let m=0;m<u;m+=1)for(let g=0;g<u;g+=1)l.isDark(g,m)&&(h+=1);const p=Math.abs(100*h/u/u-50)/5;return f+=p*10,f},a})(),Ji=(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})(),yf=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]^=Ji.gexp(Ji.glog(r.getAt(l))+Ji.glog(a.getAt(u)));return yf(i,0)},r.mod=function(a){if(r.getLength()-a.getLength()<0)return r;const i=Ji.glog(r.getAt(0))-Ji.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]^=Ji.gexp(Ji.glog(a.getAt(u))+i);return yf(l,0).mod(a)},r},ck=(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 T0.L:return e[(a-1)*4+0];case T0.M:return e[(a-1)*4+1];case T0.Q:return e[(a-1)*4+2];case T0.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],m=l[h*3+1],g=l[h*3+2];for(let w=0;w<p;w+=1)f.push(t(m,g))}return f},n})(),uk=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},pJ=function(e){const t=os.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},mJ=function(e){const t=os.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},gJ=function(e){const t=os.MODE_8BIT_BYTE,n=Td.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},vJ=function(e){const t=os.MODE_KANJI,n=Td.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},hR=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},wJ=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},yJ=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},bJ=function(e,t){const n=e,r=t,a=new Array(e*t),i={};i.setPixel=function(h,p,m){a[p*n+h]=m},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,m=u(p);h.writeByte(p);let g=0;for(;m.length-g>255;)h.writeByte(255),h.writeBytes(m,g,255),g+=255;h.writeByte(m.length-g),h.writeBytes(m,g,m.length-g),h.writeByte(0),h.writeString(";")};const l=function(h){const p=h;let m=0,g=0;const w={};return w.write=function(y,b){if(y>>>b)throw"length over";for(;m+b>=8;)p.writeByte(255&(y<<m|g)),b-=8-m,y>>>=8-m,g=0,m=0;g=y<<m|g,m=m+b},w.flush=function(){m>0&&p.writeByte(g)},w},u=function(h){const p=1<<h,m=(1<<h)+1;let g=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(m));const y=hR(),b=l(y);b.write(p,g);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),g),w.size()<4095&&(w.size()==1<<g&&(g+=1),w.add(S+E)),S=E)}return b.write(w.indexOf(S),g),b.write(m,g),b.flush(),y.toByteArray()},f=function(){const h={};let p=0;const m={};return m.add=function(g){if(m.contains(g))throw"dup key:"+g;h[g]=p,p+=1},m.size=function(){return p},m.indexOf=function(g){return h[g]},m.contains=function(g){return typeof h[g]<"u"},m};return i},xJ=function(e,t,n){const r=bJ(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=hR();r.write(a);const i=wJ(),l=a.toByteArray();for(let u=0;u<l.length;u+=1)i.writeByte(l[u]);return i.flush(),"data:image/gif;base64,"+i};Td.stringToBytes;const H8=4;function kJ({value:e,label:t,size:n=200}){const{side:r,path:a}=s.useMemo(()=>{const i=Td(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+H8} ${f+H8}h1v1h-1z`);return{side:l+H8*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 SJ=3e4,EJ=5*6e4;function CJ(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 jJ=e=>e.url,AJ=e=>`${e.slice(0,3)} ${e.slice(3)}`;function NJ(e,t,n){return e.lastVisit&&e.lastVisit.at>=t-EJ?"connected":n-t>=SJ?"stuck":"waiting"}function MJ(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 RJ(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 PJ(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 LJ(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 $J=2e3;function TJ(){const{markUsed:e}=Qc();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),[m,g]=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(U=!1)=>{try{n(await Ae.phone(U)),a(!1)}catch{a(!0)}},[]),[L,T]=s.useState(!1),M=async()=>{T(!0);try{n(await Ae.phoneNewCode()),l(Date.now())}catch{C({kind:"warning",title:"Could not make a new code"})}finally{T(!1)}};s.useEffect(()=>{A();const U=setInterval(()=>{f(Date.now()),A()},$J);return()=>{clearInterval(U),S.current&&clearTimeout(S.current)}},[A]);const j=t?jJ(t):null;s.useEffect(()=>{j&&i===null&&l(Date.now())},[j,i]);const R=t&&j&&i!==null?NJ(t,i,u):null;s.useEffect(()=>{R==="stuck"&&p(!0)},[R]);const P=!!j&&!!(t!=null&&t.thisComputer);s.useEffect(()=>{if(!P)return;let U=!0;return Ae.phoneHelp().then(I=>U&&g(I.firewall)).catch(()=>U&&g("unknown")),()=>{U=!1}},[P]);const H=CJ(t,r),D=t?RJ(m,t.platform):null,B=t?PJ(w,t.platform):null,V=async()=>{j&&(await hJ(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}))},K=async()=>{y("asking");try{const U=await Ae.phoneAllow();g(U.firewall),y(U.result)}catch{y("failed")}};return o.jsxs(cs,{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(kJ,{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:AJ(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 K(),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&&R&&o.jsx("p",{className:"sc-phone-arrival","data-state":R,"aria-live":"polite",children:MJ(R,t)}),t.thisComputer&&o.jsxs("details",{className:"sc-phone-help",open:h,onToggle:U=>p(U.currentTarget.open),children:[o.jsx("summary",{children:"Not opening?"}),o.jsx("ul",{children:LJ(m,t).map(U=>o.jsx("li",{children:U},U))})]})]})]}),(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 DJ(e){switch(e){case"npx":return"npx scenri update";case"global":case"managed":return"scenri update";default:return"npx scenri@latest"}}function HJ({version:e}){var k;const t=zm(),n=Qc(),{brand:r}=cn(),a=t.status,[i,l]=s.useState(null),[u,f]=s.useState(!1);s.useEffect(()=>{Ae.settings().then(S=>l(!!S.updateCheck)).catch(()=>{})},[]);const h=async()=>{if(i===null)return;const S=!i;l(S);try{await Ae.saveSettings({updateCheck:S})}catch{l(!S)}},p=s.useRef(null);s.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const m=DJ(e==null?void 0:e.installKind),g=async()=>{try{await navigator.clipboard.writeText(m),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):VN(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:m})," 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(cs,{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 g(),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(Zn,{className:"sc-btn sc-btn-ghost",to:jp(r),children:"Show"})]})]})}function dk({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 OJ({brandId:e}){const[t,n]=s.useState(null);s.useEffect(()=>{let u=!0;return n(null),Ae.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 m of t??[])u.set(m.day,(u.get(m.day)??0)+m.generations+m.edits);const f=lk(u,53),h=lk(u,13),p={generation:0,edit:0};for(const m of t??[])m.day<f.from||(p.generation+=m.generations,p.edit+=m.edits);return{year:f,quarter:h,total:f.sum,byKind:p}},[t]);return o.jsx(cs,{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(dk,{weeks:53,months:r.months,cells:r.cells}),o.jsx(dk,{weeks:13,months:a.months,cells:a.cells})]})})}function IJ({engines:e,brandId:t,onSaved:n}){const r=Ar("settings"),a=r.value!==null,[i,l]=s.useState(null);s.useEffect(()=>{if(!a||i)return;let y=!0;return Ae.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 Ae.home().then(b=>y&&f(b)).catch(()=>{}),()=>{y=!1}},[a]);const[h,p]=s.useState(null),m=(i==null?void 0:i.thisComputer)===!0;s.useEffect(()=>{if(!a||!m)return;let y=!0;return Ae.desktop().then(b=>y&&p(b)).catch(()=>{}),()=>{y=!1}},[a,m]);const[g,w]=s.useState("idle");return o.jsx(Us,{open:a,className:"sc-set",maxWidth:"880px",onDismiss:r.close,children:o.jsx(FJ,{value:r.value,onPick:r.set,saved:o.jsx(_J,{state:g}),page:y=>o.jsx(VJ,{page:y,engines:e,brandId:t,onSaved:n,onKitState:w,version:i,home:u,desktop:h,onDesktop:p})})})}function FJ({value:e,onPick:t,saved:n,page:r}){const a=Mr(aa),{brand:i}=cn(),l=cY(e),[u,f]=s.useState(()=>uY(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 m=y=>{t(y),f(!1)},g=Mh.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(Ra,{size:15})}),o.jsx(Ns,{className:"sc-newdlg-title",children:g.label}),l==="brand"&&n,o.jsx(fk,{})]}),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:g.sub(ka(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:()=>m(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(uQ,{feature:y.feature}),a&&o.jsx(Cl,{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(fk,{})]}),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:Mh.filter(y=>y.scope==="brand").map(w)}),o.jsx("p",{className:"sc-set-group",children:"Studio"}),o.jsx("ul",{children:Mh.filter(y=>y.scope==="studio").map(w)}),o.jsx("p",{className:"sc-set-group",children:"Delete"}),o.jsx("ul",{className:"sc-set-apart",children:Mh.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:g.label}),o.jsx("p",{children:g.sub(ka(i))})]}),l==="brand"&&n]}),r(l)]},l)]})]},"index")}function _J({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"}),bQ(e)]})}function VJ({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(GQ,{onSaveState:a});case"usage":return o.jsx(OJ,{brandId:n});case"engines":return o.jsxs(o.Fragment,{children:[o.jsx(cJ,{engines:t}),o.jsx(eJ,{engines:t,onSaved:r,thisComputer:h})]});case"appearance":return o.jsx(pQ,{});case"library":return o.jsx(fJ,{info:l,thisComputer:h});case"phone":return o.jsxs(o.Fragment,{children:[o.jsx(TJ,{}),h&&o.jsx(rJ,{status:u,onStatus:f})]});case"updates":return o.jsx(HJ,{version:i});case"about":return o.jsx(fQ,{version:i});case"danger":return o.jsx(tJ,{onDone:r,thisComputer:h})}}function fk(){return o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})}function ZJ(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 zJ(e){return e>0?`See ${e} more update${e===1?"":"s"}`:"See all updates"}const pR="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",BJ="/assets/whatsnew-stage-DlyjaAn6.webp",UJ=["January","February","March","April","May","June","July","August","September","October","November","December"];function mR(e){const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return e;const n=UJ[Number(t[2])-1];return n?`${Number(t[3])} ${n} ${t[1]}`:e}function WJ(e){const t=mR(e);if(t===e)return e;const[n,r,a]=t.split(" ");return`${n} ${r.slice(0,3)} ${a}`}const KJ="/assets/0.16.0-local-access-D7XQonLd.webp",GJ="/assets/0.17.0-select-several-DdAw3yQ3.webp",YJ="/assets/0.17.1-presenter-identity-BfgRpajU.webp",qJ="/assets/0.17.2-presenter-prompt-BiaRpVJN.webp",XJ="/assets/0.18.0-portrait-standard-CrJ6Ixm2.webp",QJ="/assets/0.19.0-home-examples-Dv7HjKk9.webp",JJ="/assets/0.20.0-made-in-place-B0L_kS__.webp",eee=Object.assign({"./assets/whatsnew/0.16.0-local-access.webp":KJ,"./assets/whatsnew/0.17.0-select-several.webp":GJ,"./assets/whatsnew/0.17.1-presenter-identity.webp":YJ,"./assets/whatsnew/0.17.2-presenter-prompt.webp":qJ,"./assets/whatsnew/0.18.0-portrait-standard.webp":XJ,"./assets/whatsnew/0.19.0-home-examples.webp":QJ,"./assets/whatsnew/0.20.0-made-in-place.webp":JJ});function tee(e){return eee[`./assets/whatsnew/${e}`]??null}const gR="Scenri could not read its release notes. If you are running a development server, it may predate this page; restart it and try again.",vR="There is nothing new to show here yet.",nee={fetchpriority:"high"};function wR(e){var r;const t=(r=e==null?void 0:e.sections.find(a=>a.image))==null?void 0:r.image,n=t?tee(t.file):null;return t&&n?{src:n,alt:t.alt}:null}function yR({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?nee: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(_I,{size:14})})})]}):o.jsx("div",{className:"sc-wn-media","data-ready":u,children:f})}function ree({src:e,alt:t,onClose:n}){const r=s.useRef(null);return o.jsx(Al,{open:!0,onOpenChange:a=>!a&&n(),children:o.jsxs(Nl,{children:[o.jsx(Ml,{className:"sc-wn-lb-scrim"}),o.jsxs(Rl,{className:"sc-wn-lb","aria-describedby":void 0,onOpenAutoFocus:a=>{r.current=document.activeElement,ON(a)},onCloseAutoFocus:a=>{var i;a.preventDefault(),(i=r.current)!=null&&i.isConnected&&r.current.focus()},onClick:n,children:[o.jsx(Pl,{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(Hf,{className:"sc-icon-btn sc-wn-lb-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})]})]})})}function bR({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 see({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 xR({entry:e,current:t=!1,hideVersion:n=!1}){return o.jsxs("p",{className:"sc-wn-when",children:[!n&&o.jsx(bR,{version:e.version,current:t}),o.jsxs("time",{dateTime:e.date,children:[o.jsx("span",{"aria-hidden":"true",children:WJ(e.date)}),o.jsx("span",{className:"sc-vh",children:mR(e.date)})]})]})}function aee({version:e,current:t}){return o.jsxs("div",{className:"sc-wn-media sc-wn-fallback","data-ready":!0,children:[o.jsx("img",{src:pR,alt:""}),o.jsx("span",{className:"sc-wn-fallback-chip","data-theme":"dark",children:o.jsx(bR,{version:e,current:t})})]})}function oee({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(Cc,{size:12,"aria-hidden":"true"})]})}function iee(){const e=Ar("whatsnew"),{brand:t}=cn(),{status:n,featured:r,recent:a,unseen:i,lead:l,running:u,markSeen:f}=Qc(),h=e.value!==null&&n!=="loading",p=r,m=s.useRef({open:!1,more:0});h&&!m.current.open?m.current={open:!0,more:i.filter(A=>A!==(p==null?void 0:p.version)).length}:h||(m.current.open=!1);const g=()=>{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?wR(p):null,S=(k==null?void 0:k.src)??pR;s.useEffect(()=>{if(l)for(const A of[S,BJ]){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(Us,{open:h,className:"sc-wn",tone:"dim",maxWidth:"520px",described:!0,onDismiss:g,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(Cn,{size:16})})})]}),o.jsx("div",{className:"sc-newdlg-body",children:p?o.jsxs("article",{className:"sc-wn-ex",children:[k?o.jsx(yR,{picture:k,eager:!0,onBroken:()=>b(p.version)},p.version):o.jsx(aee,{version:p.version,current:p.version===u}),o.jsx(xR,{entry:p,current:p.version===u,hideVersion:!k}),o.jsx(Tc,{asChild:!0,children:o.jsx("h3",{className:"sc-wn-hed",children:o.jsx(Zn,{className:"sc-wn-ex-link",to:`${jp(t)}#v${p.version}`,replace:!0,onClick:C,children:p.title})})})]}):o.jsx(Tc,{className:"sc-wn-txt",children:n==="failed"?gR:vR})}),o.jsxs("div",{className:"sc-newdlg-foot sc-wn-foot",children:[a.length>0&&o.jsxs(Zn,{className:"sc-wn-link",to:jp(t),replace:!0,onClick:C,children:[zJ(m.current.more),o.jsx(wa,{size:13,"aria-hidden":"true"})]}),o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",children:"Got it"})})]})]})}function lee(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 kR(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 cee(e){return`Scenri will start Codex without ${kR(e)}. Nothing on your computer changes, and you can undo this here later.`}function uee(e){return`Scenri is starting Codex without ${kR(e)} on this computer.`}const dee=2e3,fee=5*6e4;function hee({engines:e,onSaved:t}){const n=Ar("setup"),r=n.close,a=n.value,i=a?cR(a):void 0,u=!!i||a==="codex-cli",f=e.find(m=>m.id===a),[h,p]=s.useState(!0);return s.useEffect(()=>{let m=!0;return Ae.version().then(g=>m&&p(g.thisComputer!==!1)).catch(()=>{}),()=>{m=!1}},[]),o.jsx(Us,{open:u,className:"sc-setup",maxWidth:"520px",onDismiss:r,onOpenAutoFocus:i&&h?m=>{var g;m.preventDefault(),(g=m.target.querySelector(".sc-setup-key input"))==null||g.focus()}:void 0,children:i?o.jsx(pee,{provider:i,name:f?ml(f.displayName):i.engineId,connected:!!(f!=null&&f.available),thisComputer:h,onSaved:t,onDone:r}):o.jsx(mee,{engines:e,onSaved:t,onDone:r})})}function SR({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(Cn,{size:16})})})]})}function pee({provider:e,name:t,connected:n,thisComputer:r,onSaved:a,onDone:i}){const[l,u]=s.useState(""),[f,h]=s.useState(!1),[p,m]=s.useState(null),[g,w]=s.useState(!1),y=async()=>{const k=l.trim();if(k){h(!0),m(null);try{await Ae.saveSettings({[e.settingKey]:k}),u(""),a(),i()}catch(S){m(S.message)}finally{h(!1)}}},b=async()=>{h(!0),m(null);try{await Ae.saveSettings({[e.settingKey]:""});const k=await Ae.settings();if(a(),k[e.settingKey]){w(!0);return}i()}catch(k){m(k.message)}finally{h(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(SR,{title:n?`${t} key`:`Connect ${t}`}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(ER,{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(Lr,{size:"1"}):o.jsx(LE,{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(Cc,{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()})}),g&&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(gm,{size:15})," ",p]})})]})]})}function mee({engines:e,onSaved:t,onDone:n}){const r=Il(),[a,i]=s.useState("checking"),[l,u]=s.useState(null),[f,h]=s.useState(!1),[p,m]=s.useState("mac"),[g,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(U=!1)=>{const{state:I,reason:_,platform:O,conflictKeys:Y,ignoredKeys:z}=await Ae.codexStatus({force:U});return O&&m(O),w(_??null),b(Y??[]),S(z??[]),i(I),I},[]);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:U,conflictKeys:I,ignoredKeys:_,reason:O}=await Ae.repairCodexEnv(y);b(I??[]),S(_??[]),w(O??null),i(U)}catch(U){u({detail:U.message}),i("env-conflict")}},M=async()=>{u(null),i("checking");try{const{state:U,conflictKeys:I,ignoredKeys:_}=await Ae.restoreCodexEnv();b(I??[]),S(_??[]),i(U)}catch{A().catch(()=>i("unverified"))}};s.useEffect(()=>{a==="ready"&&t()},[a,t]);const j=async()=>{u(null),i("installing");try{const U=await Ae.installCodex();if(U.ok||U.state!=="not-installed"){i(U.state);return}u({detail:U.detail,command:U.fallbackCommand,docsUrl:U.docsUrl}),i(U.state)}catch(U){u({detail:U.message,command:"npm install -g @openai/codex"}),i("not-installed")}},R=async()=>{u(null),i("signing-in");const U=Date.now();C(),E.current=window.setInterval(()=>{if(Date.now()-U>fee){C(),i("not-authenticated"),u({detail:"Sign-in did not finish. Try again, or use the command below.",command:"codex login"});return}Ae.codexStatus().then(({state:I})=>{I==="ready"&&(C(),i("ready"))}).catch(()=>{})},dee);try{const I=await Ae.loginCodex();if(C(),I.ok||I.state==="ready"){i(I.state);return}u({detail:I.detail,command:I.fallbackCommand}),i(I.state)}catch(I){C(),u({detail:I.message,command:"codex login --device-auth"}),i("not-authenticated")}},P=s.useRef(null);s.useEffect(()=>()=>{P.current&&window.clearTimeout(P.current)},[]);const H=U=>{var I;(I=navigator.clipboard)==null||I.writeText(U).then(()=>{h(!0),P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>h(!1),1600)})},D=e.filter(U=>U.available&&U.id!=="codex-cli"&&!U.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:R}:a==="env-conflict"||a==="repairing"?{step:2,label:"Ignore that key",verb:a==="repairing"?"Ignoring":"Ignore that key",busy:a==="repairing",run:T}:null,K=a==="not-installed"||a==="installing"||a==="not-authenticated"||a==="signing-in";return o.jsxs(o.Fragment,{children:[o.jsx(SR,{title:"Set up image generation"}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(ER,{engineId:"codex-cli",name:"Codex CLI",state:gee[a],ready:a==="ready",busy:B}),o.jsx("p",{className:"sc-setup-lead",children:vee[a](g)}),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(wee,{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:cee(y)}),a==="ready"&&k.length>0&&o.jsxs("p",{className:"sc-setup-note",children:[uee(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(pp,{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(U=>ml(U.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(gm,{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(pp,{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(Cc,{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(hp,{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(hp,{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(LE,{size:15})," Add a provider key"]}),o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:()=>void A(),children:"Back to Codex setup"})]}),K&&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 gee={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"},vee={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 ER({engineId:e,name:t,state:n,ready:r,busy:a}){const i=dR(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(fR,{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(Lr,{size:"1"}):r?o.jsx("span",{className:"d"}):null,n]})]})]})}function wee({phase:e,act:t}){const{installed:n,signedIn:r,connected:a}=lee(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",m=o.jsx("span",{className:"sc-learn-n","aria-hidden":"true",children:i[f]?o.jsx(Kn,{size:14,weight:"bold"}):f+1}),g=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:g,onClick:t.run,children:[m,o.jsx("span",{className:"sc-learn-step-name",children:u}),o.jsxs("span",{className:"sc-learn-go","aria-hidden":"true",children:[g?o.jsx(Lr,{size:"1"}):null,t.verb,g?null:o.jsx(wa,{size:12,weight:"bold"})]})]}):o.jsxs("div",{className:"sc-learn-step","data-state":p,children:[m,o.jsx("span",{className:"sc-learn-step-name",children:u}),i[f]&&o.jsx("span",{className:"sc-vh",children:", done"})]})},u)})})}function yee(){const{brands:e}=$n(),t=CR(e);return t?o.jsx(Xa,{to:Do(t),replace:!0}):o.jsx(Xa,{to:"/setup",replace:!0})}function CR(e){const t=mG();return e.find(n=>n.id===t)??e[0]??null}const bee=48;function xee(e,t,n=bee){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&&Uu(u[u.length-1],a)<0)continue;r??(r=[...e]);let f=0;for(;f<r.length&&Uu(r[f],a)<=0;)f++;r.splice(f,0,a),r.length>n&&(r.length=n)}return r??e}const jR='[data-guide="library.new"]',Dd=(e,t)=>({id:"go",voice:"ask",point:`[data-guide="nav.${e}"]`,side:"bottom",soft:!0,...t}),kee='[data-guide="compose"] .sc-attachpanel',See='[data-guide="compose"] .sc-attachpanel .sc-ap-body',$p='[data-guide="compose"] .sc-promptcard',Eee='[data-guide="compose.add"]',AR='[data-guide="compose"] .sc-brief-line',Tp='[data-guide="compose.send"]',NR='[data-guide="compose.engine"]',od=".sc-pstudio",P4=`${od} .sc-convo-card`,Cee=".sc-newdlg-layer",id=".sc-ovl",Sn={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."}},gl=e=>`.sc-feed .sc-cell[data-fb-node="${e}"]`,Jw=e=>e.status==="done"&&e.images>0,ey=e=>e.status==="error"||e.status==="cancelled"||e.status==="done"&&e.images===0,L4=e=>e.products+e.presenters+(e.scene?1:0)+e.others,hk={product:"Products",presenter:"Presenters",scene:"Scenes"};function MR(e){if(!e.here)return e.heading?Dd("create",Sn.go):null;const t=e.composer,n=e.nodes.find(Jw);if(n)return{id:"result",voice:"note",point:gl(n.id),side:"bottom",...Sn.result,done:!0};const r=e.nodes.find(u=>u.status==="running");if(r)return{id:"waiting",voice:"note",point:gl(r.id),side:"bottom",...Sn.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||L4(t)>0||t.words,i=e.nodes.find(ey);if(i&&!a)return{id:"failed",voice:"note",point:gl(i.id),side:"bottom",...Sn.failed};if(t.engine!=="ready")return{id:"engine",voice:"ask",point:NR,side:"top",...Sn.engine};if(!e.begun&&L4(t)===0&&!t.words)return{id:"intro",voice:"ask",live:[],start:!0,...Sn.intro};const l=PR(t);return l?$4(l,t.pickerOpen):{id:"make",voice:"ask",point:Tp,live:[AR,Tp],side:"top",...Sn.make}}function RR(e){if(!e.here)return e.heading?Dd("create",Sn.go):null;const t=e.composer,n=e.nodes.find(Jw);if(n)return{id:"again",voice:"note",point:gl(n.id),side:"bottom",...Sn.reuseResult,done:!0};const r=e.nodes.find(l=>l.status==="running");if(r)return{id:"waiting",voice:"note",point:gl(r.id),side:"bottom",...Sn.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||L4(t)>0||t.words,i=e.nodes.find(ey);return i&&!a?{id:"failed",voice:"note",point:gl(i.id),side:"bottom",...Sn.failed}:t.engine!=="ready"?{id:"engine",voice:"ask",point:NR,side:"top",...Sn.engine}:t.products===0?$4("product",t.pickerOpen,Sn.reuseProduct):t.scene?{id:"make",voice:"ask",point:Tp,live:[AR,Tp],side:"top",...Sn.make}:$4("scene",t.pickerOpen,Sn.reuseScene)}function PR(e){return e.products===0?"product":e.presenters===0?"presenter":e.scene?null:"scene"}function $4(e,t,n){const r=n??Sn[e];return t?{id:e,voice:"ask",point:kee,live:[See],lit:[$p],beside:!0,side:"right",...r}:{id:e,voice:"ask",point:Eee,side:"top",...r}}const LR=`${id} .sc-promptcard`,jee=`${id} .sc-stage-img`,pk=`${id} .sc-trail`,mk=".sc-feed";function Aee(e){if(e.heading)return Dd("create",Sn.refineGo);if(!e.here)return null;if(!e.open&&!e.armed)return{id:"choose",voice:"ask",point:mk,live:[mk],beside:!0,side:"left",...Sn.refineChoose};const t=e.nodes.find(Jw);if(t)return e.open?{id:"refined",voice:"note",shell:id,point:pk,side:"top",...Sn.refineResult,done:!0}:{id:"refined",voice:"note",point:gl(t.id),side:"bottom",...Sn.refineResult,done:!0};if(e.nodes.some(r=>r.status==="running"))return{id:"refining",voice:"quiet"};const n=e.nodes.find(ey);return n&&!e.asking?e.open?{id:"refine-failed",voice:"note",shell:id,point:pk,side:"top",...Sn.refineFailed}:{id:"refine-failed",voice:"note",point:gl(n.id),side:"bottom",...Sn.refineFailed}:e.open?{id:"ask",voice:"ask",shell:id,point:LR,also:[jee],beside:!0,side:"left",...Sn.refineAsk}:{id:"ask",voice:"ask",point:$p,live:[$p],beside:!0,side:"top",...Sn.refineAsk}}function $R(e){if(e.heading)return Dd("presenters",Sn.presenterGo);const t=e.studio;if(t){const n=`${od} [data-turn="q:${t.open}"]`,r=(a,i,l=[],u)=>({id:a,voice:"ask",shell:od,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",Sn.presenterStart,[P4]);case"noengine":return r("engine",Sn.presenterEngine);case"identity":case"revision":return r("face",Sn.presenterFace,[".sc-pstudio-well",P4],[`${od} [data-turn]:has(+ [data-turn="q:${t.open}"])`]);case"save":return r("save",Sn.presenterSave);default:return{id:"studio",voice:"quiet"}}}return e.onPage?{id:"new",voice:"ask",point:jR,side:"bottom",...Sn.presenterNew}:null}function Nee(e,t){return{id:e,voice:"ask",shell:Cee,point:".sc-newdlg",beside:!0,side:"left",...t}}function TR(e){return{id:"new",voice:"ask",point:jR,side:"bottom",...e}}function Mee(e){var n,r;if(e.heading)return Dd("scenes",Sn.sceneGo);const t=e.studio;if(t){const a=`${od} [data-turn="q:${t.open}"]`,i=(l,u)=>({id:l,voice:"ask",shell:od,point:`${a} .sc-convo-ask`,live:[a],also:[P4],beside:!0,side:"left",...u});return t.open==="source"?i("start",Sn.sceneStart):(n=t.open)!=null&&n.startsWith("agree-")?i("words",Sn.sceneWords):(r=t.open)!=null&&r.startsWith("decide-")?{id:"use",voice:"quiet"}:{id:"studio",voice:"quiet"}}return e.onPage?TR(Sn.sceneNew):null}function Ree(e){return e.heading?Dd("products",Sn.productGo):e.dialogOpen?Nee("product",Sn.productMake):e.onPage?TR(Sn.productNew):null}function DR(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 Pee(e,t,n){return e?DR(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 Lee(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 $ee={"first-shot":"shot",reuse:"shot",refine:"refine",product:"product",presenter:"presenter",scene:"scene"};function $h(e,t){return!(!t.eligible||t.hidden||t.active&&(t.active.task===e||t.active.task==="first-shot")||t.done[$ee[e]]||t.dismissed.includes(e)||e==="refine"&&!t.done.shot)}function Tee(e){return e.onMainPage&&e.eligible&&e.welcome===null&&e.ready&&e.visible&&!e.blocked&&!e.busy}const Ku={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 Dee(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 Hee(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 Oee="https://github.com/tonygorb/scenri";function Iee(){var S,E;const e=pn(pt.hub),t=pn(pt.set),n=!!e||!!t,r=Qc(),a=zm(),i=!!((S=a.status)!=null&&S.available),l=i&&!a.dismissed||r.unread,u=Ol(),f=Il(),h=HN(),p=dY(),{engines:m}=$n(),g=!m.some(C=>C.available),{brand:w}=cn(),{pathname:y}=Un(),b=s.useRef(!1),k=jp(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(lF,{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(I7,{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:()=>{m4.current="help",h()},children:[o.jsx(YI,{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(qI,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:Ku.again})]})]}),n&&o.jsxs(qn,{className:"sc-menu-item",onSelect:()=>window.dispatchEvent(new Event("scenri:shortcuts")),children:[o.jsx(JI,{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(Zn,{to:k,onClick:C=>{!C.metaKey&&!C.ctrlKey&&!C.shiftKey&&!C.altKey&&y!==k&&(b.current=!0)},children:[o.jsx(eF,{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"})]})]})}),g&&o.jsxs(qn,{className:"sc-menu-item",onSelect:()=>f(),children:[o.jsx(ef,{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(hm,{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:Oee,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(GI,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Scenri on GitHub"})]})})]})]})})}function Fee(){return o.jsx(Iee,{})}const _ee={composer:null,overlay:null,studio:null,showing:!1};let to=_ee;const T4=new Set;function n2(e){to=e;for(const t of T4)t()}const ty=(e,t)=>e===t||JSON.stringify(e)===JSON.stringify(t);function gk(e){ty(to.composer,e)||n2({...to,composer:e})}function vk(e){ty(to.overlay,e)||n2({...to,overlay:e})}function Dp(e){ty(to.studio,e)||n2({...to,studio:e})}function wk(e){to.showing!==e&&n2({...to,showing:e})}function HR(e){return T4.add(e),()=>T4.delete(e)}function Vee(){return to}function OR(){return s.useSyncExternalStore(HR,Vee)}function Zee(){return s.useSyncExternalStore(HR,()=>to.showing)}function IR(e){return e.milestones.map(t=>t.label)}const sl=[{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"}],D4={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 zee(e){return sl.find(t=>t.id===e)??null}function Bee(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 Uee(e,t){return e.find(n=>t(n)!=="done")??null}const ny=Object.fromEntries(sl.map(e=>[e.id,Object.fromEntries(e.milestones.flatMap((t,n)=>t.moments.map(r=>[r,n])))]));function FR(e,t){let n=0;for(const r of t){const a=ny[e][r];a!==void 0&&a>n&&(n=a)}return n}function Wee(e,t){return FR(e,t)>0}function Kee(e,t){var a;const n=ny[e][t],r=((a=sl.find(i=>i.id===e))==null?void 0:a.milestones.length)??0;return n===void 0||!r?null:{at:n+1,of:r}}const O8=e=>e.status==="done"&&e.images>0;function yk(e,t,n){const r=FR(e,t);return n?Math.max(Gee(e,n),r):r}function Gee(e,t){const n=t.moment?ny[e][t.moment]:void 0;if(n!==void 0)return n;switch(e){case"first-shot":return t.nodes.some(O8)?5:t.nodes.length>0?4:0;case"reuse":return t.nodes.some(O8)?4:t.nodes.length>0?3:0;case"presenter":return t.draft?3:0;case"refine":return t.nodes.some(O8)||t.nodes.some(r=>r.status==="running")?3:0;default:return 0}}const H4={"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 Yee({open:e,pictures:t,note:n,onTake:r,onDecline:a}){return o.jsxs(Us,{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":Ku.notNow,children:o.jsx(Cn,{size:16})})})]}),o.jsx(Tc,{className:"sc-welcome-lede",children:Ku.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:Ku.notNow}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:r,children:Ku.take})]})]})}const bk=e=>e.t!=="format",Jo=()=>[{t:"text",v:""}],qa=e=>e.t==="product"?`p:${e.id}`:e.t==="template"?`t:${e.id}`:e.t==="ref"?`r:${e.imageHash}`:r2(e);function qee(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(bk).filter(r),i=t.filter(bk).filter(r);return{own:a,carried:i}}function ry(e){const{own:t,carried:n}=qee(e.tokens??[],e.inherited??[]),r=[...t,...n],a=r.length?r:Jo(),i=a.some(l=>l.t==="template");return e.templateId&&!i?[{t:"template",id:e.templateId},...a]:a}const hc="sc-token",a1=`.${hc}`,r2=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},di="\uFEFF",_l=//g,Ec=e=>!!e&&e.nodeType===Node.TEXT_NODE&&e.textContent===di,_R=e=>{var t;return e.length-(((t=e.match(_l))==null?void 0:t.length)??0)};function So(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)?Op(e,n.startContainer,n.startOffset):null}function Ua(e,t){if(!e)return;let n=0;for(const r of Array.from(e.childNodes)){const a=bd(r);if(r.nodeType===Node.TEXT_NODE){if(t<=n+a){Po(e,r,Hp(r,t-n));return}}else if(t<=n+a){const i=r.nextSibling;if((i==null?void 0:i.nodeType)===Node.TEXT_NODE){Po(e,i,Hp(i,0));return}break}n+=a}pc(e)}function Hp(e,t){const n=e.textContent??"";if(n===di)return 1;let r=0,a=0;for(;a<n.length&&r<t;)n[a]!==di&&(r+=1),a+=1;return a}function pc(e){if(!e)return;e.focus({preventScroll:!0});const t=e.lastChild;if((t==null?void 0:t.nodeType)===Node.TEXT_NODE){Po(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 Xee(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 Po(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 bd=e=>e.nodeType===Node.TEXT_NODE?_R(e.textContent??""):1;function Op(e,t,n){if(t===e){let a=0;for(let i=0;i<n&&i<e.childNodes.length;i++)a+=bd(e.childNodes[i]);return a}let r=0;for(const a of Array.from(e.childNodes)){if(a===t)return r+_R((a.textContent??"").slice(0,n));if(a.contains(t))return r+1;r+=bd(a)}return r}function Co(e){var n,r;if(!e)return;const t=So(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(_l,""),u=l.length?l:i.length?di:"";u!==i&&(a.textContent=u),u||a.remove()}for(const a of Array.from(e.childNodes))Ec(a)&&!Fs(a.previousSibling)&&!Fs(a.nextSibling)&&a.remove();for(const a of Array.from(e.childNodes))Fs(a)&&(((n=a.previousSibling)==null?void 0:n.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(di),a),((r=a.nextSibling)==null?void 0:r.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(di),a.nextSibling));D0(e)||t!==null&&Ua(e,t)}function Qee(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(Fs(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(di)&&(u!==di||!Fs(l.previousSibling)&&!Fs(l.nextSibling)))return!1}return!0}function Jee(e){return e.querySelector(a1)?!1:!(e.textContent??"").replace(/[​ ]/g,"").trim()}function D0(e){if(!e)return!1;const t=Jee(e);return t&&e.firstChild&&e.replaceChildren(),e.toggleAttribute("data-empty",t),t}const Fs=e=>!!e&&e.nodeType===Node.ELEMENT_NODE&&e.classList.contains(hc);function sy(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 xk(e){var a;if(!e)return Jo();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(_l,"");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 kk(e,t,n){if(e){e.textContent="";for(const r of ete(t)){if(r.t==="text"){r.v&&e.appendChild(document.createTextNode(r.v));continue}e.appendChild(n(r))}Co(e)}}function ete(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 I8(e,t){for(const n of Array.from(e.querySelectorAll(a1))){const r=ks(n.dataset.tok??"");if(r&&qa(r)===t)return n}return null}function VR(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 ZR(){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 yc(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;Po(e,a,Ec(a)?1:n==="after"?0:a.length)}const Ip=9;function zR(e){if(!e.firstChild)return[];const t=document.createRange();return t.selectNodeContents(e),Array.from(t.getClientRects()).filter(n=>n.height>0)}function BR(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 Sk(e,t,n){if(!e)return!1;const r=zR(e),a=BR(r,n);if(!a)return!1;const i=a.top+a.height/2;for(const u of Array.from(e.querySelectorAll(a1))){const f=u.getBoundingClientRect();if(!(f.bottom<a.top||f.top>a.bottom)&&!(t<f.left-Ip||t>f.right+Ip))return yc(e,u,t<f.left+f.width/2?"before":"after"),!0}if(n>=a.top&&n<=a.bottom)return!1;const l=UR(t,i);return!l||!e.contains(l.node)||l.node.nodeType!==Node.TEXT_NODE?!1:(Po(e,l.node,l.offset),!0)}function tte(e,t,n){if(!e)return null;const r=BR(zR(e),n);if(!r)return null;const a=r.top+r.height/2;for(const l of Array.from(e.querySelectorAll(a1))){const u=l.getBoundingClientRect();if(!(u.bottom<r.top||u.top>r.bottom)&&!(t<u.left-Ip||t>u.right+Ip))return{beside:l,side:t<u.left+u.width/2?"before":"after"}}const i=UR(t,a);return!i||!e.contains(i.node)?null:{node:i.node,offset:i.offset}}function UR(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 nte(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){Ua(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=ote(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)}Co(e),Ua(e,no(e,t)+1)}const rte=["$","/","@","#"],ste=e=>rte.includes(e),Fp=e=>e===" "||e===`
100
+ `||e===" "||e===di;function ate(e){const t=VR(e);for(let n=t.length-1;n>=0;n--){const r=t[n];if(Fp(r))return null;if(ste(r))return n===0||Fp(t[n-1])?{sigil:r,query:t.slice(n+1)}:null}return null}function ote(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 F8(e,t){if(!e||!t)return;e.normalize();const n=no(e,t);t.remove(),Co(e),Ua(e,n)}function no(e,t){let n=0;for(const r of Array.from(e.childNodes)){if(r===t)break;n+=bd(r)}return n}function ite(e,t){var u,f;const n=sy(e);if(!n||!e)return!1;const{text:r,at:a}=n,i=Ec(r);if(t==="right"){if(!Fs(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:(Po(e,h,Ec(h)?1:0),!0)}if(!Fs(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:(Po(e,l,Ec(l)?1:l.length),!0)}function Ek(e,t){const n=sy(e);if(!n)return null;const{text:r,at:a}=n,i=Ec(r);return t==="Backspace"?Fs(r.previousSibling)&&(i||a===0)?r.previousSibling:null:Fs(r.nextSibling)&&(i||a===r.length)?r.nextSibling:null}function Ck(e,t){const n=sy(e);return!n||!Ec(n.text)?!1:t==="Backspace"?!n.text.previousSibling:!n.text.nextSibling}function lte(e,t){const n=So(e);if(!e||n==null)return null;const r=Array.from(e.childNodes).filter(Fs);if(t==="forward")return r.find(a=>no(e,a)>=n)??null;for(let a=r.length-1;a>=0;a--)if(no(e,r[a])<n)return r[a];return null}const ld=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function cte(e){let t="",n="",r=!1;const a=i=>{var f;if(i.nodeType===Node.TEXT_NODE){const h=(i.textContent??"").replace(_l,"");if(!h)return;t+=h,n+=ld(h),r=!1;return}const l=i,u=(f=l.dataset)==null?void 0:f.tok;if(u){const h=ei(l);t+=(r?" ":"")+h,r=!0,n+=`<span data-sc-tok="${ld(u)}">${ld(h)}</span>`;return}i.childNodes.forEach(a)};return e.cloneContents().childNodes.forEach(a),{text:t,html:`<span data-sc-brief="1">${n}</span>`}}function ute(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(ld(l));continue}const i=t(a);n.push(i),r.push(`<span data-sc-tok="${ld(r2(a))}">${ld(i)}</span>`)}return{text:n.join(" "),html:`<span data-sc-brief="1">${r.join(" ")}</span>`}}function ei(e){var t;return(((t=e.querySelector(".sc-token-label"))==null?void 0:t.textContent)??"").trim()}function dte(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 m=(i.textContent??"").replace(_l,"");m&&r.push(m);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 WR(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=o1(e);return r.filter((i,l)=>l===r.length-1||!/^[ \n]*$/.test(a.slice(i,r[l+1])))}const o1=e=>e.map(t=>t.t==="text"?t.v:"").join(""),ay=(e,t,n)=>{const r=n<=t?e.slice(n,t):e.slice(t+1,n);return/^[ \n]*$/.test(r)};function fte(e,t){const n=o1(e);return WR(e).filter(r=>!ay(n,t,r))}function hte(e,t){return e.find(n=>n>=t)??(e.length?e[e.length-1]:null)}function pte(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 KR(e,t,n){if(!e||!t.parentNode)return!1;const r=no(e,t);if(ay(o1(s2(e)),r,n))return!1;let a=null,i=0;for(const l of Array.from(e.childNodes)){const u=bd(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(Hp(l,f))}else a=n===i?l:l.nextSibling;break}i+=u}return a===t?!1:(t.remove(),e.insertBefore(t,a),Co(e),!0)}function jk(e,t,n){if(!e)return!1;const r=no(e,t),a=fte(s2(e),r),i=n===-1?[...a].reverse().find(l=>l<r):a.find(l=>l>r+1);return i===void 0?!1:KR(e,t,i)}function mte(e,t){if(!e)return t;const n=o1(s2(e));let r=t;for(;r>0&&(n[r-1]===" "||n[r-1]===`
102
+ `);)r-=1;return r}function Ak(e,t,n,r){if(!e)return null;const a=tte(e,n,r);if(!a)return null;const i=s2(e),l=no(e,t),u=WR(i),f="beside"in a?no(e,a.beside)+(a.side==="before"?0:1):a.node.nodeType===Node.TEXT_NODE||a.node===e?Op(e,a.node,a.offset):null;if(f===null)return null;const h="beside"in a&&a.side==="after"?hte(u,f):pte(u,f);return h===null?null:{units:h,noop:ay(o1(i),l,h)}}function O4(e,t){const n=ei(t)||"the chip",r=gte(t);if(r)return`Moved ${n} before ${r}.`;const a=vte(t);return a?`Moved ${n} after ${a}.`:no(e,t)===0?`Moved ${n} to the start of the brief.`:`Moved ${n} to the end of the brief.`}const GR=3;function gte(e){for(let t=e.nextSibling;t;t=t.nextSibling){if(Fs(t))return ei(t)||null;const n=(t.textContent??"").replace(_l,"").trim();if(n)return`"${n.split(/\s+/).slice(0,GR).join(" ")}"`}return null}function vte(e){for(let t=e.previousSibling;t;t=t.previousSibling){if(Fs(t))return ei(t)||null;const n=(t.textContent??"").replace(_l,"").trim();if(n)return`"${n.split(/\s+/).slice(-GR).join(" ")}"`}return null}function s2(e){const t=[];let n="";for(const r of Array.from(e.childNodes)){if(r.nodeType===Node.TEXT_NODE){n+=(r.textContent??"").replace(_l,"");continue}n&&(t.push({t:"text",v:n}),n=""),t.push({t:"ref",imageHash:""})}return n&&t.push({t:"text",v:n}),t}function I4(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 w0=e=>(e==null?void 0:e.querySelector('[data-kind="template"]'))??null,el=e=>{var t;return((t=e==null?void 0:e.closest)==null?void 0:t.call(e,a1))??null};function _8(e,t,n={}){var a;if(!e)return!1;let r=!1;for(let i=0;i<32;i++){const l=yte(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)};kte(e,l.node,l.start,l.end,t(u)),r=!0}return r&&Co(e),r}function wte(e,t){var i;e.dataset.kind="color",e.dataset.tok=r2(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 yte(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=xte(a.textContent??"",t,(u,f)=>bte(a,f,u)),l=i[i.length-1];if(l)return{node:a,...l}}return null}function bte(e,t,n){if(n>0)return Fp(t[n-1]);const r=e.previousSibling;if(!r||Fs(r))return!0;if(r.nodeType===Node.TEXT_NODE){const a=r.textContent??"";return!a.length||Fp(a[a.length-1]??"")}return!0}function xte(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=NQ(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 kte(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 m=a.previousSibling;(m==null?void 0:m.nodeType)===Node.TEXT_NODE&&Po(e,m,Math.min(h,(m.textContent??"").length));return}if(h<=r||!u.length){Po(e,t,t.length);return}Po(e,t,Math.min(h-r,t.length))}}function cd(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 Ste(){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 y0="data-sc-coach-inert",Ete=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Cte(e=document.body){let t=new Set;const n=a=>{a.hasAttribute("inert")&&!a.hasAttribute(y0)||(a.setAttribute(y0,""),a.setAttribute("inert",""))},r=a=>{a.hasAttribute(y0)&&(a.removeAttribute(y0),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)||Ete.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(y0)))},release(){for(const a of t)r(a);t=new Set}}}const ap=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),fi=e=>e.right-e.left,No=e=>e.bottom-e.top;function YR(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 b0(e,t){return{left:e.left-t,top:e.top-t,right:e.right+t,bottom:e.bottom+t}}function Nk(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 qR(e,t){return e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom}function Mk(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 fi(n)>0&&No(n)>0?n:null}function Rk(e,t){let{top:n,bottom:r}=e;const a=(e.top+e.bottom)/2;for(const i of t)qR(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 jte=e=>e==="top"||e==="bottom";function Ate(e,t,n){return t?jte(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 Pk=e=>e==="top"?"bottom":e==="bottom"?"top":e==="left"?"right":"left",Os=e=>Math.round(e*2)/2;function Nte(e,t,n){const r=Os(t),a=Os(n),i=e.map(u=>{const f=Math.max(0,Os(fi(u))),h=Math.max(0,Os(No(u))),p=Os(Math.max(0,Math.min(u.radius,f/2,h/2)));return`<rect x='${Os(u.left)}' y='${Os(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 Mte(e,t,n,r){const a=Os(t),i=Os(n),l=e.map(p=>{const m=Math.max(0,Os(fi(p))),g=Math.max(0,Os(No(p))),w=Os(Math.max(0,Math.min(p.radius,m/2,g/2)));return{x:Os(p.left),y:Os(p.top),ww:m,hh:g,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 Rte(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=>fi(a)>0&&No(a)>0)}const Lk=0,Pte=10,V8=14,x0=4,Z8="data-guide-stage",Lte="rgba(255,255,255,0.05)",F4="[data-guide-shape]",$k=[],$te="[data-radix-popper-content-wrapper], .sc-setpop, .sc-morepop, .sc-shotsheet, .sc-note-pop",Tk='input, textarea, [contenteditable]:not([contenteditable="false"])',Tte=17,Th=12,Dte=20,Hte=450,Ote=768,Dk=90,Ite=8,Hk=12,Fte=2e3,_te=".sc-topbar, .sc-tabbar, .sc-filterbar, .sc-canvas-dock, .sc-help-float, .sc-pstudio-head, .sc-newdlg-head",Vte=120,Zte="[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",z8=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 zte(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",m=!r,g=!!(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),[R,P]=s.useState("moving"),[H]=s.useState(Yte),[D,B]=s.useState(()=>z8(e)),V=s.useRef(e);V.current=e;const K=s.useRef(!1),U=s.useRef(null),I=s.useRef([]),_=R==="shown"&&D.id===t?z8(e):D,O=B8(a),Y=B8(h),z=B8(f);s.useEffect(()=>{if(p)return j.current=Cte(l),()=>{var Z;(Z=j.current)==null||Z.release(),j.current=null;for(const Q of I.current)Q.removeAttribute(Z8);I.current=[]}},[p,l]),s.useLayoutEffect(()=>{var It,Mt,Zt;const Z=b.current,Q=k.current,me=S.current,te=E.current,he=C.current,re=A.current;if(p&&(!me||!te||!he||!re)||g&&(!Z||!Q))return;let ee=!0,J=0,ae=0,Me=!1,ue=!1,Se="",Be=0,vt=0,Ue=0,Xe=null,De=null,G=null;const oe=window.matchMedia("(prefers-reduced-motion: reduce)").matches,We=a[0]??r??l;let Oe="",ie=r?Dh(r):null;P("moving");const X=()=>{var Rt;return(Rt=j.current)==null?void 0:Rt.set([...Z?[Z]:[],...me?[me]:[],...te?[te]:[],...he?[he]:[],...re?[re]:[],...a,...h,...[...document.querySelectorAll(Zte)].filter(Tt=>![...a,...h].some(Ee=>Tt.contains(Ee)))])},se=()=>{var Rt,Tt;(Rt=j.current)==null||Rt.release(),ue=!1,P("away"),(Tt=r??a[0])!=null&&Tt.isConnected&&Ye()};if(p&&j.current&&K.current){X(),ue=!0;const Rt=a.find(Ee=>Ee.matches(Tk)),Tt=document.activeElement;Rt&&!a.some(Ee=>Ee.contains(Tt))&&Ok(Rt)}const Re=async()=>{const Rt=++J;if(r&&!r.isConnected||a.some(ne=>!ne.isConnected))return se(),V.current.onLost();const Tt=window.innerWidth,Ee=window.innerHeight,Je=window.visualViewport,St=[{left:0,top:0,right:Tt,bottom:Ee},...Je?[{left:Je.offsetLeft,top:Je.offsetTop,right:Je.offsetLeft+Je.width,bottom:Je.offsetTop+Je.height}]:[]],qe=ne=>{const ce=ne===r?ie:Dh(ne);return ce?[...St,ap(ce.getBoundingClientRect())]:St},st=Bte(We,l),rt=st.filter(ne=>fi(ne)>Tt/3),Xt=r?Mk(ap(r.getBoundingClientRect()),qe(r)):null,Gt=Xt&&Rk(Xt,rt);if(r&&!Gt)return!Me&&Ue<Hk&&(Ue++,ie=Dh(r),U8(r,ie,oe).then(()=>ee&&ge())),se();const sn=[],Ut=[];for(const ne of[...r?[r]:[],...a,...h,...f,...Ik()]){const ce=Fk(ne);Ut.includes(ce)||Ut.push(ce)}const An=new Set([...r?[r]:[],...a,...f,...Ik()].map(Fk));let Bt=null;for(const ne of Ut){const ce=Mk(ap(ne.getBoundingClientRect()),qe(ne)),de=ce&&Rk(ce,rt);if(!de)continue;const Ve=op(ne);sn.push(Ve>=4||ne.matches("img, video, canvas")?{...b0(de,Lk),radius:Ve+Lk}:{...b0(de,Pte),radius:V8}),An.has(ne)&&(Bt=Bt?YR(Bt,de):de)}if(!m&&!Gt&&!Bt)return se();if(ue&&(a.some(ne=>ne.closest("[inert]"))||Z!=null&&Z.closest("[inert]"))&&(ue=!1),p&&me&&te&&he&&re){if(!sn.length&&Gt){const de=r,Ve=_k(de);sn.push({...b0(Gt,x0),radius:Nk(op(de),Ve.radius,x0,V8,No(Gt),Ve.height,Ve.count)})}for(const de of I.current)Ut.includes(de)||de.removeAttribute(Z8);for(const de of Ut)de.setAttribute(Z8,"");I.current=Ut;const ce=`${sn.map(de=>[de.left,de.top,de.right,de.bottom,de.radius].map(Math.round).join(",")).join("|")}@${Tt}x${Ee}`;if(ce!==Oe&&(Oe=ce,Gte(me,te,re,sn,H)),r&&Gt){const de=Jte(r),Ve=_k(r),Ie=de??b0(Gt,x0);Object.assign(he.style,{left:`${Ie.left}px`,top:`${Ie.top}px`,width:`${fi(Ie)}px`,height:`${No(Ie)}px`,borderRadius:`${de?Qte:Nk(op(r),Ve.radius,x0,V8,No(Gt),Ve.height,Ve.count)}px`}),he.hidden=!1}else he.hidden=!0}if(Z&&document.documentElement.style.setProperty("--sc-coach-h",`${Math.round(Z.offsetHeight)}px`),Z&&m&&(Z.style.right="",Z.style.left=`${Math.round((Tt-Z.offsetWidth)/2)}px`,Z.style.top=`${Math.round((Ee-Z.offsetHeight)/2)}px`,Z.dataset.side="centre",Q&&(Q.hidden=!0)),Z&&Q&&r&&Gt){Z.style.right="";const ne={top:Th+Ute(st,Ee),bottom:Th+Wte(st,Ee),left:Th,right:Th},ce=Tt>=Ote;De!==ce&&(De!==null&&r&&(ie=Dh(r),U8(r,ie,oe)),Xe=null,De=ce);const de=i==="left"||i==="right"?"top":i,Ve=!ce&&fi(Gt)>Tt*.6,Ie=ce?i:Ve?`${de}-start`:de,mt=($e,Ke)=>kj(Kte($e,r),Z,{strategy:"fixed",placement:Xe??Ie,middleware:[yj(Tte),xj({padding:ne,fallbackPlacements:Ke}),bj({padding:ne}),W6({element:Q,padding:Dte})]}),bt=!ce&&Bt?{...Gt,top:Bt.top,bottom:Bt.bottom}:Gt,kt=($e,Ke)=>qR({left:$e,top:Ke,right:$e+Z.offsetWidth,bottom:Ke+Z.offsetHeight},b0(bt,x0)),Ce=ce&&(i==="left"||i==="right")?[Pk(i),"top","bottom"]:ce?void 0:Ve?["bottom-start","top-start"]:["bottom","top"],xe=!p&&No(Gt)>Ee*.6,et=ce&&(e.beside||a.length>1),Ct=xe?{...Gt,top:Gt.bottom-1}:et?Ate(Gt,Bt,i):bt;let ke=await mt(Ct,xe?["top"]:Ce);if(!ee||Rt!==J||!xe&&kt(ke.x,ke.y)&&(ke=await mt(bt,void 0),!ee||Rt!==J))return;if(!xe&&kt(ke.x,ke.y))return P("stowed");Xe=ke.placement;const it=ke.placement.split("-")[0];Z.style.left=`${Math.round(ke.x)}px`,Z.style.top=`${Math.round(ke.y)}px`,Z.dataset.side=it;const ft=ke.middlewareData.arrow;Q.dataset.edge=Pk(it),Q.style.left=(ft==null?void 0:ft.x)!=null?`${ft.x}px`:"",Q.style.top=(ft==null?void 0:ft.y)!=null?`${ft.y}px`:"",Q.hidden=!ft||Math.abs(ft.centerOffset)>1}if(p&&!ue&&(X(),ue=!0),!Me){if(ene([...r?[r]:[],...a])&&++vt<Hk){window.setTimeout(ge,Dk);return}const ne=[...r?[r]:[],...a,...h,...f].map(ce=>{const de=ce.getBoundingClientRect();return[de.left,de.top,de.right,de.bottom].map(Math.round).join(",")}).join("|");if(ne!==Se&&(Se=ne,Be=0),++Be<2&&Be<Ite){window.setTimeout(ge,Dk);return}}P("shown"),Me||(Me=!0,Qe(),Ye())};let _e=0;const Ye=()=>{const Rt=r??a[0];if(!Rt)return;cancelAnimationFrame(_e);let Tt=Rt.getBoundingClientRect();const Ee=performance.now()+Fte,Je=()=>{if(!ee)return;const St=Rt.getBoundingClientRect();(St.top!==Tt.top||St.left!==Tt.left||St.height!==Tt.height)&&(Tt=St,ge()),performance.now()<Ee&&(_e=requestAnimationFrame(Je))};_e=requestAnimationFrame(Je)},ge=()=>{cancelAnimationFrame(ae),ae=requestAnimationFrame(()=>void Re())},Qe=()=>{K.current=!0;let Rt=!1;if(p&&Z){const Tt=St=>!!St&&a.some(qe=>qe.contains(St)),Ee=document.activeElement,Je=a.find(St=>St.matches(Tk))??null;M.current&&Tt(Ee)?M.current=null:M.current?(((M.current==="back"?L.current:null)??T.current??Z).focus({preventScroll:!0}),M.current=null):Je&&!Tt(Ee)?Ok(Je):(!Ee||Ee===document.body||Ee.closest("[inert]"))&&(Z.focus({preventScroll:!0}),Rt=!0)}u(t,Rt)},at=K.current&&!oe&&g&&U.current!==t?Vte:0;U.current=t,qte(at).then(()=>{if(ee)return Br.flushSync(()=>B(z8(V.current))),r?U8(r,ie,oe):void 0}).then(()=>{ee&&(G=wj(We,Z??me??We,ge))});const wt=new ResizeObserver(ge);for(const Rt of a)wt.observe(Rt);r&&wt.observe(r),Z&&wt.observe(Z);for(const Rt of[...r?[r]:[],...a]){const Tt=(It=Rt==null?void 0:Rt.closest)==null?void 0:It.call(Rt,F4);Tt&&wt.observe(Tt)}(Mt=window.visualViewport)==null||Mt.addEventListener("resize",ge),(Zt=window.visualViewport)==null||Zt.addEventListener("scroll",ge);let Et=0;const ot=p?new MutationObserver(()=>{ue&&(cancelAnimationFrame(Et),Et=requestAnimationFrame(X))}):null;return ot==null||ot.observe(l,{childList:!0,subtree:!0}),()=>{var Rt,Tt;ee=!1,document.documentElement.style.removeProperty("--sc-coach-h"),cancelAnimationFrame(ae),cancelAnimationFrame(_e),cancelAnimationFrame(Et),ot==null||ot.disconnect(),G==null||G(),wt.disconnect(),(Rt=window.visualViewport)==null||Rt.removeEventListener("resize",ge),(Tt=window.visualViewport)==null||Tt.removeEventListener("scroll",ge)}},[t,p,g,r,O,Y,z,i,l,u,H]),s.useEffect(()=>{if(!g||!r||!Xte(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 Q=(r.getAttribute("aria-describedby")??"").split(/\s+/).filter(me=>me&&me!==y);Q.length?r.setAttribute("aria-describedby",Q.join(" ")):r.removeAttribute("aria-describedby")}},[g,r,y]);const{onEscape:q}=e;return s.useEffect(()=>{if(!p)return;const Z=ee=>!!ee&&a.some(J=>J.contains(ee)),Q=ee=>{var Se;const J=b.current,ae=ee.target instanceof Node?ee.target:null,Me=Z(ae),ue=document.activeElement;if(ee.key==="Escape"){if(ee.defaultPrevented||ue!=null&&ue.closest('[role="dialog"]:not(.sc-coach):not(.sc-attachpanel)')||Me&&(ue!=null&&ue.closest('input, textarea, select, [contenteditable="true"], [role="menu"], [role="listbox"]')))return;ee.preventDefault(),ee.stopPropagation(),q(t);return}Me||(!ae||ae===document.body||ae===document.documentElement||J!=null&&J.contains(ae)||(Se=E.current)!=null&&Se.contains(ae))&&ee.stopPropagation()};let me=0,te=!1;const he=ee=>{te=ee.target instanceof Node&&Z(ee.target)},re=ee=>{ee.relatedTarget||te||!b.current||(cancelAnimationFrame(me),me=requestAnimationFrame(()=>{var ae;if(!document.hasFocus())return;const J=document.activeElement;(!J||J===document.body||J.closest("[inert]"))&&((ae=b.current)==null||ae.focus({preventScroll:!0}))}))};return window.addEventListener("keydown",Q,!0),window.addEventListener("pointerdown",he,!0),document.addEventListener("focusout",re,!0),()=>{cancelAnimationFrame(me),window.removeEventListener("keydown",Q,!0),window.removeEventListener("pointerdown",he,!0),document.removeEventListener("focusout",re,!0)}},[t,p,O,q]),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":R,"aria-hidden":"true",children:Zk.map(Z=>o.jsx("div",{className:"sc-coach-panel"},Z))}),o.jsx("div",{ref:E,className:"sc-coach-catch","data-guide":"catch","data-state":R,"aria-hidden":"true",onMouseDown:Z=>Z.preventDefault(),children:Zk.map(Z=>o.jsx("div",{className:"sc-coach-catch-part"},Z))}),o.jsx("div",{ref:A,className:"sc-coach-rim","data-state":R,"aria-hidden":"true"}),o.jsx("div",{ref:C,className:"sc-coach-ring","data-state":R,"aria-hidden":"true",hidden:!0})]}),g&&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":_.title?w:void 0}:{role:"note"},"aria-describedby":y,tabIndex:-1,"data-state":R,children:[o.jsx("div",{ref:k,className:"sc-coach-arrow","aria-hidden":"true",hidden:!0}),o.jsxs("div",{className:"sc-coach-head",children:[_.title?o.jsx("h2",{id:w,className:"sc-coach-title",children:_.title}):o.jsx("p",{id:y,className:"sc-coach-body","data-lead":"",children:_.body}),_.count&&o.jsxs("p",{className:"sc-coach-count",children:[o.jsx("span",{className:"sc-vh",children:"Step "}),_.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(Cn,{size:16})})})]}),_.title&&_.body&&o.jsx("p",{id:y,className:"sc-coach-body",children:_.body}),(_.canBack||_.action)&&o.jsxs("div",{className:"sc-coach-foot",children:[_.canBack&&o.jsx("button",{ref:L,type:"button",className:"sc-coach-back",onClick:()=>{M.current="back",e.onBack(t)},children:"Back"}),_.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:_.action.label})]})]})]}),l)}function Ok(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}pc(e)}function Ik(){return[...document.querySelectorAll($te)].filter(e=>e.getClientRects().length>0)}function B8(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 Bte(e,t){const n=[];for(const r of document.querySelectorAll(_te))t.contains(r)&&(r.contains(e)||e.contains(r)||r.getClientRects().length===0||n.push(ap(r.getBoundingClientRect())));return n}function Ute(e,t){return Math.max(0,...e.filter(n=>n.top<=0&&n.bottom<t/3).map(n=>n.bottom))}function Wte(e,t){return Math.max(0,...e.filter(n=>n.bottom>=t&&n.top>t*2/3).map(n=>t-n.top))}function Kte(e,t){const n={x:e.left,y:e.top,left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:fi(e),height:No(e)};return{getBoundingClientRect:()=>n,contextElement:t}}function Gte(e,t,n,r,a){const i=window.innerWidth,l=window.innerHeight,u=r.reduce((h,p)=>h?YR(h,p):p,null),f=u?Rte(u,i,l):[];if(a){const h=Nte(r,i,l),p=e.style;p.maskImage=h,p.webkitMaskImage=h,n.style.backgroundImage=Mte(r,i,l,Lte)}else Vk(e,f);Vk(t,f)}function op(e){return Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||0}function Fk(e){return e.closest(F4)??e.querySelector(F4)??e}function _k(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,op(a)),n=Math.max(n,a.getBoundingClientRect().height));return{radius:t,height:n,count:r}}function Vk(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:`${fi(a)}px`,height:`${No(a)}px`})})}const Zk=[0,1,2,3];function Yte(){return typeof CSS>"u"?!1:CSS.supports("mask-image",'url("x.svg")')||CSS.supports("-webkit-mask-image",'url("x.svg")')}function Dh(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 U8(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,Hte)})}function qte(e){return e>0?new Promise(t=>window.setTimeout(t,e)):Promise.resolve()}function Xte(e){return e.matches('button, a[href], input, select, textarea, [tabindex], [contenteditable="true"]')}const Qte=10;function Jte(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 ene(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 tne(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 i1=320,oy=180,nne=28,rne=700;function a2(e){const t=e.split(/(\s+)/).filter(a=>a.length>0),n=t.filter(a=>!/^\s+$/.test(a)).length,r=Math.min(nne,Math.floor(rne/Math.max(1,n)));return{words:t,step:r,total:i1+oy+r*n+160}}function W8(e,t){return e.every(n=>!!t[n.id])}function sne(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 ane(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const one=/^(hi|hello|hey|heya|hiya|yo|hola|shalom|sup|good (morning|afternoon|evening)|thanks|thank you|thx|cheers)\b/i,ine=/^(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,lne=/^(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,cne=/^(start over|start again|restart|reset|cancel|stop|quit|exit|go back|back|undo|never ?mind|forget it|close)\b/i,une=/^(skip|next|continue|go|go on|proceed|generate|draw|render|build|show me|show|try|do it|let'?s go|begin|start)\b/i,zk=/^(help|help me|how does this work|what do i do|what should i (write|say|type)|instructions|\?+)[\s!.,?]*$/i,dne=/\b(presenters?|avatars?|characters?|Scenri|create|creating|generate|generating|images?|pictures?|shoot|campaign|brand|product)\b/i,fne=/^(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,hne=/^[b-df-hj-np-tv-xz]{3,}$/i,pne=/(.)\1{3,}/,mne=/\b(like|as|resembling|resembles|similar to|looks? like|looking like)\s+([A-Z][a-z]+)(?:\s+[A-Z][a-z]+)*\b/,gne=/^(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 ri(e,t){const n=e.trim();if(!n)return null;const r=mne.exec(n);if(r&&!gne.test(r[2]))return"likeness";if(t(n))return null;if(!new RegExp("\\p{L}","u").test(n))return zk.test(n)?"help":"nonsense";const a=n.split(/\s+/).filter(Boolean),i=a.length;if(zk.test(n))return"help";if(one.test(n)&&i<=4)return"greeting";if(ine.test(n))return"ack";const l=u=>u.replace(/[^a-z]/gi,"");return i<=8&&a.some(u=>fne.test(l(u))||hne.test(l(u))||pne.test(l(u)||u))?"nonsense":lne.test(n)||/\?\s*$/.test(n)?"question":cne.test(n)&&i<=4?"nav":dne.test(n)&&i<=10?"intent":une.test(n)&&i<=4?"go":i===1&&/^[A-Z][a-z]+$/.test(n)?null:i<=2?"vague":null}const vne=e=>`aside-said-${e}`,Bk=e=>e.startsWith("aside-said-")?e.slice(11):null,xi=(e,t=!1,n=!1)=>[...n?[]:[{kind:"you",id:vne(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}],_p=e=>(e.kind==="you"||e.kind==="scenri")&&e.id.startsWith("aside-");function XR(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question.id;if(!_p(n))return null}return null}const Vp=()=>new Date().toISOString();function wne({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 yne({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 m=p.firstElementChild,g=Number.parseFloat(getComputedStyle(p).columnGap)||0,w=m?m.offsetWidth+g: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(Uk,{dir:-1,live:r.back,onGo:l}),o.jsx("div",{className:"sc-convo-plates",ref:n,children:t}),f&&o.jsx(Uk,{dir:1,live:r.on,onGo:l})]})}function Uk({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(Ra,{size:14,weight:"bold"}):o.jsx(Cl,{size:14,weight:"bold"})})}const bne=106;function Wk({options:e,picked:t,onPick:n}){return o.jsx(yne,{step:bne,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 QR=6e4,xne=60*QR,K8=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),kne=e=>e.toLocaleDateString([],{day:"numeric",month:"short"});function Sne(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 Ene(e,t=Date.now()){const n=Math.max(0,t-e);if(n<45e3)return"just now";if(n<xne)return`${Math.max(1,Math.round(n/QR))} min ago`;const r=new Date(e),a=Sne(r,new Date(t));return a===0?K8(r):a===1?`Yesterday ${K8(r)}`:`${kne(r)} ${K8(r)}`}const Cne=e=>new Date(e).toLocaleString([],{dateStyle:"medium",timeStyle:"short"});function jne({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:m,view:g,current:w,restore:y,onRestore:b,retry:k,onRetry:S,onShow:E}){const[C]=s.useState(l),A=ly(u,C),{playing:L,thinking:T}=rP(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?{...JR(C),"--sc-convo-after":`${a2(e).total}ms`}:void 0,children:[i&&o.jsx(iy,{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(tP,{}),o.jsx(nP,{text:e,playing:L})]}),p&&o.jsxs("span",{className:"sc-convo-shot","data-reveal":L||void 0,"data-current":w||void 0,children:[g&&E?o.jsx("button",{type:"button",className:"sc-convo-shot-pick","aria-label":m?`Show ${m} on the stage`:"Show this on the stage",onClick:()=>E(g),children:o.jsx(Kk,{thumb:p,label:m,current:w})}):o.jsx(Kk,{thumb:p,label:m,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 JR=e=>({"--sc-convo-start":`${e}ms`,"--sc-convo-think":`${i1}ms`});function iy({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(aQ,{className:"sc-convo-mark"}),"Scenri",t?o.jsx(eP,{at:t,now:n}):null]})}function eP({at:e,now:t}){return o.jsx("time",{className:"sc-convo-time",dateTime:new Date(e).toISOString(),title:Cne(e),children:Ene(e,t)})}function Ane({what:e="Thinking"}){return o.jsxs("div",{className:"sc-convo-turn","data-who":"scenri","data-working":"true",children:[o.jsx(iy,{thinking:!0}),o.jsx("p",{className:"sc-convo-say",children:o.jsxs("span",{className:"sc-convo-work",children:[e,o.jsx(Nne,{})]})})]})}function Nne(){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 tP(){return o.jsxs("span",{className:"sc-convo-dots","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]})}function nP({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}=a2(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 rP(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+a2(t).total),p=setTimeout(()=>u(!1),n+i1);return()=>{clearTimeout(h),clearTimeout(p)}},[a,t,n]),{playing:a&&!r,thinking:a&&l&&!r}}function ly(e,t,n=i1+oy){const r=s.useRef(performance.now());if(e)return performance.now()-r.current<t+n?"early":"true"}function Kk({thumb:e,label:t,current:n}){return o.jsx("img",{src:mn(e,"micro"),srcSet:`${mn(e,"micro")} 160w, ${mn(e,"small")} 320w, ${mn(e,"tile")} 640w`,sizes:"(max-width: 767px) 248px, 128px",alt:n&&t?`${t}, active`:t??""})}const Mne=300,Rne=e=>typeof e=="string"?e:null,Pne=e=>Array.isArray(e)?e:[],Lne=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{};function $ne({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:m,onPick:g,onStarter:w,onDescribe:y,onAttachFiles:b,onCancel:k}){var re,ee,J,ae,Me;const[S]=s.useState(a),E=ly(i,S),{playing:C,thinking:A}=rP(t,e.prompt,S,E==="true"),L="given"in e?e.given:void 0,[T,M]=s.useState(()=>Lne(L)),[j,R]=s.useState(null),[P,H]=s.useState(()=>new Set(Pne(L))),D=!!l||!!n,B=s.useRef(!1);s.useEffect(()=>{B.current&&!D&&R(null),B.current=D},[D]),s.useEffect(()=>{e.attempt&&R(null)},[e.attempt]);const V=(ue,Se)=>{j||(R(ue),g==null||g(e.id,{picked:ue,picks:T}),m(Se))},K=j??Rne(L),U=s.useRef(null),I=s.useRef(null),_=s.useRef(()=>{});_.current=()=>{e.kind==="pick"&&e.more&&!e.loading&&m({kind:"pick",action:{type:"more"}})};const O=e.kind==="pick"?e.items.length:0,Y=e.kind==="pick"&&!!e.more;s.useEffect(()=>{const ue=I.current,Se=U.current;if(!ue||!Se||!Y||typeof IntersectionObserver>"u")return;const Be=new IntersectionObserver(vt=>vt.some(Ue=>Ue.isIntersecting)&&_.current(),{root:Se,rootMargin:"0px 0px 240px 0px"});return Be.observe(ue),()=>Be.disconnect()},[O,Y]);const z=O>0;s.useLayoutEffect(()=>{const ue=U.current;if(!ue||!z||typeof ResizeObserver>"u")return;const Se=()=>{const vt=ue.querySelector(".sc-convo-plate");vt&&ue.style.setProperty("--sc-pick-row",`${vt.getBoundingClientRect().height}px`)};Se();const Be=new ResizeObserver(Se);return Be.observe(ue),()=>Be.disconnect()},[z]);const q=e.kind==="pick"?(re=e.search)==null?void 0:re.value:void 0;s.useEffect(()=>{U.current&&(U.current.scrollTop=0)},[q]);const Z=a2(e.prompt),Q=`sc-convo-q-${e.id}`,me=s.useRef(null),te=e.reopened&&k&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost sc-convo-cancel",onClick:k,children:"Cancel"}),he="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 ue;return(ue=me.current)==null?void 0:ue.click()},children:[o.jsx(sF,{size:14,weight:"bold"}),e.attach]}),o.jsx("input",{ref:me,type:"file",accept:"image/*",hidden:!0,"aria-label":e.attach,onChange:ue=>{const Se=Array.from(ue.target.files??[]).filter(Be=>Be.type.startsWith("image/"));ue.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?{...JR(S),"--sc-convo-after":`${Z.total}ms`}:void 0,children:[!e.reopened&&r&&o.jsx(iy,{thinking:A,at:h,now:p}),!e.reopened&&o.jsxs("p",{className:"sc-convo-say",id:Q,"data-tone":e.tone,"data-reveal":C||void 0,children:[A&&o.jsx(tP,{}),o.jsx(nP,{text:e.prompt,playing:C})]}),e.reopened&&o.jsx("span",{id:Q,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":Q,hidden:e.kind==="text"&&!((ee=e.starters)!=null&&ee.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(ue=>o.jsx(fr,{label:ue.text,children:o.jsx("button",{type:"button",className:"sc-convo-starter",onClick:()=>w==null?void 0:w(ue.text),children:ue.label})},ue.text))}),e.kind==="choice"&&((J=e.options)==null?void 0:J.some(ue=>ue.card))&&o.jsx(Wk,{options:e.options,picked:K,onPick:ue=>V(ue,{kind:"choice",id:ue})}),e.kind==="choice"&&e.options&&!e.groups&&!e.options.some(ue=>ue.card)&&o.jsx("div",{className:"sc-convo-choices sc-convo-ask","data-guide-shape":"",children:e.options.map(ue=>o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice","aria-pressed":e.multi?P.has(ue.id):void 0,"data-on":(e.multi?P.has(ue.id):K===ue.id)||void 0,onClick:()=>e.multi?H(Se=>{const Be=new Set(Se);return Be.delete(ue.id)||Be.add(ue.id),Be}):V(ue.id,{kind:"choice",id:ue.id}),children:ue.label},ue.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}),he,!e.multi&&te]}),e.kind==="choice"&&!e.groups&&!e.multi&&!e.describe&&!e.attach&&te&&o.jsx("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:te}),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([...P].map(ue=>[ue,"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}),te]}),e.kind==="choice"&&e.groups&&o.jsxs("div",{className:"sc-convo-groups",children:[e.groups.map(ue=>o.jsxs("div",{className:"sc-convo-group",children:[o.jsx("span",{className:"sc-convo-group-lb",id:`sc-convo-g-${e.id}-${ue.id}`,children:ue.label}),o.jsx(ti,{label:ue.label,value:T[ue.id]??"",ids:ue.options.map(Se=>Se.id),onChange:Se=>M(Be=>({...Be,[ue.id]:Se})),className:"sc-convo-choices",children:ue.options.map(Se=>o.jsx(ni,{id:Se.id,on:T[ue.id]===Se.id,label:Se.label,className:"sc-chip sc-convo-choice",onPick:()=>M(Be=>({...Be,[ue.id]:Se.id})),children:Se.label},Se.id))})]},ue.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":!W8(e.groups,T)||void 0,title:W8(e.groups,T)?void 0:"Pick one in each row, or skip.","data-on":j==="submit"||void 0,onClick:()=>{W8(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}),te]})]}),e.kind==="swatches"&&o.jsxs("div",{className:"sc-convo-look",children:[e.row.options.some(ue=>ue.card)?e.layout==="grid"?o.jsx(wne,{options:e.row.options,picked:K,onPick:ue=>V(ue,{kind:"swatches",picks:{[e.row.id]:ue}})}):o.jsx(Wk,{options:e.row.options,picked:K,onPick:ue=>V(ue,{kind:"swatches",picks:{[e.row.id]:ue}})}):o.jsx("div",{className:"sc-convo-swatches",children:e.row.options.map(ue=>o.jsx(fr,{label:ue.label,children:o.jsx("button",{type:"button",className:ue.color?"sc-convo-swatch":"sc-chip sc-convo-choice",style:ue.color?{"--sc-swatch":ue.color}:void 0,"aria-label":ue.label,"aria-pressed":K===ue.id,"data-on":K===ue.id||void 0,onClick:()=>V(ue.id,{kind:"swatches",picks:{[e.row.id]:ue.id}}),children:ue.color?null:ue.label})},ue.id))}),(e.skip||e.describe||te)&&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}),te]})]}),e.kind==="photos"&&o.jsxs("div",{className:"sc-convo-photos-q",children:[o.jsx(YM,{hashes:e.hashes,max:e.max,label:((ae=e.drop)==null?void 0:ae.label)??"Add a photo of their face",hint:((Me=e.drop)==null?void 0:Me.hint)??"Drop it here, or choose a file",busy:e.busy,onAdd:ue=>m({kind:"photos",action:{type:"add",files:ue}}),onRemove:ue=>m({kind:"photos",action:{type:"remove",hash:ue}}),onReject:()=>m({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:ue=>m({kind:"photos",action:{type:"attest",checked:ue.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":!!G8(e)||void 0,title:G8(e)??void 0,"data-on":j==="submit"||void 0,onClick:()=>{G8(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}),te]})]}),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:ue=>m({kind:"pick",action:{type:"query",text:ue.target.value}}),onKeyDown:ue=>{var Se;ue.key!=="Escape"||!((Se=e.search)!=null&&Se.value)||(ue.preventDefault(),m({kind:"pick",action:{type:"query",text:""}}))}}),o.jsxs("fieldset",{ref:U,className:"sc-convo-pick-scroll","aria-labelledby":Q,"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},(ue,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(ue=>o.jsx("button",{type:"button",className:"sc-convo-plate","aria-label":ue.alt,"aria-pressed":K===ue.id,"data-on":K===ue.id||void 0,onClick:()=>V(ue.id,{kind:"pick",action:{type:"pick",id:ue.id}}),children:o.jsx("span",{className:"sc-convo-plate-in",style:{backgroundImage:`url("${mn(ue.hash,"small")}")`}})},ue.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:I,className:"sc-convo-pick-end","aria-hidden":!0})]}),o.jsx("p",{className:"sc-vh",role:"status",children:e.loading?"":e.status??""}),(e.back||te)&&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}),te]})]}),e.kind==="confirm"&&e.quote&&o.jsx(Tne,{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((ue,Se)=>o.jsx("button",{type:"button",className:`sc-btn ${Se===0&&!e.quiet?"sc-btn-primary":"sc-btn-ghost"}`,"data-on":j===ue.id||void 0,onClick:()=>V(ue.id,{kind:"confirm",id:ue.id}),children:ue.label},ue.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}),he,te]}),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 Tne({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(pp,{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 G8(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 Dne({text:e,photos:t,at:n,now:r,editable:a,editing:i,arrive:l,leave:u,delay:f=0,turnId:h,dim:p,onEdit:m,onSave:g,onCancel:w}){const[y]=s.useState(!!l),[b]=s.useState(f),k=ly(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(eP,{at:n,now:r}):null,i&&g&&w?o.jsx(Hne,{text:e,onSave:g,onCancel:w}):o.jsxs("div",{className:"sc-convo-bubble",children:[a&&m&&o.jsx(fr,{label:"Change this answer",children:o.jsx("button",{type:"button",className:"sc-convo-edit","aria-label":"Change this answer",onClick:m,children:o.jsx(Cd,{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:mn(S,"micro"),alt:`Yours, ${E+1} of ${t.length}`},S))})]})]})}function Hne({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 One=180,Gk=3e3,sP=460,Ine="cubic-bezier(0.22, 1, 0.36, 1)",Fne=220,_ne=450,Vne=48;function Zne({turns:e,busy:t,working:n,memoryKey:r,resumed:a,onAnswer:i,onEdit:l,onSaveEdit:u,onCancelEdit:f,onStarter:h,onDescribe:p,onAttachFiles:m,onRestore:g,onRetry:w,onShow:y}){var Oe;const b=s.useRef(null),k=s.useRef(!0),S=s.useRef(!!a),E=s.useRef(performance.now());S.current&&performance.now()-E.current>Gk&&(S.current=!1),s.useEffect(()=>{if(!S.current)return;const ie=()=>{S.current=!1},X=window.setTimeout(ie,Gk);return window.addEventListener("pointerdown",ie,{capture:!0}),window.addEventListener("keydown",ie,{capture:!0}),()=>{window.clearTimeout(X),window.removeEventListener("pointerdown",ie,{capture:!0}),window.removeEventListener("keydown",ie,{capture:!0})}},[]);const C=ane(),A=s.useRef(e),L=s.useRef(null),T=s.useRef(null),M=s.useRef(null),j=s.useRef(null),R=s.useRef(null),P=s.useRef([]),[,H]=s.useState(0),D=s.useRef(new Map),B=s.useRef(0),V=performance.now(),K=s.useRef(!1),U=Une(e);if(U!==L.current){L.current=U,K.current=!0;const ie=j.current&&V<j.current.until?j.current:null,X=ie?Yk(A.current,ie):A.current,se=new Set(e.map(cr)),Re=Xk(e),_e=Xk(X),Ye=ge=>ge.startsWith("you:")&&Re.has(Hh(ge))||ge.startsWith("q:")&&_e.has(ge)&&se.has(Hh(ge));if(P.current=X.map(cr).filter(ge=>!se.has(ge)&&!Ye(ge)),Re.size&&!_e.size){const ge=Hh([...Re][0]),Qe=X.find(at=>cr(at)===ge);M.current=(Qe==null?void 0:Qe.kind)==="you"?{key:ge,text:Qe.text}:null}if(_e.size>0&&Re.size===0){const ge=M.current;M.current=null;const Qe=ge?e.find(Et=>cr(Et)===ge.key):void 0,at=!!ge&&((Qe==null?void 0:Qe.kind)!=="you"||Qe.text!==ge.text),wt=e[e.length-1];T.current=at&&(wt==null?void 0:wt.kind)==="question"?cr(wt):null}if(!C&&P.current.length){const ge=P.current.some(wt=>!(ie!=null&&ie.gone.has(wt))),Qe=ie!=null&&ie.look&&P.current.includes(`q:${ie.look.qid}`)?ie.look:null,at=R.current??Qe;j.current={from:X,gone:new Set(P.current),look:at,until:ge?V+(R.current?Mne:One):(ie==null?void 0:ie.until)??V}}else j.current=null;R.current=null,A.current=e}const I=j.current&&V<j.current.until?j.current:null;I||(j.current=null),s.useEffect(()=>{if(!I)return;const ie=window.setTimeout(()=>H(X=>X+1),Math.max(0,I.until-performance.now()));return()=>window.clearTimeout(ie)},[I]);const _=(ie,X)=>{R.current={qid:ie,look:X}},O=I?Yk(e,I):e,Y=s.useRef(null);if(Y.current===null){const ie=r?Yne(r):null;Y.current=ie??new Set(a||e.length>2?e.map(cr):[])}const z=s.useRef(null);z.current===null&&(z.current=(r?Kne(r):null)??new Map);const[q,Z]=s.useState(()=>Date.now()),Q=Math.max(0,...z.current.values()),me=q-Q<36e5;s.useEffect(()=>{if(!me)return;const ie=window.setInterval(()=>Z(Date.now()),3e4);return()=>window.clearInterval(ie)},[me]),T.current&&(Y.current.delete(T.current),T.current=null);const te=new Set;for(const ie of O){const X=cr(ie);ie.kind==="question"&&ie.question.reopened||Y.current.has(X)||te.add(X)}if(a&&S.current&&te.size){for(const ie of te)Y.current.add(ie);te.clear()}const he=[];let re=Number.POSITIVE_INFINITY;{const ie=new Set(O.map(cr));for(const X of[...D.current.keys()])ie.has(X)||D.current.delete(X);for(const X of O){const se=cr(X);if(!te.has(se)){he.push(X);continue}let Re=D.current.get(se);if(Re===void 0){const _e=X.kind==="you"||X.kind==="scenri"&&!!X.quiet;Re=Math.max(V,_e?0:B.current,(I==null?void 0:I.until)??0),D.current.set(se,Re),B.current=Math.max(B.current,Re+(_e?Fne:i1+oy))}Re<=V?he.push(X):re=Math.min(re,Re-V)}}s.useEffect(()=>{if(re===Number.POSITIVE_INFINITY)return;const ie=window.setTimeout(()=>H(X=>X+1),re);return()=>window.clearTimeout(ie)},[re]),s.useEffect(()=>{const ie=Y.current;if(ie){for(const X of P.current)ie.delete(X);for(const X of he){if(X.kind==="question"&&X.question.reopened)continue;const se=cr(X);I!=null&&I.gone.has(se)||ie.add(se)}r&&qne(r,ie),r&&z.current&&Gne(r,z.current)}});const ee=s.useRef(null),J=s.useCallback(()=>{const ie=b.current;if(!ie)return null;const X=ee.current;return X!=null&&X.isConnected&&X.scrollHeight>X.clientHeight?X:(ee.current=_4(ie),ee.current)},[]);s.useEffect(()=>{const ie=()=>{const X=J();X&&(k.current=X.scrollHeight-X.scrollTop-X.clientHeight<24)};return document.addEventListener("scroll",ie,{passive:!0,capture:!0}),()=>document.removeEventListener("scroll",ie,{capture:!0})},[J]);const ae=(()=>{const ie=e.find(se=>se.kind==="question"&&se.question.reopened);if(ie)return cr(ie);const X=e.find(se=>se.kind==="you"&&se.editing);return X?cr(X):null})();s.useLayoutEffect(()=>{var se;if(!k.current||ae)return;const ie=document.activeElement;if(ie instanceof HTMLInputElement&&ie.type==="search"&&((se=b.current)!=null&&se.contains(ie)))return;const X=J();X&&(X.scrollTop=X.scrollHeight)});const Me=s.useRef(ae);Me.current=ae;const ue=e.length;s.useEffect(()=>{const ie=ue>0&&b.current?Wne(b.current):null;if(!ie||typeof ResizeObserver>"u")return;const X=new ResizeObserver(()=>{!k.current||Me.current||(ie.scrollTop=ie.scrollHeight)});return X.observe(ie),()=>X.disconnect()},[ue]);const Se=s.useRef(null);s.useLayoutEffect(()=>{var Ye,ge,Qe,at;if(ae===Se.current)return;const ie=Se.current;Se.current=ae;const X=b.current;if(!X)return;const se=document.activeElement;if(!(!se||se===document.body||X.contains(se)))return;if(ae){if(k.current=!1,ae.startsWith("you:"))return;(ge=(Ye=k0(X,ae))==null?void 0:Ye.querySelector(".sc-convo-q"))==null||ge.focus({preventScroll:!0});return}if(!ie)return;const _e=ie.startsWith("q:")?Hh(ie):ie;(at=(Qe=k0(X,_e))==null?void 0:Qe.querySelector(".sc-convo-edit"))==null||at.focus({preventScroll:!0})}),s.useEffect(()=>{if(!ae)return;const ie=window.setTimeout(()=>{const X=k0(b.current,ae),se=b.current&&_4(b.current);if(!X||!se)return;const Re=X.getBoundingClientRect(),_e=se.getBoundingClientRect();Re.bottom-_e.bottom>Vne&&qk(X,C)},sP);return()=>window.clearTimeout(ie)},[ae,C]);const Be=e.length&&e[e.length-1].kind==="question"?cr(e[e.length-1]):null,vt=s.useRef(Be);s.useLayoutEffect(()=>{var Ye,ge;const ie=b.current;if(ae||!ie||Be===vt.current)return;const X=document.activeElement,se=(Ye=X==null?void 0:X.closest(".sc-convo-turn"))==null?void 0:Ye.getAttribute("data-turn"),Re=!X||X===document.body||X!==ie&&X.contains(ie)||!!se&&se.startsWith("q:")&&se!==Be;if(!Be||!Re){vt.current=Be;return}const _e=(ge=k0(ie,Be))==null?void 0:ge.querySelector(".sc-convo-q:not([hidden])");_e&&(vt.current=Be,_e.focus({preventScroll:!0}))});const Ue=s.useRef(Be),Xe=s.useRef(null);s.useEffect(()=>{if(Be===Ue.current)return;if(!Be){ae&&(Xe.current=Ue.current),Ue.current=null;return}const ie=k0(b.current,Be);if(!ie)return;Ue.current=Be;const X=Xe.current!==null,se=Xe.current===Be;if(Xe.current=null,k.current||X&&se)return;const Re=()=>{Bne(ie,b.current)||qk(ie,C)};if(!X){Re();return}const _e=window.setTimeout(Re,_ne);return()=>window.clearTimeout(_e)},[Be,ae,C]);const De=s.useRef(new Map);s.useLayoutEffect(()=>{const ie=b.current;if(!ie)return;const X=new Map,se=K.current;K.current=!1;for(const Re of ie.querySelectorAll(".sc-convo-turn")){const _e=Re.dataset.turn??"",Ye=Re.offsetTop;X.set(_e,Ye);const ge=De.current.get(_e);!se||C||ge===void 0||Math.abs(ge-Ye)<1||zne(Re,ge-Ye)}De.current=X});const G=new Set;if(ae){G.add(ae);const ie=ae.slice(ae.indexOf(":")+1);G.add(`scenri:asked-${ie}`);const X=he.findIndex(se=>cr(se)===ae);if(X>=0){for(let se=X+1;se<he.length&&_p(he[se]);se++)G.add(cr(he[se]));for(let se=X-1;se>=0&&_p(he[se]);se--)G.add(cr(he[se]))}}for(const ie of he){const X=cr(ie);z.current.has(X)||z.current.set(X,Date.now())}let oe=!1;const We=[];for(const ie of he){const X=cr(ie),se=!!ae&&!G.has(X),Re=z.current.get(X),_e=!!(I!=null&&I.gone.has(X)),Ye=_e&&ie.kind==="question"&&((Oe=I==null?void 0:I.look)==null?void 0:Oe.qid)===ie.question.id,ge=ie.kind==="scenri"&&!!ie.quiet,Qe=!C&&!_e&&te.has(X)&&!ge,at=0,wt=oe;_e||(oe=ie.kind==="scenri"||ie.kind==="question"&&!ie.question.reopened),ie.kind==="you"?We.push(o.jsx(Dne,{text:ie.text,photos:ie.photos,editable:ie.editable,editing:ie.editing,arrive:Qe,leave:_e,delay:at,turnId:X,dim:se,at:Re,now:q,onEdit:ie.editable&&l?()=>l(ie.id):void 0,onSave:u?Et=>u(ie.id,Et):void 0,onCancel:f},X)):ie.kind==="scenri"?We.push(o.jsx(jne,{text:ie.text,tone:ie.tone,reveal:Qe,leave:_e,eyebrow:!wt,delay:at,turnId:X,dim:se,at:Re,now:q,thumb:ie.thumb,label:ie.label,view:ie.view,current:ie.current,restore:ie.restore,onRestore:g,retry:ie.retry,onRetry:w,onShow:y},X)):We.push(o.jsx($ne,{question:ie.question,reveal:Qe,leave:_e&&!Ye,spent:_e,delay:at,turnId:X,dim:se,busy:t||se,eyebrow:!wt,at:Re,now:q,onAnswer:Et=>i(ie.question.id,Et),onPick:_,onStarter:h,onDescribe:p,onAttachFiles:m,onCancel:f},X))}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(Ane,{what:n===!0?void 0:n})]})})}function Yk(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 zne(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:sP,easing:Ine,fill:"both"});r.id="slide",r.onfinish=()=>{e.style.transform="",r.cancel()}}function Bne(e,t){if(!t)return!1;const n=_4(t),r=e.getBoundingClientRect(),a=n.getBoundingClientRect();return r.top>=a.top&&r.top<=a.bottom-24}function qk(e,t){var n;(n=e==null?void 0:e.scrollIntoView)==null||n.call(e,{block:"nearest",behavior:t?"auto":"smooth"})}function k0(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 Une(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 Xk(e){const t=new Set;for(const n of e)n.kind==="question"&&n.question.reopened&&t.add(cr(n));return t}function Hh(e){return e.startsWith("you:")?`q:${e.slice(4)}`:e.startsWith("q:")?`you:${e.slice(2)}`:""}function _4(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 Wne(e){for(let t=e;t;t=t.parentElement){const{overflowY:n}=getComputedStyle(t);if(n==="auto"||n==="scroll")return t}return null}const cy=e=>`scenri:convo-said:${e}`;function cl(e){try{sessionStorage.removeItem(cy(e)),sessionStorage.removeItem(uy(e))}catch{}}const uy=e=>`scenri:convo-at:${e}`;function Kne(e){try{const t=sessionStorage.getItem(uy(e));return t?new Map(Object.entries(JSON.parse(t))):null}catch{return null}}function Gne(e,t){try{sessionStorage.setItem(uy(e),JSON.stringify(Object.fromEntries(t)))}catch{}}function Yne(e){try{const t=sessionStorage.getItem(cy(e));return t?new Set(JSON.parse(t)):null}catch{return null}}function qne(e,t){try{sessionStorage.setItem(cy(e),JSON.stringify([...t]))}catch{}}function Y8(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 we={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? ${Y8(t.length)} with a Scenri demo ${e} in the place: ${q8(t.map(n=>n.toLowerCase()))}.`,staleSet:e=>`${Y8(e)} here show${e===1?"s":""} the place as it was before. Draw ${e===1?"it":"them"} again?`,moreViews:e=>`Add ${Y8(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."},Xne="part of the place itself, never a separate object that competes with the subject, and leaving the subject a clear place to stand",aP={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 dy(e,t){const n=e?aP[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 Qne(e){return Object.keys(aP).flatMap(t=>dy(t,e)??[])}const Jne=["water","stone","colour","citrus","volcanic","dark","plaster","linen"],l1=["world","surface","light","signature"],pa=(e,t)=>`scene-${e}-${t}`,xl={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:pa("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:pa("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:pa("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:pa("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:pa("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:pa("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:pa("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:pa("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:pa("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:pa("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:pa("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:pa("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"]}]}},ere=new Set([...xl.world.options.map(e=>e.card),...xl.light.options.filter(e=>e.card).map(e=>e.card),...Jne.flatMap(e=>["surface","light","signature"].flatMap(t=>(dy(e,t)??[]).map(n=>n.card)))]);function tre(e,t){return e==="world"?xl.world.options:dy(t,e)??xl[e].options}function nre(e,t){const n=tre(e,t),r=n.every(a=>!!a.card&&ere.has(a.card));return{id:e,label:xl[e].prompt,options:n.map(a=>({id:a.id,label:a.label,...r?{card:a.card}:{}}))}}const rre={world:"place",surface:"surface",light:"light",signature:"idea"},Qk=e=>rre[e],Lo=(e,t)=>{if(!t)return;const n=xl[e].options.find(r=>r.id===t);return n||e==="world"?n:Qne(e).find(r=>r.id===t)},sre="one signature idea that makes this place unforgettable, invented for it and never generic";function are(e){const t=` ${e.toLowerCase().replace(/[^a-z0-9]+/g," ")} `,n={};for(const r of l1){let a=null;for(const i of xl[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 xd=4e3,oP=8e3,ore=["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"],V4=["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"],iP=["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"],lP=["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"],cP=["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"],uP=["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"],dP={world:[...ore,...V4],surface:V4,light:lP,signature:iP,stage:cP,camera:uP},ire=e=>` ${e.toLowerCase().replace(/[^a-z0-9é]+/g," ").trim()} `,lre=(e,t)=>e.includes(` ${t.replace(/[^a-z0-9é]+/g," ")} `);function fP(e){const t=ire(e),n=r=>r.some(a=>lre(t,a));return{world:n(dP.world),surface:n(V4),light:n(lP),signature:n(iP),stage:n(cP),camera:n(uP)}}const cre=e=>Object.keys(dP).filter(t=>e[t]);function ure(e){const t=["world","surface","light"].filter(r=>!e[r]),n=cre(e).length>=3?t.filter(r=>r==="world"):t.slice(0,2);return e.signature?n:[...n,"signature"]}const hi="__passed",H0=e=>{var t;return(t=e.source)==null?void 0:t.door},dre=e=>{var t;return H0(e)==="words"?ure(fP(((t=e.source)==null?void 0:t.text)??"")):[]},o2=[{id:"source",applies:()=>!0},{id:"photos",applies:e=>H0(e)==="photos"},{id:"shot",applies:e=>H0(e)==="shot"},{id:"reuse",applies:e=>{var t;return H0(e)==="shot"&&!!((t=e.shot)!=null&&t.scene)}},...l1.map(e=>({id:e,applies:t=>H0(t)==="guided"||dre(t).includes(e)}))],ip=o2.map(e=>e.id),Zp=e=>l1.includes(e),Jk=e=>ip.includes(e),fre=e=>{var t;return!!e&&(!!e.pick||!!((t=e.words)!=null&&t.trim()))};function fy(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":fre(t[e])}const hre=e=>o2.filter(t=>t.applies(e)&&fy(t.id,e)).map(t=>t.id);function hP(e){var t;return((t=o2.find(n=>n.applies(e)&&!fy(n.id,e)))==null?void 0:t.id)??null}const pP=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:l1.some(l=>tl(l,e[l])!==null)},eS=e=>!!e.source&&hP(e)===null&&pP(e),Z4=(e,t)=>JSON.stringify(e)!==JSON.stringify(t);function hy(e,t){const n={...e},r=[];for(const[a,i]of Object.entries(t))Z4(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=>ip.indexOf(i)));for(const i of ip)ip.indexOf(i)<=a||i in t||delete n[i]}for(const a of o2)n[a.id]!==void 0&&!a.applies(n)&&delete n[a.id];return n}function pre(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:hi,...i?{words:i}:{}}}}return null}function tS(e){var t;return(e==null?void 0:e.pick)===hi?[sre,(t=e.words)==null?void 0:t.trim()].filter(Boolean).join(", "):tl("signature",e)}function tl(e,t){var a,i;if(!t)return null;const n=t.pick&&t.pick!==hi?(a=Lo(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 nS=e=>e?`, ${Xne}`:"";function mre(e){var l,u,f,h,p,m,g;if(((l=e.source)==null?void 0:l.door)==="words"){const w=(e.source.text??"").trim(),y=tl("world",e.world),b=tl("light",e.light)??(fP(w).light?null:((f=Lo("world",(u=e.world)==null?void 0:u.pick))==null?void 0:f.light)??null),k=tS(e.signature),S=[y,tl("surface",e.surface),b,k].filter(Boolean);return S.length?`${w.replace(/[.\s]+$/,"")}, ${S.join(", ")}${nS(k)}.`:w}if(((h=e.source)==null?void 0:h.door)!=="guided")return"";const t=tl("world",e.world),n=tl("light",e.light)??((m=Lo("world",(p=e.world)==null?void 0:p.pick))==null?void 0:m.light)??null,r=tS(e.signature),i=`${[t??"a place",tl("surface",e.surface),n,r].filter(Boolean).join(", ").replace(/^./,w=>w.toUpperCase())}${nS(r)}.`;return(g=e.world)!=null&&g.pick?`${i.slice(0,-1)}. ${we.worldIsAStart}`:i}function gre(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 rS=e=>/^image\/hei[cf]/i.test(e.type)||/\.hei[cf]$/i.test(e.name),vre={answers:{},revision:0,editing:null,held:null,asides:[]};function mP(e,t){var n,r;switch(t.type){case"answer":{const a=hy(e.answers,t.patch);return Z4(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 mP(e,{type:"photos",hashes:[...((r=e.answers.photos)==null?void 0:r.hashes)??[],t.hash]});case"edit":return fy(t.id,e.answers)?{...e,editing:t.id,held:e.answers}:e;case"cancel-edit":return!e.held||!Z4(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 wre=e=>({answers:e.held??e.answers,revision:e.revision,asides:e.asides}),yre=/^[a-f0-9]{32}$/,sS=/^[\w.:-]{1,80}$/;function bre(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,xd)}:{}});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"&&sS.test(i.id)&&typeof i.hash=="string"&&yre.test(i.hash)){const u=i.scene,f=u&&typeof u.id=="string"&&sS.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 l1){const f=t.answers[u];if(!f||typeof f!="object")continue;const h=typeof f.pick=="string"&&(f.pick===hi||Lo(u,f.pick))?f.pick:void 0,p=typeof f.words=="string"?f.words.slice(0,xd):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:hy({},n),revision:Number(t.revision)||0,editing:null,held:null,asides:l}}const zp=4,gP=oP,py=60,vP={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 xre(e){return{...vP,place:e.place,pictures:e.pictures.slice(0,zp),heldPictures:e.pictures.slice(zp),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 Tr=e=>e.versions[e.current]??null,aS=e=>e.versions.some(t=>!!t.hash);function kre(e,t){return!t||e.job||e.inputsRev===0||e.readRev!==null&&e.readRev===e.inputsRev||e.readTried===e.inputsRev?null:e.inputsRev}const wP=e=>e.readRev!==null&&e.readRev!==e.inputsRev;function Sre(e,t){var n,r,a;switch(t.type){case"inputs":{const i=t.place.slice(0,gP),l=[...new Set(t.pictures)].slice(0,zp);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,py),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:oS({...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=Tr(e))==null?void 0:n.reading)??null:null),h=l.status==="failed"?l.error??we.failed:null;if(l.status==="cancelled"){if(!f)return{...u,error:i.kind==="make"?we.stoppedRead:we.stopped};if(i.kind==="again"&&!l.hash)return{...u,error:we.stoppedDraw}}const p=l.status==="cancelled"&&i.kind==="change"&&!l.hash;if(!f||i.kind==="again"&&!l.hash)return{...u,error:h};const m=i.kind==="make"?"read":i.kind==="change"?"change":e.versions.some(S=>S.hash)?"again":"draw",g={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=Tr(e))==null?void 0:a.coverage)??[]:[],how:m},w=Tr(e),y=i.kind==="make"&&!l.hash&&w&&!w.hash&&w.how==="read",b=y?e.versions.map((S,E)=>E===e.current?g:S):[...e.versions,g],k={...u,versions:b,current:y?e.current:b.length-1,readRev:i.kind==="make"?i.inputsRev:e.readRev,error:p?we.stoppedChange:h};return oS(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=Tr(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 oS(e,t){return e.named||!(t!=null&&t.name)?e:{...e,name:t.name.slice(0,py)}}function Ere(e){var n;const t=e.job?e.job.phase==="drawing"?e.job.pending:null:((n=Tr(e))==null?void 0:n.reading)??null;return t?!e.job&&wP(e)?{can:!1,why:we.stillReading,words:t}:e.name.trim()?{can:!0,why:null,words:t}:{can:!1,why:we.nameIt,words:t}:{can:!1,why:e.job?we.stillReading:null,words:null}}const X8=e=>e.job?e.job.phase==="changing"?we.changing:e.job.phase==="drawing"?we.drawing:e.pictures.length?we.readingPhotos:we.reading:void 0;function Cre(e){var r;const t=new Map;e.versions.forEach((a,i)=>{a.hash&&t.set(a.hash,i)});const n=((r=Tr(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 yP=e=>(e==null?void 0:e.hero)??(e==null?void 0:e.hash)??null,jre=(e,t)=>e.versions.slice(0,t+1).filter(n=>!!n.hash).length,Are=(e,t)=>e.versions.map(n=>n.hash).lastIndexOf(t);function Nre(e){const t=[{label:we.placeLabel,text:e.prompt}];return e.lighting&&t.push({label:we.lightLabel,text:e.lighting}),e.camera&&t.push({label:we.cameraLabel,text:e.camera}),e.figure&&t.push({label:we.figureLabel,text:e.figureTreatment?`${iS(e.figure)}, ${iS(e.figureTreatment)}.`:e.figure}),t}const iS=e=>e.replace(/[.\s]+$/,""),Mre=/\b(presenters?|models?|influencers?|celebrit(y|ies)|actors?|actress(es)?)\b/i,Rre=/\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,Pre=/\b(add|put|place|include|show|feature|with|holding|wearing|sitting|standing)\b/i,Lre=/\b(no|without|remove|removing|empty|nobody|none|take out|get rid of|less)\b/i,$re=/^\s*(undo|go back|revert|back to|previous|the (first|last|previous|old|earlier) (one|version))\b/i,Tre=/^\s*(hi|hello|hey|thanks|thank you|ok|okay|cool|nice|great|good|wow|yes|no)\b[\s!.]*$/i,Dre=/^(?: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,bP=e=>{var t,n;return((n=(t=Dre.exec(e.trim()))==null?void 0:t[1])==null?void 0:n.trim())||null};function Hre(e){const t=e.trim(),n=bP(t);return n?{kind:"rename",name:n}:$re.test(t)?{kind:"navigate",say:we.usePutBack}:Tre.test(t)||/\?\s*$/.test(t)&&!/\b(make|can you|could you|try)\b/i.test(t)?{kind:"chatter",say:we.sayAChange}:(Mre.test(t)||Rre.test(t))&&Pre.test(t)&&!Lre.test(t)?{kind:"refuse",say:we.notInAScene}:{kind:"change"}}const Ore=(e,t)=>{var n;return!!((n=Tr(e))!=null&&n.ask)&&Tr(e).ask.trim().toLowerCase()===t.trim().toLowerCase()},xP=e=>!e.saved&&(e.versions.length>0||!!e.job||!!e.error),lS=(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 Ire(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 kP=1;function Fre(e){return JSON.stringify({v:kP,...e})}function _re(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||t.v!==kP)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,gP):"",pictures:n(t.pictures).slice(0,zp),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,py):"",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 Vre(e){if(!e||e.loading)return"";const t=e.items.length;return t?we.shotCount(t,e.more):e.error?we.shotsFailed:e.query.trim()?we.shotNotFound(e.query.trim()):we.shotNone}function cS(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 Zre(e){return Nre(e).map(t=>t.label===we.placeLabel?t.text:`${t.label}: ${t.text.replace(/[.\s]+$/,"")}.`).join(" ")}const i2=new Set([we.stopped,we.stoppedRead,we.stoppedDraw,we.stoppedChange,we.lost,we.failed,we.busyElsewhere]),zre=e=>i2.has(e)?e:df(e)??we.failedKept(e.replace(/[.\s]+$/,"")),Bre=new Set([we.stopped,we.stoppedRead,we.stoppedDraw,we.stoppedChange]),Q8=e=>Bre.has(e)?{}:{tone:"alert"},uS=e=>{if(i2.has(e))return e;const t=df(e);return t?we.failedSaid(t):we.failedFirst(e.replace(/[.\s]+$/,""))},SP=e=>e&&!i2.has(e)?io(e).remedy:void 0,z4=e=>{const t=SP(e);return t?[{id:`remedy:${t.opens}`,label:t.label}]:[]};function dS(e){const t=!SP(e)&&!i2.has(e)&&!io(e).retryable;return[...z4(e),...t?[{id:"reword",label:we.sayDifferently}]:[],{id:"retry",label:we.retry}]}function fS(e,t,n,r,a){var y,b,k,S,E,C,A,L,T,M,j,R,P,H;const i=t.answers,l=n?{reopened:!0}:{};if(e==="source")return{id:e,kind:"choice",prompt:we.source,options:[{id:"photos",label:we.addPictures},{id:"guided",label:we.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:we.photos,hashes:((E=i.photos)==null?void 0:E.hashes)??[],max:4,busy:r>0,submit:we.readThem,back:we.guideInstead,drop:we.photosDrop,...l,...a&&a.any!==!1&&!((C=i.photos)!=null&&C.hashes.length)&&r===0&&!n?{instead:we.fromShot,...a.any===null?{insteadWaiting:!0}:{}}:{}};if(e==="shot"){const D=(a==null?void 0:a.query.trim())??"";return{id:e,kind:"pick",prompt:we.shot,items:(a==null?void 0:a.items)??[],given:(A=i.shot)==null?void 0:A.id,search:{label:we.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?we.shotsFailed:D?we.shotNotFound(D):we.shotNone,status:Vre(a),back:n?void 0:we.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:we.madeIn(D),options:[{id:"use",label:we.takeScene(D)},{id:"read",label:we.readNew}],given:i.reuse,...l}}const u=i[e],f=e==="light"?(j=Lo("world",(M=i.world)==null?void 0:M.pick))==null?void 0:j.light:void 0,h=e==="surface"&&!!Lo("world",(R=i.world)==null?void 0:R.pick),p=(u==null?void 0:u.pick)===hi||u==null?void 0:u.pick,m=(u==null?void 0:u.pick)===hi,g=u==null?void 0:u.words,w=((P=i.source)==null?void 0:P.door)==="words";return{id:e,kind:"swatches",prompt:EP(e,i),row:nre(e,(H=i.world)==null?void 0:H.pick),layout:e==="world"?"grid":void 0,hint:e==="world"&&!w?we.worldHint:void 0,skip:f?we.keepWorldLight:h?we.keepWorldSurface:e==="signature"&&!w?we.suggestOne:w?we.leaveToReading:we.skip,describe:we.describeInstead,given:p,skipped:m,note:g,...l}}function EP(e,t){var r,a,i;const n=e==="light"?(a=Lo("world",(r=t.world)==null?void 0:r.pick))==null?void 0:a.light:void 0;if(n)return we.worldLightPrompt(n);if(((i=t.source)==null?void 0:i.door)==="words"){if(e==="world")return we.followWorld;if(e==="light")return we.followLight}return xl[e].prompt}function Ure(e,t){var n,r;return e==="source"?we.source:e==="photos"?we.photos:e==="shot"?we.shot:e==="reuse"?we.madeIn(((r=(n=t.shot)==null?void 0:n.scene)==null?void 0:r.name)??""):EP(e,t)}function hS(e,t){var f,h,p,m,g,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:we.fromShotAnswer}:{text:((p=t.source)==null?void 0:p.door)==="photos"?we.addPictures:we.guideMe};if(e==="shot")return{text:we.shotAnswer,photos:t.shot?[t.shot.hash]:[]};if(e==="reuse")return{text:we.readNew};if(e==="photos"){const C=((m=t.photos)==null?void 0:m.hashes.length)??0;return{text:`${C} ${C===1?"picture":"pictures"}`,photos:(g=t.photos)==null?void 0:g.hashes}}const n=t[e],r=e==="light"&&(n==null?void 0:n.pick)===hi&&((y=Lo("world",(w=t.world)==null?void 0:w.pick))==null?void 0:y.light),a=e==="surface"&&(n==null?void 0:n.pick)===hi&&!!Lo("world",(b=t.world)==null?void 0:b.pick),i=r?we.keepWorldLight:a?we.keepWorldSurface:((k=t.source)==null?void 0:k.door)==="words"?we.leaveToReading:e==="signature"?we.suggestOne:we.skip,l=(n==null?void 0:n.pick)===hi?i:(S=Lo(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 pS=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,Wre=e=>{const t=Tr(e);return t?`${t.hash?"decide":"agree"}-${e.current}`:null};function Kre(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(pS))l.add(A),i.push(...xi(A))};r?i.push({kind:"scenri",id:"edit-open",text:we.editOpen(r.name)}):i.push({kind:"you",id:"intent",text:we.intent});const f=r?null:hP(a);if(!r)for(const C of hre(a)){if(i.push({kind:"scenri",id:`asked-${C}`,text:Ure(C,a),quiet:!0}),u(C),t.editing===C){i.push({kind:"question",question:fS(C,t,!0,e.uploading,e.shots)});continue}const A=hS(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:we.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:we.draw}),C.how==="again"&&i.push({kind:"you",id:`again-${A}`,text:we.tryAgain}),A===h&&!r&&mS(i,e),i.push({kind:"scenri",id:`pic-${A}`,text:C.how==="change"?we.changed:C.how==="again"?we.again:we.here,thumb:yP(C)??C.hash,label:we.version(jre(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?we.draw:we.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&&mS(i,e),n.saved&&Gre(i,e);let m=null;const g=!r&&!p&&!n.versions.length&&e.canRead===!1&&((w=a.source)==null?void 0:w.door)===e.noReader?e.noReader:null;if(g==="photos"&&((y=a.photos)!=null&&y.hashes.length)&&i.push({kind:"you",id:"photos",...hS("photos",a)}),g)m={id:"noreader",kind:"confirm",quiet:!0,prompt:we.noReader,options:[{id:"remedy:setup",label:"Set up"},{id:"unstop",label:g==="photos"?we.changePictures:we.anotherShot}]};else if(f)m=fS(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=Tr(n))==null?void 0:b.reading))==null?void 0:k.name)??n.name;m={id:"name",kind:"text",prompt:we.name,starters:C?[{label:C,text:C}]:void 0}}}else if(n.saved)m=Yre(e);else{const C=Tr(n);if(e.stale&&!r)n.error&&(m={id:"retry",kind:"confirm",...Q8(n.error),prompt:uS(n.error),options:dS(n.error)});else if(!C&&n.error)m={id:"retry",kind:"confirm",...Q8(n.error),prompt:uS(n.error),options:dS(n.error)};else if(C){n.error&&i.push({kind:"scenri",id:`error-${n.versions.length}`,text:zre(n.error),...Q8(n.error)});const A=Zre(C.reading);if(C.hash){const L=!!r&&!r.changed;m={id:`decide-${n.current}`,kind:"confirm",prompt:L?we.decideSaved:(r?we.decideEdit:we.decide)(n.name.trim()||C.reading.name),quote:A,quoteLabel:we.readingHead,...C.how==="draw"||C.how==="again"?{quoteFolded:!0}:{},options:[...z4(n.error),...L?[]:[{id:"use",label:r?we.saveChanges:we.use}],...e.canDraw?[{id:"again",label:we.tryAgain}]:[]],...L?{quiet:!0}:{},describe:we.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:we.anotherShot}]:[],j=C.how==="change"?we.agreeChanged:L?we.agreePhotos:T?we.agreeShot:we.agree;m={id:`agree-${n.current}`,kind:"confirm",prompt:e.canDraw?C.reading.hero==="place"?j:`${j} ${we.drawsTwo}`:we.agreeBlind,quote:A,quoteLabel:we.readingHead,options:[...z4(n.error),...e.canDraw?[{id:"draw",label:we.draw}]:[{id:"use",label:r?we.saveChanges:we.saveWords}],...M]}}}}for(const C of t.asides.filter(A=>!l.has(A)).sort(pS))i.push(...xi(C));return e.note&&i.push({kind:"scenri",id:`note-${e.note.length}-${e.note.slice(0,12)}`,text:e.note}),m&&i.push({kind:"question",question:m}),i}function Gre(e,t){const{studio:n,edit:r,set:a,canDraw:i}=t;if(e.push({kind:"you",id:"use",text:r?we.saveChanges:i?we.use:we.saveWords}),!a)return;const l=CP(t),u=a.tiles.filter(g=>!(g.role==="hero"&&g.hash===l)),f=u.length>0||a.running;e.push({kind:"scenri",id:"saved",text:f?we.inUse(a.who):a.read&&a.noSubject&&i?we.noLibrary:a.read&&i&&a.first.length?we.savedQuiet:we.saved}),(n.setDrawn||n.setDeclined)&&e.push({kind:"you",id:"set-start",text:n.setDrawn?a.stale?we.drawThemAgain:l?we.drawIt:we.drawThem:we.notNow});const h=n.moreAsked?we.addThem:n.moreDeclined?we.notNow:null;let p=!1;const m=()=>{!h||p||(p=!0,e.push({kind:"you",id:"more",text:h}))};for(const g of u)if(g.role!=="hero"&&g.role!=="close"&&m(),g.state==="shown"&&g.hash)e.push({kind:"scenri",id:`ex-${g.role}-${g.hash}`,text:we.exampleHere[g.role],thumb:g.hash,label:Ya[g.role],view:g.role,...a.running||n.job?{}:{retry:g.role}});else if(g.state==="failed"){const w=g.error?df(g.error):null;e.push({kind:"scenri",id:`ex-failed-${g.role}`,text:w?we.exampleFailedSaid(Ya[g.role],w):we.exampleFailed(Ya[g.role],g.error??we.failed),tone:"alert"})}m()}function Yre(e){var u;const{set:t,studio:n}=e,r=n.name.trim()||((u=Tr(n))==null?void 0:u.reading.name)||"The scene";if(!t||t.running||!t.read)return null;const a=CP(e);if(e.canDraw&&t.first.length&&!n.setDrawn&&!n.setDeclined){const f=t.first.map(h=>Ya[h]);return{id:"set-start",kind:"confirm",prompt:t.stale?we.staleSet(t.first.length):a?we.moreViews(f):we.showInUse(t.who,f),options:[{id:"draw-set",label:t.stale?we.drawThemAgain:t.first.length===1?we.drawIt:we.drawThem},{id:"not-now",label:we.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:we.more(t.missing.map(f=>Ya[f])),options:[{id:"more",label:we.addThem},{id:"not-now",label:we.notNow}]};const l=t.tiles.filter(f=>f.state==="failed");return{id:"set-done",kind:"confirm",prompt:l.length?we.readyMissing(r):t.tiles.length?we.ready(r):we.readyUndrawn(r),options:[...l.length&&e.canDraw?[{id:"retry-failed",label:we.tryAgain}]:[],{id:"done",label:t.finish}]}}function CP(e){var n,r;const t=((n=Tr(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 mS(e,t){if(!t.studio.named&&!t.editingName)return;e.push({kind:"scenri",id:"asked-name",text:we.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 qre(e,t){var l,u,f;const{setup:n,studio:r}=e,a=(h,p=!1)=>({target:{kind:"off",why:h},placeholder:"",label:we.lineLabel,action:we.send,working:p,attach:!1});if(r.saved){const h=!!r.job||!!((l=e.set)!=null&&l.running);return a(t&&!h?we.usedOff:"",h)}const i=n.editing;return i==="source"?Yo({kind:"source"},we.sourcePlaceholder,!0):i&&Zp(i)?Yo({kind:"row",id:i},we.rowPlaceholder(Qk(i))):i==="photos"?a(we.photosOff):i==="shot"?a(we.shotOff):i==="reuse"?a(we.reuseOff):!t&&!r.job&&n.answers.source&&!pP(n.answers)?Yo({kind:"source"},we.nothingSaidPlaceholder,!0):t?t.id==="source"?Yo({kind:"source"},we.sourcePlaceholder,!0):t.id==="photos"?{...a(we.photosOff),attach:!0}:t.id==="shot"?a(we.shotOff):t.id==="reuse"?a(we.reuseOff):t.id==="noreader"?a(we.noReaderOff):Zp(t.id)?Yo({kind:"row",id:t.id},we.rowPlaceholder(Qk(t.id))):t.id==="name"?Yo({kind:"name"},we.namePlaceholder):t.id==="retry"?Yo({kind:"source"},we.nothingSaidPlaceholder,!0):t.id.startsWith("agree-")?e.canDraw?Yo({kind:"add"},e.edit?we.addPlaceholder:((u=n.answers.source)==null?void 0:u.door)==="photos"?we.keepPlaceholder:((f=n.answers.source)==null?void 0:f.door)==="shot"?we.keepShotPlaceholder:we.addPlaceholder):a(""):t.id.startsWith("decide-")?{...Yo({kind:"change"},we.changePlaceholder),action:we.change}:a(""):r.job?a("",!0):a("")}function Yo(e,t,n=!1){return{target:e,placeholder:t,label:t,action:we.send,working:!1,attach:n}}const Xre=/\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,jP=e=>Xre.test(e)||e.trim().split(/\s+/).length>=5&&!/\?\s*$/.test(e);function gS(e,t){switch(e){case"greeting":case"ack":return t==="source"?we.greet:we.greetRow;case"question":case"help":return we.askHelp;case"nav":return we.startOverIsUp;case"go":return t==="source"?we.goFirst:we.greetRow;default:return we.notAPlace}}function vS(e,t){if(t==="source"){const r=ri(e,jP);return r==="vague"?null:r}const n=ri(e,()=>!1);return n==="vague"||n==="intent"||n==="likeness"?null:n}const AP=2;function Qre(e,t){return JSON.stringify({v:AP,setup:wre(e),studio:Fre(t)})}function NP(e){if(!e)return null;try{const t=JSON.parse(e);return(t==null?void 0:t.v)!==AP?null:{setup:bre(t.setup),studio:_re(typeof t.studio=="string"?t.studio:null)}}catch{return null}}const my=e=>`scenri:scene-studio:${e}:`;function Jre(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=NP(typeof(n==null?void 0:n.session)=="string"?n.session:null),a=r==null?void 0:r.studio;if(!a||!xP(a))return null;const i=[a.versions[a.current],...[...a.versions].reverse()].find(m=>m==null?void 0:m.hash),l=Tr(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 ese(e,t,n=tse()){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 tse(){var t;const e=[];for(const n of jr.keys("scenri:scene-studio:"))try{(t=JSON.parse(jr.get(n)??"null"))!=null&&t.sceneId&&e.push(n.slice(n.lastIndexOf(":")+1))}catch{}return e}function nse(e){return e.drawing?"Drawing":e.hash?"Drawn, not used yet":e.failed?"Did not finish":"Not drawn yet"}function lp(e){const t=my(e);return jr.keys(t).map(n=>Jre(n.slice(t.length),jr.get(n))).filter(n=>!!n)}function rse(e,t){jr.set(e,JSON.stringify({at:Date.now(),sceneId:t,done:!0}))}function sse(e,t){try{const n=JSON.parse(jr.get(`${my(e)}${t}`)??"null");return(n==null?void 0:n.done)===!0&&typeof n.sceneId=="string"?n.sceneId:null}catch{return null}}function ase(e,t){const n=`${my(e)}${t}`;jr.del(n),cl(n)}function ose(e,t,n,r){const a=Wee(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 MP(){const{brand:e,recent:t,products:n}=cn(),r=Bn(),a=Fl(),i=!!pn(pt.hub),l=!!pn(pt.hubShot),u=!!pn(pt.products),f=!!pn(pt.scenes),h=!!pn(pt.presenters),p=!!pn(pt.presenterStudio),m=!!pn(pt.sceneStudio);return s.useCallback(async g=>{var C,A;const w=t.find(L=>L.kind!=="root"&&L.status==="done"&&L.images.length>0),y=g==="refine"&&!w?"first-shot":g==="reuse"&&n.length===0?"product":g,b=np().active;(b==null?void 0:b.task)===y&&b.brandId===e.id&&!b.paused||await uc({start:{task:y,brandId:e.id}});const k=((A=(C=np().progress)==null?void 0:C[y])==null?void 0:A.reached)??[],S=np().activeDraftId,E=ose(y,{onHub:i,onShot:l,onProducts:u,onScenes:f,onPresenters:h,onStudio:p,onSceneStudio:m},k,S);switch(E.kind!=="head"&&p4(),E.kind){case"stay":try{window.localStorage.removeItem(h4(e.id,y)),(y==="first-shot"||y==="reuse")&&window.localStorage.removeItem(RN(e.id))}catch{}return(y==="first-shot"||y==="reuse")&&i?r(Er(e)):void 0;case"head":return PN(e.id,y);case"hub":return r(Er(e));case"products":return r(Ju(e));case"scenes":return r(fl(e));case"presenters":return r(li(e));case"studio":return r(pl(e,S));case"sceneStudio":{const L=lp(e.id).sort((T,M)=>M.at-T.at)[0];return r(hl(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,m])}const ise=Number(window.localStorage.getItem("scenri:welcome-settle-ms")??900),lse='[role="dialog"]:not(.sc-coach):not(.sc-attachpanel):not(.sc-swap), [role="alertdialog"], .sc-lightbox',cse='[data-guide="compose"] .sc-attachpanel';function use(){var Ie,mt,bt,kt,nt,yt,Ce;const e=Aw(),t=OR(),n=$n(),{brand:r,recent:a,subscribeActivity:i,products:l,importing:u}=cn(),{tasks:f,builds:h}=sa(),{push:p}=rr(),m=MP(),g=Bn(),[w]=El(),y=Ar("new"),b=!!pn(pt.brand),k=!!pn(pt.hub),S=((Ie=pn(pt.hubShot))==null?void 0:Ie.params.shotId)??null,E=!!pn(pt.presenterStudio),C=!!pn(pt.sceneStudio),A=!!pn(pt.products),L=!!pn(pt.scenes),T=!!pn(pt.presenters),M=e.active,j=M&&M.brandId===r.id?M.task:null,R=j&&!(M!=null&&M.paused)?j:null,P=R==="first-shot"||R==="reuse"?"generation":R==="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(!(!P||!M))return i(xe=>B(et=>Hee(et,xe,M.since,P)))},[P,M,i]);const V=!!((mt=t.composer)!=null&&mt.busy),K=s.useRef(!1),[U,I]=s.useState(!1);s.useEffect(()=>{K.current&&!V&&P&&(I(!0),k8().finally(()=>I(!1))),K.current=V},[V,P]);const[,_]=s.useState(0),O=s.useRef(0),Y=s.useCallback(()=>{cancelAnimationFrame(O.current),O.current=requestAnimationFrame(()=>_(xe=>xe+1))},[]);s.useEffect(()=>{if(!R&&!H)return;const xe=new MutationObserver(Y);return xe.observe(document.body,{childList:!0,subtree:H}),window.addEventListener("resize",Y),()=>{cancelAnimationFrame(O.current),xe.disconnect(),window.removeEventListener("resize",Y)}},[R,H,Y]);const[z,q]=s.useState(()=>!document.hidden);s.useEffect(()=>{const xe=()=>q(!document.hidden);return document.addEventListener("visibilitychange",xe),()=>document.removeEventListener("visibilitychange",xe)},[]);const Z=!!R||H,Q=DN.some(xe=>w.has(xe)),me=Z&&(Q||[...document.querySelectorAll(lse)].some(xe=>!xe.closest("[data-radix-popper-content-wrapper], .sc-shotsheet"))),te=w.get("new"),he=R?`scenri:guide-begun:${r.id}:${R}`:null,[re,ee]=s.useState(!1);s.useEffect(()=>{ee(!!he&&window.localStorage.getItem(he)==="1")},[he]);const J=s.useCallback(()=>{if(he)try{window.localStorage.setItem(he,"1")}catch{}ee(!0)},[he]),ae=e.heading,Me=xe=>!!xe&&(ae==null?void 0:ae.brandId)===r.id&&ae.task===xe&&!me,ue=xe=>xe==="first-shot"||xe==="reuse"||xe==="refine"?k:xe==="product"?A:xe==="scene"?L:xe==="presenter"?T||E:!1,[Se,Be]=s.useState(!1);s.useEffect(()=>{let xe=!1;try{xe=!!R&&window.localStorage.getItem(h4(r.id,R))==="1"}catch{}Be(xe)},[R,r.id,ae]),s.useEffect(()=>{if(!(!ae||ae.brandId!==r.id)&&ue(ae.task)){try{window.localStorage.setItem(h4(r.id,ae.task),"1")}catch{}Be(!0),(ae.task==="first-shot"||ae.task==="reuse")&&J(),p4()}},[ae,k,A,L,T,E,r.id,J]);const vt=s.useRef(null);s.useEffect(()=>{const xe=vt.current;!xe||ue(xe)||(vt.current=null,PN(r.id,xe))},[k,A,L,T,E,r.id]),s.useEffect(()=>{e.loaded&&!j&&ae&&p4()},[e.loaded,j,ae]);let Ue=null;if(R==="first-shot"||R==="reuse"){const xe=((bt=t.composer)==null?void 0:bt.brandId)===r.id?t.composer:null,et=k&&Me(R),Ct={here:k&&!me,heading:Me(R)&&!k,composer:xe&&U?{...xe,busy:!0}:xe,nodes:D,begun:re||et||D.length>0};Ue=R==="reuse"?RR(Ct):MR(Ct)}else if(R==="refine"){const xe=((kt=t.composer)==null?void 0:kt.brandId)===r.id?t.composer:null,et=!!S;Ue=Aee({here:et||k&&!me,heading:Me(R)&&!k&&!et,open:et,armed:k&&!!(xe!=null&&xe.refining),nodes:D,asking:et?!!ic(LR):!!ic($p)})}else R==="presenter"?Ue=$R({heading:Me(R)&&!T&&!E,onPage:T&&!E&&!me,studio:E?t.studio:null}):R==="scene"?Ue=Mee({heading:Me(R)&&!L&&!C,onPage:L&&!C&&!me,studio:C?t.studio:null}):R==="product"&&(Ue=Ree({heading:Me(R)&&!A,onPage:A&&!me&&te!=="product",dialogOpen:te==="product"}));const Xe=((nt=t.composer)==null?void 0:nt.brandId)===r.id?t.composer:null,De=R==="first-shot"&&Xe?PR(Xe):R==="reuse"&&Xe?Xe.products===0?"product":Xe.scene?null:"scene":null,G=!!((yt=t.composer)!=null&&yt.pickerOpen);s.useEffect(()=>{G&&(R==="first-shot"&&!De?window.dispatchEvent(new Event("scenri:guide-close-picker")):De&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:hk[De]}})))},[R,G,De]),s.useEffect(()=>{R==="first-shot"&&!De&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:null}}))},[R,De]),s.useEffect(()=>{if(R)return document.documentElement.dataset.guideTask=R,()=>{delete document.documentElement.dataset.guideTask}},[R]);const oe=(Ue==null?void 0:Ue.point)===cse&&window.innerWidth<1024;if(s.useEffect(()=>{if(oe)return document.documentElement.dataset.guidePicker="",()=>{delete document.documentElement.dataset.guidePicker}},[oe]),R&&Ue&&Ue.voice!=="quiet"){const xe=Kee(R,Ue.id);xe&&(Ue={...Ue,...xe})}const We=R&&Ue&&Ue.voice!=="quiet"?Ue.id:null,Oe=s.useRef("");s.useEffect(()=>{var et,Ct;if(!R||!We)return;const xe=`${R}:${We}`;Oe.current!==xe&&(Oe.current=xe,!((Ct=(et=e.progress)==null?void 0:et[R])!=null&&Ct.reached.includes(We))&&uc({reached:{task:R,moment:We}}))},[R,We,e.progress]);const ie=Ue,X=s.useRef(new Set),se=s.useCallback(xe=>{X.current.add(xe),uc({finish:xe})},[]),Re=s.useCallback(xe=>{uc({dismiss:xe}),p({kind:"info",title:"Guide closed",detail:"Continue it any time from Learn."})},[p]);s.useEffect(()=>{R==="first-shot"&&S&&D.some(xe=>xe.id===S&&xe.status==="done"&&xe.images>0)&&se("first-shot")},[R,S,D,se]),s.useEffect(()=>{R==="refine"&&S&&k8()},[R,S]);const _e=s.useRef(!1);s.useEffect(()=>{if(R!=="refine"){_e.current=!1;return}S?_e.current=!0:_e.current&&(_e.current=!1,se("refine"))},[R,S,se]);const Ye=j==="presenter"||j==="scene"||j==="product",ge=h.filter(xe=>!xe.finished).length;s.useEffect(()=>{Ye&&k8()},[Ye,r,l.length,ge,u]),s.useEffect(()=>{Ye&&e.counts&&Lee(e,e.counts)&&se(M==null?void 0:M.task)},[Ye,e,M,se]);const Qe=!!((Ce=t.overlay)!=null&&Ce.engaged);s.useEffect(()=>{if(!e.loaded||!e.eligible)return;const xe={eligible:e.eligible,hidden:e.hidden,done:e.done,dismissed:e.dismissed,active:M},Ct=!!S&&Qe&&a.some(ke=>ke.id===S&&ke.status==="done")&&$h("refine",xe)?"refine":C&&$h("scene",xe)?"scene":te==="product"&&$h("product",xe)?"product":E&&$h("presenter",xe)?"presenter":null;!Ct||X.current.has(Ct)||(X.current.add(Ct),uc({start:{task:Ct,brandId:r.id}}))},[e,M,S,Qe,a,te,E,C,r.id]);const[at,wt]=s.useState(""),Et=s.useRef(ie);Et.current=ie;const ot=s.useCallback((xe,et)=>{if(wt(""),et)return;const Ct=Et.current,ke=Ct?[Ct.title,Ct.body].filter(Boolean).join(". "):"";ke&&requestAnimationFrame(()=>wt(ke))},[]),[It,Mt]=s.useState(!1),Zt=Ar("welcome"),Rt=Zt.value!==null,Tt=b&&n.showcaseLoaded||k,Ee=h.some(xe=>!xe.finished)||f.some(xe=>xe.state==="running"&&xe.kind!=="catalog"),Je=Tee({onMainPage:b||k,eligible:e.eligible,welcome:e.welcome,ready:Tt&&!document.querySelector('[data-variant="skeleton"]'),visible:z,blocked:me,busy:Ee});s.useEffect(()=>{if(!Je)return;const xe=window.setTimeout(()=>Mt(!0),ise);return()=>window.clearTimeout(xe)},[Je]);const St=s.useMemo(()=>Dee(n.showcase).map(xe=>dse(xe.previewUrl)),[n.showcase]),qe=n.engines.some(xe=>xe.available),st=l.length>0,rt=ie&&(ie.voice==="ask"||ie.voice==="note")?ie:null,Xt=rt!=null&&rt.shell?ic(rt.shell):document.body,Gt=rt!=null&&rt.point?ic(rt.point):null,sn=(rt==null?void 0:rt.live)??(rt!=null&&rt.point?[rt.point]:[]),Ut=sn.map(xe=>ic(xe)).filter(xe=>!!xe),An=((rt==null?void 0:rt.also)??[]).map(xe=>ic(xe)).filter(xe=>!!xe),Bt=((rt==null?void 0:rt.lit)??[]).map(xe=>ic(xe)).filter(xe=>!!xe),ne=!!rt&&!!Xt&&(!rt.point||!!Gt)&&Ut.length===sn.length,ce=rt&&!ne?rt:null,de=It||ne;s.useEffect(()=>wk(de),[de]),s.useEffect(()=>()=>wk(!1),[]),s.useEffect(()=>{if(!ce)return;const xe=(ce.shell?document.querySelector(ce.shell):null)??document.querySelector(".sc-feed")??document.body,et=new MutationObserver(Y);return et.observe(xe,{childList:!0,subtree:!0}),()=>et.disconnect()},[ce==null?void 0:ce.id,ce==null?void 0:ce.shell,Y]);const Ve=xe=>{R&&(xe.done?se(R):Re(R))};return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:at}),rt&&ne&&o.jsx(zte,{id:rt.id,voice:rt.voice,target:Gt,live:Ut,also:An,lit:Bt,side:rt.side??"top",beside:rt.beside,soft:rt.soft,container:Xt,title:rt.title,body:rt.body,at:rt.at,of:rt.of,canBack:Pee(R,rt.id,Se||!!(k&&Me(R))),action:rt.start?{label:"Start"}:rt.done?{label:"Done"}:null,closeLabel:rt.done?"Close":"Close guide",onBack:()=>{const xe=R?DR(R,rt.id):null;if(xe){window.dispatchEvent(new CustomEvent("scenri:guide-take-back",{detail:{kind:xe}})),window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:hk[xe]}}));return}if(R==="presenter"&&(rt.id==="start"||rt.id==="face"||rt.id==="save"))return g(li(r),{replace:!0});if((R==="product"||R==="scene")&&rt.id===R)return y.close();if(R==="refine"&&rt.id==="ask"){if(S)return g(Er(r),{replace:!0});window.dispatchEvent(new Event("scenri:guide-clear-refine"));return}if(Se&&R&&(rt.id==="new"||rt.id==="choose"||rt.id==="product"))return window.dispatchEvent(new Event("scenri:guide-close-picker")),vt.current=R,g(Do(r))},onAction:()=>{if(rt.start)return J();rt.done&&R&&se(R)},onClose:()=>Ve(rt),onEscape:()=>Ve(rt),onShown:ot,onLost:Y}),o.jsx(Yee,{open:It||Rt,pictures:St,note:Ku.note({engineReady:qe,ownsProducts:st}),onTake:()=>{const xe=It;Mt(!1),Rt&&Zt.close(),xe?uc({welcome:"taken"}).then(()=>m("first-shot")):window.setTimeout(()=>void m("first-shot"),0)},onDecline:()=>{const xe=It;Mt(!1),Rt&&Zt.close(),xe&&uc({welcome:"declined"})}})]})}function ic(e){for(const t of document.querySelectorAll(e))if(t.getClientRects().length>0)return t;return null}function dse(e){return`${e}${e.includes("?")?"&":"?"}w=320`}const fse="lessons";function hse(){var I;const e=Ar("learn"),t=e.value!==null,n=zee(e.value),r=Mr(aa),a=Aw(),i=OR(),{brand:l,recent:u,products:f}=cn(),h=MP(),[p,m]=s.useState(null);s.useEffect(()=>{t||!p||(m(null),h(p))},[t,p,h]);const g=s.useRef(!1),w=_=>{g.current=!0,m(_),e.close()},y=s.useRef(null);s.useEffect(()=>{t&&(y.current=m4.current,m4.current=null)},[t]);const b=()=>{const _=g.current;if(g.current=!1,_)return;const O=y.current==="help";requestAnimationFrame(()=>{var q;if(document.activeElement!==document.body)return;const Y=O?".sc-help-btn":".sc-learn-btn",z=O?".sc-learn-btn":".sc-help-btn";(q=document.querySelector(Y)??document.querySelector(z))==null||q.focus()})},k=!!pn(pt.hub),S=!!pn(pt.presenterStudio),E=!!pn(pt.presenters),C=_=>{var O;return((O=a.heading)==null?void 0:O.brandId)===l.id&&a.heading.task===_},A=((I=a.active)==null?void 0:I.brandId)===l.id&&!a.active.paused?a.active.task:null,L=u.some(_=>_.kind!=="root"&&_.status==="done"&&_.images.length>0),T=_=>_.needs==="shot"&&!L||_.needs==="product"&&f.length===0?_.needs??null:null,M=_=>{var Z,Q,me,te,he,re;const O=((Q=(Z=a.progress)==null?void 0:Z[_.id])==null?void 0:Q.reached)??[];if(A!==_.id)return yk(_.id,O,null);const Y=((me=i.composer)==null?void 0:me.brandId)===l.id?i.composer:null,z={here:k,heading:C(_.id),composer:k?Y:null,nodes:a.activeNodes,begun:!0},q=_.id==="first-shot"?((te=MR(z))==null?void 0:te.id)??null:_.id==="reuse"?((he=RR(z))==null?void 0:he.id)??null:_.id==="presenter"?((re=$R({heading:C("presenter"),onPage:E&&!S,studio:S?i.studio:null}))==null?void 0:re.id)??null:null;return yk(_.id,O,{moment:q,nodes:a.activeNodes,draft:!!a.activeDraftId})},j=_=>Bee(_.id,a,l.id,M(_)),R=Uee(sl,j),P=n??R??sl[0],H=sl.filter(_=>j(_)==="done").length;s.useEffect(()=>{if(t)for(const _ of Object.values(H4))new Image().src=_.wide},[t]);const D=s.useRef(null),B=s.useRef(new Map),V=s.useRef(null),K=s.useRef(!1);s.useEffect(()=>{var Y;const _=t&&!K.current;if(K.current=t,!t)return;const O=()=>{var z,q;(z=D.current)==null||z.focus({preventScroll:!0}),(q=D.current)==null||q.scrollIntoView({block:"nearest"})};r&&n?(V.current=n.id,O()):r&&V.current?(Y=B.current.get(V.current))==null||Y.focus({preventScroll:!0}):_&&O()},[t,r,n]);const U=(_,O)=>o.jsx(pse,{lesson:_,state:j(_),at:M(_),blocked:T(_),describe:O,actionRef:D,onBegin:()=>w(_.id)});return o.jsx(Us,{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(fse),"aria-label":"All lessons",children:o.jsx(Ra,{size:15})}),o.jsx(Ns,{className:"sc-newdlg-title",children:n.title}),o.jsx(wS,{})]}),o.jsx("div",{className:"sc-newdlg-body sc-learn-body",children:U(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 ",sl.length," done"]}),o.jsx(wS,{})]}),o.jsx(Tc,{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:sl.map(_=>o.jsx("li",{children:o.jsxs("button",{type:"button",className:"sc-learn-row","data-state":j(_),"aria-current":!r&&P.id===_.id?"true":void 0,ref:O=>{O?B.current.set(_.id,O):B.current.delete(_.id)},onClick:()=>e.set(_.id),children:[o.jsx("span",{className:"sc-learn-thumb",children:o.jsx("img",{src:H4[_.id].square,alt:"",decoding:"async"})}),o.jsxs("span",{className:"sc-learn-say",children:[o.jsx("span",{className:"sc-learn-name",children:_.title}),o.jsx(RP,{lesson:_,state:j(_),at:M(_),blocked:T(_)})]}),(R==null?void 0:R.id)===_.id&&o.jsx("span",{className:"sc-learn-next",children:"Next"})]})},_.id))}),!r&&U(P,!1)]})]},"all")})}function pse({lesson:e,state:t,at:n,blocked:r,describe:a,actionRef:i,onBegin:l}){const u=r?D4[r].action:t==="active"?"Continue":t==="done"?"Start again":"Start",f=t==="active"?n:0,h=m=>t==="done"?"done":t==="active"?m<n?"done":m===n?"active":"todo":m===0?"active":"todo",p=a?o.jsx(Tc,{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:H4[e.id].wide,alt:"",decoding:"async"})}),o.jsxs("div",{className:"sc-learn-copy",children:[o.jsx("div",{className:"sc-learn-kicker",children:o.jsx(RP,{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:IR(e).map((m,g)=>{const w=h(g),y=o.jsx("span",{className:"sc-learn-n","aria-hidden":"true",children:w==="done"?o.jsx(Kn,{size:14,weight:"bold"}):g+1}),b=t==="active"&&g===n?"step":void 0,k=o.jsx("span",{className:"sc-learn-step-name",children:m});return o.jsx("li",{children:g===f?o.jsxs("button",{ref:i,type:"button",className:"sc-learn-step","data-state":w,"data-here":"","aria-current":b,"aria-label":`${u}: ${m}`,onClick:l,children:[y,k,o.jsxs("span",{className:"sc-learn-go","aria-hidden":"true",children:[u," ",o.jsx(wa,{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"})]})},m)})}),r&&o.jsx("p",{className:"sc-learn-note",children:D4[r].note})]})]})]})}function RP({lesson:e,state:t,at:n,blocked:r}){const a=IR(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:D4[r].status}):o.jsxs("span",{className:"sc-learn-status",children:[a," step",a===1?"":"s"]})}function wS(){return o.jsx(Ms,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})}const PP=s.createContext(null),mse={products:[],productsLoaded:!1,importing:!1,refreshProducts:async()=>{}};function cn(){const e=s.useContext(PP),t=nR()??mse;if(!e)throw new Error("useBrand must be used inside BrandLayout");return s.useMemo(()=>({...e,...t}),[e,t])}const LP=s.createContext(null);function gse(){const e=s.useContext(LP);if(!e)throw new Error("useAssetsPanel must be used inside BrandLayout");return e}function vse(){const{brandSlug:e}=na(),{pathname:t,search:n}=Un(),r=pn({path:pt.brand,end:!1}),{brands:a,engines:i,refresh:l}=$n(),[u,f]=s.useState(null),[h,p]=s.useState(null),[m,g]=s.useState([]),[w,y]=s.useState([]),[b,k]=s.useState({}),[S,E]=s.useState(!1),[C,A]=s.useState(0),L=s.useCallback(()=>A(re=>re+1),[]),T=Bn(),[M,j]=ja(qr.assetsOpen,window.innerWidth>=1280),R=s.useCallback(()=>j(re=>!re),[]),P=s.useMemo(()=>({open:M,toggle:R,setOpen:j}),[M,R]);lQ();const H=s.useRef(null),D=a.find(re=>re.slug===e)??a.find(re=>re.id===e)??a.find(re=>re.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 re=D.id,ee=await Ae.workspace(re);B.current===re&&(f(ee.project),p(ee.root),g(ee.recent),y(ee.sets),k(ee.membership),E(!0))},[D==null?void 0:D.id]),K=s.useRef(new Set),U=s.useCallback(re=>(K.current.add(re),()=>{K.current.delete(re)}),[]),I=s.useCallback(re=>{if(re.length){g(ee=>xee(ee,re));for(const ee of K.current)ee(re)}},[]),_=s.useCallback((re,ee)=>{!D||re!==D.id||I(ee)},[D==null?void 0:D.id,I]),O=s.useCallback(re=>y(ee=>ee.map(J=>J.id===re.id?re:J)),[]),Y=s.useCallback(re=>y(ee=>ee.filter(J=>J.id!==re)),[]),z=s.useCallback(re=>y(ee=>ee.some(J=>J.id===re.id)?ee:[re,...ee]),[]),q=s.useCallback((re,ee)=>k(J=>({...J,[re]:ee})),[]),Z=s.useMemo(()=>D?{brand:D,workspace:(u==null?void 0:u.brandId)===D.id?u:null,root:h,recent:m,sets:w,membership:b,loaded:S,refresh:V,applySet:O,dropSet:Y,insertSet:z,applyMembership:q,applyNodes:I,subscribeActivity:U,shotsEpoch:C,resetShots:L}:null,[D,u,h,m,w,b,S,V,O,Y,z,q,I,U,C,L]);s.useEffect(()=>{E(!1),g([]),p(null)},[D==null?void 0:D.id]),s.useEffect(()=>{D&&gG(D.id)},[D==null?void 0:D.id]),s.useEffect(()=>{V()},[V]);const Q=s.useCallback(()=>{l(),V()},[l,V]),me=r?t.slice(r.pathnameBase.length):"",te=!!D&&e!==D.slug,he=D?Do(D)+me+n:"";if(s.useEffect(()=>{te&&T(he,{replace:!0})},[te,he,T]),!D){const re=CR(a),ee=!!H.current&&!a.some(Me=>Me.id===H.current),J=new URLSearchParams(n);ee&&(J.delete("settings"),J.delete("new"));const ae=J.toString();return o.jsx(Xa,{to:re?Do(re)+me+(ae?`?${ae}`:""):pt.root,replace:!0})}return o.jsxs(PP.Provider,{value:Z,children:[o.jsx(IJ,{engines:i,brandId:D.id,onSaved:Q}),o.jsx(hee,{engines:i,onSaved:l}),o.jsx(iee,{}),o.jsx(Sq,{brand:D,onActivity:_,children:o.jsxs(cQ,{brand:D,children:[o.jsx(xse,{}),o.jsx(qX,{children:o.jsxs(LP.Provider,{value:P,children:[o.jsxs("div",{className:"sc-shell",children:[o.jsx(oQ,{}),o.jsx(_c,{}),o.jsx(Iq,{})]}),o.jsx(use,{}),o.jsx(hse,{}),o.jsx(Fee,{})]})})]})})]})}const wse=Number(window.localStorage.getItem("scenri:whatsnew-settle-ms")??2500)||2500,$P=s.createContext(null);function Qc(){const e=s.useContext($P);if(!e)throw new Error("useWhatsNew must be used inside WhatsNewProvider");return e}function yse({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState("loading"),[i,l]=s.useState(!1),[u,f]=s.useState([]),h=Ar("whatsnew");s.useEffect(()=>{let M=!0;return Ae.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)??yS,m=p[0]??null,g=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=(g==null?void 0:g.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}),Ae.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(R=>R!==M)),Ae.releaseUsed(M).catch(()=>{}))},[u]),T=s.useMemo(()=>({status:r,recent:p,history:(t==null?void 0:t.history)??yS,featured:m,running:t&&t.version!=="0.0.0"?t.version:null,unseen:(t==null?void 0:t.unseen)??bse,lead:g,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,m,g,E,C,i,b,S,A,L]);return o.jsx($P.Provider,{value:T,children:e})}const yS=[],bse=[];function xse(){var S;const e=Qc(),{running:t,builds:n}=sa(),{loaded:r}=cn(),[a]=El(),i=!!pn(pt.whatsNew),[l,u]=s.useState(()=>!document.hidden),f=s.useRef(!1),h=Aw(),p=Zee(),m=h.eligible&&h.welcome===null,g=m||p||((S=h.active)==null?void 0:S.task)==="first-shot"&&!h.active.paused,w=!h.loaded||g;g&&(f.current=!0);const y=s.useRef(!1),{markSeen:b}=e;s.useEffect(()=>{m?y.current=!0:y.current&&(y.current=!1,b())},[m,b]),s.useEffect(()=>{const E=()=>u(!document.hidden);return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},[]);const k=DN.some(E=>a.has(E));return s.useEffect(()=>{if(!ZJ({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()},wse);return()=>window.clearTimeout(C)},[e,r,l,k,t,n,w,i]),null}const kse=5e3,TP=s.createContext(null);function $n(){const e=s.useContext(TP);if(!e)throw new Error("useAppData must be used inside AppShell");return e}function Sse(){const e=JG(),[t,n]=s.useState(null),[r,a]=s.useState([]),[i,l]=s.useState(null),u=tY(),f=rY(),h=aY(),p=iY(),[m,g]=s.useState(null),w=s.useCallback(D=>{D&&g(B=>B&&B.arriving===D.arriving&&B.installs===D.installs?B:D)},[]),y=s.useRef(null),{refetch:b}=u,{refetch:k}=f,{refetch:S}=h,{refetch:E}=p;s.useEffect(()=>{if(!m)return;const D=y.current;if(y.current=m.installs,!(m.installs===0||D===m.installs))for(const B of[b,k,S,E])B({quiet:!0})},[m,b,k,S,E]);const C=s.useRef(0),A=s.useRef(new Map),L=s.useRef(0),T=s.useRef(!1),M=s.useCallback(D=>{A.current.set(D.id,++C.current),n(B=>B&&kY(B,D))},[]),j=s.useCallback(async()=>{const D=++C.current;L.current=D;const B=await Ae.brands();if(L.current!==D)return;const V=new Set;for(const[K,U]of A.current)U>D&&V.add(K);n(K=>SY(K,B,V))},[]),R=s.useCallback(()=>j().catch(()=>{}),[j]),P=s.useCallback(async()=>{try{await Promise.all([j(),Ae.engines().then(a)]),T.current=!0}catch(D){T.current||l(String(D.message??D))}},[j]);s.useEffect(()=>{P(),BG()},[P]),s.useEffect(()=>{let D=0;const B=()=>{document.hidden||Date.now()-D<kse||(D=Date.now(),R())};return document.addEventListener("visibilitychange",B),window.addEventListener("focus",B),()=>{document.removeEventListener("visibilitychange",B),window.removeEventListener("focus",B)}},[R]);const H=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:P,refreshBrands:R,applyBrand:M,contentArriving:!!(m!=null&&m.arriving),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,P,R,M,m==null?void 0:m.arriving,w]);return i?o.jsx(_s,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(Mw,{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(_s,{align:"center",justify:"center",height:"100vh",children:o.jsx(Lr,{size:"3"})}):o.jsx(TP.Provider,{value:H,children:o.jsx(LN.Provider,{value:e,children:o.jsx(vY,{children:o.jsxs(yse,{children:[o.jsx(P7,{}),o.jsx(_c,{})]})})})})}function Ar(e){const[t,n]=El(),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 Oh(e,t=""){const[n,r]=El(),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 bS(e,t){const n=xS(t.name),r=kS(t.url);return!n&&!r?null:e.find(a=>{var i,l,u,f;return!!(r&&kS((l=(i=a.json)==null?void 0:i.meta)==null?void 0:l.website)===r||n&&xS(((f=(u=a.json)==null?void 0:u.meta)==null?void 0:f.name)??a.slug)===n)})??null}const xS=e=>String(e??"").trim().replace(/\s+/g," ").toLowerCase()||null,kS=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 Ese(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 Cse(e){return e.logo.status!=="primary"||e.colors.count===0||e.name.source==="hostname"}const S0=(e,t=!1)=>({key:"products",found:t,label:"Products",value:e});function jse(e){switch(e.kind){case"idle":return null;case"scanning":return S0("looking for a shop");case"timeout":return S0("this site took too long to search");case"error":return S0("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 S0(`${n?"about ":""}${t.count.toLocaleString()} found`,!0)}return S0("we could not load the catalogue")}}}function Ase(e){return e.kind==="timeout"||e.kind==="error"?!0:e.kind==="result"&&(e.scan.verdict==="blocked"||e.scan.verdict==="likely")}function Nse(e){var t;return!e||e.verdict!=="found"?!1:e.candidates.length>0||(((t=e.cards)==null?void 0:t.length)??0)>0}function Mse(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 Rse(){var re,ee,J,ae,Me,ue;const{brands:e,refresh:t}=$n(),n=Bn(),r=e.length>0,[a,i]=s.useState(""),[l,u]=s.useState(""),[f,h]=s.useState(!1),[p,m]=s.useState(!1),[g,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,R]=s.useState(null),[P,H]=s.useState(null),D=s.useRef(!1),B=s.useRef(null),V=async(Se,Be)=>{D.current=!0,B.current=null,b(Se),await t(),n(`${Do(Se)}${Be?`?settings=${Be}`:""}`,{replace:!0})},K=s.useRef(!1);s.useEffect(()=>{K.current=!1;const Se=()=>{const Be=B.current;!Be||D.current||(B.current=null,fetch(`/api/brands/${Be}`,{method:"DELETE",keepalive:!0}).catch(()=>{}))};return window.addEventListener("pagehide",Se),()=>{K.current=!0,window.removeEventListener("pagehide",Se),Se()}},[]);const U=async(Se=!1)=>{var Be,vt;if(!Se){const Ue=bS(e,{url:a.trim()});if(Ue){H(Ue);return}}m(!0),w(null);try{const Ue=await Ae.brandFromUrl(a);if(K.current){fetch(`/api/brands/${Ue.id}`,{method:"DELETE",keepalive:!0}).catch(()=>{});return}b(Ue),B.current=Ue.id,L(Ue.report),M(((Be=Ue.report)==null?void 0:Be.read)===!1&&((vt=Ue.warnings)==null?void 0:vt.slice(0,2).join(" "))||null),m(!1)}catch(Ue){w(String(Ue.message??Ue)),m(!1)}},I=async(Se=!1)=>{if(!Se){const Be=bS(e,{name:l});if(Be){H(Be);return}}m(!0),w(null);try{await V(await Ae.createBrand({specVersion:"0.1",meta:{name:l.trim()||"Untitled brand"}}))}catch(Be){w(String(Be.message??Be)),m(!1)}},_=()=>n("/",{replace:!0}),{scan:O,scanning:Y,outcome:z,retry:q}=KM((y==null?void 0:y.id)??null),Z=jse(z),Q=z.kind==="timeout"||z.kind==="error",me=async Se=>{var Be,vt;if(y){R(null),C(!0);try{await Ae.catalogImport(y.id,String(((vt=(Be=y.json)==null?void 0:Be.meta)==null?void 0:vt.website)??a),Se)}catch{R("That did not start. Check your connection and try again."),C(!1);return}C(!1),S(!1),await V(y)}},te=y?ea((re=y.json)==null?void 0:re.palette):[],he=y?Jr((ee=Nq(y.json))==null?void 0:ee.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:_,style:r?void 0:{visibility:"hidden"},children:[o.jsx(Ra,{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:Y?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",disabled:!0,children:[o.jsx(Lr,{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"})})]}):Q?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:q,children:["Look for products again ",o.jsx(wa,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y),children:"Continue without products"})})]}):Nse(O)?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:()=>S(!0),children:["Add brand and products ",o.jsx(wa,{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(wa,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y,"brand"),children:A&&Cse(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 I()}),o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!l.trim()||p,onClick:()=>void I(),children:p?o.jsx(Lr,{size:"1"}):o.jsxs(o.Fragment,{children:["Create it ",o.jsx(wa,{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 U()}),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 U(),children:p?o.jsx(Lr,{size:"1"}):o.jsxs(o.Fragment,{children:["Build the kit ",o.jsx(wa,{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"})})]})]}),P&&o.jsxs(r4,{color:"amber",mt:"3",size:"1",children:[o.jsxs(s4,{children:["You already have ",ka(P),". 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(Do(P)),children:["Open ",ka(P)," instead"]}),o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>{H(null),f?I(!0):U(!0)},children:"Create anyway"})]})]}),g&&o.jsx(r4,{color:"red",mt:"3",size:"1",children:o.jsx(s4,{children:g})})]})]}),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(Lr,{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:te.length?16:0},children:[o.jsx("span",{className:"sc-kit-logo",style:{width:44,height:44,padding:7,borderRadius:12},children:he?o.jsx("img",{src:he,alt:""}):o.jsx(Pa,{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=(J=y.json)==null?void 0:J.meta)==null?void 0:ae.name}),((ue=(Me=y.json)==null?void 0:Me.meta)==null?void 0:ue.tagline)&&o.jsx("small",{dir:"auto",style:{display:"block",color:"var(--sc-fg3)",fontSize:11.5},children:Mse(String(y.json.meta.tagline),72)})]})]}),te.length>0&&o.jsx("div",{style:{display:"flex",gap:8},children:te.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:[...Ese(A),...Z?[Z]:[]].map(Se=>o.jsxs("li",{"data-found":Se.found?"":void 0,children:[Se.key==="products"&&Y?o.jsx(Lr,{size:"1"}):Se.found?o.jsx(Kn,{size:12,weight:"bold"}):o.jsx(tF,{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}),!Y&&!Q&&Ase(z)&&o.jsx("button",{type:"button",className:"sc-wizpick-open",onClick:q,children:"Try the catalogue again"})]})]})]})}),k&&O&&y&&o.jsx(WM,{brandId:y.id,scan:O,busy:E,error:j,onImport:Se=>void me(Se),onImportAll:()=>void me(),onDismiss:()=>S(!1)})]})}const _u=e=>{const t=(e??"").trim();return t||null};function Pse(e){const t=e;return{name:e.name,brand:_u(t.brand)??_u(t.vendor),qualifier:_u(t.format)??_u(t.subcategory)??_u(t.variant)}}function Lse(e){return!e.brand||e.name.toLowerCase().startsWith(e.brand.toLowerCase())?e.name:`${e.brand} ${e.name}`}function Ho(e,t){const n=Pse(e);if(t==="chip")return n.name;const r=Lse(n);return t==="tooltip"?[r,n.qualifier].filter(Boolean).join(" · "):r}function kl(e,t){return t==="tooltip"?[e.name,_u(e.lighting)].filter(Boolean).join(" · "):e.name}function Bp(e){return[e.name,...e.legacyNames??[],...e.keywords??[],e.description,e.lighting,e.subject].concat(e.collections??[],e.verticals??[]).filter(Boolean).join(" ")}function gy(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 Up(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 $se(e,t,n){return[e.title,e.category,n,t.product?gy(t.product):null,t.presenter?Up(t.presenter):null,t.scene?Bp(t.scene):null].filter(Boolean).join(" ")}function vy(){const{brand:e}=cn(),t=Bn(),n=Er(e);return s.useCallback(r=>{t(`${n}?presenter=${encodeURIComponent(r)}&compose=1${kc()}`)},[n,t])}function l2(){const{brand:e}=cn(),t=Bn(),n=Er(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${kc()}`)},[n,t])}function B4(e){return{...e.brief,...e.quality?{quality:e.quality}:{},_at:Date.now()}}function Tse(){const{brand:e}=cn(),t=Bn(),n=Er(e);return s.useCallback(r=>{t(`${n}?showcase=${encodeURIComponent(r)}`)},[n,t])}const cp=e=>`sc-favscenes-${e}`,Dse=e=>`sc-favlooks-${e}`,Hse=e=>`bt-favlooks-${e}`;function DP(e,t){return e==="presenter"?`sc-favpresenters-${t}`:e==="product"?`sc-favproducts-${t}`:cp(t)}function HP(e){try{const t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function ki(e){try{const t=localStorage.getItem(cp(e))??i4(Dse(e),cp(e))??i4(Hse(e),cp(e));return HP(t)}catch{return[]}}function kd(e,t){try{return e==="scene"?ki(t):HP(localStorage.getItem(DP(e,t)))}catch{return[]}}function OP(e,t,n){try{localStorage.setItem(DP(e,t),JSON.stringify(n))}catch{}}function c2(e,t,n){const r=kd(e,t),a=r.includes(n)?r.filter(i=>i!==n):[...r,n];return OP(e,t,a),a}function wy(e,t,n,r){const a=kd(e,t),i=r?[...a,...n.filter(l=>!a.includes(l))]:a.filter(l=>!n.includes(l));return OP(e,t,i),i}const IP=[{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"}],Ose=new Map(IP.map(e=>[e.key,e]));function J8(e){var t;return e?((t=Ose.get(e))==null?void 0:t.label)??e:null}function Ise(e){const t=new Map(IP.map((n,r)=>[n.key,r]));return[...e].sort((n,r)=>(t.get(n)??99)-(t.get(r)??99)||n.localeCompare(r))}function Fse(e,t){let r=null,a=null,i=null,l=null,u=null,f=null,h=null,p={dx:0,dy:0},m={w:0,h:0},g=0;const w=R=>{R.style.position="fixed",R.style.left="0",R.style.top="0",R.style.margin="0",R.style.zIndex="var(--sc-z-popover)",R.style.pointerEvents="none"},y=()=>{const R=P=>{var H,D;window.removeEventListener("click",R,!0),!((D=(H=P.target).closest)!=null&&D.call(H,'[data-role="remove"]'))&&(P.stopPropagation(),P.preventDefault())};window.addEventListener("click",R,!0),setTimeout(()=>window.removeEventListener("click",R,!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(g)},k=R=>{!e.isConnected||!e.contains(document.activeElement)||(f!==null?Ua(e,f):yc(e,R,"after"))},S=()=>{if(!a)return;const R=a;b(),y(),k(R),t.onCancelled()},E=R=>{if(R.button!==0||R.pointerType==="touch")return;const P=R.target;if(P.closest('[data-role="remove"]'))return;const H=el(P);H&&(r={chip:H,x:R.clientX,y:R.clientY})},C=R=>{var H,D;if(!r)return;f=So(e),a=r.chip,t.onDragStart(),(H=window.getSelection())==null||H.removeAllRanges(),e.setAttribute("data-chip-drag","");const P=a.getBoundingClientRect();p={dx:r.x-P.left,dy:r.y-P.top},r=null;try{e.setPointerCapture(R.pointerId),h=R.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=`${P.width}px`,i.style.height=`${P.height}px`,i.style.fontSize=getComputedStyle(a).fontSize,m={w:P.width,h:P.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(R)},A=R=>{if(!i||!a)return;const P=Math.min(Math.max(4,R.clientX-p.dx),window.innerWidth-m.w-4),H=Math.min(Math.max(4,R.clientY-p.dy),window.innerHeight-m.h-4);i.style.transform=`translate3d(${P}px, ${H}px, 0)`;const D=Ak(e,a,R.clientX,R.clientY);if(u=D,!l)return;const B=D&&!D.noop?SS(e,D.units):null;if(!B||!D){l.style.display="none";return}const V=mte(e,D.units),K=V<D.units?SS(e,V):null,U=!!K&&Math.abs(K.top+K.height/2-(B.top+B.height/2))<B.height/2,I=K&&U?(K.left+B.left)/2:B.left;l.style.display="",l.style.transform=`translate3d(${I-1.5}px, ${B.top-2}px, 0)`,l.style.height=`${B.height+4}px`},L=R=>{if(r){if(Math.hypot(R.clientX-r.x,R.clientY-r.y)<5)return;R.preventDefault(),C(R);return}if(!a)return;R.preventDefault(),cancelAnimationFrame(g);const{clientX:P,clientY:H}=R;g=requestAnimationFrame(()=>A({clientX:P,clientY:H}))},T=R=>{if(r){r=null;return}if(!a)return;const P=a;let H;try{H=Ak(e,P,R.clientX,R.clientY)??u}catch{H=u}finally{b()}if(y(),H&&!H.noop&&KR(e,P,H.units)){yc(e,P,"after"),t.onMoved(P,O4(e,P));return}k(P),t.onCancelled()},M=R=>{R.key==="Escape"&&a&&(R.stopPropagation(),S())},j=R=>{el(R.target)&&R.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 SS(e,t){let n=0;const r=Array.from(e.childNodes);for(let l=0;l<r.length;l++){const u=r[l],f=bd(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 g=u.getBoundingClientRect();return new DOMRect(t===n?g.left:g.right,g.top,0,g.height)}const p=document.createRange();p.setStart(u,Hp(u,Math.max(0,Math.min(t-n,f)))),p.collapse(!0);const m=p.getBoundingClientRect();return m.height?m:null}n+=f}const i=(e.lastElementChild??e).getBoundingClientRect();return new DOMRect(i.right,i.top,0,i.height||18)}function _se({kind:e,label:t,thumb:n,onInspect:r,onMove:a,onRemove:i,onClose:l}){const{sheet:u,grip:f}=Ld(()=>l("dismiss")),h=e==="mark"?"brand mark":"reference image";return o.jsx(Al,{open:!0,onOpenChange:p=>!p&&l("dismiss"),children:o.jsxs(Nl,{children:[o.jsx(Ml,{className:"sc-shotsheet-scrim"}),o.jsxs(Rl,{ref:u,className:"sc-shotsheet sc-swapsheet","data-kind":e,"aria-describedby":void 0,onOpenAutoFocus:p=>{var m;p.preventDefault(),(m=u.current)==null||m.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(Pl,{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(Cv,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>a(1),children:["Move later ",o.jsx(wa,{size:13})]})]}),i&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:i,children:[o.jsx(jl,{size:13}),"Remove ",e==="mark"?"mark":"reference"]})]})]})]})})}const Vse=440,Zse=460,zse=600,ES=156,FP=8,up=14,e6=20,kr=12,_P=200,Bse=240,VP=204;function Use(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-kr*2),i=e.right+up+r+kr<=t.width?e.right+up:Math.max(kr,e.left-up-r),l=Math.max(kr,Math.min(e.top,t.height-kr-VP));return{left:i,top:l,width:r,maxHeight:Math.max(_P,t.height-l-kr),side:"beside"}}function Wse(e,t){const n=(r,a)=>Math.min(Math.max(r,e6),Math.max(e6,a-e6));return t.side==="beside"?{edge:t.left>=e.right?"left":"right",x:0,y:n((e.top+e.bottom)/2-t.top,VP)}:{edge:t.side==="above"?"bottom":"top",x:n((e.left+e.right)/2-t.left,t.width),y:0}}function Kse(e,t,n,r){if(e.bottom<0||e.top>t.height)return null;const a=FP,i=Math.min(n.width,t.width-kr*2),l=n.height,u=Math.min(Math.max(e.left+(e.right-e.left)/2-i/2,kr),Math.max(kr,t.width-i-kr)),h=e.top-a-kr>=l?e.top-a-l:Math.min(e.bottom+a,Math.max(kr,t.height-l-kr));return{left:u,top:h}}function yy(e,t,n){if(e.bottom<0||e.top>t.height)return null;const r=Math.min((n==null?void 0:n.width)??Vse,t.width-kr*2),a=(n==null?void 0:n.gap)??FP,i=e.top-a-kr,l=t.height-e.bottom-a-kr,u=i>=Bse||i>=l?"above":"below",f=u==="above"?i:l,h=Math.max(_P,Math.min((n==null?void 0:n.maxHeight)??Zse,f)),p=Math.min(Math.max(e.left,kr),Math.max(kr,t.width-r-kr)),m=u==="above"?Math.max(kr,e.top-a-h):e.bottom+a;return u==="above"?{left:p,top:m,width:r,maxHeight:h,side:u,bottomEdge:e.top-a}:{left:p,top:m,width:r,maxHeight:h,side:u}}function ZP(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 Gse=["ref","mark","product","presenter","scene","shot"],dp=e=>Gse.includes(e),zP={ref:"Reference image",mark:"Brand mark",product:"Product",presenter:"Presenter",scene:"Scene",shot:"Shot"};function Yse(e){return e.side==="below"||e.side==="beside"?{top:Math.round(e.top)}:{bottom:Math.round(window.innerHeight-(e.top+e.maxHeight))}}function Hd({anchor:e,kind:t,src:n,label:r,warning:a,note:i,noun:l,side:u="auto",onOpen:f,onHoverIn:h,onHoverOut:p,onClose:m}){const[g,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"?Use(L,T,{width:ES}):yy(L,T,{width:ES,gap:up});if(!M){m();return}w({...M,tail:Wse(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,m]),s.useEffect(()=>{const S=E=>{E.key==="Escape"&&m()};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[m]),!g)return null;const k=l??zP[t];return Br.createPortal(o.jsxs("div",{className:"sc-chip-preview","data-kind":t,"data-side":g.side,"aria-hidden":"true",style:{left:Math.round(g.left),...Yse(g),maxWidth:g.width,maxHeight:g.maxHeight},onPointerEnter:h,onPointerLeave:p,children:[o.jsx("span",{className:"sc-chip-preview-tail","data-edge":g.tail.edge,style:g.tail.edge==="left"||g.tail.edge==="right"?{top:Math.round(g.tail.y)}:{left:Math.round(g.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(Pa,{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 qse=160,Xse=120;function Od(){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),qse)},[a]),l=s.useCallback(()=>{a(),n.current=setTimeout(()=>t(null),Xse)},[a]),u=s.useCallback(()=>{a(),t(null)},[a]);return s.useEffect(()=>a,[a]),{shown:e,open:i,keep:a,close:l,closeNow:u}}const O0="sc-insert-menu";function Qse(e){var t;return!!(((t=e.nativeEvent)==null?void 0:t.isComposing)??e.isComposing)||e.keyCode===229}function Jse(e){return e==="/"?"Scenes":e==="@"?"Presenters":e==="#"?"Colors":"Products"}function eae(e){return e==="/"?"No matching scenes":e==="#"?"No matching colours":e==="@"?"No matching presenters":"No matching products"}function tae({menuOpen:e,handled:t}){return!e&&!t}function nae(e,t){return t||!e?{open:!1}:{open:!0,sigil:e.sigil,query:e.query}}function rae(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 sae(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.right-e.left,h:e.bottom-e.top}}function aae(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 oae(e,t,n){return n?t:e||t}function iae(e,t){return!t||e==null?!0:e===t?!1:!t.contains(e)}function t6(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 lae(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 uae(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 BP=320,Wp=320,dae=280,mc=8,dc=12,fae=8,CS=80,hae=120,UP=48;function WP(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>UP)}function pae(e){return{top:e.top,bottom:Math.min(e.bottom,e.top+22),left:e.left,right:e.left+2}}function KP(e,t,n,r){return Math.min(Math.max(e,r),Math.max(r,n.width-t-r))}function U4(e,t,n,r){const a=n?fae:dc,i=n?Math.max(0,e.right-e.left):Math.min(BP,t.width-a*2),l=n?e.left:KP(e.left,i,t,a),u=n?Math.min(dae,Math.floor(t.height*.4)):Wp,f=Math.min(u,r??u),h=e.top-mc-a,p=Math.max(0,Math.min(f,h)),m=Math.max(a,e.top-mc-p);return{left:l,top:m,width:i,maxHeight:p,side:"above",shell:"dock"}}function jS(e,t,n,r){const a=Math.min(BP,n.width-dc*2),i=KP(e.left,a,n,dc),l=e.top-mc-dc,u=n.height-e.bottom-mc-dc,f=l>=hae||l>=u?"above":"below",h=Math.min(Wp,r??Wp),p=f==="above"?l:u,m=Math.min(h,r==null?Math.max(CS,p):p);if(f==="above"){const w=Math.max(dc,e.top-mc-Math.min(h,l)),y=Math.min(h,e.top-mc-w);return r==null&&y<CS?U4(t,n,!1):{left:i,top:w,width:a,maxHeight:y,side:f,shell:"caret"}}const g=e.bottom+mc;return g+Math.min(m,u)>n.height-dc?U4(t,n,!1,r):{left:i,top:g,width:a,maxHeight:Math.min(h,u),side:f,shell:"caret"}}function mae(e,t,n,r={}){if(r.phone)return U4(t,n,!0,r.height);const a=r.line??t;if(WP(e,n)&&e)return jS(e,t,n,r.height);const i=e&&e.right-e.left>UP?e:a;return jS(pae(i),t,n,r.height)}function gae({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 m=Mr(aa),[g,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),R=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 P=s.useCallback(V=>{var Q;const K=t==null?void 0:t.getBoundingClientRect();if(!K)return null;const U=(n==null?void 0:n.getBoundingClientRect())??K,I=window.visualViewport,_={width:(I==null?void 0:I.width)??window.innerWidth,height:(I==null?void 0:I.height)??window.innerHeight},O=!!((Q=k.current)!=null&&Q.contains(document.activeElement)),Y=O?null:ZR(),z=Y&&WP(Y,_)?Y:null;z&&(C.current=sae(z,U));const q=C.current?aae(U,C.current):null,Z=oae(z,q,O)??(O?null:(e==null?void 0:e.getBoundingClientRect())??null);return mae(Z,K,_,{phone:m,line:U,height:V})},[e,t,n,m]);s.useLayoutEffect(()=>{var I,_;L.current.sigil!==u&&(L.current={sigil:u});const V=()=>{const O=M.current>0?void 0:L.current.height,Y=P(O);b(z=>t6(z,Y)?z:Y)},K=O=>{iae(O.target,k.current)&&V()};V();const U=requestAnimationFrame(V);return window.addEventListener("resize",V),window.addEventListener("scroll",K,!0),(I=window.visualViewport)==null||I.addEventListener("resize",V),(_=window.visualViewport)==null||_.addEventListener("scroll",V),()=>{var O,Y;cancelAnimationFrame(U),window.removeEventListener("resize",V),window.removeEventListener("scroll",K,!0),(O=window.visualViewport)==null||O.removeEventListener("resize",V),(Y=window.visualViewport)==null||Y.removeEventListener("scroll",V)}},[e,t,n,m,u,P]),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 O=P();O&&!t6(y,O)&&b(O);return}const V=k.current,K=S.current,U=K?V.offsetHeight-K.clientHeight:V.offsetHeight,I=lae(U,(K==null?void 0:K.scrollHeight)??0,Wp);if(!(I>0)||L.current.height===I&&L.current.sigil===(u??""))return;L.current={sigil:u??"",height:I};const _=P(I);!_||t6(y,_)||b(_)},[y,A,P,i,a.length,u]),s.useLayoutEffect(()=>{const V=K=>{K.isComposing||K.keyCode===229||(K.key==="ArrowDown"?(K.preventDefault(),g>=a.length-1?R():w(U=>U+1)):K.key==="ArrowUp"?(K.preventDefault(),w(U=>Math.max(0,U-1))):(K.key==="Enter"||K.key==="Tab")&&a[g]?(K.preventDefault(),a[g].run()):K.key==="Escape"&&(K.preventDefault(),p()))};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[a,g,p,R]),s.useEffect(()=>{const V=S.current,K=V==null?void 0:V.querySelector('[data-active="true"]');V&&K&&uae(V,K)},[g]),s.useEffect(()=>{const V=E.current,K=S.current;if(!V||!K)return;const U=new IntersectionObserver(I=>{K.scrollTop<=0||I.some(_=>_.isIntersecting)&&R()},{root:K,rootMargin:"0px 0px 8px 0px"});return U.observe(V),()=>U.disconnect()},[y,A,R]);const H=a[g]?`${O0}-opt-${g}`:null;if(s.useEffect(()=>(h==null||h(H),()=>h==null?void 0:h(null)),[H,h]),s.useEffect(()=>{const V=K=>{K.target.closest(".sc-cmd")||(I4(K),p())};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[p]),!y)return null;const D=`${O0}-list`,B=Jse(u);return Br.createPortal(o.jsx("div",{className:"sc-cmd",id:O0,"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,K)=>{var I;const U=K===0||V.group!==((I=a[K-1])==null?void 0:I.group);return o.jsxs("div",{children:[U&&o.jsx(AS,{name:V.group,total:l}),o.jsxs("button",{type:"button",id:`${O0}-opt-${K}`,className:"sc-cmd-row",role:"option","aria-selected":K===g,"data-active":K===g,onMouseEnter:()=>w(K),onMouseDown:_=>I4(_),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(vae,{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(AS,{name:B,total:l}),o.jsx("div",{className:"sc-cmd-empty",children:eae(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 AS({name:e,total:t}){return o.jsxs("div",{className:"sc-cmd-group",children:[e," ",o.jsx("span",{className:"sc-cmd-n",children:t})]})}function vae({text:e,query:t}){return o.jsx("span",{className:"sc-cmd-label",children:rae(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 wae={fragrance:["Fragrance"],footwear:["Footwear"],apparel:["Apparel"],furniture:["Furniture","Home"],beauty:["Beauty"],electronics:["Electronics"],accessories:["Accessories"],beverage:["Food & drink"],jewelry:["Jewelry"],food:["Food & drink"]},yae={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 bae(e,t){if(!t)return!1;const n=wae[t];return!!n&&n.some(r=>e.verticals.includes(r))}function xae(e,t){if(!t)return!1;const n=yae[t];return!!n&&n.some(r=>e.suitableCategories.includes(r))}function NS(e){return e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").replace(/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g,"").toLowerCase()}const kae=4;function Oo(e,t){const n=NS(t).trim().split(/\s+/).filter(Boolean);if(!n.length)return!0;const r=NS(e);return n.every(a=>r.includes(a)||a.length>=kae&&a.endsWith("s")&&r.includes(a.slice(0,-1)))}function by(e,t){return{visible:e.slice(0,t),remaining:Math.max(0,e.length-t)}}function GP(e,t){return[...e].sort((n,r)=>Number(t(r))-Number(t(n)))}function YP(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 c1={product:"product",presenter:"presenter",scene:"scene"},ul=48;function Sae(e){return e?e.t==="product"?"product":e.t==="character"?"presenter":e.t==="template"?"scene":null:null}function Vu(e){const t=Sae(e);return t||((e==null?void 0:e.t)==="color"?"color":null)}function Eae(e){const t=Vu(e);return t||((e==null?void 0:e.t)==="ref"||(e==null?void 0:e.t)==="mark"?e.t:null)}function n6(e){return(e==null?void 0:e.t)==="ref"||(e==null?void 0:e.t)==="mark"?e.imageHash:null}const K0=e=>{const t=(e??"").trim();return t||void 0},MS=e=>(e==null?void 0:e.custom)===!0;function dl(e,t){return e==="product"?[...(t.libraryProducts.length?t.libraryProducts:t.brandProducts).map(r=>{var a,i;return RS(r,"brand",_m((i=(a=r.shots)==null?void 0:a[0])==null?void 0:i.file,"tile"))}),...t.demoProducts.map(r=>RS(r,"catalog",r.previewUrl??null))]:e==="presenter"?[...t.presenters.map(n=>{const r=yi(n);return{kind:"presenter",id:n.id,label:n.name,full:[n.name,K0(n.descriptor)].filter(Boolean).join(" · "),sub:K0(n.descriptor),search:Up(n),thumb:Ln(r.src,"tile"),crop:r.crop,source:MS(n)?"brand":"catalog",recommended:xae(n,t.productCategory),token:{t:"character",id:n.id}}}),...t.cast.map(n=>{const r=Zw(n);return{kind:"presenter",id:n.id,label:n.name,full:n.name,search:n.name,thumb:Ln(r.src,"tile"),crop:r.crop,source:"brand",token:{t:"character",id:n.id}}})]:t.scenes.map(n=>({kind:"scene",id:n.id,label:kl(n,"card"),full:kl(n,"tooltip"),sub:K0(n.lighting),search:Bp(n),thumb:Ln(n.previewUrl??null,"tile"),tint:cd(n.previewColor),source:MS(n)?"brand":"catalog",recommended:bae(n,t.productCategory),token:{t:"template",id:n.id}}))}function RS(e,t,n){return{kind:"product",id:e.id,label:Ho(e,"chip"),full:Ho(e,"tooltip"),sub:Cae(e),search:gy(e),thumb:n,source:t,token:{t:"product",id:e.id}}}function Cae(e){const t=e;return K0(t.brand)??K0(t.vendor)}function ud(e,t){const n=t.trim();return n?e.filter(r=>Oo(r.search,n)):e}function PS(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 u2(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=[...ud(a,n.query)].sort((h,p)=>PS(e,h,n.bookmarked)-PS(e,p,n.bookmarked)).map(h=>n.bookmarked.has(h.id)?{...h,bookmarked:!0}:h),{visible:u,remaining:f}=by(l,n.shown??ul);return{current:r,items:u,remaining:f,total:l.length}}const jae={$:"product","/":"scene","@":"presenter"},qP={Products:8,Presenters:8,Colors:16,Scenes:8},XP={$:"Products","/":"Scenes","@":"Presenters","#":"Colors"};function E0(e){return qP[XP[e??"$"]]}function QP(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 Aae(e,t,n){return u2(e,t,{currentId:null,query:"",bookmarked:n,shown:t.length}).items.map(QP)}function LS(e,t){const{visible:n,remaining:r}=by(e,t);return{items:n,remaining:r,total:e.length}}function Nae(e,t,n={query:""}){const r=n.query.trim(),a=n.bookmarked??new Set,i=n.shown??qP[XP[e]];if(e==="#"){const h=(t.colors??[]).map(Mae),p=r?h.filter(m=>Oo(m.search??m.label,r)):h;return LS(p,i)}const l=jae[e],u=l==="product"?t.products:l==="presenter"?t.presenters:t.scenes??[],f=r?ud(u,r).map(QP):Aae(l,u,a);return LS(f,i)}function Mae(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 Rae="(pointer: coarse)";function Pae(e){return Mr(aa)?o.jsx(Oae,{...e}):o.jsx(Hae,{...e,onMove:void 0})}function Lae(){return!Mr(Rae)}const $ae=e=>`Remove ${c1[e]}`;function $S(e,t,n){const r={slug:t};return e==="product"?xa(r,n):e==="presenter"?Aa(r,n):zr(r,n)}function JP({kind:e,currentId:t,candidates:n,brandId:r,brandSlug:a,warning:i,note:l,onPick:u,onRemove:f,onClose:h,onAttachRequest:p,onMove:m,views:g,autoFocusSearch:w}){const[y,b]=s.useState(""),[k,S]=s.useState(!1),E=async I=>{if(!(!g||k)){S(!0);try{await g.onPick(I)}finally{S(!1)}}},[C,A]=s.useState(ul),L=s.useRef(null),T=s.useRef(null),[M,j]=s.useState(0),R=s.useMemo(()=>e==="scene"?new Set(ki(r)):new Set,[e,r]);s.useEffect(()=>{A(ul),j(0)},[y]);const P=s.useMemo(()=>u2(e,n,{currentId:t,query:y,bookmarked:R,shown:C}),[e,n,t,y,R,C]);s.useLayoutEffect(()=>{var I;w&&((I=L.current)==null||I.focus({preventScroll:!0}))},[w]),s.useEffect(()=>{j(I=>Math.max(0,Math.min(I,P.items.length-1)))},[P.items.length]);const H=s.useCallback(I=>{var O;const _=(O=T.current)==null?void 0:O.querySelectorAll("[data-nav]")[I];_&&(j(I),_.focus({preventScroll:!0}),_.scrollIntoView({block:"nearest"}))},[]),D=s.useCallback(()=>{const I=T.current;return I?Math.max(1,getComputedStyle(I).gridTemplateColumns.split(" ").filter(Boolean).length):1},[]),B=I=>{var z;if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),h("escape");return}const _=I.target===L.current;if(_&&I.key==="ArrowDown"){I.preventDefault(),H(0);return}if(_&&I.key==="Enter"){I.preventDefault(),P.items[0]&&u(P.items[0]);return}if(_)return;const O=D(),Y=I.key==="ArrowRight"?1:I.key==="ArrowLeft"?-1:I.key==="ArrowDown"?O:I.key==="ArrowUp"?-O:0;if(Y){I.preventDefault();const q=M+Y;q<0&&Y===-O?(z=L.current)==null||z.focus():q>=0&&q<P.items.length&&H(q);return}I.key==="Home"?(I.preventDefault(),H(0)):I.key==="End"&&(I.preventDefault(),H(P.items.length-1))},V=c1[e],K=e==="product",U=!!P.current&&!!g&&g.options.length>1&&!y.trim();return o.jsxs("div",{className:"sc-swap-inner","data-sections":U||void 0,onKeyDown:B,children:[o.jsx("div",{className:"sc-swap-head",children:o.jsxs("span",{className:"sc-swap-search",children:[o.jsx(fd,{size:13}),o.jsx("input",{ref:L,type:"text",value:y,onChange:I=>b(I.target.value),placeholder:`Search ${V}s`,"aria-label":`Search ${V}s`,autoComplete:"off",spellCheck:!1})]})}),P.current&&!U&&o.jsxs("div",{className:"sc-swap-cur",title:P.current.full,children:[o.jsx(TS,{src:P.current.thumb,tinted:!!P.current.tint,crop:P.current.crop}),o.jsxs("span",{className:"sc-swap-curtext",children:[o.jsx("b",{dir:"auto",children:P.current.label}),P.current.sub&&o.jsx("span",{dir:"auto",children:P.current.sub})]}),o.jsx("a",{className:"sc-swap-open",href:$S(e,a,P.current.id),target:"_blank",rel:"noreferrer",title:`Open this ${V} in a new tab`,"aria-label":`Open ${P.current.label} in a new tab`,children:o.jsx(Cc,{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:[U&&P.current&&g&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"sc-ap-sec",children:[o.jsx("span",{className:"sc-ap-sec-title",dir:"auto",children:P.current.label}),o.jsxs("a",{className:"sc-ap-sec-act sc-swap-sec-open",href:$S(e,a,P.current.id),target:"_blank",rel:"noreferrer","aria-label":`Open ${P.current.label} in a new tab`,children:["Open",o.jsx(Cc,{size:12})]})]}),o.jsxs("fieldset",{className:"sc-swap-this","aria-label":`${P.current.label}: the picture a shot follows`,"aria-busy":k||void 0,children:[o.jsx(Tae,{views:g.options,on:!g.picked,disabled:k,onPress:()=>void E(null)}),g.options.map(I=>o.jsx(Dae,{option:I,on:g.picked===I.view,disabled:k,onPress:()=>void E(g.picked===I.view?null:I)},I.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:P.total})]})})]}),P.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:P.items.map((I,_)=>o.jsxs("div",{className:"sc-swap-card",role:"option","aria-selected":!1,"data-nav":_,tabIndex:_===M?0:-1,title:I.full,style:I.tint?{"--tint":I.tint}:void 0,onFocus:()=>j(_),onClick:()=>u(I),onKeyDown:O=>{O.key!=="Enter"&&O.key!==" "||(O.preventDefault(),u(I))},children:[o.jsx(TS,{src:I.thumb,tinted:!!I.tint,crop:I.crop}),o.jsxs("b",{dir:"auto",children:[I.bookmarked&&o.jsxs(o.Fragment,{children:[o.jsx(Qa,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Kept. "})]}),I.label]}),K&&I.sub&&o.jsx("span",{dir:"auto",children:I.sub}),e==="scene"&&o.jsx(xy,{})]},I.id))}),P.remaining>0&&o.jsxs("button",{type:"button",className:"sc-swap-more",onClick:()=>A(I=>I+ul),children:["Show ",Math.min(ul,P.remaining)," more of ",P.total]})]}),o.jsxs("div",{className:"sc-swap-foot",children:[t&&!P.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"})]}),m&&o.jsxs("div",{className:"sc-swap-move",children:[o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>m(-1),children:[o.jsx(Cv,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>m(1),children:["Move later ",o.jsx(wa,{size:13})]})]}),f&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:f,children:[o.jsx(jl,{size:13}),$ae(e)]})]})]})}function xy(){return o.jsxs("span",{className:"sc-ap-puck","aria-hidden":!0,children:[o.jsx(mr,{className:"sc-ap-puck-add",size:11,weight:"bold"}),o.jsx(Kn,{className:"sc-ap-puck-on",size:11,weight:"bold"}),o.jsx(Cn,{className:"sc-ap-puck-off",size:11,weight:"bold"})]})}function Tae({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:Ln(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(xy,{})]})}function Dae({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:Ln(e.thumb,"small"),alt:"",loading:"lazy"})}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:e.name})}),o.jsx(xy,{})]})}function TS({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(Pa,{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 Hae(e){const{anchor:t,kind:n,onClose:r}=e,a=Lae(),[i,l]=s.useState(null),u=s.useRef(null);return s.useLayoutEffect(()=>{var h,p;const f=()=>{const m=window.visualViewport,g=yy(t.getBoundingClientRect(),{width:(m==null?void 0:m.width)??window.innerWidth,height:(m==null?void 0:m.height)??window.innerHeight},n==="scene"?{maxHeight:zse}:void 0);if(!g){r("outside");return}l(g)};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 m,g;window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),(m=window.visualViewport)==null||m.removeEventListener("resize",f),(g=window.visualViewport)==null||g.removeEventListener("scroll",f)}},[t,r]),s.useEffect(()=>{const f=h=>{var m;const p=h.target;(m=u.current)!=null&&m.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 ${c1[n]}`,style:ZP(i),children:o.jsx(JP,{...e,autoFocusSearch:a})}),document.body):null}function Oae(e){const{kind:t,onClose:n}=e,{sheet:r,grip:a}=Ld(()=>n("dismiss"));return o.jsx(Al,{open:!0,onOpenChange:i=>!i&&n("dismiss"),children:o.jsxs(Nl,{children:[o.jsx(Ml,{className:"sc-shotsheet-scrim"}),o.jsxs(Rl,{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(Pl,{className:"sc-vh",children:["Change ",c1[t]]})]}),o.jsx(JP,{...e,autoFocusSearch:!1})]})]})})}const Iae=260;function Fae(e){return Mr(aa)?o.jsx(Vae,{...e}):o.jsx(_ae,{...e,onMove:void 0})}function Mu(e,t){const n=e?ur(e):null,r=t?ur(t):null;return!!n&&n===r}function eL({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=>Mu(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=>Mu(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=>Mu(A.hex,e)));(C=(E=f.current)==null?void 0:E.querySelectorAll("[data-nav]")[S])==null||C.focus({preventScroll:!0})},[]);const m=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}))},[]),g=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&&m(E)}},w=S=>r({t:"color",hex:S.hex,name:S.name||void 0}),y=(S,E)=>{const C=u.find(A=>Mu(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=>Mu(S.hex,b));return o.jsxs("div",{className:"sc-swap-inner",onKeyDown:g,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=Mu(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(yd,{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(yd,{className:"sc-swap-swatch sc-swap-custom",triggerStyle:{background:"none"},value:e??e2(n),presets:n.map(S=>S.hex),commitMode:"live",align:"start",label:"Custom colour",onChange:S=>y(S),children:[o.jsx(mr,{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(Cv,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>l(1),children:["Move later ",o.jsx(wa,{size:13})]})]}),a&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:a,children:[o.jsx(jl,{size:13}),"Remove colour"]})]})]})}function _ae(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=yy(t.getBoundingClientRect(),{width:(h==null?void 0:h.width)??window.innerWidth,height:(h==null?void 0:h.height)??window.innerHeight},{width:Iae});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:ZP(r),children:o.jsx(eL,{...e})}),document.body):null}function Vae(e){const{onClose:t}=e,{sheet:n,grip:r}=Ld(()=>t("dismiss"));return o.jsx(Al,{open:!0,onOpenChange:a=>!a&&t("dismiss"),children:o.jsxs(Nl,{children:[o.jsx(Ml,{className:"sc-shotsheet-scrim"}),o.jsxs(Rl,{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(Pl,{className:"sc-vh",children:"Change colour"})]}),o.jsx(eL,{...e})]})]})})}function u1(e){const{brand:t,products:n}=cn(),{scenes:r,presenters:a,demoProducts:i}=$n(),l=s.useMemo(()=>Lp(qc(t),r),[t,r]),u=s.useMemo(()=>Lp(r1(t),a),[t,a]),f=s.useMemo(()=>{var p;return(((p=t==null?void 0:t.json)==null?void 0:p.characters)??[]).filter(m=>(m==null?void 0:m.origin)!=="custom")},[t]),h=s.useMemo(()=>{var p;return hf(((p=t==null?void 0:t.json)==null?void 0:p.products)??[])},[t]);return s.useMemo(()=>({libraryProducts:HM(n),brandProducts:h,demoProducts:i,presenters:u,cast:f,scenes:l,productCategory:e??null}),[n,h,i,u,f,l,e])}const C0=new Map,Zae=64;function tL(e){let t=C0.get(e);if(!t)for(t=Bae(e).then(n=>n?Uae(n.data,4):null).catch(()=>null),C0.set(e,t);C0.size>Zae;)C0.delete(C0.keys().next().value);return t}function zae(e,t){tL(t).then(n=>{const r=cd(n??void 0);!r||!e.isConnected||(e.dataset.tinted="true",e.style.setProperty("--tint",r))})}async function Bae(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 Uae(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}=Wae(i,l,u);if(h<.18||p<.12||p>.92)continue;const m=h*(1-Math.abs(p-.5)*1.2),g=n[Math.min(23,Math.floor(f/360*24))];g.score+=m,g.r+=i*m,g.g+=l*m,g.b+=u*m}const r=n.reduce((a,i)=>i.score>a.score?i:a,n[0]);return r.score<=0?null:Kae(r.r/r.score,r.g/r.score,r.b/r.score)}function Wae(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 m;return l===r?m=((a-i)/h+(a<i?6:0))*60:l===a?m=((i-r)/h+2)*60:m=((r-a)/h+4)*60,{h:m,s:p,l:f}}function Kae(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)}`}const DS=["hero","place","close","hands","angle","bold"],HS=e=>[...e].sort((t,n)=>DS.indexOf(t.view)-DS.indexOf(n.view));function Gae(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 Ae.sceneFrames(n).then(l=>{if(!i)return;const u=l.views.map(f=>({view:f.view,name:ed[f.view],thumb:f.url,hash:null}));a({id:n,views:u})}).catch(()=>{}),()=>{i=!1}},[n]),t){const i=[];t.placeUrl&&t.previewHash&&i.push({view:"place",name:ed.place,thumb:t.placeUrl,hash:t.previewHash});for(const l of t.examples??[])i.push({view:l.role,name:ed[l.role],thumb:l.url,hash:l.hash});return HS(i)}return r&&r.id===n?HS(r.views):[]}function Yae(e){return!e||e.cap==null||e.cap<=0?null:e.cap}function qae(e){const t=new Set;if(!e||e.cap==null||e.cap<=0)return t;const n=new Set(e.attachments.map(r=>gc(r.role,r.id??r.hash)));for(const r of e.dropped){const a=gc(r.role,r.id??r.hash);r.reason!=="missing"&&!n.has(a)&&t.add(a)}return t}const gc=(e,t)=>`${e}:${t}`,I0=new Set(["product","character","ref","mark","template"]),Kp=12,W4=`Shot is full: ${Kp} 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 pi(e){const t=Yr.find(n=>n.id===e);return t?t.w/t.h:1}function Xae(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 Ih=6,Qae=s.forwardRef(function({initialTokens:t,onChange:n,brand:r,templates:a,presenters:i,demoProducts:l,onTemplatePick:u,scenesSitOut:f,placeholder:h,placeholderSm:p,label:m="Brief",flag:g,described:w,describedNote:y,onInspect:b,activeProductCategory:k,onAttachRequest:S,onSubmit:E,onDropFiles:C},A){var Pt,Yt,jt,Ft,Ne,Fe,tt;const L=s.useRef(null),T=s.useRef(null),M=s.useId(),[j,R]=s.useState(""),P=s.useCallback(F=>{R(""),requestAnimationFrame(()=>R(F))},[]),H=s.useRef(null),[D,B]=s.useState(null),[V,K]=s.useState(null),U=Od(),{shown:I,closeNow:_}=U,O=s.useRef(V);s.useEffect(()=>{O.current=V},[V]);const Y=s.useRef(g);s.useEffect(()=>{Y.current=g},[g]);const[z,q]=s.useState(""),[Z,Q]=s.useState(E0("$")),[me,te]=s.useState(null),he=s.useRef(!1),re=s.useRef(0),[ee,J]=s.useState(!1),ae=s.useRef(0),{products:Me}=cn(),ue=Me.length?Me:((Pt=r.json)==null?void 0:Pt.products)??[],Se=((Yt=r.json)==null?void 0:Yt.characters)??[],Be=s.useMemo(()=>n1(r.json),[r]),vt=s.useCallback((F,fe)=>{var Qn,un,Jn;const ye=document.createElement("span");ye.className=hc,ye.contentEditable="false",ye.dir="ltr",ye.dataset.kind=F.t,ye.dataset.tok=r2(F),ye.dataset.uid=fe??`u${re.current++}`;let Ze="",Pe=null,ct,Ot=null;const _t=YP(F,{products:ue,demoProducts:l,cast:Se,presenters:i,scenes:a});if((_t==null?void 0:_t.kind)==="scene"){const tn=_t.scene;Ze=tn?kl(tn,"chip"):"missing template",Pe=Ln((tn==null?void 0:tn.previewUrl)??null,"micro"),tn&&F.t==="template"&&F.view&&(Pe=mn(F.view,"micro"),F.viewName&&(Ze=`${Ze} · ${F.viewName}`));const gr=cd(tn==null?void 0:tn.previewColor);gr&&(ye.dataset.tinted="true",ye.style.setProperty("--tint",gr)),!gr&&Pe&&_t.custom&&zae(ye,Pe)}else if((_t==null?void 0:_t.kind)==="product"){const tn=_t.product??_t.demo;Ze=tn?Ho(tn,"chip"):"missing product",Pe=_t.product?_m((un=(Qn=_t.product.shots)==null?void 0:Qn[0])==null?void 0:un.file,"micro"):Ln(((Jn=_t.demo)==null?void 0:Jn.previewUrl)??null,"micro")}else if((_t==null?void 0:_t.kind)==="presenter"){const{character:tn,presenter:gr}=_t;Ze=(tn==null?void 0:tn.name)??(gr==null?void 0:gr.name)??"missing person";const Or=tn?Zw(tn):gr?yi(gr):{src:null};Pe=Ln(Or.src,"micro"),ct=Or.crop}else if(F.t==="color")Ze=F.name??F.hex,Ot=F.hex;else if(F.t==="ref")Ze=F.label??"Image",Pe=mn(F.imageHash,"micro");else if(F.t==="mark"){const tn=Be.find(gr=>gr.hash===F.imageHash);Ze=tn?Gm(r.json,tn):"missing mark",Pe=mn(F.imageHash,"micro")}if(Ze.startsWith("missing ")&&(ye.dataset.missing=""),Pe){const tn=document.createElement("img");tn.src=Pe,tn.alt="",ct&&(tn.dataset.crop=ct),tn.onerror=()=>tn.remove(),ye.appendChild(tn)}else if(Ot){const tn=document.createElement("span");tn.className="sc-token-swatch",tn.style.background=Ot,ye.appendChild(tn)}const Lt=document.createElement("span");Lt.className="sc-token-label",Lt.dir="auto",Lt.textContent=Ze,ye.appendChild(Lt);const vn=(g==null?void 0:g(F))??null;vn&&(ye.title=vn,F.t!=="template"&&(ye.dataset.warn="1")),w!=null&&w(F)&&(ye.dataset.described="1");const qt=Vu(F);if(qt){const tn=qt==="color"?"colour":c1[qt];ye.tabIndex=-1,ye.setAttribute("role","button"),ye.setAttribute("aria-haspopup","dialog"),ye.setAttribute("aria-expanded","false"),ye.setAttribute("aria-label",`${tn}: ${Ze}. Change or remove.`)}else ye.tabIndex=-1,ye.setAttribute("role","button"),ye.setAttribute("aria-haspopup","dialog"),ye.setAttribute("aria-expanded","false"),ye.setAttribute("aria-label",`${F.t==="mark"?"brand mark":"reference image"}: ${Ze}. Open, remove or move.`);ye.setAttribute("aria-keyshortcuts","Alt+ArrowLeft Alt+ArrowRight"),ye.setAttribute("aria-describedby",M),ye.setAttribute("draggable","false");const Nn=document.createElement("button");return Nn.type="button",Nn.tabIndex=-1,Nn.setAttribute("aria-hidden","true"),Nn.dataset.role="remove",Nn.appendChild(Ste()),ye.appendChild(Nn),ye},[a,ue,Se,i,l,Be,r,g,w,M]),Ue=s.useCallback(()=>{const F=L.current;F&&n(xk(F))},[n]);s.useEffect(()=>{const F=L.current;F&&(kk(F,t!=null&&t.length?t:Jo(),fe=>vt(fe)),D0(F))},[]);const Xe=s.useCallback((F,fe)=>{var Pe;const ye=L.current,Ze=ye==null?void 0:ye.querySelector(`[data-uid="${CSS.escape(F)}"]`);if(ye&&Ze&&jk(ye,Ze,fe)){yc(ye,Ze,"after");const ct=So(ye);ct!==null&&(H.current=ct,((Pe=O.current)==null?void 0:Pe.uid)===F&&(O.current={...O.current,caret:ct}),K(Ot=>Ot&&Ot.uid===F?{...Ot,caret:ct}:Ot)),Ue(),P(O4(ye,Ze))}},[Ue,P]);s.useEffect(()=>{const F=L.current;if(F)return Fse(F,{onDragStart:()=>{B(null),q(""),_()},onMoved:(fe,ye)=>{Ue(),P(ye)},onCancelled:()=>P("Reorder cancelled.")})},[Ue,P,_]),s.useEffect(()=>{const F=L.current;if(F)for(const fe of F.querySelectorAll(`.${hc}`)){const ye=ks(fe.dataset.tok??"");if(!ye)continue;const Ze=(g==null?void 0:g(ye))??null;Ze&&ye.t!=="template"?fe.dataset.warn="1":delete fe.dataset.warn,w!=null&&w(ye)?fe.dataset.described="1":delete fe.dataset.described,Ze&&!("open"in fe.dataset)?fe.title=Ze:fe.removeAttribute("title")}},[g,w]),s.useEffect(()=>{const F=()=>{const fe=So(L.current);fe!==null&&(H.current=fe)};return document.addEventListener("selectionchange",F),()=>document.removeEventListener("selectionchange",F)},[]);const De=s.useCallback(F=>{const fe=L.current;if(!fe)return;if(F.t==="template"){const ct=w0(fe);if(ct){ct.replaceWith(vt(F,ct.dataset.uid)),Co(fe),Ue(),B(null),q("");return}}const ye=qa(F);if(ye){const ct=I8(fe,ye);if(ct){B(null),q(""),P(`${ei(ct)||"That"} is already in the brief.`);return}}if(I0.has(F.t)&&!(F.t==="template"&&w0(fe))&&Array.from(fe.querySelectorAll(`.${hc}`)).filter(Ot=>I0.has(Ot.dataset.kind??"")).length>=Kp){B(null),q(""),P(W4);return}nte(fe,vt(F),{eatQuery:!!D,fallbackUnits:H.current});const Pe=So(fe);Pe!==null&&(H.current=Pe),Ue(),B(null),q("")},[D,vt,Ue,P]),G=s.useRef(De);s.useEffect(()=>{G.current=De},[De]);const oe=s.useCallback((F,fe)=>{const ye=L.current,Ze=ye==null?void 0:ye.querySelector(`[data-uid="${CSS.escape(F)}"]`);return!ye||!Ze?!1:(Ze.replaceWith(vt(fe,F)),Co(ye),Ue(),!0)},[vt,Ue]),We=s.useCallback(F=>{const fe=L.current,ye=fe==null?void 0:fe.querySelector(`[data-uid="${CSS.escape(F)}"]`);if(!fe||!ye)return null;const Ze=no(fe,ye);return F8(fe,ye),Ue(),Ze},[Ue]),Oe=()=>{var F;return document.documentElement.dataset.guideTask==="first-shot"&&!!((F=L.current)!=null&&F.closest('[data-guide="compose"]'))},ie=(F,fe)=>{var ct;const ye=[...F.querySelectorAll(".sc-token")];if(!ye.length)return!1;const[Ze]=((ct=fe.getTargetRanges)==null?void 0:ct.call(fe))??[];if(!Ze)return!1;const Pe=document.createRange();return Pe.setStart(Ze.startContainer,Ze.startOffset),Pe.setEnd(Ze.endContainer,Ze.endOffset),ye.some(Ot=>Pe.intersectsNode(Ot))},X=s.useRef(We);s.useEffect(()=>{X.current=We},[We]),s.useEffect(()=>{const F=L.current;if(!F)return;const fe=ye=>{if(ye.inputType.startsWith("delete")&&Oe()&&ie(F,ye))return ye.preventDefault();const Ze=ye.inputType==="deleteContentBackward"?"Backspace":ye.inputType==="deleteContentForward"?"Delete":null;if(!Ze)return;const Pe=Ek(F,Ze);if(!(Pe!=null&&Pe.dataset.uid)){Ck(F,Ze)&&ye.preventDefault();return}ye.preventDefault();const ct=X.current(Pe.dataset.uid);ct!=null&&Ua(F,ct)};return F.addEventListener("beforeinput",fe),()=>F.removeEventListener("beforeinput",fe)},[]);const se=s.useCallback(F=>{const fe=ks(F.dataset.tok??"");if(!fe||fe.t!=="ref"&&fe.t!=="mark")return!1;const ye=L.current,Ze=ye?So(ye):null;return Ze!=null&&(H.current=Ze),_(),b==null||b({src:Dr(fe.imageHash),kind:fe.t,label:fe.t==="mark"?ei(F):null}),!0},[b,_]),Re=s.useCallback((F,fe,ye,Ze)=>{const Pe=F.dataset.uid;Pe&&(_(),F.dataset.open="",F.hasAttribute("aria-haspopup")&&F.setAttribute("aria-expanded","true"),F.removeAttribute("title"),B(null),q(""),K({uid:Pe,kind:fe,anchor:F,caret:ye,touch:Ze}))},[_]),_e=s.useCallback((F,fe)=>{var Ot;const ye=O.current;if(O.current=null,K(null),!ye)return;const Ze=L.current,Pe=Ze==null?void 0:Ze.querySelector(`[data-uid="${CSS.escape(ye.uid)}"]`);if(Pe){delete Pe.dataset.open,Pe.hasAttribute("aria-haspopup")&&Pe.setAttribute("aria-expanded","false");const _t=ks(Pe.dataset.tok??""),Lt=_t?((Ot=Y.current)==null?void 0:Ot.call(Y,_t))??null:null;Lt&&(Pe.title=Lt)}const ct=fe!==void 0?fe:ye.caret;if(ye.touch){ct!=null&&(H.current=ct);return}Ze&&(Ze.focus({preventScroll:!0}),ct!=null?Ua(Ze,ct):pc(Ze))},[]);s.useEffect(()=>{if(!V)return;const F=L.current;F!=null&&F.querySelector(`[data-uid="${CSS.escape(V.uid)}"]`)||_e("outside")},[V,_e]),s.useEffect(()=>{var F;I&&((F=L.current)!=null&&F.contains(I.anchor)||_())},[I,_]),s.useEffect(()=>{const F=I==null?void 0:I.anchor;if(!F)return;F.dataset.open="";const fe=F.getAttribute("title");return fe&&F.removeAttribute("title"),()=>{delete F.dataset.open,fe&&F.setAttribute("title",fe)}},[I]),s.useImperativeHandle(A,()=>({insert:F=>G.current(F),setTokens:F=>{const fe=L.current;fe&&(kk(fe,F.length?F:Jo(),ye=>vt(ye)),D0(fe),n(xk(fe)))},removeTemplate:()=>{const F=L.current,fe=F?w0(F):null;!F||!fe||(F8(F,fe),Ue())},remove:F=>{const fe=L.current;if(!fe)return;const ye=I8(fe,qa(F));ye&&(F8(fe,ye),Ue())},openMenu:F=>{q(""),Q(E0("$")),B({anchor:F})},focus:()=>pc(L.current),restoreCaret:()=>{const F=L.current;if(!F)return;F.focus({preventScroll:!0});const fe=H.current;fe!=null?Ua(F,fe):pc(F)}}));const Ye=u1(k),ge=s.useCallback(F=>dl(F,Ye),[Ye]),Qe=s.useMemo(()=>new Set(ki(r.id)),[r.id]),at=s.useMemo(()=>{var F;return D?Nae(D.sigil??"$",{products:dl("product",Ye),presenters:dl("presenter",Ye),scenes:f?[]:dl("scene",Ye),colors:ea((F=r.json)==null?void 0:F.palette)},{query:z,bookmarked:Qe,shown:Z}):{items:[],remaining:0,total:0}},[D,Ye,z,Qe,Z,f,(jt=r.json)==null?void 0:jt.palette]),wt=s.useMemo(()=>at.items.map(F=>({...F,run:()=>F.token.t==="template"?u(F.token.id):G.current(F.token)})),[at.items,u]),Et=s.useCallback(()=>{at.remaining<=0||Q(F=>F+E0(D==null?void 0:D.sigil))},[at.remaining,D==null?void 0:D.sigil]),ot=F=>{const fe=L.current,ye=F.target;if(ye.closest('[data-role="remove"]')){if(F.preventDefault(),Oe())return;const Lt=el(ye);V&&(Lt==null?void 0:Lt.dataset.uid)===V.uid&&_e("remove"),Lt!=null&&Lt.dataset.uid&&We(Lt.dataset.uid),B(null);return}const Ze=el(ye),Pe=Ze==null?void 0:Ze.getBoundingClientRect();if(!(!!Ze&&!!Pe&&F.clientX-Pe.left>Ih&&Pe.right-F.clientX>Ih)){if(Xee(fe))return;Sk(fe,F.clientX,F.clientY);return}Sk(fe,F.clientX,F.clientY);const Ot=Ze.dataset.uid??null;if(Ot&&(V==null?void 0:V.uid)===Ot){F.detail!==0&&_e("outside");return}const _t=Vu(ks(Ze.dataset.tok??""));if(!_t){se(Ze);return}Re(Ze,_t,So(fe),!1)},It=F=>{if(F.pointerType!=="mouse")return;const fe=L.current;if(V||D||fe&&"chipDrag"in fe.dataset)return;const ye=el(F.target),Ze=ye==null?void 0:ye.dataset.uid;if(!ye||!Ze||!Mt(ye)){U.close();return}if((I==null?void 0:I.uid)===Ze){U.keep();return}U.open({uid:Ze,anchor:ye})},Mt=F=>{const fe=ks(F.dataset.tok??"");if(n6(fe))return!0;const ye=Vu(fe);return!!(ye&&ye!=="color"&&dp(ye)&&F.querySelector("img"))},Zt=F=>{const fe=el(F.target),ye=fe==null?void 0:fe.dataset.uid;!fe||!ye||V||D||Mt(fe)&&Ym(fe)&&U.open({uid:ye,anchor:fe})},Rt=F=>{if(F.pointerType==="mouse")return;const fe=F.target;if(fe.closest('[data-role="remove"]'))return;const ye=el(fe);if(!ye)return;const Ze=ye.getBoundingClientRect();if(F.clientX-Ze.left<=Ih||Ze.right-F.clientX<=Ih)return;const Pe=Eae(ks(ye.dataset.tok??""));if(!Pe||ye.dataset.uid&&(V==null?void 0:V.uid)===ye.dataset.uid)return;F.preventDefault();const ct=L.current,Ot=document.activeElement===ct,_t=Ot?So(ct):H.current;Ot&&(ct==null||ct.blur()),Re(ye,Pe,_t,!0)},Tt=F=>{const fe=L.current,ye=el(F.target);if(ye&&!V){const Ze=()=>{yc(fe,ye,"after"),fe==null||fe.focus({preventScroll:!0})};if(F.altKey&&(F.key==="ArrowLeft"||F.key==="ArrowRight")){F.preventDefault(),fe&&jk(fe,ye,F.key==="ArrowLeft"?-1:1)&&(ye.focus({preventScroll:!0}),Ue(),P(O4(fe,ye)));return}if(F.key==="ArrowLeft"||F.key==="ArrowRight"){F.preventDefault(),yc(fe,ye,F.key==="ArrowLeft"?"before":"after"),fe==null||fe.focus({preventScroll:!0});return}if(F.key==="Tab"){F.preventDefault(),yc(fe,ye,F.shiftKey?"before":"after"),fe==null||fe.focus({preventScroll:!0});return}if(F.key==="Enter"||F.key===" "){F.preventDefault();const Pe=Vu(ks(ye.dataset.tok??""));Pe&&fe?Re(ye,Pe,no(fe,ye)+1,!1):se(ye);return}if(F.key==="Backspace"||F.key==="Delete"){if(F.preventDefault(),Oe())return;const Pe=ye.dataset.uid?We(ye.dataset.uid):null;fe==null||fe.focus({preventScroll:!0}),Pe!=null&&Ua(fe,Pe);return}if(F.key==="Escape"){F.preventDefault(),Ze();return}}if(F.key==="Escape"&&D){F.preventDefault(),B(null),q("");return}if(F.key==="Enter"&&!F.shiftKey){const Ze=F.defaultPrevented;F.preventDefault(),tae({menuOpen:!!D,handled:Ze})&&E();return}if(!(D||V)&&!Qse(F)){if(F.key==="Tab"&&!F.altKey&&!F.metaKey&&!F.ctrlKey){const Ze=lte(fe,F.shiftKey?"back":"forward");Ze&&(F.preventDefault(),Ze.focus({preventScroll:!0}));return}if(!F.shiftKey&&!F.altKey&&!F.metaKey&&!F.ctrlKey){if(F.key==="ArrowLeft"||F.key==="ArrowRight"){ite(fe,F.key==="ArrowLeft"?"left":"right")&&F.preventDefault();return}if(F.key==="Backspace"||F.key==="Delete"){const Ze=Ek(fe,F.key);if(Ze!=null&&Ze.dataset.uid){if(F.preventDefault(),Oe())return;const Pe=We(Ze.dataset.uid);Pe!=null&&Ua(fe,Pe);return}if(Ck(fe,F.key)){F.preventDefault();return}}}if((F.key==="$"||F.key==="/"||F.key==="@"||F.key==="#")&&!Oe()){const Ze=L.current,Pe=VR(Ze),ct=Pe.slice(-1);if(Pe.length&&!/[\s\u00a0]/.test(ct))return;q(""),Q(E0(F.key)),B({anchor:{getBoundingClientRect:()=>ZR()??(Ze==null?void 0:Ze.getBoundingClientRect())??new DOMRect},sigil:F.key})}}},Ee=s.useCallback(F=>{var fe,ye;return(ye=ea((fe=r.json)==null?void 0:fe.palette).find(Ze=>Ze.hex===F))==null?void 0:ye.name},[(Ft=r.json)==null?void 0:Ft.palette]),Je=s.useCallback(()=>{requestAnimationFrame(()=>{const F=T.current;if(!F)return;F.scrollHeight-F.scrollTop-F.clientHeight>1?F.dataset.more="":delete F.dataset.more})},[]);s.useEffect(()=>{const F=T.current;if(!F)return;Je();const fe=new ResizeObserver(Je);fe.observe(F);for(const ye of F.children)fe.observe(ye);return()=>fe.disconnect()},[Je]);const St=F=>{Je();const fe=L.current,ye=F==null?void 0:F.nativeEvent;if(ye!=null&&ye.isComposing)return;Qee(fe)||Co(fe),D0(fe)&&pc(fe);const Ze=he.current;he.current=!1;const Pe=_8(fe,Ot=>vt(Ot),{commit:Ze,nameFor:Ee});Pe&&(B(null),q(""));const ct=Pe?{open:!1}:nae(ate(fe),Ze);ct.open?D&&(ct.query!==z&&Q(E0(ct.sigil)),q(ct.query)):D&&(B(null),q("")),Ue()},qe=F=>{const fe=window.getSelection();if(!fe||fe.rangeCount===0||fe.isCollapsed)return null;const ye=fe.getRangeAt(0),{text:Ze,html:Pe}=cte(ye);return Ze?(F.clipboardData.setData("text/plain",Ze),F.clipboardData.setData("text/html",Pe),F.preventDefault(),ye):null},st=F=>{qe(F)},rt=F=>{const fe=qe(F);fe&&(fe.deleteContents(),Co(L.current),Ue())},Xt=s.useCallback(F=>F.t==="template"?a.some(fe=>fe.id===F.id):F.t==="product"?ue.some(fe=>fe.id===F.id)||l.some(fe=>fe.id===F.id):F.t==="character"?Se.some(fe=>fe.id===F.id)||i.some(fe=>fe.id===F.id):F.t==="mark"?Be.some(fe=>fe.hash===F.imageHash):!0,[a,ue,Se,i,l,Be]);s.useEffect(()=>{const F=L.current;if(F)for(const fe of F.querySelectorAll(`.${hc}[data-missing]`)){const ye=ks(fe.dataset.tok??"");ye&&Xt(ye)&&fe.replaceWith(vt(ye,fe.dataset.uid))}},[Xt,vt]);const Gt=F=>{Array.from(F.dataTransfer.types).includes("Files")&&(F.preventDefault(),ae.current++,J(!0))},sn=F=>F.preventDefault(),Ut=()=>{ae.current=Math.max(0,ae.current-1),ae.current===0&&J(!1)},An=F=>{F.preventDefault(),ae.current=0,J(!1),F.dataTransfer.files.length&&(C==null||C(F.dataTransfer.files))},Bt=F=>{F.preventDefault();const fe=F.clipboardData.files;if(fe.length&&Array.from(fe).some(Pe=>Pe.type.startsWith("image/"))){C==null||C(fe);return}he.current=!0;const ye=dte(F.clipboardData.getData("text/html"));if(ye&&ne(ye)){const Pe=L.current;_8(Pe,ct=>vt(ct),{commit:!0,nameFor:Ee})&&Ue();return}const Ze=F.clipboardData.getData("text/plain");Ze&&document.execCommand("insertText",!1,Ze)},ne=F=>{const fe=L.current,ye=window.getSelection();if(!fe||!ye||ye.rangeCount===0||!fe.contains(ye.getRangeAt(0).startContainer))return!1;const Ze=ye.getRangeAt(0);Ze.deleteContents();let Pe=!1,ct=Array.from(fe.querySelectorAll(`.${hc}`)).filter(un=>I0.has(un.dataset.kind??"")).length,Ot=!1;const _t=new Set,Lt=[];for(const un of F){if(typeof un=="string"){Lt.push(un);continue}if(!Xt(un)){Lt.push(toe(un,a,ue));continue}if(un.t==="template"){if(Pe)continue;Pe=!0}const Jn=qa(un);if(Jn){if(_t.has(Jn)||I8(fe,Jn))continue;_t.add(Jn)}if(I0.has(un.t)&&!(un.t==="template"&&w0(fe))){if(ct>=Kp){Ot=!0;continue}ct+=1}Lt.push(un)}Ot&&P(W4);const vn=Pe?w0(fe):null,qt=document.createDocumentFragment();for(const un of Lt)qt.appendChild(typeof un=="string"?document.createTextNode(un):vt(un));const Nn=qt.lastChild;Ze.insertNode(qt),vn&&vn.remove();const Qn=Nn?Nn.nodeType===Node.TEXT_NODE?Op(fe,Nn,Nn.length):Op(fe,fe,Array.from(fe.childNodes).indexOf(Nn)+1):So(fe)??0;return Co(fe),Ua(fe,Qn),Ue(),!0},ce=s.useCallback(()=>{requestAnimationFrame(()=>{const F=L.current;F&&document.activeElement===F&&D0(F)&&pc(F)})},[]),de=V?ks(V.anchor.dataset.tok??""):null,Ve=n6(de),Ie=(V==null?void 0:V.kind)==="scene"&&(de==null?void 0:de.t)==="template"?a.find(F=>F.id===de.id)??null:null,mt=Gae(Ie),bt=(de==null?void 0:de.t)==="template"&&de.view?((Ne=mt.find(F=>F.hash===de.view)??mt.find(F=>F.name===de.viewName))==null?void 0:Ne.view)??null:null,kt=async F=>{if(!V||(de==null?void 0:de.t)!=="template")return;const{uid:fe}=V,{id:ye,setup:Ze}=de;let Pe=(F==null?void 0:F.hash)??null;if(F&&!Pe)try{Pe=(await Ae.pickSceneView(ye,F.view)).hash}catch{return}oe(fe,{t:"template",id:ye,...Ze?{setup:Ze}:{},...F&&Pe?{view:Pe,viewName:F.name}:{}}),_e("pick")},nt=de?(g==null?void 0:g(de))??null:null,yt=de&&(w!=null&&w(de))?y??null:null,Ce=I?ks(I.anchor.dataset.tok??""):null,xe=n6(Ce),et=((Fe=I==null?void 0:I.anchor.querySelector("img"))==null?void 0:Fe.getAttribute("src"))??null,Ct=xe?mn(xe,"tile"):Ln(et,"tile"),ke=Vu(Ce),it=Ce&&dp(Ce.t)?Ce.t:ke&&ke!=="color"&&dp(ke)?ke:null,ft=Ce?(g==null?void 0:g(Ce))??null:null,$e=Ce&&(w!=null&&w(Ce))?y??null:null,Ke=Oe()?void 0:()=>{if(!V)return;const F=We(V.uid);_e("remove",F)};return o.jsxs("div",{className:"sc-brief",ref:T,onScroll:Je,"data-drag-over":ee||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?O0:void 0,"aria-activedescendant":D?me??void 0:void 0,"aria-label":m,"aria-placeholder":h,tabIndex:0,dir:"auto","data-ph":h,...p?{"data-ph-sm":p}:{},onClick:ot,onPointerDown:Rt,onPointerOver:It,onPointerLeave:F=>F.pointerType==="mouse"&&U.close(),onFocusCapture:Zt,onKeyDown:Tt,onInput:St,onCopy:st,onCut:rt,onPaste:Bt,onDragEnter:Gt,onDragOver:sn,onDragLeave:Ut,onDrop:An,onFocus:ce,onBlur:()=>{const F=L.current;_8(F,fe=>vt(fe),{commit:!0,nameFor:Ee})&&(B(null),q("")),Ue()}}),D&&o.jsx(gae,{anchor:D.anchor,composer:{getBoundingClientRect:()=>{var F,fe,ye;return((fe=(F=L.current)==null?void 0:F.closest(".sc-promptcard"))==null?void 0:fe.getBoundingClientRect())??((ye=L.current)==null?void 0:ye.getBoundingClientRect())??new DOMRect}},line:{getBoundingClientRect:()=>{var F;return((F=L.current)==null?void 0:F.getBoundingClientRect())??new DOMRect}},query:z,options:wt,remaining:at.remaining,total:at.total,sigil:D.sigil,onMore:Et,onActiveId:te,onClose:()=>{B(null),q("")}}),I&&Ct&&it&&o.jsx(Hd,{anchor:I.anchor,kind:it,src:Ct,label:ei(I.anchor),warning:ft,note:$e,onOpen:()=>{const F=I.anchor;if(xe){se(F);return}_(),b==null||b({src:Ct,kind:it,label:ei(F)})},onHoverIn:U.keep,onHoverOut:U.close,onClose:_},I.uid),(V==null?void 0:V.kind)==="ref"||(V==null?void 0:V.kind)==="mark"?o.jsx(_se,{kind:V.kind,label:ei(V.anchor),thumb:Ve?mn(Ve,"micro"):null,onInspect:()=>se(V.anchor),onMove:F=>Xe(V.uid,F),onRemove:Ke,onClose:_e},V.uid):(V==null?void 0:V.kind)==="color"?o.jsx(Fae,{anchor:V.anchor,currentHex:Fh(V.anchor),currentName:Jae(V.anchor),palette:ea((tt=r.json)==null?void 0:tt.palette),onPick:(F,fe)=>{var Ze;const ye=V.uid;if(fe!=null&&fe.live){const Pe=(Ze=L.current)==null?void 0:Ze.querySelector(`[data-uid="${CSS.escape(ye)}"]`);Pe&&wte(Pe,F),Ue();return}if(eoe(F.hex,Fh(V.anchor))){_e("pick");return}oe(ye,F),_e("pick")},onRemove:Ke,onMove:F=>Xe(V.uid,F),onClose:_e},V.uid):V?o.jsx(Pae,{kind:V.kind,anchor:V.anchor,currentId:Fh(V.anchor),candidates:ge(V.kind),brandId:r.id,brandSlug:r.slug,warning:nt,note:yt,onAttachRequest:S?F=>{_e("outside"),S(F)}:void 0,onPick:F=>{const fe=V.uid;if(F.id===Fh(V.anchor)){_e("pick");return}F.kind==="scene"?u(F.id):oe(fe,F.token),_e("pick")},onRemove:Ke,onMove:F=>Xe(V.uid,F),onClose:_e,views:V.kind==="scene"?{options:mt,picked:bt,onPick:kt}:void 0},V.uid):null]})});function Fh(e){const t=ks(e.dataset.tok??"");return t?t.t==="color"?t.hex:"id"in t?t.id:null:null}function Jae(e){const t=ks(e.dataset.tok??"");return(t==null?void 0:t.t)==="color"?t.name:void 0}function eoe(e,t){const n=e?ur(e):null,r=t?ur(t):null;return!!n&&n===r}function toe(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 _h(e,t){return t===null?e===null:e===t}function noe(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 ky({"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,m=i.current;if(!p||!m)return;let g=0;const w=()=>{const A=m.querySelector(":scope > button[data-on]");if(!A)return m.style.setProperty("--sc-ink-x","0px"),m.style.setProperty("--sc-ink-w","0px"),null;const L=A.querySelector(".sc-vlabel")??A;return m.style.setProperty("--sc-ink-x",`${A.offsetLeft+L.offsetLeft}px`),m.style.setProperty("--sc-ink-w",`${L.offsetWidth}px`),A},y=()=>{const A=m.scrollWidth-m.clientWidth;if(A<=1){delete p.dataset.overflowLeft,delete p.dataset.overflowRight;return}m.scrollLeft>2?p.dataset.overflowLeft="":delete p.dataset.overflowLeft,m.scrollLeft<A-2?p.dataset.overflowRight="":delete p.dataset.overflowRight},b=A=>{const L=m.scrollWidth-m.clientWidth;if(L<=0)return;const T=[...m.querySelectorAll(":scope > button")],M=T.indexOf(A);if(M<0)return;const j=72,R=m.scrollLeft,P=R+m.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 K=R;if(B>P)K=Math.min(L,B-m.clientWidth);else if(V<R)K=V;else return;if(Math.abs(K-R)<1)return;const U=window.matchMedia("(prefers-reduced-motion: reduce)").matches;m.scrollTo({left:K,behavior:U?"auto":"smooth"})},k=w();k&&b(k),y(),m.dataset.inkReady||requestAnimationFrame(()=>{m.dataset.inkReady=""});const S=()=>{g||(g=requestAnimationFrame(()=>{g=0,y()}))},E=A=>{if(m.scrollWidth<=m.clientWidth+1||Math.abs(A.deltaX)>Math.abs(A.deltaY)||A.deltaY===0)return;const L=m.scrollWidth-m.clientWidth,T=Math.max(0,Math.min(L,m.scrollLeft+A.deltaY));T!==m.scrollLeft&&(A.preventDefault(),m.scrollLeft=T,y())},C=new ResizeObserver(()=>{w(),y()});C.observe(m);for(const A of m.querySelectorAll(":scope > button"))C.observe(A);return m.addEventListener("scroll",S,{passive:!0}),m.addEventListener("wheel",E,{passive:!1}),()=>{g&&cancelAnimationFrame(g),C.disconnect(),m.removeEventListener("scroll",S),m.removeEventListener("wheel",E)}},[t,l]);const u=p=>{_h(t,p)||(a.current&&noe(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 m=Math.max(0,n.findIndex(b=>_h(t,b.value)));let g=m;if(p.key==="ArrowRight"?g=Math.min(n.length-1,m+1):p.key==="ArrowLeft"?g=Math.max(0,m-1):p.key==="Home"?g=0:p.key==="End"&&(g=n.length-1),g===m)return;u(n[g].value);const w=(y=i.current)==null?void 0:y.querySelectorAll(":scope > button")[g];w==null||w.focus()},h=n.findIndex(p=>_h(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,m)=>{const g=_h(t,p.value);return o.jsxs("button",{type:"button",role:"tab","aria-selected":g,"data-on":g?"":void 0,tabIndex:g||h<0&&m===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 Id({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=m=>{if(m.key!=="/"||m.metaKey||m.ctrlKey||m.altKey)return;const g=m.target;g!=null&&g.isContentEditable||g&&/^(input|textarea|select)$/i.test(g.tagName)||(m.preventDefault(),f())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[f,a]);const h=p=>{var m;p.key==="Escape"&&(p.stopPropagation(),e?t(""):(u(!1),(m=i.current)==null||m.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(fd,{size:16})}),o.jsxs("div",{className:"sc-libsearch-field",children:[o.jsx(fd,{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(Cn,{size:12,weight:"bold"})})]})]})}function nL({why:e,children:t}){return e?o.jsx(jw,{content:e,className:"sc-tip",maxWidth:"220px",children:LM(t)}):t}const roe=["All","Products","Presenters","Scenes","Colors","Brand","Shots"],Gp=roe.filter(e=>e!=="All"),OS={Products:"Products",Presenters:"Presenters",Scenes:"Scenes",Colors:"Brand colors",Brand:"Brand marks",Shots:"Shots"},soe={Products:"Product",Presenters:"Presenter",Scenes:"Scene",Colors:"Brand color",Brand:"Brand mark",Shots:"Reference shot"},K4={Products:"products",Presenters:"presenters",Scenes:"scenes",Colors:"brand colors",Brand:"brand marks",Shots:"shots"},aoe={Products:"square",Presenters:"square",Scenes:"square",Colors:"swatch",Brand:"square",Shots:"square"},rL={Products:132,Presenters:132,Scenes:132,Colors:132,Brand:132,Shots:132},G4={Products:96,Presenters:96,Scenes:96,Colors:96,Brand:96,Shots:96},IS=10;function ooe(e,t,n){const r=(n?G4:rL)[e];return r<=0||t<=0?1:Math.max(1,Math.floor((t+IS)/(r+IS)))}const ioe={product:"Products",presenter:"Presenters",scene:"Scenes"};function loe(e){const t=ioe[e.kind];return{key:qa(e.token),group:t,shape:aoe[t],label:e.label,sub:e.kind==="product"?e.sub:void 0,full:e.recommended?`${e.full} · Recommended`:e.full,search:e.search,thumb:Ln(e.thumb??null,"small"),crop:e.crop,recommended:e.recommended,bookmarked:e.bookmarked,token:e.token}}function coe(e){const t=n1(e).map(r=>{const a=r.hash,i=Gm(e,r);return{key:`m:${a}`,group:"Brand",shape:"square",label:i,full:`${i} · the mark itself`,search:i,thumb:mn(a,"micro"),token:{t:"mark",imageHash:a}}}),n=ea(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 uoe(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:mn(n.images[0],"micro"),token:{t:"ref",imageHash:n.images[0],label:"Shot"}}})}const FS=(e,t)=>Oo(`${e.label} ${e.sub??""} ${e.search}`,t),sL=`
106
+ `;function doe(e){return e.map(qa).filter(t=>t.length>0).join(sL)}function foe(e){return new Set(e?e.split(sL):[])}const hoe=new Set(["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"]);function poe(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 moe(e,t){const n=t.trim();return e==="All"?n?`Nothing matches “${n}”.`:"Nothing to add yet.":n?`No matching ${K4[e]}.`:e==="Shots"?"No finished shots yet.":`No ${K4[e]} yet.`}function goe(e){return[{value:null,label:"All",count:Gp.reduce((n,r)=>n+e[r],0)},...Gp.map(n=>({value:n,label:n,count:e[n]}))]}const voe=s.memo(function({card:t,index:n,active:r,ticked:a,why:i,onPick:l,onFocus:u}){const f=m=>{(m.key==="Enter"||m.key===" ")&&m.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(woe,{src:t.thumb,crop:t.crop}),o.jsxs("span",{className:"sc-ap-cap",children:[o.jsxs("span",{className:"sc-vh",children:[soe[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(mr,{className:"sc-ap-puck-add",size:11,weight:"bold"}),o.jsx(Kn,{className:"sc-ap-puck-on",size:11,weight:"bold"}),o.jsx(Cn,{className:"sc-ap-puck-off",size:11,weight:"bold"})]}),a&&o.jsx("span",{className:"sc-vh",children:" In the shot."})]});return o.jsx(nL,{why:h,children:p})});function woe({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(Pa,{size:16}):o.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async","data-crop":t,onError:()=>r(!0)})})}function _S({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(Rv,{size:22,"aria-hidden":!0})}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:"Upload image"})})]})}const yoe=48,boe={items:[],total:0,hasMore:!1,loading:!1,settled:!1,error:null,loadMore:()=>{}};function Sy(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),[m,g]=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),g(null);try{const A=await Ae.feed(e,{lens:"all",sort:"newest",q:r,limit:yoe,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;g(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:m,loadMore:k}:{...boe,loading:h,error:m,loadMore:k}}const r6={Products:"product",Presenters:"presenter",Scenes:"scene"};function xoe({brand:e,tab:t,onTab:n,only:r,activeProductCategory:a,refining:i,full:l,attached:u,phone:f,touch:h,onPick:p,onRemove:m,onUpload:g,onFiles:w,onClose:y}){const b=s.useRef(a).current,k=u1(b),S=s.useMemo(()=>new Set(ki(e.id)),[e.id]),E=Fl(),{applyBrand:C}=$n(),{push:A}=rr(),[L,T]=s.useState(!1),[M,j]=s.useState(""),R=s.useDeferredValue(M),[P,H]=s.useState(ul),[D,B]=s.useState(0),[V,K]=s.useState(f?347:696),U=s.useRef(null),I=s.useRef(null);s.useEffect(()=>{H(ul),B(0)},[t,R]),s.useLayoutEffect(()=>{const De=I.current;if(!De)return;const G=()=>K(De.clientWidth-2*Soe(De));G();const oe=new ResizeObserver(G);return oe.observe(De),()=>oe.disconnect()},[]);const _=s.useMemo(()=>({product:dl("product",k),presenter:dl("presenter",k),scene:dl("scene",k)}),[k]),O=s.useMemo(()=>coe(e.json),[e.json]),Y=Sy(e.id,R),z=s.useMemo(()=>uoe(Y.items,Y.total),[Y.items,Y.total]),q=s.useMemo(()=>{const De={};for(const G of Gp){const oe=r6[G];De[G]=G==="Shots"?Y.total:oe?ud(_[oe],R).length:O.filter(We=>We.group===G&&FS(We,R)).length}return De},[_,O,R,Y.total]),Z=s.useCallback((De,G)=>{const oe=r6[De];if(oe){const Oe=u2(oe,_[oe],{currentId:null,query:R,bookmarked:S,shown:G});return{group:De,items:Oe.items.map(loe),total:Oe.total,remaining:Oe.remaining}}if(De==="Shots"){const Oe=z.slice(0,G),ie=Y.hasMore?Math.max(1,Y.total-z.length):Math.max(0,z.length-G);return{group:De,items:Oe,total:Y.total,remaining:ie}}const We=O.filter(Oe=>Oe.group===De&&FS(Oe,R));return{group:De,items:We.slice(0,G),total:We.length,remaining:Math.max(0,We.length-G)}},[_,O,R,S,z,Y.hasMore,Y.total]),Q=s.useMemo(()=>{if(t==="All"){const De=[];for(const G of Gp){const oe=ooe(G,V,f),We=Z(G,f&&De.length===0?Math.max(1,oe-1):oe);We.items.length>0&&De.push(We)}return De}return[Z(t,t==="Shots"?Number.MAX_SAFE_INTEGER:P)]},[t,Z,P,V,f]),{flat:me,navGroups:te}=s.useMemo(()=>{const De=[],G=[];for(const oe of Q)oe.items.length&&(G.push({start:De.length,end:De.length+oe.items.length-1}),De.push(...oe.items));return{flat:De,navGroups:G}},[Q]);s.useEffect(()=>{B(De=>Math.max(0,Math.min(De,me.length-1)))},[me.length]);const he=s.useCallback(De=>{var oe;const G=(oe=I.current)==null?void 0:oe.querySelector(`[data-nav="${De}"]`);G&&(B(De),G.focus({preventScroll:!0}),G.scrollIntoView({block:"nearest"}))},[]),re=s.useRef(null),ee=s.useRef(()=>{});ee.current=()=>{const De=Q[0];!De||t==="All"||De.remaining<=0||(De.group==="Shots"?Y.loading||Y.loadMore():H(G=>G+ul))},s.useEffect(()=>{const De=re.current,G=I.current;if(!De||!G)return;const oe=new IntersectionObserver(We=>{We.some(Oe=>Oe.isIntersecting)&&ee.current()},{root:G,rootMargin:"0px 0px 240px 0px"});return oe.observe(De),()=>oe.disconnect()},[t,Q]);const J=s.useCallback(De=>{var oe,We;const G=me[De];G&&(u.has(G.key)?m(G):p(G),h&&((We=(oe=document.activeElement)==null?void 0:oe.blur)==null||We.call(oe)))},[me,u,h,p,m]),ae=De=>{const G=De.clipboardData.files;!G.length||!Array.from(G).some(oe=>oe.type.startsWith("image/"))||(De.preventDefault(),w(G))},Me=De=>{var ie,X;const G=De.target,oe=G instanceof HTMLInputElement&&!!((ie=U.current)!=null&&ie.contains(G));if(De.key==="Escape"){if(oe)return;De.preventDefault(),De.stopPropagation(),y();return}if(oe){De.key==="ArrowDown"?(De.preventDefault(),De.stopPropagation(),he(0)):De.key==="Enter"&&(De.preventDefault(),De.stopPropagation(),J(0));return}if(!hoe.has(De.key)||(De.stopPropagation(),G.closest('[role="tablist"]')))return;const We=G.closest("[data-nav]");if(!We)return;De.preventDefault();const Oe=poe(D,De.key,koe(We.closest(".sc-ap-grid")),te);if(Oe==="search"){const se=U.current;(X=(se==null?void 0:se.querySelector(".sc-libsearch[data-open] input"))??(se==null?void 0:se.querySelector(".sc-libsearch-toggle")))==null||X.focus()}else Oe!=null&&he(Oe)},ue=async De=>{T(!0);try{const G=await kN(e.id,De);C(G);const oe=G.logoHash;oe&&p({key:`m:${oe}`,group:"Brand",shape:"square",label:"Logo",full:"Logo",search:"",token:{t:"mark",imageHash:oe}});const We=G.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(G){A(on(G,"Could not upload that logo"))}finally{T(!1)}},Se=De=>E(De,{onCreated:G=>{if(G.kind===De){if(G.kind==="product"){const oe={t:"product",id:G.id};p({key:qa(oe),group:"Products",shape:"square",label:"Product",full:"",search:"",token:oe});return}if(G.kind==="presenter"){const oe={t:"character",id:G.id};p({key:qa(oe),group:"Presenters",shape:"square",label:"Presenter",full:G.name,search:G.name,token:oe});return}n("Scenes")}}}),Be=async De=>{var We;const G=rR((We=e.json)==null?void 0:We.palette,De);if(!G.swatch)return;if(G.added)try{const Oe=await Ae.updateBrand(e.id,{...e.json??{},palette:G.palette},e.json);C(Oe)}catch(Oe){A(on(Oe,"Could not save the brand"));return}const oe={t:"color",hex:G.swatch.hex,name:G.swatch.name};p({key:qa(oe),group:"Colors",shape:"swatch",label:G.swatch.name,full:"",search:"",swatch:G.swatch.hex,token:oe})},vt=De=>i&&De==="Scenes"?"Scenes set up a new shot. Press X on Refining to use one.":l&&De!=="Colors"?l:null,Ue=me.length===0;let Xe=0;return o.jsxs("div",{className:"sc-ap-inner",onKeyDown:Me,onPaste:ae,children:[o.jsxs("div",{className:"sc-ap-head",ref:U,children:[o.jsx("div",{className:"sc-ap-tabs",children:o.jsx(ky,{"aria-label":"What to add",activeKey:t==="All"?null:t,items:goe(q),onSelect:De=>n(De??"All")})}),o.jsxs("div",{className:"sc-ap-actions",children:[o.jsxs("div",{className:"sc-ap-actions-add",children:[o.jsx(Id,{value:M,onChange:j,noun:t==="All"?"everything":K4[t],total:t==="All"?void 0:q[t],shortcut:!1}),!f&&o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary sc-ap-upload",onClick:g,title:"Add an image from your computer. It joins the shot as a reference.",children:[o.jsx(Rv,{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(Cn,{size:14})})]})]}),o.jsxs("div",{className:"sc-ap-body",ref:I,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."}),Q.map((De,G)=>{var se,Re,_e;const oe=vt(De.group),We=Xe;Xe+=De.items.length;const Oe=r6[De.group],X={"--ap-min":`${(f?G4:rL)[De.group]}px`,"--ap-lines":Oe==="product"?2:1};return o.jsxs("section",{className:"sc-ap-group","aria-label":OS[De.group],children:[o.jsxs("div",{className:"sc-ap-sec",children:[o.jsxs("span",{className:"sc-ap-sec-title",children:[OS[De.group],o.jsx("span",{className:"sc-ap-sec-n",children:De.total})]}),t==="All"&&De.total>De.items.length&&o.jsxs("button",{type:"button",className:"sc-ap-sec-act",onClick:()=>n(De.group),children:["Show all ",De.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(yd,{className:"sc-ap-sec-act sc-ap-add",triggerStyle:{background:"none"},value:e2(ea((se=e.json)==null?void 0:se.palette)),presets:ea((Re=e.json)==null?void 0:Re.palette).map(Ye=>Ye.hex),commitMode:"close",align:"end",label:"Add color",onChange:Ye=>void Be(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 Qe;const ge=(Qe=Ye.target.files)==null?void 0:Qe[0];Ye.target.value="",ge&&ue(ge)}}),"Add logo"]})]}),o.jsxs("div",{className:"sc-ap-grid","data-shape":((_e=De.items[0])==null?void 0:_e.shape)??"square",style:X,children:[f&&G===0&&!r&&o.jsx(_S,{onClick:g}),De.items.map((Ye,ge)=>o.jsx(voe,{card:Ye,index:We+ge,active:We+ge===D,ticked:u.has(Ye.key),why:oe,onPick:J,onFocus:B},Ye.key))]}),t!=="All"&&De.remaining>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:re,className:"sc-ap-sentinel","aria-hidden":!0}),o.jsxs("p",{className:"sc-ap-foot","aria-live":"polite",children:[De.items.length," of ",De.total]})]})]},De.group)}),t==="Shots"&&Y.error&&o.jsxs("p",{className:"sc-ap-empty",children:["Could not load the shots. ",Y.error]}),Ue&&f&&o.jsx("div",{className:"sc-ap-grid",style:{"--ap-min":`${G4.Products}px`},children:o.jsx(_S,{onClick:g})}),Ue&&!(t==="Shots"&&(!Y.settled||Y.loading||Y.error))&&o.jsx("p",{className:"sc-ap-empty",children:moe(t,M)})]})]})}function koe(e){return e?Math.max(1,getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length):1}function Soe(e){return Number.parseFloat(getComputedStyle(e).paddingLeft)||0}const Eoe="(pointer: coarse)";function Coe(e){const t=Mr(aa),n=Mr(Eoe),[r,a]=s.useState(e.initialTab??"All");s.useEffect(()=>{a(e.initialTab??"All")},[e.initialTab,e.tabNonce]);const[i]=El(),l=i.get("new")!==null;return o.jsx(joe,{id:e.id,phone:t,touch:n,creating:l,onClose:e.onClose,children:o.jsx(xoe,{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 joe({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,m;n&&((m=(p=document.activeElement)==null?void 0:p.blur)==null||m.call(p))},[n]),s.useLayoutEffect(()=>{var y,b;const p=l.current,m=p==null?void 0:p.parentElement;if(!t||!p||!m)return;const g=()=>{const k=p.closest(".sc-shell")??document.documentElement,S=Number.parseFloat(getComputedStyle(k).getPropertyValue("--sc-topbar-h"))||0,E=m.getBoundingClientRect().top-S-16;p.style.setProperty("--ap-avail",`${Math.max(160,Math.round(E))}px`)};g();const w=new ResizeObserver(g);return w.observe(m),window.addEventListener("resize",g),(y=window.visualViewport)==null||y.addEventListener("resize",g),(b=window.visualViewport)==null||b.addEventListener("scroll",g),()=>{var k,S;w.disconnect(),window.removeEventListener("resize",g),(k=window.visualViewport)==null||k.removeEventListener("resize",g),(S=window.visualViewport)==null||S.removeEventListener("scroll",g)}},[t]),s.useEffect(()=>{const p=m=>{var w;if(m.key!=="Escape"||r)return;const g=document.activeElement;g instanceof HTMLInputElement&&((w=l.current)!=null&&w.contains(g))||(m.preventDefault(),m.stopPropagation(),f.current())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[r]);const h=p=>{var w;const m=document.activeElement,g=p.target;m instanceof HTMLInputElement&&((w=l.current)!=null&&w.contains(m))&&!g.closest("input")&&m.blur(),I4(p)};return s.useEffect(()=>{const p=m=>{if(r)return;const g=m.target;g.closest('[data-guide="catch"], [data-guide="card"], [data-guide="inline"]')||document.querySelector('[data-guide="catch"]')||g.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 Aoe({target:e,onOpenImage:t,onClear:n}){var f;const r=Od(),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()||Hr(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:mn(a,"micro"),alt:""}):o.jsx("span",{className:"sc-target-thumb",children:o.jsx(Na,{})}),"Refining",n&&o.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),r.closeNow(),n()},"aria-label":"Make a new shot instead",children:o.jsx(Cn,{size:12})})]}),r.shown&&a&&o.jsx(Hd,{anchor:r.shown.anchor,kind:"shot",src:mn(a,"tile"),label:l,noun:"Refining this shot",onOpen:u,onHoverIn:r.keep,onHoverOut:r.close,onClose:r.closeNow})]})}function Sd({src:e,kind:t,label:n,noun:r,actions:a,onRestoreFocus:i,onClose:l}){const[u,f]=s.useState(!1),h=r??zP[t],p=s.useRef(null);return o.jsxs(Us,{className:"sc-lightbox",maxWidth:"min(880px, 92vw)",onOpenAutoFocus:()=>{p.current=document.activeElement},onCloseAutoFocus:m=>{var g;if(m.preventDefault(),i)return i();(g=p.current)!=null&&g.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(Cn,{size:16})})})}),o.jsx("div",{className:"sc-lightbox-frame","data-kind":t,children:u?o.jsxs("span",{className:"sc-lightbox-blank",children:[o.jsx(Pa,{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 Noe={"codex-cli":{sizing:"advisory"},openrouter:{sizing:"ratio"},replicate:{sizing:"ratio"},fal:{sizing:"exact"},demo:{sizing:"exact"}},Moe={sizing:"exact"},aL=e=>Noe[e]??Moe;function Roe(e,t){const n=aL(e).formats;return!n||n.includes(t)}const Ey=e=>aL(e).sizing,Poe="portrait",Loe=1,$oe="standard",si=[{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"}],Yp=[1,2,3,4],oL=e=>Yr.filter(t=>!Roe(e,t.id)).map(t=>t.id),Y4=(e,t)=>t.length===0?void 0:`${e} cannot make ${Yr.filter(n=>t.includes(n.id)).map(n=>n.hint).join(" or ")}.`,Cy=e=>{var n;e.preventDefault();const t=e.currentTarget??e.target;(n=t==null?void 0:t.querySelector('[role="radiogroup"]'))==null||n.focus()};function s6({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(md,{open:r,onOpenChange:a,children:[o.jsx(gd,{children:o.jsx("button",{type:"button",className:"sc-var","aria-label":e,"data-guide":u,children:n})}),o.jsx(vd,{ref:f,className:"sc-setpop",align:"end",sideOffset:8,width:t,onOpenAutoFocus:Cy,onCloseAutoFocus:l,onInteractOutside:h=>{var p;(p=h.target)!=null&&p.closest(".sc-prompt-pills")&&h.preventDefault()},children:i(()=>a(!1))})]})}function Toe({mode:e,engineId:t,engineName:n,formatId:r,onFormat:a,count:i,onCount:l,quality:u,onQuality:f,onCloseAutoFocus:h,guided:p=!1,onSettle:m}){const g=Yr.find(T=>T.id===r)??Yr[0],w=si.find(T=>T.id===u)??si[1],y=oL(t),b=Ey(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&&(m==null||m(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(s6,{...L("aspect"),aria:`Aspect ${g.label}, ${g.hint}`,width:"178px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(A4,{w:g.w,h:g.h,slot:15,box:13}),g.label]}),children:T=>o.jsxs(o.Fragment,{children:[o.jsx(ti,{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(ni,{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(A4,{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(Q5,{})]},M.id))}),Y4(n,y)&&o.jsx(hQ,{children:Y4(n,y)})]})}),e==="generation"&&o.jsx(s6,{...L("variants"),aria:`${i} shot${i===1?"":"s"}`,width:"156px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(XE,{size:14}),i]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(ti,{label:"Shots",className:"sc-seg",value:String(i),ids:Yp.map(String),onChange:M=>l(Number(M)),children:Yp.map(M=>o.jsx(ni,{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(s6,{...L("resolution"),aria:`Resolution ${w.label}, ${w.edge} px`,width:"192px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(wE,{size:14}),w.label]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(ti,{label:"Resolution",className:"sc-setpop-list",value:u,ids:si.map(M=>M.id),onChange:M=>f(M),children:si.map(M=>o.jsxs(ni,{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(Q5,{})]},M.id))})})})]})}function iL({mode:e,engineId:t,engineName:n,formatId:r,onFormat:a,count:i,onCount:l,quality:u,onQuality:f,engineChoices:h,onEngine:p}){const m=oL(t),g=Ey(t);return o.jsxs(o.Fragment,{children:[h&&p&&h.length>1&&o.jsx(Vh,{label:"Engine",children:o.jsx(ti,{label:"Engine",className:"sc-seg",value:t,ids:h.map(w=>w.id),onChange:p,children:h.map(w=>o.jsx(ni,{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(Vh,{label:"Aspect ratio",note:Y4(n,m),children:o.jsx(ti,{label:"Aspect ratio",className:"sc-seg",value:r,ids:Yr.map(w=>w.id),unavailable:m,onChange:a,children:Yr.map(w=>o.jsxs(ni,{id:w.id,className:"sc-seg-o sc-seg-ratio",on:w.id===r,unavailable:m.includes(w.id),label:`${w.label}, ${w.hint}`,onPick:()=>a(w.id),children:[o.jsx(A4,{w:w.w,h:w.h,slot:17,box:14}),w.hint]},w.id))})}),e==="generation"&&o.jsx(Vh,{label:"Shots",children:o.jsx(ti,{label:"Shots",className:"sc-seg",value:String(i),ids:Yp.map(String),onChange:w=>l(Number(w)),children:Yp.map(w=>o.jsx(ni,{id:String(w),className:"sc-seg-o",on:w===i,label:`${w} shot${w===1?"":"s"}`,onPick:()=>l(w),children:w},w))})}),e==="generation"&&g!=="ratio"&&o.jsx(Vh,{label:"Resolution",note:g==="advisory"?"This engine renders at its own size, so this is a request rather than a guarantee.":void 0,children:o.jsx(ti,{label:"Resolution",className:"sc-seg",value:u,ids:si.map(w=>w.id),onChange:w=>f(w),children:si.map(w=>o.jsx(ni,{id:w.id,className:"sc-seg-o",on:w.id===u,label:g==="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 Vh({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 Doe({guide:e,onSettle:t,...n}){const[r,a]=s.useState(!1),i=f=>{!f&&r&&(t==null||t()),a(f)},{sheet:l,grip:u}=Ld(()=>i(!1));return o.jsxs(Al,{open:r,onOpenChange:i,children:[o.jsx(Fv,{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(Mv,{size:16})})}),o.jsxs(Nl,{children:[o.jsx(Ml,{className:"sc-shotsheet-scrim"}),o.jsxs(Rl,{ref:l,className:"sc-shotsheet","aria-describedby":void 0,onOpenAutoFocus:Cy,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(Pl,{className:"sc-vh",children:"Shot settings"})]}),o.jsx(iL,{...n})]})]})]})}const lL=e=>e.t==="template"&&typeof e.view=="string"&&Object.hasOwn(ed,e.view);async function Hoe(e){return Promise.all(e.map(async t=>{if(t.t!=="template"||!lL(t))return t;const{view:n,viewName:r,...a}=t,i=await Ae.pickSceneView(t.id,n).then(l=>l.hash,()=>null);return i?{...a,view:i,...r?{viewName:r}:{}}:a}))}function VS(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 Ooe(e,t){return e>0&&t>0&&Math.abs(Math.log(t))<Math.abs(Math.log(e))-.01?"crop":"extend"}const a6=2,Ioe=.15;function Foe(e,t){if(Ooe(e,t)==="crop")return"crop";if(!(e>0&&t>0))return"extend";const n=t>e?t/e:e/t;return(n>a6?Math.max(a6,n*(1-Ioe)):n)>a6+1e-9?"crop":"extend"}const q4=4,qp=24,G0=24,cL={product:[],presenter:[],scene:null,ref:[],color:[]};function _oe(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 Voe(e){return`${e.product.join(",")}|${e.presenter.join(",")}|${e.scene??""}|${e.ref.join(",")}|${e.color.join(",")}`}function Zoe(e,t,n){const r=e.slice(0,n);return{visible:r,more:Math.max(0,e.length-r.length)}}const jy=s.forwardRef(function({projectId:t,brand:n,engines:r,parentId:a,initialBrief:i,suppressDraftRestore:l,startScene:u,startSetup:f,startPresenter:h,startProduct:p,startRef:m,startView:g,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:R,persistDraft:P=!0,variant:H="dock",guided:D=!1},B){var _d,w1;const{products:V,productsLoaded:K}=cn(),{demoProducts:U,demoProductsLoaded:I,loaded:_}=$n(),O=u1(),Y=O.scenes,z=O.presenters,q=Ol(),Z=Il(),{push:Q}=rr(),me=r.filter(ve=>ve.available),[te,he]=ja(qr.engine,wf);s.useEffect(()=>{const ve=YQ(me,te);ve!==te&&he(ve)},[me,te,he]);const re=me.length===0&&r.some(ve=>ve.code==="not-installed"||ve.code==="not-authenticated"),ee=me.length===0,J=ee?re?{icon:o.jsx(lR,{}),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(ef,{size:15}),title:"No image provider connected",detail:"Add a provider key and this prompt is ready to run.",action:"Open settings",onAct:()=>q("engines"),info:!1}:null,[ae,Me]=s.useState(Jo()),[ue,Se]=s.useState(void 0),[Be,vt,Ue,Xe]=y8(qr.format,Poe),[De,G]=s.useState({}),oe=A&&A.kind!=="root"?A:null,We=oe?Xae(oe.brief):void 0,Oe=oe?De[oe.id]??We??Be:Be,ie=ve=>{oe?G(ht=>({...ht,[oe.id]:ve})):vt(ve)},[X,se]=s.useState({}),[Re,_e,Ye,ge]=y8(qr.count,Loe),[Qe,at]=s.useState(!1),[wt,Et]=s.useState(null),[ot,It]=s.useState(null),[Mt,Zt]=s.useState(!1),[Rt,Tt]=s.useState("All"),[Ee,Je]=s.useState(0),[St,qe]=s.useState(null),[st,rt,Xt,Gt]=y8(qr.quality,$oe),[sn,Ut]=s.useState(!1),[An,Bt]=s.useState(!1),ne=ve=>Bt(ve);Mr("(hover: hover) and (min-width: 1024px)");const ce=Mr("(max-width: 767px)"),de=s.useRef(null),Ve=s.useRef(null),Ie=s.useRef(null),mt=s.useId(),bt={...Xe?{format:Xe}:{},...ge?{count:ge}:{},...Gt?{quality:Gt}:{}},kt=s.useRef({tokens:ae,tplFields:X,branchId:(A==null?void 0:A.id)??null,lent:bt});kt.current={tokens:ae,tplFields:X,branchId:(A==null?void 0:A.id)??null,lent:bt};const nt=s.useRef(null),yt=s.useRef(null),Ce=s.useRef(null),xe=s.useRef(void 0),et=s.useRef(void 0),Ct=s.useRef(void 0),ke=s.useRef(void 0),it=s.useCallback(ve=>{if(Ce.current&&(clearTimeout(Ce.current),Ce.current=null),!P)return;const ht=kt.current;if(ht.branchId)return;const en=nt.current??ht.tokens;A8(en,ht.tplFields)?Pw(ve,{tokens:en,tplFields:ht.tplFields,setSlug:R,lent:ht.lent}):R5(ve)},[R,P]);s.useEffect(()=>{b&&(Tt(b),Zt(!0))},[b]);const ft=s.useCallback(ve=>{if(!ve.some(lL)){nt.current=null,Se(ve);return}nt.current=ve,Hoe(ve).then(ht=>{nt.current===ve&&(nt.current=null,Se(ht))})},[]),$e=ve=>{Ue(ve.format&&Yr.some(ht=>ht.id===ve.format)?ve.format:null),Ye(ve.count??null),Xt(ve.quality&&si.some(ht=>ht.id===ve.quality)?ve.quality:null)};s.useEffect(()=>{if(!i)return;const ve=(i.tokens??[]).find(ht=>ht.t==="format");ve&&Ue(ve.id),Ye(i.variants??null),i.quality&&Xt(i.quality),se(i.templateFields??{}),ft(ry(i))},[i]),s.useEffect(()=>{var y1;const ve=yt.current,ht=!!ve&&ve!==n.id;ht&&it(ve);const en=!P||!ht&&(!!i||!!l),hn=ve!==n.id;let nn=null,jn=null,Wr=null;if(!en&&hn){const Dn=M5(n.id);Dn&&A8(Dn.tokens,Dn.tplFields)?(nn=sp(n,Dn.tokens),jn=Dn.tplFields,Wr=Dn.lent??null):ht&&(nn=Jo(),jn={})}ht&&(Ue(null),Ye(null),Xt(null),G({}));const In=!!u&&u!==xe.current||!!h&&h!==et.current||!!p&&p!==Ct.current||!!m&&!u&&m!==ke.current;let sr=null;if(w&&In){const Dn=hn?null:kt.current,es=nn??(Dn?nt.current??Dn.tokens:null),ws=jn??(Dn==null?void 0:Dn.tplFields)??{};es&&A8(es,ws)&&(sr={tokens:es,tplFields:ws,lent:Wr??(Dn==null?void 0:Dn.lent)??null}),nn=Jo(),jn={},Wr=null,Ue(null),Ye(null),Xt(null)}const or=()=>hn?Jo():kt.current.tokens;let Da=!1;if(u&&u!==xe.current){xe.current=u,Da=!0;const Dn=nn??or(),es=Dn.find(Ha=>Ha.t==="template"),ws=(es==null?void 0:es.id)??null,E2=((y1=Y.find(Ha=>Ha.id===u))==null?void 0:y1.name)??"this scene",Vd=VS(ws,u,E2,null,null),ru=m&&/^[a-f0-9]{32}$/.test(m)?m:null,b1=g&&g in ed?ed[g]:void 0;if((Vd.changed||ru)&&(nn=[{t:"template",id:u,...f?{setup:f}:{},...ru?{view:ru,...b1?{viewName:b1}:{}}:{}},...Dn.filter(Ha=>Ha.t!=="template")],Vd.toast)){const Ha=Vd.toast;Q({kind:"info",title:Ha.title,action:{label:"Undo",onClick:()=>{var x1,k1;Ha.prevSceneId?(x1=de.current)==null||x1.insert({t:"template",id:Ha.prevSceneId}):(k1=de.current)==null||k1.removeTemplate()}}})}}if(h&&h!==et.current){et.current=h,Da=!0;const Dn=nn??or();Dn.some(ws=>ws.t==="character"&&ws.id===h)||(nn=[...Dn,{t:"character",id:h}])}if(p&&p!==Ct.current){Ct.current=p,Da=!0;const Dn=nn??or();Dn.some(ws=>ws.t==="product"&&ws.id===p)||(nn=[...Dn,{t:"product",id:p}])}if(m&&!u&&/^[a-f0-9]{32}$/.test(m)&&m!==ke.current){ke.current=m,Da=!0;const Dn=nn??or();Dn.some(ws=>ws.t==="ref"&&ws.imageHash===m)||(nn=[...Dn,{t:"ref",imageHash:m,label:"Scene view"}])}if(nn&&(ft(nn),jn&&se(jn)),Wr&&$e(Wr),sr){const Dn=sr,es=n.id;Q({kind:"info",title:"Started a new shot",action:{label:"Undo",onClick:()=>PY(es,{tokens:Dn.tokens,tplFields:Dn.tplFields,setSlug:R,lent:Dn.lent??void 0})}})}Da&&(y==null||y()),yt.current=n.id},[n.id,u,h,p,m]),s.useEffect(()=>{var ve;ue&&((ve=de.current)==null||ve.setTokens(ue),Se(void 0))},[ue]);const Ke=s.useMemo(()=>{var nn;const ve=Yr.find(jn=>jn.id===Oe)??Yr[0],en=(((nn=si.find(jn=>jn.id===st))==null?void 0:nn.edge)??1024)/Math.max(ve.w,ve.h),hn=jn=>Math.max(256,Math.round(jn*en/8)*8);return{t:"format",id:ve.id,w:hn(ve.w),h:hn(ve.h)}},[Oe,st]),Pt=s.useMemo(()=>[Ke,...ae],[Ke,ae]),Yt=s.useMemo(()=>({tokens:Pt,templateFields:X,variants:Re,quality:st,format:Oe}),[Pt,X,Re,st,Oe]),jt=ae.some(ve=>ve.t==="text"?!!ve.v.trim():!0),Ft=s.useMemo(()=>{const ve=ae.find(ht=>ht.t==="template");return ve?Y.find(ht=>ht.id===ve.id)??null:null},[ae,Y]),Ne=s.useMemo(()=>{const ve=ae.find(ht=>ht.t==="template");return(ve==null?void 0:ve.id)??null},[ae]),Fe=s.useCallback(ve=>{var jn,Wr;const ht=(Ft==null?void 0:Ft.id)??null,en=(A==null?void 0:A.id)??null,hn=((jn=Y.find(In=>In.id===ve))==null?void 0:jn.name)??"this scene",nn=VS(ht,ve,hn,en,A?Hr(A):null);if(nn.changed&&((Wr=de.current)==null||Wr.insert({t:"template",id:ve}),nn.toast)){const In=nn.toast;Q({kind:"info",title:In.title,action:{label:"Undo",onClick:()=>{var sr,or;In.prevSceneId?(sr=de.current)==null||sr.insert({t:"template",id:In.prevSceneId}):(or=de.current)==null||or.removeTemplate(),In.branchWasCleared&&en&&(j==null||j(en))}}})}},[Ft,A,Y,Q,j]);s.useImperativeHandle(B,()=>({insertToken:ve=>{var ht;return(ht=de.current)==null?void 0:ht.insert(ve)},removeToken:ve=>{var ht;return(ht=de.current)==null?void 0:ht.remove(ve)},applyScene:ve=>Fe(ve),removeTemplate:()=>{var ve;return(ve=de.current)==null?void 0:ve.removeTemplate()},openAttach:ve=>le(ve),showAttach:()=>{Te.current||le("All")},focus:()=>{var ve;return(ve=de.current)==null?void 0:ve.focus()},submit:()=>{po()}}));const tt=s.useMemo(()=>_oe(ae),[ae]),F=Voe(tt),fe=doe(ae),ye=s.useMemo(()=>foe(fe),[fe]),Ze=s.useRef(tt);Ze.current=tt,s.useEffect(()=>{E==null||E(Ze.current)},[F,E]),s.useEffect(()=>{var ve;!_||!Ne||Ft||((ve=de.current)==null||ve.removeTemplate(),Q({kind:"warning",title:"That scene is no longer available",detail:"Removed from the brief."}))},[_,Ne,Ft,Q]);const Pe=s.useRef(null);s.useEffect(()=>(Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>it(yt.current??n.id),500),()=>{Ce.current&&clearTimeout(Ce.current)}),[ae,X,Xe,ge,Gt,A==null?void 0:A.id,n.id,it]),s.useEffect(()=>P?NY():void 0,[P]),s.useEffect(()=>{if(!P)return;const ve=ht=>{const en=ht.detail;if(en!==(yt.current??n.id))return;const hn=M5(en);hn&&(ft(sp(n,hn.tokens)),se(hn.tplFields),$e(hn.lent??{}))};return window.addEventListener(w4,ve),()=>window.removeEventListener(w4,ve)},[P,n,ft]),s.useEffect(()=>()=>it(yt.current??n.id),[it]),s.useEffect(()=>{const ve=()=>it(yt.current??n.id);return window.addEventListener("beforeunload",ve),()=>window.removeEventListener("beforeunload",ve)},[it,n.id]);const ct=r.find(ve=>ve.id===te),Ot=ct?ml(ct.displayName):"This engine",_t=!!A&&A.kind!=="root"&&A.status==="running",Lt=A&&A.kind!=="root"&&A.status==="done"&&A.images.length>0||_t,vn=!!(ct!=null&&ct.supportsEdit),Nn=!!oe&&!!We&&We!==Oe&&Lt&&!Ft,Qn=Nn?Foe(pi(We),pi(Oe)):null,un=Qn==="crop",Jn=Qn==="extend"&&vn,tn=Yr.find(ve=>ve.id===Oe),gr=tn?`${tn.label} ${tn.hint}`:Oe,[Or,wn]=s.useState(null),oa=()=>{A!=null&&A.images[0]&&wn({src:Dr(A.images[0]),kind:"shot",label:Hr(A),noun:"Refining this shot"})},Tn=Lt&&!Ft&&(vn||un||Jn)?"edit":"generation",ia=Tn==="edit"&&!!A&&H!=="overlay",Ws=Lt?Ft?"A scene starts a new shot.":un||Jn||vn?null:`${(ct==null?void 0:ct.displayName)??"This engine"} cannot edit. This makes a new shot.`:null,an=s.useMemo(()=>{const ve=Yr.find(jn=>jn.id===Oe)??Yr[0],ht=`Aspect ${ve.label} ${ve.hint}`;if(Tn==="edit")return ht;const en=si.find(jn=>jn.id===st),hn=Ey(te),nn=hn==="ratio"||!en?null:hn==="advisory"?`${en.label}, asking for ${en.edge} px`:`${en.label} ${en.edge} px`;return[ht,`${Re} shot${Re===1?"":"s"}`,nn&&`resolution ${nn}`].filter(Boolean).join(", ")},[Tn,Oe,Re,st,te]),yn=s.useRef(void 0),Wn=s.useRef(void 0);s.useEffect(()=>{var hn;const ve=Lt?(A==null?void 0:A.id)??null:null,ht=ve!==yn.current&&yn.current!==void 0;yn.current=ve;const en=Ne!==Wn.current;Wn.current=Ne,!(!Ft||!Lt)&&(ht&&!en&&ve?(hn=de.current)==null||hn.removeTemplate():T==null||T())},[Ft,Ne,Lt,A,T]);const wr=(ot==null?void 0:ot.warnings.filter(ve=>ve.includes("built around a product")))??[],hr=Nn&&!jt,Mn=un&&jt,ps=z.length>0&&ae.some(ve=>ve.t==="character"&&!z.some(ht=>ht.id===ve.id)),lo=!Qe&&(jt||hr)&&!Mn&&!ps&&!!t&&!_t&&!L&&(un||!ee),co=ee&&!un?"Image generation is not set up yet":Qe?"Working on the last one":t?_t?"Wait for this version to finish, or press X to start a new shot":L?"Wait for this refinement to finish":Mn?"This shape is reached by cropping, and a crop uses no words. Clear the prompt, or keep the current shape.":ps?"Remove the presenter who is no longer in your roster":!jt&&!hr?"Write a prompt first":null:"Still opening this brand";s.useEffect(()=>{const ve=Tn==="edit"&&!!A;if(un||!jt&&!ve){It(null);return}Pe.current&&clearTimeout(Pe.current);const ht=Yt;return Pe.current=setTimeout(()=>{Ae.previewBrief(Yt,te,n.id,ve?A.id:void 0).then(en=>It({...en,forBrief:ht})).catch(()=>It(null))},280),()=>{Pe.current&&clearTimeout(Pe.current)}},[Yt,te,n.id,jt,Tn,A,un]);const yr=ve=>{var ht;ie(ve),(ht=de.current)==null||ht.focus()},Mi=ve=>{var ht;rt(ve),(ht=de.current)==null||ht.focus()},Ta=ve=>{var ht;_e(ve),(ht=de.current)==null||ht.focus()},uo=ve=>{var ht;ve.preventDefault(),(ht=de.current)==null||ht.focus()},le=ve=>{Tt(ve),Je(ht=>ht+1),Zt(!0)},Te=s.useRef(!1);Te.current=Mt;const lt=s.useRef(le);lt.current=le;const Wt=s.useCallback(({restore:ve})=>{var ht;Te.current&&(Te.current=!1,Zt(!1),ve&&((ht=de.current)==null||ht.restoreCaret()))},[]),ln=s.useRef(Fe);ln.current=Fe;const _n=s.useRef(ae);_n.current=ae;const On=s.useCallback(ve=>{var en;const ht=ve.token;ht.t==="template"?ln.current(ht.id):(en=de.current)==null||en.insert(ht)},[]),Rn=s.useCallback(ve=>{var en,hn;const ht=ve.token;ht.t==="template"?(en=de.current)==null||en.removeTemplate():(hn=de.current)==null||hn.remove(ht)},[]),bn=async ve=>{var en;if(!(ve!=null&&ve.length))return;const ht=Array.from(ve).filter(hn=>hn.type.startsWith("image/"));if(!ht.length){Q({kind:"warning",title:"Only images can be attached here"});return}Ut(!0),Et(null);try{for(const hn of ht.slice(0,4)){const nn=await uf(hn);(en=de.current)==null||en.insert({t:"ref",imageHash:nn,label:zoe(hn.name)})}ht.length>4&&Q({kind:"warning",title:"Only the first 4 images were attached",detail:`${ht.length-4} more ${ht.length-4===1?"was":"were"} skipped. Attach ${ht.length-4===1?"it":"them"} in another pick.`})}catch(hn){Et(String(hn.message??hn)),Q(on(hn,"Could not attach that image"))}finally{Ut(!1),Ie.current&&(Ie.current.value="")}},Ur=ot&&ot.forBrief===Yt?ot:null,Vl=s.useMemo(()=>ae.filter(ve=>I0.has(ve.t)).length,[ae]),fo=s.useRef(null),ms=s.useMemo(()=>Vl===0?(fo.current=null,null):(Ur&&(fo.current={cap:Yae(Ur),described:qae(Ur),preview:Ur}),fo.current),[Ur,Vl]),Jc=(ms==null?void 0:ms.cap)??null,gs=(ms==null?void 0:ms.preview)??null,ho=(ct==null?void 0:ct.displayName)??"This engine",Zl=Vl>=Kp?W4:null;s.useEffect(()=>{C==null||C(Zl)},[Zl,C]);const eu=ve=>{const ht=ms==null?void 0:ms.described;return!ht||ht.size===0?!1:ve.t==="product"?ht.has(gc("product",ve.id)):ve.t==="character"?ht.has(gc("character",ve.id)):ve.t==="template"?ht.has(gc("scene",ve.id)):ve.t==="ref"?ht.has(gc("reference",ve.imageHash)):ve.t==="mark"?ht.has(gc("brand",ve.imageHash)):!1},m1=Jc!=null?`Described in words: ${ho} pictures ${Jc} per shot, products and presenters first. Drag it earlier to picture it.`:null,Ri=Ft?wr.length>0?"This scene builds around a product. Attach one.":(gs==null?void 0:gs.warnings.some(ve=>ve.includes("built around a person")))??!1?"This scene builds around a person. Without a presenter, only the set renders.":null:null,tu=ve=>{var jn,Wr;if(ve.t==="template")return Ri;if(ve.t==="product"&&K&&I&&!((V.length?V:((jn=n.json)==null?void 0:jn.products)??[]).some(or=>or.id===ve.id)||U.some(or=>or.id===ve.id)))return"This product is no longer in your library. Remove it from the brief.";if(ve.t==="mark"&&!n1(n.json).some(In=>In.hash===ve.imageHash))return"This mark is no longer in your brand kit. Remove it from the brief.";if(!gs)return null;const ht=(ct==null?void 0:ct.displayName)??"this engine",en=gs.cap,hn=In=>`${In} won't reach ${ht} this time.`,nn=(In,sr)=>{var or;return((or=gs.dropped)==null?void 0:or.some(Da=>Da.role===In&&Da.id===sr&&Da.reason==="missing"))??!1};if(ve.t==="ref"&&!gs.attachments.some(In=>In.hash===ve.imageHash))return en===0?`This reference won't reach ${ht}. Choose an engine that reads images, or remove it.`:en==null?hn("This reference"):null;if(ve.t==="mark"&&!gs.attachments.some(In=>In.role==="brand"&&In.hash===ve.imageHash))return en===0?`The brand mark won't reach ${ht}, so the logo can't be drawn from it. Choose an engine that reads images.`:en==null?`${hn("The brand mark")} The logo can't be drawn from it.`:null;if(ve.t==="mark"){const In=gs.warnings.find(sr=>sr.includes("px across"));if(In)return In}if(ve.t==="product"){const sr=(V.length?V:((Wr=n.json)==null?void 0:Wr.products)??[]).find(or=>or.id===ve.id)??U.find(or=>or.id===ve.id);if(sr&&!gs.attachments.some(or=>or.role==="product"&&or.id===sr.id))return nn("product",sr.id)?`${sr.name} has no usable photo. Re-add one, or remove this.`:null}if(ve.t==="character"){const In=z.find(sr=>sr.id===ve.id);if(!In&&z.length>0)return"This presenter is no longer in your roster. Remove them from the brief.";if(In&&!gs.attachments.some(sr=>sr.role==="character"&&sr.id===In.id))return nn("character",In.id)?`${In.name} has no usable photo. Re-add one, or remove this.`:null}return null},g1=s.useCallback(tu,[gs,ct==null?void 0:ct.displayName,Ri,V,K,n.json,U,I,z]),vs=s.useCallback(eu,[ms]),po=async()=>{var ht,en,hn;if(!lo)return;at(!0),Et(null);const ve=ae.flatMap(nn=>nn.t==="text"?[nn.v]:[]).join(" ").replace(/\s+/g," ").trim();S==null||S({said:ve||"Your shot",count:Tn==="generation"?Re:1,format:Oe});try{if(!t)throw new Error("the workspace is still loading");const nn=await Ae.addNode({projectId:t,parentId:Tn==="edit"&&A?A.id:a,kind:Tn,engineId:te,count:Re,brief:{...Yt,tokens:sp(n,Yt.tokens)},...Tn==="edit"&&M?{sourceImage:M}:{},...Tn==="edit"&&Qn?{reshape:Qn}:{}}),jn=nn.warnings??[];jn.length===1?Q({kind:"warning",title:"Sent, with one thing to know",detail:jn[0]}):jn.length>1&&Q({kind:"warning",title:`Sent, with ${jn.length} things to know`,detail:jn.join(" ")}),nt.current=null,(ht=de.current)==null||ht.setTokens(Jo()),se({}),Ue(null),G({}),Ye(null),Xt(null),P&&R5(n.id),k(nn.id,Tn,(en=nn.siblings)==null?void 0:en.map(Wr=>Wr.id),(hn=nn.siblings)!=null&&hn.length?nn.siblings:[nn])}catch(nn){const jn=String(nn.message??nn);Et(jn),Q(on(nn,"That did not send",ct==null?void 0:ct.displayName)),S==null||S(null)}finally{at(!1)}},Pi=(_d=ae.find(ve=>ve.t==="product"))==null?void 0:_d.id,Li=Pi?V.find(ve=>ve.id===Pi)??(((w1=n.json)==null?void 0:w1.products)??[]).find(ve=>ve.id===Pi)??U.find(ve=>ve.id===Pi)??null:null,v1=Li?Gw(Li):null,nu=D?{brandId:n.id,products:ae.filter(ve=>ve.t==="product").length,presenters:ae.filter(ve=>ve.t==="character").length,scene:!!Ft,others:ae.filter(ve=>ve.t==="color"||ve.t==="ref"||ve.t==="mark").length,words:ae.some(ve=>ve.t==="text"&&!!ve.v.trim()),busy:Qe,pickerOpen:Mt,refining:Tn==="edit"&&!!A,engine:ee?re?"setup":"settings":"ready"}:null;s.useEffect(()=>{nu&&gk(nu)}),s.useEffect(()=>{if(D)return()=>gk(null)},[D]),s.useEffect(()=>{if(!D||!Mt)return;const ve=()=>Wt({restore:!0});return window.addEventListener("scenri:guide-close-picker",ve),()=>window.removeEventListener("scenri:guide-close-picker",ve)},[D,Mt,Wt]),s.useEffect(()=>{if(!D)return;const ve=ht=>{var jn;const{kind:en}=ht.detail,hn=en==="presenter"?"character":en==="scene"?"template":"product",nn=[..._n.current].reverse().find(Wr=>Wr.t===hn);nn&&((jn=de.current)==null||jn.remove(nn))};return window.addEventListener("scenri:guide-take-back",ve),()=>window.removeEventListener("scenri:guide-take-back",ve)},[D]),s.useEffect(()=>{if(!T)return;const ve=()=>T();return window.addEventListener("scenri:guide-clear-refine",ve),()=>window.removeEventListener("scenri:guide-clear-refine",ve)},[T]),s.useEffect(()=>{if(!D)return;const ve=ht=>{const{tab:en}=ht.detail;qe(en??null),en&&lt.current(en)};return window.addEventListener("scenri:guide-picker",ve),()=>{window.removeEventListener("scenri:guide-picker",ve),qe(null)}},[D]);const[zl,$i]=s.useState(!1),Bl=H==="overlay"&&(zl||ae.some(ve=>ve.t==="text"&&!!ve.v.trim()));return s.useEffect(()=>{H==="overlay"&&vk({engaged:Bl})},[H,Bl]),s.useEffect(()=>{if(H==="overlay")return()=>vk(null)},[H]),o.jsxs("div",{className:"sc-composer","data-guide":D?"compose":void 0,onPointerDownCapture:H==="overlay"&&!zl?()=>$i(!0):void 0,onKeyDownCapture:H==="overlay"&&!zl?()=>$i(!0):void 0,children:[o.jsx("input",{ref:Ie,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ve=>void bn(ve.target.files)}),Or&&o.jsx(Sd,{src:Or.src,kind:Or.kind,label:Or.label,noun:Or.noun,onRestoreFocus:()=>{var ve;return(ve=de.current)==null?void 0:ve.restoreCaret()},onClose:()=>wn(null)}),Mt&&o.jsx(Coe,{brand:n,activeProductCategory:v1,refining:ia,full:Zl,initialTab:Rt,tabNonce:Ee,only:St,id:mt,attached:ye,onUpload:()=>{var ve;return(ve=Ie.current)==null?void 0:ve.click()},onFiles:ve=>void bn(ve),onPick:On,onRemove:Rn,onClose:Wt}),J&&o.jsx("div",{className:"sc-notes","data-guide-shape":D?"":void 0,children:J&&o.jsxs("div",{className:"sc-banner","data-tone":"action",children:[o.jsx("span",{className:"sc-banner-ic",children:J.icon}),o.jsxs("span",{className:"sc-banner-txt",children:[o.jsx("b",{children:J.title}),o.jsxs("small",{children:[J.detail,J.info&&o.jsxs(md,{children:[o.jsx(gd,{children:o.jsx("button",{type:"button",className:"sc-note-info","aria-label":"What a ChatGPT account has to do with this",children:o.jsx(hm,{size:13})})}),o.jsxs(vd,{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:()=>q("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:J.onAct,children:J.action})]})}),o.jsxs("div",{className:"sc-promptcard","data-guide-shape":D?"":void 0,children:[Lt&&(T||H==="overlay"&&Tn==="edit")&&o.jsxs("div",{className:"sc-target","data-note":Ws?"":void 0,children:[o.jsx(Aoe,{target:A,onOpenImage:oa,onClear:T}),Ws&&o.jsx("small",{className:"sc-target-note",children:Ws})]}),Lt&&!T&&Ws&&!(H==="overlay"&&Tn==="edit")&&o.jsx("small",{className:"sc-target-note sc-target-note-alone",children:Ws}),Nn&&(un||Jn)&&o.jsxs("small",{className:"sc-reshape-hint","aria-live":"polite",children:[un?"Will crop to":"Will extend to"," ",gr]}),o.jsx(Qae,{ref:de,onChange:Me,brand:n,templates:Y,presenters:z,demoProducts:U,onTemplatePick:Fe,scenesSitOut:ia,flag:g1,described:vs,describedNote:m1,onInspect:ve=>wn(ve),onAttachRequest:ve=>le(ve),activeProductCategory:v1,placeholder:Ft?"Add art direction, or run it as written":Tn==="edit"?"Say what to change about this shot":"What should we shoot? (use $ / @ #)",placeholderSm:Ft||Tn==="edit"?void 0:"What should we shoot? ($ / @ #)",label:Ft?"Art direction":Tn==="edit"?"What to change":"Shot brief",onSubmit:()=>void po(),onDropFiles:ve=>void bn(ve)}),o.jsxs("div",{className:"sc-prompt-row",children:[o.jsxs("div",{className:"sc-prompt-left",children:[o.jsx("button",{type:"button",ref:Ve,className:"sc-icon-btn sc-attach-toggle","data-guide":D?"compose.add":void 0,"aria-expanded":Mt,"aria-controls":Mt?mt:void 0,"aria-label":"Add to shot",title:"Add a product, a presenter, a scene, a colour or an image",onClick:()=>Mt?Wt({restore:!1}):le("All"),children:sn?o.jsx(Lr,{size:"1"}):o.jsx(mr,{size:16})}),me.length>1&&o.jsxs(pN,{value:te,onValueChange:he,children:[o.jsxs(mN,{variant:"ghost",className:"sc-mini-sel",children:[o.jsx(ef,{size:14}),o.jsx("span",{className:"sc-mini-sel-t",children:ct?ml(ct.displayName):"Demo"})]}),o.jsx(gN,{children:me.map(ve=>o.jsx(vN,{value:ve.id,children:ml(ve.displayName)},ve.id))})]})]}),o.jsxs("div",{className:"sc-prompt-right",children:[o.jsx(Toe,{mode:Tn,engineId:te,engineName:Ot,formatId:Oe,onFormat:yr,count:Re,onCount:Ta,quality:st,onQuality:Mi,onCloseAutoFocus:uo,guided:D}),o.jsxs(md,{open:An,onOpenChange:ne,children:[o.jsx(gd,{children:o.jsxs("button",{type:"button",className:"sc-var sc-more","aria-label":`Shot settings. ${an}`,"data-guide":D&&!ce?"compose.settings":void 0,children:[o.jsx(Mv,{size:14}),"More"]})}),o.jsx(vd,{className:"sc-morepop",align:"end",sideOffset:8,width:"300px",onOpenAutoFocus:Cy,onCloseAutoFocus:uo,children:o.jsx(iL,{mode:Tn,engineId:te,engineName:Ot,formatId:Oe,onFormat:yr,count:Re,onCount:Ta,quality:st,onQuality:Mi})})]}),o.jsx(Doe,{guide:D&&ce?"compose.settings":void 0,mode:Tn,engineId:te,engineName:Ot,formatId:Oe,onFormat:yr,count:Re,onCount:Ta,quality:st,onQuality:Mi}),o.jsxs("button",{type:"button",className:"sc-send","data-guide":D?"compose.send":void 0,"aria-disabled":!lo||void 0,onClick:()=>void po(),"aria-label":Tn==="edit"?"Refine":"Generate",title:wt??Ri??co??`${Tn==="edit"?"Refine":"Generate"} (enter)`,children:[o.jsx("span",{className:"sc-send-ico",children:Qe?o.jsx(Lr,{size:"1"}):o.jsx(K7,{size:17,weight:"bold"})}),o.jsx("span",{className:"sc-send-lb",children:Tn==="edit"?"Refine":"Generate"})]})]})]})]})]})});function zoe(e){return e.replace(/\.[a-z0-9]{2,5}$/i,"").trim()||"Image"}function Ay(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 uL({full:e=!0,children:t}){const[n,r]=s.useState(null);return Ay(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 Ny(){const{brand:e}=cn(),{tasks:t}=sa(),[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,m=h!=null&&n===h.id,g=Mq(e.json),w=Jr(g==null?void 0:g.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:(g==null?void 0:g.role)==="mark"?"sc-impbar-badge":void 0}):o.jsx(eC,{size:13,weight:"regular"})}),o.jsx("span",{className:"sc-impbar-count",children:h.subtitle}),o.jsx("span",{className:"sc-impbar-clock",children:$c(h.startedAt,l)})]}),p&&o.jsxs("button",{type:"button",className:"sc-impbar-stop",disabled:m,"aria-label":"Stop importing",onClick:()=>{r(h.id),Ae.cancelCatalogJob(e.id,p).catch(()=>r(null))},children:[o.jsx(Cn,{size:12,weight:"bold"}),m?"Stopping":"Stop"]})]}),a&&o.jsx(E4,{brandId:e.id,jobId:a,onDismiss:()=>i(null)})]})}const Boe={presenter:"Presenter",product:"Product",scene:"Scene"};function dL({entry:e,productName:t,productPreviewUrl:n,productId:r,presenterName:a,presenterPreviewUrl:i,presenterId:l,sceneName:u,scenePreviewUrl:f,sceneId:h,onOpen:p,productHref:m,presenterHref:g,sceneHref:w,active:y,hideRecipe:b,decorative:k,size:S="grid"}){const{contentArriving:E}=$n(),C=[t,a,u].filter(Boolean).join(" · "),A=a?{key:"presenter",name:a,previewUrl:i,linked:!!(g&&l),href:g&&l?g(l):void 0}:null,L=n&&t?{key:"product",name:t,previewUrl:n,linked:!!(m&&r),href:m&&r?m(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($d,{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(Woe,{presenter:A,product:L,scene:T})]})}function Uoe(e){return o.jsx(Jm,{...e,caption:!1})}function Woe({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(ZS,{credit:e,open:r==="presenter",onEnter:()=>a("presenter"),children:Goe(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(ZS,{credit:h,open:r===h.key,onEnter:()=>a(h.key),style:f(),children:Koe({credit:h,step:p===0?1:2})})]},h.key))]})]})}function ZS({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=VM(),p=h==="large"?144:88,m=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)||m,j=window.visualViewport,R=Kse(A,{width:(j==null?void 0:j.width)??window.innerWidth,height:(j==null?void 0:j.height)??window.innerHeight},{width:T,height:M});if(!R){f(null);return}f({left:Math.round(R.left),top:Math.round(R.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,m]),!e.previewUrl)return o.jsx("span",{ref:i,className:"sc-credit-tip",onPointerEnter:n,style:a,children:r});const g=Boe[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":`${g}: ${e.name}`,children:o.jsxs("span",{className:"sc-credit-tip-card",children:[o.jsx("img",{src:Ln(e.previewUrl,"small"),alt:""}),o.jsx("span",{className:"sc-credit-tip-name",children:e.name}),o.jsx("span",{className:"sc-credit-tip-role",children:g})]})}),document.body)]})}function Koe({credit:e,step:t}){const{name:n,previewUrl:r,linked:a,href:i}=e;return a&&i?o.jsx(Zn,{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:Ln(r,"micro"),alt:""}):null}):o.jsx("span",{className:"sc-showcase-chip","data-step":t,children:r?o.jsx("img",{src:Ln(r,"micro"),alt:n}):o.jsx("span",{className:"sc-vh",children:n})})}function Goe(e){const{name:t,previewUrl:n,linked:r,href:a}=e;return r&&a?o.jsxs(Zn,{className:"sc-showcase-badge",to:a,"data-link":!0,"aria-label":`See ${t}`,onClick:i=>i.stopPropagation(),children:[n?o.jsx("img",{src:Ln(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:Ln(n,"micro"),alt:""}):null,o.jsx("span",{className:"sc-showcase-badge-name",children:t})]})}function zS(e){return{key:"open-tab",icon:"open-tab",label:"Open in new tab",onSelect:()=>window.open(e,"_blank")}}function BS(e){return{key:"select",icon:"select",label:"Select",onSelect:e}}function Sl(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(zS(e.draft.href)),e.select&&n.push(BS(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(zS(e.href)),e.use&&t.push({key:"use",icon:"use",label:e.use.label,onSelect:e.use.run}),e.select&&t.push(BS(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 ls(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 Si(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 d2(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 f2({kind:e,count:t,openLabel:n,onOpen:r,href:a,onDeselect:i,onAct:l,onKeep:u,allKept:f}){const h=ls(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 g=d2(t,!!f,e==="presenter"?"presenters":e==="product"?"products":"scenes");p.push({key:"keep",icon:g.icon,label:g.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 Xp(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 X4({presenter:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,onDuplicate:u,onEdit:f,onDelete:h,onRename:p,bookmarked:m,onBookmark:g,fresh:w,chosen:y,batching:b,onPick:k,batch:S,size:E="grid"}){const A=S?f2({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}):Sl(!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:g?{on:!!m,run:()=>g(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($d,{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:m,onBookmark:g,fresh:w,chosen:y,batching:b,onPick:k,size:E})}function fL(e){return o.jsx(Jm,{...e})}function bf({scene:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,bookmarked:u,onBookmark:f,onDelete:h,onRename:p,chosen:m,batching:g,onPick:w,batch:y,size:b="grid"}){const S=y&&h?f2({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}):Sl(!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($d,{id:e.id,previewUrl:e.previewUrl,title:e.description||kl(e,"tooltip"),primary:kl(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:m,batching:g,onPick:w,size:b})}function hL(e){return o.jsx(Jm,{...e})}const Zu=new Map,Yoe=50;function qoe(e,t){for(Zu.delete(e),Zu.set(e,t);Zu.size>Yoe;)Zu.delete(Zu.keys().next().value)}function Xoe(e){return Zu.get(e)}const Qoe=1e3;function us({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=Xoe(r);if(!i||!l)return;let u=!1;const f=()=>{u||(u=!0,a.current=!1,p.disconnect(),clearTimeout(m),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),m=setTimeout(f,Qoe);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||qoe(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 h2({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 p2({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(ky,{"aria-label":t.label,activeKey:t.selected,items:n,onSelect:t.onSelect})}const My=o.jsx(Qa,{size:21,weight:"regular"});function Mo({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 m2({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(Mo,{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 Joe=150;function d1(e){const[t,n]=El(),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),m=s.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]);s.useEffect(()=>{r!==h.current&&(h.current=r,m(),f(r))},[r,m]),s.useEffect(()=>m,[m]);const g=s.useCallback(E=>{f(E),m(),p.current=setTimeout(()=>{p.current=null,h.current=E,l({q:E||null})},Joe)},[l,m]),w=s.useCallback((E,C)=>l({[E]:C}),[l]),y=l,b=u.trim().length>0||Object.values(i).some(Boolean),k=s.useCallback(()=>{m(),f(""),h.current="",l({q:null})},[l,m]),S=s.useCallback(()=>{m(),f(""),h.current="";const E={q:null};for(const C of a.split(",").filter(Boolean))E[C]=null;l(E)},[l,m,a]);return{q:u,setQ:g,facets:i,setFacet:w,setFacets:y,active:b,clearSearch:k,clear:S}}const eie=6,al=new Map;function US(e){return al.get(e)??null}function tie(e){if(e.key)for(al.delete(e.key),al.set(e.key,e);al.size>eie;)al.delete(al.keys().next().value)}function nie(e){for(const[t,n]of al)n.brandId===e&&al.delete(t)}const rie=8;function sie(){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}=$n(),{brand:m,workspace:g,root:w,products:y,applyNodes:b}=cn(),k=t,{poke:S}=sa(),E=Fl(),C=Bn(),{push:A}=rr(),L=vy(),T=l2(),M=Tse(),j=Mr(aa),{q:R,setQ:P,facets:H,setFacet:D,clearSearch:B,clear:V}=d1(["category"]),K=H.category,U=Oe=>D("category",Oe),I=R.trim().length>0,[_,O]=ja(qr.wallDensity,wd),Y=Xc(_),z=Oe=>O(Oe),q=Qm(Y),Z=qm(Y),Q=CX[Y],me=Oe=>{const ie=new URLSearchParams(Oe??{}).toString();C(`${Er(m)}${ie?`?${ie}`:""}`)},te=y.length?y:((We=m.json)==null?void 0:We.products)??[],he=Oe=>{var Re,_e,Ye;const ie=(Re=Oe.brief.tokens.find(ge=>ge.t==="product"))==null?void 0:Re.id,X=(_e=Oe.brief.tokens.find(ge=>ge.t==="character"))==null?void 0:_e.id,se=(Ye=Oe.brief.tokens.find(ge=>ge.t==="template"))==null?void 0:Ye.id;return{product:ie?i.find(ge=>ge.id===ie):void 0,presenter:X?r.find(ge=>ge.id===X):void 0,scene:se?k.find(ge=>ge.id===se):void 0}},re=s.useMemo(()=>{const Oe=new Map;for(const ie of l){const{product:X,presenter:se,scene:Re}=he(ie);Oe.set(ie.id,$se(ie,{product:X,presenter:se,scene:Re},J8(ie.category)))}return Oe},[l,i,r,k]),ee=s.useMemo(()=>(K?l.filter(ie=>ie.category===K):l).filter(ie=>Oo(re.get(ie.id)??ie.title,R)),[l,K,R,re]),J=s.useMemo(()=>{const Oe=Ise(u);return{key:"category",label:"Categories",everyLabel:"All examples",everyCount:l.length,selected:K,onSelect:U,options:Oe.map(ie=>({value:ie,label:J8(ie)??ie,count:l.filter(X=>X.category===ie).length}))}},[l,u,K,U]),ae=Oe=>{const{product:ie,presenter:X,scene:se}=he(Oe);return{productName:ie?Ho(ie,"chip"):null,productPreviewUrl:(ie==null?void 0:ie.previewUrl)??null,productId:(ie==null?void 0:ie.id)??null,presenterName:(X==null?void 0:X.name)??null,presenterPreviewUrl:X?yi(X).src:null,presenterId:(X==null?void 0:X.id)??null,sceneName:se?kl(se,"chip"):null,scenePreviewUrl:(se==null?void 0:se.previewUrl)??null,sceneId:(se==null?void 0:se.id)??null}},[Me,ue]=s.useState(null),Be=j?M:Oe=>{const ie=l.find(X=>X.id===Oe);ie&&(ue(B4(ie)),A({kind:"info",title:`Starting from "${ie.title}"`}))},vt=()=>{const ie=[...ki(m.id)].reverse().find(X=>k.some(se=>se.id===X));me(ie?{scene:ie,attach:"products",compose:"1"}:{attach:"products",compose:"1"})},Ue=s.useMemo(()=>Lp(r1(m),r),[m,r]),Xe=Ue.slice(0,Q),De=s.useMemo(()=>{const Oe=ki(m.id);return Lp(qc(m),GP(k,ie=>Oe.includes(ie.id)))},[k,m]),G=De.slice(0,Q),oe=s.useMemo(()=>{var Ye,ge,Qe,at,wt;const Oe=new Set,ie=Et=>!Et||Oe.has(Et)?null:(Oe.add(Et),Ln(Et,"tile")),X=Et=>{for(const ot of Et){const It=l.find(Zt=>Zt.id===ot&&Zt.previewUrl),Mt=ie(It==null?void 0:It.previewUrl);if(Mt)return Mt}return null},se=Et=>{for(const ot of Et){const It=k.find(Zt=>Zt.id===ot&&Zt.previewUrl),Mt=ie(It==null?void 0:It.previewUrl);if(Mt)return Mt}return null},Re=Et=>{for(const ot of l)if(!(!ot.previewUrl||Oe.has(ot.previewUrl))&&!(Et&&!ot.brief.tokens.some(It=>It.t===Et)))return ie(ot.previewUrl);return null},_e=te.find(Et=>{var ot,It;return Jr((It=(ot=Et==null?void 0:Et.shots)==null?void 0:ot[0])==null?void 0:It.file)});return{compose:ie(_e?Jr((ge=(Ye=_e.shots)==null?void 0:Ye[0])==null?void 0:ge.file):null)??X(["c15-orange-pool","orris-waterline","hoops-painted-canvas"])??ie((Qe=i.find(Et=>Et.id==="calder-vane-c15-serum"))==null?void 0:Qe.previewUrl)??ie((at=i.find(Et=>Et.previewUrl))==null?void 0:at.previewUrl)??Re("product"),product:X(["ridgeline-tyre-top","ridgeline-boulder-gap","yuzu-ice-burst"])??ie((wt=i.find(Et=>Et.id==="voss-rowe-ridgeline-trail"))==null?void 0:wt.previewUrl)??Re("product"),presenter:ie(yi(r.find(Et=>Et.id==="odette")??r.find(Et=>Et.avatarUrl)??r[0]??{}).src)??Re("character"),scene:se(["travertine-window-light","palm-shade-garden","lantern-room","cobalt-container","sunlit-color-field"])??X(["lounge-chair-travertine","lounge-chair-snowfall","capsule-model-village"])??Re("template")}},[k,r,te,i,l]);return o.jsx(s1.Provider,{value:Z,children:o.jsxs(us,{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:vt,children:[o.jsx(pL,{thumbUrl:oe.compose,fallback:o.jsx(D7,{size:22,weight:"fill"})}),o.jsx("b",{children:"Create an image"})]}),o.jsx(o6,{tone:"product",title:"Add a product",count:te.length,thumbUrl:oe.product,icon:o.jsx(pm,{size:22,weight:"fill"}),onClick:()=>E("product")}),o.jsx(o6,{tone:"presenter",title:"Create a presenter",thumbUrl:oe.presenter,icon:o.jsx(uF,{size:22,weight:"fill"}),onClick:()=>E("presenter")}),o.jsx(o6,{tone:"scene",title:"Create a scene",thumbUrl:oe.scene,icon:o.jsx(nF,{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:q,"aria-hidden":!0,children:o.jsx(Uoe,{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(h2,{filters:o.jsx(p2,{mode:"tabs",group:J}),search:l.length>=rie&&o.jsx(Id,{value:R,onChange:P,noun:"examples",total:l.length}),density:o.jsx(Xm,{value:Y,onChange:z})}),ee.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":Z,style:q,children:ee.map(Oe=>o.jsx(dL,{entry:Oe,size:"grid",hideRecipe:!0,onOpen:Be,productHref:ie=>xa(m,ie),presenterHref:ie=>Aa(m,ie),sceneHref:ie=>zr(m,ie),...ae(Oe)},Oe.id))}),ee.length===0&&(I?o.jsx(m2,{noun:"examples",q:R,facet:K?J8(K):null,onClearSearch:B,onClearAll:V}):o.jsx("p",{className:"sc-looks-empty",children:"No example carries that category yet."}))]})]}),(!a||Xe.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:q,children:Xe.map(Oe=>o.jsx(X4,{presenter:Oe,variant:"navigate",size:"grid",onOpen:L},Oe.id))}):o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:q,"aria-hidden":!0,children:o.jsx(fL,{size:"grid",count:Q})}),(!a||Ue.length>Xe.length)&&o.jsx("div",{className:"sc-lib-more",children:o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:li(m),children:a?`Show all ${Ue.length} presenters`:"Show all presenters"})})]}),(!n||G.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:q,children:G.map(Oe=>o.jsx(bf,{scene:Oe,variant:"navigate",size:"grid",onOpen:T},Oe.id))}):o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:q,"aria-hidden":!0,children:o.jsx(hL,{size:"grid",count:Q})}),(!n||De.length>G.length)&&o.jsx("div",{className:"sc-lib-more",children:o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:fl(m),children:n?`Show all ${De.length} scenes`:"Show all scenes"})})]})]}),!j&&o.jsxs(uL,{children:[o.jsx(Ny,{}),o.jsx(jy,{projectId:(g==null?void 0:g.id)||null,brand:m,engines:e,parentId:w,initialBrief:Me,onQueued:(Oe,ie,X,se)=>{se!=null&&se.length&&b(se),S(),nie(m.id),C(Er(m))}})]})]})})}function o6({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(pL,{thumbUrl:a,fallback:n}),o.jsxs("b",{children:[t,r?o.jsx(nN,{variant:"soft",radius:"full",size:"1",children:r}):null]})]})}function pL({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 mL({id:e,name:t,hash:n,drawing:r,state:a,href:i,blank:l,onDiscard:u,chosen:f,batching:h,onPick:p,batch:m}){const g=Bn(),w=Vw(),y=m?f2({kind:"draft",count:m.count,openLabel:"Continue",onOpen:()=>g(i),href:i,onDeselect:()=>p==null?void 0:p(e),onAct:m.onAct}):Sl(u?{draft:{onContinue:()=>g(i),href:i,onDiscard:()=>u(e)},select:p?{run:()=>p(e)}:void 0}:{onOpen:()=>g(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(Zn,{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:mn(n,"tile"),alt:""}):o.jsx("span",{className:"sc-lookcard-blank",children:l}),r&&o.jsx(Na,{}),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(Cn,{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(qf,{children:[o.jsx(Xf,{children:b}),o.jsx(Qf,{children:y.map(k=>o.jsxs("span",{style:{display:"contents"},children:[k.separated&&o.jsx(Fm,{}),o.jsxs(Jf,{color:k.danger?"red":void 0,onSelect:k.onSelect,children:[o.jsx(sd,{name:k.icon}),k.label]})]},k.key))})]})}function Ry({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),m=u.trim(),g=m.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(!(!g||r||p.current)){if(m===t.trim())return l();p.current=!0,i(m)}};return o.jsxs(Us,{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:!g||r,"data-busy":r||void 0,onClick:y,children:r?"Saving":"Save"})]})]})}function gL({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":`${Hw(e,t)}, ${$c(e,t)}`,children:$c(e,t)})}function aie({build:e,onCancel:t,onRetry:n,onDismiss:r}){const a=e.stage==="failed",i=a?io(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(Na,{since:e.startedAt}),o.jsx(gL,{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(Cn,{size:13})}),a&&r&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Dismiss ${e.name}`,onClick:()=>r(e.id),children:o.jsx(Cn,{size:13})}),a&&n&&o.jsxs("button",{type:"button",className:"sc-lookcard-use",onClick:()=>n(e),children:[o.jsx(_7,{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 Py({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(i6,{label:l.label,onClick:l.onAct,children:o.jsx(Qa,{size:17,weight:l.filled?"fill":"regular"})}),o.jsx(i6,{label:n,tone:a?"danger":void 0,onClick:i,children:o.jsx(oie,{name:r})})]}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-exit",children:o.jsx(i6,{label:"Done",onClick:u,children:o.jsx(Cn,{size:16,weight:"bold"})})})]})}function oie(e){return o.jsx(jl,{size:17})}function i6({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 j0=()=>({kind:null,ids:new Set});function Ly(e){const[t,n]=s.useState(j0),r=s.useCallback(()=>n(j0()),[]);s.useEffect(()=>{r()},[e,r]),s.useEffect(()=>{if(t.ids.size===0)return;const p=m=>{m.defaultPrevented||m.key!=="Escape"||r()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t.ids.size,r]);const a=s.useCallback((p,m)=>{n(g=>{if(g.kind&&g.kind!==p)return g;const w=new Set(g.ids);return w.has(m)?w.delete(m):w.add(m),w.size?{kind:g.kind??p,ids:w}:j0()})},[]),i=s.useCallback((p,m)=>{n({kind:p,ids:new Set(m)})},[]),l=s.useCallback(p=>{const m=new Set(p);n(g=>{const w=new Set([...g.ids].filter(y=>m.has(y)));return w.size?{kind:g.kind,ids:w}:j0()})},[]),u=s.useCallback(p=>{n(m=>{if(!m.ids.has(p))return m;const g=new Set(m.ids);return g.delete(p),g.size?{kind:m.kind,ids:g}:j0()})},[]),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 $y({label:e}){return o.jsx("div",{className:"sc-starter-rule",children:o.jsx("span",{children:e})})}const l6=60;function xf(e,t){const[n,r]=s.useState(l6);s.useEffect(()=>{r(l6)},[t]);const{visible:a,remaining:i}=by(e,n),l=s.useCallback(()=>r(u=>u+l6),[]);return{visible:a,remaining:i,showMore:l}}const iie=24,lie=8,c6="__bookmarked";function cie(){const{scenes:e,collections:t,verticals:n,loaded:r,error:a,refetch:i,applyBrand:l,refreshBrands:u}=$n(),{brand:f}=cn(),h=e,{push:p}=rr(),m=Bn(),[g,w]=s.useState(()=>ki(f.id)),y=Ce=>w(c2("scene",f.id,Ce)),b=l2(),{builds:k,poke:S,studio:E}=sa(),C=Fl(),A=s.useMemo(()=>qc(f),[f]),L=k.filter(Ce=>Ce.kind==="scene"&&(!Ce.finished||Ce.stage==="failed")),T=!!pn({path:pt.sceneStudio}),[M,j]=s.useState(()=>lp(f.id)),R=E.filter(Ce=>Ce.kind==="scene").map(Ce=>`${Ce.id}:${Ce.status}`).join("|");s.useEffect(()=>{T||j(lp(f.id))},[T,f.id,R]);const P=s.useMemo(()=>ese(M,E),[M,E]),[H,D]=s.useState(null),B=Ce=>{Ce.drawing&&Ce.jobId&&Ae.cancelSceneStudioJob(f.id,Ce.jobId).catch(()=>{}),ase(f.id,Ce.convo),j(lp(f.id))},V=Ce=>{const xe=P.find(et=>et.convo===Ce);xe&&(xe.hash||xe.drawing?D(xe):B(xe))},{q:K,setQ:U,facets:I,setFacets:_,clearSearch:O,clear:Y}=d1(["vertical","bookmarked"]),z=I.vertical,q=I.bookmarked==="1",Z=Ly(`${f.id}|${K}|${z??""}|${q?"1":""}`),Q=K.trim().length>0,[me,te]=ja(qr.wallDensity,wd),he=Xc(me),re=Ce=>te(Ce),ee=Qm(he),J=qm(he),ae=Ce=>m(zr(f,Ce)),[Me,ue]=s.useState(null),[Se,Be]=s.useState(!1),[vt,Ue]=s.useState(null),[Xe,De]=s.useState(!1),[G,oe]=s.useState(null),[We,Oe]=s.useState(!1),ie=s.useCallback(Ce=>{const xe=A.find(et=>et.id===Ce);xe&&ue(xe)},[A]),X=s.useCallback(Ce=>{const xe=A.find(et=>et.id===Ce);xe&&(oe(null),Ue(xe))},[A]),se=async Ce=>{if(!(!vt||Xe)){De(!0),oe(null);try{l((await Ae.updateScene(f.id,vt.id,{name:Ce})).brand),Ue(null)}catch(xe){const et=on(xe,"Could not rename this scene");oe([et.title,et.detail].filter(Boolean).join(" "))}finally{De(!1)}}},Re=async()=>{if(!(!Me||Se)){Be(!0);try{l((await Ae.deleteScene(f.id,Me.id)).brand),Z.forget(Me.id),ue(null)}catch(Ce){(Ce==null?void 0:Ce.status)===404?(await u(),Z.forget(Me.id),ue(null)):p(on(Ce,"Could not delete this scene"))}finally{Be(!1)}}},_e=s.useMemo(()=>q?h.filter(Ce=>g.includes(Ce.id)):z?h.filter(Ce=>Ce.verticals.includes(z)):h,[h,z,q,g]),ge=!(A.length>0||L.length>0||P.length>0),Qe=[...h,...A].reduce((Ce,xe)=>Ce+(g.includes(xe.id)?1:0),0),at=q&&Qe===0,wt=at&&ge,Et=at&&!ge,ot=Q||q&&!wt,It=s.useMemo(()=>wt?h:_e,[wt,h,_e]),Mt=s.useMemo(()=>It.filter(Ce=>Oo(Bp(Ce),K)),[It,K]),[Zt,Rt]=s.useState(()=>new Set),{visible:Tt,remaining:Ee,showMore:Je}=xf(Mt,`${z??""}|${q?"bookmarked":""}|${wt?"browse":""}|${K}`),St=Ce=>[...A,...h].filter(xe=>!xe.verticals.length||xe.verticals.includes(Ce)).length,qe=[{value:c6,label:"Keepers",count:Qe},...n.map(Ce=>({value:Ce,label:Ce,count:St(Ce)}))],st=h.length>0?"tabs":"none",rt={key:"vertical",label:"Vertical",everyLabel:"All scenes",everyCount:h.length+A.length,selected:q?c6:z,onSelect:Ce=>_(Ce===c6?{bookmarked:"1",vertical:null}:{bookmarked:null,vertical:Ce}),options:qe},Xt=s.useMemo(()=>A.filter(Ce=>z?!Ce.verticals.length||Ce.verticals.includes(z):!0).filter(Ce=>Oo(Bp(Ce),K)).filter(Ce=>q?g.includes(Ce.id):!0),[A,z,K,q,g]),Gt=q?Xt.length>0:P.length>0||L.length>0||Xt.length>0,{visible:sn,remaining:Ut,showMore:An}=xf(Xt,`${f.id}|${z??""}|${q?"bookmarked":""}|${K}`),[Bt,ne]=s.useState(null);s.useEffect(()=>{if(!Bt||Ut<=0)return;const Ce=new IntersectionObserver(xe=>{xe.some(et=>et.isIntersecting)&&An()},{root:Bt.closest(".sc-home"),rootMargin:"200% 0px"});return Ce.observe(Bt),()=>Ce.disconnect()},[Bt,Ut,An]);const ce=()=>{Z.ids.size===1?ie([...Z.ids][0]):Oe(!0)},de=[...Z.ids],Ve=de.length>0&&de.every(Ce=>g.includes(Ce)),Ie=()=>w(wy("scene",f.id,de,!Ve)),mt=d2(Z.ids.size,Ve,"scenes"),bt=async()=>{if(Se)return;const Ce=[...Z.ids];Be(!0);try{const{failed:xe,error:et}=await Xp(Ce,Ct=>Ae.deleteScene(f.id,Ct));await u(),Z.retain(xe),Oe(!1),et&&p(on(et,"Could not delete these scenes"))}finally{Be(!1)}},kt=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>C("scene"),children:[o.jsx(mr,{size:12})," Create scene"]}),nt=(Ce,xe=!1)=>o.jsx("div",{className:"sc-masonry","data-wall":xe||void 0,"data-density":!0,"data-density-size":J,style:ee,children:Ce.map(et=>o.jsx(bf,{scene:et,variant:"use",size:"grid",onOpen:ae,href:zr(f,et.id),onUse:b,bookmarked:g.includes(et.id),onBookmark:y},et.id))}),yt=o.jsx(h2,{title:"Scenes",filters:o.jsx(p2,{mode:st,group:rt}),density:o.jsx(Xm,{value:he,onChange:re}),search:h.length>=lie&&o.jsx(Id,{value:K,onChange:U,noun:"scenes",total:h.length})});return o.jsxs(s1.Provider,{value:J,children:[o.jsx(us,{children:o.jsxs("main",{className:"sc-looks sc-scenes",id:"main","data-hero":ge||void 0,onClick:Z.onBlank,children:[!ge&&yt,Gt&&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":J,style:ee,children:[!q&&P.map(Ce=>o.jsx(mL,{id:Ce.convo,name:Ce.name||"Untitled scene",hash:Ce.hash,drawing:Ce.drawing,state:nse(Ce),href:hl(f,Ce.convo),blank:o.jsx(nC,{size:44,weight:"thin"}),onDiscard:V},Ce.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:Ce=>{Ce||D(null)},onConfirm:()=>{B(H),D(null)}}),!q&&L.map(Ce=>o.jsx(aie,{build:Ce,onCancel:xe=>void Ae.cancelAssetBuild(f.id,xe).then(S),onDismiss:xe=>void Ae.deleteAssetBuild(f.id,xe).then(S),onRetry:()=>C("scene")},Ce.id)),sn.map(Ce=>o.jsx(bf,{scene:Ce,variant:"use",size:"grid",onOpen:ae,href:zr(f,Ce.id),onUse:b,bookmarked:g.includes(Ce.id),onBookmark:y,onDelete:ie,onRename:X,chosen:Z.ids.has(Ce.id),batching:Z.batching==="owned-scene",onPick:Z.picking("owned-scene")?xe=>Z.toggle("owned-scene",xe):void 0,batch:Z.kind==="owned-scene"&&Z.ids.has(Ce.id)?{count:Z.ids.size,onAct:ce,onKeep:Ie,allKept:Ve}:null},Ce.id))]}),Ut>0&&o.jsx("div",{ref:ne,"aria-hidden":!0}),Ut>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(Ut,60)," more"]})}),vt&&o.jsx(Ry,{title:"Rename scene",name:vt.name,maxLength:60,busy:Xe,error:G,onConfirm:Ce=>void se(Ce),onDismiss:()=>{Xe||Ue(null)}}),Me&&o.jsx(Xn,{label:"Delete scene",title:`Delete ${Me.name}?`,body:Si("owned-scene",1),open:!0,busy:Se,onOpenChange:Ce=>{!Ce&&!Se&&ue(null)},onConfirm:()=>void Re()}),We&&o.jsx(Xn,{label:ls("owned-scene",Z.ids.size).menu,title:`${ls("owned-scene",Z.ids.size).menu}?`,body:Si("owned-scene",Z.ids.size),open:!0,busy:Se,onOpenChange:Ce=>{!Ce&&!Se&&Oe(!1)},onConfirm:()=>void bt()})]}),ge&&r&&!a&&h.length>0&&o.jsx(Mo,{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}),Gt&&r&&!a&&_e.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri scenes"})}),ge&&r&&!a&&h.length>0&&o.jsxs(o.Fragment,{children:[o.jsx($y,{label:"Or start from one of ours"}),yt]}),!r&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":J,style:ee,"aria-hidden":!0,children:o.jsx(hL,{size:"grid",count:8})}),r&&a&&o.jsx(Mo,{shape:"error",title:"Couldn't load this library",body:"Something went wrong reaching the catalog.",onRetry:()=>i()}),r&&!a&&!ot&&t.map(Ce=>{const xe=It.filter(ke=>ke.collections.includes(Ce));if(!xe.length)return null;const Ct=Zt.has(Ce)?xe:xe.slice(0,iie);return o.jsxs("section",{className:"sc-coll",children:[o.jsx("h2",{children:Ce}),nt(Ct),Ct.length<xe.length&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>Rt(ke=>new Set(ke).add(Ce)),children:["Show all ",xe.length]})})]},Ce)}),r&&!a&&ot&&Tt.length>0&&nt(Tt,!0),r&&!a&&Et&&o.jsx(Mo,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a scene from its card and it stays here.",mark:My,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>_({bookmarked:null}),children:"Browse every scene"})}),r&&!a&&h.length>0&&!Et&&Mt.length===0&&Xt.length===0&&o.jsx(m2,{noun:"scenes",q:K,facet:wt?null:q?"Keepers":z,onClearSearch:O,onClearAll:Y}),ot&&Ee>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:Je,children:["Show ",Math.min(Ee,60)," more"]})})]})}),o.jsx(_c,{}),Z.kind==="owned-scene"&&Z.ids.size>0&&o.jsx("div",{className:"sc-wall-dock",children:o.jsx(Py,{count:Z.ids.size,loaded:sn.length,tool:ls("owned-scene",Z.ids.size).tool,icon:ls("owned-scene",Z.ids.size).icon,danger:!0,onAct:ce,keep:{label:mt.tool,filled:Ve,onAct:Ie},onClear:Z.clear,onSelectAll:()=>Z.selectAll("owned-scene",sn.map(Ce=>Ce.id))})})]})}function Ty(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 Ae.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 Q4=[{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"}],vL=4;function uie(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 Dy({to:e,wall:t,where:n}){return o.jsxs("div",{className:"sc-lookpage-crumb",children:[o.jsx(Zn,{to:e,children:t}),o.jsx("span",{children:"/"}),o.jsx("span",{children:n})]})}function Hy({kind:e,brandId:t,id:n}){const[r,a]=s.useState(()=>kd(e,t).includes(n));s.useEffect(()=>{a(kd(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(c2(e,t,n).includes(n)),children:o.jsx(Qa,{size:15,weight:r?"fill":"regular"})})})}function die({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(Cn,{size:10,weight:"bold"})})]},l))]}),o.jsx(wl,{size:13,className:"sc-chipfield-caret","aria-hidden":!0})]})}function fie({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),[m,g]=s.useState(""),w=s.useRef(null),y=[...n,...e.filter(L=>!n.some(T=>Ru(T,L)))],b=m.trim(),k=b?y.filter(L=>L.toLowerCase().includes(b.toLowerCase())):y,S=e.length>=u,E=b.length>0&&!y.some(L=>Ru(L,b))&&!S,C=L=>{const T=e.some(M=>Ru(M,L));!T&&S||t(T?e.filter(M=>!Ru(M,L)):[...e,L])},A=()=>{var L;E&&(t([...e,b.slice(0,f)]),g(""),(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||g("")},children:[o.jsx(die,{items:e,placeholder:a,open:h,onOpen:()=>p(!0),onRemove:L=>t(e.filter(T=>!Ru(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:m,maxLength:f,placeholder:i,"aria-label":i,onChange:L=>g(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=>Ru(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(mr,{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 Ru=(e,t)=>e.trim().toLowerCase()===t.trim().toLowerCase();function wL({name:e,categories:t,known:n,hint:r,ways:a,wayChoices:i,wayMax:l,busy:u,error:f,onSave:h,onDismiss:p}){const[m,g]=s.useState(e),[w,y]=s.useState(t),[b,k]=s.useState(()=>[...a??[]]),S=m.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(Us,{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:m,dir:"auto",onChange:M=>g(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(fie,{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(Cn,{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(mr,{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 yL(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 kf({count:e,label:t,className:n,trackClassName:r,style:a,children:i}){const{shellRef:l,railRef:u,page:f}=yL(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(Ra,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-rail-arrow next","aria-label":`${t}, later`,onClick:()=>f(1),children:o.jsx(Cl,{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 g2(){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 Gu({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(Av,{className:"sc-lookcard-more-vert",size:16,weight:"bold"}),o.jsx(jv,{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(sd,{name:"open"}),"Open"]}),a&&o.jsxs(qn,{disabled:l,onSelect:a,children:[o.jsx(sd,{name:"use"}),"Use this view"]}),u&&o.jsxs(qn,{disabled:l,onSelect:i,children:[o.jsx(sd,{name:"cover"}),"Set as cover"]})]})]})})]})}function Qp({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 WS=1500;function bL(e,t,n){const{refreshBrands:r}=$n(),[a,i]=s.useState(null),[l,u]=s.useState([]),[f,h]=s.useState([]),[p,m]=s.useState(!1),[g,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 Ae.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),m(!0),b(!1),((T=M.job)==null?void 0:T.status)==="running"&&(A=setTimeout(L,WS))}catch(M){C&&(M==null?void 0:M.status)!==404&&(A=setTimeout(L,WS*2))}};return L(),()=>{C=!1,A&&clearTimeout(A)}},[e,t,n,g]);const E=s.useCallback(()=>{b(!0),w(C=>C+1)},[]);return{job:a,first:l,more:f,read:p,waiting:y,again:E}}const hie=["no","one","two","three","four","five"];function pie({brandId:e,scene:t,onError:n}){var _;const{applyBrand:r}=$n(),a=l2(),i=g2(),{job:l,first:u,again:f}=bL(e,t.id,t.placeUrl??null),[h,p]=s.useState(!1),[m,g]=s.useState(!1),[w,y]=s.useState(!1),[b,k]=s.useState(null),S=iM(t.examples,l),E=(l==null?void 0:l.status)==="running",C=nq(t.examples),A=async()=>{if(m||!u.length)return;const O=i();g(!0),n(null);try{await Ae.drawSceneExamples(e,t.id,{first:!0}),f()}catch(Y){O()&&n(String((Y==null?void 0:Y.message)??Y))}finally{O()&&g(!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:m,onClick:()=>void A(),children:[C.length?"Draw them again":"Draw it in use",`, ${hie[u.length]??u.length} picture${u.length===1?"":"s"}`]})}):null,T=async O=>{const Y=Q4.find(q=>q.id===O);if(!Y||h)return;const z=i();p(!0),n(null);try{const q=t.setups??[];if(!q.some(Z=>Z.id===Y.id)){const Z=await Ae.updateScene(e,t.id,{setups:[...q,Y]});r(Z.brand)}if(!z())return;a(t.id,Y.id)}catch(q){z()&&n(String((q==null?void 0:q.message)??q))}finally{z()&&p(!1)}},M=async O=>{const Y=i();y(!0),n(null);try{const z=await Ae.updateScene(e,t.id,{cover:O});r(z.brand)}catch(z){Y()&&n(String((z==null?void 0:z.message)??z))}finally{Y()&&y(!1)}},j=bX(t),R=(O,Y)=>O?()=>a(t.id,void 0,O,Y):void 0,P=t.placeUrl?{src:t.placeUrl,label:"The place",view:"place",...t.previewHash?{hash:t.previewHash}:{}}:null,H=O=>o.jsx(Gu,{variant:"sheet",label:O.label,isCover:O.view===j,onUse:R(O.hash,O.view),onCover:()=>void M(O.view),busy:w});if(!S.length&&!P)return o.jsx(Uw,{});if(!S.length&&P)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":`${P.label}, open`,onClick:()=>k(P),children:o.jsx(Sa,{src:Ln(P.src,"tile"),srcSet:wc(P.src)})}),o.jsx(Gu,{variant:"tile",label:P.label,isCover:!0,onOpen:()=>k(P),onUse:R(P.hash,"place")})]}),L,b&&o.jsx(Sd,{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?Q4.find(O=>O.id===D.setup):void 0,V=!!B&&((t.setups??[]).some(O=>O.id===B.id)||(t.setups??[]).length<vL),K=E&&l?Dw({status:l.status,step:l.current,done:l.done.length,total:l.roles.length,error:l.error}):C.length>0?`${C.length===1?`The ${Ya[C[0]].toLowerCase()} shows`:"These show"} an earlier picture of this place.`:null,U=((_=S[0])==null?void 0:_.role)==="hero",I=P?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(P),children:o.jsx(Sa,{src:Ln(P.src,"tile"),srcSet:wc(P.src)})}),o.jsx(Gu,{variant:"tile",label:P.label,isCover:j==="place",onOpen:()=>k(P),onUse:R(P.hash,"place"),onCover:()=>void M("place"),busy:w})]}),o.jsx(Qp,{label:"The place",isCover:j==="place"})]},"place"):null;return o.jsxs(o.Fragment,{children:[o.jsxs(kf,{count:S.length+(P?1:0),label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:[!U&&I,S.map((O,Y)=>{const z=Ya[O.role],q=()=>k({src:O.url,label:z,view:O.role,tile:O,...O.hash?{hash:O.hash}:{}});return o.jsxs(s.Fragment,{children:[o.jsxs("li",{children:[O.state==="drawing"?o.jsxs("span",{className:"sc-refset-tile","data-state":"drawing",role:"img","aria-label":`${z}, drawing`,children:[O.url&&o.jsx(Sa,{src:Ln(O.url,"tile"),srcSet:wc(O.url)}),o.jsx(Na,{})]}):O.state==="failed"?o.jsxs("span",{className:"sc-refset-tile","data-state":"failed",role:"img","aria-label":`${z} did not draw`,title:O.error?df(O.error)??O.error:void 0,children:[o.jsx(Vc,{size:20,"aria-hidden":!0}),o.jsx("span",{children:"Did not draw"}),O.error&&o.jsx("small",{className:"sc-refset-why",children:df(O.error)??O.error})]}):o.jsxs("span",{className:"sc-sceneview-frame","data-cover":j===O.role||void 0,children:[o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":`${z}${j===O.role?", the cover":""}, open`,onClick:q,children:o.jsx(Sa,{src:Ln(O.url,"tile"),srcSet:wc(O.url)})}),o.jsx(Gu,{variant:"tile",label:z,isCover:j===O.role,onOpen:q,onUse:R(O.hash,O.role),onCover:()=>void M(O.role),busy:w})]}),o.jsx(Qp,{label:z,isCover:j===O.role})]}),U&&Y===0&&I]},O.role)})]}),K&&o.jsx("p",{className:"sc-scenepage-examples-state","aria-live":"polite",children:K}),L,b&&o.jsx(Sd,{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 KS=["hero","place","close","hands","angle","bold"],GS=3;function mie(){var Be,vt,Ue,Xe,De;const{sceneId:e}=na(),{scenes:t,loaded:n,error:r,refetch:a,applyBrand:i,refreshBrands:l}=$n(),{brand:u}=cn(),f=t,h=Bn(),p=l2(),m=u.id,[g,w]=s.useState([]),[y,b]=s.useState([]),[k,S]=s.useState(null),[E,C]=s.useState(!1),[A,L]=s.useState(null),T=G=>h(zr(u,G)),M=pf(u,e??""),j=M??f.find(G=>G.id===e);Gc(j==null?void 0:j.name);const R=!!M;s.useEffect(()=>{let G=!0;if(w([]),b([]),!R)return Ae.sceneFrames(e??"").then(oe=>{G&&(w(oe.frames),b(oe.views??[]),S(e??""))}).catch(()=>{G&&(w([]),S(e??""))}),()=>{G=!1}},[e,R]);const P=Ty(u.id,[e??""]),H=s.useMemo(()=>{if(!j||R)return[];return f.filter(We=>We.id!==j.id).sort((We,Oe)=>oe(Oe)-oe(We)).slice(0,8);function oe(We){const Oe=We.lighting.split(/[ ,]+/).some(X=>X.length>3&&j.lighting.toLowerCase().includes(X.toLowerCase())),ie=We.collections.some(X=>j.collections.includes(X));return(Oe?2:0)+(ie?1:0)}},[f,j,R]),D=s.useMemo(()=>{if(j||!n||r)return[];const G=ki(m);return GP(f,oe=>G.includes(oe.id)).slice(0,6)},[j,n,r,f,m]),[B,V]=s.useState(null),[K,U]=s.useState(!1),[I,_]=s.useState(!1),[O,Y]=s.useState(!1),z=s.useRef(!1),q=g2(),Z=s.useMemo(()=>[...new Set([...f.flatMap(G=>G.verticals),...qc(u).flatMap(G=>G.verticals)])].sort((G,oe)=>G.localeCompare(oe)),[f,u]),Q=async G=>{if(M){_(!0),V(null);try{const oe=await Ae.updateScene(u.id,M.id,{name:G.name,verticals:G.categories,...G.ways?{setups:G.ways}:{}});i(oe.brand),Y(!1)}catch(oe){V(String(oe.message??oe))}finally{_(!1)}}},me=async()=>{if(!M||z.current)return;z.current=!0;const G=q(),oe=fl(u);U(!0);try{const We=await Ae.deleteScene(u.id,M.id);i(We.brand)}catch(We){if((We==null?void 0:We.status)!==404){z.current=!1,G()&&(V(String(We.message??We)),U(!1));return}await l()}G()&&h(oe,{replace:!0})};if(!n&&!M)return o.jsx(us,{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(us,{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(us,{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(Zn,{className:"sc-btn sc-btn-primary",to:`${Er(u)}?compose=1`,children:"Start from scratch"}),o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:fl(u),children:"Browse all scenes"})]}),D.length>0&&o.jsx(ad,{label:"You might like",children:D.map(G=>o.jsx(bf,{scene:G,variant:"navigate",size:"slider",onOpen:T,href:zr(u,G.id)},G.id))})]})});const te=y.length?[...y].sort((G,oe)=>KS.indexOf(G.view)-KS.indexOf(oe.view)).map(G=>({src:G.url,label:G.view==="place"?"The place":Ya[G.view],view:G.view})):g.length?g.map((G,oe)=>({src:G,label:`Example ${oe+1}`})):j.previewUrl?[{src:j.previewUrl,label:j.cover&&j.cover!=="place"?Ya[j.cover]:"The place"}]:[],he=async G=>{if(E)return;const oe=q();C(!0),V(null);try{const{hash:We}=await Ae.pickSceneView(j.id,G);if(!oe())return;p(j.id,void 0,We,G)}catch(We){V(String((We==null?void 0:We.message)??We))}finally{C(!1)}},re=(M==null?void 0:M.setups)??[],ee=((M==null?void 0:M.refs)??[]).filter(G=>G!==(M==null?void 0:M.placeUrl)),J=((vt=(Be=M==null?void 0:M.examples)==null?void 0:Be.find(G=>!G.earlier))==null?void 0:vt.with)??((Xe=(Ue=M==null?void 0:M.examples)==null?void 0:Ue[0])==null?void 0:Xe.with),ae=!!M&&(M.anchor===!0||!!(M.figure&&M.figureTreatment)),Me=M!=null&&M.previewHash||(De=M==null?void 0:M.examples)!=null&&De.length?" Use a view to shoot like it.":"",ue=M?M.figure&&ae?`The person in it is a stand-in: with a presenter attached, the picture goes with the shot and they take the role.${Me}`:ae?`${J?`Shown in use with a Scenri demo ${J}. `:""}Shots are given its picture as their world and find their own frame in it.${Me}`:J?`Shown in use with a Scenri demo ${J}. Shots are told the words.${Me}`:M.placeUrl?`Shots are told the words.${Me}`:"":"",Se=M?uie({refs:ee,setups:M.setups},ue):"";return o.jsx(us,{children:o.jsxs("main",{className:"sc-lookpage sc-scenepage",id:"main",children:[o.jsx(Dy,{to:fl(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(G=>o.jsx("li",{className:"sc-chip","data-static":!0,children:G},G))}),o.jsx("p",{className:"sc-lookpage-lede",children:j.description}),o.jsxs("div",{className:"sc-lookpage-acts",children:[re.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(wl,{size:12,weight:"bold","aria-hidden":!0})})}),o.jsx(As,{children:re.map(G=>o.jsx(qn,{onSelect:()=>void p(j.id,G.id),children:G.label},G.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(Zn,{className:"sc-btn sc-btn-ghost",to:Nw(u,M.id),children:"Edit scene"}),o.jsx(Hy,{kind:"scene",brandId:m,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:()=>Y(!0),children:o.jsx(Cd,{size:17})})})]}),B&&o.jsx("p",{className:"sc-assetform-err",children:B}),M?o.jsx(pie,{brandId:u.id,scene:M,onError:V},M.id):k!==(e??"")?o.jsx(kf,{count:GS,label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:Array.from({length:GS},(G,oe)=>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(Qp,{label:"",isCover:!1})]},oe))}):te.length>1?o.jsx(kf,{count:te.length,label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:te.map(G=>o.jsxs("li",{children:[o.jsxs("span",{className:"sc-sceneview-frame",children:[o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":`${G.label}, open`,onClick:()=>L(G),children:o.jsx(Sa,{src:Ln(G.src,"tile"),srcSet:wc(G.src)})}),G.view&&o.jsx(Gu,{variant:"tile",label:G.label,isCover:!1,onOpen:()=>L(G),onUse:()=>void he(G.view),busy:E})]}),o.jsx(Qp,{label:G.label,isCover:!1})]},G.src))}):te.length===1?o.jsx("div",{className:"sc-scenepage-place",children:o.jsx("button",{type:"button",className:"sc-scenepage-open","aria-label":`${te[0].label}, open`,onClick:()=>L(te[0]),children:o.jsx(Sa,{src:Ln(te[0].src,"tile"),srcSet:wc(te[0].src)})})}):o.jsx(Uw,{}),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:we.lightLabel}),o.jsx("dd",{dir:"auto",children:M.lighting})]}),M.camera&&o.jsxs("div",{children:[o.jsx("dt",{children:we.cameraLabel}),o.jsx("dd",{dir:"auto",children:M.camera})]}),M.figure&&o.jsxs("div",{children:[o.jsx("dt",{children:we.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."})]}),ee.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:ee.map((G,oe)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${oe+1}, open`,onClick:()=>L({src:G,label:`Source photo ${oe+1}`}),children:o.jsx(Sa,{src:Ln(G,"micro")})},G))})]}),M&&o.jsxs("div",{className:"sc-prec",children:[Se&&o.jsx("p",{className:"sc-prec-note",children:Se}),o.jsx(Xn,{label:"Delete scene",title:`Delete ${M.name}?`,body:Si("owned-scene",1),busy:K,onConfirm:()=>void me()})]}),P.length>0&&o.jsx(ad,{label:`Shots made in ${j.name}`,children:P.map(G=>o.jsx(Ww,{node:G,to:Zm(u,null,G.id)},G.id))}),H.length>0&&o.jsx(ad,{label:"Other scenes, similar light",children:H.map(G=>o.jsx(bf,{scene:G,variant:"navigate",size:"slider",onOpen:T,href:zr(u,G.id)},G.id))}),O&&M&&o.jsx(wL,{name:M.name,categories:M.verticals,known:Z,hint:"The verticals this place suits, so it surfaces where you work.",ways:re,wayChoices:Q4,wayMax:vL,busy:I,error:B,onSave:G=>void Q(G),onDismiss:()=>Y(!1)}),A&&o.jsx(Sd,{src:A.src,kind:"scene",label:A.label,noun:j.name,onClose:()=>L(null),actions:A.view?o.jsx(Gu,{variant:"sheet",label:A.label,isCover:!1,onUse:()=>void he(A.view),busy:E}):void 0})]})})}function gie({draft:e,href:t,onDiscard:n,chosen:r,batching:a,onPick:i,batch:l}){return o.jsx(mL,{id:e.id,name:e.name.trim()||"Untitled presenter",hash:e.hash,drawing:!!e.drawing,state:vie(e),href:t,blank:o.jsx(dF,{size:44,weight:"thin"}),onDiscard:n,chosen:r,batching:a,onPick:i,batch:l})}function vie(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 wie({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 m=()=>{!p||t||f.current||(f.current=!0,r(h))};return o.jsxs(Us,{className:"sc-newdlg sc-pdetails",maxWidth:"min(420px, 94vw)",onDismiss:a,onOpenAutoFocus:g=>{g.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:g=>l(g.target.value),onKeyDown:g=>g.key==="Enter"&&m()})]}),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:m,children:t?"Duplicating":"Duplicate"})]})]})}const yie=60;function bie(e,t,n=yie){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 xie=8,u6="__bookmarked";function kie(){const{presenters:e,presenterCategories:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:l}=$n(),{brand:u}=cn(),f=Bn(),h=vy(),{push:p}=rr(),{q:m,setQ:g,facets:w,setFacets:y,clearSearch:b,clear:k}=d1(["category","bookmarked"]),S=w.category,E=w.bookmarked==="1",[C,A]=s.useState(()=>kd("presenter",u.id)),L=ke=>A(c2("presenter",u.id,ke)),T=Ly(`${u.id}|${m}|${S??""}|${E?"1":""}`),M=Fl(),j=s.useMemo(()=>r1(u),[u]),[R,P]=ja(qr.wallDensity,wd),H=Xc(R),D=ke=>P(ke),B=Qm(H),V=qm(H),K=ke=>f(Aa(u,ke)),U=ke=>f(Vm(u,ke)),I=s.useMemo(()=>S?e.filter(ke=>ke.suitableCategories.includes(S)):e,[e,S]),_=s.useMemo(()=>I.filter(ke=>Oo(Up(ke),m)),[I,m]),O=s.useRef(null),Y=s.useRef(null),z=o.jsxs("button",{ref:Y,type:"button",className:"sc-btn sc-btn-primary",onClick:()=>M("presenter"),children:[o.jsx(mr,{size:12})," Create presenter"]}),[q,Z]=s.useState([]),Q=s.useRef(0),me=s.useCallback(()=>{const ke=++Q.current;return Ae.presenterDrafts(u.id).then(it=>{ke===Q.current&&Z(it.drafts.filter(ft=>!ft.presenterId))}).catch(()=>{}),()=>{ke===Q.current&&Q.current++}},[u.id]),te=!!pn({path:pt.presenterStudio}),{tasks:he}=sa(),re=he.filter(ke=>ke.id.startsWith("presenter:")).map(ke=>`${ke.id}:${ke.state}:${ke.percent??""}`).join("|");s.useEffect(()=>{if(!te)return me()},[te,me,re]);const ee=s.useCallback(ke=>{const it=Math.max(0,q.findIndex(ft=>ft.id===ke));J.current=it,T.forget(ke),Z(ft=>ft.filter($e=>$e.id!==ke)),Ae.deletePresenterDraft(u.id,ke).finally(()=>me())},[u.id,q,me,T.forget]),J=s.useRef(null);s.useEffect(()=>{var $e;const ke=J.current;if(ke===null)return;J.current=null;const it=($e=O.current)==null?void 0:$e.querySelectorAll("[data-build] .sc-cardpuck"),ft=it!=null&&it.length?it[Math.min(ke,it.length-1)]:Y.current??document.querySelector(".sc-new-go");ft==null||ft.focus()},[q]);const[ae,Me]=s.useState(null),[ue,Se]=s.useState(!1),[Be,vt]=s.useState(!1),Ue=s.useCallback(ke=>{const it=q.find(ft=>ft.id===ke);it!=null&&it.drawn?Me(it):ee(ke)},[q,ee]),[Xe,De]=s.useState(null),[G,oe]=s.useState(null),[We,Oe]=s.useState(null),[ie,X]=s.useState(!1),[se,Re]=s.useState(null),[_e,Ye]=s.useState(null),ge=s.useCallback(ke=>{const it=j.find(ft=>ft.id===ke);it&&(Re(null),De(it))},[j]),Qe=s.useCallback(ke=>{const it=j.find(ft=>ft.id===ke);it&&(Re(null),oe(it))},[j]),at=async ke=>{if(!(!G||ie)){X(!0),Re(null);try{i((await Ae.updatePresenter(u.id,G.id,{name:ke})).brand),oe(null)}catch(it){const ft=on(it,"Could not rename this presenter");Re([ft.title,ft.detail].filter(Boolean).join(" "))}finally{X(!1)}}},wt=s.useCallback(ke=>{const it=j.find(ft=>ft.id===ke);it&&Oe(it)},[j]),Et=s.useRef(null);s.useEffect(()=>{var $e;const ke=Et.current;if(ke===null)return;Et.current=null;const it=($e=O.current)==null?void 0:$e.querySelectorAll(".sc-lookcard:not([data-build]) .sc-lookcard-more"),ft=it!=null&&it.length?it[Math.min(ke,it.length-1)]:Y.current??document.querySelector(".sc-new-go");ft==null||ft.focus()},[e,u]);const ot=async ke=>{if(!(!Xe||ie)){X(!0),Re(null);try{const it=await Ae.duplicatePresenter(u.id,Xe.id,ke);i(it.brand),De(null),Ye(it.presenter.id)}catch(it){const ft=on(it,"Could not duplicate this presenter");Re([ft.title,ft.detail].filter(Boolean).join(" "))}finally{X(!1)}}},It=async()=>{if(!(!We||ie)){Et.current=Math.max(0,Mt.findIndex(ke=>ke.id===We.id)),X(!0);try{const ke=await Ae.deletePresenter(u.id,We.id);i(ke.brand),T.forget(We.id),Oe(null)}catch(ke){(ke==null?void 0:ke.status)===404?(await l(),T.forget(We.id),Oe(null)):p(on(ke,"Could not delete this presenter"))}finally{X(!1)}}};s.useEffect(()=>{var it,ft;if(!_e)return;(ft=(it=O.current)==null?void 0:it.querySelector(".sc-lookcard[data-just-added]"))==null||ft.scrollIntoView({block:"nearest"});const ke=window.setTimeout(()=>Ye(null),1800);return()=>window.clearTimeout(ke)},[_e]);const Mt=s.useMemo(()=>j.filter(ke=>S?!ke.suitableCategories.length||ke.suitableCategories.includes(S):!0).filter(ke=>Oo(Up(ke),m)).filter(ke=>E?C.includes(ke.id):!0),[j,S,m,E,C]),Rt=!(j.length>0||q.length>0),Tt=[...j,...e].reduce((ke,it)=>ke+(C.includes(it.id)?1:0),0),Ee=E&&Tt===0,Je=Ee&&Rt,St=Ee&&!Rt,qe=!E||Je,st=Mt.filter(ke=>!E||Je||C.includes(ke.id)),rt=qe&&q.length>0||st.length>0,{visible:Xt,remaining:Gt,showMore:sn}=xf(st,`${u.id}|${S??""}|${E?"keepers":""}|${Je?"browse":""}|${m}`),[Ut,An]=s.useState(null);s.useEffect(()=>{if(!Ut||Gt<=0)return;const ke=new IntersectionObserver(it=>{it.some(ft=>ft.isIntersecting)&&sn()},{root:Ut.closest(".sc-home"),rootMargin:"200% 0px"});return ke.observe(Ut),()=>ke.disconnect()},[Ut,Gt,sn]);const Bt=s.useMemo(()=>!E||Je?_:_.filter(ke=>C.includes(ke.id)),[_,E,Je,C]),{visible:ne,remaining:ce,showMore:de}=xf(Bt,`${S??""}|${E?"keepers":""}|${Je?"browse":""}|${m}`),Ve=e.length+j.length>0?"tabs":"none",Ie=s.useCallback(async ke=>{const{failed:it,error:ft}=await Xp(ke,$e=>Ae.deletePresenterDraft(u.id,$e));Z($e=>$e.filter(Ke=>it.includes(Ke.id)||!ke.includes(Ke.id))),T.retain(it),me(),ft&&p(on(ft,"Could not discard these drafts"))},[u.id,me,T.retain,p]),mt=()=>{const ke=q.filter(it=>T.ids.has(it.id));ke.some(it=>it.drawn)?ke.length===1?Me(ke[0]):Se(!0):Ie(ke.map(it=>it.id))},bt=()=>{const ke=[...T.ids];ke.length===1?wt(ke[0]):vt(!0)},kt=[...T.ids],nt=T.kind==="presenter"&&kt.length>0&&kt.every(ke=>C.includes(ke)),yt=()=>A(wy("presenter",u.id,kt,!nt)),Ce=d2(T.ids.size,nt,"presenters"),xe=async()=>{if(ie)return;const ke=[...T.ids];X(!0);try{const{failed:it,error:ft}=await Xp(ke,$e=>Ae.deletePresenter(u.id,$e));await l(),T.retain(it),vt(!1),ft&&p(on(ft,"Could not delete these presenters"))}finally{X(!1)}},et={key:"category",label:"Category",everyLabel:"All presenters",everyCount:e.length+j.length,selected:E?u6:S,onSelect:ke=>y(ke===u6?{bookmarked:"1",category:null}:{bookmarked:null,category:ke}),options:[{value:u6,label:"Keepers",count:Tt},...t.map(ke=>({value:ke,label:ke,count:[...j,...e].filter(it=>!it.suitableCategories.length||it.suitableCategories.includes(ke)).length}))]},Ct=o.jsx(h2,{title:"Presenters",filters:o.jsx(p2,{mode:Ve,group:et}),density:o.jsx(Xm,{value:H,onChange:D}),search:e.length>=xie&&o.jsx(Id,{value:m,onChange:g,noun:"presenters",total:e.length})});return o.jsxs(s1.Provider,{value:V,children:[o.jsx(us,{children:o.jsxs("main",{className:"sc-looks sc-presenters",id:"main","data-hero":Rt||void 0,onClick:T.onBlank,children:[!Rt&&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:O,className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:[qe&&q.map(ke=>o.jsx(gie,{draft:ke,href:pl(u,ke.id),onDiscard:Ue,chosen:T.ids.has(ke.id),batching:T.batching==="draft",onPick:T.picking("draft")?it=>T.toggle("draft",it):void 0,batch:T.kind==="draft"&&T.ids.has(ke.id)?{count:T.ids.size,onAct:mt}:null},ke.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:ke=>{ke||Me(null)},onConfirm:()=>{ee(ae.id),Me(null)}}),Xt.map(ke=>o.jsx(X4,{presenter:ke,variant:"use",size:"grid",onOpen:K,href:Aa(u,ke.id),onUse:h,onDuplicate:ge,onEdit:U,onDelete:wt,onRename:Qe,bookmarked:C.includes(ke.id),onBookmark:L,fresh:ke.id===_e,chosen:T.ids.has(ke.id),batching:T.batching==="presenter",onPick:T.picking("presenter")?it=>T.toggle("presenter",it):void 0,batch:T.kind==="presenter"&&T.ids.has(ke.id)?{count:T.ids.size,onAct:bt,onKeep:yt,allKept:nt}:null},ke.id)),G&&o.jsx(Ry,{title:"Rename presenter",name:G.name,maxLength:60,busy:ie,error:se,onConfirm:ke=>void at(ke),onDismiss:()=>{ie||oe(null)}}),Xe&&o.jsx(wie,{suggested:bie(Xe.name,j.map(ke=>ke.name)),busy:ie,error:se,onConfirm:ke=>void ot(ke),onDismiss:()=>{ie||De(null)}}),We&&o.jsx(Xn,{label:"Delete presenter",title:`Delete ${We.name}?`,body:Si("presenter",1),open:!0,busy:ie,onOpenChange:ke=>{!ke&&!ie&&Oe(null)},onConfirm:()=>void It()}),Be&&o.jsx(Xn,{label:ls("presenter",T.ids.size).menu,title:`${ls("presenter",T.ids.size).menu}?`,body:Si("presenter",T.ids.size),open:!0,busy:ie,onOpenChange:ke=>{!ke&&!ie&&vt(!1)},onConfirm:()=>void xe()}),ue&&o.jsx(Xn,{label:ls("draft",T.ids.size).menu,title:`${ls("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:ke=>{ke||Se(!1)},onConfirm:()=>{const ke=[...T.ids];Se(!1),Ie(ke)}})]}),Gt>0&&o.jsx("div",{ref:An,"aria-hidden":!0}),Gt>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:sn,children:["Show ",Math.min(Gt,60)," more"]})})]}),Rt&&n&&!r&&e.length>0&&o.jsx(Mo,{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&&ne.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(fL,{size:"grid",count:8})}),n&&r&&o.jsx(Mo,{shape:"error",title:"Couldn't load the presenter library",body:"Something went wrong reaching the catalog.",onRetry:()=>a()}),Rt&&n&&!r&&e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx($y,{label:"Or cast someone from ours"}),Ct]}),n&&!r&&ne.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:ne.map(ke=>o.jsx(X4,{presenter:ke,variant:"use",size:"grid",onOpen:K,href:Aa(u,ke.id),onUse:h,bookmarked:C.includes(ke.id),onBookmark:L},ke.id))}),n&&!r&&St&&o.jsx(Mo,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a presenter from its card and it stays here.",mark:My,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>y({bookmarked:null}),children:"Browse every presenter"})}),n&&!r&&!St&&!Bt.length&&e.length>0&&o.jsx(m2,{noun:"presenters",q:m,facet:E?"Keepers":S,onClearSearch:b,onClearAll:k}),n&&!r&&!e.length&&o.jsx(Mo,{shape:"zero",body:"The presenter library is still being cast. Check back soon."}),ce>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(ce,60)," more"]})})]})}),T.ids.size>0&&(T.kind==="draft"||T.kind==="presenter")&&o.jsx("div",{className:"sc-wall-dock",children:o.jsx(Py,{count:T.ids.size,loaded:T.kind==="draft"?q.length:Xt.length,tool:ls(T.kind,T.ids.size).tool,icon:ls(T.kind,T.ids.size).icon,danger:ls(T.kind,T.ids.size).danger,onAct:T.kind==="draft"?mt:bt,keep:T.kind==="presenter"?{label:Ce.tool,filled:nt,onAct:yt}:null,onClear:T.clear,onSelectAll:()=>T.selectAll(T.kind==="draft"?"draft":"presenter",(T.kind==="draft"?q:Xt).map(ke=>ke.id))})}),o.jsx(_c,{})]})}const YS={portrait:"Face",identity:"Face",front:"Full body","three-quarter":"Three-quarter",back:"Back",left:"Left",right:"Right","left-profile":"Left","right-profile":"Right"},qS=3;function Sie(){var te;const{presenterId:e=""}=na(),{presenters:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:l,presenterCategories:u}=$n(),{brand:f}=cn(),h=Bn(),p=g2(),m=s.useRef(!1),g=vy(),[w,y]=s.useState([]),[b,k]=s.useState(null),[S,E]=s.useState(null),C=vX(f,e),A=C??t.find(he=>he.id===e);Gc(A==null?void 0:A.name);const L=!!C,[T,M]=s.useState(null);s.useEffect(()=>{let he=!0;if(y([]),!L)return Ae.presenterFrames(e).then(re=>{he&&(y(re.frames),M(e))}).catch(()=>{he&&(y([]),M(e))}),()=>{he=!1}},[e,L]);const j=!!pn({path:pt.presenterEdit});s.useEffect(()=>{let he=!0;if(E(null),!(!L||j))return Ae.presenterDrafts(f.id).then(re=>{if(!he)return;const ee=re.drafts.find(J=>J.presenterId===e);E((ee==null?void 0:ee.id)??null)}).catch(()=>{}),()=>{he=!1}},[f.id,e,L,j]);const R=((te=f.json)==null?void 0:te.characters)??[],P=R.find(he=>he.presenterId===e),H=R.find(he=>he.id===e),D=Ty(f.id,[e??"",(P==null?void 0:P.id)??""]),[B,V]=s.useState(null),[K,U]=s.useState(!1),[I,_]=s.useState(!1),O=async he=>{if(C){U(!0),V(null);try{const re=await Ae.updatePresenter(f.id,C.id,he);i(re.brand),_(!1)}catch(re){V(String(re.message??re))}finally{U(!1)}}},Y=async()=>{if(!C||m.current)return;m.current=!0;const he=p(),re=li(f);U(!0);try{const ee=await Ae.deletePresenter(f.id,C.id);i(ee.brand)}catch(ee){if((ee==null?void 0:ee.status)!==404){m.current=!1,he()&&(V(String(ee.message??ee)),U(!1));return}await l()}he()&&h(re,{replace:!0})},z=Bw(f,e);if(z!==e)return o.jsx(Xa,{to:Aa(f,z),replace:!0});if(!n&&!C)return o.jsx(us,{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(us,{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(us,{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(Zn,{className:"sc-btn sc-btn-primary",to:li(f),children:"Browse presenters"})})]})});const q=C?(Array.isArray(H==null?void 0:H.shots)?H.shots:[]).map((he,re)=>({src:Jr(he==null?void 0:he.file),label:YS[(he==null?void 0:he.angle)??""]??`Reference ${re+1}`,angle:typeof(he==null?void 0:he.angle)=="string"?he.angle:void 0})).filter(he=>!!he.src):w.length?w.map((he,re)=>({src:he.url,label:YS[he.angle]??`Reference ${re+1}`,angle:he.angle})):A.previewUrl?[{src:A.previewUrl,label:"Preview"}]:[],Z=Vm(f,e),Q=yi(C??A),me=[...new Set([...u,...r1(f).flatMap(he=>he.suitableCategories??[])])].sort((he,re)=>he.localeCompare(re));return o.jsx(us,{children:o.jsxs("main",{className:"sc-lookpage sc-presenterpage",id:"main",children:[o.jsx(Dy,{to:li(f),wall:"Presenters",where:C?"Yours":"Scenri library"}),Q.src&&o.jsx("div",{className:"sc-presenterpage-avatar",children:o.jsx(Sa,{src:Ln(Q.src,"small"),crop:Q.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(he=>o.jsx("li",{className:"sc-chip","data-static":!0,children:he},he))}),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:()=>g(e),children:"Use in a shot"}),C&&o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:Z,children:S?"Continue editing":"Edit presenter"}),o.jsx(Hy,{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:()=>_(!0),children:o.jsx(Cd,{size:17})})})]}),B&&o.jsx("p",{className:"sc-assetform-err",children:B}),!C&&T!==e?o.jsx(kf,{count:qS,label:"Reference set",className:"sc-refset-rail",trackClassName:"sc-refset",children:Array.from({length:qS},(he,re)=>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"})]},re))}):q.length>0?o.jsx(kf,{count:q.length,label:"Reference set",className:"sc-refset-rail",trackClassName:"sc-refset",children:q.map(he=>o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-refset-tile","data-role":he.angle,"aria-label":`${he.label}, open`,onClick:()=>k(he),children:o.jsx(Sa,{src:Ln(he.src,"small")})}),o.jsx("span",{className:"sc-refset-lb","aria-hidden":!0,children:he.label})]},he.label))}):o.jsx(Uw,{}),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((he,re)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${re+1}, open`,onClick:()=>k({src:he,label:`Source photo ${re+1}`}),children:o.jsx(Sa,{src:Ln(he,"micro")})},he))})]}),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:Si("presenter",1),busy:K,onConfirm:()=>void Y()})]}),D.length>0&&o.jsx(ad,{label:`Shots featuring ${A.name}`,children:D.map(he=>o.jsx(Ww,{node:he,to:Zm(f,null,he.id)},he.id))}),I&&C&&o.jsx(wL,{name:C.name,categories:A.suitableCategories,known:me,hint:"The verticals they suit, so they surface where you work.",busy:K,error:B,onSave:he=>void O({name:he.name,suitableCategories:he.categories}),onDismiss:()=>_(!1)}),b&&o.jsx(Sd,{src:b.src,kind:"presenter",label:b.label,noun:A.name,onClose:()=>k(null)})]})})}function Eie({placeholder:e,label:t,action:n="Send",scope:r,hint:a,value:i,onValue:l,allowEmpty:u,disabled:f,why:h,quiet:p,working:m,error:g,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,R]=s.useState(void 0);s.useLayoutEffect(()=>{const z=T.current;if(!z)return;z.style.height="auto";const q=Number.parseFloat(getComputedStyle(z).maxHeight)||Number.POSITIVE_INFINITY;z.style.height=`${Math.min(z.scrollHeight,q)}px`,z.style.overflowY=z.scrollHeight>q?"auto":"hidden"},[i]);const[P,H]=s.useState(!1),D=Mr(aa);s.useEffect(()=>{if(!w||w===j||f||(R(w),D))return;const z=T.current;if(z==null||z.focus({preventScroll:!0}),z!=null&&z.value){z.select(),H(!0);const q=setTimeout(()=>H(!1),700);return()=>clearTimeout(q)}},[w,j,f,D]);const B=f||m,V=!!(C!=null&&C.hex)||!!(A!=null&&A.some(z=>!z.busy)),K=!i.trim()&&!u&&!V,U=()=>{B||K||L(i)},I=g?{text:g,tone:"alert"}:{text:(r==null?void 0:r.hint)??a??"",tone:r==null?void 0:r.tone},_=!!y&&(m||!i.trim()&&!V),O=m||_?null:f&&h?h:K&&!f?"Nothing typed yet.":null,Y=o.jsxs("button",{type:"button",className:"sc-convo-send","aria-disabled":(_?!!b:m||B||K)||void 0,"aria-busy":m||_||void 0,"data-stop":_||void 0,onClick:_?b?void 0:y:m?void 0:U,children:[o.jsx("span",{className:"sc-convo-send-ico",children:m||_?o.jsx("span",{className:"sc-convo-spin","aria-hidden":"true"}):o.jsx(K7,{size:17,weight:"bold"})}),_?b?"Stopping":"Stop":m?"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":P||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(Cn,{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(yd,{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(Cn,{size:11,weight:"bold"})})]}),o.jsx("textarea",{ref:T,className:"sc-in",rows:1,maxLength:xd,"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(),U())}})]}),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(mr,{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 q=Array.from(z.target.files??[]).filter(Z=>Z.type.startsWith("image/"));z.target.value="",q.length&&S(q)}})]}),O?o.jsx(fr,{label:O,children:Y}):Y]})]}),I.text?o.jsx("small",{className:"sc-convo-line",role:I.tone==="alert"?"alert":void 0,"data-tone":I.tone,children:I.text}):null]})}function xL({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 XS=500,kL=400,SL=760,Pu=e=>Math.min(SL,Math.max(kL,Math.round(e)));function Cie({title:e,headAction:t,stage:n,body:r,bodyProps:a,foot:i,overlay:l,kind:u,resizeLabel:f,onPaste:h,onDropFiles:p,onClose:m}){const g=s.useRef(null),[w,y]=s.useState(null);Ay(w,"--sc-pstudio-dock-h"),s.useEffect(()=>{const A=L=>{L.key!=="Escape"||L.defaultPrevented||(L.preventDefault(),m())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[m]);const[b,k]=ja(qr.pstudioRailW,XS),S=s.useRef(0),E=s.useRef(0),C=s.useRef(null);return Br.createPortal(o.jsx(Ad,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:A=>{var L;C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,A.preventDefault(),(L=g.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:g,tabIndex:-1,className:"sc-pstudio","data-kind":u,style:{"--sc-pstudio-rail-set":`${Pu(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:m,"aria-label":"Close",children:o.jsx(Cn,{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:m,"aria-label":"Close",children:o.jsx(Cn,{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":kL,"aria-valuemax":SL,"aria-valuenow":Pu(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",`${Pu(window.innerWidth-S.current)}px`)}))},onPointerUp:A=>{A.currentTarget.releasePointerCapture(A.pointerId),E.current&&(cancelAnimationFrame(E.current),E.current=0),k(Pu(window.innerWidth-A.clientX))},onDoubleClick:()=>k(XS),onKeyDown:A=>{if(A.key==="ArrowLeft")k(L=>Pu(L+16));else if(A.key==="ArrowRight")k(L=>Pu(L-16));else return;A.preventDefault()}})]}),l]})}),document.body)}function jie({hash:e,alt:t,drawing:n,since:r,items:a,onPick:i,compare:l,doing:u,takes:f,onTake:h,empty:p,glyph:m}){const g=Aie(n),[w,y]=s.useState(null),b=f??[],k=Math.max(0,b.findIndex(P=>w?P.hash===w:P.current)),S=b[k];s.useEffect(()=>y(null),[e]);const E=Nie(w&&b.some(P=>P.hash===w)?w:e),[C,A]=s.useState(void 0);s.useEffect(()=>{E||A(void 0)},[E]);const L=P=>{const H=b[k+P];H&&y(H.hash)},T=s.useRef(null),[M,j]=s.useState(!1);s.useLayoutEffect(()=>{const P=T.current,H=!!(P!=null&&P.complete&&P.naturalWidth);j(!H),H&&(P!=null&&P.naturalHeight)&&A(P.naturalWidth/P.naturalHeight)},[E]);const R=!!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:Dr(E),srcSet:`${mn(E,"tile")} 640w, ${Dr(E)} 1024w`,sizes:"(max-width: 767px) 92vw, 44vw",alt:t,decoding:"async","data-waiting":M||void 0,onLoad:P=>{const H=P.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(xL,{glyph:m,lead:p==null?void 0:p.lead,hint:p==null?void 0:p.hint})}),(n&&!e||R)&&o.jsx(Na,{}),n&&o.jsxs("span",{className:"sc-pstudio-doing",children:[o.jsx("span",{children:u??"Drawing"}),r&&o.jsx("time",{"aria-hidden":"true",children:$c(r,g)})]}),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(Ra,{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(Cl,{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(P=>{const H=P.label+(P.approved?", used":P.state==="stale"?", to be drawn again":"")+(P.photo?", your photo":"")+(P.drawing?", drawing":"")+(P.error?", failed":"");return o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-pstudio-slot","data-state":P.state,"data-view":P.view,"aria-current":P.state==="current"?"step":void 0,"aria-label":H,disabled:!i,onClick:()=>i==null?void 0:i(P.view),children:o.jsxs("span",{className:"sc-pstudio-slot-inner",children:[P.hash?o.jsx("img",{src:mn(P.hash,"micro"),alt:""}):null,P.drawing?o.jsx(Na,{}):null,P.approved&&!P.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","aria-hidden":!0,children:o.jsx(Kn,{size:11,weight:"bold"})}):null,P.error&&!P.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","data-tone":"alert","aria-hidden":!0,children:o.jsx(gm,{size:11,weight:"bold"})}):null]})}),o.jsx("span",{className:"sc-pstudio-slot-lb","data-on":P.state==="current"||void 0,"aria-hidden":!0,children:P.label})]},P.view)})})]})}function Aie(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 Nie(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=`${mn(e,"tile")} 640w, ${Dr(e)} 1024w`,i.sizes="(max-width: 767px) 92vw, 44vw",i.src=Dr(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 Oy({surface:e,onClose:t}){var h,p,m;const n=Mr(aa),r=e,a=(h=r.stage)==null?void 0:h.onPick,i=a?g=>a(g):void 0,l=tne(r.turns);s.useEffect(()=>{if(!l||r.busy)return;let g=!1;const w=y=>{var k,S;if(y.key!=="Enter"||y.shiftKey||y.defaultPrevented||g)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(),g=!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(fF,{size:32}),f=n?null:r.stage?o.jsx(jie,{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(xL,{glyph:u,lead:(p=r.stageEmpty)==null?void 0:p.lead,hint:(m=r.stageEmpty)==null?void 0:m.hint})})})})});return o.jsx(Cie,{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(Zne,{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:g=>(r.onStarter??r.onText)(g),onDescribe:r.onDescribe,onAttachFiles:r.onAttachRef}),foot:o.jsxs(o.Fragment,{children:[r.dock,r.composer&&o.jsx(Eie,{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 Fd=[{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"}]}}],$a=e=>Fd.find(t=>t.id===e),Mie=/\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 EL(e){return Mie.test(e??"")}function Rie(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&&!EL(n)?`${n} ${r}`:n:r?`${((l=$a(e))==null?void 0:l.label.toLowerCase())??e} ${r}`:""}function QS(e,t){const n=(t??[]).filter(r=>/\b(left|right)\b/i.test(r.words)&&(e==="front"||!Pie.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 Pie=new Set(["tattoo","prosthetic"]),v2=["who","age","heritage","skin","hair","length","facial","eyes","build","height"],Dc="either",Hc=e=>{var t,n;return[(e==null?void 0:e.pick)===Dc?"":(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(", ")},CL=e=>{var t;return!!(e!=null&&e.pick||(t=e==null?void 0:e.words)!=null&&t.trim())},w2=e=>{var t;return((t=e.source)==null?void 0:t.door)==="scratch"},J4=e=>{var t;return w2(e)&&((t=e.source)==null?void 0:t.via)==="taps"},y2=e=>{var t;return w2(e)&&((t=e.source)==null?void 0:t.via)!=="taps"},b2=e=>{var t;return((t=e.source)==null?void 0:t.door)==="photos"},Lie=/\b(slim|slender|athletic|average|fuller|curvy|broad|lean|muscular|petite|stocky|heavy|thin|plus.size)\b/i;function Iy(e){const t=e.trim(),n=t.split(/\s+/).filter(Boolean).length,r=[];return Ap.test(t)||r.push("who"),$w.test(t)||r.push("age"),r.length&&!Lie.test(t)&&n<8&&r.push("build"),r}const $ie=(e,t)=>v2.every(n=>!LL(`look-${n}`,e,t)||e[`look-${n}`]!==void 0),jL=e=>y2(e)&&e.describe!==void 0&&Iy(e.describe).length>0,Tie=e=>y2(e)&&e.describe!==void 0&&(!jL(e)||e.gaps!==void 0),Die=(e,t)=>{var n;return b2(e)&&!!t.draft&&t.draft.source==="photos"&&t.canGenerate&&t.draft.stage!=="analyzing"&&(e.traits!==void 0||!((n=t.draft.keep)!=null&&n.trim()))},AL=(e,t)=>J4(e)?$ie(e,t):y2(e)?Tie(e):Die(e,t),Hie=(e,t)=>w2(e)||b2(e)&&!!t.draft,NL=e=>t=>{var n;return!!((n=t.traits)!=null&&n.includes(e))},ML=e=>t=>CL(t[`trait-${e}`]),RL=e=>t=>{var n;return NL(e)(t)&&ML(e)(t)&&!!((n=$a(e))!=null&&n.where)&&!EL(Hc(t[`trait-${e}`]))},Zh=(e,t)=>Array.isArray(e)&&e.includes(t),Oie=(e,t)=>{var n;return AL(e,t)&&(((n=e.traits)==null?void 0:n.every(r=>ML(r)(e)&&(!RL(r)(e)||e[`trait-${r}-where`]!==void 0)))??!1)},Iie=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),Fie=(e,t)=>{var r;if(!b2(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)},mi=[{id:"source",applies:()=>!0},{id:"photos",applies:b2},{id:"weakphotos",applies:Fie},...v2.map(e=>({id:`look-${e}`,applies:e==="facial"?t=>{var n;return J4(t)&&((n=t["look-who"])==null?void 0:n.pick)!=="woman"}:J4})),{id:"describe",applies:y2},{id:"gaps",applies:jL,dependsOn:[{on:"describe"}]},{id:"traits",applies:Hie,ready:AL},...Fd.flatMap(e=>[{id:`trait-${e.id}`,applies:NL(e.id),dependsOn:[{on:"traits",changed:(t,n)=>Zh(t,e.id)!==Zh(n,e.id)}]},{id:`trait-${e.id}-where`,applies:RL(e.id),dependsOn:[{on:`trait-${e.id}`,changed:(t,n)=>Hc(t)!==Hc(n)},{on:"traits",changed:(t,n)=>Zh(t,e.id)!==Zh(n,e.id)}]}]),{id:"keep",applies:w2,ready:Oie,optional:!0,sticky:!0}],PL=new Map(mi.map(e=>[e.id,e])),_ie=mi.map(e=>e.id),Sf=e=>{const t=mi.findIndex(n=>n.id===e);return t<0?mi.length:t},Vie=e=>PL.get(e);function LL(e,t,n){return Vie(e).applies(t,n)}function $L(e,t,n){if(e==="photos")return!!n.draft&&n.draft.source==="photos";const r=t[e];return r===void 0?!1:dr(e)||zie(e)?CL(r):!0}function TL(e,t){return mi.filter(n=>n.applies(e,t)&&$L(n.id,e,t)).map(n=>n.id)}function x2(e,t){var n;return((n=mi.find(r=>{var a;return!r.optional&&r.applies(e,t)&&(((a=r.ready)==null?void 0:a.call(r,e,t))??!0)&&!$L(r.id,e,t)}))==null?void 0:n.id)??null}function JS(e,t,n){const r={...e},a=new Set,i=new Set(Object.keys(t));for(const[u,f]of Object.entries(t))Iie(e[u],f)&&(f===void 0?delete r[u]:r[u]=f,a.add(u));if(a.size){const u=mi.map(m=>m.id),f=Math.min(...[...a].map(m=>u.indexOf(m))),h=new Set(a),p=m=>(m.dependsOn??[]).some(g=>h.has(g.on));for(const m of mi)u.indexOf(m.id)<=f||i.has(m.id)||r[m.id]===void 0||m.sticky||p(m)||(delete r[m.id],a.add(m.id))}let l=!0;for(;l;){l=!1;for(const u of mi){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 Zie(e){const t={};for(const n of e.traits??[]){const r=e[`trait-${n}`];r&&(t[n]={words:Hc(r)||void 0,where:Hc(e[`trait-${n}-where`])||void 0,refs:r.refs.length?r.refs:void 0})}return t}function DL(e){const t={};for(const n of v2){const r=e[`look-${n}`];r!==void 0&&(t[n]=r)}return t}const HL=e=>Fd.map(t=>t.id).filter(t=>e.includes(t)),dr=e=>e.startsWith("look-"),zie=e=>e.startsWith("trait-"),Js=e=>PL.has(e);function ds(e){if(!e.startsWith("trait-"))return null;const t=e.endsWith("-where"),n=t?e.slice(6,-6):e.slice(6);return $a(n)?{id:n,part:t?"where":"what"}:null}const Bie=[{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"}],Uie=[{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"}],Wie=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"]),Kie=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 Gie(e){const[t,n,r]=Kie(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 m=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:m,l:h}}const Yie=e=>{var t;return((t=Bie.find(n=>e<n.to))==null?void 0:t.name)??"red"};function qie(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 Xie(e){return e<.18?"deep":e<.34?"dark":e>=.88?"pale":e>=.74?"light":""}function OL(e){var u;const{h:t,s:n,l:r}=Gie(e);if(n<.09){const f=((u=Uie.find(h=>r<h.to))==null?void 0:u.name)??"grey";return{name:f,family:f,h:t,s:n,l:r}}const a=Yie(t),i=qie(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=Xie(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 Qie(e){const{family:t,h:n,s:r,l:a}=OL(e);return Wie.has(t)?!0:n>=16&&n<=60&&a>=.7&&r<.7||r<.09}const Fy=[{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"}],IL=[{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"}],_y=[{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"}],FL=[{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"}],Jie=[{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"}],Vy=[{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"}],_L=[{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"}],VL=[{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"}],ele={},ZL=[{id:"woman",label:"Woman"},{id:"man",label:"Man"},{id:"androgynous",label:"Androgynous"}],zL=["20s","30s","40s","50s","60+"].map(e=>({id:e,label:e})),f1={who:{row:{id:"who",label:"Who",options:ZL},prompt:"Who are they?"},age:{row:{id:"age",label:"Age",options:zL},prompt:"Roughly how old?"},heritage:{row:{id:"heritage",label:"Heritage",options:Jie},prompt:"Where are they from?"},skin:{row:{id:"skin",label:"Skin",options:_y},prompt:"And their skin?"},eyes:{row:{id:"eyes",label:"Eyes",options:Vy},prompt:"What colour are their eyes?"},facial:{row:{id:"facial",label:"Facial hair",options:_L},prompt:"Any facial hair?"},hair:{row:{id:"hair",label:"Hair",options:Fy},prompt:"What colour is their hair?"},length:{row:{id:"length",label:"Length",options:IL},prompt:"And the length?"},build:{row:{id:"build",label:"Build",options:FL},prompt:"And their build?"},height:{row:{id:"height",label:"Height",options:VL},prompt:"And how tall?"}};v2.map(e=>f1[e]);const e9=new Set(["hair","skin","eyes"]),tle={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"},nle=e=>e==="man"?"man":e==="woman"?"woman":"androgynous",rle=new Set(["length","height","build"]),sle=900;function Zy(e,t,n){const r=ale(e,t);if(r.far<sle)return r.id;const a=OL(e).name;return n==="hair"&&!Qie(e)?`dyed ${a}`:a}function ale(e,t,n){const r=h=>{const p=h.replace("#","");return(p.length===3?p.split("").map(g=>g+g):[p.slice(0,2),p.slice(2,4),p.slice(4,6)]).map(g=>Number.parseInt(g,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,m,g]=r(h.color),w=(a-p)**2+(i-m)**2+(l-g)**2;w<f&&(f=w,u=h)}return{id:u.id,far:f}}const t9=e=>e==="skin"?_y:e==="eyes"?Vy:Fy,fp=e=>e.charAt(0).toUpperCase()+e.slice(1);function BL(e){const t=H=>H!=null&&H.pick&&H.pick!==Dc?H.pick:"",n=(H,D,B)=>{var K;const V=t(H);return V?V.startsWith("#")?Zy(V,D,B):V:((K=H==null?void 0:H.words)==null?void 0:K.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(" "),g=[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&&g.push(a(y,r(e.age)));const b=[],k=i(e.length,IL),S=i(e.hair,Fy,"hair"),E=[k,S].filter(Boolean).join(" ");E&&b.push(a(`${E} hair`,r(e.length),r(e.hair)));const C=i(e.facial,_L);C&&b.push(a(C,r(e.facial)));const A=i(e.eyes,Vy);A&&b.push(a(`${A} eyes`,r(e.eyes)));const L=i(e.skin,_y,"skin");L&&b.push(a(`${L} skin`,r(e.skin)));const T=i(e.height,VL),M=i(e.build,FL),j=T?a(ele[T]??T,r(e.height)):"",R=M?a(`${/^[aeiou]/.test(M)?"an":"a"} ${M} build`,r(e.build)):"",P=[j,R&&(j?`with ${R}`:R)].filter(Boolean).join(" ");return P&&b.push(P),b.length&&g.push(`with ${b.join(", ")}`),a(g.join(" "),r(e.who))}function ole(e,t){var i,l;const n=t.pick,r=n===Dc?"Either way":n!=null&&n.startsWith("#")?fp(Zy(n,e.options,e.id)):n?((i=e.options.find(u=>u.id===n))==null?void 0:i.label)??fp(n):"",a=((l=t.words)==null?void 0:l.trim())??"";return r?a?`${r}, ${a}`:r:fp(a)}function ile(e){return fp(BL(e))}const Ef=e=>typeof e=="string"&&e.startsWith("aside:"),lle=e=>e.slice(6),Jp={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.",UL=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function ule(e){if(!e||e==="name")return null;if(e==="keep")return"keep";const t=ds(e);return t&&t.part==="what"?`trait-${t.id}`:null}function n9(e,t){var r;const n=ule(t);return n?{id:n,refs:((r=e.answers[n])==null?void 0:r.refs)??[]}:null}function d6(e){const t=e.composing;if(!t)return e.answers;const n=e.answers[t.id];if(!n||UL(n.refs,t.refs))return e.answers;if(!Hc(n)&&!t.refs.length){const r={...e.answers};return delete r[t.id],r}return{...e.answers,[t.id]:{...n,refs:t.refs}}}function dle(e,t){var r;if(!dr(t)&&!ds(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 ev(e,t,n,r){return e.filter(a=>!a.q||!Js(a.q)?!0:!LL(a.q,t,n)||a.edit&&t[a.q]!==void 0?!1:r===void 0||Sf(a.q)<=r)}function fle(e){const t=Object.keys(e).filter(n=>Js(n));return t.length?Math.min(...t.map(Sf)):void 0}function WL(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 f6(e,t){const n=e.unsure;if(!n)return e;const r=x2(e.answers,t),a=u=>u&&(u===r||Js(u)&&e.answers[u]!==void 0)?u:null,i=e.asides.map(u=>u.q==="unsure"?{...u,q:a(n.q)}:u),l=WL(i,{said:n.said,reply:cle,q:a(n.q),at:n.at});return{...e,unsure:null,asides:ev([...i,l],e.answers,t)}}function hle(e,t){var n,r,a;switch(t.type){case"answer":{const i=JS(e.answers,t.patch,t.ctx),l=!UL(i,e.answers),u=f6(e,t.ctx);return{...u,answers:i,revision:l?e.revision+1:e.revision,asides:ev(u.asides,i,t.ctx,fle(t.patch)),editing:null,saying:null,colour:null,composing:null,text:""}}case"edit":{const i=Ef(t.id)||t.id==="name"?void 0:dle(e,t.id);return{...e,answers:d6(e),composing:Ef(t.id)?null:n9(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&&Js(i.q)?i.q:null,u=l&&e.answers[l]!==void 0?JS(e.answers,{[l]:void 0},t.ctx):e.answers,f=ev(e.asides.filter(h=>h.at<=t.at),u,t.ctx,l?Sf(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:d6(e),composing:null,editing:null,saying:null,colour:null,text:""};case"say":{const i=e.saying===t.id?null:t.id;return{...e,answers:d6(e),composing:n9(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&&Js(t.aside.q)&&e.answers[t.aside.q]!==void 0?{...t.aside,after:!0}:t.aside;return{...e,asides:[...e.asides,WL(e.asides,l)],text:""}}case"unsure":return{...f6(e,t.ctx),unsure:t.unsure,text:""};case"settle-unsure":return f6(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{...Jp,revision:e.revision+1,text:t.text??""};case"restore":return{...Jp,answers:t.answers,revision:t.revision,asides:t.asides??[],extrasDeclined:!!t.extrasDeclined,held:!!t.held}}}function tv(e,t){return x2(e.answers,t)===null&&!e.editing&&!e.saying}const KL=5,GL=40;function ple(e){return JSON.stringify({v:KL,answers:e.answers,revision:e.revision,asides:e.asides.slice(-GL),...e.extrasDeclined?{extrasDeclined:!0}:{},...e.held?{held:!0}:{}})}function mle(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 gle(e){var r;if(dr(e))return f1[e.slice(5)].row.options;const t=ds(e),n=t&&$a(t.id);return n?t.part==="where"?((r=n.where)==null?void 0:r.options)??[]:n.options:[]}function r9(e,t){return t===Dc||/^#[0-9a-f]{6}$/i.test(t)?{pick:t}:gle(e).some(n=>n.id===t)?{pick:t}:{words:t}}function vle(e,t){if(e==="keep")return typeof t=="string"?{words:t,refs:[]}:t;if(typeof t=="string"&&(dr(e)||ds(e)))return r9(e,t);const n=ds(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}:{...r9(e,r.words),refs:a}}return t}function em(e){if(!e)return null;try{const t=JSON.parse(e);if(t.v!==KL&&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))Js(a)&&(n[a]=vle(a,i));const r=(Array.isArray(t.asides)?t.asides:[]).map(mle).filter(a=>a!==null).slice(-GL);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."},YL=e=>e==="photos"?"the photos":"the face",qL=[{id:"photos",label:"Add photos"},{id:"scratch",label:"Describe someone"}],wle={photos:/\b(photos?|pictures?|pics?|upload|images?|selfies?)\b/,scratch:/\b(scratch|describe|description|invent|make (someone|one|them) up|imagine|new person)\b/},yle=[{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 XL(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"}.`}XL(null);function ble(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 xle=(e,t)=>`${e} is larger than ${Math.round(t/1024/1024)}MB. Choose a smaller copy of it.`,kle=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.`,Sle="First portrait appears here",Ele=(e,t)=>!e||e==="portrait"||!t?Sle:`The ${t} appears here`;function Cle(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 QL=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 jle(e){return e===1?"One photo":`${e} photos`}function Ale(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 Nle="That does not read as a description yet. Draw from it anyway, or describe them: age, hair, build, skin, presence.",Mle=e=>e===0?void 0:e===1?"Changing this asks the one after it again.":`Changing this asks the ${e} after it again.`,Rle="Change this answer?",Ple="The face is drawn again from the change, and the views built on it follow. Nothing already saved changes.",Lle="The views drawn from the photos are drawn again with the change. The photos themselves stay as they are.",$le={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"},Tle={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 lc(e,t,n,r="",a,i=!1){const l=t==="look"?Tle[a??""]??null:null,u=(l==null?void 0:l.how)??$le[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 Dle=e=>e.trim().replace(/[.\s]+$/,""),zy=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 k2(e,t,n=zy(null)){const r=io(t);if(r.kind==="unknown")return{text:`${e}: ${Dle(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 nv=e=>e&&YN.includes(e)?[{id:"skip-extras",label:"Not now"}]:[];function JL(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 zh(e,t){const n=e==="portrait"?"face":kn[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"},...nv(e)]}:JL(k2(`The ${n} could not be drawn`,t,zy(e)),nv(e))}function Hle(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 Ole(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 Ile=e=>e.charAt(0).toUpperCase()+e.slice(1);function Fle({draft:e,ui:t,afterCoverage:n,asides:r,openId:a,placed:i}){var re;const l=[],u=(ee,J,ae)=>l.push({kind:"scenri",id:ee,text:J,tone:ae}),f=ee=>l.push({kind:"question",question:ee}),h=((re=e.name)==null?void 0:re.trim())??"",p=h||"them",m=()=>{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}))},g=()=>f({id:"name",kind:"text",prompt:Yn.name}),w=(ee,J=[])=>t.failedView?zh(t.failedView,ee):JL(k2("That did not go through",ee),J),y=()=>{h||g()};if(e.stage==="analyzing")return u("reading",`Reading ${YL(e.source)}.`),h?m():g(),l;const b=QY(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=ee=>ee==="portrait"&&!ui(e)?Yn.identity(p):Yn.change,M=(e.results??[]).filter(ee=>ee.how!=="restored"),j=e.decisions??[],R=!e.activeView&&e.stage==="idle",P=new Map,H=new Map,D=new Map;for(const ee of M){const J=`${ee.view}:${ee.hash}`;if(D.set(J,ee),P.has(J))continue;const ae=(H.get(ee.view)??0)+1;H.set(ee.view,ae),P.set(J,ae)}const B=ee=>P.get(`${ee.view}:${ee.hash}`)??1,V=(ee,J)=>{const ae=B(ee),Me=e.views[ee.view].hash===ee.hash,ue=(H.get(ee.view)??0)>1;return{kind:"scenri",id:J,text:`Here is ${kn[ee.view]} ${ae}.`,thumb:ee.hash,view:ee.view,label:`${Pc[ee.view]} ${ae}`,current:ue&&Me&&D.get(`${ee.view}:${ee.hash}`)===ee,restore:R&&!Me&&!Tw(e,ee.view)?{view:ee.view,hash:ee.hash}:void 0}},K=new Set,U=new Map(E.map(ee=>{const J=M.find(ae=>!K.has(ae)&&ae.how==="drawn"&&ae.view===ee.view&&ae.ask===ee.text&&ae.at>=ee.at);return J&&K.add(J),[ee,J]})),I=new Map;for(const ee of j)ee.what==="use"&&!I.has(ee.view)&&I.set(ee.view,ee);const _=ee=>ee==="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 ${kn[ee]}. Use it, or keep the previous one.`,O=ee=>{const J=ee===I.get(ee.view),ae=ee.view==="portrait"&&J,Me=ee.what==="again"?"Try again":ee.what==="keep"?"Keep previous":ae?"Use this person":ee.view==="portrait"?"Use this":"Use it";return[{kind:"scenri",id:`asked-decided-${ee.at}`,text:ae?Yn.identity(p):J?Yn.landed(kn[ee.view]):_(ee.view),quiet:!0},{kind:"you",id:`decided-${ee.at}`,text:Me,editable:!1}]},Y=()=>{const ee=L?E.slice(0,-1):E,J=Ole(e),ae=r.filter(Se=>!i.has(Se)&&(Se.q!==a||Se.at<=J));for(const Se of ae)i.add(Se);const Me=M.find(Se=>YN.includes(Se.view)),ue=[...ee.map(Se=>{const Be=U.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},...Be?[V(Be,`redrew-${Se.at}`)]:[]]}}),...M.filter(Se=>!K.has(Se)).map(Se=>({at:Se.at,turns:[V(Se,`result-${Se.at}`)]})),...j.map(Se=>({at:Se.at,turns:O(Se)})),...ae.map(Se=>({at:Se.at,turns:xi(Se)})),...ui(e)&&(e.extras||t.extrasDeclined)?[{at:Me?Me.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}]}]:[]];ue.sort((Se,Be)=>Se.at<Be.at?-1:Se.at>Be.at?1:0);for(const Se of ue)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(!ui(e)){const ee=k.status==="generating"||S==="portrait"&&k.status!=="candidate";return ee&&!E.length?(u("drawing-face","Drawing their face."),h?m():g(),l):(m(),Y(),ee?(z(),u("drawing-face",L?"Adjusting the face. Everything else stays.":"Drawing their face."),h||g(),l):t.failed?(y(),f(w(t.failed)),l):k.error?(y(),z(),f(zh("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:QS("portrait",e.keepItems),options:[{id:"use",label:"Use this person"},{id:"again",label:"Try again"}],describe:"Change something"})),l))}m(),Y();const q=Object.keys(e.views),Z=ci(e),Q=[...Z].reverse().find(ee=>y4.has(ee)),me=Z.find(ee=>!y4.has(ee)),te=q.find(ee=>e.views[ee].status==="candidate"),he=Z.find(ee=>!!e.views[ee].error);if(t.failed&&!S)return y(),f(w(t.failed,nv(Um(e)))),l;if(S)return z(),u(`drawing-${S}`,L&&(C==null?void 0:C.view)===S?`Redrawing the ${kn[S]}.`:S===Q&&!e.views[S].hash?`Drawing the ${kn[S]} from this face.`:S===me&&!e.views[S].hash&&Q?`Building the rest of the set from the ${kn[Q]}.`:`Drawing the ${kn[S]}.`),h||g(),l;if(te){y(),z();const ee=e.views[te],J=!!ee.prior,ae=ue=>ue?P.get(`${te}:${ue}`)??0:0,Me=!!ee.hash&&!!ee.prior&&ae(ee.hash)<ae(ee.prior);if(ee.error){const ue=zh(te,ee.error);u(`failed-${te}`,ue.prompt,ee.error==="cancelled"?void 0:"alert")}return ee.hash&&l.push({kind:"scenri",id:`candidate-${te}-${ee.hash}`,text:Me?`Here is ${kn[te]} ${ae(ee.hash)} again.`:ee.error?`Here is the ${kn[te]} as it is.`:J?te==="portrait"?`Here is ${p} with the change.`:`Redrew the ${kn[te]}.`:`Here is the ${kn[te]}.`,thumb:ee.hash,label:Pc[te],view:te,current:!0}),f({id:te==="portrait"?"revision":"view-revision",kind:"confirm",prompt:J?te==="portrait"?`Use this, or keep the previous one.${JY(e,te)?" Using it redraws the views built on the face.":""}`:"Use it, or keep the previous one.":"Use it, or try again.",hint:te==="portrait"||te==="front"?QS(te,e.keepItems):void 0,options:[{id:"use",label:te==="portrait"?"Use this":"Use it"},...J?[{id:"keep",label:"Keep previous"}]:[],{id:"again",label:"Try again"}]}),l}return he?(y(),z(),f(zh(he,e.views[he].error??"")),l):DY(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:`${Ile(p)} is ready.${Hle(e)}`,options:[{id:"save",label:"Save presenter"}]}),l):(g(),l):(h||g(),l)}const _le={who:{label:"Who",options:ZL},age:{label:"Age",options:zL},build:{label:"Build",options:["slender","average","athletic","fuller"].map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1)}))}},tm=e=>e.charAt(0).toUpperCase()+e.slice(1);function Vle(e){return!e||e==="skipped"?"Draw as is":Object.values(e).map(t=>tm(t)).join(", ")}function Zle(e){const t=e.map(n=>{var r;return((r=$a(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 zle=e=>sne(e,qL,wle),e$=(e,t)=>e.trim().slice(0,t).trimEnd(),Ble=oP;function h1(e){return e$(Ule(e),Ble)}function Ule(e){var a;if(((a=e.source)==null?void 0:a.via)==="taps"){const i=DL(e),l=Hc(i.who);return BL(l&&!ga(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 GY({steer:n.who??null,age:n.age??null},r)}function Wle(e){return S2(e).map(t=>t.words)}const Kle=xd,Gle=12;function S2(e){var i,l;const t=Zie(e),n=(u,f,h)=>({id:u,words:e$(f,Kle),...h!=null&&h.length?{refs:h.slice(0,4)}:{}}),r=[];for(const u of HL(e.traits??[])){const f=t[u],h=f?Rie(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,Gle)}function s9(e){const t=Wle(e);return t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Yle(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 qle(e,t,n,r){const a=r.toLowerCase().split(/[^a-z0-9]+/).filter(l=>l.length>2);if(!a.length)return!0;const i=h1({...e,[t]:n}).toLowerCase();return a.every(l=>i.includes(l))}function Xle(e){const t=em(e.setup??null);return t&&Object.keys(t.answers).length?{answers:t.answers,asides:t.asides,...t.extrasDeclined?{extrasDeclined:t.extrasDeclined}:{}}:{answers:Qle(e),asides:[]}}function Qle(e){const t=em(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},...a9(e)}:{source:{door:"scratch",via:"typed"},describe:e.direction??"",gaps:"skipped",traits:[],...a9(e)}}function a9(e){const t=e.keepItems??[];if(!t.length)return{};const n={},r=[];let a;for(const i of t){const l=Fd.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 t$=(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 Jle(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:Dc,...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:Fd.map(l=>l.id).filter(l=>t.picks[l])}:t.kind==="skip"?{traits:[]}:null;const r=ds(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 ece(e,t){var r;return`the ${((r=$a(e))==null?void 0:r.label.toLowerCase())??"detail"} in the attached ${t===1?"picture":"pictures"}`}const o9="A scar, a ring, anything we missed",tce=new Set(["describe","keep"]),nce=new Set(["likeness","help","question","greeting","ack","nav","intent","go","nonsense"]);function i9(e,t){const n=(t==null?void 0:t.trim())??"";return e?n?`${e}, ${n}`:e:tm(n)}const rce=/^(?:but|and|though|although|only|just|except(?: that)?|with|without|plus)\s+/i,l9=e=>rce.test(e.trim());function h6(e){return e.trim().replace(/[.\s]+$/,"").replace(/^(?:but|and|though|although|only|just|except(?: that)?)\s+/i,"").trim()}function Cf(e,t){if(!e)return!1;if(tce.has(e))return!0;if(!dr(e)&&!ds(e))return!1;const n=t[e];return!!n&&!n.pick&&!!n.words}function Bh(e,t,n){const r=t.trim();return r?e==="look-age"&&ZY(r)?null:e!=="look-who"&&(dr(e)||e.startsWith("trait-"))&&FY(r)?"nonsense":dr(e)||e.startsWith("trait-")||e==="keep"?ace(r,n):e==="describe"||e==="source"?ri(r,n):null:"vague"}function p6(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 c9=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"]),sce=/^[a-z]{1,10}\d+$/i,ace=(e,t)=>{const n=e.trim(),r=n.toLowerCase().replace(/[^a-z ]/g,"");if(c9.has(r)||c9.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=>sce.test(l)))return"nonsense";const i=ri(e,t);return i&&nce.has(i)?i:null};function oce(e,t){return e==="name"?"metadata":t?e==="source"||e==="photos"?"start-over":"redraw":"plain"}function u9(e,t,n,r){var f,h,p,m,g,w,y,b,k;const a=t.answers,i=r?{reopened:!0,cost:Mle(TL(a,n).filter(S=>S!=="keep"&&Sf(S)>Sf(e)).length)}:{};switch(e){case"source":return{id:e,kind:"choice",prompt:Yn.source,options:qL,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:Ale(S.hashes.length,z0),hashes:S.hashes,max:z0,busy:t.uploading>0,attest:{text:XL(n.engine),checked:S.attested},submit:"Continue",back:"Describe someone instead"}}case"describe":return{id:e,kind:"text",prompt:Yn.describe,starters:yle};case"gaps":{const S=Iy(a.describe??"");return{id:e,kind:"choice",prompt:QL(S.length),groups:S.map(E=>({id:E,..._le[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:Fd.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}=f1[S],A=nle((p=a["look-who"])==null?void 0:p.pick),L=rle.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:((m=a[e])==null?void 0:m.pick)===Dc||(g=a[e])==null?void 0:g.pick,skipped:((w=a[e])==null?void 0:w.pick)===Dc,note:(y=a[e])==null?void 0:y.words,...i}}const l=ds(e),u=l?$a(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 m6(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 QL(Iy(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 f1[e.slice(5)].prompt;const n=ds(e),r=n?$a(n.id):void 0;return!n||!r?"":n.part==="where"?((l=r.where)==null?void 0:l.ask)??"":r.ask}function d9(e,t,n){var u,f,h,p,m,g,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:jle(y.length),photos:y}}case"describe":return{text:(t.describe??"").trim()};case"gaps":return{text:Vle(t.gaps)};case"traits":return{text:Zle(HL(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:ole(f1[y].row,t[e]??{})}}const r=ds(e),a=r?$a(r.id):void 0;if(!r||!a)return{text:""};if(r.part==="where"){const y=t[e]??{},b=y.pick?((g=(m=a.where)==null?void 0:m.options.find(k=>k.id===y.pick))==null?void 0:g.label)??tm(y.pick):"";return{text:i9(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)??tm(i.pick):"";return{text:i9(l,i==null?void 0:i.words),photos:i!=null&&i.refs.length?i.refs:void 0}}function ice(e){const t=e.state.asides,n=t.length?XR(f9(e,[],null)):null;return f9(e,t,n)}const n$=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,nm=(e,t)=>Ef(e.editing)&&lle(e.editing)===t.at;function f9(e,t,n){const r=new Set,a=lce(e,t,n,r),i=a.length&&a[a.length-1].kind==="question"?a.pop():null,l=t.filter(f=>!r.has(f)).sort(n$),u=e.state.unsure;for(const f of l)(!u||f.at<u.at)&&a.push(...xi(f,nm(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:Nle,options:[{id:"use",label:"Use it anyway"}]}});for(const f of l)f.at>=u.at&&a.push(...xi(f,nm(e.state,f)))}return a}function lce({state:e,draft:t,canGenerate:n,engine:r,failed:a,failedView:i,awaiting:l},u,f,h){var R,P,H,D,B,V;const p=t$(t,n,r),m=e.answers,g=[{kind:"you",id:"intent",text:"Create a presenter"}],w=[],y=((R=m.source)==null?void 0:R.door)==="photos",b=(K,U,I=!1)=>{const _=u.filter(O=>!h.has(O)&&!!O.q&&O.q!==f&&U.includes(O.q)&&!!O.after===I).sort(n$);for(const O of _)h.add(O),K.push(...xi(O,nm(e,O)))},k=K=>u.find(U=>U.edit&&U.q===K&&!h.has(U)),S=(K,U,I=!0)=>{var O;if(K.push({kind:"scenri",id:`asked-${U}`,text:m6(U,m),quiet:!0}),b(K,U==="describe"&&((O=m.source)==null?void 0:O.via)==="typed"?["source","describe"]:[U]),!I){const Y=k(U);Y&&(h.add(Y),K.push({kind:"you",id:U,text:Y.said}),K.push(...xi(Y,nm(e,Y),!0))),b(K,[U],!0);return}const _=d9(U,m,t);K.push({kind:"you",id:U,text:_.text,photos:_.photos,editable:!0,editing:e.editing===U&&Cf(U,m)||void 0}),b(K,[U],!0)},E=new Set(TL(m,p)),C=_ie.filter(K=>E.has(K)||u.some(U=>U.edit&&U.q===K));for(const K of C){const U=y&&t&&K!=="source"&&K!=="photos"?w:g;if(e.editing===K&&!Cf(K,m)){U.push({kind:"scenri",id:`asked-${K}`,text:m6(K,m),quiet:!0}),b(U,[K]),U.push({kind:"question",question:u9(K,e,p,!0)}),b(U,[K],!0);continue}K==="source"&&((P=m.source)==null?void 0:P.via)==="typed"||S(U,K,E.has(K))}let A=null;const L=((H=m.source)==null?void 0:H.door)==="photos"&&e.held&&!t,T=!n&&(t?!!Lw(t):((D=m.source)==null?void 0:D.door)==="scratch"||L)&&!(t&&e.editing);if(L&&!n&&((B=m.photos)!=null&&B.hashes.length)&&(g.push({kind:"scenri",id:"asked-photos",text:m6("photos",m),quiet:!0}),g.push({kind:"you",id:"photos",...d9("photos",m,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 K=x2(m,p);K?A=u9(K,e,p,!1):!t&&((V=m.source)==null?void 0:V.door)==="scratch"&&(m.source.via==="taps"||e.held?A={id:"agree",kind:"confirm",prompt:Yn.agree,quote:m.source.via==="taps"?`${ile(DL(m))}${s9(m)?`, and always ${s9(m)}`:""}.`:h1(m),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&&g.push({kind:"question",question:A}),g;const M=Fle({draft:t,ui:{extrasDeclined:e.extrasDeclined,failed:a,failedView:i,editingName:e.editing==="name"},afterCoverage:w,asides:u,openId:f,placed:h}),j=[...g,...A?M.filter(K=>K.kind!=="question"):M];return A&&j.push({kind:"question",question:A}),j}function r$(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question;if(!_p(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 ${YL(t.source)}`:t!=null&&t.activeView?"Drawing":n}const qo={placeholder:"Nothing to type yet",label:"Message",action:"Send"},h9=(e,t)=>({placeholder:t?tle[e]??"In your words":e9.has(e)?"Tap a swatch above, or say the colour":"Pick one above, or describe it",label:"Describe it",action:"Send",color:e9.has(e)});function p9(e,t){const n=ds(e),r=n?$a(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 s$(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)&&!ga(r)}function uce(e,t,n,r){const a=dce(e,t,n,r);return a.action==="Refine"&&!a.off&&s$(t.text,n,(e==null?void 0:e.id)??null)?{...a,label:"Their name",action:"Send"}:a}function dce(e,t,n,r){if(t.editing!==null&&(t.editing==="name"||Ef(t.editing)||Cf(t.editing,t.answers)))return{...qo,off:"Finish the change above."};if(t.saying==="keep")return{placeholder:o9,label:"What should stay the same about them",action:"Send"};if(t.saying&&dr(t.saying))return h9(t.saying.slice(5),!0);if(t.saying)return p9(t.saying,!0);if(t.editing!==null)return{...qo,off:"Finish the change above."};if(e){if(dr(e.id))return h9(e.id.slice(5),!1);if(e.id.startsWith("trait-"))return p9(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:o9,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"}.`}:Lc(n)?ui(n)?{placeholder:m9(r,n),label:"What should change",action:"Refine",off:""}:{...qo,off:""}:ui(n)?{placeholder:m9(r,n),label:"What should change",action:"Refine"}:{...qo,off:"The face comes first."}:{...qo,off:"Starting the draft."}}function m9(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: ${kn[e]}`}function g9(e,t){return e.saying?e.saying:t&&Js(t.id)&&(t.id==="source"||t.id==="describe")||t&&Js(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 fce=/\b(here|in this (view|one|picture|image|frame)|this (view|one|picture|image|frame))\b/i,hce=/\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,pce=/\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,mce=/\b(simpler|plainer|plain|neutral|cleaner|tidier)\b/i,gce=/\b(outfit|clothes|clothing|top|wardrobe|wearing)\b/i;function a$(e,t,n){const r=e.trim();if(!r)return{blocked:"Say what should change."};if(pce.test(r)&&!(mce.test(r)&&gce.test(r)))return{scope:"out-of-scope"};const a=eM.test(r),i=hce.test(r),l=fce.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 ${kn[t]} yet.`}:{scope:"view",view:t}}const o$=e=>`Use Create for wardrobe, products and scenes. Edits here change who ${e} is.`;function vce(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=a$(a,t,n);return"blocked"in l?{chip:null,hint:l.blocked,tone:"alert"}:l.scope==="out-of-scope"?{chip:null,hint:o$(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 ${kn[l.view]}`},hint:"Changes this view only. Hair, skin, age or build change the person."}}const wce=e=>e.replace(/^asset:/,"");function By(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??"",wce(i.file)]));for(const i of ci(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 v9(e,t){var n,r;return!By(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 w9=(e,t)=>t==="cancelled"?{text:`Stopped drawing the ${kn[e]}. Nothing finished was touched.`,stopped:!0}:{...k2(`The ${kn[e]} could not be drawn`,t,zy(e)),stopped:!1},yce=e=>TY.filter(t=>e.views[t].status==="empty"&&t!=="portrait"),bce=e=>e.length<=2?e.map(t=>kn[t]).join(" and "):`${e.slice(0,-1).map(t=>kn[t]).join(", ")} and ${kn[e[e.length-1]]}`,xce={building:!1,buildDeclined:!1,scopeAsk:null,failed:null,conflict:null},kce="Say what should change: hair, age or build change the person; anything else changes the view on the stage.",Sce="Still here. Select a view and say what is wrong with it, or say what should change about them.";function Ece(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?Sce:kce}}const fc={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 Cce(e){const t=e.ui.asides??[],n=t.length?XR(y9(e,[],null)):null;return y9(e,t,n)}function y9({draft:e,base:t,name:n,selected:r,canGenerate:a,ui:i},l,u){var ee;const f=[{kind:"scenri",id:"opening",text:fc.opening(n)}],h=new Set,p=()=>{for(const J of l)h.has(J)||f.push(...xi(J));return f},m=(J,ae,Me)=>{Me&&f.push({kind:"scenri",id:`asked-${J}`,text:Me}),f.push({kind:"you",id:J,text:ae,editable:!1})},g=(J,ae,Me)=>f.push({kind:"scenri",id:J,text:ae,tone:Me}),w=J=>f.push({kind:"question",question:J});if(!e)return p();const y=yce(e),b=e.source!=="synthetic"||!!((ee=e.direction)!=null&&ee.trim()),k=ci(e).some(J=>e.views[J].status==="candidate");if(y.length&&b&&!k&&!i.building&&!i.buildDeclined&&!Lc(e)&&a){const J=ci(e).filter(ae=>e.views[ae].status==="approved").length;return w({id:"legacy",kind:"confirm",prompt:`${n} has ${J===1?"one reference":`${J} references`}. Build the ${bce(y)} from it?`,options:[{id:"build",label:"Build them"},{id:"not",label:"Not now"}]}),p()}const S=ci(e),E=e.activeView,C=S.find(J=>e.views[J].status==="candidate"),A=S.find(J=>!!e.views[J].error),L=(t==null?void 0:t.identityEdits)??[];(e.identityEdits??[]).filter(J=>!L.includes(J)).forEach((J,ae)=>{m(`edit-${ae}`,J,fc.change),g(`changed-${ae}`,`Changed ${n}. The views built on the face were redrawn.`)});const M=e.asks??[],j=M[M.length-1],R=j?e.views[j.view]:null,P=!!j&&!!R&&(R.status==="generating"&&e.activeView===j.view||R.status==="candidate"&&R.adjustment===j.text||!!R.error),H=new Set((e.identityEdits??[]).map(J=>J.toLowerCase())),D=(P?M.slice(0,-1):M).filter(J=>!(J.view==="portrait"&&H.has(J.text.replace(/\s+/g," ").toLowerCase()))),B=[...M,...e.results??[],...e.decisions??[]].map(J=>J.at).reduce((J,ae)=>ae>J?ae:J,""),V=l.filter(J=>!h.has(J)&&(J.q!==u||J.at<=B));for(const J of V)h.add(J);const K=(e.results??[]).filter(J=>J.how!=="restored"),U=!e.activeView&&e.stage==="idle",I=new Map,_=new Map,O=new Map;for(const J of K){const ae=`${J.view}:${J.hash}`;if(O.set(ae,J),I.has(ae))continue;const Me=(_.get(J.view)??0)+1;_.set(J.view,Me),I.set(ae,Me)}const Y=J=>I.get(`${J.view}:${J.hash}`)??1,z=(J,ae)=>{const Me=Y(J),ue=e.views[J.view].hash===J.hash,Se=(_.get(J.view)??0)>1;return{kind:"scenri",id:ae,text:`Here is ${kn[J.view]} ${Me}.`,thumb:J.hash,view:J.view,label:`${Pc[J.view]} ${Me}`,current:Se&&ue&&O.get(`${J.view}:${J.hash}`)===J,restore:U&&!ue?{view:J.view,hash:J.hash}:void 0}},q=new Set,Z=new Map(M.map(J=>{const ae=K.find(Me=>!q.has(Me)&&Me.how==="drawn"&&Me.view===J.view&&Me.ask===J.text&&Me.at>=J.at);return ae&&q.add(ae),[J,ae]})),Q=(e.decisions??[]).filter(J=>!(J.view==="portrait"&&J.what==="use")),me=J=>[{kind:"scenri",id:`asked-decided-${J.at}`,text:J.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 ${kn[J.view]}. Use it, or keep the previous one.`},{kind:"you",id:`decided-${J.at}`,text:J.what==="again"?"Try again":J.what==="keep"?"Keep previous":"Use it",editable:!1}],te=[...D.map(J=>{const ae=Z.get(J);return{at:J.at,turns:[{kind:"scenri",id:`asked-ask-${J.at}`,text:fc.change},{kind:"you",id:`ask-${J.at}`,text:J.text,editable:!1},...ae?[z(ae,`redrew-${J.at}`)]:[]]}}),...K.filter(J=>!q.has(J)).map(J=>({at:J.at,turns:[z(J,`result-${J.at}`)]})),...Q.map(J=>({at:J.at,turns:me(J)})),...V.map(J=>({at:J.at,turns:xi(J)}))];te.sort((J,ae)=>J.at<ae.at?-1:J.at>ae.at?1:0);for(const J of te)f.push(...J.turns);if(i.scopeAsk)return m("scope-ask",i.scopeAsk.said),w({id:"scope",kind:"choice",prompt:fc.scope,options:[{id:"view",label:`This view (the ${kn[r]})`},{id:"identity",label:"The presenter"}]}),p();const he=()=>{P&&j&&m(`ask-${j.at}`,j.text,fc.change)};if(E){const J=e.views[E];return he(),g(`drawing-${E}`,P&&(j==null?void 0:j.view)===E?E==="portrait"?`Changing ${n}. Everything else stays.`:`Redrawing the ${kn[E]}.`:J.status==="stale"||S.some(ae=>e.views[ae].status==="stale")?`Redrawing the views built on the face. The ${kn[E]} first.`:`Drawing the ${kn[E]}.`),p()}if(C){he();const J=e.views[C];if(J.error){const ae=w9(C,J.error);g(`failed-${C}`,ae.text,ae.stopped?void 0:"alert")}return J.hash&&f.push({kind:"scenri",id:`candidate-${C}-${J.hash}`,text:J.error?`Here is the ${kn[C]} as it is.`:C==="portrait"?`Here is ${n} with the change.`:`Redrew the ${kn[C]}.`,thumb:J.hash,label:Pc[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){he();const J=A?w9(A,e.views[A].error??""):{...k2("That did not go through",i.failed??""),stopped:!1};return w({id:"retry",kind:"confirm",...J.stopped?{quiet:!0}:{tone:"alert"},prompt:J.text,options:[...J.remedy?[{id:`remedy:${J.remedy.opens}`,label:J.remedy.label}]:[],{id:"retry",label:J.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 re=S.find(J=>e.views[J].status==="stale");return re?(g(`drawing-${re}`,`Redrawing the views built on the face. The ${kn[re]} first.`),p()):(t&&By(e,t)&&w({id:"save",kind:"confirm",prompt:`The set is coherent. ${fc.saved}`,options:[{id:"save",label:"Save changes"}]}),p())}function jce(e,t,n){return!(!n||t.id!==n||e&&e.id===t.id&&t.updatedAt<e.updatedAt)}function i$(e,t){const[n,r]=s.useState(null),[a,i]=s.useState(!1),[l,u]=s.useState(null),[f,h]=s.useState(null),[p,m]=s.useState(!1),{poke:g}=sa(),w=s.useRef(!0);s.useEffect(()=>(w.current=!0,()=>{w.current=!1}),[]);const y=s.useRef(t);y.current=t;const b=s.useCallback(U=>{w.current&&r(I=>jce(I,U,y.current)?U:I)},[]),k=s.useRef(!1);s.useEffect(()=>{r(null),i(!1),u(null),k.current=!1,m(!1)},[t]);const S=s.useCallback(async()=>{if(!t)return;const U=t;try{b(await Ae.presenterDraft(e,U)),k.current&&w.current&&y.current===U&&(k.current=!1,u(null))}catch(I){if(!w.current||y.current!==U)return;/HTTP 404|not found/i.test(String((I==null?void 0:I.message)??I))?i(!0):(k.current=!0,h(null),u(String((I==null?void 0:I.message)??I)))}},[e,t,b]);s.useEffect(()=>{S()},[S]);const E=!!n&&(n.stage!=="idle"||!!n.activeView);s.useEffect(()=>{if(!E)return;const U=setInterval(()=>void S(),1500);return()=>clearInterval(U)},[E,S]);const C=s.useCallback(async(U,I=null)=>{const _=y.current;m(!0),u(null),k.current=!1;try{return b(await U()),g(),!0}catch(O){return!w.current||y.current!==_?!1:(O==null?void 0:O.status)===409?(S(),!1):(k.current=!1,h(I),u(String((O==null?void 0:O.message)??O)),!1)}finally{w.current&&m(!1)}},[b,S,g]),A=s.useCallback((U,I,_)=>C(async()=>(await Ae.generateDraftView(e,t??"",U,{...I?{adjustment:I}:{},..._?{decide:_}:{}})).draft,U),[C,e,t]),L=s.useCallback(U=>C(()=>Ae.approveDraftView(e,t??"",U)),[C,e,t]),T=s.useCallback(U=>C(()=>Ae.redoDraftView(e,t??"",U)),[C,e,t]),M=s.useRef(!1),j=s.useCallback(async U=>{if(M.current)return!1;M.current=!0;try{return await C(U)}finally{M.current=!1}},[C]),R=s.useCallback(U=>j(()=>Ae.revertDraftView(e,t??"",U)),[j,e,t]),[P,H]=s.useState(!1),D=s.useCallback(async()=>{H(!0);try{return await C(()=>Ae.stopDraft(e,t??""))}finally{w.current&&H(!1)}},[C,e,t]),B=s.useCallback((U,I)=>j(()=>Ae.restoreDraftView(e,t??"",U,I)),[j,e,t]),V=s.useCallback(U=>C(()=>Ae.updatePresenterDraft(e,t??"",U)),[C,e,t]),K=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:R,stop:D,stopping:P,restore:B,update:V,clearErr:K}}function Ace({presenterId:e,onLeave:t,caps:n}){var Oe,ie;const{brand:r}=cn(),{applyBrand:a,refreshBrands:i}=$n(),l=Il(),u=Ol(),f=Ar("setup").value,h=Ar("settings").value,p=!!f||!!h,m=!!(n!=null&&n.canGenerate),[g,w]=s.useState(null),[y,b]=s.useState(null),[k,S]=s.useState(xce),[E,C]=s.useState(""),[A,L]=s.useState(null),[T,M]=s.useState(!1),[j,R]=s.useState(null),[P,H]=s.useState(!1),[D,B]=s.useState(!1),V=s.useRef(new Set),K=(((Oe=r.json)==null?void 0:Oe.characters)??[]).find(X=>X.id===e),U=((ie=K==null?void 0:K.name)==null?void 0:ie.trim())||"them",I=K?{shots:K.shots??[],identityEdits:K.identityEdits??[]}:null;s.useEffect(()=>{let X=!0;return w(null),b(null),Ae.editPresenter(r.id,e).then(se=>{X&&w(se.id)}).catch(se=>{X&&b(String((se==null?void 0:se.message)??se))}),()=>{X=!1}},[r.id,e]);const _=i$(r.id,g),O=_.draft,Y=O?`presenter-edit:${r.id}:${e}:${O.id}`:void 0,z=!0;s.useEffect(()=>{if(!O||_.busy||!m||_.err)return;const X=Lw(O);if(!X||O.views[X].status==="empty"&&!k.building)return;const se=`${X}:${O.views[X].attempts}:${O.generations}:${O.views[X].status}`;V.current.has(se)||(V.current.add(se),_.generate(X,void 0,Qo(X)))},[O,_.busy,_.generate,m,_.err,k.building]);const q=O?XN(O,A):"portrait",Z=O?O.views[q]:null,Q=!!O&&(O.activeView===q||O.stage==="analyzing"),me=!!O&&!O.activeView&&O.stage==="idle",te=_.err&&O&&!O.activeView?_.err:null,he=s.useMemo(()=>Cce({draft:O,base:I,name:U,selected:q,canGenerate:m,ui:{...k,failed:te}}),[O,I,U,q,m,k,te]),re=r$(he),ee=!!O&&!!I&&By(O,I),J=!!O&&!!I&&v9(O,I),ae=s.useCallback(X=>{Y&&cl(Y),t(X)},[Y,t]),Me=s.useCallback(async()=>{if(!(!O||P)){H(!0),R(null);try{const X=await Ae.savePresenterDraft(r.id,O.id);ae(X.presenter.id),a(X.brand)}catch(X){H(!1);const se=String((X==null?void 0:X.message)??X);/changed elsewhere|HTTP 409/i.test(se)?S(Re=>({...Re,conflict:se})):R(se)}}},[O,P,r.id,a,ae]),ue=s.useCallback(async()=>{B(!0);try{O&&await Ae.deletePresenterDraft(r.id,O.id)}catch{}ae(e)},[O,r.id,e,ae]),Se=s.useCallback(async()=>{if(!(!O||!I)){B(!0);try{v9(await Ae.presenterDraft(r.id,O.id),I)&&await Ae.deletePresenterDraft(r.id,O.id)}catch{}ae(e)}},[O,I,r.id,e,ae]),Be=s.useCallback(async()=>{B(!0);try{const X=await Ae.revertPresenter(r.id,e);O&&await Ae.deletePresenterDraft(r.id,O.id).catch(()=>{}),ae(X.presenter.id),a(X.brand)}catch(X){B(!1),R(String((X==null?void 0:X.message)??X))}},[r.id,e,O,a,ae]),vt=s.useCallback((X,se)=>{var Re;if(R(null),!!O)switch(X){case"legacy":if(se.kind!=="confirm")return;S(_e=>({..._e,building:se.id==="build",buildDeclined:se.id!=="build"}));return;case"scope":{if(se.kind!=="choice")return;const _e=((Re=k.scopeAsk)==null?void 0:Re.said)??"";S(Ye=>({...Ye,scopeAsk:null})),se.id==="identity"?_.generate("portrait",_e):_.generate(q,_e,Qo(q)),L(se.id==="identity"?"portrait":q);return}case"revision":case"view-revision":{if(se.kind!=="confirm")return;const _e=Object.keys(O.views).find(Ye=>O.views[Ye].status==="candidate")??q;se.id==="use"&&_.approve(_e),se.id==="keep"&&_.revert(_e),se.id==="again"&&_.generate(_e,O.views[_e].adjustment,Qo(_e)),M(!1);return}case"retry":{if(se.kind==="confirm"&&se.id.startsWith("remedy:")){const Ye=se.id.slice(7);Ye==="setup"?l():u(Ye);return}if(_.err){_.clearErr(),V.current=new Set;return}const _e=Object.keys(O.views).find(Ye=>!!O.views[Ye].error);_e&&_.generate(_e,O.views[_e].adjustment,Qo(_e));return}case"conflict":S(_e=>({..._e,conflict:null})),B(!0),Promise.all([i(),Ae.deletePresenterDraft(r.id,O.id).catch(()=>{})]).finally(()=>ae(e));return;case"save":Me();return}},[O,k.scopeAsk,_,q,Me,i,ae,e,r.id,l,u]),Ue=s.useCallback(X=>{const se=X.trim();if(!se||!O)return!1;R(null);const Re=(re==null?void 0:re.id)??null,_e=Vp(),Ye=(wt,Et)=>({...wt,asides:[...wt.asides??[],{said:se,reply:Et,q:Re,at:_e}]}),ge=wt=>wt.scopeAsk?{...wt,scopeAsk:null,asides:[...wt.asides??[],{said:wt.scopeAsk.said,reply:fc.scope,q:"scope",at:wt.scopeAsk.at}]}:wt,Qe=ri(se,ga);if(Qe&&Qe!=="vague")return S(wt=>Ye(wt,Ece(Qe,U,(wt.asides??[]).some(Et=>Et.q===Re)))),C(""),!0;if(!m)return R("Image generation is not set up, so nothing can be redrawn yet."),!1;const at=a$(se,q,O);return"blocked"in at?(R(at.blocked),!1):at.scope==="out-of-scope"?(S(wt=>Ye(ge(wt),o$(U))),C(""),!0):at.scope==="ambiguous"?(S(wt=>({...ge(wt),scopeAsk:{said:se,at:_e}})),C(""),!0):(S(wt=>ge(wt)),L(at.view),M(!1),_.generate(at.view,se,at.scope==="view"?Qo(at.view):void 0),C(""),!0)},[O,m,q,_,re==null?void 0:re.id,U]),Xe=O?vce(E,q,O,U):null,De=Xe?{chip:Xe.chip?{label:Xe.chip.label,thumb:O!=null&&O.views[Xe.chip.view].hash?mn(O.views[Xe.chip.view].hash,"micro"):void 0}:null,hint:Xe.hint,tone:Xe.tone}:null,G=T&&(Z!=null&&Z.prior)?Z.prior:Z==null?void 0:Z.hash,oe=O?(re==null?void 0:re.id)==="legacy"?"Decide above.":(re==null?void 0:re.id)==="conflict"?"Reload to continue.":(re==null?void 0:re.id)==="scope"?"Pick above.":(re==null?void 0:re.id)==="retry"?"Retry above.":O.stage==="analyzing"?"Reading the photos.":O.activeView?"":null:null,We=!!O;return{d:O,record:K,name:U,view:q,slot:Z,dirty:ee,saving:P,leaving:D,openErr:y,canRevert:!!(K!=null&&K.revisionOf),discard:ue,revert:Be,closeUntouched:J?()=>void Se():null,keepPrevious:Z&&Z.status==="approved"&&Z.prior&&!Q&&!(O!=null&&O.activeView)&&(O==null?void 0:O.stage)==="idle"?()=>void _.revert(q):null,surface:{title:"Edit presenter",memoryKey:Y,resumed:z,turns:he,busy:_.busy||P||D||p,stage:O?{hash:G,alt:`${Pc[q]}${(Z==null?void 0:Z.status)==="candidate"?", candidate":""}`,drawing:Q,since:nM(O),doing:rM(O),takes:Tw(O,q)?[]:aM(O,q),onTake:me?X=>{_.busy||_.restore(q,X)}:void 0,items:QN(O,q),onPick:X=>{L(X),M(!1)},compare:Z&&Z.status==="candidate"&&Z.prior?{on:T,toggle:()=>M(X=>!X)}:void 0}:null,composer:We?{placeholder:q==="portrait"?`What should change about ${U}?`:`Change this view: ${kn[q]}`,label:"What should change",action:"Refine",scope:oe?null:De,hint:null,why:oe??void 0,error:j,disabled:_.busy||P||D||!!oe,working:!!(O!=null&&O.activeView),onStop:O!=null&&O.activeView?()=>void _.stop():void 0,stopping:_.stopping,focusKey:`${(re==null?void 0:re.id)??"open"}:${(O==null?void 0:O.id)??""}`}:null,text:E,onText:C,onSend:Ue,onAnswer:vt,onRestore:(X,se)=>{_.busy||(L(X),_.restore(X,se))}},setupNeeded:m?null:l}}function Nce({onClose:e,...t}){const n=Ace(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 ",kn[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(Oy,{surface:{...n.surface,headAction:r,dock:a},onClose:n.closeUntouched??e})}function Mce(){const{presenterId:e=""}=na(),{brand:t}=cn(),n=Bn(),{caps:r}=Yw();Gc("Edit presenter");const a=s.useRef(!1);s.useEffect(()=>(a.current=!0,()=>{a.current=!1}),[]);const[i]=s.useState(()=>Bw(t,e)),l=s.useCallback(f=>{a.current&&n(Aa(t,f),{replace:!0})},[n,t]),u=s.useCallback(()=>n(Aa(t,e),{replace:!0}),[n,t,e]);return i!==e?o.jsx(Xa,{to:Vm(t,i),replace:!0}):o.jsx(Nce,{presenterId:e,onLeave:l,onClose:u,caps:r})}function Rce(e,t){return(t.source!=="synthetic"||(t.direction??"")===h1(e.answers))&&Pce(t.keepItems,S2(e.answers))}function Pce(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 Lce(e,t){return{...t.source==="synthetic"?{direction:h1(e.answers)}:{},keepItems:S2(e.answers)}}const $ce=e=>e.source==="photos"?e.views.front.hash?"front":null:e.views.portrait.hash?"portrait":null;function l$(e){if(!e.draftId)return!1;const t=e.draft;return t?e.seededFor!==t.id&&(!e.state.answers.source||!tv(e.state,e.ctx)):!0}function Tce(e){const{state:t,draft:n,ctx:r}=e;if(e.busy||e.err)return[];if(n){if(l$(e))return[{kind:"seed",...Xle(n)}];if(!tv(t,r))return[];const i=[];Rce(t,n)||i.push({kind:"sync",patch:Lce(t,n),redo:$ce(n)});const l=e.canDraw?Lw(n):null;return l&&i.push({kind:"draw",view:l,decide:Qo(l)}),i}if(e.draftId)return[];if(!e.canDraw||!tv(t,r))return[];const a=t.answers.source;return(a==null?void 0:a.door)==="scratch"&&a.via!=="taps"&&!t.held?[{kind:"start"}]:[]}function Dce(e){for(const t of Tce(e))if(!e.done.has(c$(t,e)))return t;return null}function c$(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 Lu=(e,t)=>`scenri:presenter-setup:${e}:${t}`,nl={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 b9(e,t){let n=nl.read("scenri:tab");return n||(n=[...crypto.getRandomValues(new Uint8Array(6))].map(r=>r.toString(16).padStart(2,"0")).join(""),nl.write("scenri:tab",n)),`${n}:${e}:${t}`}function Hce(e,t){var r,a,i;const n=t==="keep"?"detail":((a=$a(((r=ds(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 x9(e,t,n){const r=e.editing&&e.editing!=="name"?e.editing:e.saying??x2(e.answers,t);if(r==="keep"||!r&&n==="agree")return"keep";if(!r)return null;const a=ds(r);return a&&a.part==="what"?`trait-${a.id}`:null}function Oce({draftId:e,convoKey:t,onOpenDraft:n,onLeaveDraft:r,onStarted:a,caps:i}){var Pt,Yt,jt,Ft;const{brand:l}=cn(),{presenterCategories:u,applyBrand:f}=$n(),h=Il(),p=Ol(),m=Ar("setup").value,g=Ar("settings").value,w=!!m||!!g,[y,b]=s.useState(!1);s.useEffect(()=>b(!1),[i]);const k=!!(i!=null&&i.canGenerate)&&!y,[S,E]=s.useReducer(hle,{brandId:l.id,convoKey:t},Ne=>{const Fe=em(nl.read(Lu(Ne.brandId,Ne.convoKey)));return Fe?{...Jp,answers:Fe.answers,revision:Fe.revision,asides:Fe.asides,extrasDeclined:!!Fe.extrasDeclined,held:!!Fe.held}:Jp}),C=s.useRef(S);C.current=S;const A=ple(S),L=Object.keys(S.answers).length>0||S.asides.length>0,T=s.useRef(t);s.useEffect(()=>{L?nl.write(Lu(l.id,t),A):nl.remove(Lu(l.id,t));const Ne=T.current;T.current=t,Ne!==t&&e&&t===e&&(nl.remove(Lu(l.id,Ne)),cl(`presenter-create:${l.id}:${Ne}`))},[l.id,t,e,A,L]);const M=s.useRef(null);s.useEffect(()=>{if(!e||M.current===A)return;const Ne=setTimeout(()=>{M.current=A,Ae.updatePresenterDraft(l.id,e,{setup:A}).catch(()=>{M.current=null})},800);return()=>clearTimeout(Ne)},[l.id,e,A]);const[j,R]=s.useState(null),[P,H]=s.useState(!1),[D,B]=s.useState(null),[V,K]=s.useState([]),[U,I]=s.useState(!1),[_,O]=s.useState(null),[Y,z]=s.useState(!1),[q,Z]=s.useState(null),[Q,me]=s.useState(null),[te,he]=s.useState(0),[re,ee]=s.useState([]),J=s.useRef(new Map),[ae]=s.useState(()=>!!e||!!em(nl.read(Lu(l.id,t))));s.useEffect(()=>()=>{for(const Ne of J.current.values())URL.revokeObjectURL(Ne)},[]);const Me=s.useRef(!1),ue=s.useRef(new Set),Se=s.useRef(!1),Be=s.useRef(null),vt=s.useRef(!1),Ue=s.useRef(!0);s.useEffect(()=>(Ue.current=!0,()=>{Ue.current=!1}),[]);const Xe=s.useRef(new Set),De=s.useRef(0),G=i$(l.id,e),oe=G.draft,We=(i==null?void 0:i.engineName)??null,Oe=s.useMemo(()=>t$(oe,k,We),[oe,k,We]);s.useEffect(()=>{ue.current=new Set,Me.current=!1,K([]),M.current=null,e||(vt.current=!1)},[e]),s.useEffect(()=>{if(Me.current||!oe)return;const Ne=YY(oe,V);Ne&&(Me.current=!0,K(Ne))},[oe,V]),s.useEffect(()=>{G.gone&&r()},[G.gone,r]);const ie=s.useCallback(()=>{nl.remove(Lu(l.id,t)),cl(`presenter-create:${l.id}:${t}`)},[l.id,t]),X=s.useCallback(Ne=>n(Ne,!0),[n]),se=s.useCallback(Ne=>{if(!WN.test(Ne)){B(Ne);return}b(!0),E({type:"hold",held:!0})},[]),Re=s.useCallback(async()=>{const Ne=C.current;if(!k||Y)return;const Fe=Ne.revision;E({type:"hold",held:!1}),z(!0),B(null);try{const tt=S2(Ne.answers),F=await Ae.createPresenterDraft(l.id,{source:"synthetic",direction:h1(Ne.answers),...tt.length?{keepItems:tt}:{},clientKey:b9(t,Fe)});if(C.current.revision!==Fe||!Ue.current){Ae.deletePresenterDraft(l.id,F.id).catch(()=>{});return}X(F.id)}catch(tt){se(String((tt==null?void 0:tt.message)??tt))}finally{z(!1)}},[l.id,k,Y,X,t,se]),_e=s.useCallback(async()=>{const Ne=C.current,Fe=Ne.answers.photos;if(!(Fe!=null&&Fe.hashes.length)||!Fe.attested||Y)return;if(!k){E({type:"hold",held:!0});return}E({type:"hold",held:!1});const tt=Ne.revision;z(!0),B(null);try{const F=await Ae.createPresenterDraft(l.id,{source:"photos",imageHashes:Fe.hashes,attestation:!0,clientKey:b9(t,tt)});if(C.current.revision!==tt||!Ue.current){Ae.deletePresenterDraft(l.id,F.id).catch(()=>{});return}X(F.id)}catch(F){se(String((F==null?void 0:F.message)??F))}finally{z(!1)}},[l.id,k,Y,X,t,se]),Ye=s.useCallback(async Ne=>{B(null);const Fe=()=>{var Ze;return((Ze=C.current.answers.photos)==null?void 0:Ze.hashes)??[]},tt=Ne.slice(0,Math.max(0,z0-Fe().length-De.current));De.current+=tt.length;const F=[];let fe=0;E({type:"upload-begin"});try{for(const Ze of tt){if(Ze.size>P5){F.push(xle(Ze.name,P5));continue}try{const Pe=await uf(Ze);Fe().includes(Pe)&&(fe+=1),E({type:"uploaded",hash:Pe,max:z0})}catch{F.push(kle(Ze.name))}}}finally{De.current-=tt.length,E({type:"upload-end"})}const ye=ble({over:Ne.length-tt.length,same:fe,failed:F,max:z0});ye&&B(ye)},[]),ge=s.useCallback(Ne=>{E({type:"answer",patch:Ne,ctx:Oe}),!k&&Ne.describe!==void 0&&E({type:"hold",held:!0})},[Oe,k]),Qe=s.useCallback(async Ne=>{const Fe=Ne??oe;if(!Fe||U)return;const tt=qY(Fe,Fe.name);if(tt){O(tt);return}I(!0),O(null);try{await Ae.updatePresenterDraft(l.id,Fe.id,{facets:V});const F=await Ae.savePresenterDraft(l.id,Fe.id);f(F.brand),ie(),E({type:"start-over"}),a({kind:"presenter",id:F.presenter.id,name:F.presenter.name})}catch(F){I(!1),O(String((F==null?void 0:F.message)??F))}},[oe,U,k,l.id,V,ie,a,f]),at=s.useCallback(async()=>{const Fe=C.current.answers.describe||(oe==null?void 0:oe.direction)||"";vt.current=!!e,ie(),E({type:"start-over",text:Fe}),B(null),Z(null),me(null),ue.current=new Set,oe&&!JN(oe)&&await Ae.deletePresenterDraft(l.id,oe.id).catch(()=>{}),r()},[oe,e,l.id,ie,r]),wt=oe?G.err&&!Lc(oe)?G.err:null:D,Et=s.useMemo(()=>ice({state:S,draft:oe,canGenerate:k,engine:We,failed:wt,failedView:G.errView,awaiting:l$({state:S,draft:oe,ctx:Oe,draftId:e,seededFor:Be.current})}),[S,oe,k,We,wt,G.errView,e,Oe]),ot=r$(Et),It=s.useRef(null);It.current=(ot==null?void 0:ot.id)??null;const Mt=oe?XN(oe,j):"portrait",Zt=oe?oe.views[Mt]:null,Rt=!!oe&&(oe.activeView===Mt||oe.stage==="analyzing"),Tt=!!oe&&!oe.activeView&&oe.stage==="idle",Ee={state:S,draft:oe,ctx:Oe,canDraw:k,busy:G.busy||Y||Se.current||vt.current||(oe?Lc(oe):!1),err:!!G.err||!oe&&!!D,draftId:e,seededFor:Be.current,done:ue.current},Je=Dce(Ee),St=s.useRef(Je);St.current=Je;const qe=Je?c$(Je,Ee):"";s.useEffect(()=>{var Fe;oe&&Be.current!==oe.id&&!Ee.busy&&!Ee.err&&((Fe=St.current)==null?void 0:Fe.kind)!=="seed"&&(Be.current=oe.id);const Ne=St.current;if(!(!Ne||ue.current.has(qe)))switch(ue.current.add(qe),Ne.kind){case"seed":Be.current=(oe==null?void 0:oe.id)??null,E({type:"restore",answers:Ne.answers,revision:C.current.revision+1,asides:Ne.asides,extrasDeclined:Ne.extrasDeclined});return;case"start":Re();return;case"sync":Se.current=!0,(async()=>{if(!(await G.update(Ne.patch)||await G.update(Ne.patch))){ue.current.delete(qe);return}Ne.redo&&await G.redo(Ne.redo)})().finally(()=>{Se.current=!1});return;case"draw":G.generate(Ne.view,void 0,Ne.decide);return}},[qe,oe,Re,G.update,G.redo,G.generate]);const st=s.useCallback((Ne,Fe,tt,F,fe=!1)=>{E({type:"aside",aside:{said:Ne,reply:Fe,q:tt,at:Vp(),kind:F,...fe?{edit:!0}:{}}})},[]),rt=s.useCallback((Ne,Fe)=>{B(null);const tt=C.current;if(Js(Ne)){if(Ne==="weakphotos"&&Fe.kind==="confirm"){Fe.id==="again"&&at(),Fe.id==="anyway"&&ge({weakphotos:{pick:"anyway"}});return}const F=Jle(Ne,Fe,tt.answers);if(F){const fe=tt.text.trim(),ye=F[Ne],Ze=(dr(Ne)||!!ds(Ne))&&ye&&typeof ye=="object"&&!ye.words;ge(Ze&&fe?{...F,[Ne]:{...ye,words:h6(fe)}}:F);return}if(Ne==="photos"&&Fe.kind==="photos"){const fe=Fe.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"&&_e(),fe.type==="back"&&ge({source:{door:"scratch",via:"taps"}})}return}switch(Ne){case"unsure":{if(Fe.kind!=="confirm"||Fe.id!=="use"||!tt.unsure)return;const F=tt.unsure.said,fe=tt.unsure.q==="describe"?"describe":"source";E({type:"settle-unsure",ctx:Oe}),ge(fe==="describe"?{describe:F}:{source:{door:"scratch",via:"typed"},describe:F});return}case"noengine":Fe.kind==="confirm"&&Fe.id==="setup"&&h(),Fe.kind==="confirm"&&Fe.id==="change"&&E({type:"hold",held:!1});return;case"agree":{if(Fe.kind!=="confirm")return;Fe.id==="draw"&&Re();return}case"identity":if(Fe.kind!=="confirm"||!oe)return;Fe.id==="use"&&(G.approve("portrait"),R(null)),Fe.id==="again"&&G.generate("portrait");return;case"revision":case"view-revision":{if(Fe.kind!=="confirm"||!oe)return;const F=Ne==="revision"?"portrait":Object.keys(oe.views).find(fe=>oe.views[fe].status==="candidate")??Mt;Fe.id==="use"&&G.approve(F),Fe.id==="keep"&&G.revert(F),Fe.id==="again"&&G.generate(F,oe.views[F].adjustment,Qo(F)),H(!1);return}case"retry":{if(Fe.kind==="confirm"&&Fe.id.startsWith("remedy:")){const fe=Fe.id.slice(7);fe==="setup"?h():p(fe);return}if(Fe.kind==="confirm"&&Fe.id==="skip-extras"){G.clearErr(),G.update({extras:!1}),E({type:"extras-declined"});return}if(!oe){ue.current=new Set,B(null);return}if(G.err){G.clearErr(),ue.current=new Set([...ue.current].filter(fe=>fe.startsWith("sync:")));return}const F=Object.keys(oe.views).find(fe=>!!oe.views[fe].error);F&&G.generate(F,oe.views[F].adjustment,Qo(F));return}case"extras":if(Fe.kind!=="confirm")return;Fe.id==="add"&&G.update({extras:!0}),Fe.id==="save"&&E({type:"extras-declined"});return;case"save":Qe();return}},[ge,Ye,_e,Re,h,p,oe,G,Mt,Qe]),Xt=s.useCallback(Ne=>{var Jn,tn,gr,Or,wn,oa,Tn,ia,Ws;const Fe=Ne.trim(),tt=C.current,F=g9(tt,ot),fe=F&&((Jn=tt.colour)==null?void 0:Jn.step)===F?tt.colour.hex:null,ye=F&&dr(F)?F.slice(5):null,Ze=F==="keep"?(((tn=tt.answers.keep)==null?void 0:tn.refs)??[]).length:F!=null&&F.startsWith("trait-")?(((gr=tt.answers[F])==null?void 0:gr.refs)??[]).length:0,Pe=Fe||fe||"";if(!Pe&&!Ze)return!1;if(B(null),F==="name"){const an=Pe.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||Pe;return oe&&G.update({name:an.slice(0,60)}),E({type:"text",text:""}),!0}const ct=(an,yn)=>tt.asides.filter(Wn=>Wn.q===an&&Wn.kind===yn).length,Ot=(an,yn=null)=>p6(an,yn,!!(oe!=null&&oe.views.portrait.hash)),_t=(an,yn,Wn,wr)=>{const hr=Wn!==null&&tt.editing===Wn;hr&&ge({[Wn]:void 0}),st(an,yn,Wn,wr,hr)};if(F&&F!=="keep"&&F.startsWith("trait-")){const an=ds(F);if(!an)return!1;const yn=an.part==="what"?((Or=tt.answers[F])==null?void 0:Or.refs)??[]:[];if(!Fe&&yn.length)return ge({[F]:{pick:(wn=tt.answers[F])==null?void 0:wn.pick,words:ece(an.id,yn.length),refs:yn}}),!0;const Wn=Bh(F,Fe,ga);if(!Fe||Wn)return _t(Fe,lc(Wn??"vague",Ot(F),ct(F,Wn??"vague"),Fe,void 0,!0),F,Wn??"vague"),!0;const wr=l9(Fe),hr=wr?h6(Fe):Fe;if(an.part==="where"){const Mn=tt.answers[F];ge({[F]:{pick:wr?Mn==null?void 0:Mn.pick:void 0,words:hr}})}else{const Mn=tt.answers[F];ge({[F]:{pick:wr?Mn==null?void 0:Mn.pick:void 0,words:hr,refs:(Mn==null?void 0:Mn.refs)??[]}})}return!0}if(F==="keep"){const an=tt.answers.keep,yn=(an==null?void 0:an.refs)??[],Wn=Fe||(yn.length&&!(an!=null&&an.words)?"the detail in the attached picture":"");return Wn?(ge({keep:{words:[(oa=an==null?void 0:an.words)==null?void 0:oa.trim(),Wn].filter(Boolean).join(", "),refs:yn}}),!0):!1}if(F&&dr(F)&&ye){const an=Fe&&!/^#[0-9a-f]{6}$/i.test(Fe)?Bh(F,Fe,ga):null;if(an)return _t(Fe,lc(an,Ot(F),ct(F,an),Fe,ye,!0),F,an),!0;const yn=tt.answers[F],Wn=!Fe||l9(Fe),wr=fe??(Wn?yn==null?void 0:yn.pick:void 0),hr={pick:wr,words:Fe?Wn?h6(Fe):Fe:yn==null?void 0:yn.words};if(Fe&&!wr&&!qle(tt.answers,F,hr,Fe)){const Mn=tt.answers.keep;return ge({keep:{words:[(Tn=Mn==null?void 0:Mn.words)==null?void 0:Tn.trim(),Yle(Fe)].filter(Boolean).join(", "),refs:(Mn==null?void 0:Mn.refs)??[]}}),!0}return ge({[F]:hr}),!0}const Lt=(ot==null?void 0:ot.id)??null,vn=Lt==="unsure"?((ia=tt.unsure)==null?void 0:ia.q)??"source":Lt;if(Lt==="traits"){const an=ri(Pe,ga);if(an)return st(Pe,lc(an,Ot(null,Lt),ct(Lt,an),Pe),Lt,an),!0;const yn=tt.answers.keep;return ge({traits:[],keep:{words:[(Ws=yn==null?void 0:yn.words)==null?void 0:Ws.trim(),Pe].filter(Boolean).join(", "),refs:(yn==null?void 0:yn.refs)??[]}}),!0}if(Lt==="gaps"){const an=ri(Pe,ga);if(an)return st(Pe,lc(an,Ot(null,Lt),ct(Lt,an),Pe),Lt,an),!0;const yn=(tt.answers.describe??"").trim().replace(/[.\s]+$/,"");return ge({describe:yn?`${yn}, ${Pe}`:Pe}),!0}const qt=Ot(null,vn),Nn=vn==="source"?zle(Pe):null,Qn=Nn?null:ri(Pe,ga);if(Qn&&(qt==="source"||qt==="describe"||Qn!=="vague"))return st(Pe,lc(Qn,qt,ct(Lt,Qn),Pe),Lt,Qn),!0;if((vn==="source"||vn==="describe")&&!Nn&&!ga(Pe))return E({type:"unsure",unsure:{said:Pe,q:Lt,at:Vp()},ctx:Oe}),!0;if((vn==="source"||vn==="describe")&&E({type:"settle-unsure",ctx:Oe}),vn==="source")return Nn?(ge({source:{door:Nn,via:"taps"}}),!0):(ge({source:{door:"scratch",via:"typed"},describe:Pe}),!0);if(vn==="describe")return ge({describe:Pe}),!0;if(s$(Pe,oe,vn))return G.update({name:Pe.slice(0,60)}),E({type:"text",text:""}),!0;if(vn==="name"){const an=Pe.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||Pe;return oe&&G.update({name:an.slice(0,60)}),E({type:"text",text:""}),!0}if(!oe)return!1;if(vn==="identity")return G.generate("portrait",Pe),E({type:"text",text:""}),!0;const un=tM(Pe,Mt,oe);return"blocked"in un?(B(un.blocked),!1):(R(un.view),H(!1),G.generate(un.view,Pe,un.scope==="view"?Qo(un.view):void 0),E({type:"text",text:""}),!0)},[ot,ge,st,oe,G,Mt]),Gt=s.useCallback(Ne=>{if(Ne==="name"){E({type:"edit",id:"name"});return}const Fe=Bk(Ne);if(Fe){E({type:"edit",id:`aside:${Fe}`});return}if(!Js(Ne))return;const tt=oce(Ne,oe);if(tt==="start-over"){Z("start-over");return}if(tt==="redraw"){me(Ne),Z("redraw");return}E({type:"edit",id:Ne})},[oe]),sn=s.useCallback(()=>{Z(null),Q&&E({type:"edit",id:Q}),me(null)},[Q]),Ut=s.useCallback((Ne,Fe)=>{const tt=C.current.answers;if(Ne==="keep"||Ne.startsWith("trait-")&&!Ne.endsWith("-where")){const F=tt[Ne];ge({[Ne]:{pick:Ne==="keep"||F==null?void 0:F.pick,words:Fe,refs:(F==null?void 0:F.refs)??[]}});return}if(dr(Ne)||Ne.startsWith("trait-")){const F=tt[Ne];ge({[Ne]:{pick:F==null?void 0:F.pick,words:Fe}});return}ge({[Ne]:Fe})},[ge]),An=s.useCallback((Ne,Fe)=>{const tt=Fe.trim();if(!tt)return;if(Ne==="name"){E({type:"cancel-edit"}),oe&&G.update({name:tt.slice(0,60)});return}const F=Bk(Ne);if(F){const ye=C.current,Ze=ye.asides.find(qt=>qt.at===F);if(!Ze)return;const Pe=Ze.q&&Js(Ze.q)?Ze.q:null,ct=Pe?Bh(Pe,tt,ga):ri(tt,ga);if(!ct&&Pe){E({type:"drop-aside",at:F}),Ut(Pe,tt);return}const Ot=p6(Pe,Ze.q,!!(oe!=null&&oe.views.portrait.hash)),_t=Pe&&dr(Pe)?Pe.slice(5):void 0,Lt=ct??"vague",vn=ye.asides.filter(qt=>qt.q===Ze.q&&qt.at<Ze.at&&qt.kind===Lt).length;E({type:"amend-aside",at:F,said:tt,reply:lc(Lt,Ot,vn,tt,_t),kind:Lt,ctx:Oe});return}if(!Js(Ne)||!Cf(Ne,C.current.answers))return;const fe=Bh(Ne,tt,ga);if(fe){const ye=C.current,Ze=p6(Ne,Ne,!!(oe!=null&&oe.views.portrait.hash)),Pe=dr(Ne)?Ne.slice(5):void 0,ct=ye.asides.filter(Ot=>Ot.q===Ne&&Ot.kind===fe).length;ge({[Ne]:void 0}),st(tt,lc(fe,Ze,ct,tt,Pe),Ne,fe);return}Ut(Ne,tt)},[oe,G.update,ge,Ut,Xt,ot,Oe]),Bt=s.useCallback(()=>E({type:"cancel-edit"}),[]),ne=s.useCallback(()=>{const Ne=C.current,Fe=Ne.editing&&Ne.editing!=="name"&&!Ef(Ne.editing)?Ne.editing:null,tt=Fe&&!Cf(Fe,Ne.answers)?Fe:ot==null?void 0:ot.id;if(tt==="agree"){E({type:"say",id:"keep"});return}if(tt==="identity"){he(F=>F+1);return}if(!(!tt||!Js(tt))){if(tt==="look-who"){ge({source:{door:"scratch",via:"words"}});return}E({type:"say",id:tt})}},[ot==null?void 0:ot.id,ge]),ce=s.useCallback(()=>x9(C.current,Oe,It.current),[Oe]),de=s.useCallback(Ne=>{const Fe=ce();if(Fe){B(null),C.current.saying!==Fe&&E({type:"say",id:Fe});for(const tt of Ne.slice(0,1)){const F=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,fe=URL.createObjectURL(tt);ee(ye=>[...ye,{key:F,id:Fe,url:fe}]),uf(tt).then(ye=>{if(Xe.current.delete(F)){URL.revokeObjectURL(fe);return}J.current.has(ye)?URL.revokeObjectURL(fe):J.current.set(ye,fe),E({type:"ref",id:Fe,hash:ye}),ee(Ze=>Ze.filter(Pe=>Pe.key!==F))}).catch(ye=>{Xe.current.delete(F)||B(String((ye==null?void 0:ye.message)??ye)),ee(Ze=>Ze.filter(Pe=>Pe.key!==F)),URL.revokeObjectURL(fe)})}}},[ce]),Ve=(Ne,Fe,tt)=>{const F=Zy(Ne,Fe,tt);return F.charAt(0).toUpperCase()+F.slice(1)},Ie=Ne=>t9(Ne).flatMap(Fe=>{const tt=Fe.color?ur(Fe.color):null;return tt?[{hex:tt,name:Fe.label,slot:"accent"}]:[]}),mt=x9(S,Oe,(ot==null?void 0:ot.id)??null),bt=(()=>{var ct,Ot,_t;if(!mt)return;const Ne=((ct=S.answers[mt])==null?void 0:ct.refs)??[],Fe=mt==="keep"?Ne.slice(((Ot=S.composing)==null?void 0:Ot.id)==="keep"?S.composing.refs.length:Ne.length):Ne,tt=re.filter(Lt=>Lt.id===mt);if(!Fe.length&&!tt.length)return;const F=mt==="keep"?null:ds(mt),fe=F&&((_t=$a(F.id))==null?void 0:_t.label)||"Detail",ye=Fe.length+tt.length>1;let Ze=0;const Pe=()=>ye?`${fe} ${++Ze}`:fe;return[...Fe.map(Lt=>({key:Lt,src:J.current.get(Lt)??mn(Lt,"micro"),label:Pe(),onRemove:()=>E({type:"ref",id:mt,hash:Lt,remove:!0})})),...tt.map(Lt=>({key:Lt.key,src:Lt.url,label:Pe(),busy:!0,onRemove:()=>{Xe.current.add(Lt.key),ee(vn=>vn.filter(qt=>qt.key!==Lt.key))}}))]})(),kt=uce(ot,S,oe,Mt),nt=G.busy||Y||!!kt.off,yt=mt,Ce=g9(S,ot),xe=Ce==="name"?null:Ce,et=xe&&dr(xe)?xe.slice(5):null,Ct=kt.color&&et?Ie(et):null,ke=xe&&((Pt=S.colour)==null?void 0:Pt.step)===xe?S.colour.hex:null,it=oe&&ui(oe)&&!kt.off&&!(ot!=null&&ot.id.match(/^(name|describe)$/))?(()=>{const Ne=XY(S.text,Mt,oe),Fe=Ne.chip?oe.views[Ne.chip.view].hash:void 0;return{chip:Ne.chip?{label:Ne.chip.label,thumb:Fe?mn(Fe,"micro"):void 0}:null,hint:Ne.hint,tone:Ne.tone}})():null,ft=oe?QN(oe,Mt):[],$e=(Zt==null?void 0:Zt.hash)??((oe==null?void 0:oe.stage)==="analyzing"?oe.sources[0]:void 0),Ke=P&&(Zt!=null&&Zt.prior)?Zt.prior:$e;return{d:oe,view:Mt,slot:Zt,facets:V,setFacets:K,presenterCategories:u,saving:U,saveErr:_,confirming:q,setConfirming:Z,confirmEdit:sn,pendingEdit:Q,startOver:at,begun:Object.keys(S.answers).length>0||!!oe,unsaved:!e&&!oe&&Object.keys(S.answers).length>0,leave:()=>{ie(),E({type:"start-over"})},revision:S.revision,open:(ot==null?void 0:ot.id)??null,keepPrevious:Zt&&Zt.status==="approved"&&Zt.prior&&!Rt&&!(oe!=null&&oe.activeView)&&(oe==null?void 0:oe.stage)==="idle"?()=>void G.revert(Mt):null,surface:{title:"Create presenter",memoryKey:`presenter-create:${l.id}:${t}`,resumed:ae,turns:Et,busy:G.busy||Y||w,working:cce(Et,oe,Y||G.busy),stageEmpty:{lead:Ele(oe?Mt:void 0,kn[Mt]),hint:Cle((ot==null?void 0:ot.id)??null,((Yt=S.answers.photos)==null?void 0:Yt.hashes.length)??0)},stage:oe?{hash:Ke,alt:`${Pc[Mt]}${(Zt==null?void 0:Zt.status)==="candidate"?", candidate":""}`,drawing:Rt,since:nM(oe),doing:rM(oe),takes:Tw(oe,Mt)?[]:aM(oe,Mt),onTake:Tt?Ne=>void G.restore(Mt,Ne):void 0,items:ft,onPick:Ne=>{R(Ne),H(!1)},compare:Zt&&Zt.status==="candidate"&&Zt.prior?{on:P,toggle:()=>H(Ne=>!Ne)}:void 0}:null,composer:{placeholder:kt.placeholder,label:kt.label,action:kt.action,scope:it,hint:null,why:kt.off??void 0,error:D??_,disabled:nt,working:!!oe&&!!oe.activeView&&(ot==null?void 0:ot.id)!=="name",onStop:oe!=null&&oe.activeView?()=>void G.stop():void 0,stopping:G.stopping,focusKey:ot&&!(ot.id==="agree"&&!S.saying)?`${ot.id}:${(oe==null?void 0:oe.id)??"setup"}:${te}:${S.saying??""}:${S.says}`:void 0,onAttach:!yt&&!oe&&(ot==null?void 0:ot.id)==="source"?()=>ge({source:{door:"photos",via:"taps"}}):void 0,onAttachFiles:yt?de:void 0,attachLabel:yt?Hce(S,yt):"Add photos",refs:bt,colour:Ct&&et?{hex:ke,label:ke?Ve(ke,t9(et),et):"Pick a colour",seed:(jt=Ct[Math.floor(Ct.length/2)])==null?void 0:jt.hex,onPick:Ne=>E({type:"colour",hex:Ne,step:xe}),onClear:()=>E({type:"colour",hex:null,step:xe})}:null},text:S.text,onText:Ne=>E({type:"text",text:Ne}),onSend:Xt,onAnswer:rt,onRestore:(Ne,Fe)=>{R(Ne),G.restore(Ne,Fe)},onEdit:Gt,onSaveEdit:An,onCancelEdit:Bt,onDescribe:ne,onAttachRef:de,onStarter:Ne=>{(ot==null?void 0:ot.id)==="agree"&&E({type:"say",id:"keep"}),E({type:"text",text:Ne})},onPaste:!oe&&((Ft=S.answers.source)==null?void 0:Ft.door)==="photos"?Ne=>void Ye(Ne):void 0}}}function Ice({onClose:e,...t}){const n=Oce(t),r=n.d,{push:a}=rr();s.useEffect(()=>Dp({open:n.open}),[n.open]),s.useEffect(()=>()=>Dp(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. ${JN(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:g=>{g||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 ",kn[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:Rle,body:(r==null?void 0:r.source)==="photos"?Lle:Ple,busy:!1,open:n.confirming==="redraw",onOpenChange:g=>{g||n.setConfirming(null)},onConfirm:n.confirmEdit}),m=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:g=>{g||l(!1)},onConfirm:()=>{l(!1),n.leave(),e()}})]});return o.jsx(Oy,{surface:{...n.surface,headAction:f,dock:h,overlay:m},onClose:u})}function Fce(){const{draftId:e=null}=na(),{key:t}=Un(),{brand:n}=cn(),r=Bn(),{announce:a,caps:i}=Yw();Gc("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((g,w=!1)=>{l.current&&(w&&(u.current=g),r(pl(n,g),{replace:w}))},[r,n]),p=s.useCallback(()=>{l.current&&(u.current=null,r(pl(n),{replace:!0}))},[r,n]),m=s.useCallback(()=>r(li(n),{replace:!0}),[r,n]);return o.jsx(Ice,{draftId:e,convoKey:e??t,onOpenDraft:h,onLeaveDraft:p,onClose:m,onStarted:g=>{a(g,{quiet:l.current&&g.kind==="presenter"}),l.current&&r(g.kind==="presenter"?Aa(n,g.id):li(n),{replace:!0})},caps:i},f.current)}const k9=1e3,_ce=3,Vce=1e3;function S9(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 Zce(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),[m,g]=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}=sa(),A=s.useCallback(async(B,V={})=>{if(!(S.current||b.current.job)){S.current=!0,g(!0);try{const K=b.current,U=Tr(K),I=B==="make"?{kind:B,instruction:K.place,imageHashes:K.pictures,draw:V.draw??!1,...V.shot?{shot:!0}:{}}:B==="again"?{kind:B,reading:U==null?void 0:U.reading,imageHashes:K.pictures}:{kind:B,reading:U==null?void 0:U.reading,ask:V.ask,from:(U==null?void 0:U.hash)??void 0,...U!=null&&U.hash&&U.anchor?{fromAnchor:!0}:{},...U!=null&&U.hash&&U.hero?{fromHero:U.hero,...U.heroWith?{heroWith:U.heroWith}:{}}:{},imageHashes:K.pictures,draw:V.draw},_=K.name.trim()||(U==null?void 0:U.reading.name)||void 0,{jobId:O,job:Y,existing:z}=await Ae.startSceneStudioJob(r,{...I,conversation:i,...a?{sceneId:a}:{},..._?{label:_}:{}});if(z&&Y.kind!==B){n({type:"error",text:we.busyElsewhere});return}n({type:"started",id:O,kind:Y.kind,ask:Y.kind===B?V.ask:void 0,since:Y.phaseAt}),C()}catch(K){n({type:"error",text:String((K==null?void 0:K.message)??K)}),y(U=>U+1)}finally{S.current=!1,g(!1)}}},[r,n,C]);s.useEffect(()=>{const B=b.current;if(B.job||!B.versions.length&&!B.inputsRev)return;let V=!0;return Ae.activity(r).then(K=>{var I;const U=(I=K.studio)==null?void 0:I.find(_=>_.kind==="scene"&&_.conversation===i&&_.status==="running"&&!!_.job);!V||!(U!=null&&U.job)||b.current.job||S.current||n({type:"started",id:U.id.slice(6),kind:U.job,since:U.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||Ae.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,K=!0,U;const I=async()=>{var _;try{const O=await Ae.sceneStudioJob(r,M);if(!B)return;V=0,f(!1),K&&O.status==="running"&&((_=b.current.job)!=null&&_.stopping)&&Ae.cancelSceneStudioJob(r,M).catch(()=>{}),K=!1,O.status==="running"?(n({type:"progress",job:O}),U=setTimeout(I,k9)):n({type:"finished",job:O})}catch(O){if(!B)return;if((O==null?void 0:O.status)===404){f(!1),n({type:"lost",id:M,error:we.lost});return}V++,V>=_ce&&f(!0),U=setTimeout(I,Math.min(k9*2**Math.min(V,3),8e3))}};return I(),()=>{B=!1,clearTimeout(U)}},[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=()=>Ae.cancelSceneStudioJob(r,B.id);return V().catch(()=>new Promise(K=>setTimeout(K,Vce)).then(V)).then(()=>!0,()=>(n({type:"stop-failed",id:B.id}),!1))},[r,n]),R=s.useCallback(B=>{const V=Are(b.current,B);V>=0&&n({type:"put-back",index:V})},[n]),P=s.useCallback(async(B={})=>{var _,O,Y,z;const V=b.current,K=((_=Tr(V))==null?void 0:_.reading.name)||((Y=(O=V.job)==null?void 0:O.pending)==null?void 0:Y.name)||"",U={...V,name:V.name.trim()||K},I=Ere(U);if(!(!I.can||!I.words||S.current)){S.current=!0,p(!0);try{const q=((z=V.job)==null?void 0:z.phase)==="drawing"?V.job.id:null,Z=S9(U,I.words,q?null:Tr(V)??null),Q=k.current,me=Q?Tr(Q):null,te=a&&!B.asNew?await Ae.updateScene(r,a,Q&&me?Ire(Z,S9(Q,me.reading,me)):Z):await Ae.createScene(r,{...Z,conversation:i});l(te.brand);const he=te.scene;if(q){const re=await Ae.attachSceneStudioJob(r,q,he.id).catch(()=>null);(re==null?void 0:re.state)==="landed"&&l(re.brand)}n({type:"saved",id:he.id}),E.current({id:he.id,name:he.name,verticals:he.verticals??[]},!!B.asNew)}catch(q){n({type:"error",text:String((q==null?void 0:q.message)??q)})}finally{S.current=!1,p(!1)}}},[r,a,i,l,n]);return{offline:u,saving:h,starting:m,failed:w,start:A,stop:j,putBack:R,use:P}}const zce="scenri:scene-studio:",Bce=10080*60*1e3;function u$(e){const t=jr.get(e);if(!t)return null;try{return JSON.parse(t)}catch{return null}}function Uce(e){const t=u$(e);return NP(typeof(t==null?void 0:t.session)=="string"?t.session:null)}function Wce(e,t,n){jr.set(e,JSON.stringify({at:Date.now(),sceneId:n,session:t}))}function Kce(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 E9(e){jr.del(e)}function Gce(e=Date.now()){var t;for(const n of jr.keys(zce)){let r=0;try{r=Number((t=JSON.parse(jr.get(n)??"null"))==null?void 0:t.at)||0}catch{}e-r>Bce&&jr.del(n)}}function Yce(e){var xe,et,Ct,ke,it,ft;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(()=>{Gce();const $e=Uce(l);return $e||cl(l),$e}),[p,m]=s.useReducer(mP,null,()=>(h==null?void 0:h.setup)??vre),[g,w]=s.useReducer(Sre,null,()=>(h==null?void 0:h.studio)??a??vP),[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),R=s.useRef(!1),P=s.useRef(p);P.current=p;const H=s.useRef(g);H.current=g;const[D,B]=s.useState(null),V=s.useRef(e.onSaved);V.current=e.onSaved;const K=Zce({s:g,dispatch:w,brandId:t.id,sceneId:r,conversation:i,seed:a,applyBrand:n,onSaved:($e,Ke)=>V.current($e,r&&!Ke?"updated":"created")}),U=s.useRef(!1);s.useEffect(()=>{if(R.current)return;const $e=u$(l);if(($e==null?void 0:$e.done)===!0||U.current&&!$e){R.current=!0;return}const Ke=typeof($e==null?void 0:$e.sceneId)=="string"?$e.sceneId:null;Wce(l,Qre(p,g),r??g.saved??Ke),U.current=!0},[p,g,l,r]);const I=g.saved,_=I?pf(t,I):void 0,O=bL(t.id,I,(_==null?void 0:_.placeUrl)??null),Y=((xe=O.job)==null?void 0:xe.status)==="running",[z,q]=s.useState(!1),[Z,Q]=s.useState(0),[me,te]=s.useState(!1);s.useEffect(()=>{Y||te(!1)},[Y]);const he=s.useMemo(()=>iM(_==null?void 0:_.examples,O.job),[_==null?void 0:_.examples,O.job]),re=s.useRef(e.onDone);re.current=e.onDone;const ee=s.useMemo(()=>{var Ke,Pt;if(!I)return;const $e=(_==null?void 0:_.examples)??[];return{tiles:he,running:Y||z||O.waiting,read:O.read,who:((Ke=$e[0])==null?void 0:Ke.with)??((Pt=O.job)==null?void 0:Pt.subject.kind)??((_==null?void 0:_.subject)==="person"||_!=null&&_.figure?"presenter":"product"),noSubject:O.read&&!O.job&&!$e.length&&O.more.length===0,missing:tq(O.more,$e,O.job),first:O.first,stale:O.first.length>0&&$e.some(Yt=>Yt.earlier),finish:e.finish}},[I,_,he,Y,z,O.waiting,O.read,O.job,O.first,O.more,e.finish]),J=s.useCallback($e=>{I&&(j(null),q(!0),Ae.drawSceneExamples(t.id,I,$e).then(()=>{q(!1),O.again()}).catch(Ke=>{q(!1),Q(Pt=>Pt+1),"roles"in $e||w({type:"set-failed",more:"more"in $e}),j(String((Ke==null?void 0:Ke.message)??Ke))}))},[t.id,I,O.again]),ae=s.useCallback(()=>{I&&(R.current=!0,rse(l,I),cl(l),re.current(I))},[I,l]),[Me,ue]=s.useState(null);s.useEffect(()=>ue(null),[g.current]),s.useEffect(()=>{f||p.editing||!eS(p.answers)||w({type:"inputs",place:mre(p.answers),pictures:gre(p.answers)})},[p.answers,p.editing,f]);const Se=s.useRef(new Set),Be=kre(g,!f&&eS(p.answers));s.useEffect(()=>{var $e;Be===null||K.starting||Se.current.has(Be)||(Se.current.add(Be),K.start("make",{draw:!1,shot:(($e=P.current.answers.source)==null?void 0:$e.door)==="shot"}))},[Be,K.starting,K.start]);const[vt,Ue]=s.useState(""),Xe=Sy(t.id,vt,!f),De=s.useRef(Xe);De.current=Xe;const G=s.useRef([]);Xe.settled&&!Xe.error&&(G.current=Xe.items);const oe=Xe.settled?Xe.items:G.current,We=!Xe.error&&(!Xe.settled||Xe.loading),{recent:Oe,loaded:ie}=cn(),[X,se]=s.useState(null);s.useEffect(()=>{!vt.trim()&&Xe.settled&&!Xe.error&&se(Xe.items.length>0)},[vt,Xe.settled,Xe.error,Xe.items.length]);const Re=X??(Oe.length>0?!0:ie?!1:null),_e=s.useMemo(()=>({any:Re,items:oe.map($e=>({id:$e.id,hash:$e.images[0],alt:Kce($e.promptHead)})),query:vt,more:Xe.settled&&Xe.hasMore,loading:We,error:Xe.error}),[Re,oe,vt,Xe.settled,Xe.hasMore,We,Xe.error]),Ye=$n().scenes,ge=(u==null?void 0:u.canRead)??!0,[Qe,at]=s.useState(null),wt=s.useCallback(async $e=>{var Ft,Ne,Fe;const Ke=G.current.find(tt=>tt.id===$e)??Xe.items.find(tt=>tt.id===$e);if(!(Ke!=null&&Ke.images[0]))return;const Pt=P.current.revision;let Yt=cS(Ke.brief);if(!Yt&&Ke.kind==="edit"){const tt=await Ae.lineage(Ke.id).catch(()=>null);if(Yt=cS((Ft=tt==null?void 0:tt.ancestors.find(F=>F.kind==="generation"))==null?void 0:Ft.brief),P.current.revision!==Pt)return}const jt=Yt?((Ne=pf(t,Yt))==null?void 0:Ne.name)??((Fe=Ye.find(tt=>tt.id===Yt))==null?void 0:Fe.name):void 0;if(!ge&&!(Yt&&jt)){at("shot");return}at(null),St({shot:{id:Ke.id,hash:Ke.images[0],...Yt&&jt?{scene:{id:Yt,name:jt}}:{}},reuse:void 0})},[t,Ye,Xe.items,ge]),Et=s.useCallback(()=>{var Ke;const $e=(Ke=P.current.answers.shot)==null?void 0:Ke.scene;$e&&(R.current=!0,E9(l),cl(l),re.current($e.id,{existing:!0}))},[l]),ot=(u==null?void 0:u.canDraw)??!0,It=K.offline?we.offline:M,Mt={setup:p,studio:g,canDraw:ot,canRead:ge,noReader:Qe,uploading:y,edit:f&&{...f,changed:lS(g,a)},editingName:C,note:It,stale:wP(g),shots:_e,set:ee},Zt=K.failed+Z,Rt=s.useMemo(()=>Kre(Mt).map($e=>$e.kind==="question"&&Zt?{...$e,question:{...$e.question,attempt:Zt}}:$e),[p,g,ot,ge,Qe,y,C,It,f,_e,ee,Zt]),Tt=(()=>{const $e=Rt[Rt.length-1];return($e==null?void 0:$e.kind)==="question"?$e.question:null})(),Ee=qre(Mt,Tt),Je=($e,Ke,Pt)=>m({type:"aside",aside:{said:$e,reply:Ke,q:Pt,at:Vp()}}),St=s.useCallback($e=>{const Ke=P.current,Pt=Ke.held??Ke.answers;Ke.editing&&aS(H.current)&&JSON.stringify(hy(Pt,$e))!==JSON.stringify(Pt)&&w({type:"forget-record"}),m({type:"answer",patch:$e})},[]),qe=s.useRef(0),st=s.useCallback(async $e=>{var Ne,Fe;const Ke=$e.some(rS),Pt=$e.filter(tt=>tt.type.startsWith("image/")&&!rS(tt));if(!Pt.length){j(Ke?we.heicNotYet:we.onlyPictures);return}((Ne=P.current.answers.source)==null?void 0:Ne.door)!=="photos"&&St({source:{door:"photos"}});const jt=4-(((Fe=P.current.answers.photos)==null?void 0:Fe.hashes)??[]).length-qe.current;if(jt<=0){j(we.fourPictures);return}const Ft=Pt.slice(0,jt);j(Pt.length>jt?we.fourPictures:Ke?we.heicNotYet:null),qe.current+=Ft.length,b(tt=>tt+1);try{for(const tt of Ft)try{m({type:"photo",hash:await uf(tt)})}catch(F){j(`${tt.name} could not be added: ${String((F==null?void 0:F.message)??F)}`)}finally{qe.current-=1}}finally{b(tt=>tt-1)}},[St]),rt=s.useRef(he);rt.current=he;const Xt=Ol(),Gt=Il(),sn=s.useCallback(($e,Ke)=>{var Pt,Yt;if(j(null),Ke.kind==="confirm"&&Ke.id.startsWith("remedy:")){const jt=Ke.id.slice(7);jt==="setup"?Gt():(jt==="engines"||jt==="budget")&&Xt(jt);return}if(Ke.kind==="confirm"&&Ke.id==="reword"){T(String(Date.now()));return}if($e==="photos"&&Ke.kind==="photos"){const jt=Ke.action,Ft=((Pt=P.current.answers.photos)==null?void 0:Pt.hashes)??[];jt.type==="add"?st(jt.files):jt.type==="instead"?St({source:{door:"shot"}}):jt.type==="remove"?m({type:"photos",hashes:Ft.filter(Ne=>Ne!==jt.hash)}):jt.type==="reject"?j(we.onlyPictures):jt.type==="submit"&&Ft.length?ge?(at(null),St({photos:{hashes:Ft,done:!0}})):at("photos"):jt.type==="back"&&St({source:{door:"guided"}});return}if($e==="shot"&&Ke.kind==="pick"){const jt=Ke.action;jt.type==="pick"?wt(jt.id):jt.type==="query"?Ue(jt.text):jt.type==="more"?De.current.loading||De.current.loadMore():jt.type==="back"&&(Ue(""),St({source:{door:"photos"},photos:{hashes:[],done:!1}}));return}if($e==="reuse"&&Ke.kind==="choice"&&Ke.id==="use"){Et();return}if($e==="reuse"&&!ge){at("shot");return}if($e==="noreader"){Ke.kind==="confirm"&&Ke.id==="unstop"&&at(null);return}if(Jk($e)){const jt=pre($e,Ke,P.current.answers);jt&&St(jt);return}if($e==="retry"){K.start("make",{draw:!1,shot:((Yt=P.current.answers.source)==null?void 0:Yt.door)==="shot"});return}if(Ke.kind==="confirm"){if($e==="set-start"){Ke.id==="draw-set"?(w({type:"set-drawn"}),J({first:!0})):w({type:"set-declined"});return}if($e==="set-more"){Ke.id==="more"?(w({type:"ask-more"}),J({more:!0})):w({type:"decline-more"});return}if($e==="set-done"){Ke.id==="retry-failed"?J({roles:rt.current.filter(jt=>jt.state==="failed").map(jt=>jt.role)}):ae();return}Ke.id==="draw"||Ke.id==="again"?K.start("again"):Ke.id==="use"?K.use():Ke.id==="another-shot"&&ce.current("shot")}},[st,St,K.start,K.use,J,ae,wt,Et,Xt,Gt,ge]),Ut=$e=>{$e.trim()?!E.current&&Ee.target.kind!=="off"&&(E.current=Ee.target):E.current=null,S($e)},An=$e=>{const Ke=Bt($e);return Ke&&(E.current=null,S("")),Ke};function Bt($e){var Ke;{const Pt=$e.trim();if(!Pt)return!1;j(null);const Yt=E.current??Ee.target;if(Yt.kind==="source"){if(jP(Pt))return St({source:{door:"words",text:Pt.slice(0,xd)}}),!0;const jt=are(Pt),Ft=Object.keys(jt);return Ft.length>0?(St({source:{door:"guided"},...Object.fromEntries(Ft.map(Ne=>[Ne,{pick:jt[Ne]}]))}),!0):(Je(Pt,gS(vS(Pt,"source")??"vague","source"),"source"),!0)}if(Yt.kind==="row"&&Zp(Yt.id)){const jt=vS(Pt,"row");if(jt)return Je(Pt,gS(jt,"row"),Yt.id),!0;const Ft=(Ke=P.current.answers[Yt.id])==null?void 0:Ke.pick;return St({[Yt.id]:{...Ft?{pick:Ft}:{},words:Pt.slice(0,xd)}}),!0}if(Yt.kind==="name")return w({type:"name",text:bP(Pt)??Pt}),!0;if(Yt.kind==="add"||Yt.kind==="change"){if(g.job||K.starting)return!1;const jt=Hre(Pt),Ft=Wre(g);return jt.kind==="rename"?(w({type:"name",text:jt.name}),Je(Pt,we.renamed(jt.name),Ft),!0):jt.kind!=="change"?(Je(Pt,jt.say,Ft),jt.kind!=="refuse"):(Yt.kind==="add"?K.start("change",{ask:Pt,draw:!1}):Ore(g,Pt)?K.start("again"):K.start("change",{ask:Pt}),!0)}return!1}}const ne=s.useCallback($e=>{g.job||($e==="name"?A(!0):Jk($e)&&($e==="shot"&&Ue(""),aS(g)?B($e):m({type:"edit",id:$e})))},[g]),ce=s.useRef(ne);ce.current=ne;const de=s.useCallback(($e,Ke)=>{$e==="name"&&(Ke.trim()&&w({type:"name",text:Ke.trim()}),A(!1))},[]),Ve=s.useCallback(()=>{A(!1),m({type:"cancel-edit"})},[]),Ie=Tr(g),mt=Y&&O.job?Dw({status:O.job.status,step:O.job.current,done:O.job.done.length,total:O.job.roles.length,error:O.job.error}):void 0,bt=g.job?X8(g):K.saving?"Saving":mt,kt=[];let nt=null;const yt=$e=>({view:"place",label:"The place",state:$e==="place"?"current":"approved",hash:(Ie==null?void 0:Ie.hash)??void 0,photo:!1,drawing:!1,approved:!0,error:!1});if(I){const $e=Y?(et=O.job)==null?void 0:et.current:null,Ke=((Ct=[...he].reverse().find(Ft=>Ft.state==="shown"))==null?void 0:Ct.role)??null,Pt=Me??$e??Ke??"place",Yt=((ke=he[0])==null?void 0:ke.role)==="hero"&&he[0].state==="shown";Yt||kt.push(yt(Pt));for(const[Ft,Ne]of he.entries())kt.push({view:Ne.role,label:Ya[Ne.role],state:Pt===Ne.role?"current":Ne.state==="shown"?"approved":"todo",hash:Ne.hash,photo:!1,drawing:Ne.state==="drawing",approved:Ne.state==="shown",error:Ne.state==="failed"}),Yt&&Ft===0&&kt.push(yt(Pt));const jt=kt.find(Ft=>Ft.view===Pt)??kt[0];nt={hash:jt.hash,drawing:jt.drawing}}else if(Ie!=null&&Ie.hash&&Ie.hero){const $e=Me==="place"?"place":"hero";kt.push({view:"hero",label:Ya.hero,state:$e==="hero"?"current":"approved",hash:Ie.hero,photo:!1,drawing:!1,approved:!0,error:!1},yt($e))}const Ce=!f&&(!!p.answers.source||g.versions.length>0);return{title:f?we.editTitle:we.title,turns:Rt,working:bt,busy:K.saving,resumed:!!h,memoryKey:l,stage:nt?{hash:nt.hash,alt:`${g.name.trim()||(Ie==null?void 0:Ie.reading.name)||"The scene"}, in use`,drawing:nt.drawing||!!g.job&&g.job.phase==="drawing",doing:mt??X8(g),items:kt,onPick:$e=>ue($e)}:{hash:(Me==="place"?Ie==null?void 0:Ie.hash:yP(Ie))??void 0,alt:`Preview of ${g.name.trim()||(Ie==null?void 0:Ie.reading.name)||"the scene"}`,drawing:!!g.job&&g.job.phase==="drawing",since:((it=g.job)==null?void 0:it.since)??void 0,doing:X8(g),takes:g.job?void 0:Cre(g),onTake:K.putBack,items:kt,onPick:$e=>ue($e)},composer:{placeholder:Ee.placeholder,label:Ee.label,action:Ee.action,disabled:Ee.target.kind==="off",why:Ee.target.kind==="off"&&Ee.target.why||null,working:Ee.working,onStop:g.job?()=>{j(null),K.stop().then($e=>{$e||j(we.stopLost)})}:Y&&I?()=>{te(!0),Ae.stopSceneExamples(t.id,I).then(()=>O.again()).catch(()=>{te(!1),j(we.stopLost)})}:void 0,stopping:!!((ft=g.job)!=null&&ft.stopping)||me,focusKey:L,onAttachFiles:Ee.attach?$e=>void st($e):void 0,attachLabel:we.attachLabel},text:k,onText:Ut,onSend:An,onAnswer:sn,onEdit:ne,onSaveEdit:de,onCancelEdit:Ve,confirmingEdit:D!==null,confirmEdit:()=>{D&&m({type:"edit",id:D}),B(null)},cancelConfirm:()=>B(null),onRestore:($e,Ke)=>K.putBack(Ke),onRetry:$e=>J({roles:[$e]}),onDescribe:()=>T(String(Date.now())),onStarter:$e=>{Ut($e),T(String(Date.now()))},onPaste:(Tt==null?void 0:Tt.id)==="source"||(Tt==null?void 0:Tt.id)==="photos"?$e=>void st($e):void 0,canDraw:ot,begun:Ce,unsaved:g.saved?!1:f?lS(g,a):Ce,running:!!g.job||Y,saved:!!I,finish:ae,keptAsDraft:!f&&xP(g),leave:()=>{K.stop(),R.current=!0,E9(l),cl(l)}}}function qce({brand:e,applyBrand:t,sceneId:n,seed:r,conversation:a,storageKey:i,caps:l,onClose:u,onStartOver:f,onSaved:h,onDone:p,finish:m}){const g=Yce({brand:e,applyBrand:t,sceneId:n,seed:r,conversation:a,storageKey:i,caps:l,onSaved:h,onDone:p,finish:m}),[w,y]=s.useState(!1),[b,k]=s.useState(!1),S=g.turns[g.turns.length-1],E=(S==null?void 0:S.kind)==="question"?S.question.id:null;s.useEffect(()=>Dp({open:E}),[E]),s.useEffect(()=>()=>Dp(null),[]);const C=!!n,A=()=>{if(g.busy){k(!0);return}if(g.saved){g.finish();return}if(g.running||g.keptAsDraft){u();return}if(g.unsaved){y(!0);return}g.leave(),u()};s.useEffect(()=>{!b||g.busy||(k(!1),A())},[b,g.busy]);const L=!C&&g.begun&&!g.saved?o.jsx(Xn,{label:we.startOver,tone:"quiet",title:we.startOverTitle,body:we.startOverBody,busy:!1,onConfirm:()=>{g.leave(),f()}}):null;return o.jsx(Oy,{onClose:A,surface:{kind:"scene",glyph:o.jsx(nC,{size:32}),title:g.title,turns:g.turns,busy:g.busy,working:g.working,memoryKey:g.memoryKey,resumed:g.resumed,stage:g.stage,stageEmpty:{lead:we.emptyLead,hint:we.emptyHint},composer:g.composer,text:g.text,onText:g.onText,onSend:g.onSend,onAnswer:g.onAnswer,onEdit:g.onEdit,onSaveEdit:g.onSaveEdit,onCancelEdit:g.onCancelEdit,onRestore:g.onRestore,onRetry:g.onRetry,onDescribe:g.onDescribe,onStarter:g.onStarter,onPaste:g.onPaste,headAction:L,overlay:o.jsxs(o.Fragment,{children:[o.jsx(Xn,{label:we.changeIt,title:we.changeTitle,body:we.changeBody,busy:!1,open:g.confirmingEdit,onOpenChange:T=>{T||g.cancelConfirm()},onConfirm:g.confirmEdit}),o.jsx(Xn,{label:C?we.discard:we.leave,title:C?we.discardTitle:we.leaveTitle,body:C?we.discardBody:we.leaveBody,busy:!1,open:w,onOpenChange:T=>{T||y(!1)},onConfirm:()=>{y(!1),g.leave(),u()}})]})}})}const rv=e=>{const t=/^asset:([a-f0-9]{32})$/.exec(String(e??""));return t?t[1]:null};function Xce(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=>rv(u==null?void 0:u.file)).filter(Boolean);return xre({place:String(r.instruction??""),pictures:i,reading:a,hash:rv(r.preview)??null,anchor:r.anchor===!0,...Qce(r),name:a.name})}function Qce(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=rv(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 Jce(){return[...crypto.getRandomValues(new Uint8Array(6))].map(t=>t.toString(16).padStart(2,"0")).join("")}function C9(){const{sceneId:e=null,convoId:t=null}=na(),{key:n,state:r}=Un(),{brand:a}=cn(),{applyBrand:i}=$n(),l=Bn(),{announce:u,caps:f}=Yw();Gc(e?"Edit scene":"Create scene");const[h]=s.useState(()=>e?Xce(a,e):null),p=typeof(r==null?void 0:r.from)=="string"?r.from:null,m=p&&(vl(pt.hub,p.split("?")[0])||vl(pt.set,p.split("?")[0])),g=s.useCallback(()=>{var k;p&&(((k=window.history.state)==null?void 0:k.idx)??0)>0?l(-1):l(p??(e?zr(a,e):fl(a)),{replace:!0})},[l,p,e,a]),w=s.useMemo(()=>t??Jce(),[t,n]);s.useEffect(()=>{t||e&&!h||l(e?Nw(a,e,w):hl(a,w),{replace:!0,state:r})},[t,w,e,h,a,l,r]);const y=s.useRef(null),b=s.useMemo(()=>t?sse(a.id,t):null,[a.id,t]);return e&&!h?o.jsx(Xa,{to:zr(a,e),replace:!0}):b?o.jsx(Xa,{to:zr(a,b),replace:!0}):o.jsx(qce,{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:g,onStartOver:()=>l(hl(a),{replace:!0,state:r}),onSaved:(k,S)=>{y.current={made:k,how:S}},finish:m?we.useInAShot:we.openScene,onDone:(k,S)=>{var E,C;if(!(S!=null&&S.existing)&&!pf(a,k)){l(fl(a),{replace:!0});return}if(!(S!=null&&S.existing)){const A=pf(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:!(m&&p)})}m&&p?l(`${p.split("?")[0]}?scene=${encodeURIComponent(k)}&compose=1`,{replace:!0}):l(zr(a,k),{replace:!0})}},w)}function d$(){const{brand:e}=cn(),t=Bn(),n=Er(e);return s.useCallback(r=>{t(`${n}?product=${encodeURIComponent(r)}&compose=1${kc()}`)},[n,t])}function eue({product:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,onDelete:u,onRename:f,bookmarked:h,onBookmark:p,chosen:m,batching:g,onPick:w,batch:y,size:b="grid"}){var S,E;const k=s.useMemo(()=>y?f2({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}):Sl({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($d,{id:e.id,previewUrl:Jr((E=(S=e.shots)==null?void 0:S[0])==null?void 0:E.file),title:Ho(e,"tooltip"),primary:Ho(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:m,batching:g,onPick:w,size:b})}function tue(e){return o.jsx(Jm,{...e})}const f$=s.memo(eue);function nue({product:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,bookmarked:u,onBookmark:f,size:h="grid"}){const p=gf(e.category)??e.category,{contentArriving:m}=$n(),g=s.useMemo(()=>Sl({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($d,{id:e.id,previewUrl:e.previewUrl,pending:!e.previewUrl&&m,title:`${Ho(e,"tooltip")} · ${p}`,primary:Ho(e,"card"),secondary:"",useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,menu:g,bookmarked:u,onBookmark:f,size:h})}const h$=s.memo(nue),rue=8,g6="__bookmarked";function sue(){var St;const{brand:e,products:t,productsLoaded:n,refreshProducts:r}=cn(),a=((St=nR())==null?void 0:St.importing)??!1,{demoProducts:i,applyBrand:l,refreshBrands:u}=$n(),{push:f}=rr(),h=n&&t.length===0,p=Bn(),m=d$(),g=Fl(),{q:w,setQ:y,facets:b,setFacets:k,clearSearch:S,clear:E}=d1(["category","bookmarked"]),C=b.category,A=b.bookmarked==="1",[L,T]=s.useState(()=>kd("product",e.id)),M=qe=>T(c2("product",e.id,qe)),j=Ly(`${e.id}|${w}|${C??""}|${A?"1":""}`),[R,P]=ja(qr.wallDensity,wd),H=Xc(R),D=s.useCallback(qe=>P(qe),[P]),B=s.useMemo(()=>Qm(H),[H]),V=qm(H),K=s.useMemo(()=>{const qe=a?t.filter(st=>{var rt;return(((rt=st.shots)==null?void 0:rt.length)??0)>0}):t;return HM(qe).map(st=>({product:st,category:Gw(st),own:!0}))},[t,a]),U=s.useMemo(()=>i.map(qe=>({product:qe,category:qe.category,own:!1})),[i]),I=s.useMemo(()=>[...K,...U],[K,U]),_=s.useMemo(()=>I.reduce((qe,st)=>qe+(L.includes(st.product.id)?1:0),0),[I,L]),O=A&&_===0,Y=O&&h,z=O&&!h,q=s.useMemo(()=>{const qe=new Map;for(const{category:st}of I)st&&qe.set(st,(qe.get(st)??0)+1);return qe},[I]),Z=s.useMemo(()=>mf.filter(qe=>q.has(qe.key)),[q]),Q=I.length>0?"tabs":"none",me=s.useCallback(qe=>p(xa(e,qe)),[p,e]),[te,he]=s.useState(null),[re,ee]=s.useState(!1),[J,ae]=s.useState(null),[Me,ue]=s.useState(!1),[Se,Be]=s.useState(null),[vt,Ue]=s.useState(!1),Xe=s.useCallback(qe=>{const st=t.find(rt=>rt.id===qe);st&&he(st)},[t]),De=qe=>qe.origin==="catalog"||qe.id.startsWith("cat-"),G=s.useCallback(qe=>{const st=t.find(rt=>rt.id===qe);!st||De(st)||(Be(null),ae(st))},[t]),oe=async qe=>{if(!(!J||Me)){ue(!0),Be(null);try{l(await Ae.updateProduct(e.id,J.id,{name:qe})),ae(null)}catch(st){const rt=on(st,"Could not rename this product");Be([rt.title,rt.detail].filter(Boolean).join(" "))}finally{ue(!1)}}},We=async()=>{if(!te||re)return;ee(!0);const qe=te.origin==="catalog"||te.id.startsWith("cat-");try{qe?(await Ae.deleteCatalogProduct(e.id,te.id),await r()):l(await c4(e.id,te.id)),j.forget(te.id),he(null)}catch(st){(st==null?void 0:st.status)===404?(await Promise.all([u(),r()]),j.forget(te.id),he(null)):f(on(st,"Could not delete this product"))}finally{ee(!1)}},Oe=s.useCallback(qe=>qe.filter(({product:st})=>Y||!A||L.includes(st.id)).filter(({category:st})=>!C||st===C).filter(({product:st,category:rt})=>Oo([gy(st),gf(rt)].filter(Boolean).join(" "),w)).map(({product:st})=>st),[C,w,A,L,Y]),ie=s.useMemo(()=>Oe(K),[Oe,K]),X=s.useMemo(()=>Oe(U),[Oe,U]),{visible:se,remaining:Re,showMore:_e}=xf(ie,`${C??""}|${A?"keepers":""}|${w}`),[Ye,ge]=s.useState(null);s.useEffect(()=>{if(!Ye||Re<=0)return;const qe=Ye.closest(".sc-home"),st=new IntersectionObserver(rt=>{rt.some(Xt=>Xt.isIntersecting)&&_e()},{root:qe,rootMargin:"200% 0px"});return st.observe(Ye),()=>st.disconnect()},[Ye,Re,_e]);const Qe={key:"category",label:"Category",everyLabel:"All products",everyCount:I.length,selected:A?g6:C,onSelect:qe=>k(qe===g6?{bookmarked:"1",category:null}:{bookmarked:null,category:qe}),options:[{value:g6,label:"Keepers",count:_},...Z.map(qe=>({value:qe.key,label:qe.label,count:q.get(qe.key)??0}))]},at=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>g("product"),children:[o.jsx(mr,{size:12})," Add product"]}),wt=h,Et=t.length>0,ot=o.jsx(h2,{title:"Products",filters:o.jsx(p2,{mode:Q,group:Qe}),density:o.jsx(Xm,{value:H,onChange:D}),search:I.length>=rue&&o.jsx(Id,{value:w,onChange:y,noun:"products",total:I.length})}),It=qe=>{const st=t.find(Xt=>Xt.id===qe);return st&&st.origin==="catalog"||qe.startsWith("cat-")?Ae.deleteCatalogProduct(e.id,qe):c4(e.id,qe)},Mt=()=>{const qe=[...j.ids];qe.length===1?Xe(qe[0]):Ue(!0)},Zt=[...j.ids],Rt=Zt.length>0&&Zt.every(qe=>L.includes(qe)),Tt=()=>T(wy("product",e.id,Zt,!Rt)),Ee=d2(j.ids.size,Rt,"products"),Je=async()=>{if(re)return;const qe=[...j.ids];ee(!0);try{const{failed:st,error:rt}=await Xp(qe,It);await Promise.all([u(),r()]),j.retain(st),Ue(!1),rt&&f(on(rt,"Could not delete these products"))}finally{ee(!1)}};return o.jsx(s1.Provider,{value:V,children:o.jsxs(us,{children:[o.jsxs("main",{className:"sc-looks sc-products",id:"main","data-hero":wt||void 0,onClick:j.onBlank,children:[n&&!wt&&ot,!n&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":V,style:B,"aria-hidden":!0,children:o.jsx(tue,{size:"grid",count:8})}),Et&&se.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:se.map(qe=>o.jsx(f$,{product:qe,variant:"use",size:"grid",onOpen:me,href:xa(e,qe.id),onUse:m,bookmarked:L.includes(qe.id),onBookmark:M,onDelete:Xe,onRename:De(qe)?void 0:G,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:Mt,onKeep:Tt,allKept:Rt}:null},qe.id))}),Re>0&&o.jsx("div",{ref:ge,"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:_e,children:["Show ",Math.min(Re,60)," more"]})}),J&&o.jsx(Ry,{title:"Rename product",name:J.name,maxLength:500,busy:Me,error:Se,onConfirm:qe=>void oe(qe),onDismiss:()=>{Me||ae(null)}}),te&&o.jsx(Xn,{label:"Delete product",title:`Delete ${te.name}?`,body:Si("product",1),open:!0,busy:re,onOpenChange:qe=>{!qe&&!re&&he(null)},onConfirm:()=>void We()}),vt&&o.jsx(Xn,{label:ls("product",j.ids.size).menu,title:`${ls("product",j.ids.size).menu}?`,body:Si("product",j.ids.size),open:!0,busy:re,onOpenChange:qe=>{!qe&&!re&&Ue(!1)},onConfirm:()=>void Je()})]}),wt&&o.jsx(Mo,{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:at}),Et&&se.length>0&&X.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri products"})}),wt&&U.length>0&&o.jsxs(o.Fragment,{children:[o.jsx($y,{label:"Or borrow one of ours"}),ot]}),n&&X.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:X.map(qe=>o.jsx(h$,{product:qe,variant:"use",size:"grid",onUse:m,onOpen:me,href:xa(e,qe.id),bookmarked:L.includes(qe.id),onBookmark:M},qe.id))}),n&&z&&o.jsx(Mo,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a product from its card and it stays here.",mark:My,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&&X.length===0&&o.jsx(m2,{noun:"products",q:w,facet:A?"Keepers":C?gf(C):null,onClearSearch:S,onClearAll:E})]}),o.jsxs("div",{className:"sc-wall-dock",children:[j.kind==="product"&&j.ids.size>0&&o.jsx(Py,{count:j.ids.size,loaded:se.length,tool:ls("product",j.ids.size).tool,icon:ls("product",j.ids.size).icon,danger:!0,onAct:Mt,keep:{label:Ee.tool,filled:Rt,onAct:Tt},onClear:j.clear,onSelectAll:()=>j.selectAll("product",se.map(qe=>qe.id))}),o.jsx(Ny,{})]})]})})}function aue({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 m=p?e.findIndex(A=>A.file===p.file):-1,g=!!l&&m>0,w=!!u&&!!p&&e.length>1,y=!!(r&&i&&e.length>0),b=e.length>1||y,{shellRef:k,railRef:S,page:E}=yL(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(Lr,{size:"2"}):o.jsx(mr,{size:22,weight:"bold"}),o.jsx("span",{children:"Add a reference"})]}):o.jsx("span",{className:"sc-refstage-blank",children:o.jsx(Pa,{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(Ra,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-refrail-arrow next","aria-label":"Next references",onClick:()=>E(1),children:o.jsx(Cl,{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(Lr,{size:"1"}):o.jsx(mr,{size:16,weight:"bold"}),o.jsx("span",{className:"sc-vh",children:r})]})]}),(g||w)&&o.jsx("div",{className:"sc-refacts",children:o.jsxs("span",{className:"sc-refacts-pair",children:[g&&o.jsxs("button",{type:"button",className:"sc-refact sc-refact-lead",onClick:()=>l==null?void 0:l(p.file),children:[o.jsx(II,{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 oue({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 iue({value:e,onChange:t}){const n=gf(e)??"Other",r=e&&mf.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(wl,{size:11,weight:"bold"})]})}),o.jsx(As,{align:"center",sideOffset:8,children:o.jsx(Sp,{value:r,children:mf.map(a=>o.jsx(Bu,{value:a.key,onSelect:()=>t(a.key),children:a.label},a.key))})})]})}const v6='mm|cm|inches|inch|in|m|"';function j9(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 jf(e){const t=Number(e.trim().replace(",","."));return e.trim()&&Number.isFinite(t)&&t>0?String(t):""}const p1=["height","width","depth"],sv={height:"Height",width:"Width",depth:"Depth"};function p$(e){var f,h,p,m,g,w;const t={unit:"cm",height:"",width:"",depth:""},n=e.trim();if(!n||!new RegExp(v6,"i").test(n))return t;const r={},a=(y,b)=>{if(r[b])return;const k=n.match(new RegExp(`(\\d+(?:[.,]\\d+)?)\\s*(${v6})?\\s*(?:${y})\\b`,"i"));if(!k)return;const S=jf(k[1]);S&&(r[b]={value:S,unit:j9(k[2])})};a("tall|high","height"),a("across|wide","width"),a("long","width"),a("deep","depth");const i=p1.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*(${v6})?`,"gi"))){const b=jf(y[1]);b&&l.push({value:b,unit:j9(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:((m=l[0])==null?void 0:m.value)??"",width:((g=l[1])==null?void 0:g.value)??"",depth:((w=l[2])==null?void 0:w.value)??""}}function lue(e){const t=p$(e),n=p1.flatMap(i=>t[i]?[`${sv[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 uue(e){return p1.map(t=>{const n=jf(e[t]);return n?`${n} ${e.unit} ${cue[t]}`:""}).filter(Boolean).join(" and ")}function due(e,t){return p1.every(n=>jf(e[n])===jf(t[n]))}function fue({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(()=>p$(u)),[h,p]=s.useState(f),[m,g]=s.useState(l),w=(S,E)=>S.trim().toLowerCase()===E.trim().toLowerCase(),y=due(h,f)?u:uue(h),b=()=>{if(!n){if(w(y,u)&&m===l)return i();a({size:y,category:m})}},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(Us,{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(iue,{value:m,onChange:g}),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:p1.map(S=>o.jsxs("label",{className:"sc-size-dim",children:[o.jsx("span",{className:"sc-size-name",children:sv[S]}),o.jsxs("span",{className:"sc-size-box",children:[o.jsx("input",{className:"sc-pdetails-field",inputMode:"decimal","aria-label":sv[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 hue=3;function pue(e){const t=e,n=(t.brand??t.vendor??"").trim();return!n||e.name.toLowerCase().startsWith(n.toLowerCase())?null:n}function mue(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 gue(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 vue(){var Ye;const{productId:e=""}=na(),{brand:t,products:n,productsLoaded:r,refreshProducts:a}=cn(),{demoProducts:i,demoProductsLoaded:l,applyBrand:u,refreshBrands:f}=$n(),h=Bn(),p=d$(),{push:m}=rr(),[g,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=g2(),T=n.find(ge=>ge.id===e),[M,j]=s.useState(null);s.useEffect(()=>{if((T==null?void 0:T.origin)!=="catalog"){j(null);return}let ge=!0;return Ae.libraryProduct(t.id,T.id).then(Qe=>{ge&&j(Qe.product)}).catch(()=>{}),()=>{ge=!1}},[t.id,T]);const R=M&&T&&M.id===T.id?{...M,...T,shots:M.shots}:T,P=s.useMemo(()=>R?void 0:i.find(ge=>ge.id===e),[R,i,e]);Gc((Ye=R??P)==null?void 0:Ye.name);const[H,D]=s.useState([]);s.useEffect(()=>{if(!P){D([]);return}let ge=!0;return Ae.demoProductFrames(P.id).then(Qe=>{ge&&D(Qe.frames)}).catch(()=>{ge&&D([])}),()=>{ge=!1}},[P==null?void 0:P.id]);const[B,V]=s.useState((R==null?void 0:R.name)??"");s.useEffect(()=>{V((R==null?void 0:R.name)??"")},[R==null?void 0:R.id]);const K=Ty(t.id,[e??""]),[U,I]=s.useState(null),[_,O]=s.useState(!1),[Y,z]=s.useState(!1),[q,Z]=s.useState(null),Q=!!(R??P);s.useEffect(()=>{if(I(null),!Q||!e)return;let ge=!0;return Ae.productSize(t.id,e).then(Qe=>{ge&&I(Qe.size)}).catch(()=>{}),()=>{ge=!1}},[t.id,e,Q]);const me=async ge=>{if(!e)return!1;const Qe=L();z(!0),Z(null);try{const at=await Ae.setProductSize(t.id,e,ge);return Qe()&&(I(at.size),O(!1)),!0}catch(at){return Z(String(at.message??at)),!1}finally{z(!1)}},te=((R==null?void 0:R.origin)??"manual")==="manual",he=async(ge,Qe)=>{Qe&&ge&&typeof ge=="object"&&"json"in ge?u(ge):await a()},re=ge=>{if(!R||A.current)return;C.current={...C.current,...ge},E.current&&clearTimeout(E.current);const Qe=t.id,at=R.id,wt=te;E.current=setTimeout(()=>{E.current=null;const Et=C.current;C.current={},(wt?Ae.updateProduct(Qe,at,Et):Ae.updateCatalogProduct(Qe,at,Et)).then(It=>he(It,wt)).catch(It=>S(String(It.message??It)))},500)},ee=async ge=>{const Qe=(U==null?void 0:U.text)??"",at=ge.size.trim().toLowerCase()!==Qe.trim().toLowerCase();at&&!await me(ge.size)||(ge.category!==(Be??"other")&&re({category:ge.category}),at||O(!1))},J=async ge=>{const Qe=te;w(!0),S(null);try{await he(await ge,Qe)}catch(at){S(String(at.message??at))}finally{w(!1)}},ae=async()=>{if(!R||A.current)return;A.current=!0,E.current&&clearTimeout(E.current),E.current=null,C.current={};const ge=L(),Qe=Ju(t),at=R.origin==="catalog"||R.id.startsWith("cat-");b(!0),S(null);try{at?(await Ae.deleteCatalogProduct(t.id,R.id),await a()):u(await c4(t.id,R.id))}catch(wt){if((wt==null?void 0:wt.status)!==404){A.current=!1,ge()&&(S(String(wt.message??wt)),b(!1));return}await Promise.all([f(),a()])}ge()&&h(Qe,{replace:!0})};if(!R&&!P&&(!l||!r))return o.jsx(us,{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(!R&&!P)return o.jsx(us,{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(Zn,{className:"sc-btn sc-btn-primary",to:Ju(t),children:"Browse products"})})]})});const Me=P?"none":te?"full":"fields",ue=R??P,Se=(R==null?void 0:R.id)??P.id,Be=R?Gw(R):(P==null?void 0:P.category)??null,vt=pue(ue),Ue=ge=>{const Qe=Jr(ge.file);return Qe?[{file:ge.file,url:Qe,angle:ge.angle}]:[]},Xe=P?H.map(ge=>({file:ge.angle,url:ge.url,angle:ge.angle})):((R==null?void 0:R.shots)??[]).flatMap(Ue),De=ge=>{const Qe=Xe.map(wt=>wt.file),at=Qe.indexOf(ge)+1;J(Ae.setProductShots(t.id,Se,Qe.filter(wt=>wt!==ge))).then(()=>m({kind:"success",title:"Reference removed",detail:`Reference ${at} of ${Qe.length}`,action:{label:"Undo",onClick:()=>void J(Ae.setProductShots(t.id,Se,Qe))}}))},G=P?"Our reference set. Yours replaces it.":Xe.length===0?te?"No reference yet.":"No reference yet. Images from your store are still arriving.":Xe.length===1?"One angle. A shot has to guess at every side it can't see.":Xe.length===2?"Two angles. A third pins the shape.":"The first three build every shot. Remove any that show a different colour or version.",oe=Me==="none"?null:"Add image",We=R!=null&&R.descriptionHtml?gue(mue(R.descriptionHtml),200):"",Oe=(P==null?void 0:P.description)||We||null,ie=lue((U==null?void 0:U.text)??""),X=P?[P.subcategory]:[R==null?void 0:R.variant,R==null?void 0:R.material,ie.length?null:R==null?void 0:R.dimensions],se=gf(Be),Re=X.filter(Boolean),_e=P?i.filter(ge=>ge.id!==Se).slice(0,8):n.filter(ge=>ge.id!==Se).slice(0,8);return o.jsx(us,{children:o.jsxs("main",{className:"sc-lookpage sc-productpage",id:"main",children:[o.jsx(Dy,{to:Ju(t),wall:"Products",where:P?"Scenri library":te?"Yours":"From your store"}),vt&&o.jsx("p",{className:"sc-lookpage-house",children:o.jsx("em",{className:"sc-accent",children:vt})}),Me==="full"?o.jsx(oue,{label:"Product name",value:B,onChange:ge=>{V(ge),re({name:ge})}}):o.jsx("h1",{dir:"auto",children:ue.name}),(se||ie.length>0)&&o.jsxs("div",{className:"sc-lookpage-marks",children:[se&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Filed under",children:o.jsx("li",{className:"sc-chip","data-static":!0,children:se})}),ie.length>0&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Size",children:ie.map(ge=>o.jsx("li",{className:"sc-chip","data-static":!0,children:ge},ge))})]}),Oe&&o.jsx("p",{className:"sc-lookpage-lede",children:Oe}),Re.length>0&&o.jsx("p",{className:"sc-lookpage-facts",children:Re.join(" · ")}),o.jsxs("div",{className:"sc-lookpage-acts",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>p(Se),children:"Use in a shot"}),o.jsx(Hy,{kind:"product",brandId:t.id,id:Se}),Me!=="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:()=>{Z(null),O(!0)},children:o.jsx(Cd,{size:17})})})]}),k&&o.jsx("p",{className:"sc-assetform-err",children:k}),o.jsx(aue,{refs:Xe,cap:hue,note:G,addLabel:oe,busy:g,onAdd:Me==="none"?void 0:ge=>void J(PG(t.id,Se,ge)),onPromote:Me==="none"?void 0:ge=>void J(Ae.setProductShots(t.id,Se,[ge,...Xe.map(Qe=>Qe.file).filter(Qe=>Qe!==ge)])),onRemove:Me==="none"?void 0:De}),K.length>0&&o.jsx(ad,{label:`Shots featuring ${ue.name}`,children:K.map(ge=>o.jsx(Ww,{node:ge,to:Zm(t,null,ge.id)},ge.id))}),_e.length>0&&o.jsx(ad,{label:P?"Other products in the library":"Other products",children:_e.map(ge=>P?o.jsx(h$,{product:ge,variant:"navigate",size:"slider",onOpen:Qe=>h(xa(t,Qe)),href:xa(t,ge.id)},ge.id):o.jsx(f$,{product:ge,variant:"navigate",size:"slider",onOpen:Qe=>h(xa(t,Qe)),href:xa(t,ge.id)},ge.id))}),_&&o.jsx(fue,{size:U,category:Be,busy:Y,error:q,onSave:ge=>void ee(ge),onDismiss:()=>O(!1)}),R&&o.jsx("div",{className:"sc-ownedbits",children:o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx(Xn,{label:"Delete product",title:`Delete ${R.name}?`,body:Si("product",1),busy:y,onConfirm:()=>void ae()})})})]})})}function wue(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 yue=[{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 bue({open:e,onOpenChange:t}){return o.jsx(xw,{open:e,onOpenChange:t,children:o.jsxs(kw,{maxWidth:"360px","aria-describedby":void 0,children:[o.jsx(Sw,{children:"Shortcuts"}),o.jsx("div",{className:"sc-keys",children:yue.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 Uy({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=S4(f,B0(f),n,null),p=f.getBoundingClientRect();h.size(p.width,p.height),h.draw(performance.now()/1e3);const m=g=>h.draw(g);return xM(m),()=>kM(m)},[t]),s.useLayoutEffect(()=>{const f=i.current,h=e.current;if(!f||!h||!t)return;const p=f.getBoundingClientRect(),m=performance.now(),g=r??m,w=qq(f,h,B0(f),n,p.width,p.height,g/1e3);let y=Math.min(w.ms,m-g);w.draw(y/w.ms);let b=m,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 w6=BM,xue=UM;function kue({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,m]=s.useState(!1),[g,w]=s.useState(!1),[y,b]=s.useState(()=>w6(h)),[k,S]=s.useState(h);h!==k&&(S(h),m(!1),w(!1),b(w6(h)));const E=s.useRef(null),C=s.useCallback(()=>{xue(h),m(!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||ff()?null:w6(h)?A9(h)!==void 0?"run":null:"hold");L==="hold"&&p&&(m$.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":g||void 0,style:r?{"--sc-cell-ar":r}:void 0,children:g?o.jsx(Pa,{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(Uy,{img:E,ready:L==="run",index:l,since:A9(h),onDone:M})]})})}const m$=new Map,A9=e=>{const t=m$.get(e);return t!==void 0&&performance.now()-t<2e3?t:void 0};function g$({name:e}){return o.jsx(sd,{name:e})}function Sue({node:e,chosen:t,picking:n,batching:r,armed:a,menu:i,onPick:l,onBranch:u,onToggleKeep:f,onArchive:h,onDelete:p}){const m=Hr(e),g=Vw(),w=(b,k)=>PM(b,k,g),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=Dr(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 ${m}`,children:o.jsx(Av,{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(bc,{}),o.jsxs(qn,{color:b.danger?"red":void 0,onSelect:b.onSelect,children:[o.jsx(g$,{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 ${m}`,onClick:()=>u(e.id),children:o.jsx(ME,{size:15,weight:"bold"})})),e.images[0]&&w("Download",o.jsx("button",{type:"button",className:"sc-cell-ctl","aria-label":`Download ${m}`,onClick:y,children:o.jsx(fE,{size:15})})),e.archived?p&&w("Delete permanently",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-danger","aria-label":`Delete ${m} permanently`,onClick:()=>p(e),children:o.jsx(jl,{size:15})})):h&&w("Archive",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-danger","aria-label":`Archive ${m}`,onClick:()=>h(e),children:o.jsx(um,{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 ${m} from Keepers`:`Add ${m} to Keepers`,onClick:()=>f(e),children:o.jsx(Qa,{size:15,weight:e.kept?"fill":"regular"})}))]})})]})}function v$(e,t){return e>1?`Remove ${e} shots from ${t}`:`Remove from ${t}`}function Uh(e,t,n){return e>1?n(e):t}function Eue(e,{chosen:t,batching:n,versions:r,onOpen:a,onBranch:i,onPick:l,onVersions:u,onToggleKeep:f,onArchive:h,onDeletePermanently:p,shotHref:m,inSet:g,filedIn:w,onRemoveFromSet:y,batch:b}){const k=[{key:"open",icon:"open",label:"Open",onSelect:()=>a(e.id)}];m&&k.push({key:"open-tab",icon:"open-tab",label:"Open in new tab",onSelect:()=>window.open(m(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:Uh(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?g?[g]:[]:g?[g]:w??[];if(L)for(const M of T)k.push({key:`unset-${M.id}`,icon:"unset",label:v$(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?Uh(b.count,"Restore",M=>`Restore ${M} shots`):Uh(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:Uh(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 w$(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:pi((l=e.brief)==null?void 0:l.format),guess:!0}}const Cue=s.memo(function({node:t,selected:n,armed:r,chosen:a,picking:i,batching:l,versions:u,handlers:f,inSet:h,filedIn:p,pickedMeta:m}){const g=Eue(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&&m&&f.onKeepPicked?{...m,onKeep:f.onKeepPicked,onArchive:f.onArchivePicked??(()=>{}),onRestore:f.onRestorePicked??(()=>{}),onDelete:f.onDeletePickedAsk??(()=>{}),onRemoveFromSet:f.onRemovePickedFromSet}:null});return o.jsxs(qf,{children:[o.jsx(Xf,{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(Zn,{className:"sc-cell-open",to:f.shotHref(t.id),"aria-label":l?`${a?"Deselect":"Select"} ${Hr(t)}`:`Open ${Hr(t)}`,onClick:w=>{var y;l&&(w.preventDefault(),(y=f.onPick)==null||y.call(f,t.id))},children:o.jsx(kue,{src:mn(t.images[0],"tile"),fallback:Dr(t.images[0]),arrival:jue(t),index:t.batchIndex,...w$(t,0)})}),o.jsx(Sue,{node:t,chosen:a,picking:i,batching:l,armed:r,menu:g,onPick:f.onPick,onBranch:f.onBranch,onToggleKeep:f.onToggleKeep,onArchive:f.onArchive,onDelete:f.onDeleteAsk})]})}),o.jsx(Qf,{children:g.map(w=>o.jsxs("span",{style:{display:"contents"},children:[w.separated&&o.jsx(Fm,{}),o.jsxs(Jf,{color:w.danger?"red":void 0,onSelect:w.onSelect,children:[o.jsx(g$,{name:w.icon}),w.label]})]},w.key))})]})});function jue(e){const t=Wa(Ka(e));return Number.isFinite(t)&&Date.now()-(t+(e.durationMs??0))<9e4}const Aue=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":pi((i=t.brief)==null?void 0:i.format)},children:[o.jsxs(Zn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${Hr(t)}, still rendering`,children:[o.jsx(Na,{index:t.batchIndex,since:Ka(t)}),o.jsx(gL,{since:Ka(t)})]}),a&&o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-cancel",onClick:()=>a(t),children:"Cancel"})]})}),Nue=s.memo(function({node:t,selected:n,shotHref:r,engineName:a,onRetry:i,onArchive:l}){var h;const u=t.status==="cancelled",f=u?KN():io(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":pi(t.brief.format)}:void 0,children:[o.jsx(Zn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${Hr(t)}`}),o.jsx("span",{className:"sc-cell-failed",children:o.jsx(IN,{failure:f,density:"tile",onRetry:()=>i(t),dismiss:l?{label:t.archived?"Restore":"Dismiss",onClick:()=>l(t)}:void 0})})]})}),Mue=40,Rue=1,N9=64,Pue=e=>e>Mue,Lue=e=>Math.floor(e/N9)*N9,$ue=112;function Wh(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,$ue):i)+rd}function M9(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 Tue(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 R9(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 Due(e,t){const n=t*Rue;return[e-n,e+t+n]}function Wy(e){const t=e.getBoundingClientRect().top,n=e.querySelector(".sc-toolbar");return n?Math.max(t,n.getBoundingClientRect().bottom):t}function Hue(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,m=0;const g=()=>{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?Oue(e,Wy(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:Lue(h.scrollTop-k),height:h.clientHeight};r(E=>E.top===S.top&&E.height===S.height?E:S)}g(),cancelAnimationFrame(m),m=requestAnimationFrame(g)},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(m),u.current=()=>{},h.removeEventListener("scroll",y),b.disconnect()}},[e,t]),{...n,anchor:a,resync:f,hold:l}}function Oue(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 Iue(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 m of h){const g=m.target.getAttribute("data-fb-node");if(!g)continue;const w=m.target;if(w.offsetHeight<=2||w.offsetWidth<=2)continue;const y=(w.offsetHeight-2)/(w.offsetWidth-2),b=r.current.get(g);(b===void 0||Math.abs(b-y)>.004)&&(r.current.set(g,y),p=!0)}p&&!u&&(u=requestAnimationFrame(()=>{u=0,a(m=>m+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+rd},[n])}function Fue({nodes:e,selectedId:t,onOpen:n,shotHref:r,onRetry:a,onCancel:i,onToggleKeep:l,onArchive:u,onDeletePermanently:f,picked:h,onPick:p,empty:m,sending:g,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:R,onDeletePicked:P,onRemovePickedFromSet:H}){const D=e.filter(X=>X.kind!=="root"),B=!!p,V=B&&((h==null?void 0:h.size)??0)>0,K=s.useMemo(()=>{if(!h||h.size===0)return null;let X=0,se=0,Re=0;for(const _e of e)!h.has(_e.id)||_e.kind==="root"||(X+=1,_e.kept&&(se+=1),_e.archived&&(Re+=1));return{count:h.size,allKept:X>0&&se===X,archived:X>0&&Re===X}},[e,h]),[U,I]=s.useState(null),[_,O]=s.useState(!1),[Y,z]=s.useState(null),{tile:q,cols:Z}=NX(jX(Y),S,AX()<SX),[Q,me]=s.useState(null);s.useEffect(()=>{if(!Q||!C)return;const X=Q.closest(".sc-canvas"),se=new IntersectionObserver(Re=>{Re.some(_e=>_e.isIntersecting)&&C()},{root:X,rootMargin:"200% 0px"});return se.observe(Q),()=>se.disconnect()},[Q,C]);const te=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:R,onDeletePicked:P,onRemovePickedFromSet:H});te.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:R,onDeletePicked:P,onRemovePickedFromSet:H};const he=!!f,re=!!P,ee=s.useMemo(()=>({onOpen:X=>te.current.onOpen(X),shotHref:X=>te.current.shotHref(X),onRetry:X=>te.current.onRetry(X),onCancel:i?X=>{var se,Re;return(Re=(se=te.current).onCancel)==null?void 0:Re.call(se,X)}:void 0,onToggleKeep:l?X=>{var se,Re;return(Re=(se=te.current).onToggleKeep)==null?void 0:Re.call(se,X)}:void 0,onArchive:u?X=>{var se,Re;return(Re=(se=te.current).onArchive)==null?void 0:Re.call(se,X)}:void 0,onBranch:w?X=>{var se,Re;return(Re=(se=te.current).onBranch)==null?void 0:Re.call(se,X)}:void 0,onPick:p?X=>{var se,Re;return(Re=(se=te.current).onPick)==null?void 0:Re.call(se,X)}:void 0,onVersions:b?X=>{var se,Re;return(Re=(se=te.current).onVersions)==null?void 0:Re.call(se,X)}:void 0,onDeleteAsk:he?X=>I(X):void 0,engineName:k?X=>{var se,Re;return(Re=(se=te.current).engineName)==null?void 0:Re.call(se,X)}:void 0,onRemoveFromSet:T?(X,se)=>{var Re,_e;return(_e=(Re=te.current).onRemoveFromSet)==null?void 0:_e.call(Re,X,se)}:void 0,onKeepPicked:M?()=>{var X,se;return(se=(X=te.current).onKeepPicked)==null?void 0:se.call(X)}:void 0,onArchivePicked:j?()=>{var X,se;return(se=(X=te.current).onArchivePicked)==null?void 0:se.call(X)}:void 0,onRestorePicked:R?()=>{var X,se;return(se=(X=te.current).onRestorePicked)==null?void 0:se.call(X)}:void 0,onDeletePickedAsk:re?()=>O(!0):void 0,onRemovePickedFromSet:H?X=>{var se,Re;return(Re=(se=te.current).onRemovePickedFromSet)==null?void 0:Re.call(se,X)}:void 0}),[!!i,!!l,!!u,!!w,!!p,!!b,he,re,!!k,!!T,!!M,!!j,!!R,!!H]),J=[...g?Array.from({length:Math.max(1,g.count)},(X,se)=>({key:`sending-${se}`,node:null,said:g.said,slot:se})):[],...D.map(X=>({key:X.id,node:X}))],ae=X=>X.status==="cancelled"||X.status==="error"||X.images.length===0,Me=X=>{const se=X.node;return se?se.status==="running"?o.jsx(Aue,{node:se,selected:se.id===t,shotHref:ee.shotHref,onCancel:ee.onCancel},se.id):ae(se)?o.jsx(Nue,{node:se,selected:se.id===t,shotHref:ee.shotHref,engineName:ee.engineName,onRetry:ee.onRetry,onArchive:ee.onArchive},se.id):o.jsx(Cue,{node:se,selected:se.id===t,armed:se.id===y,chosen:(h==null?void 0:h.has(se.id))??!1,picking:B,batching:V,versions:se.childCount,handlers:ee,inSet:A,filedIn:L==null?void 0:L(se.id),pickedMeta:K},se.id):o.jsxs("div",{className:"sc-cell","data-running":"true","data-sending":"true",style:g!=null&&g.format?{"--sc-cell-ar":pi(g.format)}:void 0,children:[o.jsx(Na,{index:X.slot,appear:!0}),o.jsx("span",{className:"sc-cell-tag",children:"sending"}),o.jsx("span",{className:"sc-cell-said",dir:"auto",children:X.said})]},X.key)},ue=X=>{var Re,_e;const se=X.node;return se?se.status==="running"?Wh("running",pi((Re=se.brief)==null?void 0:Re.format),q):ae(se)?Wh("failed",(_e=se.brief)!=null&&_e.format?pi(se.brief.format):3/2,q):Wh("done",w$(se,0).aspect,q):Wh("sending",void 0,q)},Se=Pue(J.length),Be=Hue(Y,Se),vt=Iue(Y,Se,q),Ue=K5(Z),Xe=`${Ue}:${q}`,De=s.useRef(Xe),G=s.useRef({items:J,heightOf:vt,estimate:ue});G.current={items:J,heightOf:vt,estimate:ue};const oe=s.useRef(null);if(s.useLayoutEffect(()=>{const X=De.current;De.current=Xe;const se=Be.anchor.current,Re=Y==null?void 0:Y.closest(".sc-canvas");if(!(X===Xe||!se||!Y||!Re)){if(oe.current={anchor:se,until:performance.now()+_ue},Be.hold(se,oe.current.until),!P9(Y,Re,se)){const{items:_e,heightOf:Ye,estimate:ge}=G.current,Qe=_e.findIndex(ot=>{var It;return((It=ot.node)==null?void 0:It.id)===se.id});if(Qe<0)return;const at=R9(_e.length,Ue)[Qe%Ue],wt=M9(at.map(ot=>(_e[ot].node&&Ye(_e[ot].node.id))??ge(_e[ot]))),Et=Y.getBoundingClientRect().top+wt[Math.floor(Qe/Ue)];Re.scrollTop+=Et-Wy(Re)-se.offset}Be.resync()}},[Xe,Ue,Y,Be.anchor,Be.resync,Be.hold]),s.useLayoutEffect(()=>{const X=oe.current,se=Y==null?void 0:Y.closest(".sc-canvas");if(!(!X||!Y||!se)){if(performance.now()>X.until){oe.current=null;return}P9(Y,se,X.anchor)}}),s.useEffect(()=>{const X=Y==null?void 0:Y.closest(".sc-canvas");if(!X)return;const se=()=>{oe.current=null,Be.hold(null)},Re=["wheel","touchstart","keydown","pointerdown"];for(const _e of Re)X.addEventListener(_e,se,{passive:!0});return()=>{for(const _e of Re)X.removeEventListener(_e,se)}},[Y,Be.hold]),E&&x5(D)&&!g){const X=Math.max(1,Math.min(Z,8));return o.jsx("div",{className:"sc-feed","aria-busy":"true",ref:z,style:{"--sc-tile":`${q}px`,"--sc-cols":X},children:Array.from({length:X},(se,Re)=>o.jsx("div",{className:"sc-feed-col",children:Array.from({length:2},(_e,Ye)=>o.jsx("div",{className:"sc-cell sc-wait-late","data-placeholder":"true",children:o.jsx("span",{className:"sc-placeholder"})},`pending-${Re}-${Ye}`))},`col-${X}-${Re}`))})}if(x5(D)&&!g)return o.jsx(o.Fragment,{children:m??o.jsx("p",{className:"sc-feed-empty",children:"Nothing here yet."})});const We=K5(Z),Oe=R9(J.length,We),ie=Se?Due(Be.top,Be.height):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-feed",ref:z,style:{"--sc-tile":`${q}px`,"--sc-cols":We},children:Oe.map((X,se)=>{const Re=`col-${We}-${se}`;if(!ie)return o.jsx("div",{className:"sc-feed-col",children:X.map(at=>Me(J[at]))},Re);const _e=X.map(at=>(J[at].node&&vt(J[at].node.id))??ue(J[at])),Ye=M9(_e),[ge,Qe]=Tue(Ye,ie[0],ie[1]);return o.jsxs("div",{className:"sc-feed-col",children:[ge>0&&o.jsx("div",{className:"sc-feed-pad",style:{height:Ye[ge]},"aria-hidden":!0}),X.slice(ge,Qe).map(at=>Me(J[at])),Qe<X.length&&o.jsx("div",{className:"sc-feed-pad",style:{height:Ye[X.length]-Ye[Qe]},"aria-hidden":!0})]},Re)})}),C&&o.jsx("div",{className:"sc-feed-end",ref:me,"aria-hidden":!0}),o.jsx(zf,{open:!!U||_,onOpenChange:X=>{X||(I(null),O(!1))},children:o.jsxs(Bf,{maxWidth:"420px",children:[o.jsx(Uf,{children:_?`Delete ${(K==null?void 0:K.count)??0} shot${((K==null?void 0:K.count)??0)===1?"":"s"} permanently?`:"Delete this shot permanently?"}),o.jsx(Wf,{size:"2",children:"This cannot be undone."}),o.jsxs(_s,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Gf,{children:o.jsx(ba,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Kf,{children:o.jsx(ba,{color:"red",onClick:()=>{_?P==null||P():U&&(f==null||f(U)),I(null),O(!1)},children:"Delete permanently"})})]})]})})]})}const _ue=800;function P9(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-Wy(t)-n.offset;return Math.abs(a)>=1&&(t.scrollTop+=a),!0}function Vue(e){return e==="open"||e==="result"?"open":"compact"}function av({name:e,kind:t,count:n,mode:r,onToggle:a,action:i,children:l}){const u=Vue(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(wl,{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 y$({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(Pa,{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(Qa,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Kept. "})]}),e.label]})]});return o.jsx(nL,{why:r?a:null,children:l})}function y6({kind:e,title:t,items:n,attached:r,mode:a,onToggle:i,onPick:l,onUnpick:u,full:f,moreLabel:h,createLabel:p,onCreate:m}){const g=s.useMemo(()=>new Set(r),[r]),[w,y]=s.useState(qp);return s.useEffect(()=>{a!=="open"&&y(qp)},[a]),a==="result"&&n.length===0?null:o.jsx(av,{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:m,children:o.jsx(mr,{size:10})}),children:b=>{const{visible:k,more:S}=Zoe(n,g,b==="open"?w:q4);return o.jsxs("div",{className:b==="open"?"sc-acard-grid":"sc-arow",children:[k.map(E=>o.jsx(y$,{candidate:E,on:g.has(E.id),named:b==="open",disabled:!!f&&!g.has(E.id),title:f??void 0,onClick:()=>g.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+G0),"aria-label":`Show ${Math.min(S,G0)} more ${h}`,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",S]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})}})}const L9=220,$9="cubic-bezier(0.32, 0.72, 0, 1)";function b6(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 Zue(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 b6(a))for(const l of[...i.body.getAnimations(),...i.group.getAnimations()])l.finish();n.current=b6(a)}};return s.useLayoutEffect(()=>{const a=n.current;n.current=null;const i=e.current;if(!(!a||!i))for(const l of b6(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:L9,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:L9,easing:$9})}}},[t]),r}function zue({brand:e,shots:t,shotsTotal:n,attached:r=cL,full:a,onToken:i,offToken:l,onTemplate:u,offTemplate:f,onClose:h}){const p=u1(),m=Fl(),{applyBrand:g}=$n(),{push:w}=rr(),[y,b]=pG(qr.assetsExpanded,null),k=s.useRef(null),S=Zue(k,y),E=Z=>{S(),b(Q=>Q===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(ki(e.id)),[e.id]),R=s.useMemo(()=>{const Z=Q=>{const me=dl(Q,p);return u2(Q,me,{currentId:null,query:"",bookmarked:j,shown:me.length}).items};return{product:Z("product"),presenter:Z("presenter"),scene:Z("scene")}},[p,j]),P=s.useMemo(()=>({product:ud(R.product,C),presenter:ud(R.presenter,C),scene:ud(R.scene,C)}),[R,C]),H=s.useMemo(()=>{var Z;return ea((Z=e.json)==null?void 0:Z.palette)},[e]),D=s.useMemo(()=>L?H.filter(Z=>Oo(`${Z.name} ${Z.hex}`,C)):H,[H,C,L]),B=Z=>{(async()=>{var me;const Q=rR((me=e.json)==null?void 0:me.palette,Z);if(Q.swatch){if(Q.added)try{const te=await Ae.updateBrand(e.id,{...e.json??{},palette:Q.palette},e.json);g(te)}catch(te){w(on(te,"Could not save the brand"));return}T("colors")}})()},V=Z=>{(async()=>{var me;const Q=MQ((me=e.json)==null?void 0:me.palette,Z);if(Q.removed)try{const te=await Ae.updateBrand(e.id,{...e.json??{},palette:Q.palette},e.json);g(te)}catch(te){w(on(te,"Could not save the brand"))}})()},K=M("shots")==="open",U=Sy(e.id,"",K),I=s.useMemo(()=>{const Z=new Set,Q=[];for(const me of[...t,...U.items])me.status!=="done"||me.images.length===0||Z.has(me.id)||(Z.add(me.id),Q.push(me));return Q},[t,U.items]),_=Math.max(n??0,U.total,I.length),[O,Y]=s.useState(qp);s.useEffect(()=>{K||Y(qp)},[K]);const z=()=>{Y(Z=>Z+G0),U.hasMore&&I.length<O+2*G0&&U.loadMore()},q=L&&!P.product.length&&!P.presenter.length&&!P.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(Cn,{size:12})})]}),o.jsx("div",{className:"sc-assets-searchbar",children:o.jsxs("div",{className:"sc-assets-search",children:[o.jsx(fd,{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(Cn,{size:11})})]})}),q&&o.jsxs("p",{className:"sc-assets-zero",children:["Nothing here matches “",C.trim(),"”."]}),o.jsx(y6,{kind:"product",title:"Products",items:P.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:()=>m("product",{onCreated:Z=>{Z.kind==="product"&&(T("product"),i({t:"product",id:Z.id}))}})}),o.jsx(y6,{kind:"presenter",title:"Presenters",items:P.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:()=>m("presenter",{onCreated:()=>T("presenter")})}),o.jsx(y6,{kind:"scene",title:"Scenes",items:P.scene,attached:r.scene?[r.scene]:[],mode:M("scene"),onToggle:E,onPick:u,onUnpick:()=>f(),full:a,moreLabel:"scenes",createLabel:"Create scene",onCreate:()=>m("scene",{onCreated:Z=>{Z.kind==="scene"&&T("scene")}})}),!(L&&D.length===0)&&o.jsx(av,{name:"Brand colors",count:D.length,mode:M("colors"),onToggle:()=>E("colors"),action:o.jsx(yd,{className:"sc-aadd",triggerStyle:{background:"none"},value:e2(H),presets:H.map(Z=>Z.hex),commitMode:"close",align:"end",label:"Add colour",onChange:B,children:o.jsx(mr,{size:10})}),children:Z=>o.jsx("div",{className:"sc-arow",children:(Z==="open"?D:D.slice(0,q4)).map(Q=>{const me=r.color.includes(Q.hex.toLowerCase());return o.jsxs("div",{className:"sc-aswatch-tile","data-on":me||void 0,children:[o.jsxs("button",{type:"button",title:`${Q.name} ${Q.hex}`,"aria-pressed":me,onClick:()=>me?l({t:"color",hex:Q.hex,name:Q.name}):i({t:"color",hex:Q.hex,name:Q.name}),children:[o.jsx("span",{className:"sc-aswatch",style:{background:Q.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 ${Q.name}`,title:"Remove",onClick:()=>V(Q.hex),children:o.jsx(Cn,{size:10,weight:"bold"})})]},Q.hex)})})}),I.length>0&&!L&&o.jsx(av,{name:"Recent shots",count:_,mode:M("shots"),onToggle:()=>E("shots"),children:Z=>o.jsxs("div",{className:Z==="open"?"sc-acard-grid":"sc-arow",children:[I.slice(0,Z==="open"?O:q4).map((Q,me)=>{const te=Q.images[0],he=r.ref.includes(te);return o.jsx(y$,{candidate:{label:`Shot ${_-me}`,full:`Shot ${_-me} · as reference`,thumb:mn(te,"micro")},on:he,named:Z==="open",disabled:!!a&&!he,title:a??void 0,onClick:()=>he?l({t:"ref",imageHash:te}):i({t:"ref",imageHash:te,label:"Shot"})},Q.id)}),Z==="open"&&(I.length>O||U.hasMore)&&o.jsxs("button",{type:"button",className:"sc-amore-tile",onClick:z,"aria-label":`Show ${G0} more shots`,"aria-busy":U.loading||void 0,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",Math.max(1,_-Math.min(I.length,O))]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})})]})}function Bue({sets:e,active:t,ungrouped:n,ungroupedCount:r,onPlaceAll:a,onPlaceUngrouped:i,onOpenSet:l,onNewSet:u,onResetNewSet:f,onRenameSet:h,onDeleteSet:p,askCreate:m,lens:g,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 R=t?t.id:n?"__ungrouped__":"__all__",P=t?t.name:n?"Not in a set":"All shots",H=!!t||n,D=Mr(aa),[B,V]=s.useState(!1),[K,U]=s.useState(!1),[I,_]=s.useState(!1),[O,Y]=s.useState(""),z=s.useRef(null),q=s.useRef(!1),Z=()=>{q.current=!0,U(!0),Y(""),V(!0)},Q=()=>{t&&(q.current=!1,U(!1),Y(t.name),V(!0))};s.useEffect(()=>{m&&Z()},[m]);const me=()=>{const ae=O.trim();if(!ae)return;const Me=q.current;q.current=!1,U(!1),V(!1),Me?u(ae):h==null||h(ae)},te=ae=>{if(ae){V(!0);return}const Me=q.current;q.current=!1,U(!1),V(!1),Me&&(f==null||f())},he=AN.map(ae=>({value:ae.id==="all"?null:ae.id,label:ae.label,count:w==null?void 0:w[ae.id]})),re=o.jsxs(o.Fragment,{children:[o.jsxs(Sp,{value:R,children:[o.jsx(Bu,{value:"__all__",onSelect:a,children:"All shots"}),o.jsxs(Bu,{value:"__ungrouped__",onSelect:i,children:["Not in a set",r>0?` · ${r}`:""]}),e.length>0&&o.jsx(bc,{}),e.map(ae=>o.jsx(Bu,{value:ae.id,onSelect:()=>l(ae),children:ae.name},ae.id))]}),o.jsx(bc,{}),o.jsx(qn,{onSelect:()=>{f==null||f(),Z()},children:"New set"}),t&&h&&o.jsx(qn,{onSelect:Q,children:"Rename"}),t&&p&&o.jsx(qn,{color:"red",onSelect:()=>_(!0),children:"Delete set"})]}),ee=o.jsx(Sp,{value:E,onValueChange:ae=>C(ae),children:jN.map(ae=>o.jsx(Bu,{value:ae.id,children:ae.label},ae.id))}),J=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(Ra,{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":P,children:[o.jsx(Nv,{className:"sc-toolbar-place-ic",size:16}),o.jsx("span",{className:"sc-toolbar-place-t",children:P}),o.jsx(wl,{size:10,className:"sc-caret"})]})}),o.jsx(As,{align:"start",children:re})]})]}),o.jsx(xw,{open:B,onOpenChange:te,children:o.jsxs(kw,{maxWidth:"360px","aria-describedby":void 0,onOpenAutoFocus:ae=>{ae.preventDefault();const Me=z.current;Me&&(Me.focus(),Me.select())},children:[o.jsx(Sw,{children:K?"Name this set":"Rename set"}),o.jsx("input",{ref:z,className:"sc-in",style:{width:"100%",marginTop:8},value:O,"aria-label":"Set name",onChange:ae=>Y(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&me()}}),o.jsxs(_s,{gap:"3",mt:"4",justify:"end",children:[o.jsx(ba,{variant:"soft",color:"gray",onClick:()=>te(!1),children:"Cancel"}),o.jsx(ba,{onClick:me,disabled:!O.trim(),children:"Save"})]})]})}),o.jsx(zf,{open:I,onOpenChange:_,children:o.jsxs(Bf,{maxWidth:"420px",children:[o.jsx(Uf,{children:"Delete this set?"}),o.jsx(Wf,{size:"2",children:"Shots stay in the library. Only the set goes."}),o.jsxs(_s,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Gf,{children:o.jsx(ba,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Kf,{children:o.jsx(ba,{color:"red",onClick:()=>{p==null||p(),_(!1)},children:"Delete set"})})]})]})}),o.jsx(ky,{"aria-label":"Shot lenses",activeKey:g==="all"?null:g,items:he,onSelect:ae=>y(ae??"all")})]}),o.jsxs("div",{className:"sc-toolbar-actions",children:[o.jsx(Id,{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":J||void 0,"aria-label":`Set and sort: ${P}`,children:[o.jsx(Mv,{size:15}),J&&o.jsx("span",{className:"sc-toolbar-view-dot","aria-hidden":!0})]})}),o.jsxs(As,{align:"end",children:[o.jsx(a4,{children:"Set"}),re,o.jsx(bc,{}),o.jsx(a4,{children:"Sort"}),ee]})]}):o.jsxs(Cs,{children:[o.jsx(js,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-btn","aria-label":"Sort shots",children:[o.jsx(FI,{size:14}),o.jsx("span",{className:"sc-toolbar-btn-t",children:"Sort"}),o.jsx(wl,{size:10})]})}),o.jsx(As,{align:"end",children:ee})]}),o.jsx(PX,{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(cF,{size:15,mirrored:!0})})]})]})}function Uue(e){const{push:t}=rr(),n=s.useCallback(l=>Ae.archiveNode(l.id,!0).then(u=>(e(u),t({kind:"success",title:"Archived",detail:Hr(l),action:{label:"Undo",onClick:()=>void Ae.archiveNode(l.id,!1).then(e)}}),!0)).catch(u=>(t(on(u,"Could not archive this shot")),!1)),[e,t]),r=s.useCallback(l=>Ae.archiveNode(l.id,!1).then(u=>(e(u),!0)).catch(u=>(t(on(u,"Could not restore this shot")),!1)),[e,t]),a=s.useCallback(l=>Promise.all(l.map(u=>Ae.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=>Ae.archiveNode(f.id,!1))).then(f=>{for(const h of f)e(h)})}}}),!0}).catch(u=>(t(on(u,"Could not archive these shots")),!1)),[e,t]),i=s.useCallback(l=>Promise.all(l.map(u=>Ae.archiveNode(u,!1))).then(u=>{for(const f of u)e(f);return!0}).catch(u=>(t(on(u,"Could not restore these shots")),!1)),[e,t]);return{archive:n,archiveBatch:a,unarchive:r,unarchiveBatch:i}}function Wue(e){const{push:t}=rr(),n=s.useCallback(a=>Ae.deleteNode(a.id).then(()=>e([a.id])).catch(i=>t(on(i,"Could not delete this shot"))),[e,t]),r=s.useCallback(a=>Ae.deleteNodesBatch(a).then(()=>e(a)).catch(i=>t(on(i,"Could not delete these shots"))),[e,t]);return{remove:n,removeBatch:r}}function Kue(e,{demoProducts:t,presenters:n,scenes:r}){var f,h,p,m;const a=((f=e.brief)==null?void 0:f.tokens)??[],i=(h=a.find(g=>(g==null?void 0:g.t)==="product"))==null?void 0:h.id,l=(p=a.find(g=>(g==null?void 0:g.t)==="character"))==null?void 0:p.id,u=(m=a.find(g=>(g==null?void 0:g.t)==="template"))==null?void 0:m.id;return{product:i?t.find(g=>g.id===i):void 0,presenter:l?n.find(g=>g.id===l):void 0,scene:u?r.find(g=>g.id===u):void 0}}function Gue(e,t){const{product:n,presenter:r,scene:a}=Kue(e,t);return{productName:n?Ho(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?yi(r).src:null,presenterId:(r==null?void 0:r.id)??null,sceneName:a?kl(a,"chip"):null,scenePreviewUrl:(a==null?void 0:a.previewUrl)??null,sceneId:(a==null?void 0:a.id)??null}}function Yue(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 m=n.current;i(),m<=0&&n.current>0&&(h.scrollLeft=n.current)});p.observe(h);for(const m of h.children)p.observe(m);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 m=()=>{p||(p=requestAnimationFrame(()=>{p=0,l()}))},g=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",m,{passive:!0}),h.addEventListener("wheel",g,{passive:!1}),h.addEventListener("pointerdown",w),()=>{p&&cancelAnimationFrame(p),u(),h.removeEventListener("scroll",m),h.removeEventListener("wheel",g),h.removeEventListener("pointerdown",w)}},[u,l]);const f=s.useCallback(h=>{const p=t.current,m=p==null?void 0:p.firstElementChild;if(!p||!m)return;const g=m.offsetWidth||232,w=Number.parseFloat(getComputedStyle(p).columnGap)||0,y=g+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 que(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 Xue({entries:e,catalogs:t,stagedId:n,onUse:r,productHref:a,presenterHref:i,sceneHref:l}){const u=s.useMemo(()=>que(e).slice(0,10),[e]),{ref:f,page:h}=Yue(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(Ra,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-shelf-arrow next","aria-label":"More examples",onClick:()=>h(1),children:o.jsx(Cl,{size:13,weight:"bold"})}),o.jsx("div",{className:"sc-shelf-row",ref:f,children:[0,1,2].map(p=>u.map(m=>o.jsx(dL,{entry:m,size:"grid",hideRecipe:!0,decorative:p!==1,active:n===m.id,onOpen:()=>r(m),productHref:a,presenterHref:i,sceneHref:l,...Gue(m,t)},`${p}-${m.id}`)))})]})]})}function A0({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 Que({count:e,sets:t,activeSet:n,onAdd:r,onRemove:a,onNew:i,onClear:l,onKeep:u,onArchiveBatch:f,allKept:h,archivedLens:p,pickedIds:m,onRestoreBatch:g,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($u,{label:"Restore",onClick:()=>g(m),children:o.jsx(J0,{size:17})}),o.jsx($u,{label:`Delete ${e} permanently`,tone:"danger",onClick:()=>S(!0),children:o.jsx(jl,{size:17})})]}):o.jsxs(o.Fragment,{children:[o.jsx($u,{label:h?"Remove from keepers":"Keep",onClick:u,children:o.jsx(Qa,{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(Nv,{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(bc,{}),o.jsx(qn,{onSelect:i,children:"New set…"})]})]}),n&&a&&o.jsx($u,{label:v$(e,n.name),onClick:a,children:o.jsx(gE,{size:17})}),o.jsx($u,{label:"Archive",tone:"danger",onClick:()=>f(m),children:o.jsx(um,{size:17})})]})}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-exit",children:o.jsx($u,{label:"Done",onClick:l,children:o.jsx(Cn,{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(m)})]})}function $u({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 Jue(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 ede(e){switch(e){case"oldest":return(t,n)=>Uu(n,t);case"cost":return(t,n)=>n.costUsd-t.costUsd||Uu(t,n);case"keepers":return(t,n)=>Number(n.kept)-Number(t.kept)||Uu(t,n);default:return Uu}}function b$(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 tde(e,t){return t==="archived"?e.archived:t==="keepers"?!e.archived&&e.kept:!e.archived}function T9(e,t,n){var r;return(r=t.q)!=null&&r.trim()?null:b$(e,t,n)&&tde(e,t.lens)}function D9(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 x6(e,t,n,r){if(!r)return e;const a=D9(t),i=D9(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 nde(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}function ov(e,t){const n=e.findIndex(a=>a.id===t.id);if(n===-1||nde(e[n],t))return e;const r=[...e];return r[n]=t,r}function H9(e,t){const n=new Set(t);return e.some(r=>n.has(r.id))?e.filter(r=>!n.has(r.id)):e}function rde(e,t,n,r){if(e.some(u=>u.id===t.id))return ov(e,t);const a=ede(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 sde(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 ade(e,t){const n=new Set(t.map(r=>r.id));return[...t,...e.filter(r=>!n.has(r.id))]}const k6=60;function ode(e,t,n){const{shotsEpoch:r}=cn(),a=`${Jue(e,t)}#${r}`,[i,l]=s.useState(()=>{const M=US(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),m=s.useRef(i);m.current=i;const g=s.useRef(t);g.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=US(a);return j&&m.current.key!==a&&l({...j,error:null}),Ae.feed(e,{...g.current,limit:k6},M.signal).then(R=>{M.signal.aborted||l({brandId:e,key:a,items:R.items,next:R.next,counts:R.counts??null,error:null})}).catch(R=>{if(M.signal.aborted)return;const P=String((R==null?void 0:R.message)??R);l(H=>H.key===a?{...H,error:P}:{brandId:e,key:a,items:[],next:null,counts:null,error:P})}).finally(()=>{M.signal.aborted||p(!1)}),()=>M.abort()},[e,a,u]),s.useEffect(()=>{i.key&&!i.error&&tie(i)},[i]);const b=s.useCallback(()=>f(M=>M+1),[]),k=s.useCallback(()=>{const M=m.current;if(M.key!==a||!M.next||y.current)return;y.current=!0,p(!0);const j=M.next;Ae.feed(e,{...g.current,limit:k6,cursor:j}).then(R=>{l(P=>P.key!==a?P:{...P,items:sde(P.items,R.items),next:R.next,counts:R.counts??P.counts})}).catch(()=>{}).finally(()=>{y.current=!1,p(!1)})},[e,a]),S=s.useCallback(async()=>{const M=await Ae.feed(e,{...g.current,limit:k6});l(j=>j.key!==a?j:{...j,items:ade(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 R=j.items.find(V=>V.id===M.id);if(!R)return j;const P=g.current,D=T9(M,P,w.current)===!1?H9(j.items,[M.id]):ov(j.items,M),B=j.counts?x6(j.counts,R,M,!0):j.counts;return D===j.items&&B===j.counts?j:{...j,items:D,counts:B}})},[]),C=s.useCallback((M,j)=>{let R=!1;l(P=>{let H=P.items,D=P.counts;const B=g.current;for(const V of M){if(H.some(_=>_.id===V.id)){H=ov(H,V);continue}const K=T9(V,B,w.current);if(K===null){R=!0;continue}const U=b$(V,B,w.current);K&&(H=rde(H,V,B.sort,P.next===null));const I=(j==null?void 0:j.get(V.id))??null;D&&(D=x6(D,I,V,U))}return H===P.items&&D===P.counts?P:{...P,items:H,counts:D}}),R&&S().catch(()=>{})},[S]),A=s.useCallback(M=>{l(j=>{const R=j.items.filter(H=>M.includes(H.id));if(!R.length)return j;let P=j.counts;if(P)for(const H of R)P=x6(P,H,null,!0);return{...j,items:H9(j.items,M),counts:P}})},[]),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 ide(){const e=pn(pt.hubShot),t=pn(pt.setShot);return(e==null?void 0:e.params.shotId)??(t==null?void 0:t.params.shotId)??null}function O9(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 Ae.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 x$({set:e}){const{engines:t,scenes:n,presenters:r,demoProducts:a,showcase:i,showcaseLoaded:l}=$n(),{brand:u,workspace:f,root:h,recent:p,sets:m,membership:g,loaded:w,refresh:y,applySet:b,dropSet:k,insertSet:S,applyMembership:E,applyNodes:C,subscribeActivity:A,products:L}=cn(),T=n,M=u1(),j=Bn(),[R,P]=El(),H=ide(),[D,B]=s.useState(null),[V,K]=s.useState(!1);s.useEffect(()=>{const le=()=>K(!0);return window.addEventListener("scenri:shortcuts",le),()=>window.removeEventListener("scenri:shortcuts",le)},[]);const{open:U,toggle:I,setOpen:_}=gse(),O=Mr("(min-width: 1280px)"),Y=O&&U,[z,q]=s.useState(null),[Z,Q]=s.useState(cL),[me,te]=s.useState(null),[he,re]=s.useState(null),ee=s.useRef(!1);s.useEffect(()=>{if(!ee.current||H)return;ee.current=!1;const le=requestAnimationFrame(()=>{var Te;return(Te=Qe.current)==null?void 0:Te.focus()});return()=>cancelAnimationFrame(le)},[H,he]);const[J,ae]=s.useState(null),[Me,ue]=s.useState(new Set),[Se,Be]=Oh("tab","all"),[vt,Ue]=Oh("in",""),[Xe,De]=Oh("branch",""),[G,oe]=Oh("lineage",""),[We,Oe]=ja(qr.tileSize,FM),ie=_M(We),{q:X,setQ:se,clearSearch:Re}=d1([]),[_e,Ye]=ja(qr.feedSort,"newest"),ge=OG(_e)?_e:"newest",Qe=s.useRef(null),{push:at}=rr(),{poke:wt}=sa(),[Et,ot]=s.useState(null),It=(f==null?void 0:f.id)??"",Mt=e?P0(u,e):Er(u),Zt=s.useCallback(le=>{const Te=R.toString();return`${Mt}/shots/${le}${Te?`?${Te}`:""}`},[Mt,R]),Rt=s.useCallback((le,Te=!1)=>j(Zt(le),{replace:Te}),[j,Zt]),Tt=s.useCallback(()=>{const le=new URLSearchParams(R);le.delete("panel");const Te=le.toString();j(`${Mt}${Te?`?${Te}`:""}`,{replace:!0})},[Mt,j,R]),Ee=IG(Se)?Se:"all",Je=!e&&vt==="ungrouped";s.useEffect(()=>{Se==="ungrouped"&&(Be(null),Ue("ungrouped"))},[Se,Be,Ue]);const St=s.useMemo(()=>{const le=new Map;for(const Te of m)for(const lt of g[Te.id]??[])le.has(lt)||le.set(lt,[]),le.get(lt).push(Te);return le},[m,g]),qe=s.useMemo(()=>({lens:Ee,set:e==null?void 0:e.id,ungrouped:Je||void 0,lineage:G||void 0,q:X.trim()||void 0,sort:ge}),[Ee,e==null?void 0:e.id,Je,G,X,ge]),st=s.useRef(g);st.current=g;const rt=s.useRef(St);rt.current=St;const Xt=s.useRef(new Set),Gt=s.useMemo(()=>({inSet:le=>e?(st.current[e.id]??[]).includes(le):!1,inAnySet:le=>rt.current.has(le),inLineage:le=>le.id===G||le.parentId!==null&&Xt.current.has(le.parentId)}),[e==null?void 0:e.id,G]),sn=ode(u.id,qe,Gt),{items:Ut,byId:An,counts:Bt}=sn,ne=s.useRef(sn);ne.current=sn,Xt.current=s.useMemo(()=>new Set(Ut.map(le=>le.id)),[Ut]);const ce=s.useRef(new Map);s.useEffect(()=>{for(const le of Ut)ce.current.set(le.id,le)},[Ut]);const de=s.useRef(null),[Ve,Ie]=s.useState("");s.useEffect(()=>A(le=>{const{messages:Te,next:lt}=wue(de.current??new Map,le),Wt=de.current===null;if(de.current=lt,!Wt&&Te.length){const bn=Te.join(" ");Ie(Ur=>Ur===bn?`${bn} `:bn)}const ln=ne.current;let _n=!1;const On=[],Rn=new Map;for(const bn of le){if(ln.byId.has(bn.id))ln.patch(bn);else if(ce.current.has(bn.id)){const Ur=ce.current.get(bn.id);Ur&&Rn.set(bn.id,Ur),On.push(bn)}else bn.kind!=="root"&&(_n=!0);ce.current.set(bn.id,bn)}On.length&&ln.insert(On,Rn),_n&&ln.ready&&ln.refresh().catch(()=>{})}),[A]);const mt=w&&sn.ready,bt=O9(G||null,An);s.useEffect(()=>{!G||!bt.missing||(oe(null),at({kind:"info",title:"That shot is no longer available",detail:"Showing everything instead."}))},[G,bt.missing,oe,at]);const kt=s.useMemo(()=>{var Wt,ln;const le=L.length?L:((Wt=u.json)==null?void 0:Wt.products)??[],Te=((ln=u.json)==null?void 0:ln.characters)??[],lt=M.scenes;return{product:_n=>{const On=le.find(Rn=>Rn.id===_n)??a.find(Rn=>Rn.id===_n);return On?Ho(On,"chip"):null},person:_n=>{var On,Rn;return((On=Te.find(bn=>bn.id===_n))==null?void 0:On.name)??((Rn=r.find(bn=>bn.id===_n))==null?void 0:Rn.name)??null},scene:_n=>{const On=lt.find(Rn=>Rn.id===_n);return On?kl(On,"chip"):null}}},[L,a,u,r,M.scenes]),nt=s.useMemo(()=>{const le=D?An.get(D):void 0;return le||(Ut.find(Te=>Te.status!=="error")??Ut[0]??null)},[An,Ut,D]),yt=O9(Xe||null,An),Ce=s.useMemo(()=>{const le=yt.node;return!le||le.kind==="root"?null:le.status==="running"||le.status==="done"&&le.images.length>0?le:null},[yt.node]),xe=(Ce==null?void 0:Ce.images[0])??null,et=s.useCallback(()=>De(null),[De]),Ct=s.useRef(null),ke=s.useCallback((...le)=>{if(Ct.current){for(const lt of le)Ct.current.add(lt);return}const Te=new Set(le);Ct.current=Te,queueMicrotask(()=>{Ct.current=null,P(lt=>{const Wt=new URLSearchParams(lt);for(const ln of Te)Wt.delete(ln);return Wt},{replace:!0})})},[P]),it=s.useCallback(()=>ke("scene","setup","presenter","product","ref","view","fresh"),[ke]);s.useEffect(()=>{!Xe||!mt||(yt.node&&!Ce?(et(),at({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})):yt.missing&&(et(),at({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})))},[Xe,yt.node,yt.missing,Ce,mt,et,at]);const ft=s.useCallback(le=>{var Te;De(le),(Te=Qe.current)==null||Te.focus()},[De]),$e=le=>B(le),Ke=le=>H||/\/shots\//.test(window.location.pathname)?Rt(le,!0):$e(le),Pt=s.useCallback(le=>{for(const Te of le)ce.current.set(Te.id,Te);ne.current.insert(le),C(le),wt()},[C,wt]),Yt=s.useCallback(async()=>{try{await y(),await ne.current.refresh(),q(null)}catch(le){q(String(le.message??le))}},[y]),jt=s.useCallback(le=>C([le]),[C]),{archive:Ft,archiveBatch:Ne,unarchive:Fe,unarchiveBatch:tt}=Uue(jt),F=s.useCallback(le=>ne.current.drop(le),[]),{remove:fe,removeBatch:ye}=Wue(F);s.useEffect(()=>{H&&B(H)},[H]);const Ze=s.useRef(new Set),Pe=async le=>{var Te,lt;if(le.status==="running")return le.id;if(Ze.current.has(le.id))return null;if(le.status==="error"||le.status==="cancelled"){Ze.current.add(le.id);try{const Wt=await Ae.retryNode(le.id);return C([Wt]),wt(),Wt.id}catch(Wt){return at(on(Wt,"Could not run this again")),null}finally{Ze.current.delete(le.id)}}Ze.current.add(le.id);try{const Wt=await Ae.node(le.id),ln=await Ae.addNode({projectId:It,parentId:le.parentId,kind:le.kind==="edit"?"edit":"generation",prompt:Wt.prompt,engineId:le.engineId,count:1,brief:le.brief,...le.kind==="edit"&&((Te=le.brief)!=null&&Te.sourceImage)?{sourceImage:le.brief.sourceImage}:{}});return Pt((lt=ln.siblings)!=null&&lt.length?ln.siblings:[ln]),(ln==null?void 0:ln.id)??null}catch(Wt){return at(on(Wt,"Could not run this again")),null}finally{Ze.current.delete(le.id)}},ct=async le=>{try{await Ae.cancelNode(le.id),C([{...le,status:"cancelled"}]),wt()}catch(Te){at(on(Te,"Could not cancel this shot"))}},Ot=s.useCallback(le=>{var Te,lt,Wt;le!=null&&le.scene&&((Te=Qe.current)==null||Te.applyScene(le.scene)),le!=null&&le.scenesPanel&&((lt=Qe.current)==null||lt.openAttach("Scenes")),(Wt=Qe.current)==null||Wt.focus()},[]);s.useEffect(()=>{var Te;if(R.get("compose")===null)return;const le=R.get("attach")==="all";Ot(),le&&((Te=Qe.current)==null||Te.showAttach()),ke("compose",...le?["attach"]:[])},[R,Ot,ke]);const _t=R.get("showcase"),Lt=s.useRef(null);s.useEffect(()=>{if(!_t||!l||Lt.current===_t)return;Lt.current=_t;const le=i.find(Te=>Te.id===_t);le?(re(B4(le)),at({kind:"info",title:`Starting from "${le.title}"`})):at({kind:"info",title:"That example is no longer available",detail:"Starting from scratch instead."}),P(Te=>{const lt=new URLSearchParams(Te);return lt.delete("showcase"),lt},{replace:!0})},[_t,l,i,P,at]);const vn=async(le,Te=!le.kept)=>{C([{...le,kept:Te}]);try{C([await Ae.keep(le.id,Te)])}catch(lt){C([le]),at(on(lt,"Could not update keeper status"))}},qt=s.useMemo(()=>[...Me].map(le=>An.get(le)).filter(le=>!!le),[An,Me]),Nn=async()=>{const le=!(qt.length>0&&qt.every(lt=>lt.kept)),Te=qt.filter(lt=>lt.kept!==le);C(Te.map(lt=>({...lt,kept:le})));try{C(await Promise.all(Te.map(lt=>Ae.keep(lt.id,le))))}catch(lt){C(Te),at(on(lt,"Could not update keeper status"))}},Qn=le=>{const Te=le.map(lt=>An.get(lt)).filter(lt=>!!lt&&!lt.archived);Te.length&&C(Te.map(lt=>({...lt,archived:!0}))),ue(new Set),Ne(le).then(lt=>{lt||C(Te)})},un=le=>{const Te=le.map(lt=>An.get(lt)).filter(lt=>!!lt&&lt.archived);Te.length&&C(Te.map(lt=>({...lt,archived:!1}))),ue(new Set),tt(le).then(lt=>{lt||C(Te)})},Jn=s.useCallback((le,Te)=>{st.current={...st.current,[le]:Te},E(le,Te)},[E]),tn=async le=>{try{const Te=await Ae.addToSet(le.id,[...Me]);Jn(le.id,Te.nodeIds),ue(new Set),(e||Je)&&ne.current.refresh()}catch(Te){at(on(Te,"Could not add to the set"))}},gr=async(le,Te)=>{const lt=st.current[le.id]??[],Wt=lt.filter(ln=>!Te.includes(ln));Jn(le.id,Wt),ue(ln=>{if(!Te.some(On=>ln.has(On)))return ln;const _n=new Set(ln);for(const On of Te)_n.delete(On);return _n}),(e==null?void 0:e.id)===le.id&&ne.current.drop(Te);try{const ln=await Ae.removeFromSet(le.id,Te);Jn(le.id,ln.nodeIds),Je&&ne.current.refresh()}catch(ln){Jn(le.id,lt),((e==null?void 0:e.id)===le.id||Je)&&ne.current.refresh(),at(on(ln,"Could not remove from the set"))}},Or=le=>gr(le,[...Me]),wn=(le,Te)=>gr(Te,[le.id]),oa=s.useRef([]),[Tn,ia]=s.useState(!1);s.useEffect(()=>{Tn&&ia(!1)},[Tn]);const Ws=async(le,Te)=>{const lt=Te.trim();if(lt)try{const Wt=await Ae.createSet(u.id,lt);if(S(Wt),le.length>0){const ln=await Ae.addToSet(Wt.id,le);Jn(Wt.id,ln.nodeIds)}ue(new Set),j(P0(u,Wt))}catch(Wt){at(on(Wt,"Could not create the set"))}},an=()=>{const le=oa.current;return oa.current=[],le},yn=async le=>{if(!e)return;const Te=le.trim();if(!(!Te||Te===e.name))try{const lt=await Ae.renameSet(e.id,Te);b(lt),j(P0(u,lt),{replace:!0}),y()}catch(lt){at(on(lt,"Could not rename the set"))}},Wn=async()=>{if(e)try{await Ae.deleteSet(e.id),k(e.id),j(Er(u),{replace:!0}),y()}catch(le){at(on(le,"Could not delete the set"))}},wr=async le=>{var bn;const Te=((bn=/\/shots\/([^/?#]+)/.exec(window.location.pathname))==null?void 0:bn[1])??null,lt=Te?An.get(Te)??null:nt;if(!lt)return;if(le==="left"||le==="right"){const{prev:Ur,next:Vl}=u4(Ut,lt.id),fo=le==="left"?Ur:Vl;fo&&Ke(fo.id);return}const Wt=await Ae.lineage(lt.id).catch(()=>null);if(!Wt)return;const ln=Wt.history??[...Wt.ancestors,lt,...Wt.children.slice(0,1)],{prev:_n,next:On}=u4(ln.filter(Ur=>Ur.id===lt.id||Ur.images[0]),lt.id),Rn=le==="up"?_n:On;Rn&&Ke(Rn.id)};s.useEffect(()=>{const le=Te=>{var On,Rn;if(Te.defaultPrevented)return;const lt=document.activeElement,Wt=((lt==null?void 0:lt.tagName)??"").toUpperCase(),ln=Wt==="INPUT"||Wt==="TEXTAREA"||Wt==="SELECT"||!!(lt!=null&&lt.closest('[contenteditable="true"]'))||!!(lt!=null&&lt.closest('[role="separator"]')),_n=!!(lt!=null&&lt.closest('button, a[href], [role="button"], [role="tab"], [role="menuitem"]'));if(Te.key==="Enter"&&(Te.metaKey||Te.ctrlKey)){if(H||lde(lt))return;(On=Qe.current)==null||On.submit(),Te.preventDefault();return}if(!ln){if(Te.key==="?"){K(!0),Te.preventDefault();return}if(Te.key==="/"&&!H){(Rn=Qe.current)==null||Rn.focus(),Te.preventDefault();return}if(Te.key==="Escape"&&V){K(!1),Te.preventDefault();return}if(Te.key==="Escape"&&H){Tt(),Te.preventDefault();return}if(Te.key==="Escape"&&Me.size>0){ue(new Set),Te.preventDefault();return}if(Te.key==="Escape"&&Xe){et(),Te.preventDefault();return}if(nt){if(Te.key==="b"&&nt.kind!=="root"&&nt.status==="done"&&nt.images.length>0){ft(nt.id),Te.preventDefault();return}if(Te.key==="k"&&nt.kind!=="root"&&nt.status==="done"){vn(nt),Te.preventDefault();return}Te.key==="ArrowLeft"?(wr("left"),Te.preventDefault()):Te.key==="ArrowRight"?(wr("right"),Te.preventDefault()):Te.key==="ArrowUp"?(wr("up"),Te.preventDefault()):Te.key==="ArrowDown"?(wr("down"),Te.preventDefault()):Te.key==="Enter"&&!H&&nt.kind!=="root"&&!_n?Rt(nt.id):Te.key==="."&&!H&&O&&I()}}};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[nt,H,V,Me.size,Xe,ft,De,h,O]);const hr=le=>ue(Te=>{const lt=new Set(Te);return lt.delete(le)||lt.add(le),lt}),Mn=mt&&Bt!==null&&Bt.total===0,ps=Y||Mn&&O,lo=Mn?o.jsx(Xue,{entries:i,catalogs:{demoProducts:a,presenters:r,scenes:T},stagedId:J,productHref:le=>xa(u,le),presenterHref:le=>Aa(u,le),sceneHref:le=>zr(u,le),onUse:le=>{ae(le.id),re(B4(le))}}):X.trim()?o.jsx(A0,{text:`No shots match “${X.trim()}”.`,onAll:Re,actionLabel:"Clear search"}):Ee==="keepers"?o.jsx(A0,{text:"No keepers yet. Star a shot and it lands here.",onAll:()=>Be(null)}):Ee==="archived"?o.jsx(A0,{text:"Nothing archived.",onAll:()=>Be(null)}):e?o.jsx(A0,{text:"Nothing in this set yet. Pick shots on All, then add them here."}):Je?o.jsx(A0,{text:"Every shot is already in a set.",onAll:()=>Ue(null)}):null,co=s.useRef(0);!X.trim()&&Bt&&(co.current=Bt[Ee]);const[yr,Mi]=ja(qr.feedCounts,null);s.useEffect(()=>{if(!Bt)return;const le={brandId:u.id,all:Bt.all,keepers:Bt.keepers,archived:Bt.archived};Mi(Te=>Te&&Te.brandId===le.brandId&&Te.all===le.all&&Te.keepers===le.keepers&&Te.archived===le.archived?Te:le)},[u.id,Bt,Mi]);const Ta=s.useMemo(()=>Bt?{all:Bt.all,keepers:Bt.keepers,archived:Bt.archived}:(yr==null?void 0:yr.brandId)===u.id?{all:yr.all,keepers:yr.keepers,archived:yr.archived}:null,[Bt,yr,u.id]),uo={byId:An,items:Ut,loadMore:sn.loadMore,complete:sn.complete,rootId:h,recent:p,loaded:mt,setsFor:le=>St.get(le)??[],brand:u,engines:t,projectId:It,close:Tt,select:Ke,retry:le=>{Pe(le).then(Te=>{Te&&Ke(Te)})},cancel:le=>void ct(le),keep:le=>void vn(le),reload:Yt,remix:le=>{var _n;const Te=(_n=le.brief)==null?void 0:_n.tokens,lt=le.prompt??le.promptHead,Wt=Te!=null&&Te.length||!lt?le.brief:{...le.brief,tokens:[{t:"text",v:lt}]},ln=Wt!=null&&Wt.tokens?{...Wt,tokens:sp(u,Wt.tokens)}:Wt;re({...ln,_at:Date.now()}),ln&&Pw(u.id,{tokens:ry(ln),tplFields:ln.templateFields??{}}),Tt(),at({kind:"info",title:"Starting from this shot",detail:"Its prompt, chips and settings are in the composer. Change anything, then Generate."}),ee.current=!0},branch:le=>{ft(le.id),Tt()},archive:le=>Ft(le).then(Te=>{Te&&Tt()}),unarchive:le=>Fe(le).then(()=>{}),delete:le=>void fe(le).then(()=>Tt()),landed:Pt,refined:(le,Te)=>{Te==="edit"&&De(le)},subscribeActivity:A,tokenNames:kt};return o.jsxs("div",{className:"sc-work","data-assets":ps,children:[o.jsxs("main",{className:"sc-canvas",id:"main","data-page-scroll":"","data-firstrun":Mn||void 0,onClick:le=>{if(Me.size===0&&!D)return;const Te=le.target;Te.closest(".sc-cell")||Te.closest("button, a, input, select, textarea, label, [role], [contenteditable]")||(ue(new Set),B(null))},children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:Ve}),(z||sn.error)&&o.jsx("div",{className:"sc-canvas-alert",children:o.jsx(Mw,{failure:io(z??sn.error??""),action:sn.error&&!z?o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:sn.retry,children:"Try again"}):void 0})}),(!Mn||e)&&o.jsx(Bue,{sets:m,active:e,ungrouped:Je,ungroupedCount:(Bt==null?void 0:Bt.ungrouped)??0,onPlaceAll:()=>e?j(Er(u)):Ue(null),onPlaceUngrouped:()=>e?j(`${Er(u)}?in=ungrouped`):Ue("ungrouped"),onOpenSet:le=>j(P0(u,le)),onNewSet:le=>void Ws(an(),le),onResetNewSet:()=>{oa.current=[]},onRenameSet:le=>void yn(le),onDeleteSet:()=>void Wn(),askCreate:Tn,lens:Ee,lensCounts:Ta,onLens:le=>Be(le==="all"?null:le),q:X,onQ:se,searchTotal:X.trim()?co.current:(Bt==null?void 0:Bt[Ee])??0,sort:ge,onSort:Ye,tile:ie,onTile:Oe,assets:Y,onAssets:I,showAssets:O}),G&&bt.node&&o.jsxs("div",{className:"sc-lineage-bar",children:[o.jsx("button",{type:"button",className:"sc-crumb-back",onClick:()=>oe(null),children:"All shots"}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("b",{dir:"auto",children:Hr(bt.node)}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("span",{className:"sc-crumb-here",children:"versions"})]}),o.jsx(Fue,{nodes:Ut,selectedId:D,onOpen:Rt,shotHref:Zt,onRetry:le=>void Pe(le),onCancel:le=>void ct(le),onToggleKeep:le=>void vn(le),onArchive:le=>le.archived?Fe(le):Ft(le),onDeletePermanently:fe,engineName:le=>{var Te;return(Te=t.find(lt=>lt.id===le))==null?void 0:Te.displayName},picked:Me,onPick:hr,sending:Et,onBranch:ft,branchingFrom:(Ce==null?void 0:Ce.id)??null,onVersions:oe,tile:ie,empty:mt?lo:null,pending:!mt&&!sn.error,onNearEnd:sn.complete?void 0:sn.loadMore,inSet:e,setsFor:le=>St.get(le)??[],onRemoveFromSet:(le,Te)=>void wn(le,Te),onKeepPicked:()=>void Nn(),onArchivePicked:()=>Qn([...Me]),onRestorePicked:()=>un([...Me]),onDeletePicked:()=>void ye([...Me]).then(()=>ue(new Set)),onRemovePickedFromSet:le=>void Or(le)})]}),ps&&o.jsx("div",{className:"sc-assets-backdrop",onClick:()=>_(!1),"aria-hidden":!0}),o.jsx(bue,{open:V,onOpenChange:K}),O&&o.jsx(zue,{brand:u,shots:p,shotsTotal:(Ta==null?void 0:Ta.all)??0,attached:Z,full:me,onToken:le=>{var Te;return(Te=Qe.current)==null?void 0:Te.insertToken(le)},offToken:le=>{var Te;return(Te=Qe.current)==null?void 0:Te.removeToken(le)},onTemplate:le=>{var Te;return(Te=Qe.current)==null?void 0:Te.applyScene(le)},offTemplate:()=>{var le;return(le=Qe.current)==null?void 0:le.removeTemplate()},onClose:()=>_(!1)}),o.jsxs(uL,{full:!ps,children:[o.jsx(Ny,{}),Me.size>0&&o.jsx(Que,{count:Me.size,sets:m,activeSet:e,onAdd:le=>void tn(le),onRemove:e?()=>void Or(e):void 0,onNew:()=>{oa.current=[...Me],ia(!0)},onClear:()=>ue(new Set),onKeep:()=>void Nn(),onArchiveBatch:le=>Qn(le),allKept:qt.length>0&&qt.every(le=>le.kept),archivedLens:Ee==="archived",pickedIds:[...Me],onRestoreBatch:le=>un(le),onDeleteBatch:le=>void ye(le).then(()=>ue(new Set)),loaded:Ut.length,onSelectAll:()=>ue(new Set(Ut.map(le=>le.id)))}),o.jsx(jy,{ref:Qe,projectId:It||null,brand:u,engines:t,parentId:h,initialBrief:he,suppressDraftRestore:_t!==null,startScene:R.get("scene")??void 0,startSetup:R.get("setup")??void 0,startPresenter:R.get("presenter")??void 0,startProduct:R.get("product")??void 0,startRef:R.get("ref")??void 0,startView:R.get("view")??void 0,startFresh:R.get("fresh")==="1",onSeedsSpent:it,openAttachTab:R.get("attach")==="scenes"?"Scenes":R.get("attach")==="products"?"Products":void 0,target:Ce,onClearTarget:et,onRestoreBranchId:De,guided:!0,setSlug:(e==null?void 0:e.slug)??null,onSending:ot,onAttached:Q,onCeiling:te,sourceImage:xe??void 0,onQueued:(le,Te,lt,Wt)=>{re(null),P(Rn=>{const bn=new URLSearchParams(Rn);return bn.delete("scene"),bn.delete("attach"),bn.delete("presenter"),bn.delete("product"),bn},{replace:!0});const ln=()=>ot(null),_n=()=>{Te!=="edit"||!le||P(Rn=>{const bn=new URLSearchParams(Rn);return bn.set("branch",le),bn},{replace:!0})},On=()=>{Pt(Wt??[]),_n(),ln()};e&&le?Ae.addToSet(e.id,lt!=null&&lt.length?lt:[le]).then(Rn=>Jn(e.id,Rn.nodeIds)).catch(Rn=>at(on(Rn,"Could not add to the set"))).finally(On):On()}})]}),o.jsx(_c,{context:uo})]})}const I9='[aria-modal="true"], [role="alertdialog"], .rt-BaseDialogContent, .sc-newdlg-layer';function lde(e){return e!=null&&e.closest(I9)?!0:!!(e!=null&&e.closest("[data-radix-popper-content-wrapper]"))&&!!document.querySelector(I9)}const iv=new Map,cde=4e3;function ude(e){iv.set(e,performance.now())}function dde(e){const t=iv.get(e);if(t!==void 0&&performance.now()-t<cde)return t;iv.delete(e)}function fde(e){var t;return pi((t=e.brief)==null?void 0:t.format)}function hde(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 mde({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"&&S6.add(e.id);const[,f]=s.useState(0),h=s.useRef(null),[p,m]=s.useState(null),g=s.useCallback(()=>{S6.delete(e.id),f(S=>S+1)},[e.id]);if(s.useEffect(()=>{e.status!=="done"&&(Y0=null)},[e.status]),s.useEffect(()=>()=>{Y0=null},[]),e.kind==="root")return o.jsx(V0,{className:"sc-frame",p:"8",children:o.jsxs(_s,{direction:"column",align:"center",gap:"2",py:"6",children:[o.jsx(Rc,{className:"sc-display",size:"7",align:"center",children:"Blank canvas, full brand."}),o.jsx(Rc,{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":fde(e)},children:[o.jsx(Na,{since:Ka(e),from:gde(e.id)}),o.jsxs("div",{className:"sc-stage-wait-say",children:[o.jsx("span",{className:"sc-stage-wait-t",role:"timer","aria-label":`${Hw(Ka(e))}, ${Wm(Ka(e))} seconds`,children:$c(Ka(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"?KN():io(e.error,r);return o.jsx(IN,{failure:E,density:"stage",onRetry:t})}const w=e.status==="done"?e.images[0]:void 0,y=w?hde(e)??(i==null?void 0:i.size)??null:null,b=!!w&&!!y&&e.status==="done"&&S6.has(e.id)&&!ff(),k=w?o.jsxs(V0,{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(vde,{hash:w,alt:e.promptHead,imgRef:h,bare:b,onPainted:(S,E,C)=>{l({hash:S,size:[E,C]}),m(S),Y0=S}}),b&&o.jsx(Uy,{img:h,ready:p===w,onDone:g})]}):o.jsx(_s,{justify:"center",children:o.jsx(V0,{className:"sc-frame",style:{display:"inline-block",maxWidth:"100%"}})});return a?o.jsxs(qf,{children:[o.jsx(Xf,{children:k}),a]}):k}const S6=new Set;let Y0=null;function gde(e){const t=dde(e);return t!==void 0&&Y0?{src:Dr(Y0),at:t}:void 0}function vde({hash:e,alt:t,onPainted:n,imgRef:r,bare:a}){const[i,l]=s.useState(null),u=s.useRef(null),f=i===e,h=m=>{!(m!=null&&m.complete)||!m.naturalWidth||m.src!==new URL(Dr(e),location.href).href||u.current!==e&&(u.current=e,l(e),n==null||n(e,m.naturalWidth,m.naturalHeight))},p=u.current&&u.current!==e?Dr(u.current):mn(e,"tile");return o.jsxs(V0,{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:m=>{r&&(r.current=m),h(m)},src:Dr(e),alt:t,className:"sc-stage-img","data-ready":f||void 0,onLoad:m=>h(m.currentTarget)})]})}const wde=e=>((e==null?void 0:e.tokens)??[]).filter(t=>t&&typeof t.t=="string");function k$(e,t){return wde(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 lv=new Set;function S$({id:e}){return lv.add(e),null}function E$({id:e,src:t,active:n}){const r=s.useRef(null),[a,i]=s.useState(!1),[,l]=s.useState(0),u=s.useCallback(()=>{lv.delete(e),l(f=>f+1)},[e]);return!lv.has(e)||ff()?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(Uy,{img:r,ready:a,onDone:u})]})}const yde=e=>e===0?"Original":`Refinement ${e}`,bde=e=>e===0?"the original":`Refinement ${e}`,xde=(e,t)=>e.createdAt.localeCompare(t.createdAt)||e.id.localeCompare(t.id),kde=e=>e.status==="cancelled"?"Stopped":"Did not finish";function Sde(e,t,n){const r=new Set(e.map(g=>g.id)),a=new Map(n.map(g=>[g.id,g]));a.set(t.id,t);const i=[...a.values()].filter(g=>!r.has(g.id)&&g.parentId!==null&&r.has(g.parentId)),l=(i.length?[...e,...i].sort(xde):e).map(g=>a.get(g.id)??g),f=(l.some(g=>g.id===t.id)?l:[...l,t]).filter(g=>g.id===t.id||g.images[0]||g.status==="running"||g.parentId===t.id&&(g.status==="error"||g.status==="cancelled"));let h=0;const p=f.map(g=>{const w=g.images[0]?"ready":g.status==="running"?"pending":"failed";if(w==="failed"&&g.kind==="edit")return{node:g,index:-1,label:kde(g),from:null,state:w};const y=g.kind==="edit"?++h:0;return{node:g,index:y,label:yde(y),from:null,state:w}}),m=new Map(p.map((g,w)=>[g.node.id,w]));return p.map((g,w)=>{if(w===0||!g.node.parentId||g.node.parentId===p[w-1].node.id)return g;const y=m.get(g.node.parentId);return y===void 0||p[y].index<0?g:{...g,from:bde(p[y].index)}})}function Ede(e,t){var n;return((n=e.find(r=>r.state==="pending"&&r.node.parentId===t))==null?void 0:n.node)??null}function C$(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 Kh=28;function Cde({trail:e,activeId:t,names:n,onSelect:r}){var w;const a=s.useRef(null),i=s.useMemo(()=>e.map(y=>k$(y.node,n)),[e,n]),l=Od(),u=(y,b,k)=>l.open({key:y.node.id,src:mn(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+Kh?y.scrollLeft-=A.left+Kh-C.left:C.right>A.right-Kh&&(y.scrollLeft+=C.right-(A.right-Kh))};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()},m=e.some(y=>y.node.id===t)?t:(w=e[0])==null?void 0:w.node.id,g=C$(e,t);return o.jsxs("div",{className:"sc-trail",children:[g&&o.jsx("span",{className:"sc-trail-say",children:g}),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===m?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=>Ym(C.currentTarget)&&y.state==="ready"&&u(y,b,C.currentTarget),children:y.state==="ready"?o.jsx(E$,{id:k.id,src:mn(k.images[0],"micro"),active:S}):E?o.jsxs("span",{className:"sc-thumb sc-thumb-wait","data-active":S,children:[o.jsx(Na,{since:Ka(k)}),o.jsx(S$,{id:k.id})]}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":S,children:o.jsx(Vc,{size:14})})},k.id)})}),l.shown&&o.jsx(Hd,{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 jde=200,F9=32;function Ade({shots:e,activeId:t,onSelect:n,onEndReached:r,complete:a}){var y;const i=s.useRef(null),l=Od(),u=(b,k)=>l.open({key:b.id,src:mn(b.images[0],"tile"),label:Hr(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/F9).toFixed(3):"0"),k.style.setProperty("--sc-shotrail-end",S>1?Math.min(1,(S-E)/F9).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 m=()=>{p();const b=i.current;!b||a||b.scrollTop+b.clientHeight>=b.scrollHeight-jde&&r()},g=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:m,onKeyDown:g,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?`${Hr(b)}, still rendering`:Hr(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=>Ym(C.currentTarget)&&E&&u(b,C.currentTarget),children:E?o.jsx(E$,{id:b.id,src:mn(b.images[0],"micro"),active:k}):S?o.jsxs("span",{className:"sc-thumb sc-thumb-wait","data-active":k,children:[o.jsx(Na,{since:Ka(b)}),o.jsx(S$,{id:b.id})]}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":k,children:o.jsx(Vc,{size:14})})},b.id)})})}),l.shown&&o.jsx(Hd,{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 Nde=60;function Mde({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)<Nde||Math.abs(i)<2*Math.abs(l)||(i<0?e():t())},onPointerCancel:()=>{n.current=null}}}function Rde(e){const t=Bn(),n=Od(),{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),m=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=>Ym(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})}}),g=o.jsxs(o.Fragment,{children:[u&&o.jsx(Hd,{anchor:u.el,kind:u.kind,src:Ln(u.src,"tile"),label:u.label,onOpen:()=>{const w=u;f(),w.to?t(w.to):p({src:Ln(w.src,"full"),kind:w.kind,label:w.label})},onHoverIn:n.keep,onHoverOut:()=>!i&&n.close(),onClose:f},u.key),h&&o.jsx(Sd,{src:h.src,kind:h.kind,label:h.label,onClose:()=>p(null)})]});return{bind:m,isOpen:w=>(u==null?void 0:u.key)===w,surface:g}}function Pde({brief:e,prompt:t,brand:n,saidRef:r,expanded:a,clamped:i}){var T,M;const{scenes:l,presenters:u,demoProducts:f}=$n(),h=Rde(".sc-ingredient"),p=(e==null?void 0:e.tokens)??[],m=((T=n==null?void 0:n.json)==null?void 0:T.products)??[],g=((M=n==null?void 0:n.json)==null?void 0:M.characters)??[],w=qc(n),y=n1(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 R=w.find(H=>H.id===j.id);if(!(R!=null&&R.previewUrl)||cd(R.previewColor))continue;const P=`t${j.id}`;tL(R.previewUrl).then(H=>{const D=cd(H??void 0);D&&k(B=>B[P]?B:{...B,[P]:D})})}});const S={products:m,demoProducts:f,cast:g,presenters:u,scenes:[...w,...l]},E=j=>{var P,H;const R=YP(j,S);if((R==null?void 0:R.kind)==="product"){const{product:D,demo:B}=R;return{key:`p${j.id}`,kind:"product",label:(D==null?void 0:D.name)??(B==null?void 0:B.name)??"product",thumb:D?_m((H=(P=D==null?void 0:D.shots)==null?void 0:P[0])==null?void 0:H.file,"micro"):(B==null?void 0:B.previewUrl)??null,to:n&&(D||B)?xa(n,j.id):void 0}}if((R==null?void 0:R.kind)==="presenter"){const{character:D,presenter:B}=R,V=(B==null?void 0:B.id)??(D==null?void 0:D.presenterId)??((D==null?void 0:D.origin)==="custom"?D.id:void 0),K=D?Zw(D):B?yi(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:K.src,crop:K.crop,to:n&&V?Aa(n,V):void 0}}if((R==null?void 0:R.kind)==="scene"){const D=R.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:cd(D==null?void 0:D.previewColor),custom:R.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:mn(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?Gm(n==null?void 0:n.json,D):"brand mark",thumb:mn(j.imageHash,"micro"),previewHash:j.imageHash}}return null},C=j=>{const R=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]}),P=j.tint??(j.custom?b[j.key]:void 0),H=P?{"--tint":P}:void 0,D=(j.previewHash?mn(j.previewHash,"tile"):Ln(j.thumb,"tile"))??(j.to?"":null);if(D!==null&&dp(j.kind)){const B=j.kind,V=h.isOpen(j.key),K={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":P?"":void 0,style:H,title:V?void 0:`${j.label}. Preview.`,"aria-label":`${j.label}. Preview.`,...h.bind(K),children:R},j.key)}return o.jsx("span",{className:"sc-ingredient","data-kind":j.kind,"data-tinted":P?"":void 0,style:H,title:`${j.kind}: ${j.label}`,children:R},j.key)},A=[];for(const j of p){if(j.t==="text"){const P=j.v.trim();P&&A.push(P);continue}const R=E(j);R&&A.push(C(R))}if(!A.length&&!t)return null;const L=A.flatMap((j,R)=>R?[" ",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 Lde=256,ol=new Map;function cv(e,t){for(ol.delete(e),ol.set(e,t);ol.size>Lde;)ol.delete(ol.keys().next().value)}function j$(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 $de(e,t){cv(e,t);for(const n of t.history??[])n.id!==e&&cv(n.id,j$(t.history??[],n))}function _9(e){const t=e.parentId?ol.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)cv(a.id,j$(r,a))}function Tde(e){var i;const[t,n]=s.useState(()=>{const l=ol.get(e.id);return l?{id:e.id,lineage:l}:null});s.useEffect(()=>{let l=!0;return Ae.lineage(e.id).then(u=>{l&&($de(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:ol.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 Dde=32,il=new Map;function Hde(e){for(il.delete(e.id),il.set(e.id,e);il.size>Dde;)il.delete(il.keys().next().value)}function Ode(e){const[t,n]=s.useState(()=>il.get(e.id)??null);return s.useEffect(()=>{const r=il.get(e.id);if(r){n(r);return}let a=!0;return Ae.node(e.id).then(i=>{a&&(Hde(i),n(i))}).catch(()=>{}),()=>{a=!1}},[e.id]),(t==null?void 0:t.id)===e.id?t:il.get(e.id)??null}const Ide="(max-width: 1023px)",A$=380,N$=480,V9=380,Tu=e=>Math.min(N$,Math.max(A$,Math.round(e)));function Fde({node:e,rootId:t,items:n,loadMore:r,complete:a,brand:i,engines:l,projectId:u,onClose:f,onSelect:h,onRetry:p,onCancel:m,onKeep:g,onLanded:w,onRemix:y,onArchive:b,onUnarchive:k,onDelete:S,onRefined:E,subscribeActivity:C,tokenNames:A}){const{ancestors:L,children:T,history:M}=Tde(e),j=Ode(e),R=s.useMemo(()=>l.find(Ee=>Ee.id===e.engineId),[l,e.engineId]),{push:P}=rr(),[H,D]=ja(qr.ovlPanelW,V9),B=s.useRef(0),V=s.useRef(0),K=s.useRef(null),U=s.useMemo(()=>{var Ee;return(((Ee=e.brief)==null?void 0:Ee.tokens)??[]).some(Je=>(Je==null?void 0:Je.t)&&Je.t!=="text"&&Je.t!=="format")},[e.brief]),I=s.useMemo(()=>{const Ee=n1(i.json);return{...A,mark:Je=>{const St=Ee.find(qe=>qe.hash===Je);return St?Gm(i.json,St):null}}},[A,i]),_=s.useMemo(()=>k$(j??e,I),[j,e,I]),[O,Y]=s.useState(!1),[z,q]=s.useState(!1),[Z,Q]=s.useState(!1),[me,te]=s.useState(!1),[he,re]=s.useState(!1),[ee,J]=s.useState(!1);s.useEffect(()=>{Q(!1),J(!1),te(!1)},[e.id]),s.useEffect(()=>{if(!Z)return;const Ee=setTimeout(()=>Q(!1),1400);return()=>clearTimeout(Ee)},[Z]),s.useEffect(()=>{if(!ee)return;const Ee=setTimeout(()=>J(!1),1400);return()=>clearTimeout(Ee)},[ee]);const[ae,Me]=s.useState(null);Ay(ae,"--sc-ovl-dock-h");const ue=s.useRef(null),[Se,Be]=s.useState(!1),[vt,Ue]=s.useState(!1);s.useEffect(()=>Be(!1),[e.id]),s.useLayoutEffect(()=>{const Ee=ue.current;if(!Ee||Se)return;const Je=()=>Ue(Ee.scrollHeight>Ee.clientHeight+1);Je();const St=new ResizeObserver(Je);return St.observe(Ee),()=>St.disconnect()},[_,Se]);const[Xe,De]=s.useState([]);s.useEffect(()=>{if(!(!C||Xe.length===0))return C(Ee=>{const Je=new Map(Ee.map(St=>[St.id,St]));De(St=>{const qe=St.map(st=>Je.get(st.id)??st);return qe.some((st,rt)=>st!==St[rt])?qe:St})})},[C,Xe.length]);const G=s.useMemo(()=>Sde(M??[...L,e,...T.slice(0,6)],e,Xe.length?[...n,...Xe]:n),[M,L,e,T,n,Xe]),oe=s.useMemo(()=>Ede(G,e.id),[G,e.id]);s.useEffect(()=>{const Ee=Xe.find(Je=>Je.status==="done"&&Je.images[0]);Ee&&(De(Je=>Je.filter(St=>St.id!==Ee.id)),_9(Ee),e.id===Ee.parentId&&h(Ee.id))},[Xe,e.id,h]);const We=s.useMemo(()=>G.find(Ee=>Ee.node.id===e.id)??null,[G,e.id]),Oe=Mr(Ide),ie=G.length>1&&Oe?C$(G,e.id):e.kind!=="edit"?"Shot":M&&We?We.label:"Refinement",X=s.useMemo(()=>u4(n,e.id),[n,e.id]);s.useEffect(()=>{X.at>=0&&!a&&n.length-X.at<=6&&r()},[X.at,n.length,a,r]);const se=Ee=>{const Je=Ee>0?X.next:X.prev;Je&&h(Je.id)},Re=Od(),_e=(Ee,Je)=>Ee!=null&&Ee.images[0]?{onPointerEnter:St=>{St.pointerType==="mouse"&&Re.open({key:Ee.id,src:mn(Ee.images[0],"tile"),label:Hr(Ee),noun:Je,el:St.currentTarget,id:Ee.id})},onPointerLeave:St=>{St.pointerType==="mouse"&&Re.close()}}:{},Ye=Mde({onLeft:()=>se(1),onRight:()=>se(-1)});s.useEffect(()=>{const Ee=Re.shown;if(!Ee)return;const Je=Ee.noun==="Next shot"?X.next:X.prev;Je!=null&&Je.images[0]?Re.open({key:Je.id,src:mn(Je.images[0],"tile"),label:Hr(Je),noun:Ee.noun,el:Ee.el,id:Je.id}):Re.closeNow()},[e.id]),s.useEffect(()=>{var qe,st;const Ee=G.findIndex(rt=>rt.node.id===e.id),St=[(qe=G[Ee-1])==null?void 0:qe.node,(st=G[Ee+1])==null?void 0:st.node,X.prev,X.next].filter(rt=>!!(rt!=null&&rt.images[0])).map(rt=>{var Gt;const Xt=new Image;return Xt.decoding="async",Xt.src=mn(rt.images[0],"tile"),(Gt=Xt.decode)==null||Gt.call(Xt).catch(()=>{}),Xt});return()=>{for(const rt of St)rt.src=""}},[G,e.id,X.prev,X.next]);const ge=e.images[0],Qe=e.promptHead.slice(0,40).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"")||"shot",at=async(Ee=!1)=>{if(!z){q(!0);try{const Je=fetch(Dr(ge)).then(St=>{if(!St.ok)throw new Error(`HTTP ${St.status}`);return St.blob()});await navigator.clipboard.write([new ClipboardItem({"image/png":Je})]),Ee?P({kind:"success",title:"Copied to clipboard"}):Q(!0)}catch(Je){P(on(Je,"Copy failed"))}finally{q(!1)}}},wt=async()=>{if(!me){te(!0);try{await(e.archived?k(e):b(e))}finally{te(!1)}}},Et=async()=>{if(!he){re(!0);try{const Ee=e.brief?ry(e.brief):null;if(!Ee||Ee.every(Je=>Je.t==="text"&&!Je.v.trim()))await navigator.clipboard.writeText(_);else{const Je=st=>{var rt;switch(st.t){case"text":return st.v;case"product":return I.product(st.id)??"a product";case"character":return I.person(st.id)??"a presenter";case"template":return I.scene(st.id)??"a scene";case"color":return st.name??st.hex;case"ref":return"reference image";case"mark":return((rt=I.mark)==null?void 0:rt.call(I,st.imageHash))??"brand mark"}},{text:St,html:qe}=ute(Ee,Je);await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([St],{type:"text/plain"}),"text/html":new Blob([qe],{type:"text/html"})})])}J(!0)}catch(Ee){P(on(Ee,"Copy failed"))}finally{re(!1)}}};s.useEffect(()=>{const Ee=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Ee}},[]);const ot=[{key:"download",label:"Download",icon:o.jsx(fE,{size:14}),onClick:()=>{const Ee=document.createElement("a");Ee.href=Dr(ge),Ee.download=`${Qe}.png`,Ee.click()}},{key:"keep",label:e.kept?"Remove from keepers":"Keep",icon:o.jsx(Qa,{size:14,weight:e.kept?"fill":"regular"}),onClick:()=>g(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(Bx,{size:14}),onClick:()=>void at(),onMenu:()=>void at(!0),busy:z,said:Z?"Copied":void 0}],It=[{key:"archive",label:e.archived?"Restore":"Archive",icon:e.archived?o.jsx(J0,{size:14}):o.jsx(um,{size:14}),onClick:()=>void wt(),busy:me},...e.archived?[{key:"delete",label:"Delete permanently",icon:o.jsx(mm,{size:14}),onClick:()=>Y(!0),tint:"var(--sc-red)",dialog:!0}]:[]],Mt=e.status==="done"&&e.images.length>0,Zt=!Mt&&e.kind!=="edit"&&!!e.brief,Rt=Mt?[...ot,...It]:It,Tt=Mt?o.jsx(Qf,{children:Rt.map(Ee=>o.jsxs(Jf,{onSelect:Ee.onMenu??Ee.onClick,disabled:Ee.busy,color:Ee.tint?"red":void 0,children:[Ee.icon,Ee.label]},Ee.key))}):void 0;return Br.createPortal(o.jsx(Ad,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:Ee=>{var Je;Ee.preventDefault(),(Je=K.current)==null||Je.focus({preventScroll:!0})},children:o.jsxs("div",{ref:K,tabIndex:-1,className:"sc-ovl","data-fb":"shot-overlay","data-fb-node":e.id,role:"dialog","aria-modal":"true","aria-label":Hr(e),"data-rail":n.length>1?"":void 0,style:{"--sc-ovl-panel-w":`${Tu(H)}px`},children:[n.length>1&&o.jsx(Ade,{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(Cn,{size:13})})}),X.at>=0&&n.length>1&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!X.prev,onClick:()=>X.prev&&h(X.prev.id),"aria-label":"Previous shot",..._e(X.prev,"Previous shot"),children:o.jsx(Ra,{size:13})}),o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!X.next,onClick:()=>X.next&&h(X.next.id),"aria-label":"Next shot",..._e(X.next,"Next shot"),children:o.jsx(Cl,{size:13})})]})]}),Rt.length>0&&o.jsxs("div",{className:"sc-ovl-bar-r",children:[o.jsx("div",{className:"sc-ovl-acts",children:Rt.map(Ee=>o.jsx(fr,{label:Ee.said??Ee.label,open:!!Ee.said,children:o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:Ee.onClick,"aria-label":Ee.label,"aria-pressed":Ee.on===void 0?void 0:Ee.on,"data-on":Ee.on||void 0,"aria-haspopup":Ee.dialog?"dialog":void 0,"aria-busy":Ee.busy||void 0,"data-busy":Ee.busy||void 0,style:Ee.tint?{color:Ee.tint}:void 0,children:Ee.icon})},Ee.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(jv,{size:18,weight:"bold"})})})}),o.jsx(As,{align:"end",sideOffset:6,children:Rt.map(Ee=>o.jsxs(qn,{onSelect:Ee.onMenu??Ee.onClick,disabled:Ee.busy,color:Ee.tint?"red":void 0,children:[Ee.icon,Ee.label]},Ee.key))})]})]})]}),o.jsx(zf,{open:O,onOpenChange:Y,children:o.jsxs(Bf,{maxWidth:"420px",children:[o.jsx(Uf,{children:"Delete this shot permanently?"}),o.jsx(Wf,{size:"2",children:"This cannot be undone."}),o.jsxs(_s,{gap:"3",mt:"4",justify:"end",children:[o.jsx(Gf,{children:o.jsx(ba,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Kf,{children:o.jsx(ba,{color:"red",onClick:()=>S(e),children:"Delete permanently"})})]})]})}),Re.shown&&o.jsx(Hd,{anchor:Re.shown.el,kind:"shot",noun:Re.shown.noun,src:Re.shown.src,label:Re.shown.label,onOpen:()=>{var Je;const Ee=(Je=Re.shown)==null?void 0:Je.id;Re.closeNow(),Ee&&h(Ee)},onHoverIn:Re.keep,onHoverOut:Re.close,onClose:Re.closeNow},Re.shown.key),o.jsxs("div",{className:"sc-ovl-stage","data-takes":G.length>1?"":void 0,...Ye,children:[o.jsx(mde,{node:e,onRetry:()=>p(e),onCancel:()=>m(e),engineName:R==null?void 0:R.displayName,menu:Tt}),G.length>1?o.jsx(Cde,{trail:G,activeId:e.id,names:I,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":A$,"aria-valuemax":N$,"aria-valuenow":Tu(H),tabIndex:0,onPointerDown:Ee=>{Ee.button===0&&(Ee.preventDefault(),Ee.stopPropagation(),Ee.currentTarget.setPointerCapture(Ee.pointerId))},onPointerMove:Ee=>{if(!Ee.currentTarget.hasPointerCapture(Ee.pointerId))return;const Je=Ee.currentTarget.closest(".sc-ovl");B.current=Ee.clientX,!V.current&&(V.current=requestAnimationFrame(()=>{V.current=0,Je==null||Je.style.setProperty("--sc-ovl-panel-w",`${Tu(window.innerWidth-B.current)}px`)}))},onPointerUp:Ee=>{Ee.currentTarget.hasPointerCapture(Ee.pointerId)&&(Ee.currentTarget.releasePointerCapture(Ee.pointerId),D(Tu(window.innerWidth-Ee.clientX)))},onDoubleClick:Ee=>{Ee.stopPropagation(),D(V9)},onKeyDown:Ee=>{Ee.key==="ArrowLeft"?D(Je=>Tu(Je+16)):Ee.key==="ArrowRight"&&D(Je=>Tu(Je-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"}),Mt&&e.costUsd>0&&o.jsxs("small",{className:"sc-ovl-spend",title:"Of your API budget",children:["$",e.costUsd.toFixed(2)]})]}),e.kind!=="root"&&(_||U)&&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:ee?"Copied":"Copy the prompt",open:ee||void 0,children:o.jsx("button",{type:"button",className:"sc-icon-btn sc-ovl-copy","aria-label":"Copy the prompt","aria-busy":he||void 0,"data-busy":he?"":void 0,onClick:()=>void Et(),children:ee?o.jsx(Kn,{size:14,weight:"bold"}):o.jsx(Bx,{size:14})})})]}),o.jsx("div",{className:"sc-brief-record",children:o.jsx(Pde,{brief:e.brief,prompt:(j==null?void 0:j.prompt)??e.promptHead,brand:i,saidRef:ue,expanded:Se,clamped:vt&&!Se})}),(vt||Se)&&o.jsx("button",{type:"button",className:"sc-s sc-ovl-more","aria-expanded":Se,onClick:()=>Be(Ee=>!Ee),children:Se?o.jsxs(o.Fragment,{children:[o.jsx(VI,{size:12})," Show less"]}):o.jsxs(o.Fragment,{children:[o.jsx(wl,{size:12})," Show more"]})})]}),(Mt||Zt)&&o.jsxs("div",{className:"sc-sugg",children:[Zt&&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(Cd,{size:12})," Edit the prompt"]}),Mt&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>p(e),title:"Run the same setup again for a different take",children:[o.jsx(J0,{size:12})," Try again"]}),Mt&&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(hp,{size:12})," Reuse setup"]})]})]}),(Mt||e.status==="running")&&o.jsx("div",{className:"sc-ovl-edit sc-dock",ref:Me,children:o.jsx(jy,{variant:"overlay",projectId:u,brand:i,engines:l,parentId:t,target:e,holdFor:e.status==="running"?e:oe,sourceImage:ge,persistDraft:!1,onQueued:(Ee,Je,St,qe)=>{w(qe??[]);const st=Je==="edit"?qe==null?void 0:qe.find(rt=>rt.id===Ee):void 0;st?(ude(st.id),_9(st),De(rt=>[...rt.filter(Xt=>Xt.id!==st.id),st]),h(st.id)):Ee&&h(Ee),Ee&&(E==null||E(Ee,Je))}})})]})]})}),document.body)}function Z9(){const{shotId:e}=na(),t=lH(),{push:n}=rr(),r=e?t.byId.get(e)??null:null,[a,i]=s.useState(null);s.useEffect(()=>{if(!e||r)return;let p=!0;return Ae.node(e).then(m=>p&&i({id:e,node:m.kind==="root"?null:m})).catch(()=>p&&i({id:e,node:null})),()=>{p=!1}},[e,r]),s.useEffect(()=>{if(!(!e||r))return t.subscribeActivity(p=>{const m=p.find(g=>g.id===e);m&&i({id:e,node:m})})},[e,r,t.subscribeActivity]);const l=r??(a!==null&&a.id===e?a.node:null),u=!r&&a!==null&&a.id===e&&a.node===null,f=s.useRef(null);l&&(f.current=l);const h=l??(u?null:f.current);return s.useEffect(()=>{u&&(n({kind:"info",title:"That shot is no longer available",detail:"Back to the feed."}),t.close())},[u,t.close,n]),h?o.jsx(Fde,{node:h,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(h),onUnarchive:()=>t.unarchive(h),onDelete:()=>t.delete(h)}):u?null:o.jsx("div",{className:"sc-ovl-wait",role:"status","aria-label":"Loading",children:o.jsx(Lr,{size:"3"})})}const z9=10;function _de(){const{status:e,recent:t,history:n,featured:r,running:a,releasesUrl:i,notesFor:l,markSeen:u}=Qc(),{hash:f}=Un(),h=f.startsWith("#v")?n.findIndex(S=>`#v${S.version}`===f)+1:0,[p,m]=s.useState(z9),g=Math.min(n.length,Math.max(p,t.length,h)),w=g<n.length,y=s.useRef(null),b=S=>{var E;y.current=S?((E=n[g])==null?void 0:E.version)??null:null,m(g+z9)};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())},[g,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(us,{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:gR}):e==="ready"&&n.length===0?o.jsx("p",{className:"sc-wn-txt",children:vR}):o.jsxs(o.Fragment,{children:[o.jsx("ol",{className:"sc-wn-list",children:n.slice(0,g).map(S=>o.jsx(Vde,{current:S.version===a,entry:S,lead:S.version===(r==null?void 0:r.version),notes:l(S.version)},S.version))}),w&&o.jsx(Zde,{count:g,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(Cc,{size:13,"aria-hidden":"true"})]})]})]})})}function Vde({entry:e,lead:t,current:n,notes:r}){const a=!!e.announce,i=wR(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(xR,{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(yR,{picture:i,eager:t,onOpen:()=>u(!0)}),o.jsx(see,{sections:e.sections}),r&&o.jsx(oee,{href:r,version:e.version})]}),l&&i&&o.jsx(ree,{src:i.src,alt:i.alt,onClose:()=>u(!1)})]})}function Zde({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 zde(){const e=N7();return o.jsx(_s,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(Mw,{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(ba,{size:"1",variant:"soft",color:"gray",onClick:()=>window.location.reload(),children:"Reload"})})})}function Bde(){const{setSlug:e=""}=na(),{pathname:t,search:n}=Un(),{brand:r,sets:a,loaded:i,refresh:l}=cn(),u=Bn(),f=pn({path:pt.set,end:!1}),h=a.find(g=>g.slug===e)??a.find(g=>g.id===e)??null;Gc(h==null?void 0:h.name);const[p,m]=s.useState(null);if(s.useEffect(()=>{if(!i||h)return;if(p===e){u(Er(r),{replace:!0});return}let g=!0;return l().finally(()=>g&&m(e)),()=>{g=!1}},[i,h,e,p,r,u,l]),s.useEffect(()=>{h&&m(null)},[h]),!i||!h)return null;if(h.slug!==e){const g=f?t.slice(f.pathnameBase.length):"";return o.jsx(Xa,{to:P0(r,h)+g+n,replace:!0})}return o.jsx(x$,{set:h},h.id)}function Ude(){const{pathname:e,search:t}=Un();return o.jsx(Xa,{to:KG(e,t),replace:!0})}function Wde(){const{brandSlug:e}=na();return o.jsx(Xa,{to:`/${e}?settings=brand`,replace:!0})}function Kde(){const{sceneId:e}=na();return o.jsxs(o.Fragment,{children:[o.jsx(mie,{},e),o.jsx(_c,{})]})}function Gde(){const{presenterId:e}=na();return o.jsxs(o.Fragment,{children:[o.jsx(Sie,{},e),o.jsx(_c,{},e)]})}function Yde(){const{productId:e}=na();return o.jsx(vue,{},e)}const qde=rO([{element:o.jsx(Sse,{}),errorElement:o.jsx(zde,{}),children:[{index:!0,element:o.jsx(yee,{})},{path:pt.setup,element:o.jsx(Rse,{})},{path:pt.legacy,element:o.jsx(Ude,{})},{path:pt.brand,element:o.jsx(vse,{}),children:[{index:!0,element:o.jsx(sie,{})},{path:pt.hub,element:o.jsx(x$,{set:null}),children:[{path:pt.hubShot,element:o.jsx(Z9,{})}]},{path:pt.set,element:o.jsx(Bde,{}),children:[{path:pt.setShot,element:o.jsx(Z9,{})}]},{path:pt.kit,element:o.jsx(Wde,{})},{path:pt.whatsNew,element:o.jsx(_de,{})},{path:pt.products,element:o.jsx(sue,{})},{path:pt.product,element:o.jsx(Yde,{})},{path:pt.scenes,element:o.jsx(cie,{}),children:[{path:pt.sceneStudio,element:o.jsx(C9,{})}]},{path:pt.scene,element:o.jsx(Kde,{}),children:[{path:pt.sceneEdit,element:o.jsx(C9,{})}]},{path:pt.presenters,element:o.jsx(kie,{}),children:[{path:pt.presenterStudio,element:o.jsx(Fce,{})}]},{path:pt.presenter,element:o.jsx(Gde,{}),children:[{path:pt.presenterEdit,element:o.jsx(Mce,{})}]}]},{path:pt.notFound,element:o.jsx(Xa,{to:pt.root,replace:!0})}]}]),E6=localStorage.getItem("sc-theme")??localStorage.getItem("bt-theme");document.documentElement.dataset.theme=E6==="light"||E6==="dark"?E6:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";aX();const Xde={color:"currentColor",size:"1em",weight:"regular",mirrored:!1,"aria-hidden":!0};BT.createRoot(document.getElementById("root")).render(o.jsx(zn.StrictMode,{children:o.jsx($7.Provider,{value:Xde,children:o.jsx(xG,{children:o.jsx(NG,{children:o.jsx(AH,{router:qde})})})})}));