scenri 0.20.0 → 0.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,108 +0,0 @@
1
- var F3=e=>{throw TypeError(e)};var _3=(e,t,n)=>t.has(e)||F3("Cannot "+n);var ns=(e,t,n)=>(_3(e,t,"read from private field"),n?n.call(e):t.get(e)),V3=(e,t,n)=>t.has(e)?F3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Lg=(e,t,n,r)=>(_3(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function PT(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 N9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $g={exports:{}},s0={},Tg={exports:{}},Sn={};/**
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 Z3;function LT(){if(Z3)return Sn;Z3=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,X,Z){this.props=z,this.context=X,this.refs=b,this.updater=Z||w}k.prototype.isReactComponent={},k.prototype.setState=function(z,X){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,X,"setState")},k.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function S(){}S.prototype=k.prototype;function C(z,X,Z){this.props=z,this.context=X,this.refs=b,this.updater=Z||w}var E=C.prototype=new S;E.constructor=C,y(E,k.prototype),E.isPureReactComponent=!0;var A=Array.isArray,P=Object.prototype.hasOwnProperty,T={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function j(z,X,Z){var J,me={},ne=null,fe=null;if(X!=null)for(J in X.ref!==void 0&&(fe=X.ref),X.key!==void 0&&(ne=""+X.key),X)P.call(X,J)&&!M.hasOwnProperty(J)&&(me[J]=X[J]);var re=arguments.length-2;if(re===1)me.children=Z;else if(1<re){for(var ee=Array(re),Q=0;Q<re;Q++)ee[Q]=arguments[Q+2];me.children=ee}if(z&&z.defaultProps)for(J in re=z.defaultProps,re)me[J]===void 0&&(me[J]=re[J]);return{$$typeof:e,type:z,key:ne,ref:fe,props:me,_owner:T.current}}function R(z,X){return{$$typeof:e,type:z.type,key:X,ref:z.ref,props:z.props,_owner:z._owner}}function L(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function H(z){var X={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Z){return X[Z]})}var D=/\/+/g;function B(z,X){return typeof z=="object"&&z!==null&&z.key!=null?H(""+z.key):X.toString(36)}function V(z,X,Z,J,me){var ne=typeof z;(ne==="undefined"||ne==="boolean")&&(z=null);var fe=!1;if(z===null)fe=!0;else switch(ne){case"string":case"number":fe=!0;break;case"object":switch(z.$$typeof){case e:case t:fe=!0}}if(fe)return fe=z,me=me(fe),z=J===""?"."+B(fe,0):J,A(me)?(Z="",z!=null&&(Z=z.replace(D,"$&/")+"/"),V(me,X,Z,"",function(Q){return Q})):me!=null&&(L(me)&&(me=R(me,Z+(!me.key||fe&&fe.key===me.key?"":(""+me.key).replace(D,"$&/")+"/")+z)),X.push(me)),1;if(fe=0,J=J===""?".":J+":",A(z))for(var re=0;re<z.length;re++){ne=z[re];var ee=J+B(ne,re);fe+=V(ne,X,Z,ee,me)}else if(ee=g(z),typeof ee=="function")for(z=ee.call(z),re=0;!(ne=z.next()).done;)ne=ne.value,ee=J+B(ne,re++),fe+=V(ne,X,Z,ee,me);else if(ne==="object")throw X=String(z),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.");return fe}function W(z,X,Z){if(z==null)return z;var J=[],me=0;return V(z,J,"","",function(ne){return X.call(Z,ne,me++)}),J}function K(z){if(z._status===-1){var X=z._result;X=X(),X.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=X)}if(z._status===1)return z._result.default;throw z._result}var F={current:null},_={transition:null},O={ReactCurrentDispatcher:F,ReactCurrentBatchConfig:_,ReactCurrentOwner:T};function Y(){throw Error("act(...) is not supported in production builds of React.")}return Sn.Children={map:W,forEach:function(z,X,Z){W(z,function(){X.apply(this,arguments)},Z)},count:function(z){var X=0;return W(z,function(){X++}),X},toArray:function(z){return W(z,function(X){return X})||[]},only:function(z){if(!L(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},Sn.Component=k,Sn.Fragment=n,Sn.Profiler=a,Sn.PureComponent=C,Sn.StrictMode=r,Sn.Suspense=f,Sn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,Sn.act=Y,Sn.cloneElement=function(z,X,Z){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var J=y({},z.props),me=z.key,ne=z.ref,fe=z._owner;if(X!=null){if(X.ref!==void 0&&(ne=X.ref,fe=T.current),X.key!==void 0&&(me=""+X.key),z.type&&z.type.defaultProps)var re=z.type.defaultProps;for(ee in X)P.call(X,ee)&&!M.hasOwnProperty(ee)&&(J[ee]=X[ee]===void 0&&re!==void 0?re[ee]:X[ee])}var ee=arguments.length-2;if(ee===1)J.children=Z;else if(1<ee){re=Array(ee);for(var Q=0;Q<ee;Q++)re[Q]=arguments[Q+2];J.children=re}return{$$typeof:e,type:z.type,key:me,ref:ne,props:J,_owner:fe}},Sn.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},Sn.createElement=j,Sn.createFactory=function(z){var X=j.bind(null,z);return X.type=z,X},Sn.createRef=function(){return{current:null}},Sn.forwardRef=function(z){return{$$typeof:u,render:z}},Sn.isValidElement=L,Sn.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:K}},Sn.memo=function(z,X){return{$$typeof:h,type:z,compare:X===void 0?null:X}},Sn.startTransition=function(z){var X=_.transition;_.transition={};try{z()}finally{_.transition=X}},Sn.unstable_act=Y,Sn.useCallback=function(z,X){return F.current.useCallback(z,X)},Sn.useContext=function(z){return F.current.useContext(z)},Sn.useDebugValue=function(){},Sn.useDeferredValue=function(z){return F.current.useDeferredValue(z)},Sn.useEffect=function(z,X){return F.current.useEffect(z,X)},Sn.useId=function(){return F.current.useId()},Sn.useImperativeHandle=function(z,X,Z){return F.current.useImperativeHandle(z,X,Z)},Sn.useInsertionEffect=function(z,X){return F.current.useInsertionEffect(z,X)},Sn.useLayoutEffect=function(z,X){return F.current.useLayoutEffect(z,X)},Sn.useMemo=function(z,X){return F.current.useMemo(z,X)},Sn.useReducer=function(z,X,Z){return F.current.useReducer(z,X,Z)},Sn.useRef=function(z){return F.current.useRef(z)},Sn.useState=function(z){return F.current.useState(z)},Sn.useSyncExternalStore=function(z,X,Z){return F.current.useSyncExternalStore(z,X,Z)},Sn.useTransition=function(){return F.current.useTransition()},Sn.version="18.3.1",Sn}var z3;function G4(){return z3||(z3=1,Tg.exports=LT()),Tg.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 B3;function $T(){if(B3)return s0;B3=1;var e=G4(),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 s0.Fragment=n,s0.jsx=l,s0.jsxs=l,s0}var U3;function TT(){return U3||(U3=1,$g.exports=$T()),$g.exports}var o=TT(),s=G4();const zn=N9(s),Ac=PT({__proto__:null,default:zn},[s]);var nh={},Dg={exports:{}},Rs={},Hg={exports:{}},Og={};/**
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 W3;function DT(){return W3||(W3=1,(function(e){function t(_,O){var Y=_.length;_.push(O);e:for(;0<Y;){var z=Y-1>>>1,X=_[z];if(0<a(X,O))_[z]=O,_[Y]=X,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,X=_.length,Z=X>>>1;z<Z;){var J=2*(z+1)-1,me=_[J],ne=J+1,fe=_[ne];if(0>a(me,Y))ne<X&&0>a(fe,me)?(_[z]=fe,_[ne]=Y,z=ne):(_[z]=me,_[J]=Y,z=J);else if(ne<X&&0>a(fe,Y))_[z]=fe,_[ne]=Y,z=ne;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,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(_){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,E(_),!y)if(n(f)!==null)y=!0,K(P);else{var O=n(h);O!==null&&F(A,O.startTime-_)}}function P(_,O){y=!1,b&&(b=!1,S(j),j=-1),w=!0;var Y=g;try{for(E(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 X=z(m.expirationTime<=O);O=e.unstable_now(),typeof X=="function"?m.callback=X:m===n(f)&&r(f),E(O)}else r(f);m=n(f)}if(m!==null)var Z=!0;else{var J=n(h);J!==null&&F(A,J.startTime-O),Z=!1}return Z}finally{m=null,g=Y,w=!1}}var T=!1,M=null,j=-1,R=5,L=-1;function H(){return!(e.unstable_now()-L<R)}function D(){if(M!==null){var _=e.unstable_now();L=_;var O=!0;try{O=M(!0,_)}finally{O?B():(T=!1,M=null)}}else T=!1}var B;if(typeof C=="function")B=function(){C(D)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,W=V.port2;V.port1.onmessage=D,B=function(){W.postMessage(null)}}else B=function(){k(D,0)};function K(_){M=_,T||(T=!0,B())}function F(_,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,K(P))},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 X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=Y+X,_={id:p++,callback:O,priorityLevel:_,startTime:Y,expirationTime:X,sortIndex:-1},Y>z?(_.sortIndex=Y,t(h,_),n(f)===null&&_===n(h)&&(b?(S(j),j=-1):b=!0,F(A,Y-z))):(_.sortIndex=X,t(f,_),y||w||(y=!0,K(P))),_},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}}}})(Og)),Og}var K3;function HT(){return K3||(K3=1,Hg.exports=DT()),Hg.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 G3;function OT(){if(G3)return Rs;G3=1;var e=G4(),t=HT();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,$,U){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=U}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 C(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,C);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,C);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,C);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 E(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,P=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"),L=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"),W=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),F=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 X(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 J(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
- `),U=N.length-1,de=$.length-1;1<=U&&0<=de&&N[U]!==$[de];)de--;for(;1<=U&&0<=de;U--,de--)if(N[U]!==$[de]){if(U!==1||de!==1)do if(U--,de--,0>de||N[U]!==$[de]){var ye=`
37
- `+N[U].replace(" at new "," at ");return c.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",c.displayName)),ye}while(1<=U&&0<=de);break}}}finally{Z=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?X(c):""}function me(c){switch(c.tag){case 5:return X(c.type);case 16:return X("Lazy");case 13:return X("Suspense");case 19:return X("SuspenseList");case 0:case 2:case 15:return c=J(c.type,!1),c;case 11:return c=J(c.type.render,!1),c;case 1:return c=J(c.type,!0),c;default:return""}}function ne(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 L: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 W:return d=c.displayName||null,d!==null?d:ne(c.type)||"Memo";case K:d=c._payload,c=c._init;try{return ne(c(d))}catch{}}return null}function fe(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 ne(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 Q(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(U){x=""+U,$.call(this,U)}}),Object.defineProperty(c,d,{enumerable:v.enumerable}),{getValue:function(){return x},setValue:function(U){x=""+U},stopTracking:function(){c._valueTracker=null,delete c[d]}}}}function he(c){c._valueTracker||(c._valueTracker=Q(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 ce(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}function ke(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 ft(c,d){d=d.checked,d!=null&&E(c,"checked",d,!1)}function Ue(c,d){ft(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")?Pe(c,d.type,v):d.hasOwnProperty("defaultValue")&&Pe(c,d.type,re(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(c.defaultChecked=!!d.defaultChecked)}function Qe(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 Pe(c,d,v){(d!=="number"||ce(c.ownerDocument)!==c)&&(v==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+v&&(c.defaultValue=""+v))}var G=Array.isArray;function se(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 Ze(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 oe(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 q(c){var d=c.textContent;d===c._wrapperState.initialValue&&d!==""&&d!==null&&(c.value=d)}function ae(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 Le(c,d){return c==null||c==="http://www.w3.org/1999/xhtml"?ae(d):c==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var Ie,Je=(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(Ie=Ie||document.createElement("div"),Ie.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=Ie.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 et={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},nt=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(c){nt.forEach(function(d){d=d+c.charAt(0).toUpperCase()+c.substring(1),et[d]=et[c]})});function pt(c,d,v){return d==null||typeof d=="boolean"||d===""?"":v||typeof d!="number"||d===0||et.hasOwnProperty(c)&&et[c]?(""+d).trim():d+"px"}function St(c,d){c=c.style;for(var v in d)if(d.hasOwnProperty(v)){var x=v.indexOf("--")===0,N=pt(v,d[v],x);v==="float"&&(v="cssFloat"),x?c.setProperty(v,N):c[v]=N}}var at=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 _t(c,d){if(d){if(at[c]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,c));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function Lt(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 Mt(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var $t=null,Se=null,Ke=null;function kt(c){if(c=zd(c)){if(typeof $t!="function")throw Error(n(280));var d=c.stateNode;d&&(d=v1(d),$t(c.stateNode,c.type,d))}}function qe(c){Se?Ke?Ke.push(c):Ke=[c]:Se=c}function ot(){if(Se){var c=Se,d=Ke;if(Ke=Se=null,kt(c),d)for(c=0;c<d.length;c++)kt(d[c])}}function rt(c,d){return c(d)}function tn(){}var Qt=!1;function on(c,d,v){if(Qt)return c(d,v);Qt=!0;try{return rt(c,d,v)}finally{Qt=!1,(Se!==null||Ke!==null)&&(tn(),ot())}}function Wt(c,d){var v=c.stateNode;if(v===null)return null;var x=v1(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 zt=!1;if(u)try{var Ut={};Object.defineProperty(Ut,"passive",{get:function(){zt=!0}}),window.addEventListener("test",Ut,Ut),window.removeEventListener("test",Ut,Ut)}catch{zt=!1}function te(c,d,v,x,N,$,U,de,ye){var ze=Array.prototype.slice.call(arguments,3);try{d.apply(v,ze)}catch(ut){this.onError(ut)}}var ie=!1,pe=null,Fe=!1,Oe=null,mt={onError:function(c){ie=!0,pe=c}};function yt(c,d,v,x,N,$,U,de,ye){ie=!1,pe=null,te.apply(mt,arguments)}function Et(c,d,v,x,N,$,U,de,ye){if(yt.apply(this,arguments),ie){if(ie){var ze=pe;ie=!1,pe=null}else throw Error(n(198));Fe||(Fe=!0,Oe=ze)}}function st(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 vt(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 Ae(c){if(st(c)!==c)throw Error(n(188))}function xe(c){var d=c.alternate;if(!d){if(d=st(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 Ae(N),c;if($===x)return Ae(N),d;$=$.sibling}throw Error(n(188))}if(v.return!==x.return)v=N,x=$;else{for(var U=!1,de=N.child;de;){if(de===v){U=!0,v=N,x=$;break}if(de===x){U=!0,x=N,v=$;break}de=de.sibling}if(!U){for(de=$.child;de;){if(de===v){U=!0,v=$,x=N;break}if(de===x){U=!0,x=$,v=N;break}de=de.sibling}if(!U)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 Xe(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 ve=t.unstable_scheduleCallback,lt=t.unstable_cancelCallback,dt=t.unstable_shouldYield,$e=t.unstable_requestPaint,Ge=t.unstable_now,Rt=t.unstable_getCurrentPriorityLevel,nn=t.unstable_ImmediatePriority,Nt=t.unstable_UserBlockingPriority,Jt=t.unstable_NormalPriority,Ce=t.unstable_LowPriority,_e=t.unstable_IdlePriority,tt=null,I=null;function ue(c){if(I&&typeof I.onCommitFiberRoot=="function")try{I.onCommitFiberRoot(tt,c,void 0,(c.current.flags&128)===128)}catch{}}var be=Math.clz32?Math.clz32:bt,Ve=Math.log,Re=Math.LN2;function bt(c){return c>>>=0,c===0?32:31-(Ve(c)/Re|0)|0}var Ot=64,It=4194304;function Dt(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 wn(c,d){var v=c.pendingLanes;if(v===0)return 0;var x=0,N=c.suspendedLanes,$=c.pingedLanes,U=v&268435455;if(U!==0){var de=U&~N;de!==0?x=Dt(de):($&=U,$!==0&&(x=Dt($)))}else U=v&~N,U!==0?x=Dt(U):$!==0&&(x=Dt($));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-be(d),N=1<<v,x|=c[v],d&=~N;return x}function Bt(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 In(c,d){for(var v=c.suspendedLanes,x=c.pingedLanes,N=c.expirationTimes,$=c.pendingLanes;0<$;){var U=31-be($),de=1<<U,ye=N[U];ye===-1?((de&v)===0||(de&x)!==0)&&(N[U]=Bt(de,d)):ye<=d&&(c.expiredLanes|=de),$&=~de}}function dn(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function Nn(){var c=Ot;return Ot<<=1,(Ot&4194240)===0&&(Ot=64),c}function Kn(c){for(var d=[],v=0;31>v;v++)d.push(c);return d}function sn(c,d,v){c.pendingLanes|=d,d!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,d=31-be(d),c[d]=v}function ar(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-be(v),$=1<<N;d[N]=0,x[N]=-1,c[N]=-1,v&=~$}}function fs(c,d){var v=c.entangledLanes|=d;for(c=c.entanglements;v;){var x=31-be(v),N=1<<x;N&d|c[x]&d&&(c[x]|=d),v&=~N}}var Mn=0;function _s(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var na,ra,so,ln,bn,Wn=!1,fr=[],hr=null,xn=null,Br=null,ao=new Map,Vs=new Map,Ar=[],$l="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 To(c,d){switch(c){case"focusin":case"focusout":hr=null;break;case"dragenter":case"dragleave":xn=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":ao.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vs.delete(d.pointerId)}}function Do(c,d,v,x,N,$){return c===null||c.nativeEvent!==$?(c={blockedOn:d,domEventName:v,eventSystemFlags:x,nativeEvent:$,targetContainers:[N]},d!==null&&(d=zd(d),d!==null&&ra(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=Do(hr,c,d,v,x,N),!0;case"dragenter":return xn=Do(xn,c,d,v,x,N),!0;case"mouseover":return Br=Do(Br,c,d,v,x,N),!0;case"pointerover":var $=N.pointerId;return ao.set($,Do(ao.get($)||null,c,d,v,x,N)),!0;case"gotpointercapture":return $=N.pointerId,Vs.set($,Do(Vs.get($)||null,c,d,v,x,N)),!0}return!1}function De(c){var d=Hl(c.target);if(d!==null){var v=st(d);if(v!==null){if(d=v.tag,d===13){if(d=vt(v),d!==null){c.blockedOn=d,bn(c.priority,function(){so(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 it(c){if(c.blockedOn!==null)return!1;for(var d=c.targetContainers;0<d.length;){var v=Nd(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=zd(v),d!==null&&ra(d),c.blockedOn=v,!1;d.shift()}return!0}function Gt(c,d,v){it(c)&&v.delete(d)}function Yt(){Wn=!1,hr!==null&&it(hr)&&(hr=null),xn!==null&&it(xn)&&(xn=null),Br!==null&&it(Br)&&(Br=null),ao.forEach(Gt),Vs.forEach(Gt)}function _n(c,d){c.blockedOn===d&&(c.blockedOn=null,Wn||(Wn=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Yt)))}function fn(c){function d(N){return _n(N,c)}if(0<fr.length){_n(fr[0],c);for(var v=1;v<fr.length;v++){var x=fr[v];x.blockedOn===c&&(x.blockedOn=null)}}for(hr!==null&&_n(hr,c),xn!==null&&_n(xn,c),Br!==null&&_n(Br,c),ao.forEach(d),Vs.forEach(d),v=0;v<Ar.length;v++)x=Ar[v],x.blockedOn===c&&(x.blockedOn=null);for(;0<Ar.length&&(v=Ar[0],v.blockedOn===null);)De(v),v.blockedOn===null&&Ar.shift()}var Ln=A.ReactCurrentBatchConfig,kn=!0;function Zs(c,d,v,x){var N=Mn,$=Ln.transition;Ln.transition=null;try{Mn=1,oo(c,d,v,x)}finally{Mn=N,Ln.transition=$}}function Ad(c,d,v,x){var N=Mn,$=Ln.transition;Ln.transition=null;try{Mn=4,oo(c,d,v,x)}finally{Mn=N,Ln.transition=$}}function oo(c,d,v,x){if(kn){var N=Nd(c,d,v,x);if(N===null)k2(c,d,x,zc,v),To(c,x);else if(le(N,c,d,v,x))x.stopPropagation();else if(To(c,x),d&4&&-1<$l.indexOf(c)){for(;N!==null;){var $=zd(N);if($!==null&&na($),$=Nd(c,d,v,x),$===null&&k2(c,d,x,zc,v),$===N)break;N=$}N!==null&&x.stopPropagation()}else k2(c,d,x,null,v)}}var zc=null;function Nd(c,d,v,x){if(zc=null,c=Mt(x),c=Hl(c),c!==null)if(d=st(c),d===null)c=null;else if(v=d.tag,v===13){if(c=vt(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 zc=c,null}function i1(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(Rt()){case nn:return 1;case Nt:return 4;case Jt:case Ce:return 16;case _e:return 536870912;default:return 16}default:return 16}}var sa=null,Si=null,Tl=null;function Md(){if(Tl)return Tl;var c,d=Si,v=d.length,x,N="value"in sa?sa.value:sa.textContent,$=N.length;for(c=0;c<v&&d[c]===N[c];c++);var U=v-c;for(x=1;x<=U&&d[v-x]===N[$-x];x++);return Tl=N.slice(c,1<x?1-x:void 0)}function Dl(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 Ei(){return!0}function Rd(){return!1}function Xr(c){function d(v,x,N,$,U){this._reactName=v,this._targetInst=N,this.type=x,this.nativeEvent=$,this.target=U,this.currentTarget=null;for(var de in c)c.hasOwnProperty(de)&&(v=c[de],this[de]=v?v($):$[de]);return this.isDefaultPrevented=($.defaultPrevented!=null?$.defaultPrevented:$.returnValue===!1)?Ei:Rd,this.isPropagationStopped=Rd,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=Ei)},stopPropagation:function(){var v=this.nativeEvent;v&&(v.stopPropagation?v.stopPropagation():typeof v.cancelBubble!="unknown"&&(v.cancelBubble=!0),this.isPropagationStopped=Ei)},persist:function(){},isPersistent:Ei}),d}var Ho={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bc=Xr(Ho),Ee=Y({},Ho,{view:0,detail:0}),wt=Xr(Ee),rn,yn,en,Pn=Y({},Ee,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:d2,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!==en&&(en&&c.type==="mousemove"?(rn=c.screenX-en.screenX,yn=c.screenY-en.screenY):yn=rn=0,en=c),rn)},movementY:function(c){return"movementY"in c?c.movementY:yn}}),Dr=Xr(Pn),Hn=Y({},Pn,{dataTransfer:0}),Cn=Xr(Hn),Jn=Y({},Ee,{relatedTarget:0}),Hr=Xr(Jn),u2=Y({},Ho,{animationName:0,elapsedTime:0,pseudoElement:0}),Pd=Xr(u2),Ld=Y({},Ho,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),l1=Xr(Ld),Pa=Y({},Ho,{data:0}),$d=Xr(Pa),c1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p$={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"},m$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g$(c){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(c):(c=m$[c])?!!d[c]:!1}function d2(){return g$}var v$=Y({},Ee,{key:function(c){if(c.key){var d=c1[c.key]||c.key;if(d!=="Unidentified")return d}return c.type==="keypress"?(c=Dl(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?p$[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:d2,charCode:function(c){return c.type==="keypress"?Dl(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?Dl(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),w$=Xr(v$),y$=Y({},Pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ry=Xr(y$),b$=Y({},Ee,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:d2}),x$=Xr(b$),k$=Y({},Ho,{propertyName:0,elapsedTime:0,pseudoElement:0}),S$=Xr(k$),E$=Y({},Pn,{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}),C$=Xr(E$),j$=[9,13,27,32],f2=u&&"CompositionEvent"in window,Td=null;u&&"documentMode"in document&&(Td=document.documentMode);var A$=u&&"TextEvent"in window&&!Td,Py=u&&(!f2||Td&&8<Td&&11>=Td),Ly=" ",$y=!1;function Ty(c,d){switch(c){case"keyup":return j$.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dy(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var Uc=!1;function N$(c,d){switch(c){case"compositionend":return Dy(d);case"keypress":return d.which!==32?null:($y=!0,Ly);case"textInput":return c=d.data,c===Ly&&$y?null:c;default:return null}}function M$(c,d){if(Uc)return c==="compositionend"||!f2&&Ty(c,d)?(c=Md(),Tl=Si=sa=null,Uc=!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 Py&&d.locale!=="ko"?null:d.data;default:return null}}var R$={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 Hy(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d==="input"?!!R$[c.type]:d==="textarea"}function Oy(c,d,v,x){qe(x),d=p1(d,"onChange"),0<d.length&&(v=new Bc("onChange","change",null,v,x),c.push({event:v,listeners:d}))}var Dd=null,Hd=null;function P$(c){tb(c,0)}function u1(c){var d=qc(c);if(Me(d))return c}function L$(c,d){if(c==="change")return d}var Iy=!1;if(u){var h2;if(u){var p2="oninput"in document;if(!p2){var Fy=document.createElement("div");Fy.setAttribute("oninput","return;"),p2=typeof Fy.oninput=="function"}h2=p2}else h2=!1;Iy=h2&&(!document.documentMode||9<document.documentMode)}function _y(){Dd&&(Dd.detachEvent("onpropertychange",Vy),Hd=Dd=null)}function Vy(c){if(c.propertyName==="value"&&u1(Hd)){var d=[];Oy(d,Hd,c,Mt(c)),on(P$,d)}}function $$(c,d,v){c==="focusin"?(_y(),Dd=d,Hd=v,Dd.attachEvent("onpropertychange",Vy)):c==="focusout"&&_y()}function T$(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return u1(Hd)}function D$(c,d){if(c==="click")return u1(d)}function H$(c,d){if(c==="input"||c==="change")return u1(d)}function O$(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var La=typeof Object.is=="function"?Object.is:O$;function Od(c,d){if(La(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)||!La(c[N],d[N]))return!1}return!0}function Zy(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function zy(c,d){var v=Zy(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=Zy(v)}}function By(c,d){return c&&d?c===d?!0:c&&c.nodeType===3?!1:d&&d.nodeType===3?By(c,d.parentNode):"contains"in c?c.contains(d):c.compareDocumentPosition?!!(c.compareDocumentPosition(d)&16):!1:!1}function Uy(){for(var c=window,d=ce();d instanceof c.HTMLIFrameElement;){try{var v=typeof d.contentWindow.location.href=="string"}catch{v=!1}if(v)c=d.contentWindow;else break;d=ce(c.document)}return d}function m2(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 I$(c){var d=Uy(),v=c.focusedElem,x=c.selectionRange;if(d!==v&&v&&v.ownerDocument&&By(v.ownerDocument.documentElement,v)){if(x!==null&&m2(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=zy(v,$);var U=zy(v,x);N&&U&&(c.rangeCount!==1||c.anchorNode!==N.node||c.anchorOffset!==N.offset||c.focusNode!==U.node||c.focusOffset!==U.offset)&&(d=d.createRange(),d.setStart(N.node,N.offset),c.removeAllRanges(),$>x?(c.addRange(d),c.extend(U.node,U.offset)):(d.setEnd(U.node,U.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 F$=u&&"documentMode"in document&&11>=document.documentMode,Wc=null,g2=null,Id=null,v2=!1;function Wy(c,d,v){var x=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;v2||Wc==null||Wc!==ce(x)||(x=Wc,"selectionStart"in x&&m2(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}),Id&&Od(Id,x)||(Id=x,x=p1(g2,"onSelect"),0<x.length&&(d=new Bc("onSelect","select",null,d,v),c.push({event:d,listeners:x}),d.target=Wc)))}function d1(c,d){var v={};return v[c.toLowerCase()]=d.toLowerCase(),v["Webkit"+c]="webkit"+d,v["Moz"+c]="moz"+d,v}var Kc={animationend:d1("Animation","AnimationEnd"),animationiteration:d1("Animation","AnimationIteration"),animationstart:d1("Animation","AnimationStart"),transitionend:d1("Transition","TransitionEnd")},w2={},Ky={};u&&(Ky=document.createElement("div").style,"AnimationEvent"in window||(delete Kc.animationend.animation,delete Kc.animationiteration.animation,delete Kc.animationstart.animation),"TransitionEvent"in window||delete Kc.transitionend.transition);function f1(c){if(w2[c])return w2[c];if(!Kc[c])return c;var d=Kc[c],v;for(v in d)if(d.hasOwnProperty(v)&&v in Ky)return w2[c]=d[v];return c}var Gy=f1("animationend"),Yy=f1("animationiteration"),qy=f1("animationstart"),Xy=f1("transitionend"),Qy=new Map,Jy="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 Ci(c,d){Qy.set(c,d),i(d,[c])}for(var y2=0;y2<Jy.length;y2++){var b2=Jy[y2],_$=b2.toLowerCase(),V$=b2[0].toUpperCase()+b2.slice(1);Ci(_$,"on"+V$)}Ci(Gy,"onAnimationEnd"),Ci(Yy,"onAnimationIteration"),Ci(qy,"onAnimationStart"),Ci("dblclick","onDoubleClick"),Ci("focusin","onFocus"),Ci("focusout","onBlur"),Ci(Xy,"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 Fd="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(" "),Z$=new Set("cancel close invalid load scroll toggle".split(" ").concat(Fd));function eb(c,d,v){var x=c.type||"unknown-event";c.currentTarget=v,Et(x,d,void 0,c),c.currentTarget=null}function tb(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 U=x.length-1;0<=U;U--){var de=x[U],ye=de.instance,ze=de.currentTarget;if(de=de.listener,ye!==$&&N.isPropagationStopped())break e;eb(N,de,ze),$=ye}else for(U=0;U<x.length;U++){if(de=x[U],ye=de.instance,ze=de.currentTarget,de=de.listener,ye!==$&&N.isPropagationStopped())break e;eb(N,de,ze),$=ye}}}if(Fe)throw c=Oe,Fe=!1,Oe=null,c}function er(c,d){var v=d[N2];v===void 0&&(v=d[N2]=new Set);var x=c+"__bubble";v.has(x)||(nb(d,c,2,!1),v.add(x))}function x2(c,d,v){var x=0;d&&(x|=4),nb(v,c,x,d)}var h1="_reactListening"+Math.random().toString(36).slice(2);function _d(c){if(!c[h1]){c[h1]=!0,r.forEach(function(v){v!=="selectionchange"&&(Z$.has(v)||x2(v,!1,c),x2(v,!0,c))});var d=c.nodeType===9?c:c.ownerDocument;d===null||d[h1]||(d[h1]=!0,x2("selectionchange",!1,d))}}function nb(c,d,v,x){switch(i1(d)){case 1:var N=Zs;break;case 4:N=Ad;break;default:N=oo}v=N.bind(null,d,v,c),N=void 0,!zt||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 k2(c,d,v,x,N){var $=x;if((d&1)===0&&(d&2)===0&&x!==null)e:for(;;){if(x===null)return;var U=x.tag;if(U===3||U===4){var de=x.stateNode.containerInfo;if(de===N||de.nodeType===8&&de.parentNode===N)break;if(U===4)for(U=x.return;U!==null;){var ye=U.tag;if((ye===3||ye===4)&&(ye=U.stateNode.containerInfo,ye===N||ye.nodeType===8&&ye.parentNode===N))return;U=U.return}for(;de!==null;){if(U=Hl(de),U===null)return;if(ye=U.tag,ye===5||ye===6){x=$=U;continue e}de=de.parentNode}}x=x.return}on(function(){var ze=$,ut=Mt(v),gt=[];e:{var ct=Qy.get(c);if(ct!==void 0){var Pt=Bc,Ht=c;switch(c){case"keypress":if(Dl(v)===0)break e;case"keydown":case"keyup":Pt=w$;break;case"focusin":Ht="focus",Pt=Hr;break;case"focusout":Ht="blur",Pt=Hr;break;case"beforeblur":case"afterblur":Pt=Hr;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":Pt=Dr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Pt=Cn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Pt=x$;break;case Gy:case Yy:case qy:Pt=Pd;break;case Xy:Pt=S$;break;case"scroll":Pt=wt;break;case"wheel":Pt=C$;break;case"copy":case"cut":case"paste":Pt=l1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Pt=Ry}var Ft=(d&4)!==0,gr=!Ft&&c==="scroll",Te=Ft?ct!==null?ct+"Capture":null:ct;Ft=[];for(var je=ze,He;je!==null;){He=je;var xt=He.stateNode;if(He.tag===5&&xt!==null&&(He=xt,Te!==null&&(xt=Wt(je,Te),xt!=null&&Ft.push(Vd(je,xt,He)))),gr)break;je=je.return}0<Ft.length&&(ct=new Pt(ct,Ht,null,v,ut),gt.push({event:ct,listeners:Ft}))}}if((d&7)===0){e:{if(ct=c==="mouseover"||c==="pointerover",Pt=c==="mouseout"||c==="pointerout",ct&&v!==Zt&&(Ht=v.relatedTarget||v.fromElement)&&(Hl(Ht)||Ht[Oo]))break e;if((Pt||ct)&&(ct=ut.window===ut?ut:(ct=ut.ownerDocument)?ct.defaultView||ct.parentWindow:window,Pt?(Ht=v.relatedTarget||v.toElement,Pt=ze,Ht=Ht?Hl(Ht):null,Ht!==null&&(gr=st(Ht),Ht!==gr||Ht.tag!==5&&Ht.tag!==6)&&(Ht=null)):(Pt=null,Ht=ze),Pt!==Ht)){if(Ft=Dr,xt="onMouseLeave",Te="onMouseEnter",je="mouse",(c==="pointerout"||c==="pointerover")&&(Ft=Ry,xt="onPointerLeave",Te="onPointerEnter",je="pointer"),gr=Pt==null?ct:qc(Pt),He=Ht==null?ct:qc(Ht),ct=new Ft(xt,je+"leave",Pt,v,ut),ct.target=gr,ct.relatedTarget=He,xt=null,Hl(ut)===ze&&(Ft=new Ft(Te,je+"enter",Ht,v,ut),Ft.target=He,Ft.relatedTarget=gr,xt=Ft),gr=xt,Pt&&Ht)t:{for(Ft=Pt,Te=Ht,je=0,He=Ft;He;He=Gc(He))je++;for(He=0,xt=Te;xt;xt=Gc(xt))He++;for(;0<je-He;)Ft=Gc(Ft),je--;for(;0<He-je;)Te=Gc(Te),He--;for(;je--;){if(Ft===Te||Te!==null&&Ft===Te.alternate)break t;Ft=Gc(Ft),Te=Gc(Te)}Ft=null}else Ft=null;Pt!==null&&rb(gt,ct,Pt,Ft,!1),Ht!==null&&gr!==null&&rb(gt,gr,Ht,Ft,!0)}}e:{if(ct=ze?qc(ze):window,Pt=ct.nodeName&&ct.nodeName.toLowerCase(),Pt==="select"||Pt==="input"&&ct.type==="file")var Vt=L$;else if(Hy(ct))if(Iy)Vt=H$;else{Vt=T$;var qt=$$}else(Pt=ct.nodeName)&&Pt.toLowerCase()==="input"&&(ct.type==="checkbox"||ct.type==="radio")&&(Vt=D$);if(Vt&&(Vt=Vt(c,ze))){Oy(gt,Vt,v,ut);break e}qt&&qt(c,ct,ze),c==="focusout"&&(qt=ct._wrapperState)&&qt.controlled&&ct.type==="number"&&Pe(ct,"number",ct.value)}switch(qt=ze?qc(ze):window,c){case"focusin":(Hy(qt)||qt.contentEditable==="true")&&(Wc=qt,g2=ze,Id=null);break;case"focusout":Id=g2=Wc=null;break;case"mousedown":v2=!0;break;case"contextmenu":case"mouseup":case"dragend":v2=!1,Wy(gt,v,ut);break;case"selectionchange":if(F$)break;case"keydown":case"keyup":Wy(gt,v,ut)}var Xt;if(f2)e:{switch(c){case"compositionstart":var an="onCompositionStart";break e;case"compositionend":an="onCompositionEnd";break e;case"compositionupdate":an="onCompositionUpdate";break e}an=void 0}else Uc?Ty(c,v)&&(an="onCompositionEnd"):c==="keydown"&&v.keyCode===229&&(an="onCompositionStart");an&&(Py&&v.locale!=="ko"&&(Uc||an!=="onCompositionStart"?an==="onCompositionEnd"&&Uc&&(Xt=Md()):(sa=ut,Si="value"in sa?sa.value:sa.textContent,Uc=!0)),qt=p1(ze,an),0<qt.length&&(an=new $d(an,c,null,v,ut),gt.push({event:an,listeners:qt}),Xt?an.data=Xt:(Xt=Dy(v),Xt!==null&&(an.data=Xt)))),(Xt=A$?N$(c,v):M$(c,v))&&(ze=p1(ze,"onBeforeInput"),0<ze.length&&(ut=new $d("onBeforeInput","beforeinput",null,v,ut),gt.push({event:ut,listeners:ze}),ut.data=Xt))}tb(gt,d)})}function Vd(c,d,v){return{instance:c,listener:d,currentTarget:v}}function p1(c,d){for(var v=d+"Capture",x=[];c!==null;){var N=c,$=N.stateNode;N.tag===5&&$!==null&&(N=$,$=Wt(c,v),$!=null&&x.unshift(Vd(c,$,N)),$=Wt(c,d),$!=null&&x.push(Vd(c,$,N))),c=c.return}return x}function Gc(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function rb(c,d,v,x,N){for(var $=d._reactName,U=[];v!==null&&v!==x;){var de=v,ye=de.alternate,ze=de.stateNode;if(ye!==null&&ye===x)break;de.tag===5&&ze!==null&&(de=ze,N?(ye=Wt(v,$),ye!=null&&U.unshift(Vd(v,ye,de))):N||(ye=Wt(v,$),ye!=null&&U.push(Vd(v,ye,de)))),v=v.return}U.length!==0&&c.push({event:d,listeners:U})}var z$=/\r\n?/g,B$=/\u0000|\uFFFD/g;function sb(c){return(typeof c=="string"?c:""+c).replace(z$,`
38
- `).replace(B$,"")}function m1(c,d,v){if(d=sb(d),sb(c)!==d&&v)throw Error(n(425))}function g1(){}var S2=null,E2=null;function C2(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 j2=typeof setTimeout=="function"?setTimeout:void 0,U$=typeof clearTimeout=="function"?clearTimeout:void 0,ab=typeof Promise=="function"?Promise:void 0,W$=typeof queueMicrotask=="function"?queueMicrotask:typeof ab<"u"?function(c){return ab.resolve(null).then(c).catch(K$)}:j2;function K$(c){setTimeout(function(){throw c})}function A2(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),fn(d);return}x--}else v!=="$"&&v!=="$?"&&v!=="$!"||x++;v=N}while(v);fn(d)}function ji(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 ob(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 Yc=Math.random().toString(36).slice(2),io="__reactFiber$"+Yc,Zd="__reactProps$"+Yc,Oo="__reactContainer$"+Yc,N2="__reactEvents$"+Yc,G$="__reactListeners$"+Yc,Y$="__reactHandles$"+Yc;function Hl(c){var d=c[io];if(d)return d;for(var v=c.parentNode;v;){if(d=v[Oo]||v[io]){if(v=d.alternate,d.child!==null||v!==null&&v.child!==null)for(c=ob(c);c!==null;){if(v=c[io])return v;c=ob(c)}return d}c=v,v=c.parentNode}return null}function zd(c){return c=c[io]||c[Oo],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function qc(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(n(33))}function v1(c){return c[Zd]||null}var M2=[],Xc=-1;function Ai(c){return{current:c}}function tr(c){0>Xc||(c.current=M2[Xc],M2[Xc]=null,Xc--)}function Yn(c,d){Xc++,M2[Xc]=c.current,c.current=d}var Ni={},Qr=Ai(Ni),Cs=Ai(!1),Ol=Ni;function Qc(c,d){var v=c.type.contextTypes;if(!v)return Ni;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 js(c){return c=c.childContextTypes,c!=null}function w1(){tr(Cs),tr(Qr)}function ib(c,d,v){if(Qr.current!==Ni)throw Error(n(168));Yn(Qr,d),Yn(Cs,v)}function lb(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,fe(c)||"Unknown",N));return Y({},v,x)}function y1(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Ni,Ol=Qr.current,Yn(Qr,c),Yn(Cs,Cs.current),!0}function cb(c,d,v){var x=c.stateNode;if(!x)throw Error(n(169));v?(c=lb(c,d,Ol),x.__reactInternalMemoizedMergedChildContext=c,tr(Cs),tr(Qr),Yn(Qr,c)):tr(Cs),Yn(Cs,v)}var Io=null,b1=!1,R2=!1;function ub(c){Io===null?Io=[c]:Io.push(c)}function q$(c){b1=!0,ub(c)}function Mi(){if(!R2&&Io!==null){R2=!0;var c=0,d=Mn;try{var v=Io;for(Mn=1;c<v.length;c++){var x=v[c];do x=x(!0);while(x!==null)}Io=null,b1=!1}catch(N){throw Io!==null&&(Io=Io.slice(c+1)),ve(nn,Mi),N}finally{Mn=d,R2=!1}}return null}var Jc=[],eu=0,x1=null,k1=0,aa=[],oa=0,Il=null,Fo=1,_o="";function Fl(c,d){Jc[eu++]=k1,Jc[eu++]=x1,x1=c,k1=d}function db(c,d,v){aa[oa++]=Fo,aa[oa++]=_o,aa[oa++]=Il,Il=c;var x=Fo;c=_o;var N=32-be(x)-1;x&=~(1<<N),v+=1;var $=32-be(d)+N;if(30<$){var U=N-N%5;$=(x&(1<<U)-1).toString(32),x>>=U,N-=U,Fo=1<<32-be(d)+N|v<<N|x,_o=$+c}else Fo=1<<$|v<<N|x,_o=c}function P2(c){c.return!==null&&(Fl(c,1),db(c,1,0))}function L2(c){for(;c===x1;)x1=Jc[--eu],Jc[eu]=null,k1=Jc[--eu],Jc[eu]=null;for(;c===Il;)Il=aa[--oa],aa[oa]=null,_o=aa[--oa],aa[oa]=null,Fo=aa[--oa],aa[oa]=null}var zs=null,Bs=null,sr=!1,$a=null;function fb(c,d){var v=ua(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 hb(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,zs=c,Bs=ji(d.firstChild),!0):!1;case 6:return d=c.pendingProps===""||d.nodeType!==3?null:d,d!==null?(c.stateNode=d,zs=c,Bs=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(v=Il!==null?{id:Fo,overflow:_o}:null,c.memoizedState={dehydrated:d,treeContext:v,retryLane:1073741824},v=ua(18,null,null,0),v.stateNode=d,v.return=c,c.child=v,zs=c,Bs=null,!0):!1;default:return!1}}function $2(c){return(c.mode&1)!==0&&(c.flags&128)===0}function T2(c){if(sr){var d=Bs;if(d){var v=d;if(!hb(c,d)){if($2(c))throw Error(n(418));d=ji(v.nextSibling);var x=zs;d&&hb(c,d)?fb(x,v):(c.flags=c.flags&-4097|2,sr=!1,zs=c)}}else{if($2(c))throw Error(n(418));c.flags=c.flags&-4097|2,sr=!1,zs=c}}}function pb(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;zs=c}function S1(c){if(c!==zs)return!1;if(!sr)return pb(c),sr=!0,!1;var d;if((d=c.tag!==3)&&!(d=c.tag!==5)&&(d=c.type,d=d!=="head"&&d!=="body"&&!C2(c.type,c.memoizedProps)),d&&(d=Bs)){if($2(c))throw mb(),Error(n(418));for(;d;)fb(c,d),d=ji(d.nextSibling)}if(pb(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){Bs=ji(c.nextSibling);break e}d--}else v!=="$"&&v!=="$!"&&v!=="$?"||d++}c=c.nextSibling}Bs=null}}else Bs=zs?ji(c.stateNode.nextSibling):null;return!0}function mb(){for(var c=Bs;c;)c=ji(c.nextSibling)}function tu(){Bs=zs=null,sr=!1}function D2(c){$a===null?$a=[c]:$a.push(c)}var X$=A.ReactCurrentBatchConfig;function Bd(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(U){var de=N.refs;U===null?delete de[$]:de[$]=U},d._stringRef=$,d)}if(typeof c!="string")throw Error(n(284));if(!v._owner)throw Error(n(290,c))}return c}function E1(c,d){throw c=Object.prototype.toString.call(d),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":c))}function gb(c){var d=c._init;return d(c._payload)}function vb(c){function d(Te,je){if(c){var He=Te.deletions;He===null?(Te.deletions=[je],Te.flags|=16):He.push(je)}}function v(Te,je){if(!c)return null;for(;je!==null;)d(Te,je),je=je.sibling;return null}function x(Te,je){for(Te=new Map;je!==null;)je.key!==null?Te.set(je.key,je):Te.set(je.index,je),je=je.sibling;return Te}function N(Te,je){return Te=Oi(Te,je),Te.index=0,Te.sibling=null,Te}function $(Te,je,He){return Te.index=He,c?(He=Te.alternate,He!==null?(He=He.index,He<je?(Te.flags|=2,je):He):(Te.flags|=2,je)):(Te.flags|=1048576,je)}function U(Te){return c&&Te.alternate===null&&(Te.flags|=2),Te}function de(Te,je,He,xt){return je===null||je.tag!==6?(je=jg(He,Te.mode,xt),je.return=Te,je):(je=N(je,He),je.return=Te,je)}function ye(Te,je,He,xt){var Vt=He.type;return Vt===M?ut(Te,je,He.props.children,xt,He.key):je!==null&&(je.elementType===Vt||typeof Vt=="object"&&Vt!==null&&Vt.$$typeof===K&&gb(Vt)===je.type)?(xt=N(je,He.props),xt.ref=Bd(Te,je,He),xt.return=Te,xt):(xt=G1(He.type,He.key,He.props,null,Te.mode,xt),xt.ref=Bd(Te,je,He),xt.return=Te,xt)}function ze(Te,je,He,xt){return je===null||je.tag!==4||je.stateNode.containerInfo!==He.containerInfo||je.stateNode.implementation!==He.implementation?(je=Ag(He,Te.mode,xt),je.return=Te,je):(je=N(je,He.children||[]),je.return=Te,je)}function ut(Te,je,He,xt,Vt){return je===null||je.tag!==7?(je=Kl(He,Te.mode,xt,Vt),je.return=Te,je):(je=N(je,He),je.return=Te,je)}function gt(Te,je,He){if(typeof je=="string"&&je!==""||typeof je=="number")return je=jg(""+je,Te.mode,He),je.return=Te,je;if(typeof je=="object"&&je!==null){switch(je.$$typeof){case P:return He=G1(je.type,je.key,je.props,null,Te.mode,He),He.ref=Bd(Te,null,je),He.return=Te,He;case T:return je=Ag(je,Te.mode,He),je.return=Te,je;case K:var xt=je._init;return gt(Te,xt(je._payload),He)}if(G(je)||O(je))return je=Kl(je,Te.mode,He,null),je.return=Te,je;E1(Te,je)}return null}function ct(Te,je,He,xt){var Vt=je!==null?je.key:null;if(typeof He=="string"&&He!==""||typeof He=="number")return Vt!==null?null:de(Te,je,""+He,xt);if(typeof He=="object"&&He!==null){switch(He.$$typeof){case P:return He.key===Vt?ye(Te,je,He,xt):null;case T:return He.key===Vt?ze(Te,je,He,xt):null;case K:return Vt=He._init,ct(Te,je,Vt(He._payload),xt)}if(G(He)||O(He))return Vt!==null?null:ut(Te,je,He,xt,null);E1(Te,He)}return null}function Pt(Te,je,He,xt,Vt){if(typeof xt=="string"&&xt!==""||typeof xt=="number")return Te=Te.get(He)||null,de(je,Te,""+xt,Vt);if(typeof xt=="object"&&xt!==null){switch(xt.$$typeof){case P:return Te=Te.get(xt.key===null?He:xt.key)||null,ye(je,Te,xt,Vt);case T:return Te=Te.get(xt.key===null?He:xt.key)||null,ze(je,Te,xt,Vt);case K:var qt=xt._init;return Pt(Te,je,He,qt(xt._payload),Vt)}if(G(xt)||O(xt))return Te=Te.get(He)||null,ut(je,Te,xt,Vt,null);E1(je,xt)}return null}function Ht(Te,je,He,xt){for(var Vt=null,qt=null,Xt=je,an=je=0,Fr=null;Xt!==null&&an<He.length;an++){Xt.index>an?(Fr=Xt,Xt=null):Fr=Xt.sibling;var Fn=ct(Te,Xt,He[an],xt);if(Fn===null){Xt===null&&(Xt=Fr);break}c&&Xt&&Fn.alternate===null&&d(Te,Xt),je=$(Fn,je,an),qt===null?Vt=Fn:qt.sibling=Fn,qt=Fn,Xt=Fr}if(an===He.length)return v(Te,Xt),sr&&Fl(Te,an),Vt;if(Xt===null){for(;an<He.length;an++)Xt=gt(Te,He[an],xt),Xt!==null&&(je=$(Xt,je,an),qt===null?Vt=Xt:qt.sibling=Xt,qt=Xt);return sr&&Fl(Te,an),Vt}for(Xt=x(Te,Xt);an<He.length;an++)Fr=Pt(Xt,Te,an,He[an],xt),Fr!==null&&(c&&Fr.alternate!==null&&Xt.delete(Fr.key===null?an:Fr.key),je=$(Fr,je,an),qt===null?Vt=Fr:qt.sibling=Fr,qt=Fr);return c&&Xt.forEach(function(Ii){return d(Te,Ii)}),sr&&Fl(Te,an),Vt}function Ft(Te,je,He,xt){var Vt=O(He);if(typeof Vt!="function")throw Error(n(150));if(He=Vt.call(He),He==null)throw Error(n(151));for(var qt=Vt=null,Xt=je,an=je=0,Fr=null,Fn=He.next();Xt!==null&&!Fn.done;an++,Fn=He.next()){Xt.index>an?(Fr=Xt,Xt=null):Fr=Xt.sibling;var Ii=ct(Te,Xt,Fn.value,xt);if(Ii===null){Xt===null&&(Xt=Fr);break}c&&Xt&&Ii.alternate===null&&d(Te,Xt),je=$(Ii,je,an),qt===null?Vt=Ii:qt.sibling=Ii,qt=Ii,Xt=Fr}if(Fn.done)return v(Te,Xt),sr&&Fl(Te,an),Vt;if(Xt===null){for(;!Fn.done;an++,Fn=He.next())Fn=gt(Te,Fn.value,xt),Fn!==null&&(je=$(Fn,je,an),qt===null?Vt=Fn:qt.sibling=Fn,qt=Fn);return sr&&Fl(Te,an),Vt}for(Xt=x(Te,Xt);!Fn.done;an++,Fn=He.next())Fn=Pt(Xt,Te,an,Fn.value,xt),Fn!==null&&(c&&Fn.alternate!==null&&Xt.delete(Fn.key===null?an:Fn.key),je=$(Fn,je,an),qt===null?Vt=Fn:qt.sibling=Fn,qt=Fn);return c&&Xt.forEach(function(RT){return d(Te,RT)}),sr&&Fl(Te,an),Vt}function gr(Te,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 P:e:{for(var Vt=He.key,qt=je;qt!==null;){if(qt.key===Vt){if(Vt=He.type,Vt===M){if(qt.tag===7){v(Te,qt.sibling),je=N(qt,He.props.children),je.return=Te,Te=je;break e}}else if(qt.elementType===Vt||typeof Vt=="object"&&Vt!==null&&Vt.$$typeof===K&&gb(Vt)===qt.type){v(Te,qt.sibling),je=N(qt,He.props),je.ref=Bd(Te,qt,He),je.return=Te,Te=je;break e}v(Te,qt);break}else d(Te,qt);qt=qt.sibling}He.type===M?(je=Kl(He.props.children,Te.mode,xt,He.key),je.return=Te,Te=je):(xt=G1(He.type,He.key,He.props,null,Te.mode,xt),xt.ref=Bd(Te,je,He),xt.return=Te,Te=xt)}return U(Te);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(Te,je.sibling),je=N(je,He.children||[]),je.return=Te,Te=je;break e}else{v(Te,je);break}else d(Te,je);je=je.sibling}je=Ag(He,Te.mode,xt),je.return=Te,Te=je}return U(Te);case K:return qt=He._init,gr(Te,je,qt(He._payload),xt)}if(G(He))return Ht(Te,je,He,xt);if(O(He))return Ft(Te,je,He,xt);E1(Te,He)}return typeof He=="string"&&He!==""||typeof He=="number"?(He=""+He,je!==null&&je.tag===6?(v(Te,je.sibling),je=N(je,He),je.return=Te,Te=je):(v(Te,je),je=jg(He,Te.mode,xt),je.return=Te,Te=je),U(Te)):v(Te,je)}return gr}var nu=vb(!0),wb=vb(!1),C1=Ai(null),j1=null,ru=null,H2=null;function O2(){H2=ru=j1=null}function I2(c){var d=C1.current;tr(C1),c._currentValue=d}function F2(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 su(c,d){j1=c,H2=ru=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&d)!==0&&(As=!0),c.firstContext=null)}function ia(c){var d=c._currentValue;if(H2!==c)if(c={context:c,memoizedValue:d,next:null},ru===null){if(j1===null)throw Error(n(308));ru=c,j1.dependencies={lanes:0,firstContext:c}}else ru=ru.next=c;return d}var _l=null;function _2(c){_l===null?_l=[c]:_l.push(c)}function yb(c,d,v,x){var N=d.interleaved;return N===null?(v.next=v,_2(d)):(v.next=N.next,N.next=v),d.interleaved=v,Vo(c,x)}function Vo(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 Ri=!1;function V2(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bb(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 Zo(c,d){return{eventTime:c,lane:d,tag:0,payload:null,callback:null,next:null}}function Pi(c,d,v){var x=c.updateQueue;if(x===null)return null;if(x=x.shared,(On&2)!==0){var N=x.pending;return N===null?d.next=d:(d.next=N.next,N.next=d),x.pending=d,Vo(c,v)}return N=x.interleaved,N===null?(d.next=d,_2(x)):(d.next=N.next,N.next=d),x.interleaved=d,Vo(c,v)}function A1(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,fs(c,v)}}function xb(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 U={eventTime:v.eventTime,lane:v.lane,tag:v.tag,payload:v.payload,callback:v.callback,next:null};$===null?N=$=U:$=$.next=U,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 N1(c,d,v,x){var N=c.updateQueue;Ri=!1;var $=N.firstBaseUpdate,U=N.lastBaseUpdate,de=N.shared.pending;if(de!==null){N.shared.pending=null;var ye=de,ze=ye.next;ye.next=null,U===null?$=ze:U.next=ze,U=ye;var ut=c.alternate;ut!==null&&(ut=ut.updateQueue,de=ut.lastBaseUpdate,de!==U&&(de===null?ut.firstBaseUpdate=ze:de.next=ze,ut.lastBaseUpdate=ye))}if($!==null){var gt=N.baseState;U=0,ut=ze=ye=null,de=$;do{var ct=de.lane,Pt=de.eventTime;if((x&ct)===ct){ut!==null&&(ut=ut.next={eventTime:Pt,lane:0,tag:de.tag,payload:de.payload,callback:de.callback,next:null});e:{var Ht=c,Ft=de;switch(ct=d,Pt=v,Ft.tag){case 1:if(Ht=Ft.payload,typeof Ht=="function"){gt=Ht.call(Pt,gt,ct);break e}gt=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=Ft.payload,ct=typeof Ht=="function"?Ht.call(Pt,gt,ct):Ht,ct==null)break e;gt=Y({},gt,ct);break e;case 2:Ri=!0}}de.callback!==null&&de.lane!==0&&(c.flags|=64,ct=N.effects,ct===null?N.effects=[de]:ct.push(de))}else Pt={eventTime:Pt,lane:ct,tag:de.tag,payload:de.payload,callback:de.callback,next:null},ut===null?(ze=ut=Pt,ye=gt):ut=ut.next=Pt,U|=ct;if(de=de.next,de===null){if(de=N.shared.pending,de===null)break;ct=de,de=ct.next,ct.next=null,N.lastBaseUpdate=ct,N.shared.pending=null}}while(!0);if(ut===null&&(ye=gt),N.baseState=ye,N.firstBaseUpdate=ze,N.lastBaseUpdate=ut,d=N.shared.interleaved,d!==null){N=d;do U|=N.lane,N=N.next;while(N!==d)}else $===null&&(N.shared.lanes=0);zl|=U,c.lanes=U,c.memoizedState=gt}}function kb(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 Ud={},lo=Ai(Ud),Wd=Ai(Ud),Kd=Ai(Ud);function Vl(c){if(c===Ud)throw Error(n(174));return c}function Z2(c,d){switch(Yn(Kd,d),Yn(Wd,c),Yn(lo,Ud),c=d.nodeType,c){case 9:case 11:d=(d=d.documentElement)?d.namespaceURI:Le(null,"");break;default:c=c===8?d.parentNode:d,d=c.namespaceURI||null,c=c.tagName,d=Le(d,c)}tr(lo),Yn(lo,d)}function au(){tr(lo),tr(Wd),tr(Kd)}function Sb(c){Vl(Kd.current);var d=Vl(lo.current),v=Le(d,c.type);d!==v&&(Yn(Wd,c),Yn(lo,v))}function z2(c){Wd.current===c&&(tr(lo),tr(Wd))}var or=Ai(0);function M1(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 B2=[];function U2(){for(var c=0;c<B2.length;c++)B2[c]._workInProgressVersionPrimary=null;B2.length=0}var R1=A.ReactCurrentDispatcher,W2=A.ReactCurrentBatchConfig,Zl=0,ir=null,Nr=null,Or=null,P1=!1,Gd=!1,Yd=0,Q$=0;function Jr(){throw Error(n(321))}function K2(c,d){if(d===null)return!1;for(var v=0;v<d.length&&v<c.length;v++)if(!La(c[v],d[v]))return!1;return!0}function G2(c,d,v,x,N,$){if(Zl=$,ir=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,R1.current=c===null||c.memoizedState===null?nT:rT,c=v(x,N),Gd){$=0;do{if(Gd=!1,Yd=0,25<=$)throw Error(n(301));$+=1,Or=Nr=null,d.updateQueue=null,R1.current=sT,c=v(x,N)}while(Gd)}if(R1.current=T1,d=Nr!==null&&Nr.next!==null,Zl=0,Or=Nr=ir=null,P1=!1,d)throw Error(n(300));return c}function Y2(){var c=Yd!==0;return Yd=0,c}function co(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Or===null?ir.memoizedState=Or=c:Or=Or.next=c,Or}function la(){if(Nr===null){var c=ir.alternate;c=c!==null?c.memoizedState:null}else c=Nr.next;var d=Or===null?ir.memoizedState:Or.next;if(d!==null)Or=d,Nr=c;else{if(c===null)throw Error(n(310));Nr=c,c={memoizedState:Nr.memoizedState,baseState:Nr.baseState,baseQueue:Nr.baseQueue,queue:Nr.queue,next:null},Or===null?ir.memoizedState=Or=c:Or=Or.next=c}return Or}function qd(c,d){return typeof d=="function"?d(c):d}function q2(c){var d=la(),v=d.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=c;var x=Nr,N=x.baseQueue,$=v.pending;if($!==null){if(N!==null){var U=N.next;N.next=$.next,$.next=U}x.baseQueue=N=$,v.pending=null}if(N!==null){$=N.next,x=x.baseState;var de=U=null,ye=null,ze=$;do{var ut=ze.lane;if((Zl&ut)===ut)ye!==null&&(ye=ye.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:ut,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null};ye===null?(de=ye=gt,U=x):ye=ye.next=gt,ir.lanes|=ut,zl|=ut}ze=ze.next}while(ze!==null&&ze!==$);ye===null?U=x:ye.next=de,La(x,d.memoizedState)||(As=!0),d.memoizedState=x,d.baseState=U,d.baseQueue=ye,v.lastRenderedState=x}if(c=v.interleaved,c!==null){N=c;do $=N.lane,ir.lanes|=$,zl|=$,N=N.next;while(N!==c)}else N===null&&(v.lanes=0);return[d.memoizedState,v.dispatch]}function X2(c){var d=la(),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 U=N=N.next;do $=c($,U.action),U=U.next;while(U!==N);La($,d.memoizedState)||(As=!0),d.memoizedState=$,d.baseQueue===null&&(d.baseState=$),v.lastRenderedState=$}return[$,x]}function Eb(){}function Cb(c,d){var v=ir,x=la(),N=d(),$=!La(x.memoizedState,N);if($&&(x.memoizedState=N,As=!0),x=x.queue,Q2(Nb.bind(null,v,x,c),[c]),x.getSnapshot!==d||$||Or!==null&&Or.memoizedState.tag&1){if(v.flags|=2048,Xd(9,Ab.bind(null,v,x,N,d),void 0,null),Ir===null)throw Error(n(349));(Zl&30)!==0||jb(v,d,N)}return N}function jb(c,d,v){c.flags|=16384,c={getSnapshot:d,value:v},d=ir.updateQueue,d===null?(d={lastEffect:null,stores:null},ir.updateQueue=d,d.stores=[c]):(v=d.stores,v===null?d.stores=[c]:v.push(c))}function Ab(c,d,v,x){d.value=v,d.getSnapshot=x,Mb(d)&&Rb(c)}function Nb(c,d,v){return v(function(){Mb(d)&&Rb(c)})}function Mb(c){var d=c.getSnapshot;c=c.value;try{var v=d();return!La(c,v)}catch{return!0}}function Rb(c){var d=Vo(c,1);d!==null&&Oa(d,c,1,-1)}function Pb(c){var d=co();return typeof c=="function"&&(c=c()),d.memoizedState=d.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:qd,lastRenderedState:c},d.queue=c,c=c.dispatch=tT.bind(null,ir,c),[d.memoizedState,c]}function Xd(c,d,v,x){return c={tag:c,create:d,destroy:v,deps:x,next:null},d=ir.updateQueue,d===null?(d={lastEffect:null,stores:null},ir.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 Lb(){return la().memoizedState}function L1(c,d,v,x){var N=co();ir.flags|=c,N.memoizedState=Xd(1|d,v,void 0,x===void 0?null:x)}function $1(c,d,v,x){var N=la();x=x===void 0?null:x;var $=void 0;if(Nr!==null){var U=Nr.memoizedState;if($=U.destroy,x!==null&&K2(x,U.deps)){N.memoizedState=Xd(d,v,$,x);return}}ir.flags|=c,N.memoizedState=Xd(1|d,v,$,x)}function $b(c,d){return L1(8390656,8,c,d)}function Q2(c,d){return $1(2048,8,c,d)}function Tb(c,d){return $1(4,2,c,d)}function Db(c,d){return $1(4,4,c,d)}function Hb(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 Ob(c,d,v){return v=v!=null?v.concat([c]):null,$1(4,4,Hb.bind(null,d,c),v)}function J2(){}function Ib(c,d){var v=la();d=d===void 0?null:d;var x=v.memoizedState;return x!==null&&d!==null&&K2(d,x[1])?x[0]:(v.memoizedState=[c,d],c)}function Fb(c,d){var v=la();d=d===void 0?null:d;var x=v.memoizedState;return x!==null&&d!==null&&K2(d,x[1])?x[0]:(c=c(),v.memoizedState=[c,d],c)}function _b(c,d,v){return(Zl&21)===0?(c.baseState&&(c.baseState=!1,As=!0),c.memoizedState=v):(La(v,d)||(v=Nn(),ir.lanes|=v,zl|=v,c.baseState=!0),d)}function J$(c,d){var v=Mn;Mn=v!==0&&4>v?v:4,c(!0);var x=W2.transition;W2.transition={};try{c(!1),d()}finally{Mn=v,W2.transition=x}}function Vb(){return la().memoizedState}function eT(c,d,v){var x=Di(c);if(v={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null},Zb(c))zb(d,v);else if(v=yb(c,d,v,x),v!==null){var N=ps();Oa(v,c,x,N),Bb(v,d,x)}}function tT(c,d,v){var x=Di(c),N={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null};if(Zb(c))zb(d,N);else{var $=c.alternate;if(c.lanes===0&&($===null||$.lanes===0)&&($=d.lastRenderedReducer,$!==null))try{var U=d.lastRenderedState,de=$(U,v);if(N.hasEagerState=!0,N.eagerState=de,La(de,U)){var ye=d.interleaved;ye===null?(N.next=N,_2(d)):(N.next=ye.next,ye.next=N),d.interleaved=N;return}}catch{}finally{}v=yb(c,d,N,x),v!==null&&(N=ps(),Oa(v,c,x,N),Bb(v,d,x))}}function Zb(c){var d=c.alternate;return c===ir||d!==null&&d===ir}function zb(c,d){Gd=P1=!0;var v=c.pending;v===null?d.next=d:(d.next=v.next,v.next=d),c.pending=d}function Bb(c,d,v){if((v&4194240)!==0){var x=d.lanes;x&=c.pendingLanes,v|=x,d.lanes=v,fs(c,v)}}var T1={readContext:ia,useCallback:Jr,useContext:Jr,useEffect:Jr,useImperativeHandle:Jr,useInsertionEffect:Jr,useLayoutEffect:Jr,useMemo:Jr,useReducer:Jr,useRef:Jr,useState:Jr,useDebugValue:Jr,useDeferredValue:Jr,useTransition:Jr,useMutableSource:Jr,useSyncExternalStore:Jr,useId:Jr,unstable_isNewReconciler:!1},nT={readContext:ia,useCallback:function(c,d){return co().memoizedState=[c,d===void 0?null:d],c},useContext:ia,useEffect:$b,useImperativeHandle:function(c,d,v){return v=v!=null?v.concat([c]):null,L1(4194308,4,Hb.bind(null,d,c),v)},useLayoutEffect:function(c,d){return L1(4194308,4,c,d)},useInsertionEffect:function(c,d){return L1(4,2,c,d)},useMemo:function(c,d){var v=co();return d=d===void 0?null:d,c=c(),v.memoizedState=[c,d],c},useReducer:function(c,d,v){var x=co();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=eT.bind(null,ir,c),[x.memoizedState,c]},useRef:function(c){var d=co();return c={current:c},d.memoizedState=c},useState:Pb,useDebugValue:J2,useDeferredValue:function(c){return co().memoizedState=c},useTransition:function(){var c=Pb(!1),d=c[0];return c=J$.bind(null,c[1]),co().memoizedState=c,[d,c]},useMutableSource:function(){},useSyncExternalStore:function(c,d,v){var x=ir,N=co();if(sr){if(v===void 0)throw Error(n(407));v=v()}else{if(v=d(),Ir===null)throw Error(n(349));(Zl&30)!==0||jb(x,d,v)}N.memoizedState=v;var $={value:v,getSnapshot:d};return N.queue=$,$b(Nb.bind(null,x,$,c),[c]),x.flags|=2048,Xd(9,Ab.bind(null,x,$,v,d),void 0,null),v},useId:function(){var c=co(),d=Ir.identifierPrefix;if(sr){var v=_o,x=Fo;v=(x&~(1<<32-be(x)-1)).toString(32)+v,d=":"+d+"R"+v,v=Yd++,0<v&&(d+="H"+v.toString(32)),d+=":"}else v=Q$++,d=":"+d+"r"+v.toString(32)+":";return c.memoizedState=d},unstable_isNewReconciler:!1},rT={readContext:ia,useCallback:Ib,useContext:ia,useEffect:Q2,useImperativeHandle:Ob,useInsertionEffect:Tb,useLayoutEffect:Db,useMemo:Fb,useReducer:q2,useRef:Lb,useState:function(){return q2(qd)},useDebugValue:J2,useDeferredValue:function(c){var d=la();return _b(d,Nr.memoizedState,c)},useTransition:function(){var c=q2(qd)[0],d=la().memoizedState;return[c,d]},useMutableSource:Eb,useSyncExternalStore:Cb,useId:Vb,unstable_isNewReconciler:!1},sT={readContext:ia,useCallback:Ib,useContext:ia,useEffect:Q2,useImperativeHandle:Ob,useInsertionEffect:Tb,useLayoutEffect:Db,useMemo:Fb,useReducer:X2,useRef:Lb,useState:function(){return X2(qd)},useDebugValue:J2,useDeferredValue:function(c){var d=la();return Nr===null?d.memoizedState=c:_b(d,Nr.memoizedState,c)},useTransition:function(){var c=X2(qd)[0],d=la().memoizedState;return[c,d]},useMutableSource:Eb,useSyncExternalStore:Cb,useId:Vb,unstable_isNewReconciler:!1};function Ta(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 eg(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 D1={isMounted:function(c){return(c=c._reactInternals)?st(c)===c:!1},enqueueSetState:function(c,d,v){c=c._reactInternals;var x=ps(),N=Di(c),$=Zo(x,N);$.payload=d,v!=null&&($.callback=v),d=Pi(c,$,N),d!==null&&(Oa(d,c,N,x),A1(d,c,N))},enqueueReplaceState:function(c,d,v){c=c._reactInternals;var x=ps(),N=Di(c),$=Zo(x,N);$.tag=1,$.payload=d,v!=null&&($.callback=v),d=Pi(c,$,N),d!==null&&(Oa(d,c,N,x),A1(d,c,N))},enqueueForceUpdate:function(c,d){c=c._reactInternals;var v=ps(),x=Di(c),N=Zo(v,x);N.tag=2,d!=null&&(N.callback=d),d=Pi(c,N,x),d!==null&&(Oa(d,c,x,v),A1(d,c,x))}};function Ub(c,d,v,x,N,$,U){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(x,$,U):d.prototype&&d.prototype.isPureReactComponent?!Od(v,x)||!Od(N,$):!0}function Wb(c,d,v){var x=!1,N=Ni,$=d.contextType;return typeof $=="object"&&$!==null?$=ia($):(N=js(d)?Ol:Qr.current,x=d.contextTypes,$=(x=x!=null)?Qc(c,N):Ni),d=new d(v,$),c.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=D1,c.stateNode=d,d._reactInternals=c,x&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=N,c.__reactInternalMemoizedMaskedChildContext=$),d}function Kb(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&&D1.enqueueReplaceState(d,d.state,null)}function tg(c,d,v,x){var N=c.stateNode;N.props=v,N.state=c.memoizedState,N.refs={},V2(c);var $=d.contextType;typeof $=="object"&&$!==null?N.context=ia($):($=js(d)?Ol:Qr.current,N.context=Qc(c,$)),N.state=c.memoizedState,$=d.getDerivedStateFromProps,typeof $=="function"&&(eg(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&&D1.enqueueReplaceState(N,N.state,null),N1(c,v,N,x),N.state=c.memoizedState),typeof N.componentDidMount=="function"&&(c.flags|=4194308)}function ou(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 ng(c,d,v){return{value:c,source:null,stack:v??null,digest:d??null}}function rg(c,d){try{console.error(d.value)}catch(v){setTimeout(function(){throw v})}}var aT=typeof WeakMap=="function"?WeakMap:Map;function Gb(c,d,v){v=Zo(-1,v),v.tag=3,v.payload={element:null};var x=d.value;return v.callback=function(){Z1||(Z1=!0,wg=x),rg(c,d)},v}function Yb(c,d,v){v=Zo(-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(){rg(c,d)}}var $=c.stateNode;return $!==null&&typeof $.componentDidCatch=="function"&&(v.callback=function(){rg(c,d),typeof x!="function"&&($i===null?$i=new Set([this]):$i.add(this));var U=d.stack;this.componentDidCatch(d.value,{componentStack:U!==null?U:""})}),v}function qb(c,d,v){var x=c.pingCache;if(x===null){x=c.pingCache=new aT;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=yT.bind(null,c,d,v),d.then(c,c))}function Xb(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 Qb(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=Zo(-1,1),d.tag=2,Pi(v,d,1))),v.lanes|=1),c):(c.flags|=65536,c.lanes=N,c)}var oT=A.ReactCurrentOwner,As=!1;function hs(c,d,v,x){d.child=c===null?wb(d,null,v,x):nu(d,c.child,v,x)}function Jb(c,d,v,x,N){v=v.render;var $=d.ref;return su(d,N),x=G2(c,d,v,x,$,N),v=Y2(),c!==null&&!As?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~N,zo(c,d,N)):(sr&&v&&P2(d),d.flags|=1,hs(c,d,x,N),d.child)}function e3(c,d,v,x,N){if(c===null){var $=v.type;return typeof $=="function"&&!Cg($)&&$.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(d.tag=15,d.type=$,t3(c,d,$,x,N)):(c=G1(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 U=$.memoizedProps;if(v=v.compare,v=v!==null?v:Od,v(U,x)&&c.ref===d.ref)return zo(c,d,N)}return d.flags|=1,c=Oi($,x),c.ref=d.ref,c.return=d,d.child=c}function t3(c,d,v,x,N){if(c!==null){var $=c.memoizedProps;if(Od($,x)&&c.ref===d.ref)if(As=!1,d.pendingProps=x=$,(c.lanes&N)!==0)(c.flags&131072)!==0&&(As=!0);else return d.lanes=c.lanes,zo(c,d,N)}return sg(c,d,v,x,N)}function n3(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},Yn(lu,Us),Us|=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,Yn(lu,Us),Us|=c,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=$!==null?$.baseLanes:v,Yn(lu,Us),Us|=x}else $!==null?(x=$.baseLanes|v,d.memoizedState=null):x=v,Yn(lu,Us),Us|=x;return hs(c,d,N,v),d.child}function r3(c,d){var v=d.ref;(c===null&&v!==null||c!==null&&c.ref!==v)&&(d.flags|=512,d.flags|=2097152)}function sg(c,d,v,x,N){var $=js(v)?Ol:Qr.current;return $=Qc(d,$),su(d,N),v=G2(c,d,v,x,$,N),x=Y2(),c!==null&&!As?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~N,zo(c,d,N)):(sr&&x&&P2(d),d.flags|=1,hs(c,d,v,N),d.child)}function s3(c,d,v,x,N){if(js(v)){var $=!0;y1(d)}else $=!1;if(su(d,N),d.stateNode===null)O1(c,d),Wb(d,v,x),tg(d,v,x,N),x=!0;else if(c===null){var U=d.stateNode,de=d.memoizedProps;U.props=de;var ye=U.context,ze=v.contextType;typeof ze=="object"&&ze!==null?ze=ia(ze):(ze=js(v)?Ol:Qr.current,ze=Qc(d,ze));var ut=v.getDerivedStateFromProps,gt=typeof ut=="function"||typeof U.getSnapshotBeforeUpdate=="function";gt||typeof U.UNSAFE_componentWillReceiveProps!="function"&&typeof U.componentWillReceiveProps!="function"||(de!==x||ye!==ze)&&Kb(d,U,x,ze),Ri=!1;var ct=d.memoizedState;U.state=ct,N1(d,x,U,N),ye=d.memoizedState,de!==x||ct!==ye||Cs.current||Ri?(typeof ut=="function"&&(eg(d,v,ut,x),ye=d.memoizedState),(de=Ri||Ub(d,v,de,x,ct,ye,ze))?(gt||typeof U.UNSAFE_componentWillMount!="function"&&typeof U.componentWillMount!="function"||(typeof U.componentWillMount=="function"&&U.componentWillMount(),typeof U.UNSAFE_componentWillMount=="function"&&U.UNSAFE_componentWillMount()),typeof U.componentDidMount=="function"&&(d.flags|=4194308)):(typeof U.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=x,d.memoizedState=ye),U.props=x,U.state=ye,U.context=ze,x=de):(typeof U.componentDidMount=="function"&&(d.flags|=4194308),x=!1)}else{U=d.stateNode,bb(c,d),de=d.memoizedProps,ze=d.type===d.elementType?de:Ta(d.type,de),U.props=ze,gt=d.pendingProps,ct=U.context,ye=v.contextType,typeof ye=="object"&&ye!==null?ye=ia(ye):(ye=js(v)?Ol:Qr.current,ye=Qc(d,ye));var Pt=v.getDerivedStateFromProps;(ut=typeof Pt=="function"||typeof U.getSnapshotBeforeUpdate=="function")||typeof U.UNSAFE_componentWillReceiveProps!="function"&&typeof U.componentWillReceiveProps!="function"||(de!==gt||ct!==ye)&&Kb(d,U,x,ye),Ri=!1,ct=d.memoizedState,U.state=ct,N1(d,x,U,N);var Ht=d.memoizedState;de!==gt||ct!==Ht||Cs.current||Ri?(typeof Pt=="function"&&(eg(d,v,Pt,x),Ht=d.memoizedState),(ze=Ri||Ub(d,v,ze,x,ct,Ht,ye)||!1)?(ut||typeof U.UNSAFE_componentWillUpdate!="function"&&typeof U.componentWillUpdate!="function"||(typeof U.componentWillUpdate=="function"&&U.componentWillUpdate(x,Ht,ye),typeof U.UNSAFE_componentWillUpdate=="function"&&U.UNSAFE_componentWillUpdate(x,Ht,ye)),typeof U.componentDidUpdate=="function"&&(d.flags|=4),typeof U.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof U.componentDidUpdate!="function"||de===c.memoizedProps&&ct===c.memoizedState||(d.flags|=4),typeof U.getSnapshotBeforeUpdate!="function"||de===c.memoizedProps&&ct===c.memoizedState||(d.flags|=1024),d.memoizedProps=x,d.memoizedState=Ht),U.props=x,U.state=Ht,U.context=ye,x=ze):(typeof U.componentDidUpdate!="function"||de===c.memoizedProps&&ct===c.memoizedState||(d.flags|=4),typeof U.getSnapshotBeforeUpdate!="function"||de===c.memoizedProps&&ct===c.memoizedState||(d.flags|=1024),x=!1)}return ag(c,d,v,x,$,N)}function ag(c,d,v,x,N,$){r3(c,d);var U=(d.flags&128)!==0;if(!x&&!U)return N&&cb(d,v,!1),zo(c,d,$);x=d.stateNode,oT.current=d;var de=U&&typeof v.getDerivedStateFromError!="function"?null:x.render();return d.flags|=1,c!==null&&U?(d.child=nu(d,c.child,null,$),d.child=nu(d,null,de,$)):hs(c,d,de,$),d.memoizedState=x.state,N&&cb(d,v,!0),d.child}function a3(c){var d=c.stateNode;d.pendingContext?ib(c,d.pendingContext,d.pendingContext!==d.context):d.context&&ib(c,d.context,!1),Z2(c,d.containerInfo)}function o3(c,d,v,x,N){return tu(),D2(N),d.flags|=256,hs(c,d,v,x),d.child}var og={dehydrated:null,treeContext:null,retryLane:0};function ig(c){return{baseLanes:c,cachePool:null,transitions:null}}function i3(c,d,v){var x=d.pendingProps,N=or.current,$=!1,U=(d.flags&128)!==0,de;if((de=U)||(de=c!==null&&c.memoizedState===null?!1:(N&2)!==0),de?($=!0,d.flags&=-129):(c===null||c.memoizedState!==null)&&(N|=1),Yn(or,N&1),c===null)return T2(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):(U=x.children,c=x.fallback,$?(x=d.mode,$=d.child,U={mode:"hidden",children:U},(x&1)===0&&$!==null?($.childLanes=0,$.pendingProps=U):$=Y1(U,x,0,null),c=Kl(c,x,v,null),$.return=d,c.return=d,$.sibling=c,d.child=$,d.child.memoizedState=ig(v),d.memoizedState=og,c):lg(d,U));if(N=c.memoizedState,N!==null&&(de=N.dehydrated,de!==null))return iT(c,d,U,x,de,N,v);if($){$=x.fallback,U=d.mode,N=c.child,de=N.sibling;var ye={mode:"hidden",children:x.children};return(U&1)===0&&d.child!==N?(x=d.child,x.childLanes=0,x.pendingProps=ye,d.deletions=null):(x=Oi(N,ye),x.subtreeFlags=N.subtreeFlags&14680064),de!==null?$=Oi(de,$):($=Kl($,U,v,null),$.flags|=2),$.return=d,x.return=d,x.sibling=$,d.child=x,x=$,$=d.child,U=c.child.memoizedState,U=U===null?ig(v):{baseLanes:U.baseLanes|v,cachePool:null,transitions:U.transitions},$.memoizedState=U,$.childLanes=c.childLanes&~v,d.memoizedState=og,x}return $=c.child,c=$.sibling,x=Oi($,{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 lg(c,d){return d=Y1({mode:"visible",children:d},c.mode,0,null),d.return=c,c.child=d}function H1(c,d,v,x){return x!==null&&D2(x),nu(d,c.child,null,v),c=lg(d,d.pendingProps.children),c.flags|=2,d.memoizedState=null,c}function iT(c,d,v,x,N,$,U){if(v)return d.flags&256?(d.flags&=-257,x=ng(Error(n(422))),H1(c,d,U,x)):d.memoizedState!==null?(d.child=c.child,d.flags|=128,null):($=x.fallback,N=d.mode,x=Y1({mode:"visible",children:x.children},N,0,null),$=Kl($,N,U,null),$.flags|=2,x.return=d,$.return=d,x.sibling=$,d.child=x,(d.mode&1)!==0&&nu(d,c.child,null,U),d.child.memoizedState=ig(U),d.memoizedState=og,$);if((d.mode&1)===0)return H1(c,d,U,null);if(N.data==="$!"){if(x=N.nextSibling&&N.nextSibling.dataset,x)var de=x.dgst;return x=de,$=Error(n(419)),x=ng($,x,void 0),H1(c,d,U,x)}if(de=(U&c.childLanes)!==0,As||de){if(x=Ir,x!==null){switch(U&-U){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|U))!==0?0:N,N!==0&&N!==$.retryLane&&($.retryLane=N,Vo(c,N),Oa(x,c,N,-1))}return Eg(),x=ng(Error(n(421))),H1(c,d,U,x)}return N.data==="$?"?(d.flags|=128,d.child=c.child,d=bT.bind(null,c),N._reactRetry=d,null):(c=$.treeContext,Bs=ji(N.nextSibling),zs=d,sr=!0,$a=null,c!==null&&(aa[oa++]=Fo,aa[oa++]=_o,aa[oa++]=Il,Fo=c.id,_o=c.overflow,Il=d),d=lg(d,x.children),d.flags|=4096,d)}function l3(c,d,v){c.lanes|=d;var x=c.alternate;x!==null&&(x.lanes|=d),F2(c.return,d,v)}function cg(c,d,v,x,N){var $=c.memoizedState;$===null?c.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:x,tail:v,tailMode:N}:($.isBackwards=d,$.rendering=null,$.renderingStartTime=0,$.last=x,$.tail=v,$.tailMode=N)}function c3(c,d,v){var x=d.pendingProps,N=x.revealOrder,$=x.tail;if(hs(c,d,x.children,v),x=or.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&&l3(c,v,d);else if(c.tag===19)l3(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(Yn(or,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&&M1(c)===null&&(N=v),v=v.sibling;v=N,v===null?(N=d.child,d.child=null):(N=v.sibling,v.sibling=null),cg(d,!1,N,v,$);break;case"backwards":for(v=null,N=d.child,d.child=null;N!==null;){if(c=N.alternate,c!==null&&M1(c)===null){d.child=N;break}c=N.sibling,N.sibling=v,v=N,N=c}cg(d,!0,v,null,$);break;case"together":cg(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function O1(c,d){(d.mode&1)===0&&c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2)}function zo(c,d,v){if(c!==null&&(d.dependencies=c.dependencies),zl|=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=Oi(c,c.pendingProps),d.child=v,v.return=d;c.sibling!==null;)c=c.sibling,v=v.sibling=Oi(c,c.pendingProps),v.return=d;v.sibling=null}return d.child}function lT(c,d,v){switch(d.tag){case 3:a3(d),tu();break;case 5:Sb(d);break;case 1:js(d.type)&&y1(d);break;case 4:Z2(d,d.stateNode.containerInfo);break;case 10:var x=d.type._context,N=d.memoizedProps.value;Yn(C1,x._currentValue),x._currentValue=N;break;case 13:if(x=d.memoizedState,x!==null)return x.dehydrated!==null?(Yn(or,or.current&1),d.flags|=128,null):(v&d.child.childLanes)!==0?i3(c,d,v):(Yn(or,or.current&1),c=zo(c,d,v),c!==null?c.sibling:null);Yn(or,or.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),Yn(or,or.current),x)break;return null;case 22:case 23:return d.lanes=0,n3(c,d,v)}return zo(c,d,v)}var u3,ug,d3,f3;u3=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}},ug=function(){},d3=function(c,d,v,x){var N=c.memoizedProps;if(N!==x){c=d.stateNode,Vl(lo.current);var $=null;switch(v){case"input":N=ke(c,N),x=ke(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=g1)}_t(v,x);var U;v=null;for(ze in N)if(!x.hasOwnProperty(ze)&&N.hasOwnProperty(ze)&&N[ze]!=null)if(ze==="style"){var de=N[ze];for(U in de)de.hasOwnProperty(U)&&(v||(v={}),v[U]="")}else ze!=="dangerouslySetInnerHTML"&&ze!=="children"&&ze!=="suppressContentEditableWarning"&&ze!=="suppressHydrationWarning"&&ze!=="autoFocus"&&(a.hasOwnProperty(ze)?$||($=[]):($=$||[]).push(ze,null));for(ze in x){var ye=x[ze];if(de=N!=null?N[ze]:void 0,x.hasOwnProperty(ze)&&ye!==de&&(ye!=null||de!=null))if(ze==="style")if(de){for(U in de)!de.hasOwnProperty(U)||ye&&ye.hasOwnProperty(U)||(v||(v={}),v[U]="");for(U in ye)ye.hasOwnProperty(U)&&de[U]!==ye[U]&&(v||(v={}),v[U]=ye[U])}else v||($||($=[]),$.push(ze,v)),v=ye;else ze==="dangerouslySetInnerHTML"?(ye=ye?ye.__html:void 0,de=de?de.__html:void 0,ye!=null&&de!==ye&&($=$||[]).push(ze,ye)):ze==="children"?typeof ye!="string"&&typeof ye!="number"||($=$||[]).push(ze,""+ye):ze!=="suppressContentEditableWarning"&&ze!=="suppressHydrationWarning"&&(a.hasOwnProperty(ze)?(ye!=null&&ze==="onScroll"&&er("scroll",c),$||de===ye||($=[])):($=$||[]).push(ze,ye))}v&&($=$||[]).push("style",v);var ze=$;(d.updateQueue=ze)&&(d.flags|=4)}},f3=function(c,d,v,x){v!==x&&(d.flags|=4)};function Qd(c,d){if(!sr)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 es(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 cT(c,d,v){var x=d.pendingProps;switch(L2(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return es(d),null;case 1:return js(d.type)&&w1(),es(d),null;case 3:return x=d.stateNode,au(),tr(Cs),tr(Qr),U2(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(c===null||c.child===null)&&(S1(d)?d.flags|=4:c===null||c.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,$a!==null&&(xg($a),$a=null))),ug(c,d),es(d),null;case 5:z2(d);var N=Vl(Kd.current);if(v=d.type,c!==null&&d.stateNode!=null)d3(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 es(d),null}if(c=Vl(lo.current),S1(d)){x=d.stateNode,v=d.type;var $=d.memoizedProps;switch(x[io]=d,x[Zd]=$,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<Fd.length;N++)er(Fd[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":Ze(x,$),er("invalid",x)}_t(v,$),N=null;for(var U in $)if($.hasOwnProperty(U)){var de=$[U];U==="children"?typeof de=="string"?x.textContent!==de&&($.suppressHydrationWarning!==!0&&m1(x.textContent,de,c),N=["children",de]):typeof de=="number"&&x.textContent!==""+de&&($.suppressHydrationWarning!==!0&&m1(x.textContent,de,c),N=["children",""+de]):a.hasOwnProperty(U)&&de!=null&&U==="onScroll"&&er("scroll",x)}switch(v){case"input":he(x),Qe(x,$,!0);break;case"textarea":he(x),q(x);break;case"select":case"option":break;default:typeof $.onClick=="function"&&(x.onclick=g1)}x=N,d.updateQueue=x,x!==null&&(d.flags|=4)}else{U=N.nodeType===9?N:N.ownerDocument,c==="http://www.w3.org/1999/xhtml"&&(c=ae(v)),c==="http://www.w3.org/1999/xhtml"?v==="script"?(c=U.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild)):typeof x.is=="string"?c=U.createElement(v,{is:x.is}):(c=U.createElement(v),v==="select"&&(U=c,x.multiple?U.multiple=!0:x.size&&(U.size=x.size))):c=U.createElementNS(c,v),c[io]=d,c[Zd]=x,u3(c,d,!1,!1),d.stateNode=c;e:{switch(U=Lt(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<Fd.length;N++)er(Fd[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=ke(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":Ze(c,x),N=We(c,x),er("invalid",c);break;default:N=x}_t(v,N),de=N;for($ in de)if(de.hasOwnProperty($)){var ye=de[$];$==="style"?St(c,ye):$==="dangerouslySetInnerHTML"?(ye=ye?ye.__html:void 0,ye!=null&&Je(c,ye)):$==="children"?typeof ye=="string"?(v!=="textarea"||ye!=="")&&ge(c,ye):typeof ye=="number"&&ge(c,""+ye):$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&$!=="autoFocus"&&(a.hasOwnProperty($)?ye!=null&&$==="onScroll"&&er("scroll",c):ye!=null&&E(c,$,ye,U))}switch(v){case"input":he(c),Qe(c,x,!1);break;case"textarea":he(c),q(c);break;case"option":x.value!=null&&c.setAttribute("value",""+re(x.value));break;case"select":c.multiple=!!x.multiple,$=x.value,$!=null?se(c,!!x.multiple,$,!1):x.defaultValue!=null&&se(c,!!x.multiple,x.defaultValue,!0);break;default:typeof N.onClick=="function"&&(c.onclick=g1)}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 es(d),null;case 6:if(c&&d.stateNode!=null)f3(c,d,c.memoizedProps,x);else{if(typeof x!="string"&&d.stateNode===null)throw Error(n(166));if(v=Vl(Kd.current),Vl(lo.current),S1(d)){if(x=d.stateNode,v=d.memoizedProps,x[io]=d,($=x.nodeValue!==v)&&(c=zs,c!==null))switch(c.tag){case 3:m1(x.nodeValue,v,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&m1(x.nodeValue,v,(c.mode&1)!==0)}$&&(d.flags|=4)}else x=(v.nodeType===9?v:v.ownerDocument).createTextNode(x),x[io]=d,d.stateNode=x}return es(d),null;case 13:if(tr(or),x=d.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(sr&&Bs!==null&&(d.mode&1)!==0&&(d.flags&128)===0)mb(),tu(),d.flags|=98560,$=!1;else if($=S1(d),x!==null&&x.dehydrated!==null){if(c===null){if(!$)throw Error(n(318));if($=d.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(n(317));$[io]=d}else tu(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;es(d),$=!1}else $a!==null&&(xg($a),$a=null),$=!0;if(!$)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=v,d):(x=x!==null,x!==(c!==null&&c.memoizedState!==null)&&x&&(d.child.flags|=8192,(d.mode&1)!==0&&(c===null||(or.current&1)!==0?Mr===0&&(Mr=3):Eg())),d.updateQueue!==null&&(d.flags|=4),es(d),null);case 4:return au(),ug(c,d),c===null&&_d(d.stateNode.containerInfo),es(d),null;case 10:return I2(d.type._context),es(d),null;case 17:return js(d.type)&&w1(),es(d),null;case 19:if(tr(or),$=d.memoizedState,$===null)return es(d),null;if(x=(d.flags&128)!==0,U=$.rendering,U===null)if(x)Qd($,!1);else{if(Mr!==0||c!==null&&(c.flags&128)!==0)for(c=d.child;c!==null;){if(U=M1(c),U!==null){for(d.flags|=128,Qd($,!1),x=U.updateQueue,x!==null&&(d.updateQueue=x,d.flags|=4),d.subtreeFlags=0,x=v,v=d.child;v!==null;)$=v,c=x,$.flags&=14680066,U=$.alternate,U===null?($.childLanes=0,$.lanes=c,$.child=null,$.subtreeFlags=0,$.memoizedProps=null,$.memoizedState=null,$.updateQueue=null,$.dependencies=null,$.stateNode=null):($.childLanes=U.childLanes,$.lanes=U.lanes,$.child=U.child,$.subtreeFlags=0,$.deletions=null,$.memoizedProps=U.memoizedProps,$.memoizedState=U.memoizedState,$.updateQueue=U.updateQueue,$.type=U.type,c=U.dependencies,$.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),v=v.sibling;return Yn(or,or.current&1|2),d.child}c=c.sibling}$.tail!==null&&Ge()>cu&&(d.flags|=128,x=!0,Qd($,!1),d.lanes=4194304)}else{if(!x)if(c=M1(U),c!==null){if(d.flags|=128,x=!0,v=c.updateQueue,v!==null&&(d.updateQueue=v,d.flags|=4),Qd($,!0),$.tail===null&&$.tailMode==="hidden"&&!U.alternate&&!sr)return es(d),null}else 2*Ge()-$.renderingStartTime>cu&&v!==1073741824&&(d.flags|=128,x=!0,Qd($,!1),d.lanes=4194304);$.isBackwards?(U.sibling=d.child,d.child=U):(v=$.last,v!==null?v.sibling=U:d.child=U,$.last=U)}return $.tail!==null?(d=$.tail,$.rendering=d,$.tail=d.sibling,$.renderingStartTime=Ge(),d.sibling=null,v=or.current,Yn(or,x?v&1|2:v&1),d):(es(d),null);case 22:case 23:return Sg(),x=d.memoizedState!==null,c!==null&&c.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Us&1073741824)!==0&&(es(d),d.subtreeFlags&6&&(d.flags|=8192)):es(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function uT(c,d){switch(L2(d),d.tag){case 1:return js(d.type)&&w1(),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return au(),tr(Cs),tr(Qr),U2(),c=d.flags,(c&65536)!==0&&(c&128)===0?(d.flags=c&-65537|128,d):null;case 5:return z2(d),null;case 13:if(tr(or),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(n(340));tu()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return tr(or),null;case 4:return au(),null;case 10:return I2(d.type._context),null;case 22:case 23:return Sg(),null;case 24:return null;default:return null}}var I1=!1,ts=!1,dT=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function iu(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 dg(c,d,v){try{v()}catch(x){pr(c,d,x)}}var h3=!1;function fT(c,d){if(S2=kn,c=Uy(),m2(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 U=0,de=-1,ye=-1,ze=0,ut=0,gt=c,ct=null;t:for(;;){for(var Pt;gt!==v||N!==0&&gt.nodeType!==3||(de=U+N),gt!==$||x!==0&&gt.nodeType!==3||(ye=U+x),gt.nodeType===3&&(U+=gt.nodeValue.length),(Pt=gt.firstChild)!==null;)ct=gt,gt=Pt;for(;;){if(gt===c)break t;if(ct===v&&++ze===N&&(de=U),ct===$&&++ut===x&&(ye=U),(Pt=gt.nextSibling)!==null)break;gt=ct,ct=gt.parentNode}gt=Pt}v=de===-1||ye===-1?null:{start:de,end:ye}}else v=null}v=v||{start:0,end:0}}else v=null;for(E2={focusedElem:c,selectionRange:v},kn=!1,Tt=d;Tt!==null;)if(d=Tt,c=d.child,(d.subtreeFlags&1028)!==0&&c!==null)c.return=d,Tt=c;else for(;Tt!==null;){d=Tt;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 Ft=Ht.memoizedProps,gr=Ht.memoizedState,Te=d.stateNode,je=Te.getSnapshotBeforeUpdate(d.elementType===d.type?Ft:Ta(d.type,Ft),gr);Te.__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,Tt=c;break}Tt=d.return}return Ht=h3,h3=!1,Ht}function Jd(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&&dg(d,v,$)}N=N.next}while(N!==x)}}function F1(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 fg(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 p3(c){var d=c.alternate;d!==null&&(c.alternate=null,p3(d)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(d=c.stateNode,d!==null&&(delete d[io],delete d[Zd],delete d[N2],delete d[G$],delete d[Y$])),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 m3(c){return c.tag===5||c.tag===3||c.tag===4}function g3(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||m3(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 hg(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=g1));else if(x!==4&&(c=c.child,c!==null))for(hg(c,d,v),c=c.sibling;c!==null;)hg(c,d,v),c=c.sibling}function pg(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(pg(c,d,v),c=c.sibling;c!==null;)pg(c,d,v),c=c.sibling}var Ur=null,Da=!1;function Li(c,d,v){for(v=v.child;v!==null;)v3(c,d,v),v=v.sibling}function v3(c,d,v){if(I&&typeof I.onCommitFiberUnmount=="function")try{I.onCommitFiberUnmount(tt,v)}catch{}switch(v.tag){case 5:ts||iu(v,d);case 6:var x=Ur,N=Da;Ur=null,Li(c,d,v),Ur=x,Da=N,Ur!==null&&(Da?(c=Ur,v=v.stateNode,c.nodeType===8?c.parentNode.removeChild(v):c.removeChild(v)):Ur.removeChild(v.stateNode));break;case 18:Ur!==null&&(Da?(c=Ur,v=v.stateNode,c.nodeType===8?A2(c.parentNode,v):c.nodeType===1&&A2(c,v),fn(c)):A2(Ur,v.stateNode));break;case 4:x=Ur,N=Da,Ur=v.stateNode.containerInfo,Da=!0,Li(c,d,v),Ur=x,Da=N;break;case 0:case 11:case 14:case 15:if(!ts&&(x=v.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){N=x=x.next;do{var $=N,U=$.destroy;$=$.tag,U!==void 0&&(($&2)!==0||($&4)!==0)&&dg(v,d,U),N=N.next}while(N!==x)}Li(c,d,v);break;case 1:if(!ts&&(iu(v,d),x=v.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=v.memoizedProps,x.state=v.memoizedState,x.componentWillUnmount()}catch(de){pr(v,d,de)}Li(c,d,v);break;case 21:Li(c,d,v);break;case 22:v.mode&1?(ts=(x=ts)||v.memoizedState!==null,Li(c,d,v),ts=x):Li(c,d,v);break;default:Li(c,d,v)}}function w3(c){var d=c.updateQueue;if(d!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new dT),d.forEach(function(x){var N=xT.bind(null,c,x);v.has(x)||(v.add(x),x.then(N,N))})}}function Ha(c,d){var v=d.deletions;if(v!==null)for(var x=0;x<v.length;x++){var N=v[x];try{var $=c,U=d,de=U;e:for(;de!==null;){switch(de.tag){case 5:Ur=de.stateNode,Da=!1;break e;case 3:Ur=de.stateNode.containerInfo,Da=!0;break e;case 4:Ur=de.stateNode.containerInfo,Da=!0;break e}de=de.return}if(Ur===null)throw Error(n(160));v3($,U,N),Ur=null,Da=!1;var ye=N.alternate;ye!==null&&(ye.return=null),N.return=null}catch(ze){pr(N,d,ze)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)y3(d,c),d=d.sibling}function y3(c,d){var v=c.alternate,x=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(Ha(d,c),uo(c),x&4){try{Jd(3,c,c.return),F1(3,c)}catch(Ft){pr(c,c.return,Ft)}try{Jd(5,c,c.return)}catch(Ft){pr(c,c.return,Ft)}}break;case 1:Ha(d,c),uo(c),x&512&&v!==null&&iu(v,v.return);break;case 5:if(Ha(d,c),uo(c),x&512&&v!==null&&iu(v,v.return),c.flags&32){var N=c.stateNode;try{ge(N,"")}catch(Ft){pr(c,c.return,Ft)}}if(x&4&&(N=c.stateNode,N!=null)){var $=c.memoizedProps,U=v!==null?v.memoizedProps:$,de=c.type,ye=c.updateQueue;if(c.updateQueue=null,ye!==null)try{de==="input"&&$.type==="radio"&&$.name!=null&&ft(N,$),Lt(de,U);var ze=Lt(de,$);for(U=0;U<ye.length;U+=2){var ut=ye[U],gt=ye[U+1];ut==="style"?St(N,gt):ut==="dangerouslySetInnerHTML"?Je(N,gt):ut==="children"?ge(N,gt):E(N,ut,gt,ze)}switch(de){case"input":Ue(N,$);break;case"textarea":oe(N,$);break;case"select":var ct=N._wrapperState.wasMultiple;N._wrapperState.wasMultiple=!!$.multiple;var Pt=$.value;Pt!=null?se(N,!!$.multiple,Pt,!1):ct!==!!$.multiple&&($.defaultValue!=null?se(N,!!$.multiple,$.defaultValue,!0):se(N,!!$.multiple,$.multiple?[]:"",!1))}N[Zd]=$}catch(Ft){pr(c,c.return,Ft)}}break;case 6:if(Ha(d,c),uo(c),x&4){if(c.stateNode===null)throw Error(n(162));N=c.stateNode,$=c.memoizedProps;try{N.nodeValue=$}catch(Ft){pr(c,c.return,Ft)}}break;case 3:if(Ha(d,c),uo(c),x&4&&v!==null&&v.memoizedState.isDehydrated)try{fn(d.containerInfo)}catch(Ft){pr(c,c.return,Ft)}break;case 4:Ha(d,c),uo(c);break;case 13:Ha(d,c),uo(c),N=c.child,N.flags&8192&&($=N.memoizedState!==null,N.stateNode.isHidden=$,!$||N.alternate!==null&&N.alternate.memoizedState!==null||(vg=Ge())),x&4&&w3(c);break;case 22:if(ut=v!==null&&v.memoizedState!==null,c.mode&1?(ts=(ze=ts)||ut,Ha(d,c),ts=ze):Ha(d,c),uo(c),x&8192){if(ze=c.memoizedState!==null,(c.stateNode.isHidden=ze)&&!ut&&(c.mode&1)!==0)for(Tt=c,ut=c.child;ut!==null;){for(gt=Tt=ut;Tt!==null;){switch(ct=Tt,Pt=ct.child,ct.tag){case 0:case 11:case 14:case 15:Jd(4,ct,ct.return);break;case 1:iu(ct,ct.return);var Ht=ct.stateNode;if(typeof Ht.componentWillUnmount=="function"){x=ct,v=ct.return;try{d=x,Ht.props=d.memoizedProps,Ht.state=d.memoizedState,Ht.componentWillUnmount()}catch(Ft){pr(x,v,Ft)}}break;case 5:iu(ct,ct.return);break;case 22:if(ct.memoizedState!==null){k3(gt);continue}}Pt!==null?(Pt.return=ct,Tt=Pt):k3(gt)}ut=ut.sibling}e:for(ut=null,gt=c;;){if(gt.tag===5){if(ut===null){ut=gt;try{N=gt.stateNode,ze?($=N.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none"):(de=gt.stateNode,ye=gt.memoizedProps.style,U=ye!=null&&ye.hasOwnProperty("display")?ye.display:null,de.style.display=pt("display",U))}catch(Ft){pr(c,c.return,Ft)}}}else if(gt.tag===6){if(ut===null)try{gt.stateNode.nodeValue=ze?"":gt.memoizedProps}catch(Ft){pr(c,c.return,Ft)}}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;ut===gt&&(ut=null),gt=gt.return}ut===gt&&(ut=null),gt.sibling.return=gt.return,gt=gt.sibling}}break;case 19:Ha(d,c),uo(c),x&4&&w3(c);break;case 21:break;default:Ha(d,c),uo(c)}}function uo(c){var d=c.flags;if(d&2){try{e:{for(var v=c.return;v!==null;){if(m3(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 $=g3(c);pg(c,$,N);break;case 3:case 4:var U=x.stateNode.containerInfo,de=g3(c);hg(c,de,U);break;default:throw Error(n(161))}}catch(ye){pr(c,c.return,ye)}c.flags&=-3}d&4096&&(c.flags&=-4097)}function hT(c,d,v){Tt=c,b3(c)}function b3(c,d,v){for(var x=(c.mode&1)!==0;Tt!==null;){var N=Tt,$=N.child;if(N.tag===22&&x){var U=N.memoizedState!==null||I1;if(!U){var de=N.alternate,ye=de!==null&&de.memoizedState!==null||ts;de=I1;var ze=ts;if(I1=U,(ts=ye)&&!ze)for(Tt=N;Tt!==null;)U=Tt,ye=U.child,U.tag===22&&U.memoizedState!==null?S3(N):ye!==null?(ye.return=U,Tt=ye):S3(N);for(;$!==null;)Tt=$,b3($),$=$.sibling;Tt=N,I1=de,ts=ze}x3(c)}else(N.subtreeFlags&8772)!==0&&$!==null?($.return=N,Tt=$):x3(c)}}function x3(c){for(;Tt!==null;){var d=Tt;if((d.flags&8772)!==0){var v=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:ts||F1(5,d);break;case 1:var x=d.stateNode;if(d.flags&4&&!ts)if(v===null)x.componentDidMount();else{var N=d.elementType===d.type?v.memoizedProps:Ta(d.type,v.memoizedProps);x.componentDidUpdate(N,v.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var $=d.updateQueue;$!==null&&kb(d,$,x);break;case 3:var U=d.updateQueue;if(U!==null){if(v=null,d.child!==null)switch(d.child.tag){case 5:v=d.child.stateNode;break;case 1:v=d.child.stateNode}kb(d,U,v)}break;case 5:var de=d.stateNode;if(v===null&&d.flags&4){v=de;var ye=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":ye.autoFocus&&v.focus();break;case"img":ye.src&&(v.src=ye.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var ze=d.alternate;if(ze!==null){var ut=ze.memoizedState;if(ut!==null){var gt=ut.dehydrated;gt!==null&&fn(gt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}ts||d.flags&512&&fg(d)}catch(ct){pr(d,d.return,ct)}}if(d===c){Tt=null;break}if(v=d.sibling,v!==null){v.return=d.return,Tt=v;break}Tt=d.return}}function k3(c){for(;Tt!==null;){var d=Tt;if(d===c){Tt=null;break}var v=d.sibling;if(v!==null){v.return=d.return,Tt=v;break}Tt=d.return}}function S3(c){for(;Tt!==null;){var d=Tt;try{switch(d.tag){case 0:case 11:case 15:var v=d.return;try{F1(4,d)}catch(ye){pr(d,v,ye)}break;case 1:var x=d.stateNode;if(typeof x.componentDidMount=="function"){var N=d.return;try{x.componentDidMount()}catch(ye){pr(d,N,ye)}}var $=d.return;try{fg(d)}catch(ye){pr(d,$,ye)}break;case 5:var U=d.return;try{fg(d)}catch(ye){pr(d,U,ye)}}}catch(ye){pr(d,d.return,ye)}if(d===c){Tt=null;break}var de=d.sibling;if(de!==null){de.return=d.return,Tt=de;break}Tt=d.return}}var pT=Math.ceil,_1=A.ReactCurrentDispatcher,mg=A.ReactCurrentOwner,ca=A.ReactCurrentBatchConfig,On=0,Ir=null,vr=null,Wr=0,Us=0,lu=Ai(0),Mr=0,e0=null,zl=0,V1=0,gg=0,t0=null,Ns=null,vg=0,cu=1/0,Bo=null,Z1=!1,wg=null,$i=null,z1=!1,Ti=null,B1=0,n0=0,yg=null,U1=-1,W1=0;function ps(){return(On&6)!==0?Ge():U1!==-1?U1:U1=Ge()}function Di(c){return(c.mode&1)===0?1:(On&2)!==0&&Wr!==0?Wr&-Wr:X$.transition!==null?(W1===0&&(W1=Nn()),W1):(c=Mn,c!==0||(c=window.event,c=c===void 0?16:i1(c.type)),c)}function Oa(c,d,v,x){if(50<n0)throw n0=0,yg=null,Error(n(185));sn(c,v,x),((On&2)===0||c!==Ir)&&(c===Ir&&((On&2)===0&&(V1|=v),Mr===4&&Hi(c,Wr)),Ms(c,x),v===1&&On===0&&(d.mode&1)===0&&(cu=Ge()+500,b1&&Mi()))}function Ms(c,d){var v=c.callbackNode;In(c,d);var x=wn(c,c===Ir?Wr:0);if(x===0)v!==null&&lt(v),c.callbackNode=null,c.callbackPriority=0;else if(d=x&-x,c.callbackPriority!==d){if(v!=null&&lt(v),d===1)c.tag===0?q$(C3.bind(null,c)):ub(C3.bind(null,c)),W$(function(){(On&6)===0&&Mi()}),v=null;else{switch(_s(x)){case 1:v=nn;break;case 4:v=Nt;break;case 16:v=Jt;break;case 536870912:v=_e;break;default:v=Jt}v=$3(v,E3.bind(null,c))}c.callbackPriority=d,c.callbackNode=v}}function E3(c,d){if(U1=-1,W1=0,(On&6)!==0)throw Error(n(327));var v=c.callbackNode;if(uu()&&c.callbackNode!==v)return null;var x=wn(c,c===Ir?Wr:0);if(x===0)return null;if((x&30)!==0||(x&c.expiredLanes)!==0||d)d=K1(c,x);else{d=x;var N=On;On|=2;var $=A3();(Ir!==c||Wr!==d)&&(Bo=null,cu=Ge()+500,Ul(c,d));do try{vT();break}catch(de){j3(c,de)}while(!0);O2(),_1.current=$,On=N,vr!==null?d=0:(Ir=null,Wr=0,d=Mr)}if(d!==0){if(d===2&&(N=dn(c),N!==0&&(x=N,d=bg(c,N))),d===1)throw v=e0,Ul(c,0),Hi(c,x),Ms(c,Ge()),v;if(d===6)Hi(c,x);else{if(N=c.current.alternate,(x&30)===0&&!mT(N)&&(d=K1(c,x),d===2&&($=dn(c),$!==0&&(x=$,d=bg(c,$))),d===1))throw v=e0,Ul(c,0),Hi(c,x),Ms(c,Ge()),v;switch(c.finishedWork=N,c.finishedLanes=x,d){case 0:case 1:throw Error(n(345));case 2:Wl(c,Ns,Bo);break;case 3:if(Hi(c,x),(x&130023424)===x&&(d=vg+500-Ge(),10<d)){if(wn(c,0)!==0)break;if(N=c.suspendedLanes,(N&x)!==x){ps(),c.pingedLanes|=c.suspendedLanes&N;break}c.timeoutHandle=j2(Wl.bind(null,c,Ns,Bo),d);break}Wl(c,Ns,Bo);break;case 4:if(Hi(c,x),(x&4194240)===x)break;for(d=c.eventTimes,N=-1;0<x;){var U=31-be(x);$=1<<U,U=d[U],U>N&&(N=U),x&=~$}if(x=N,x=Ge()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*pT(x/1960))-x,10<x){c.timeoutHandle=j2(Wl.bind(null,c,Ns,Bo),x);break}Wl(c,Ns,Bo);break;case 5:Wl(c,Ns,Bo);break;default:throw Error(n(329))}}}return Ms(c,Ge()),c.callbackNode===v?E3.bind(null,c):null}function bg(c,d){var v=t0;return c.current.memoizedState.isDehydrated&&(Ul(c,d).flags|=256),c=K1(c,d),c!==2&&(d=Ns,Ns=v,d!==null&&xg(d)),c}function xg(c){Ns===null?Ns=c:Ns.push.apply(Ns,c)}function mT(c){for(var d=c;;){if(d.flags&16384){var v=d.updateQueue;if(v!==null&&(v=v.stores,v!==null))for(var x=0;x<v.length;x++){var N=v[x],$=N.getSnapshot;N=N.value;try{if(!La($(),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 Hi(c,d){for(d&=~gg,d&=~V1,c.suspendedLanes|=d,c.pingedLanes&=~d,c=c.expirationTimes;0<d;){var v=31-be(d),x=1<<v;c[v]=-1,d&=~x}}function C3(c){if((On&6)!==0)throw Error(n(327));uu();var d=wn(c,0);if((d&1)===0)return Ms(c,Ge()),null;var v=K1(c,d);if(c.tag!==0&&v===2){var x=dn(c);x!==0&&(d=x,v=bg(c,x))}if(v===1)throw v=e0,Ul(c,0),Hi(c,d),Ms(c,Ge()),v;if(v===6)throw Error(n(345));return c.finishedWork=c.current.alternate,c.finishedLanes=d,Wl(c,Ns,Bo),Ms(c,Ge()),null}function kg(c,d){var v=On;On|=1;try{return c(d)}finally{On=v,On===0&&(cu=Ge()+500,b1&&Mi())}}function Bl(c){Ti!==null&&Ti.tag===0&&(On&6)===0&&uu();var d=On;On|=1;var v=ca.transition,x=Mn;try{if(ca.transition=null,Mn=1,c)return c()}finally{Mn=x,ca.transition=v,On=d,(On&6)===0&&Mi()}}function Sg(){Us=lu.current,tr(lu)}function Ul(c,d){c.finishedWork=null,c.finishedLanes=0;var v=c.timeoutHandle;if(v!==-1&&(c.timeoutHandle=-1,U$(v)),vr!==null)for(v=vr.return;v!==null;){var x=v;switch(L2(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&w1();break;case 3:au(),tr(Cs),tr(Qr),U2();break;case 5:z2(x);break;case 4:au();break;case 13:tr(or);break;case 19:tr(or);break;case 10:I2(x.type._context);break;case 22:case 23:Sg()}v=v.return}if(Ir=c,vr=c=Oi(c.current,null),Wr=Us=d,Mr=0,e0=null,gg=V1=zl=0,Ns=t0=null,_l!==null){for(d=0;d<_l.length;d++)if(v=_l[d],x=v.interleaved,x!==null){v.interleaved=null;var N=x.next,$=v.pending;if($!==null){var U=$.next;$.next=N,x.next=U}v.pending=x}_l=null}return c}function j3(c,d){do{var v=vr;try{if(O2(),R1.current=T1,P1){for(var x=ir.memoizedState;x!==null;){var N=x.queue;N!==null&&(N.pending=null),x=x.next}P1=!1}if(Zl=0,Or=Nr=ir=null,Gd=!1,Yd=0,mg.current=null,v===null||v.return===null){Mr=1,e0=d,vr=null;break}e:{var $=c,U=v.return,de=v,ye=d;if(d=Wr,de.flags|=32768,ye!==null&&typeof ye=="object"&&typeof ye.then=="function"){var ze=ye,ut=de,gt=ut.tag;if((ut.mode&1)===0&&(gt===0||gt===11||gt===15)){var ct=ut.alternate;ct?(ut.updateQueue=ct.updateQueue,ut.memoizedState=ct.memoizedState,ut.lanes=ct.lanes):(ut.updateQueue=null,ut.memoizedState=null)}var Pt=Xb(U);if(Pt!==null){Pt.flags&=-257,Qb(Pt,U,de,$,d),Pt.mode&1&&qb($,ze,d),d=Pt,ye=ze;var Ht=d.updateQueue;if(Ht===null){var Ft=new Set;Ft.add(ye),d.updateQueue=Ft}else Ht.add(ye);break e}else{if((d&1)===0){qb($,ze,d),Eg();break e}ye=Error(n(426))}}else if(sr&&de.mode&1){var gr=Xb(U);if(gr!==null){(gr.flags&65536)===0&&(gr.flags|=256),Qb(gr,U,de,$,d),D2(ou(ye,de));break e}}$=ye=ou(ye,de),Mr!==4&&(Mr=2),t0===null?t0=[$]:t0.push($),$=U;do{switch($.tag){case 3:$.flags|=65536,d&=-d,$.lanes|=d;var Te=Gb($,ye,d);xb($,Te);break e;case 1:de=ye;var je=$.type,He=$.stateNode;if(($.flags&128)===0&&(typeof je.getDerivedStateFromError=="function"||He!==null&&typeof He.componentDidCatch=="function"&&($i===null||!$i.has(He)))){$.flags|=65536,d&=-d,$.lanes|=d;var xt=Yb($,de,d);xb($,xt);break e}}$=$.return}while($!==null)}M3(v)}catch(Vt){d=Vt,vr===v&&v!==null&&(vr=v=v.return);continue}break}while(!0)}function A3(){var c=_1.current;return _1.current=T1,c===null?T1:c}function Eg(){(Mr===0||Mr===3||Mr===2)&&(Mr=4),Ir===null||(zl&268435455)===0&&(V1&268435455)===0||Hi(Ir,Wr)}function K1(c,d){var v=On;On|=2;var x=A3();(Ir!==c||Wr!==d)&&(Bo=null,Ul(c,d));do try{gT();break}catch(N){j3(c,N)}while(!0);if(O2(),On=v,_1.current=x,vr!==null)throw Error(n(261));return Ir=null,Wr=0,Mr}function gT(){for(;vr!==null;)N3(vr)}function vT(){for(;vr!==null&&!dt();)N3(vr)}function N3(c){var d=L3(c.alternate,c,Us);c.memoizedProps=c.pendingProps,d===null?M3(c):vr=d,mg.current=null}function M3(c){var d=c;do{var v=d.alternate;if(c=d.return,(d.flags&32768)===0){if(v=cT(v,d,Us),v!==null){vr=v;return}}else{if(v=uT(v,d),v!==null){v.flags&=32767,vr=v;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{Mr=6,vr=null;return}}if(d=d.sibling,d!==null){vr=d;return}vr=d=c}while(d!==null);Mr===0&&(Mr=5)}function Wl(c,d,v){var x=Mn,N=ca.transition;try{ca.transition=null,Mn=1,wT(c,d,v,x)}finally{ca.transition=N,Mn=x}return null}function wT(c,d,v,x){do uu();while(Ti!==null);if((On&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(ar(c,$),c===Ir&&(vr=Ir=null,Wr=0),(v.subtreeFlags&2064)===0&&(v.flags&2064)===0||z1||(z1=!0,$3(Jt,function(){return uu(),null})),$=(v.flags&15990)!==0,(v.subtreeFlags&15990)!==0||$){$=ca.transition,ca.transition=null;var U=Mn;Mn=1;var de=On;On|=4,mg.current=null,fT(c,v),y3(v,c),I$(E2),kn=!!S2,E2=S2=null,c.current=v,hT(v),$e(),On=de,Mn=U,ca.transition=$}else c.current=v;if(z1&&(z1=!1,Ti=c,B1=N),$=c.pendingLanes,$===0&&($i=null),ue(v.stateNode),Ms(c,Ge()),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(Z1)throw Z1=!1,c=wg,wg=null,c;return(B1&1)!==0&&c.tag!==0&&uu(),$=c.pendingLanes,($&1)!==0?c===yg?n0++:(n0=0,yg=c):n0=0,Mi(),null}function uu(){if(Ti!==null){var c=_s(B1),d=ca.transition,v=Mn;try{if(ca.transition=null,Mn=16>c?16:c,Ti===null)var x=!1;else{if(c=Ti,Ti=null,B1=0,(On&6)!==0)throw Error(n(331));var N=On;for(On|=4,Tt=c.current;Tt!==null;){var $=Tt,U=$.child;if((Tt.flags&16)!==0){var de=$.deletions;if(de!==null){for(var ye=0;ye<de.length;ye++){var ze=de[ye];for(Tt=ze;Tt!==null;){var ut=Tt;switch(ut.tag){case 0:case 11:case 15:Jd(8,ut,$)}var gt=ut.child;if(gt!==null)gt.return=ut,Tt=gt;else for(;Tt!==null;){ut=Tt;var ct=ut.sibling,Pt=ut.return;if(p3(ut),ut===ze){Tt=null;break}if(ct!==null){ct.return=Pt,Tt=ct;break}Tt=Pt}}}var Ht=$.alternate;if(Ht!==null){var Ft=Ht.child;if(Ft!==null){Ht.child=null;do{var gr=Ft.sibling;Ft.sibling=null,Ft=gr}while(Ft!==null)}}Tt=$}}if(($.subtreeFlags&2064)!==0&&U!==null)U.return=$,Tt=U;else e:for(;Tt!==null;){if($=Tt,($.flags&2048)!==0)switch($.tag){case 0:case 11:case 15:Jd(9,$,$.return)}var Te=$.sibling;if(Te!==null){Te.return=$.return,Tt=Te;break e}Tt=$.return}}var je=c.current;for(Tt=je;Tt!==null;){U=Tt;var He=U.child;if((U.subtreeFlags&2064)!==0&&He!==null)He.return=U,Tt=He;else e:for(U=je;Tt!==null;){if(de=Tt,(de.flags&2048)!==0)try{switch(de.tag){case 0:case 11:case 15:F1(9,de)}}catch(Vt){pr(de,de.return,Vt)}if(de===U){Tt=null;break e}var xt=de.sibling;if(xt!==null){xt.return=de.return,Tt=xt;break e}Tt=de.return}}if(On=N,Mi(),I&&typeof I.onPostCommitFiberRoot=="function")try{I.onPostCommitFiberRoot(tt,c)}catch{}x=!0}return x}finally{Mn=v,ca.transition=d}}return!1}function R3(c,d,v){d=ou(v,d),d=Gb(c,d,1),c=Pi(c,d,1),d=ps(),c!==null&&(sn(c,1,d),Ms(c,d))}function pr(c,d,v){if(c.tag===3)R3(c,c,v);else for(;d!==null;){if(d.tag===3){R3(d,c,v);break}else if(d.tag===1){var x=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&($i===null||!$i.has(x))){c=ou(v,c),c=Yb(d,c,1),d=Pi(d,c,1),c=ps(),d!==null&&(sn(d,1,c),Ms(d,c));break}}d=d.return}}function yT(c,d,v){var x=c.pingCache;x!==null&&x.delete(d),d=ps(),c.pingedLanes|=c.suspendedLanes&v,Ir===c&&(Wr&v)===v&&(Mr===4||Mr===3&&(Wr&130023424)===Wr&&500>Ge()-vg?Ul(c,0):gg|=v),Ms(c,d)}function P3(c,d){d===0&&((c.mode&1)===0?d=1:(d=It,It<<=1,(It&130023424)===0&&(It=4194304)));var v=ps();c=Vo(c,d),c!==null&&(sn(c,d,v),Ms(c,v))}function bT(c){var d=c.memoizedState,v=0;d!==null&&(v=d.retryLane),P3(c,v)}function xT(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),P3(c,v)}var L3;L3=function(c,d,v){if(c!==null)if(c.memoizedProps!==d.pendingProps||Cs.current)As=!0;else{if((c.lanes&v)===0&&(d.flags&128)===0)return As=!1,lT(c,d,v);As=(c.flags&131072)!==0}else As=!1,sr&&(d.flags&1048576)!==0&&db(d,k1,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;O1(c,d),c=d.pendingProps;var N=Qc(d,Qr.current);su(d,v),N=G2(null,d,x,c,N,v);var $=Y2();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,js(x)?($=!0,y1(d)):$=!1,d.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,V2(d),N.updater=D1,d.stateNode=N,N._reactInternals=d,tg(d,x,c,v),d=ag(null,d,x,!0,$,v)):(d.tag=0,sr&&$&&P2(d),hs(null,d,N,v),d=d.child),d;case 16:x=d.elementType;e:{switch(O1(c,d),c=d.pendingProps,N=x._init,x=N(x._payload),d.type=x,N=d.tag=ST(x),c=Ta(x,c),N){case 0:d=sg(null,d,x,c,v);break e;case 1:d=s3(null,d,x,c,v);break e;case 11:d=Jb(null,d,x,c,v);break e;case 14:d=e3(null,d,x,Ta(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:Ta(x,N),sg(c,d,x,N,v);case 1:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ta(x,N),s3(c,d,x,N,v);case 3:e:{if(a3(d),c===null)throw Error(n(387));x=d.pendingProps,$=d.memoizedState,N=$.element,bb(c,d),N1(d,x,null,v);var U=d.memoizedState;if(x=U.element,$.isDehydrated)if($={element:x,isDehydrated:!1,cache:U.cache,pendingSuspenseBoundaries:U.pendingSuspenseBoundaries,transitions:U.transitions},d.updateQueue.baseState=$,d.memoizedState=$,d.flags&256){N=ou(Error(n(423)),d),d=o3(c,d,x,v,N);break e}else if(x!==N){N=ou(Error(n(424)),d),d=o3(c,d,x,v,N);break e}else for(Bs=ji(d.stateNode.containerInfo.firstChild),zs=d,sr=!0,$a=null,v=wb(d,null,x,v),d.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(tu(),x===N){d=zo(c,d,v);break e}hs(c,d,x,v)}d=d.child}return d;case 5:return Sb(d),c===null&&T2(d),x=d.type,N=d.pendingProps,$=c!==null?c.memoizedProps:null,U=N.children,C2(x,N)?U=null:$!==null&&C2(x,$)&&(d.flags|=32),r3(c,d),hs(c,d,U,v),d.child;case 6:return c===null&&T2(d),null;case 13:return i3(c,d,v);case 4:return Z2(d,d.stateNode.containerInfo),x=d.pendingProps,c===null?d.child=nu(d,null,x,v):hs(c,d,x,v),d.child;case 11:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ta(x,N),Jb(c,d,x,N,v);case 7:return hs(c,d,d.pendingProps,v),d.child;case 8:return hs(c,d,d.pendingProps.children,v),d.child;case 12:return hs(c,d,d.pendingProps.children,v),d.child;case 10:e:{if(x=d.type._context,N=d.pendingProps,$=d.memoizedProps,U=N.value,Yn(C1,x._currentValue),x._currentValue=U,$!==null)if(La($.value,U)){if($.children===N.children&&!Cs.current){d=zo(c,d,v);break e}}else for($=d.child,$!==null&&($.return=d);$!==null;){var de=$.dependencies;if(de!==null){U=$.child;for(var ye=de.firstContext;ye!==null;){if(ye.context===x){if($.tag===1){ye=Zo(-1,v&-v),ye.tag=2;var ze=$.updateQueue;if(ze!==null){ze=ze.shared;var ut=ze.pending;ut===null?ye.next=ye:(ye.next=ut.next,ut.next=ye),ze.pending=ye}}$.lanes|=v,ye=$.alternate,ye!==null&&(ye.lanes|=v),F2($.return,v,d),de.lanes|=v;break}ye=ye.next}}else if($.tag===10)U=$.type===d.type?null:$.child;else if($.tag===18){if(U=$.return,U===null)throw Error(n(341));U.lanes|=v,de=U.alternate,de!==null&&(de.lanes|=v),F2(U,v,d),U=$.sibling}else U=$.child;if(U!==null)U.return=$;else for(U=$;U!==null;){if(U===d){U=null;break}if($=U.sibling,$!==null){$.return=U.return,U=$;break}U=U.return}$=U}hs(c,d,N.children,v),d=d.child}return d;case 9:return N=d.type,x=d.pendingProps.children,su(d,v),N=ia(N),x=x(N),d.flags|=1,hs(c,d,x,v),d.child;case 14:return x=d.type,N=Ta(x,d.pendingProps),N=Ta(x.type,N),e3(c,d,x,N,v);case 15:return t3(c,d,d.type,d.pendingProps,v);case 17:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ta(x,N),O1(c,d),d.tag=1,js(x)?(c=!0,y1(d)):c=!1,su(d,v),Wb(d,x,N),tg(d,x,N,v),ag(null,d,x,!0,c,v);case 19:return c3(c,d,v);case 22:return n3(c,d,v)}throw Error(n(156,d.tag))};function $3(c,d){return ve(c,d)}function kT(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 ua(c,d,v,x){return new kT(c,d,v,x)}function Cg(c){return c=c.prototype,!(!c||!c.isReactComponent)}function ST(c){if(typeof c=="function")return Cg(c)?1:0;if(c!=null){if(c=c.$$typeof,c===D)return 11;if(c===W)return 14}return 2}function Oi(c,d){var v=c.alternate;return v===null?(v=ua(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 G1(c,d,v,x,N,$){var U=2;if(x=c,typeof c=="function")Cg(c)&&(U=1);else if(typeof c=="string")U=5;else e:switch(c){case M:return Kl(v.children,N,$,d);case j:U=8,N|=8;break;case R:return c=ua(12,v,d,N|2),c.elementType=R,c.lanes=$,c;case B:return c=ua(13,v,d,N),c.elementType=B,c.lanes=$,c;case V:return c=ua(19,v,d,N),c.elementType=V,c.lanes=$,c;case F:return Y1(v,N,$,d);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case L:U=10;break e;case H:U=9;break e;case D:U=11;break e;case W:U=14;break e;case K:U=16,x=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return d=ua(U,v,d,N),d.elementType=c,d.type=x,d.lanes=$,d}function Kl(c,d,v,x){return c=ua(7,c,x,d),c.lanes=v,c}function Y1(c,d,v,x){return c=ua(22,c,x,d),c.elementType=F,c.lanes=v,c.stateNode={isHidden:!1},c}function jg(c,d,v){return c=ua(6,c,null,d),c.lanes=v,c}function Ag(c,d,v){return d=ua(4,c.children!==null?c.children:[],c.key,d),d.lanes=v,d.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},d}function ET(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=Kn(0),this.expirationTimes=Kn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kn(0),this.identifierPrefix=x,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function Ng(c,d,v,x,N,$,U,de,ye){return c=new ET(c,d,v,de,ye),d===1?(d=1,$===!0&&(d|=8)):d=0,$=ua(3,null,null,d),c.current=$,$.stateNode=c,$.memoizedState={element:x,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},V2($),c}function CT(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 T3(c){if(!c)return Ni;c=c._reactInternals;e:{if(st(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(js(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(js(v))return lb(c,v,d)}return d}function D3(c,d,v,x,N,$,U,de,ye){return c=Ng(v,x,!0,c,N,$,U,de,ye),c.context=T3(null),v=c.current,x=ps(),N=Di(v),$=Zo(x,N),$.callback=d??null,Pi(v,$,N),c.current.lanes=N,sn(c,N,x),Ms(c,x),c}function q1(c,d,v,x){var N=d.current,$=ps(),U=Di(N);return v=T3(v),d.context===null?d.context=v:d.pendingContext=v,d=Zo($,U),d.payload={element:c},x=x===void 0?null:x,x!==null&&(d.callback=x),c=Pi(N,d,U),c!==null&&(Oa(c,N,U,$),A1(c,N,U)),U}function X1(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 H3(c,d){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v<d?v:d}}function Mg(c,d){H3(c,d),(c=c.alternate)&&H3(c,d)}function jT(){return null}var O3=typeof reportError=="function"?reportError:function(c){console.error(c)};function Rg(c){this._internalRoot=c}Q1.prototype.render=Rg.prototype.render=function(c){var d=this._internalRoot;if(d===null)throw Error(n(409));q1(c,d,null,null)},Q1.prototype.unmount=Rg.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var d=c.containerInfo;Bl(function(){q1(null,c,null,null)}),d[Oo]=null}};function Q1(c){this._internalRoot=c}Q1.prototype.unstable_scheduleHydration=function(c){if(c){var d=ln();c={blockedOn:null,target:c,priority:d};for(var v=0;v<Ar.length&&d!==0&&d<Ar[v].priority;v++);Ar.splice(v,0,c),v===0&&De(c)}};function Pg(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function J1(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function I3(){}function AT(c,d,v,x,N){if(N){if(typeof x=="function"){var $=x;x=function(){var ze=X1(U);$.call(ze)}}var U=D3(d,x,c,0,null,!1,!1,"",I3);return c._reactRootContainer=U,c[Oo]=U.current,_d(c.nodeType===8?c.parentNode:c),Bl(),U}for(;N=c.lastChild;)c.removeChild(N);if(typeof x=="function"){var de=x;x=function(){var ze=X1(ye);de.call(ze)}}var ye=Ng(c,0,!1,null,null,!1,!1,"",I3);return c._reactRootContainer=ye,c[Oo]=ye.current,_d(c.nodeType===8?c.parentNode:c),Bl(function(){q1(d,ye,v,x)}),ye}function eh(c,d,v,x,N){var $=v._reactRootContainer;if($){var U=$;if(typeof N=="function"){var de=N;N=function(){var ye=X1(U);de.call(ye)}}q1(d,U,c,N)}else U=AT(v,d,c,N,x);return X1(U)}na=function(c){switch(c.tag){case 3:var d=c.stateNode;if(d.current.memoizedState.isDehydrated){var v=Dt(d.pendingLanes);v!==0&&(fs(d,v|1),Ms(d,Ge()),(On&6)===0&&(cu=Ge()+500,Mi()))}break;case 13:Bl(function(){var x=Vo(c,1);if(x!==null){var N=ps();Oa(x,c,1,N)}}),Mg(c,1)}},ra=function(c){if(c.tag===13){var d=Vo(c,134217728);if(d!==null){var v=ps();Oa(d,c,134217728,v)}Mg(c,134217728)}},so=function(c){if(c.tag===13){var d=Di(c),v=Vo(c,d);if(v!==null){var x=ps();Oa(v,c,d,x)}Mg(c,d)}},ln=function(){return Mn},bn=function(c,d){var v=Mn;try{return Mn=c,d()}finally{Mn=v}},$t=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=v1(x);if(!N)throw Error(n(90));Me(x),Ue(x,N)}}}break;case"textarea":oe(c,v);break;case"select":d=v.value,d!=null&&se(c,!!v.multiple,d,!1)}},rt=kg,tn=Bl;var NT={usingClientEntryPoint:!1,Events:[zd,qc,v1,qe,ot,kg]},r0={findFiberByHostInstance:Hl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},MT={bundleType:r0.bundleType,version:r0.version,rendererPackageName:r0.rendererPackageName,rendererConfig:r0.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=Xe(c),c===null?null:c.stateNode},findFiberByHostInstance:r0.findFiberByHostInstance||jT,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 th=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!th.isDisabled&&th.supportsFiber)try{tt=th.inject(MT),I=th}catch{}}return Rs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NT,Rs.createPortal=function(c,d){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pg(d))throw Error(n(200));return CT(c,d,null,v)},Rs.createRoot=function(c,d){if(!Pg(c))throw Error(n(299));var v=!1,x="",N=O3;return d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(x=d.identifierPrefix),d.onRecoverableError!==void 0&&(N=d.onRecoverableError)),d=Ng(c,1,!1,null,null,v,!1,x,N),c[Oo]=d.current,_d(c.nodeType===8?c.parentNode:c),new Rg(d)},Rs.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=Xe(d),c=c===null?null:c.stateNode,c},Rs.flushSync=function(c){return Bl(c)},Rs.hydrate=function(c,d,v){if(!J1(d))throw Error(n(200));return eh(null,c,d,!0,v)},Rs.hydrateRoot=function(c,d,v){if(!Pg(c))throw Error(n(405));var x=v!=null&&v.hydratedSources||null,N=!1,$="",U=O3;if(v!=null&&(v.unstable_strictMode===!0&&(N=!0),v.identifierPrefix!==void 0&&($=v.identifierPrefix),v.onRecoverableError!==void 0&&(U=v.onRecoverableError)),d=D3(d,null,c,1,v??null,N,!1,$,U),c[Oo]=d.current,_d(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 Q1(d)},Rs.render=function(c,d,v){if(!J1(d))throw Error(n(200));return eh(null,c,d,!1,v)},Rs.unmountComponentAtNode=function(c){if(!J1(c))throw Error(n(40));return c._reactRootContainer?(Bl(function(){eh(null,null,c,!1,function(){c._reactRootContainer=null,c[Oo]=null})}),!0):!1},Rs.unstable_batchedUpdates=kg,Rs.unstable_renderSubtreeIntoContainer=function(c,d,v,x){if(!J1(v))throw Error(n(200));if(c==null||c._reactInternals===void 0)throw Error(n(38));return eh(c,d,v,!1,x)},Rs.version="18.3.1-next-f1338f8080-20240426",Rs}var Y3;function M9(){if(Y3)return Dg.exports;Y3=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(),Dg.exports=OT(),Dg.exports}var q3;function IT(){if(q3)return nh;q3=1;var e=M9();return nh.createRoot=e.createRoot,nh.hydrateRoot=e.hydrateRoot,nh}var FT=IT();/**
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 R9=e=>{throw TypeError(e)},P9=(e,t,n)=>t.has(e)||R9("Cannot "+n),fa=(e,t,n)=>(P9(e,t,"read from private field"),n?n.call(e):t.get(e)),b0=(e,t,n)=>t.has(e)?R9("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),fo=(e,t,n,r)=>(P9(e,t,"write to private field"),t.set(e,n),n),zp=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Bp=/^[\\/]{2}/;function L9(e,t){return t+e.replace(/\\/g,"/")}var X3="popstate";function Q3(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function _T(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 Z0("",{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:ws(a)}return ZT(t,n,null,e)}function hn(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 VT(){return Math.random().toString(36).substring(2,10)}function J3(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 Z0(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Po(t):t,state:n,key:t&&t.key||r||VT(),mask:a}}function ws({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 Po(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 ZT(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 C=Q3(k)?k:Z0(b.location,k,S);h=p()+1;let E=J3(C,h),A=b.createHref(C.mask||C);try{l.pushState(E,"",A)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;a.location.assign(A)}i&&f&&f({action:u,location:b.location,delta:1})}function w(k,S){u="REPLACE";let C=Q3(k)?k:Z0(b.location,k,S);h=p();let E=J3(C,h),A=b.createHref(C.mask||C);l.replaceState(E,"",A),i&&f&&f({action:u,location:b.location,delta:0})}function y(k){return $9(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(X3,m),f=k,()=>{a.removeEventListener(X3,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 $9(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),hn(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:ws(t);return a=a.replace(/ $/,"%20"),!n&&Bp.test(a)&&(a=r+a),new URL(a,r)}var x0,ex=class{constructor(e){if(b0(this,x0,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(fa(this,x0).has(e))return fa(this,x0).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){fa(this,x0).set(e,t)}};x0=new WeakMap;var zT=new Set(["lazy","caseSensitive","path","id","index","children"]);function BT(e){return zT.has(e)}var UT=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function WT(e){return UT.has(e)}function KT(e){return e.index===!0}function z0(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(hn(i.index!==!0||!i.children,"Cannot specify children on an index route"),hn(a||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),KT(i)){let h={...i,id:f};return r[f]=tx(h,t(h)),h}else{let h={...i,id:f,children:void 0};return r[f]=tx(h,t(h)),i.children&&(h.children=z0(i.children,t,u,r,a)),h}})}function tx(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function T9(e,t,n="/"){return Ia(e,t,n,!1)}function Ia(e,t,n,r,a){let i=typeof t=="string"?Po(t):t,l=Xs(i.pathname||"/",n);if(l==null)return null;let u=a??Dh(e),f=null,h=_9(l);for(let p=0;f==null&&p<u.length;++p)f=rD(u[p],h,r);return f}function D9(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 Dh(e){let t=H9(e);return GT(t),t}function H9(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;hn(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=xa([r,p.relativePath]),g=n.concat(p);l.children&&l.children.length>0&&(hn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),H9(l.children,t,g,m,f)),!(l.path==null&&!l.index)&&t.push({path:m,score:tD(m,l.index),routesMeta:g.map((w,y)=>{let[b,k]=F9(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 O9(l.path))i(l,u,!0,h)}),t}function O9(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=O9(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 GT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:nD(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var YT=/^:[\w-]+$/,qT=3,XT=2,QT=1,JT=10,eD=-2,nx=e=>e==="*";function tD(e,t){let n=e.split("/"),r=n.length;return n.some(nx)&&(r+=eD),t&&(r+=XT),n.filter(a=>!nx(a)).reduce((a,i)=>a+(YT.test(i)?qT:i===""?QT:JT),r)}function nD(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 rD(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?I9(m,p,f.matcher,f.compiledParams):cl(m,p),w=f.route;if(!g&&h&&n&&!r[r.length-1].route.index&&(g=cl({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},p)),!g)return null;Object.assign(a,g.params),l.push({params:a,pathname:xa([i,g.pathname]),pathnameBase:oD(xa([i,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(i=xa([i,g.pathnameBase]))}return l}function us(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 hn(g==="?"||y!=null,`Missing ":${m}" param`),encodeURIComponent(a(y))+w}return l.replace(/\?$/g,"")}).filter(l=>!!l);return r+i.join("/")}function cl(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=F9(e.path,e.caseSensitive,e.end);return I9(e,t,n,r)}function I9(e,t,n,r){let a=t.match(n);if(!a)return null;let i=a[0],l=Qu(i,1),u=a.slice(1);return{params:r.reduce((h,{paramName:p,isOptional:m},g)=>{if(p==="*"){let y=u[g]||"";l=Qu(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 F9(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 _9(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 Xs(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 sD({basename:e,pathname:t}){return t==="/"?e:xa([e,t])}var Y4=e=>zp.test(e);function aD(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Po(e):e,i;return n?(n=q4(n),n.startsWith("/")||n.startsWith("\\")?i=rx(n.substring(1),"/"):i=rx(n,t)):i=t,{pathname:i,search:iD(r),hash:lD(a)}}function rx(e,t){let n=Qu(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Ig(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 V9(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Up(e){let t=V9(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function yf(e,t,n,r=!1){let a;typeof e=="string"?a=Po(e):(a={...e},hn(!a.pathname||!a.pathname.includes("?"),Ig("?","pathname","search",a)),hn(!a.pathname||!a.pathname.includes("#"),Ig("#","pathname","hash",a)),hn(!a.search||!a.search.includes("#"),Ig("#","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=aD(a,u),h=l&&l!=="/"&&l.endsWith("/"),p=(i||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||p)&&(f.pathname+="/"),f}var q4=e=>e.replace(/[\\/]{2,}/g,"/"),xa=e=>q4(e.join("/"));function Qu(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 oD=e=>Qu(e).replace(/^\/*/,"/"),iD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,lD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,cD=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],bf=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 B0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function xf(e){let t=e.map(n=>n.route.path).filter(Boolean);return xa(t)||"/"}var Z9=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function z9(e,t){let n=e;if(typeof n!="string"||!zp.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Z9)try{let i=new URL(window.location.href),l=Bp.test(n)?new URL(L9(n,i.protocol)):new URL(n),u=Xs(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 Ji=Symbol("Uninstrumented");function uD(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=Ru(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=Ru(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[Ji]??i,u=Ru(n[a],l,(...f)=>sx(f[0]));u&&(a==="loader"&&l.hydrate===!0&&(u.hydrate=!0),u[Ji]=l,r[a]=u)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let i=a[Ji]??a,l=Ru(n.middleware,i,(...u)=>sx(u[0]));return l?(l[Ji]=i,l):a})),r}function dD(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[Ji]??e.navigate,a=Ru(n.navigate,r,(...i)=>{let[l,u]=i;return{to:typeof l=="number"||typeof l=="string"?l:l?ws(l):".",...ax(e,u??{})}});a&&(a[Ji]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[Ji]??e.fetch,a=Ru(n.fetch,r,(...i)=>{let[l,,u,f]=i;return{href:u??".",fetcherKey:l,...ax(e,f??{})}});a&&(a[Ji]=r,e.fetch=a)}return e}function Ru(e,t,n){return e.length===0?null:async(...r)=>{let a=await B9(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function B9(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=B9(e,t,n,r-1),i=await l,hn(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 sx(e){let{request:t,context:n,params:r,pattern:a}=e;return{request:fD(t),params:{...r},pattern:a,context:hD(n)}}function ax(e,t){return{currentUrl:ws(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 fD(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function hD(e){if(mD(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var pD=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function mD(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===pD}var ox=new URL("http://localhost");function X4(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),ox)}catch{return ox}}function Fg(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function gD(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 Hu(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&&!Fg(a,n),u=!Fg(i,n);if(r==="reject"){if(l||u)throw new Error("External navigation is not allowed")}else if(u&&(a==null||!gD(e,a)||!Fg(a,i)))throw new Error("External navigation is not allowed")}var U9=["POST","PUT","PATCH","DELETE"],vD=new Set(U9),wD=["GET",...U9],yD=new Set(wD),W9=new Set([301,302,303,307,308]),bD=new Set([307,308]),_g={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},xD={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},a0={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},kD=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),K9="remix-router-transitions",G9=Symbol("ResetLoaderData"),ec,ku,Zi,Su,SD=class{constructor(e){b0(this,ec),b0(this,ku),b0(this,Zi),b0(this,Su),fo(this,ec,e),fo(this,ku,Dh(e))}get stableRoutes(){return fa(this,ec)}get activeRoutes(){return fa(this,Zi)??fa(this,ec)}get branches(){return fa(this,Su)??fa(this,ku)}get hasHMRRoutes(){return fa(this,Zi)!=null}setRoutes(e){fo(this,ec,e),fo(this,ku,Dh(e))}setHmrRoutes(e){fo(this,Zi,e),fo(this,Su,Dh(e))}commitHmrRoutes(){fa(this,Zi)&&(fo(this,ec,fa(this,Zi)),fo(this,ku,fa(this,Su)),fo(this,Zi,void 0),fo(this,Su,void 0))}};ec=new WeakMap;ku=new WeakMap;Zi=new WeakMap;Su=new WeakMap;function ED(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";hn(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||kD,i=a;if(e.instrumentations){let te=e.instrumentations;i=ie=>({...a(ie),...uD(te.map(pe=>pe.route).filter(Boolean),ie)})}let l={},u=new SD(z0(e.routes,i,void 0,l)),f=e.basename||"/";f.startsWith("/")||(f=`/${f}`);let h=e.dataStrategy||MD,p={...e.future},m=null,g=new Set,w=null,y=null,b=null,k=null,S=e.hydrationData!=null,C=Ia(u.activeRoutes,e.history.location,f,!1,u.branches),E=!1,A=null,P,T;if(C==null&&!e.patchRoutesOnNavigation){let te=pa(404,{pathname:e.history.location.pathname}),{matches:ie,route:pe}=rh(u.activeRoutes);P=!0,T=!P,C=ie,A={[pe.id]:te}}else if(C&&!e.hydrationData&&Qt(C,u.activeRoutes,e.history.location.pathname).active&&(C=null),C)if(C.some(te=>te.route.lazy))P=!1,T=!P;else if(!C.some(te=>Q4(te.route)))P=!0,T=!P;else{let te=e.hydrationData?e.hydrationData.loaderData:null,ie=e.hydrationData?e.hydrationData.errors:null,pe=C;if(ie){let Fe=C.findIndex(Oe=>ie[Oe.route.id]!==void 0);pe=pe.slice(0,Fe+1)}T=!1,P=!0,pe.forEach(Fe=>{let Oe=Y9(Fe.route,te,ie);T=T||Oe.renderFallback,P=P&&!Oe.shouldLoad})}else{P=!1,T=!P,C=[];let te=Qt(null,u.activeRoutes,e.history.location.pathname);te.active&&te.matches&&(E=!0,C=te.matches)}let M,j={historyAction:e.history.action,location:e.history.location,matches:C,initialized:P,renderFallback:T,navigation:_g,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",L=null,H=!1,D,B=!1,V=new Map,W=null,K=!1,F=!1,_=new Set,O=new Map,Y=0,z=-1,X=new Map,Z=new Set,J=new Map,me=new Map,ne=new Set,fe=new Map,re,ee=null;function Q(){if(m=e.history.listen(({action:te,location:ie,delta:pe})=>{if(re){re(),re=void 0;return}nr(fe.size===0||pe!=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 Fe=Ke({currentLocation:j.location,nextLocation:ie,historyAction:te});if(Fe&&pe!=null){let Oe=new Promise(mt=>{re=mt});e.history.go(pe*-1),Se(Fe,{state:"blocked",location:ie,proceed(){Se(Fe,{state:"proceeding",proceed:void 0,reset:void 0,location:ie}),Oe.then(()=>e.history.go(pe))},reset(){let mt=new Map(j.blockers);mt.set(Fe,a0),ce({blockers:mt})}}),L==null||L.resolve(),L=null;return}return Ue(te,ie)}),n){GD(t,V);let te=()=>YD(t,V);t.addEventListener("pagehide",te),W=()=>t.removeEventListener("pagehide",te)}return j.initialized||Ue("POP",j.location,{initialHydration:!0}),M}function he(){m&&m(),W&&W(),g.clear(),D&&D.abort(),j.fetchers.forEach((te,ie)=>pt(j.fetchers,ie)),j.blockers.forEach((te,ie)=>$t(ie))}function Me(te){if(g.add(te),w){let{newErrors:ie}=w;w=null,te(j,{deletedFetchers:[],newErrors:ie,viewTransitionOpts:void 0,flushSync:!1})}return()=>g.delete(te)}function ce(te,ie={}){te.matches&&(te.matches=te.matches.map(Oe=>{let mt=l[Oe.route.id],yt=Oe.route;return yt.element!==mt.element||yt.errorElement!==mt.errorElement||yt.hydrateFallbackElement!==mt.hydrateFallbackElement?{...Oe,route:mt}:Oe})),j={...j,...te};let pe=[],Fe=[];j.fetchers.forEach((Oe,mt)=>{Oe.state==="idle"&&(ne.has(mt)?pe.push(mt):Fe.push(mt))}),ne.forEach(Oe=>{!j.fetchers.has(Oe)&&!O.has(Oe)&&pe.push(Oe)}),g.size===0&&(w={newErrors:te.errors??null}),[...g].forEach(Oe=>Oe(j,{deletedFetchers:pe,newErrors:te.errors??null,viewTransitionOpts:ie.viewTransitionOpts,flushSync:ie.flushSync===!0})),pe.forEach(Oe=>pt(j.fetchers,Oe)),Fe.forEach(Oe=>j.fetchers.delete(Oe))}function ke(te,ie,{flushSync:pe}={}){var Ae,xe;let Fe=j.actionData!=null&&j.navigation.formMethod!=null&&ss(j.navigation.formMethod)&&j.navigation.state==="loading"&&((Ae=te.state)==null?void 0:Ae._isRedirect)!==!0,Oe;ie.actionData?Object.keys(ie.actionData).length>0?Oe=ie.actionData:Oe=null:Fe?Oe=j.actionData:Oe=null;let mt=ie.loaderData?gx(j.loaderData,ie.loaderData,ie.matches||[],ie.errors):j.loaderData,yt=j.blockers;yt.size>0&&(yt=new Map(yt),yt.forEach((Xe,Ct)=>yt.set(Ct,a0)));let Et=K?!1:tn(te,ie.matches||j.matches),st=H===!0||j.navigation.formMethod!=null&&ss(j.navigation.formMethod)&&((xe=te.state)==null?void 0:xe._isRedirect)!==!0;u.commitHmrRoutes(),K||R==="POP"||(R==="PUSH"?e.history.push(te,te.state):R==="REPLACE"&&e.history.replace(te,te.state));let vt;if(R==="POP"){let Xe=V.get(j.location.pathname);Xe&&Xe.has(te.pathname)?vt={currentLocation:j.location,nextLocation:te}:V.has(te.pathname)&&(vt={currentLocation:te,nextLocation:j.location})}else if(B){let Xe=V.get(j.location.pathname);Xe?Xe.add(te.pathname):(Xe=new Set([te.pathname]),V.set(j.location.pathname,Xe)),vt={currentLocation:j.location,nextLocation:te}}ce({...ie,actionData:Oe,loaderData:mt,historyAction:R,location:te,initialized:!0,renderFallback:!1,navigation:_g,revalidation:"idle",restoreScrollPosition:Et,preventScrollReset:st,blockers:yt},{viewTransitionOpts:vt,flushSync:pe===!0}),R="POP",H=!1,B=!1,K=!1,F=!1,L==null||L.resolve(),L=null,ee==null||ee.resolve(),ee=null}async function Be(te,ie){if(L==null||L.resolve(),L=null,typeof te=="number"){L||(L=bx());let ve=L.promise;return e.history.go(te),ve}let pe=d6(j.location,j.matches,f,te,ie==null?void 0:ie.fromRouteId,ie==null?void 0:ie.relative),{path:Fe,submission:Oe,error:mt}=ix(!1,pe,ie),yt;if(ie!=null&&ie.mask){let ve=typeof ie.mask=="string"?Po(ie.mask):{...j.location.mask,...ie.mask};if(yt={pathname:ve.pathname??"",search:ve.search??"",hash:ve.hash??""},Bp.test(yt.pathname))throw new Error("External navigation is not allowed");yt.pathname.startsWith("\\")&&(yt.pathname=yt.pathname.replace(/^\\+/,"/")),Hu(typeof ie.mask=="string"?ie.mask:ws(ie.mask),ws(yt),e.history.createURL("/"),"reject")}let Et=j.location,st=Z0(Et,Fe,ie&&ie.state,void 0,yt);st={...st,...e.history.encodeLocation(st)},Hu(te==null?e.history.createHref(j.location):typeof te=="string"?te:ws(te),e.history.createHref(st.mask||st),e.history.createURL("/"),"reject");let vt=ie&&ie.replace!=null?ie.replace:void 0,Ae="PUSH";vt===!0?Ae="REPLACE":vt===!1||Oe!=null&&ss(Oe.formMethod)&&Oe.formAction===j.location.pathname+j.location.search&&(Ae="REPLACE");let xe=ie&&"preventScrollReset"in ie?ie.preventScrollReset===!0:void 0,Xe=(ie&&ie.flushSync)===!0,Ct=Ke({currentLocation:Et,nextLocation:st,historyAction:Ae});if(Ct){Se(Ct,{state:"blocked",location:st,proceed(){Se(Ct,{state:"proceeding",proceed:void 0,reset:void 0,location:st}),Be(te,ie)},reset(){let ve=new Map(j.blockers);ve.set(Ct,a0),ce({blockers:ve})}});return}await Ue(Ae,st,{submission:Oe,pendingError:mt,preventScrollReset:xe,replace:ie&&ie.replace,enableViewTransition:ie&&ie.viewTransition,flushSync:Xe,callSiteDefaultShouldRevalidate:ie&&ie.defaultShouldRevalidate})}function ft(){ee||(ee=bx()),Ie(),ce({revalidation:"loading"});let te=ee.promise;return j.navigation.state==="submitting"?te:j.navigation.state==="idle"?(Ue(j.historyAction,j.location,{startUninterruptedRevalidation:!0}),te):(Ue(R||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation,enableViewTransition:B===!0}),te)}async function Ue(te,ie,pe){D&&D.abort(),D=null,R=te,K=(pe&&pe.startUninterruptedRevalidation)===!0,rt(j.location,j.matches),H=(pe&&pe.preventScrollReset)===!0,B=(pe&&pe.enableViewTransition)===!0;let Fe=u.activeRoutes,Oe=pe!=null&&pe.initialHydration&&j.matches&&j.matches.length>0&&!E?j.matches:Ia(Fe,ie,f,!1,u.branches),mt=(pe&&pe.flushSync)===!0;if(Oe&&j.initialized&&!F&&ID(j.location,ie)&&!(pe&&pe.submission&&ss(pe.submission.formMethod))){ke(ie,{matches:Oe},{flushSync:mt});return}let yt=Qt(Oe,Fe,ie.pathname);if(yt.active&&yt.matches&&(Oe=yt.matches),!Oe){let{error:dt,notFoundMatches:$e,route:Ge}=kt(ie.pathname);ke(ie,{matches:$e,loaderData:{},errors:{[Ge.id]:dt}},{flushSync:mt});return}let Et=pe&&pe.overrideNavigation?{...pe.overrideNavigation,matches:Oe,historyAction:te}:void 0;D=new AbortController;let st=Eu(e.history,ie,D.signal,pe&&pe.submission),vt=e.getContext?await e.getContext():new ex,Ae;if(pe&&pe.pendingError)Ae=[Gi(Oe).route.id,{type:"error",error:pe.pendingError}];else if(pe&&pe.submission&&ss(pe.submission.formMethod)){let dt=await Qe(st,ie,pe.submission,Oe,te,vt,yt.active,pe&&pe.initialHydration===!0,{replace:pe.replace,flushSync:mt});if(dt.shortCircuited)return;if(dt.pendingActionResult){let[$e,Ge]=dt.pendingActionResult;if(Ks(Ge)&&B0(Ge.error)&&Ge.error.status===404){D=null,ke(ie,{matches:dt.matches,loaderData:{},errors:{[$e]:Ge.error}});return}}Oe=dt.matches||Oe,Ae=dt.pendingActionResult,Et=Vg(ie,Oe,te,pe.submission),mt=!1,yt.active=!1,st=Eu(e.history,st.url,st.signal)}let{shortCircuited:xe,matches:Xe,loaderData:Ct,errors:ve,workingFetchers:lt}=await Pe(st,ie,Oe,te,vt,yt.active,Et,pe&&pe.submission,pe&&pe.fetcherSubmission,pe&&pe.replace,pe&&pe.initialHydration===!0,mt,Ae,pe&&pe.callSiteDefaultShouldRevalidate);xe||(D=null,ke(ie,{matches:Xe||Oe,...vx(Ae),loaderData:Ct,errors:ve,...lt?{fetchers:lt}:{}}))}async function Qe(te,ie,pe,Fe,Oe,mt,yt,Et,st={}){Ie();let vt=WD(ie,Fe,Oe,pe);if(ce({navigation:vt},{flushSync:st.flushSync===!0}),yt){let Xe=await on(Fe,ie.pathname,te.signal);if(Xe.type==="aborted")return{shortCircuited:!0};if(Xe.type==="error"){if(Xe.partialMatches.length===0){let{matches:ve,route:lt}=rh(u.activeRoutes);return{matches:ve,pendingActionResult:[lt.id,{type:"error",error:Xe.error}]}}let Ct=Gi(Xe.partialMatches).route.id;return{matches:Xe.partialMatches,pendingActionResult:[Ct,{type:"error",error:Xe.error}]}}else if(Xe.matches)Fe=Xe.matches;else{let{notFoundMatches:Ct,error:ve,route:lt}=kt(ie.pathname);return{matches:Ct,pendingActionResult:[lt.id,{type:"error",error:ve}]}}}let Ae,xe=Hh(Fe,ie);if(!xe.route.action&&!xe.route.lazy)Ae={type:"error",error:pa(405,{method:te.method,pathname:ie.pathname,routeId:xe.route.id})};else{let Xe=Ou(i,l,te,ie,Fe,xe,Et?[]:r,mt),Ct=await ae(te,ie,Xe,mt,null);if(Ae=Ct[xe.route.id],!Ae){for(let ve of Fe)if(Ct[ve.route.id]){Ae=Ct[ve.route.id];break}}if(te.signal.aborted)return{shortCircuited:!0}}if(lc(Ae)){let Xe;return st&&st.replace!=null?Xe=st.replace:Xe=hx(Ae.response.headers.get("Location"),new URL(te.url),f,e.history)===j.location.pathname+j.location.search,await q(te,Ae,!0,{submission:pe,replace:Xe}),{shortCircuited:!0}}if(Ks(Ae)){let Xe=Gi(Fe,xe.route.id);return(st&&st.replace)!==!0&&(R="PUSH"),{matches:Fe,pendingActionResult:[Xe.route.id,Ae,xe.route.id]}}return{matches:Fe,pendingActionResult:[xe.route.id,Ae]}}async function Pe(te,ie,pe,Fe,Oe,mt,yt,Et,st,vt,Ae,xe,Xe,Ct){let ve=yt||Vg(ie,pe,Fe,Et),lt=Et||st||yx(ve),dt=!K&&!Ae;if(mt){if(dt){let bt=G(Xe);ce({navigation:ve,...bt!==void 0?{actionData:bt}:{}},{flushSync:xe})}let Re=await on(pe,ie.pathname,te.signal);if(Re.type==="aborted")return{shortCircuited:!0};if(Re.type==="error"){if(Re.partialMatches.length===0){let{matches:Ot,route:It}=rh(u.activeRoutes);return{matches:Ot,loaderData:{},errors:{[It.id]:Re.error}}}let bt=Gi(Re.partialMatches).route.id;return{matches:Re.partialMatches,loaderData:{},errors:{[bt]:Re.error}}}else if(Re.matches)pe=Re.matches;else{let{error:bt,notFoundMatches:Ot,route:It}=kt(ie.pathname);return{matches:Ot,loaderData:{},errors:{[It.id]:bt}}}}let $e=u.activeRoutes,{dsMatches:Ge,revalidatingFetchers:Rt}=lx(te,Oe,i,l,e.history,j,pe,lt,ie,Ae?[]:r,Ae===!0,F,_,ne,J,Z,$e,f,e.patchRoutesOnNavigation!=null,u.branches,Xe,Ct);if(z=++Y,!e.dataStrategy&&!Ge.some(Re=>Re.shouldLoad)&&!Ge.some(Re=>Re.route.middleware&&Re.route.middleware.length>0)&&Rt.length===0){let Re=new Map(j.fetchers),bt=Lt(Re);return ke(ie,{matches:pe,loaderData:{},errors:Xe&&Ks(Xe[1])?{[Xe[0]]:Xe[1].error}:null,...vx(Xe),...bt?{fetchers:Re}:{}},{flushSync:xe}),{shortCircuited:!0}}if(dt){let Re={};if(!mt){Re.navigation=ve;let bt=G(Xe);bt!==void 0&&(Re.actionData=bt)}Rt.length>0&&(Re.fetchers=se(Rt)),ce(Re,{flushSync:xe})}Rt.forEach(Re=>{at(Re.key),Re.controller&&O.set(Re.key,Re.controller)});let nn=()=>Rt.forEach(Re=>at(Re.key));D&&D.signal.addEventListener("abort",nn);let{loaderResults:Nt,fetcherResults:Jt}=await Le(Ge,Rt,te,ie,Oe);if(te.signal.aborted)return{shortCircuited:!0};D&&D.signal.removeEventListener("abort",nn),Rt.forEach(Re=>O.delete(Re.key));let Ce=sh(Nt);if(Ce)return await q(te,Ce.result,!0,{replace:vt}),{shortCircuited:!0};if(Ce=sh(Jt),Ce)return Z.add(Ce.key),await q(te,Ce.result,!0,{replace:vt}),{shortCircuited:!0};let _e=new Map(j.fetchers),{loaderData:tt,errors:I}=mx(j,pe,Nt,Xe,Rt,Jt,_e);Ae&&j.errors&&(I={...j.errors,...I});let ue=Lt(_e),be=Zt(z,_e),Ve=ue||be||Rt.length>0;return{matches:pe,loaderData:tt,errors:I,...Ve?{workingFetchers:_e}:{}}}function G(te){if(te&&!Ks(te[1]))return{[te[0]]:te[1].data};if(j.actionData)return Object.keys(j.actionData).length===0?null:j.actionData}function se(te){let ie=new Map(j.fetchers);return te.forEach(pe=>{let Fe=ie.get(pe.key),Oe=o0(void 0,Fe?Fe.data:void 0);ie.set(pe.key,Oe)}),ie}async function We(te,ie,pe,Fe){at(te);let Oe=(Fe&&Fe.flushSync)===!0,mt=u.activeRoutes,yt=d6(j.location,j.matches,f,pe,ie,Fe==null?void 0:Fe.relative),Et=Ia(mt,yt,f,!1,u.branches),st=Qt(Et,mt,yt);if(st.active&&st.matches&&(Et=st.matches),!Et){ge(te,ie,pa(404,{pathname:yt}),{flushSync:Oe});return}let{path:vt,submission:Ae,error:xe}=ix(!0,yt,Fe);if(xe){ge(te,ie,xe,{flushSync:Oe});return}let Xe=e.getContext?await e.getContext():new ex,Ct=(Fe&&Fe.preventScrollReset)===!0;if(Ae&&ss(Ae.formMethod)){await Ze(te,ie,vt,Et,Xe,st.active,Oe,Ct,Ae,Fe&&Fe.defaultShouldRevalidate);return}J.set(te,{routeId:ie,path:vt}),await oe(te,ie,vt,Et,Xe,st.active,Oe,Ct,Ae)}async function Ze(te,ie,pe,Fe,Oe,mt,yt,Et,st,vt){Ie(),J.delete(te);let Ae=j.fetchers.get(te);Je(te,KD(st,Ae),{flushSync:yt});let xe=new AbortController,Xe=Eu(e.history,pe,xe.signal,st);if(mt){let Bt=await on(Fe,new URL(Xe.url).pathname,Xe.signal,te);if(Bt.type==="aborted")return;if(Bt.type==="error"){ge(te,ie,Bt.error,{flushSync:yt});return}else if(Bt.matches)Fe=Bt.matches;else{ge(te,ie,pa(404,{pathname:pe}),{flushSync:yt});return}}let Ct=Hh(Fe,pe);if(!Ct.route.action&&!Ct.route.lazy){let Bt=pa(405,{method:st.formMethod,pathname:pe,routeId:ie});ge(te,ie,Bt,{flushSync:yt});return}O.set(te,xe);let ve=Y,lt=Ou(i,l,Xe,pe,Fe,Ct,r,Oe),dt=await ae(Xe,pe,lt,Oe,te),$e=dt[Ct.route.id];if(!$e){for(let Bt of lt)if(dt[Bt.route.id]){$e=dt[Bt.route.id];break}}if(Xe.signal.aborted){O.get(te)===xe&&O.delete(te);return}if(ne.has(te)){if(lc($e)||Ks($e)){Je(te,mo(void 0));return}}else{if(lc($e))if(O.delete(te),z>ve){Je(te,mo(void 0));return}else return Z.add(te),Je(te,o0(st)),q(Xe,$e,!1,{fetcherSubmission:st,preventScrollReset:Et});if(Ks($e)){ge(te,ie,$e.error);return}}let Ge=j.navigation.location||j.location,Rt=Eu(e.history,Ge,xe.signal),nn=u.activeRoutes,Nt=j.navigation.state!=="idle"?Ia(nn,j.navigation.location,f,!1,u.branches):j.matches;hn(Nt,"Didn't find any matches after fetcher action");let Jt=++Y;X.set(te,Jt);let{dsMatches:Ce,revalidatingFetchers:_e}=lx(Rt,Oe,i,l,e.history,j,Nt,st,Ge,r,!1,F,_,ne,J,Z,nn,f,e.patchRoutesOnNavigation!=null,u.branches,[Ct.route.id,$e],vt),tt=o0(st,$e.data),I=new Map(j.fetchers);I.set(te,tt),_e.filter(Bt=>Bt.key!==te).forEach(Bt=>{let In=Bt.key,dn=I.get(In),Nn=o0(void 0,dn?dn.data:void 0);I.set(In,Nn),at(In),Bt.controller&&O.set(In,Bt.controller)}),ce({fetchers:I});let ue=()=>_e.forEach(Bt=>at(Bt.key));xe.signal.addEventListener("abort",ue);let{loaderResults:be,fetcherResults:Ve}=await Le(Ce,_e,Rt,Ge,Oe);if(xe.signal.aborted)return;xe.signal.removeEventListener("abort",ue),X.delete(te),O.delete(te),_e.forEach(Bt=>O.delete(Bt.key));let Re=j.fetchers.has(te),bt=Bt=>{if(!Re)return Bt;let In=new Map(Bt.fetchers);return In.set(te,mo($e.data)),{...Bt,fetchers:In}},Ot=sh(be);if(Ot)return j=bt(j),q(Rt,Ot.result,!1,{preventScrollReset:Et});if(Ot=sh(Ve),Ot)return Z.add(Ot.key),j=bt(j),q(Rt,Ot.result,!1,{preventScrollReset:Et});let It=new Map(j.fetchers);Re&&It.set(te,mo($e.data));let{loaderData:Dt,errors:wn}=mx(j,Nt,be,void 0,_e,Ve,It);Zt(Jt,It),j.navigation.state==="loading"&&Jt>z?(hn(R,"Expected pending action"),D&&D.abort(),ke(j.navigation.location,{matches:Nt,loaderData:Dt,errors:wn,fetchers:It})):(ce({errors:wn,loaderData:gx(j.loaderData,Dt,Nt,wn),fetchers:It}),F=!1)}async function oe(te,ie,pe,Fe,Oe,mt,yt,Et,st){let vt=j.fetchers.get(te);Je(te,o0(st,vt?vt.data:void 0),{flushSync:yt});let Ae=new AbortController,xe=Eu(e.history,pe,Ae.signal);if(mt){let $e=await on(Fe,new URL(xe.url).pathname,xe.signal,te);if($e.type==="aborted")return;if($e.type==="error"){ge(te,ie,$e.error,{flushSync:yt});return}else if($e.matches)Fe=$e.matches;else{ge(te,ie,pa(404,{pathname:pe}),{flushSync:yt});return}}let Xe=Hh(Fe,pe);O.set(te,Ae);let Ct=Y,ve=Ou(i,l,xe,pe,Fe,Xe,r,Oe),lt=await ae(xe,pe,ve,Oe,te),dt=lt[Xe.route.id];if(!dt){for(let $e of Fe)if(lt[$e.route.id]){dt=lt[$e.route.id];break}}if(O.get(te)===Ae&&O.delete(te),!xe.signal.aborted){if(ne.has(te)){Je(te,mo(void 0));return}if(lc(dt))if(z>Ct){Je(te,mo(void 0));return}else{Z.add(te),await q(xe,dt,!1,{preventScrollReset:Et});return}if(Ks(dt)){ge(te,ie,dt.error);return}Je(te,mo(dt.data))}}async function q(te,ie,pe,{submission:Fe,fetcherSubmission:Oe,preventScrollReset:mt,replace:yt}={}){pe||(L==null||L.resolve(),L=null),ie.response.headers.has("X-Remix-Revalidate")&&(F=!0);let Et=ie.response.headers.get("Location");hn(Et,"Expected a Location header on the redirect Response");let st=Et,vt=new URL(te.url);Et=hx(Et,vt,f,e.history),Hu(st,Et,vt,"allow-explicit");let Ae=Z0(j.location,Et,{_isRedirect:!0});if(n){let dt=!1;if(ie.response.headers.has("X-Remix-Reload-Document"))dt=!0;else if(Y4(Et)){const $e=$9(t,Et,!0);dt=$e.origin!==t.location.origin||Xs($e.pathname,f)==null}if(dt){yt?t.location.replace(Et):t.location.assign(Et);return}}D=null;let xe=yt===!0||ie.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Xe,formAction:Ct,formEncType:ve}=j.navigation;!Fe&&!Oe&&Xe&&Ct&&ve&&(Fe=yx(j.navigation));let lt=Fe||Oe;if(bD.has(ie.response.status)&&lt&&ss(lt.formMethod))await Ue(xe,Ae,{submission:{...lt,formAction:Et},preventScrollReset:mt||H,enableViewTransition:pe?B:void 0});else{let dt=Vg(Ae,[],xe,Fe);await Ue(xe,Ae,{overrideNavigation:dt,fetcherSubmission:Oe,preventScrollReset:mt||H,enableViewTransition:pe?B:void 0})}}async function ae(te,ie,pe,Fe,Oe){var Et;let mt,yt={};try{mt=await PD(h,te,ie,pe,Oe,Fe,!1)}catch(st){return pe.filter(vt=>vt.shouldLoad).forEach(vt=>{yt[vt.route.id]={type:"error",error:st}}),yt}if(te.signal.aborted)return yt;if(!ss(te.method))for(let st of pe){if(((Et=mt[st.route.id])==null?void 0:Et.type)==="error")break;!mt.hasOwnProperty(st.route.id)&&!j.loaderData.hasOwnProperty(st.route.id)&&(!j.errors||!j.errors.hasOwnProperty(st.route.id))&&st.shouldCallHandler()&&(mt[st.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${st.route.id}`)})}for(let[st,vt]of Object.entries(mt))if(ZD(vt)){let Ae=vt.result;yt[st]={type:"redirect",response:DD(Ae,te,st,pe,f)}}else yt[st]=await TD(vt);return yt}async function Le(te,ie,pe,Fe,Oe){let mt=ae(pe,Fe,te,Oe,null),yt=Promise.all(ie.map(async vt=>{if(vt.matches&&vt.match&&vt.request&&vt.controller){let xe=(await ae(vt.request,vt.path,vt.matches,Oe,vt.key))[vt.match.route.id];return{[vt.key]:xe}}else return Promise.resolve({[vt.key]:{type:"error",error:pa(404,{pathname:vt.path})}})})),Et=await mt,st=(await yt).reduce((vt,Ae)=>Object.assign(vt,Ae),{});return{loaderResults:Et,fetcherResults:st}}function Ie(){F=!0,J.forEach((te,ie)=>{O.has(ie)&&_.add(ie),at(ie)})}function Je(te,ie,pe={}){let Fe=new Map(j.fetchers);Fe.set(te,ie),ce({fetchers:Fe},{flushSync:(pe&&pe.flushSync)===!0})}function ge(te,ie,pe,Fe={}){let Oe=Gi(j.matches,ie),mt=new Map(j.fetchers);pt(mt,te),ce({errors:{[Oe.route.id]:pe},fetchers:mt},{flushSync:(Fe&&Fe.flushSync)===!0})}function et(te){return me.set(te,(me.get(te)||0)+1),ne.has(te)&&ne.delete(te),j.fetchers.get(te)||xD}function nt(te,ie){at(te,ie==null?void 0:ie.reason),Je(te,mo(null))}function pt(te,ie){let pe=j.fetchers.get(ie);O.has(ie)&&!(pe&&pe.state==="loading"&&X.has(ie))&&at(ie),J.delete(ie),X.delete(ie),Z.delete(ie),ne.delete(ie),_.delete(ie),te.delete(ie)}function St(te){let ie=(me.get(te)||0)-1;ie<=0?(me.delete(te),ne.add(te)):me.set(te,ie),ce({fetchers:new Map(j.fetchers)})}function at(te,ie){let pe=O.get(te);pe&&(pe.abort(ie),O.delete(te))}function _t(te,ie){for(let pe of te){let Fe=ie.get(pe);hn(Fe,`Expected fetcher: ${pe}`);let Oe=mo(Fe.data);ie.set(pe,Oe)}}function Lt(te){let ie=[],pe=!1;for(let Fe of Z){let Oe=te.get(Fe);hn(Oe,`Expected fetcher: ${Fe}`),Oe.state==="loading"&&(Z.delete(Fe),ie.push(Fe),pe=!0)}return _t(ie,te),pe}function Zt(te,ie){let pe=[];for(let[Fe,Oe]of X)if(Oe<te){let mt=ie.get(Fe);hn(mt,`Expected fetcher: ${Fe}`),mt.state==="loading"&&(at(Fe),X.delete(Fe),pe.push(Fe))}return _t(pe,ie),pe.length>0}function Mt(te,ie){let pe=j.blockers.get(te)||a0;return fe.get(te)!==ie&&fe.set(te,ie),pe}function $t(te){j.blockers.delete(te),fe.delete(te)}function Se(te,ie){let pe=j.blockers.get(te)||a0;hn(pe.state==="unblocked"&&ie.state==="blocked"||pe.state==="blocked"&&ie.state==="blocked"||pe.state==="blocked"&&ie.state==="proceeding"||pe.state==="blocked"&&ie.state==="unblocked"||pe.state==="proceeding"&&ie.state==="unblocked",`Invalid blocker state transition: ${pe.state} -> ${ie.state}`);let Fe=new Map(j.blockers);Fe.set(te,ie),ce({blockers:Fe})}function Ke({currentLocation:te,nextLocation:ie,historyAction:pe}){if(fe.size===0)return;fe.size>1&&nr(!1,"A router only supports one blocker at a time");let Fe=Array.from(fe.entries()),[Oe,mt]=Fe[Fe.length-1],yt=j.blockers.get(Oe);if(!(yt&&yt.state==="proceeding")&&mt({currentLocation:te,nextLocation:ie,historyAction:pe}))return Oe}function kt(te){let ie=pa(404,{pathname:te}),pe=u.activeRoutes,{matches:Fe,route:Oe}=rh(pe);return{notFoundMatches:Fe,route:Oe,error:ie}}function qe(te,ie,pe){if(y=te,k=ie,b=pe||null,!S&&j.navigation===_g){S=!0;let Fe=tn(j.location,j.matches);Fe!=null&&ce({restoreScrollPosition:Fe})}return()=>{y=null,k=null,b=null}}function ot(te,ie){return b&&b(te,ie.map(Fe=>D9(Fe,j.loaderData)))||te.key}function rt(te,ie){if(y&&k){let pe=ot(te,ie);y[pe]=k()}}function tn(te,ie){if(y){let pe=ot(te,ie),Fe=y[pe];if(typeof Fe=="number")return Fe}return null}function Qt(te,ie,pe){if(e.patchRoutesOnNavigation){let Fe=u.branches;if(te){if(Object.keys(te[0].params).length>0)return{active:!0,matches:Ia(ie,pe,f,!0,Fe)}}else return{active:!0,matches:Ia(ie,pe,f,!0,Fe)||[]}}return{active:!1,matches:null}}async function on(te,ie,pe,Fe){if(!e.patchRoutesOnNavigation)return{type:"success",matches:te};let Oe=te;for(;;){let mt=l;try{await e.patchRoutesOnNavigation({signal:pe,path:ie,matches:Oe,fetcherKey:Fe,patch:(vt,Ae)=>{pe.aborted||cx(vt,Ae,u,mt,i,!1)}})}catch(vt){return{type:"error",error:vt,partialMatches:Oe}}if(pe.aborted)return{type:"aborted"};let yt=u.branches,Et=Ia(u.activeRoutes,ie,f,!1,yt),st=null;if(Et){if(Object.keys(Et[0].params).length===0)return{type:"success",matches:Et};if(st=Ia(u.activeRoutes,ie,f,!0,yt),!(st&&Oe.length<st.length&&Wt(Oe,st.slice(0,Oe.length))))return{type:"success",matches:Et}}if(st||(st=Ia(u.activeRoutes,ie,f,!0,yt)),!st||Wt(Oe,st))return{type:"success",matches:null};Oe=st}}function Wt(te,ie){return te.length===ie.length&&te.every((pe,Fe)=>pe.route.id===ie[Fe].route.id)}function zt(te){l={},u.setHmrRoutes(z0(te,i,void 0,l))}function Ut(te,ie,pe=!1){cx(te,ie,u,l,i,pe),u.hasHMRRoutes||ce({})}return M={get basename(){return f},get future(){return p},get state(){return j},get routes(){return u.stableRoutes},get branches(){return u.branches},get manifest(){return l},get window(){return t},initialize:Q,subscribe:Me,enableScrollRestoration:qe,navigate:Be,fetch:We,revalidate:ft,createHref:te=>e.history.createHref(te),createURL:te=>e.history.createURL(te),encodeLocation:te=>e.history.encodeLocation(te),getFetcher:et,resetFetcher:nt,deleteFetcher:St,dispose:he,getBlocker:Mt,deleteBlocker:$t,patchRoutes:Ut,_internalFetchControllers:O,_internalSetRoutes:zt,_internalSetStateDoNotUseOrYouWillBreakYourApp(te){ce(te)}},e.instrumentations&&(M=dD(M,e.instrumentations.map(te=>te.router).filter(Boolean))),M}function CD(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function d6(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=yf(r||".",Up(l),Xs(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=ev(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=sD({basename:n,pathname:f.pathname})),ws(f)}function ix(e,t,n){if(!n||!CD(n))return{path:t};if(n.formMethod&&!UD(n.formMethod))return{path:t,error:pa(405,{method:n.formMethod})};let r=()=>({path:t,error:pa(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),l=n7(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!ss(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(!ss(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()}}}hn(typeof FormData=="function","FormData is not available in this environment");let u,f;if(n.formData)u=p6(n.formData),f=n.formData;else if(n.body instanceof FormData)u=p6(n.body),f=n.body;else if(n.body instanceof URLSearchParams)u=n.body,f=px(u);else if(n.body==null)u=new URLSearchParams,f=new FormData;else try{u=new URLSearchParams(n.body),f=px(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(ss(h.formMethod))return{path:t,submission:h};let p=Po(t);return e&&p.search&&ev(p.search)&&u.append("index",""),p.search=`?${u}`,{path:ws(p),submission:h}}function lx(e,t,n,r,a,i,l,u,f,h,p,m,g,w,y,b,k,S,C,E,A,P){var K;let T=A?Ks(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 F=Object.keys(i.errors)[0];R=l.findIndex(_=>_.route.id===F)}else if(A&&Ks(A[1])){let F=A[0];R=l.findIndex(_=>_.route.id===F)-1}let L=A?A[1].statusCode:void 0,H=L&&L>=400,D={currentUrl:M,currentParams:((K=i.matches[0])==null?void 0:K.params)||{},nextUrl:j,nextParams:l[0].params,...u,actionResult:T,actionStatus:L},B=xf(l),V=l.map((F,_)=>{let{route:O}=F,Y=null;if(R!=null&&_>R)Y=!1;else if(O.lazy)Y=!0;else if(!Q4(O))Y=!1;else if(p){let{shouldLoad:J}=Y9(O,i.loaderData,i.errors);Y=J}else jD(i.loaderData,i.matches[_],F)&&(Y=!0);if(Y!==null)return f6(n,r,e,f,B,F,h,t,Y);let z=!1;typeof P=="boolean"?z=P:H?z=!1:(m||M.pathname+M.search===j.pathname+j.search||M.search!==j.search||AD(i.matches[_],F))&&(z=!0);let X={...D,defaultShouldRevalidate:z},Z=P0(F,X);return f6(n,r,e,f,B,F,h,t,Z,X,P)}),W=[];return y.forEach((F,_)=>{if(p||!l.some(ne=>ne.route.id===F.routeId)||w.has(_))return;let O=i.fetchers.get(_),Y=O&&O.state!=="idle"&&O.data===void 0,z=Ia(k,F.path,S??"/",!1,E);if(!z){if(C&&Y)return;W.push({key:_,routeId:F.routeId,path:F.path,matches:null,match:null,request:null,controller:null});return}if(b.has(_))return;let X=Hh(z,F.path),Z=new AbortController,J=Eu(a,F.path,Z.signal),me=null;if(g.has(_))g.delete(_),me=Ou(n,r,J,F.path,z,X,h,t);else if(Y)m&&(me=Ou(n,r,J,F.path,z,X,h,t));else{let ne;typeof P=="boolean"?ne=P:H?ne=!1:ne=m;let fe={...D,defaultShouldRevalidate:ne};P0(X,fe)&&(me=Ou(n,r,J,F.path,z,X,h,t,fe))}me&&W.push({key:_,routeId:F.routeId,path:F.path,matches:me,match:X,request:J,controller:Z})}),{dsMatches:V,revalidatingFetchers:W}}function Q4(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Y9(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Q4(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 jD(e,t,n){let r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a}function AD(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function P0(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];hn(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=>q9(h,m));p?f.push({existingRoute:p,newRoute:h}):u.push(h)}),u.length>0){let h=z0(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]=z0([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 q9(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=>q9(r,l))}))??!1:!1}var ux=new WeakMap,X9=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let a=n[t.id];if(hn(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let i=a.lazy[e];if(!i)return;let l=ux.get(a);l||(l={},ux.set(a,l));let u=l[e];if(u)return u;let f=(async()=>{let h=BT(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},dx=new WeakMap;function ND(e,t,n,r,a){let i=n[e.id];if(hn(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=dx.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let m=(async()=>{hn(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=WT(y),C=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."):C?nr(!C,`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 dx.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=X9({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 fx(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 MD(e){return e.matches.some(t=>t.route.middleware)?Q9(e,()=>fx(e)):fx(e)}function Q9(e,t){return RD(e,t,r=>{if(BD(r))throw r;return r},_D,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=Gi(l,l[u].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function RD(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 J9(l,u,t,n,r,a)}async function J9(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 J9(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 e7(e,t,n,r,a){let i=X9({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),l=ND(r.route,ss(n.method)?"action":"loader",t,e,a);return{middleware:i,route:l.lazyRoutePromise,handler:l.lazyHandlerPromise}}function f6(e,t,n,r,a,i,l,u,f,h=null,p){let m=!1,g=e7(e,t,n,i,l);return{...i,_lazyPromises:g,shouldLoad:f,shouldRevalidateArgs:h,shouldCallHandler(w){return m=!0,h?typeof p=="boolean"?P0(i,{...h,defaultShouldRevalidate:p}):typeof w=="boolean"?P0(i,{...h,defaultShouldRevalidate:w}):P0(i,h):f},resolve(w){let{lazy:y,loader:b,middleware:k}=i.route,S=m||f||w&&!ss(n.method)&&(y||b),C=k&&k.length>0&&!b&&!y;return S&&(ss(n.method)||!C)?LD({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 Ou(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:e7(e,t,n,h,l),resolve:()=>Promise.resolve({type:"data",result:void 0})}:f6(e,t,n,r,xf(a),h,l,u,!0,f))}async function PD(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:t7(t,n),pattern:xf(r),params:r[0].params,context:i,matches:r},h=await e({...u,fetcherKey:a,runClientMiddleware:p=>{let m=u;return Q9(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 LD({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:i,handlerOverride:l,scopedContext:u}){let f,h,p=ss(e.method),m=p?"action":"loader",g=w=>{let y,b=new Promise((C,E)=>y=E);h=()=>y(),e.signal.addEventListener("abort",h);let k=C=>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:t7(e,t),pattern:n,params:r.params,context:u},...C!==void 0?[C]:[]),S=(async()=>{try{return{type:"data",result:await(l?l(E=>k(E)):k())}}catch(C){return{type:"error",result:C}}})();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 pa(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 pa(404,{pathname:b})}}catch(w){return{type:"error",result:w}}finally{h&&e.signal.removeEventListener("abort",h)}return f}async function $D(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 TD(e){var r,a,i,l,u;let{result:t,type:n}=e;if(J4(t)){let f;try{f=await $D(t)}catch(h){return{type:"error",error:h}}return n==="error"?{type:"error",error:new bf(t.status,t.statusText,f),statusCode:t.status,headers:t.headers}:{type:"data",data:f,statusCode:t.status,headers:t.headers}}return n==="error"?wx(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:FD(t),statusCode:B0(t)?t.status:void 0,headers:(i=t.init)!=null&&i.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:B0(t)?t.status:void 0}:wx(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 DD(e,t,n,r,a){let i=e.headers.get("Location");if(hn(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Y4(i)){let l=r.slice(0,r.findIndex(u=>u.route.id===n)+1);i=d6(new URL(t.url),l,a,i),e.headers.set("Location",i)}return e}var HD=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function h6(e){try{return HD.includes(new URL(e).protocol)}catch{return!1}}function hx(e,t,n,r){if(Y4(e)){let a=e,i=Bp.test(a)?new URL(L9(a,t.protocol)):new URL(a);if(h6(i.toString()))throw new Error("Invalid redirect location");let l=Xs(i.pathname,n)!=null;if(i.origin===t.origin&&l)return q4(i.pathname)+i.search+i.hash}try{let a=r.createURL(e);if(h6(a.toString()))throw new Error("Invalid redirect location")}catch{}return e}function Eu(e,t,n,r){let a=e.createURL(n7(t)).toString(),i={signal:n};if(r&&ss(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=p6(r.formData):i.body=r.formData}return new Request(a,i)}function t7(e,t){let n=new URL(e.url),r=typeof t=="string"?Po(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 p6(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function px(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function OD(e,t,n,r=!1,a=!1){let i={},l=null,u,f=!1,h={},p=n&&Ks(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(hn(!lc(w),"Cannot handle redirect results in processLoaderData"),Ks(w)){let y=w.error;if(p!==void 0&&(y=p,p=void 0),l=l||{},a)l[g]=y;else{let b=Gi(e,g);l[b.route.id]==null&&(l[b.route.id]=y)}r||(i[g]=G9),f||(f=!0,u=B0(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 mx(e,t,n,r,a,i,l){let{loaderData:u,errors:f}=OD(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(hn(w,"Did not find corresponding fetcher result"),Ks(w)){let y=Gi(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(lc(w))hn(!1,"Unhandled fetcher revalidation redirect");else{let y=mo(w.data);l.set(p,y)}}),{loaderData:u,errors:f}}function gx(e,t,n,r){let a=Object.entries(t).filter(([,i])=>i!==G9).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 vx(e){return e?Ks(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Gi(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 rh(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 pa(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 bf(e||500,l,new Error(u),!0)}function sh(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(lc(a))return{key:r,result:a}}}function n7(e){let t=typeof e=="string"?Po(e):e;return ws({...t,hash:""})}function ID(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function FD(e){var t,n;return new bf(((t=e.init)==null?void 0:t.status)??500,((n=e.init)==null?void 0:n.statusText)??"Internal Server Error",e.data)}function _D(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&VD(n))}function VD(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function ZD(e){return J4(e.result)&&W9.has(e.result.status)}function Ks(e){return e.type==="error"}function lc(e){return(e&&e.type)==="redirect"}function wx(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function J4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function zD(e){return W9.has(e)}function BD(e){return J4(e)&&zD(e.status)&&e.headers.has("Location")}function UD(e){return yD.has(e.toUpperCase())}function ss(e){return vD.has(e.toUpperCase())}function ev(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Hh(e,t){let n=typeof t=="string"?Po(t).search:t.search;if(e[e.length-1].route.index&&ev(n||""))return e[e.length-1];let r=V9(e);return r[r.length-1]}function yx(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 Vg(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 WD(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 o0(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 KD(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 mo(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 GD(e,t){try{let n=e.sessionStorage.getItem(K9);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 YD(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(K9,JSON.stringify(n))}catch(r){nr(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function bx(){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 Nc=s.createContext(null);Nc.displayName="DataRouter";var dd=s.createContext(null);dd.displayName="DataRouterState";var r7=s.createContext(!1);function s7(){return s.useContext(r7)}var tv=s.createContext({isTransitioning:!1});tv.displayName="ViewTransition";var a7=s.createContext(new Map);a7.displayName="Fetchers";var qD=s.createContext(null);qD.displayName="Await";var Es=s.createContext(null);Es.displayName="Navigation";var Wp=s.createContext(null);Wp.displayName="Location";var ja=s.createContext({outlet:null,matches:[],isDataRoute:!1});ja.displayName="Route";var nv=s.createContext(null);nv.displayName="RouteError";var o7="REACT_ROUTER_ERROR",XD="REDIRECT",QD="ROUTE_ERROR_RESPONSE";function JD(e){if(e.startsWith(`${o7}:${XD}:{`))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 eH(e){if(e.startsWith(`${o7}:${QD}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new bf(t.status,t.statusText,t.data)}catch{}}function tH(e,{relative:t}={}){hn(Mc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=s.useContext(Es),{hash:a,pathname:i,search:l}=kf(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:xa([n,i])),r.createHref({pathname:u,search:l,hash:a})}function Mc(){return s.useContext(Wp)!=null}function Un(){return hn(Mc(),"useLocation() may be used only in the context of a <Router> component."),s.useContext(Wp).location}function mn(e){hn(Mc(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Un();return s.useMemo(()=>cl(e,_9(t)),[t,e])}var i7="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function l7(e){s.useContext(Es).static||s.useLayoutEffect(e)}function Bn(){let{isDataRoute:e}=s.useContext(ja);return e?mH():nH()}function nH(){hn(Mc(),"useNavigate() may be used only in the context of a <Router> component.");let e=s.useContext(Nc),{basename:t,navigator:n}=s.useContext(Es),{matches:r}=s.useContext(ja),{pathname:a}=Un(),i=JSON.stringify(Up(r)),l=s.useRef(!1);return l7(()=>{l.current=!0}),s.useCallback((f,h={})=>{if(nr(l.current,i7),!l.current)return;if(typeof f=="number"){n.go(f);return}let p=yf(f,JSON.parse(i),a,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:xa([t,p.pathname])),Hu(typeof f=="string"?f:ws(f),n.createHref(p),X4(n),"reject"),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,i,a,e])}var c7=s.createContext(null);function rH(){return s.useContext(c7)}function sH(e){let t=s.useContext(ja).outlet;return s.useMemo(()=>t&&s.createElement(c7.Provider,{value:e},t),[t,e])}function Qs(){let{matches:e}=s.useContext(ja),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function kf(e,{relative:t}={}){let{matches:n}=s.useContext(ja),{pathname:r}=Un(),a=JSON.stringify(Up(n));return s.useMemo(()=>yf(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function aH(e,t,n){hn(Mc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=s.useContext(Es),{matches:a}=s.useContext(ja),i=a[a.length-1],l=i?i.params:{},u=i?i.pathname:"/",f=i?i.pathnameBase:"/",h=i&&i.route;{let k=h&&h.path||"";h7(u,!h||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
51
-
52
- Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let p=Un(),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})):T9(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.`),uH(y&&y.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:xa([f,r.encodeLocation?r.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:xa([f,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n)}function oH(){let e=f7(),t=B0(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 iH=s.createElement(oH,null),u7=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=eH(e.digest);n&&(e=n)}let t=e!==void 0?s.createElement(ja.Provider,{value:this.props.routeContext},s.createElement(nv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?s.createElement(lH,{error:e},t):t}};u7.contextType=r7;var Zg=new WeakMap;function lH({children:e,error:t}){let{basename:n,navigator:r}=s.useContext(Es);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=JD(t.digest);if(a){let i=Zg.get(t);if(i)throw i;let l=z9(a.location,n),u=l.absoluteURL||l.to;if(Hu(a.location,u,X4(r),"allow-explicit"),h6(u))throw new Error("Invalid redirect location");if(Z9&&!Zg.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 Zg.set(t,f),f}return s.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function cH({routeContext:e,match:t,children:n}){let r=s.useContext(Nc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),s.createElement(ja.Provider,{value:e},n)}function uH(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);hn(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:xf(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||iH,l&&(u<0&&g===0?(h7("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)),C=()=>{let E;return w?E=b:y?E=k:m.route.Component?E=s.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=p,s.createElement(cH,{match:m,routeContext:{outlet:p,matches:S,isDataRoute:r!=null},children:E})};return r&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?s.createElement(u7,{location:r.location,revalidation:r.revalidation,component:b,error:w,children:C(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):C()},null)}function rv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dH(e){let t=s.useContext(Nc);return hn(t,rv(e)),t}function sv(e){let t=s.useContext(dd);return hn(t,rv(e)),t}function fH(e){let t=s.useContext(ja);return hn(t,rv(e)),t}function av(e){let t=fH(e),n=t.matches[t.matches.length-1];return hn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hH(){return av("useRouteId")}function pH(){let e=sv("useNavigation");return s.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function d7(){let{matches:e,loaderData:t}=sv("useMatches");return s.useMemo(()=>e.map(n=>D9(n,t)),[e,t])}function f7(){var r;let e=s.useContext(nv),t=sv("useRouteError"),n=av("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function mH(){let{router:e}=dH("useNavigate"),t=av("useNavigate"),n=s.useRef(!1);return l7(()=>{n.current=!0}),s.useCallback(async(a,i={})=>{nr(n.current,i7),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var xx={};function h7(e,t,n){!t&&!xx[e]&&(xx[e]=!0,nr(!1,n))}var kx={};function Sx(e,t){!e&&!kx[t]&&(kx[t]=!0,console.warn(t))}var gH="useOptimistic",Ex=Ac[gH],vH=()=>{};function wH(e){return Ex?Ex(e):[e,vH]}function yH(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 bH=["HydrateFallback","hydrateFallbackElement"],xH=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 kH({router:e,flushSync:t,onError:n,useTransitions:r}){r=s7()||r;let[i,l]=s.useState(e.state),[u,f]=wH(i),[h,p]=s.useState(),[m,g]=s.useState({isTransitioning:!1}),[w,y]=s.useState(),[b,k]=s.useState(),[S,C]=s.useState(),E=s.useRef(new Map),A=s.useCallback((j,{deletedFetchers:R,newErrors:L,flushSync:H,viewTransitionOpts:D})=>{L&&n&&Object.values(L).forEach(V=>{var W;return n(V,{location:j.location,params:((W=j.matches[0])==null?void 0:W.params)??{},pattern:xf(j.matches)})}),j.fetchers.forEach((V,W)=>{V.data!==void 0&&E.current.set(W,V.data)}),R.forEach(V=>E.current.delete(V)),Sx(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(Sx(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=>Cx(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(),C({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 xH)},[m]),s.useEffect(()=>{if(w&&h&&e.window){let j=h,R=w.promise,L=e.window.document.startViewTransition(async()=>{r===!1?l(j):s.startTransition(()=>{r===!0&&f(H=>Cx(H,j)),l(j)}),await R});L.finished.finally(()=>{y(void 0),k(void 0),p(void 0),g({isTransitioning:!1})}),k(L)}},[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}),C(void 0))},[m.isTransitioning,S]);let P=s.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:j=>e.navigate(j),push:(j,R,L)=>e.navigate(j,{state:R,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(j,R,L)=>e.navigate(j,{replace:!0,state:R,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[e]),T=e.basename||"/",M=s.useMemo(()=>({router:e,navigator:P,static:!1,basename:T,onError:n}),[e,P,T,n]);return s.createElement(s.Fragment,null,s.createElement(Nc.Provider,{value:M},s.createElement(dd.Provider,{value:u},s.createElement(a7.Provider,{value:E.current},s.createElement(tv.Provider,{value:m},s.createElement(CH,{basename:T,location:u.location,navigationType:u.historyAction,navigator:P,useTransitions:r},s.createElement(SH,{routes:e.routes,manifest:e.manifest,future:e.future,state:u,isStatic:!1,onError:n})))))),null)}function Cx(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 SH=s.memo(EH);function EH({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:i}){return aH(e,void 0,{manifest:t,state:r,isStatic:a,onError:i})}function Ka({to:e,replace:t,state:n,relative:r}){hn(Mc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a,navigator:i}=s.useContext(Es);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(ja),{pathname:u}=Un(),f=Bn(),h=yf(e,Up(l),u,r==="path");Hu(typeof e=="string"?e:ws(e),i.createHref(h),X4(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 Rc(e){return sH(e.context)}function CH({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,useTransitions:l}){hn(!Mc(),"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=Po(n));let{pathname:h="/",search:p="",hash:m="",state:g=null,key:w="default",mask:y}=n,b=s.useMemo(()=>{let k=Xs(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(Es.Provider,{value:f},s.createElement(Wp.Provider,{children:t,value:b}))}var Oh="get",Ih="application/x-www-form-urlencoded";function Kp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function jH(e){return Kp(e)&&e.tagName.toLowerCase()==="button"}function AH(e){return Kp(e)&&e.tagName.toLowerCase()==="form"}function NH(e){return Kp(e)&&e.tagName.toLowerCase()==="input"}function MH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function RH(e,t){return e.button===0&&(!t||t==="_self")&&!MH(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 PH(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 ah=null;function LH(){if(ah===null)try{new FormData(document.createElement("form"),0),ah=!1}catch{ah=!0}return ah}var $H=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function zg(e){return e!=null&&!$H.has(e)?(nr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ih}"`),null):e}function TH(e,t){let n,r,a,i,l;if(AH(e)){let u=e.getAttribute("action");r=u?Xs(u,t):null,n=e.getAttribute("method")||Oh,a=zg(e.getAttribute("enctype"))||Ih,i=new FormData(e)}else if(jH(e)||NH(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?Xs(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Oh,a=zg(e.getAttribute("formenctype"))||zg(u.getAttribute("enctype"))||Ih,i=new FormData(u,e),!LH()){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(Kp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Oh,r=null,a=Ih,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 DH={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},HH=/[&><\u2028\u2029]/g;function jx(e){return e.replace(HH,t=>DH[t])}function ov(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function p7(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&&Xs(a.pathname,t)==="/"?a.pathname=`${Qu(t)}/_root.${r}`:a.pathname=`${Qu(a.pathname)}.${r}`,a}async function OH(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 IH(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 FH(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let l=await OH(i,n);return l.links?l.links():[]}return[]}));return zH(r.flat(1).filter(IH).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Ax(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 _H(e,t,{includeHydrateFallback:n}={}){return VH(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 VH(e){return[...new Set(e)]}function ZH(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function zH(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(ZH(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function iv(){let e=s.useContext(Nc);return ov(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function BH(){let e=s.useContext(dd);return ov(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Gp=s.createContext(void 0);Gp.displayName="FrameworkContext";function Yp(){let e=s.useContext(Gp);return ov(e,"You must render this element inside a <HydratedRouter> element"),e}function UH(e,t){let n=s.useContext(Gp),[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(C=>{l(C.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:i0(u,w),onBlur:i0(f,y),onMouseEnter:i0(h,w),onMouseLeave:i0(p,y),onTouchStart:i0(m,w)}]:[!1,g,{}]}function i0(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function WH({page:e,...t}){let n=s7(),{nonce:r}=Yp(),{router:a}=iv(),i=s.useMemo(()=>T9(a.routes,e,a.basename),[a.routes,e,a.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?s.createElement(GH,{page:e,matches:i,...t}):s.createElement(YH,{page:e,matches:i,...t})):null}function KH(e){let{manifest:t,routeModules:n}=Yp(),[r,a]=s.useState([]);return s.useEffect(()=>{let i=!1;return FH(e,t,n).then(l=>{i||a(l)}),()=>{i=!0}},[e,t,n]),r}function GH({page:e,matches:t,...n}){let r=Un(),{future:a}=Yp(),{basename:i}=iv(),l=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let u=p7(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 YH({page:e,matches:t,...n}){let r=Un(),{future:a,manifest:i,routeModules:l}=Yp(),{basename:u}=iv(),{loaderData:f,matches:h}=BH(),p=s.useMemo(()=>Ax(e,t,h,i,r,"data"),[e,t,h,i,r]),m=s.useMemo(()=>Ax(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(C=>{var A;let E=i.routes[C.route.id];!E||!E.hasLoader||(!p.some(P=>P.route.id===C.route.id)&&C.route.id in f&&((A=l[C.route.id])!=null&&A.shouldRevalidate)||E.hasClientLoader?k=!0:b.add(C.route.id))}),b.size===0)return[];let S=p7(e,u,a.v8_trailingSlashAwareDataRequests,"data");return k&&b.size>0&&S.searchParams.set("_routes",t.filter(C=>b.has(C.route.id)).map(C=>C.route.id).join(",")),[S.pathname+S.search]},[u,a.v8_trailingSlashAwareDataRequests,f,r,i,p,t,e,l]),w=s.useMemo(()=>_H(m,i),[m,i]),y=KH(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 qH(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var XH=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{XH&&(window.__reactRouterVersion="7.18.3")}catch{}function QH(e,t){return ED({basename:t==null?void 0:t.basename,getContext:t==null?void 0:t.getContext,future:t==null?void 0:t.future,history:_T({window:t==null?void 0:t.window}),hydrationData:JH(),routes:e,mapRouteProperties:yH,hydrationRouteProperties:bH,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 JH(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:eO(e.errors)}),e}function eO(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 bf(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(typeof a.__subType=="string"&&cD.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:C}=s.useContext(Es),E=typeof p=="string"&&zp.test(p),A=z9(p,k);p=A.to;let P=tH(p,{relative:a}),T=Un(),M=null;if(u){let W=yf(u,[],T.mask?T.mask.pathname:"/",!0);k!=="/"&&(W.pathname=W.pathname==="/"?k:xa([k,W.pathname])),M=S.createHref(W)}let[j,R,L]=UH(r,y),H=sO(p,{replace:l,mask:u,state:f,target:h,preventScrollReset:m,relative:a,viewTransition:g,defaultShouldRevalidate:w,useTransitions:C});function D(W){t&&t(W),W.defaultPrevented||H(W)}let B=!(A.isExternal||i),V=s.createElement("a",{...y,...L,href:(B?M:void 0)||A.absoluteURL||P,onClick:B?D:t,ref:qH(b,R),target:h,"data-discover":!E&&n==="render"?"true":void 0});return j&&!E?s.createElement(s.Fragment,null,V,s.createElement(WH,{page:P})):V});Zn.displayName="Link";var tO=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=kf(l,{relative:h.relative}),g=Un(),w=s.useContext(dd),{navigator:y,basename:b}=s.useContext(Es),k=w!=null&&dO(m)&&u===!0,S=y.encodeLocation?y.encodeLocation(m).pathname:m.pathname,C=g.pathname,E=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(C=C.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&b&&(E=Xs(E,b)||E);const A=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let P=C===S||!a&&C.startsWith(S)&&C.charAt(A)==="/",T=E!=null&&(E===S||!a&&E.startsWith(S)&&E.charAt(S.length)==="/"),M={isActive:P,isPending:T,isTransitioning:k},j=P?t:void 0,R;typeof r=="function"?R=r(M):R=[r,P?"active":null,T?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let L=typeof i=="function"?i(M):i;return s.createElement(Zn,{...h,"aria-current":j,className:R,ref:p,style:L,to:l,viewTransition:u},typeof f=="function"?f(M):f)});tO.displayName="NavLink";var nO=s.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:l=Oh,action:u,onSubmit:f,relative:h,preventScrollReset:p,viewTransition:m,defaultShouldRevalidate:g,...w},y)=>{let{useTransitions:b}=s.useContext(Es),k=iO(),S=lO(u,{relative:h}),C=l.toLowerCase()==="get"?"get":"post",E=typeof u=="string"&&zp.test(u),A=P=>{if(f&&f(P),P.defaultPrevented)return;P.preventDefault();let T=P.nativeEvent.submitter,M=(T==null?void 0:T.getAttribute("formmethod"))||l,j=()=>k(T||P.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:C,action:S,onSubmit:r?f:A,...w,"data-discover":!E&&e==="render"?"true":void 0})});nO.displayName="Form";function m7({getKey:e,storageKey:t,...n}){let r=s.useContext(Gp),{basename:a}=s.useContext(Es),i=Un(),l=d7();cO({getKey:e,storageKey:t});let u=s.useMemo(()=>{if(!r||!e)return null;let h=v6(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})(${jx(JSON.stringify(t||g6))}, ${jx(JSON.stringify(u))})`}})}m7.displayName="ScrollRestoration";function g7(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lv(e){let t=s.useContext(Nc);return hn(t,g7(e)),t}function rO(e){let t=s.useContext(dd);return hn(t,g7(e)),t}function sO(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=kf(e,{relative:l});return s.useCallback(w=>{if(RH(w,t)){w.preventDefault();let y=n!==void 0?n:ws(m)===ws(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 gl(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(()=>PH(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 aO=0,oO=()=>`__${String(++aO)}__`;function iO(){let{router:e}=lv("useSubmit"),{basename:t}=s.useContext(Es),n=hH(),r=e.fetch,a=e.navigate;return s.useCallback(async(i,l={})=>{let{action:u,method:f,encType:h,formData:p,body:m}=TH(i,t);if(l.navigate===!1){let g=l.fetcherKey||oO();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 lO(e,{relative:t}={}){let{basename:n}=s.useContext(Es),r=s.useContext(ja);hn(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...kf(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:xa([n,i.pathname])),ws(i)}var g6="react-router-scroll-positions",oh={};function v6(e,t,n,r){let a=null;return r&&(n!=="/"?a=r({...e,pathname:Xs(e.pathname,n)||e.pathname},t):a=r(e,t)),a==null&&(a=e.key),a}function cO({getKey:e,storageKey:t}={}){let{router:n}=lv("useScrollRestoration"),{restoreScrollPosition:r,preventScrollReset:a}=rO("useScrollRestoration"),{basename:i}=s.useContext(Es),l=Un(),u=d7(),f=pH();s.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),uO(s.useCallback(()=>{if(f.state==="idle"){let h=v6(l,u,i,e);oh[h]=window.scrollY}try{sessionStorage.setItem(t||g6,JSON.stringify(oh))}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||g6);h&&(oh=JSON.parse(h))}catch{}},[t]),s.useLayoutEffect(()=>{let h=n==null?void 0:n.enableScrollRestoration(oh,()=>window.scrollY,e?(p,m)=>v6(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 uO(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 dO(e,{relative:t}={}){let n=s.useContext(tv);hn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=lv("useViewTransitionState"),a=kf(e,{relative:t});if(!n.isTransitioning)return!1;let i=Xs(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Xs(n.nextLocation.pathname,r)||n.nextLocation.pathname;return cl(a.pathname,l)!=null||cl(a.pathname,i)!=null}const fO=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"}))]]),hO=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"}))]]),pO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm40.49-100.49a12,12,0,0,1-17,17L140,117v51a12,12,0,0,1-24,0V117l-11.51,11.52a12,12,0,0,1-17-17l32-32a12,12,0,0,1,17,0Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm37.66-101.66a8,8,0,0,1-11.32,11.32L136,107.31V168a8,8,0,0,1-16,0V107.31l-18.34,18.35a8,8,0,0,1-11.32-11.32l32-32a8,8,0,0,1,11.32,0Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,101.66a8,8,0,0,1-11.32,0L136,107.31V168a8,8,0,0,1-16,0V107.31l-18.34,18.35a8,8,0,0,1-11.32-11.32l32-32a8,8,0,0,1,11.32,0l32,32A8,8,0,0,1,165.66,125.66Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm36.24-102.24a6,6,0,1,1-8.48,8.48L134,102.49V168a6,6,0,0,1-12,0V102.49l-21.76,21.75a6,6,0,0,1-8.48-8.48l32-32a6,6,0,0,1,8.48,0Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm37.66-101.66a8,8,0,0,1-11.32,11.32L136,107.31V168a8,8,0,0,1-16,0V107.31l-18.34,18.35a8,8,0,0,1-11.32-11.32l32-32a8,8,0,0,1,11.32,0Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm34.83-102.83a4,4,0,0,1-5.66,5.66L132,97.66V168a4,4,0,0,1-8,0V97.66L98.83,122.83a4,4,0,0,1-5.66-5.66l32-32a4,4,0,0,1,5.66,0Z"}))]]),mO=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),s.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z"}))]]),gO=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"}))]]),vO=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"}))]]),wO=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"}))]]),yO=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"}))]]),bO=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"}))]]),xO=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"}))]]),kO=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"}))]]),SO=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"}))]]),EO=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"}))]]),CO=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"}))]]),jO=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"}))]]),AO=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"}))]]),NO=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"}))]]),MO=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"}))]]),RO=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"}))]]),PO=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"}))]]),LO=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"}))]]),$O=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"}))]]),TO=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"}))]]),DO=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"}))]]),HO=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"}))]]),OO=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"}))]]),IO=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"}))]]),FO=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"}))]]),_O=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"}))]]),VO=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"}))]]),ZO=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"}))]]),zO=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"}))]]),BO=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"}))]]),UO=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"}))]]),WO=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"}))]]),KO=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"}))]]),GO=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"}))]]),YO=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"}))]]),qO=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"}))]]),XO=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"}))]]),QO=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"}))]]),JO=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"}))]]),eI=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"}))]]),tI=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"}))]]),nI=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"}))]]),rI=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"}))]]),sI=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"}))]]),aI=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"}))]]),oI=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"}))]]),iI=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"}))]]),lI=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"}))]]),cI=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"}))]]),uI=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"}))]]),dI=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"}))]]),fI=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"}))]]),hI=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"}))]]),pI=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"}))]]),mI=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"}))]]),gI=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"}))]]),vI=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"}))]]),wI=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"}))]]),yI=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"}))]]),bI=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"}))]]),xI=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"}))]]),kI=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"}))]]),SI=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"}))]]),EI=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"}))]]),CI=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"}))]]),jI=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"}))]]),AI=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"}))]]),NI=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"}))]]),MI=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"}))]]),RI=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"}))]]),PI=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"}))]]),LI=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"}))]]),v7=s.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),At=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(v7);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))});At.displayName="IconBase";const w7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:fO}));w7.displayName="ApertureIcon";const y7=w7,b7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:hO}));b7.displayName="ArchiveIcon";const qp=b7,x7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:pO}));x7.displayName="ArrowCircleUpIcon";const k7=x7,S7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:mO}));S7.displayName="ArrowClockwiseIcon";const E7=S7,C7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:gO}));C7.displayName="ArrowCounterClockwiseIcon";const U0=C7,j7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:vO}));j7.displayName="ArrowLeftIcon";const cv=j7,A7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:wO}));A7.displayName="ArrowLineUpIcon";const $I=A7,N7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:yO}));N7.displayName="ArrowRightIcon";const ma=N7,M7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:bO}));M7.displayName="ArrowSquareOutIcon";const mc=M7,R7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:xO}));R7.displayName="ArrowUpIcon";const P7=R7,L7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:kO}));L7.displayName="ArrowsClockwiseIcon";const Jh=L7,$7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:SO}));$7.displayName="ArrowsDownUpIcon";const TI=$7,T7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:EO}));T7.displayName="ArrowsOutSimpleIcon";const DI=T7,D7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:CO}));D7.displayName="BellIcon";const Bg=D7,H7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:jO}));H7.displayName="CaretDownIcon";const ul=H7,O7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:AO}));O7.displayName="CaretLeftIcon";const Aa=O7,I7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:NO}));I7.displayName="CaretRightIcon";const vl=I7,F7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:MO}));F7.displayName="CaretUpIcon";const HI=F7,_7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:RO}));_7.displayName="ChartBarIcon";const OI=_7,V7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:PO}));V7.displayName="CheckIcon";const Gn=V7,Z7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:LO}));Z7.displayName="CircleIcon";const II=Z7,z7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:$O}));z7.displayName="CircleHalfIcon";const FI=z7,B7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:TO}));B7.displayName="CopyIcon";const ep=B7,U7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:DO}));U7.displayName="CopySimpleIcon";const Nx=U7,W7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:HO}));W7.displayName="DeviceMobileIcon";const _I=W7,K7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:OO}));K7.displayName="DotsThreeIcon";const uv=K7,G7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:IO}));G7.displayName="DotsThreeVerticalIcon";const dv=G7,Y7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:FO}));Y7.displayName="DownloadSimpleIcon";const q7=Y7,X7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:_O}));X7.displayName="FilmSlateIcon";const Xp=X7,Q7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:VO}));Q7.displayName="FolderSimpleIcon";const fv=Q7,J7=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:ZO}));J7.displayName="FolderSimpleMinusIcon";const eE=J7,tE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:zO}));tE.displayName="FrameCornersIcon";const nE=tE,rE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:BO}));rE.displayName="GearSixIcon";const VI=rE,sE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:UO}));sE.displayName="GiftIcon";const ZI=sE,aE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:WO}));aE.displayName="GithubLogoIcon";const zI=aE,oE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:KO}));oE.displayName="GraduationCapIcon";const BI=oE,iE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:GO}));iE.displayName="HandWavingIcon";const UI=iE,lE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:YO}));lE.displayName="HouseIcon";const WI=lE,cE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:qO}));cE.displayName="IdentificationBadgeIcon";const Qp=cE,uE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:XO}));uE.displayName="ImageIcon";const KI=uE,dE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:QO}));dE.displayName="ImageSquareIcon";const Na=dE,fE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:JO}));fE.displayName="InfinityIcon";const hE=fE,pE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:eI}));pE.displayName="InfoIcon";const Jp=pE,mE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:tI}));mE.displayName="KeyIcon";const gE=mE,vE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:nI}));vE.displayName="KeyboardIcon";const GI=vE,wE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:rI}));wE.displayName="LightningIcon";const W0=wE,yE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:sI}));yE.displayName="MagnifyingGlassIcon";const Ju=yE,bE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:aI}));bE.displayName="MegaphoneIcon";const YI=bE,xE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:oI}));xE.displayName="MinusIcon";const qI=xE,kE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:iI}));kE.displayName="MountainsIcon";const XI=kE,SE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:lI}));SE.displayName="PackageIcon";const em=SE,EE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:cI}));EE.displayName="PaletteIcon";const QI=EE,CE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:uI}));CE.displayName="PaperclipIcon";const JI=CE,jE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:dI}));jE.displayName="PencilSimpleIcon";const fd=jE,AE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:fI}));AE.displayName="PencilSimpleLineIcon";const eF=AE,NE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:hI}));NE.displayName="PlusIcon";const mr=NE,ME=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:pI}));ME.displayName="PlusCircleIcon";const tF=ME,RE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:mI}));RE.displayName="PowerIcon";const nF=RE,PE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:gI}));PE.displayName="QuestionIcon";const rF=PE,LE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:vI}));LE.displayName="SidebarSimpleIcon";const sF=LE,$E=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:wI}));$E.displayName="SlidersHorizontalIcon";const hv=$E,TE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:yI}));TE.displayName="StackIcon";const DE=TE,HE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:bI}));HE.displayName="StarIcon";const Ga=HE,OE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:xI}));OE.displayName="StorefrontIcon";const IE=OE,FE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:kI}));FE.displayName="SunHorizonIcon";const _E=FE,VE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:SI}));VE.displayName="TrashIcon";const wl=VE,ZE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:EI}));ZE.displayName="TrashSimpleIcon";const tm=ZE,zE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:CI}));zE.displayName="UploadSimpleIcon";const pv=zE,BE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:jI}));BE.displayName="UserIcon";const aF=BE,UE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:AI}));UE.displayName="UserCircleIcon";const oF=UE,WE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:NI}));WE.displayName="UserPlusIcon";const iF=WE,KE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:MI}));KE.displayName="WarningIcon";const nm=KE,GE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:RI}));GE.displayName="WarningCircleIcon";const Pc=GE,YE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:PI}));YE.displayName="XIcon";const Rn=YE,qE=s.forwardRef((e,t)=>s.createElement(At,{ref:t,...e,weights:LI}));qE.displayName="XCircleIcon";const lF=qE;var zr=M9(),cF=Object.defineProperty,mv=(e,t)=>cF(e,"name",{value:t,configurable:!0});function w6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}mv(w6,"setRef");function XE(...e){return t=>{let n=!1;const r=e.map(a=>{const i=w6(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():w6(e[a],null)}}}}mv(XE,"composeRefs");function pn(...e){return s.useCallback(XE(...e),e)}mv(pn,"useComposedRefs");var uF=Object.defineProperty,Ja=(e,t)=>uF(e,"name",{value:t,configurable:!0});function Ya(e){const t=s.forwardRef((n,r)=>{let{children:a,...i}=n,l=null,u=!1;const f=[];y6(a)&&typeof ih=="function"&&(a=ih(a._payload)),s.Children.forEach(a,g=>{var w;if(tC(g)){u=!0;const y=g;let b="child"in y.props?y.props.child:y.props.children;y6(b)&&typeof ih=="function"&&(b=ih(b._payload)),l=dF(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?eC(l):void 0,p=pn(r,h);if(!l){if(a||a===0)throw new Error(u?pF(e):hF(e));return a}const m=JE(i,l.props??{});return l.type!==s.Fragment&&(m.ref=r?p:h),s.cloneElement(l,m)});return t.displayName=`${e}.Slot`,t}Ja(Ya,"createSlot");var Lc=Ya("Slot"),QE=Symbol.for("radix.slottable");function gv(e){const t=Ja(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=QE,t}Ja(gv,"createSlottable");var rm=gv("Slottable"),dF=Ja((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 JE(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}}Ja(JE,"mergeProps");function eC(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)}Ja(eC,"getElementRef");function tC(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QE}Ja(tC,"isSlottable");var fF=Symbol.for("react.lazy");function y6(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===fF&&"_payload"in e&&nC(e._payload)}Ja(y6,"isLazyComponent");function nC(e){return typeof e=="object"&&e!==null&&"then"in e}Ja(nC,"isPromiseLike");var hF=Ja(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),pF=Ja(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ih=Ac[" use ".trim().toString()],mF=Object.defineProperty,gF=(e,t)=>mF(e,"name",{value:t,configurable:!0}),vF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=vF.reduce((e,t)=>{const n=Ya(`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 vv(e,t){e&&zr.flushSync(()=>e.dispatchEvent(t))}gF(vv,"dispatchDiscreteCustomEvent");var wF=Object.defineProperty,yF=(e,t)=>wF(e,"name",{value:t,configurable:!0}),rC=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"}),bF=s.forwardRef(yF(function(t,n){return o.jsx(vn.span,{...t,ref:n,style:{...rC,...t.style}})},"VisuallyHidden")),sC=bF,xF=Object.defineProperty,ga=(e,t)=>xF(e,"name",{value:t,configurable:!0});function kF(e,t){const n=s.createContext(t);n.displayName=e+"Context";const r=ga(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 ga(a,"useContext"),[r,a]}ga(kF,"createContext");function Ds(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=ga(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 ga(p,"useContext"),[h,p]}ga(r,"createContext");const a=ga(()=>{const i=n.map(l=>s.createContext(l));return ga(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,aC(a,...t)]}ga(Ds,"createContextScope");function aC(...e){const t=e[0];if(e.length===1)return t;const n=ga(()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return ga(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}ga(aC,"composeContextScopes");var SF=Object.defineProperty,Vr=(e,t)=>SF(e,"name",{value:t,configurable:!0});function sm(e){const t=e+"CollectionProvider",[n,r]=Ds(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=Vr(b=>{const{scope:k,children:S}=b,C=s.useRef(null),E=s.useRef(new Map).current;return o.jsx(a,{scope:k,itemMap:E,collectionRef:C,children:S})},"CollectionProvider");l.displayName=t;const u=e+"CollectionSlot",f=Ya(u),h=s.forwardRef((b,k)=>{const{scope:S,children:C}=b,E=i(u,S),A=pn(k,E.collectionRef);return o.jsx(f,{ref:A,children:C})});h.displayName=u;const p=e+"CollectionItemSlot",m="data-radix-collection-item",g=Ya(p),w=s.forwardRef((b,k)=>{const{scope:S,children:C,...E}=b,A=s.useRef(null),P=pn(k,A),T=i(p,S);return s.useEffect(()=>(T.itemMap.set(A,{ref:A,...E}),()=>void T.itemMap.delete(A))),o.jsx(g,{[m]:"",ref:P,children:C})});w.displayName=p;function y(b){const k=i(e+"CollectionConsumer",b);return s.useCallback(()=>{const C=k.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(k.itemMap.values()).sort((T,M)=>E.indexOf(T.ref.current)-E.indexOf(M.ref.current))},[k.collectionRef,k.itemMap])}return Vr(y,"useCollection"),[{Provider:l,Slot:h,ItemSlot:w},y,r]}Vr(sm,"createCollection");var Mx=new WeakMap,wr,Ws,Ug=(Ws=class extends Map{constructor(n){super(n);V3(this,wr);Lg(this,wr,[...super.keys()]),Mx.set(this,!0)}set(n,r){return Mx.get(this)&&(this.has(n)?ns(this,wr)[ns(this,wr).indexOf(n)]=n:ns(this,wr).push(n)),super.set(n,r),this}insert(n,r,a){const i=this.has(r),l=ns(this,wr).length,u=wv(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=[...ns(this,wr)];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 Ws(this);return i.insert(n,r,a),i}before(n){const r=ns(this,wr).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,a){const i=ns(this,wr).indexOf(n);return i===-1?this:this.insert(i,r,a)}after(n){let r=ns(this,wr).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=ns(this,wr).indexOf(n);return i===-1?this:this.insert(i+1,r,a)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Lg(this,wr,[]),super.clear()}delete(n){const r=super.delete(n);return r&&ns(this,wr).splice(ns(this,wr).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Fh(ns(this,wr),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Fh(ns(this,wr),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return ns(this,wr).indexOf(n)}keyAt(n){return Fh(ns(this,wr),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 Ws(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 Ws(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 Ws(r)}toReversed(){const n=new Ws;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 Ws(r)}slice(n,r){const a=new Ws;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}},wr=new WeakMap,Vr(Ws,"OrderedDict"),Ws);function Fh(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=oC(e,t);return n===-1?void 0:e[n]}Vr(Fh,"at");function oC(e,t){const n=e.length,r=wv(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}Vr(oC,"toSafeIndex");function wv(e){return e!==e||e===0?0:Math.trunc(e)}Vr(wv,"toSafeInteger");function EF(e){const t=e+"CollectionProvider",[n,r]=Ds(t),[a,i]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Ug,setItemMap:Vr(()=>{},"setItemMap")}),l=Vr(({state:E,...A})=>E?o.jsx(f,{...A,state:E}):o.jsx(u,{...A}),"CollectionProvider");l.displayName=t;const u=Vr(E=>{const A=k();return o.jsx(f,{...E,state:A})},"CollectionInit");u.displayName=t+"Init";const f=Vr(E=>{const{scope:A,children:P,state:T}=E,M=s.useRef(null),[j,R]=s.useState(null),L=pn(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:L,collectionRefObject:M,collectionElement:j,children:P})},"CollectionProviderImpl");f.displayName=t+"Impl";const h=e+"CollectionSlot",p=Ya(h),m=s.forwardRef((E,A)=>{const{scope:P,children:T}=E,M=i(h,P),j=pn(A,M.collectionRef);return o.jsx(p,{ref:j,children:T})});m.displayName=h;const g=e+"CollectionItemSlot",w="data-radix-collection-item",y=Ya(g),b=s.forwardRef((E,A)=>{const{scope:P,children:T,...M}=E,j=s.useRef(null),[R,L]=s.useState(null),H=pn(A,j,L),D=i(g,P),{setItemMap:B}=D,V=s.useRef(M);iC(V.current,M)||(V.current=M);const W=V.current;return s.useEffect(()=>{const K=W;return B(F=>R?F.has(R)?F.set(R,{...K,element:R}).toSorted(b6):(F.set(R,{...K,element:R}),F.toSorted(b6)):F),()=>{B(F=>!R||!F.has(R)?F:(F.delete(R),new Ug(F)))}},[R,W,B]),o.jsx(y,{[w]:"",ref:H,children:T})});b.displayName=g;function k(){return s.useState(new Ug)}Vr(k,"useInitCollection");function S(E){const{itemMap:A}=i(e+"CollectionConsumer",E);return A}return Vr(S,"useCollection"),[{Provider:l,Slot:m,ItemSlot:b},{createCollectionScope:r,useCollection:S,useInitCollection:k}]}Vr(EF,"createCollection");function iC(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}Vr(iC,"shallowEqual");function lC(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Vr(lC,"isElementPreceding");function b6(e,t){return!e[1].element||!t[1].element?0:lC(e[1].element,t[1].element)?-1:1}Vr(b6,"sortByDocumentPosition");function cC(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Vr(cC,"getChildListObserver");var CF=Object.defineProperty,hd=(e,t)=>CF(e,"name",{value:t,configurable:!0}),uC=!!(typeof window<"u"&&window.document&&window.document.createElement);function jt(e,t,{checkForDefaultPrevented:n=!0}={}){return hd(function(a){if(e==null||e(a),n===!1||!a||!a.defaultPrevented)return t==null?void 0:t(a)},"handleEvent")}hd(jt,"composeEventHandlers");function jF(e){var t;if(!uC)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}hd(jF,"getOwnerWindow");function x6(e){if(!uC)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}hd(x6,"getOwnerDocument");function dC(e,t=!1){const{activeElement:n}=x6(e);if(!(n!=null&&n.nodeName))return null;if(fC(n)&&n.contentDocument)return dC(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const a=x6(n).getElementById(r);if(a)return a}}return n}hd(dC,"getActiveElement");function fC(e){return e.tagName==="IFRAME"}hd(fC,"isFrame");var kr=globalThis!=null&&globalThis.document?s.useLayoutEffect:()=>{},AF=Object.defineProperty,NF=(e,t)=>AF(e,"name",{value:t,configurable:!0}),Rx=Ac[" useEffectEvent ".trim().toString()],Px=Ac[" useInsertionEffect ".trim().toString()];function hC(e){if(typeof Rx=="function")return Rx(e);const t=s.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Px=="function"?Px(()=>{t.current=e}):kr(()=>{t.current=e}),s.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}NF(hC,"useEffectEvent");var MF=Object.defineProperty,Sf=(e,t)=>MF(e,"name",{value:t,configurable:!0}),RF=Ac[" useInsertionEffect ".trim().toString()]||kr;function ui({prop:e,defaultProp:t,onChange:n=Sf(()=>{},"onChange"),caller:r}){const[a,i,l]=pC({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:a,h=s.useCallback(p=>{var m;if(u){const g=mC(p)?p(e):p;g!==e&&((m=l.current)==null||m.call(l,g))}else i(p)},[u,e,i,l]);return[f,h]}Sf(ui,"useControllableState");function pC({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),a=s.useRef(n),i=s.useRef(t);return RF(()=>{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]}Sf(pC,"useUncontrolledState");function mC(e){return typeof e=="function"}Sf(mC,"isFunction");var Lx=Symbol("RADIX:SYNC_STATE");function PF(e,t,n,r){const{prop:a,defaultProp:i,onChange:l,caller:u}=t,f=a!==void 0,h=hC(l),p=[{...n,state:i}];r&&p.push(r);const[m,g]=s.useReducer((k,S)=>{if(S.type===Lx)return{...k,state:S.state};const C=e(k,S);return f&&!Object.is(C.state,k.state)&&h(C.state),C},...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:Lx,state:a})},[a,m.state,f]),[b,g]}Sf(PF,"useControllableStateReducer");var LF=Object.defineProperty,di=(e,t)=>LF(e,"name",{value:t,configurable:!0});function gC(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}di(gC,"useStateMachine");var ds=di(e=>{const{present:t,children:n}=e,r=vC(t),a=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),i=wC(r.ref,yC(a));return typeof n=="function"||r.isPresent?s.cloneElement(a,{ref:i}):null},"Presence");function vC(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]=gC(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??Cu(r.current),l.current=void 0):i.current="none"},[f]),kr(()=>{const p=r.current,m=a.current;if(m!==e){const w=i.current,y=Cu(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]),kr(()=>{if(t){let p;const m=t.ownerDocument.defaultView??window,g=di(y=>{const k=Cu(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=di(y=>{y.target===t&&(i.current=Cu(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=Cu(m)}else r.current=null;n(p)},[])}}di(vC,"usePresence");function k6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}di(k6,"setRef");function wC(...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=k6(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():k6(r[l],null)}}},[])}di(wC,"useStableComposedRefs");function Cu(e){return(e==null?void 0:e.animationName)||"none"}di(Cu,"getAnimationName");function yC(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)}di(yC,"getElementRef");var $F=Object.defineProperty,TF=(e,t)=>$F(e,"name",{value:t,configurable:!0}),DF=Ac[" useId ".trim().toString()]||(()=>{}),HF=0;function ka(e){const[t,n]=s.useState(DF());return kr(()=>{e||n(r=>r??String(HF++))},[e]),e||(t?`radix-${t}`:"")}TF(ka,"useId");var OF=Object.defineProperty,bC=(e,t)=>OF(e,"name",{value:t,configurable:!0}),xC=s.createContext(void 0),IF=bC(e=>{const{dir:t,children:n}=e;return o.jsx(xC.Provider,{value:t,children:n})},"DirectionProvider");function Ef(e){const t=s.useContext(xC);return e||t||"ltr"}bC(Ef,"useDirection");var FF=IF,_F=Object.defineProperty,VF=(e,t)=>_F(e,"name",{value:t,configurable:!0});function br(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)}),[])}VF(br,"useCallbackRef");var ZF=Object.defineProperty,_r=(e,t)=>ZF(e,"name",{value:t,configurable:!0}),S6="dismissableLayer.update",zF="dismissableLayer.pointerDownOutside",BF="dismissableLayer.focusOutside",$x,kC=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Cf=s.forwardRef(_r(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(kC),[g,w]=s.useState(null),y=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=s.useState({}),k=pn(n,w),S=Array.from(m.layers),[C]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),E=C?S.indexOf(C):-1,A=g?S.indexOf(g):-1,P=m.layersWithOutsidePointerEventsDisabled.size>0,T=A>=E,M=s.useRef(!1),j=EC(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=CC(D=>{if(a&&M.current)return;const B=D.target;[...m.branches].some(W=>W.contains(B))||(u==null||u(D),f==null||f(D),D.defaultPrevented||h==null||h())},y),L=g?A===S.length-1:!1,H=br(D=>{D.key==="Escape"&&(i==null||i(D),!D.defaultPrevented&&h&&(D.preventDefault(),h()))});return s.useEffect(()=>{if(L)return y.addEventListener("keydown",H,{capture:!0}),()=>y.removeEventListener("keydown",H,{capture:!0})},[y,L,H]),s.useEffect(()=>{if(g)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&($x=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),E6(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=$x))}},[g,y,r,m]),s.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),E6())},[g,m]),s.useEffect(()=>{const D=_r(()=>b({}),"handleUpdate");return document.addEventListener(S6,D),()=>document.removeEventListener(S6,D)},[]),o.jsx(vn.div,{...p,ref:k,style:{pointerEvents:P?T?"auto":"none":void 0,...t.style},onFocusCapture:jt(t.onFocusCapture,R.onFocusCapture),onBlurCapture:jt(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:jt(t.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function SC(){const e=s.useContext(kC),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}_r(SC,"useDismissableLayerSurface");var UF=_r(()=>!0,"IS_TRUE");function EC(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:i,shouldHandlePointerDownOutside:l=UF}=t,u=br(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()}_r(g,"resetOutsideInteraction");function w(){return Array.from(p.current.values()).some(Boolean)}_r(w,"isOutsideInteractionIntercepted");function y(E){if(!h.current)return;const A=E.target;A instanceof Node&&[...i].some(T=>T.contains(A))||p.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{h.current&&m.current()},0)}_r(y,"handleInteractionCapture");function b(E){h.current&&p.current.set(E.type,!1)}_r(b,"handleInteractionBubble");const k=_r(E=>{if(E.target&&!f.current){let A=function(){n.removeEventListener("click",m.current);const T=w();g(),T||yv(zF,u,P,{discrete:!0})};if(_r(A,"handleAndDispatchPointerDownOutsideEvent"),!l(E.target)){n.removeEventListener("click",m.current),g(),f.current=!1;return}const P={originalEvent:E};h.current=!0,a.current=r&&E.button===0,p.current.clear(),!r||E.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 E of S)n.addEventListener(E,y,!0),n.addEventListener(E,b);const C=window.setTimeout(()=>{n.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(C),n.removeEventListener("pointerdown",k),n.removeEventListener("click",m.current);for(const E of S)n.removeEventListener(E,y,!0),n.removeEventListener(E,b)}},[n,u,r,a,i,l]),{onPointerDownCapture:_r(()=>f.current=!0,"onPointerDownCapture")}}_r(EC,"usePointerDownOutside");function CC(e,t=globalThis==null?void 0:globalThis.document){const n=br(e),r=s.useRef(!1);return s.useEffect(()=>{const a=_r(i=>{i.target&&!r.current&&yv(BF,n,{originalEvent:i},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:_r(()=>r.current=!0,"onFocusCapture"),onBlurCapture:_r(()=>r.current=!1,"onBlurCapture")}}_r(CC,"useFocusOutside");function E6(){const e=new CustomEvent(S6);document.dispatchEvent(e)}_r(E6,"dispatchUpdate");function yv(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?vv(a,i):a.dispatchEvent(i)}_r(yv,"handleAndDispatchCustomEvent");var WF=Object.defineProperty,vs=(e,t)=>WF(e,"name",{value:t,configurable:!0}),Wg="focusScope.autoFocusOnMount",Kg="focusScope.autoFocusOnUnmount",Tx={bubbles:!1,cancelable:!0},pd=s.forwardRef(vs(function(t,n){const{loop:r=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=t,[f,h]=s.useState(null),p=br(i),m=br(l),g=s.useRef(null),w=pn(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 P=A.target;f.contains(P)?g.current=P:Ko(g.current,{select:!0})},S=function(A){if(y.paused||!f)return;const P=A.relatedTarget;P!==null&&(f.contains(P)||Ko(g.current,{select:!0}))},C=function(A){if(document.activeElement===document.body)for(const T of A)T.removedNodes.length>0&&Ko(f)};vs(k,"handleFocusIn"),vs(S,"handleFocusOut"),vs(C,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",S);const E=new MutationObserver(C);return f&&E.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",S),E.disconnect()}}},[a,f,y.paused]),s.useEffect(()=>{if(f){Dx.add(y);const k=document.activeElement;if(!f.contains(k)){const C=new CustomEvent(Wg,Tx);f.addEventListener(Wg,p),f.dispatchEvent(C),C.defaultPrevented||(jC(PC(bv(f)),{select:!0}),document.activeElement===k&&Ko(f))}return()=>{f.removeEventListener(Wg,p),setTimeout(()=>{const C=new CustomEvent(Kg,Tx);f.addEventListener(Kg,m),f.dispatchEvent(C),C.defaultPrevented||Ko(k??document.body,{select:!0}),f.removeEventListener(Kg,m),Dx.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,C=document.activeElement;if(S&&C){const E=k.currentTarget,[A,P]=AC(E);A&&P?!k.shiftKey&&C===P?(k.preventDefault(),r&&Ko(A,{select:!0})):k.shiftKey&&C===A&&(k.preventDefault(),r&&Ko(P,{select:!0})):C===E&&k.preventDefault()}},[r,a,y.paused]);return o.jsx(vn.div,{tabIndex:-1,...u,ref:w,onKeyDown:b})},"FocusScope"));function jC(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ko(r,{select:t}),document.activeElement!==n)return}vs(jC,"focusFirst");function AC(e){const t=bv(e),n=C6(t,e),r=C6(t.reverse(),e);return[n,r]}vs(AC,"getTabbableEdges");function bv(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:vs(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}vs(bv,"getTabbableCandidates");function C6(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):NC(r,{upTo:t})))return r}vs(C6,"findVisible");function NC(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}vs(NC,"isHidden");function MC(e){return e instanceof HTMLInputElement&&"select"in e}vs(MC,"isSelectableInput");function Ko(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&MC(e)&&t&&e.select()}}vs(Ko,"focus");var Dx=RC();function RC(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=j6(e,t),e.unshift(t)},remove(t){var n;e=j6(e,t),(n=e[0])==null||n.resume()}}}vs(RC,"createFocusScopesStack");function j6(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}vs(j6,"arrayRemove");function PC(e){return e.filter(t=>t.tagName!=="A")}vs(PC,"removeLinks");var KF=Object.defineProperty,GF=(e,t)=>KF(e,"name",{value:t,configurable:!0}),jf=s.forwardRef(GF(function(t,n){var f;const{container:r,...a}=t,[i,l]=s.useState(!1);kr(()=>l(!0),[]);const u=r||i&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return u?zr.createPortal(o.jsx(vn.div,{...a,ref:n}),u):null},"Portal")),YF=Object.defineProperty,xv=(e,t)=>YF(e,"name",{value:t,configurable:!0}),lh=0,ho=null;function qF(e){return md(),e.children}xv(qF,"FocusGuards");function md(){s.useEffect(()=>{ho||(ho={start:A6(),end:A6()});const{start:e,end:t}=ho;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),lh++,()=>{lh===1&&(ho==null||ho.start.remove(),ho==null||ho.end.remove(),ho=null),lh=Math.max(0,lh-1)}},[])}xv(md,"useFocusGuards");function A6(){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}xv(A6,"createFocusGuard");var vo=function(){return vo=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},vo.apply(this,arguments)};function LC(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 XF(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 _h="right-scroll-bar-position",Vh="width-before-scroll-bar",QF="with-scroll-bars-hidden",JF="--removed-body-scroll-bar-size";function Gg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function e_(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 t_=typeof window<"u"?s.useLayoutEffect:s.useEffect,Hx=new WeakMap;function n_(e,t){var n=e_(null,function(r){return e.forEach(function(a){return Gg(a,r)})});return t_(function(){var r=Hx.get(n);if(r){var a=new Set(r),i=new Set(e),l=n.current;a.forEach(function(u){i.has(u)||Gg(u,null)}),i.forEach(function(u){a.has(u)||Gg(u,l)})}Hx.set(n,e)},[e]),n}function r_(e){return e}function s_(e,t){t===void 0&&(t=r_);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 a_(e){e===void 0&&(e={});var t=s_(null);return t.options=vo({async:!0,ssr:!1},e),t}var $C=function(e){var t=e.sideCar,n=LC(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,vo({},n))};$C.isSideCarExport=!0;function o_(e,t){return e.useMedium(t),$C}var TC=a_(),Yg=function(){},am=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:Yg,onWheelCapture:Yg,onTouchMoveCapture:Yg}),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,C=S===void 0?"div":S,E=e.gapMode,A=LC(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=g,T=n_([n,t]),M=vo(vo({},A),a);return s.createElement(s.Fragment,null,p&&s.createElement(P,{sideCar:TC,removeScrollBar:h,shards:m,noRelative:w,noIsolation:y,inert:b,setCallbacks:i,allowPinchZoom:!!k,lockRef:n,gapMode:E}),l?s.cloneElement(s.Children.only(u),vo(vo({},M),{ref:T})):s.createElement(C,vo({},M,{className:f,ref:T}),u))});am.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};am.classNames={fullWidth:Vh,zeroRight:_h};var i_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function l_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=i_();return t&&e.setAttribute("nonce",t),e}function c_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function u_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var d_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=l_())&&(c_(t,n),u_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},f_=function(){var e=d_();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},DC=function(){var e=f_(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},h_={left:0,top:0,right:0,gap:0},qg=function(e){return parseInt(e||"",10)||0},p_=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[qg(n),qg(r),qg(a)]},m_=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return h_;var t=p_(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])}},g_=DC(),Iu="data-scroll-locked",v_=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(QF,` {
54
- overflow: hidden `).concat(r,`;
55
- padding-right: `).concat(u,"px ").concat(r,`;
56
- }
57
- body[`).concat(Iu,`] {
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(_h,` {
71
- right: `).concat(u,"px ").concat(r,`;
72
- }
73
-
74
- .`).concat(Vh,` {
75
- margin-right: `).concat(u,"px ").concat(r,`;
76
- }
77
-
78
- .`).concat(_h," .").concat(_h,` {
79
- right: 0 `).concat(r,`;
80
- }
81
-
82
- .`).concat(Vh," .").concat(Vh,` {
83
- margin-right: 0 `).concat(r,`;
84
- }
85
-
86
- body[`).concat(Iu,`] {
87
- `).concat(JF,": ").concat(u,`px;
88
- }
89
- `)},Ox=function(){var e=parseInt(document.body.getAttribute(Iu)||"0",10);return isFinite(e)?e:0},w_=function(){s.useEffect(function(){return document.body.setAttribute(Iu,(Ox()+1).toString()),function(){var e=Ox()-1;e<=0?document.body.removeAttribute(Iu):document.body.setAttribute(Iu,e.toString())}},[])},y_=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;w_();var i=s.useMemo(function(){return m_(a)},[a]);return s.createElement(g_,{styles:v_(i,!t,a,n?"":"!important")})},N6=!1;if(typeof window<"u")try{var ch=Object.defineProperty({},"passive",{get:function(){return N6=!0,!0}});window.addEventListener("test",ch,ch),window.removeEventListener("test",ch,ch)}catch{N6=!1}var du=N6?{passive:!1}:!1,b_=function(e){return e.tagName==="TEXTAREA"},HC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!b_(e)&&n[t]==="visible")},x_=function(e){return HC(e,"overflowY")},k_=function(e){return HC(e,"overflowX")},Ix=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=OC(e,r);if(a){var i=IC(e,r),l=i[1],u=i[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},S_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},E_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},OC=function(e,t){return e==="v"?x_(t):k_(t)},IC=function(e,t){return e==="v"?S_(t):E_(t)},C_=function(e,t){return e==="h"&&t==="rtl"?-1:1},j_=function(e,t,n,r,a){var i=C_(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=IC(e,u),y=w[0],b=w[1],k=w[2],S=b-k-i*y;(y||S)&&OC(e,u)&&(m+=S,g+=y);var C=u.parentNode;u=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}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},uh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Fx=function(e){return[e.deltaX,e.deltaY]},_x=function(e){return e&&"current"in e?e.current:e},A_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},N_=function(e){return`
90
- .block-interactivity-`.concat(e,` {pointer-events: none;}
91
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
92
- `)},M_=0,fu=[];function R_(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),a=s.useState(M_++)[0],i=s.useState(DC)[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=XF([e.lockRef.current],(e.shards||[]).map(_x),!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=uh(b),C=n.current,E="deltaX"in b?b.deltaX:C[0]-S[0],A="deltaY"in b?b.deltaY:C[1]-S[1],P,T=b.target,M=Math.abs(E)>Math.abs(A)?"h":"v";if("touches"in b&&M==="h"&&T.type==="range")return!1;var j=window.getSelection(),R=j&&j.anchorNode,L=R?R===T||R.contains(T):!1;if(L)return!1;var H=Ix(M,T);if(!H)return!0;if(H?P=M:(P=M==="v"?"h":"v",H=Ix(M,T)),!H)return!1;if(!r.current&&"changedTouches"in b&&(E||A)&&(r.current=P),!P)return!0;var D=r.current||P;return j_(D,k,b,D==="h"?E:A)},[]),f=s.useCallback(function(b){var k=b;if(!(!fu.length||fu[fu.length-1]!==i)){var S="deltaY"in k?Fx(k):uh(k),C=t.current.filter(function(P){return P.name===k.type&&(P.target===k.target||k.target===P.shadowParent)&&A_(P.delta,S)})[0];if(C&&C.should){k.cancelable&&k.preventDefault();return}if(!C){var E=(l.current.shards||[]).map(_x).filter(Boolean).filter(function(P){return P.contains(k.target)}),A=E.length>0?u(k,E[0]):!l.current.noIsolation;A&&k.cancelable&&k.preventDefault()}}},[]),h=s.useCallback(function(b,k,S,C){var E={name:b,delta:k,target:S,should:C,shadowParent:P_(S)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(A){return A!==E})},1)},[]),p=s.useCallback(function(b){n.current=uh(b),r.current=void 0},[]),m=s.useCallback(function(b){h(b.type,Fx(b),b.target,u(b,e.lockRef.current))},[]),g=s.useCallback(function(b){h(b.type,uh(b),b.target,u(b,e.lockRef.current))},[]);s.useEffect(function(){return fu.push(i),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",f,du),document.addEventListener("touchmove",f,du),document.addEventListener("touchstart",p,du),function(){fu=fu.filter(function(b){return b!==i}),document.removeEventListener("wheel",f,du),document.removeEventListener("touchmove",f,du),document.removeEventListener("touchstart",p,du)}},[]);var w=e.removeScrollBar,y=e.inert;return s.createElement(s.Fragment,null,y?s.createElement(i,{styles:N_(a)}):null,w?s.createElement(y_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function P_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const L_=o_(TC,R_);var Af=s.forwardRef(function(e,t){return s.createElement(am,vo({},e,{ref:t,sideCar:L_}))});Af.classNames=am.classNames;var $_=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},hu=new WeakMap,dh=new WeakMap,fh={},Xg=0,FC=function(e){return e&&(e.host||FC(e.parentNode))},T_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=FC(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})},D_=function(e,t,n,r){var a=T_(t,Array.isArray(e)?e:[e]);fh[n]||(fh[n]=new WeakMap);var i=fh[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=(hu.get(g)||0)+1,k=(i.get(g)||0)+1;hu.set(g,b),i.set(g,k),l.push(g),b===1&&y&&dh.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(),Xg++,function(){l.forEach(function(m){var g=hu.get(m)-1,w=i.get(m)-1;hu.set(m,g),i.set(m,w),g||(dh.has(m)||m.removeAttribute(r),dh.delete(m)),w||m.removeAttribute(n)}),Xg--,Xg||(hu=new WeakMap,hu=new WeakMap,dh=new WeakMap,fh={})}},om=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=$_(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),D_(r,a,n,"aria-hidden")):function(){return null}},H_=Object.defineProperty,Js=(e,t)=>H_(e,"name",{value:t,configurable:!0}),kv="Dialog",[_C,VC]=Ds(kv),[O_,eo]=_C(kv),yl=Js(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]=ui({prop:r,defaultProp:a??!1,onChange:i,caller:kv}),[m,g]=s.useState(0),[w,y]=s.useState(0);return o.jsx(O_,{scope:t,triggerRef:u,contentRef:f,contentId:ka(),titleId:ka(),descriptionId:ka(),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"),I_="DialogTrigger",Sv=s.forwardRef(Js(function(t,n){const{__scopeDialog:r,...a}=t,i=eo(I_,r),l=pn(n,i.triggerRef);return o.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":im(i.open),...a,ref:l,onClick:jt(t.onClick,i.onOpenToggle)})},"DialogTrigger")),ZC="DialogPortal",[F_,zC]=_C(ZC,{forceMount:void 0}),bl=Js(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=eo(ZC,t);return o.jsx(F_,{scope:t,forceMount:n,children:s.Children.map(r,l=>o.jsx(ds,{present:n||i.open,children:o.jsx(jf,{asChild:!0,container:a,children:l})}))})},"DialogPortal"),M6="DialogOverlay",xl=s.forwardRef(Js(function(t,n){const r=zC(M6,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,l=eo(M6,t.__scopeDialog);return l.modal?o.jsx(ds,{present:a||l.open,children:o.jsx(V_,{...i,ref:n})}):null},"DialogOverlay")),__=Ya("DialogOverlay.RemoveScroll"),V_=s.forwardRef(Js(function(t,n){const{__scopeDialog:r,...a}=t,i=eo(M6,r),l=SC(),u=pn(n,l);return o.jsx(Af,{as:__,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(vn.div,{"data-state":im(i.open),...a,ref:u,style:{pointerEvents:"auto",...a.style}})})},"DialogOverlayImpl")),K0="DialogContent",kl=s.forwardRef(Js(function(t,n){const r=zC(K0,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,l=eo(K0,t.__scopeDialog);return o.jsx(ds,{present:a||l.open,children:l.modal?o.jsx(Z_,{...i,ref:n}):o.jsx(z_,{...i,ref:n})})},"DialogContent")),Z_=s.forwardRef(Js(function(t,n){const r=eo(K0,t.__scopeDialog),a=s.useRef(null),i=pn(n,r.contentRef,a);return s.useEffect(()=>{const l=a.current;if(l)return om(l)},[]),o.jsx(BC,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:jt(t.onCloseAutoFocus,l=>{var u;l.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:jt(t.onPointerDownOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&l.preventDefault()}),onFocusOutside:jt(t.onFocusOutside,l=>l.preventDefault())})},"DialogContentModal")),z_=s.forwardRef(Js(function(t,n){const r=eo(K0,t.__scopeDialog),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(BC,{...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")),BC=s.forwardRef(Js(function(t,n){const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=t,f=eo(K0,r);return md(),o.jsx(o.Fragment,{children:o.jsx(pd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Cf,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionPresent?f.descriptionId:void 0,"aria-labelledby":f.titlePresent?f.titleId:void 0,"data-state":im(f.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>f.onOpenChange(!1)})})})},"DialogContentImpl")),B_="DialogTitle",Sl=s.forwardRef(Js(function(t,n){const{__scopeDialog:r,...a}=t,i=eo(B_,r),{setTitleCount:l}=i;return kr(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),o.jsx(vn.h2,{id:i.titleId,...a,ref:n})},"DialogTitle")),U_="DialogDescription",Ev=s.forwardRef(Js(function(t,n){const{__scopeDialog:r,...a}=t,i=eo(U_,r),{setDescriptionCount:l}=i;return kr(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),o.jsx(vn.p,{id:i.descriptionId,...a,ref:n})},"DialogDescription")),W_="DialogClose",Nf=s.forwardRef(Js(function(t,n){const{__scopeDialog:r,...a}=t,i=eo(W_,r);return o.jsx(vn.button,{type:"button",...a,ref:n,onClick:jt(t.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function im(e){return e?"open":"closed"}Js(im,"getState");var K_=Object.defineProperty,wi=(e,t)=>K_(e,"name",{value:t,configurable:!0}),G_="AlertDialog",[Y_,Kde]=Ds(G_,[VC]),yi=VC(),q_=wi(e=>{const{__scopeAlertDialog:t,...n}=e,r=yi(t);return o.jsx(yl,{...r,...n,modal:!0})},"AlertDialog"),X_=s.forwardRef(wi(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=yi(r);return o.jsx(Sv,{...i,...a,ref:n})},"AlertDialogTrigger")),Q_=wi(e=>{const{__scopeAlertDialog:t,...n}=e,r=yi(t);return o.jsx(bl,{...r,...n})},"AlertDialogPortal"),J_=s.forwardRef(wi(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=yi(r);return o.jsx(xl,{...i,...a,ref:n})},"AlertDialogOverlay")),eV="AlertDialogContent",[tV,nV]=Y_(eV),rV=s.forwardRef(wi(function(t,n){const{__scopeAlertDialog:r,children:a,...i}=t,l=yi(r),u=s.useRef(null),f=pn(n,u),h=s.useRef(null);return o.jsx(tV,{scope:r,cancelRef:h,children:o.jsx(kl,{role:"alertdialog",...l,...i,ref:f,onOpenAutoFocus:jt(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")),sV=s.forwardRef(wi(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=yi(r);return o.jsx(Sl,{...i,...a,ref:n})},"AlertDialogTitle")),aV=s.forwardRef(wi(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=yi(r);return o.jsx(Ev,{...i,...a,ref:n})},"AlertDialogDescription")),oV=s.forwardRef(wi(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=yi(r);return o.jsx(Nf,{...i,...a,ref:n})},"AlertDialogAction")),iV="AlertDialogCancel",lV=s.forwardRef(wi(function(t,n){const{__scopeAlertDialog:r,...a}=t,{cancelRef:i}=nV(iV,r),l=yi(r),u=pn(n,i);return o.jsx(Nf,{...l,...a,ref:u})},"AlertDialogCancel")),cV=q_,uV=X_,dV=Q_,fV=J_,hV=rV,pV=oV,mV=lV,gV=sV,vV=aV,wV=Object.defineProperty,yV=(e,t)=>wV(e,"name",{value:t,configurable:!0});function UC(e){const[t,n]=s.useState(void 0);return kr(()=>{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}yV(UC,"useSize");const bV=["top","right","bottom","left"],dl=Math.min,Jo=Math.max,tp=Math.round,hh=Math.floor,ei=e=>({x:e,y:e}),xV={left:"right",right:"left",bottom:"top",top:"bottom"};function WC(e,t,n){return Jo(e,dl(t,n))}function fi(e,t){return typeof e=="function"?e(t):e}function fl(e){return e.split("-")[0]}function gd(e){return e.split("-")[1]}function Cv(e){return e==="x"?"y":"x"}function jv(e){return e==="y"?"height":"width"}function yo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Av(e){return Cv(yo(e))}function kV(e,t,n){n===void 0&&(n=!1);const r=gd(e),a=Av(e),i=jv(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=np(l)),[l,np(l)]}function SV(e){const t=np(e);return[R6(e),t,R6(t)]}function R6(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Vx=["left","right"],Zx=["right","left"],EV=["top","bottom"],CV=["bottom","top"];function jV(e,t,n){switch(e){case"top":case"bottom":return n?t?Zx:Vx:t?Vx:Zx;case"left":case"right":return t?EV:CV;default:return[]}}function AV(e,t,n,r){const a=gd(e);let i=jV(fl(e),n==="start",r);return a&&(i=i.map(l=>l+"-"+a),t&&(i=i.concat(i.map(R6)))),i}function np(e){const t=fl(e);return xV[t]+e.slice(t.length)}function NV(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 KC(e){return typeof e!="number"?NV(e):{top:e,right:e,bottom:e,left:e}}function rp(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 zx(e,t,n){let{reference:r,floating:a}=e;const i=yo(t),l=Av(t),u=jv(l),f=fl(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=gd(t);return y&&(w[l]+=g*(y==="end"?1:-1)*(n&&h?-1:1)),w}async function MV(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}=fi(t,e),y=KC(w),k=u[g?m==="floating"?"reference":"floating":m],S=rp(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})),C=m==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),A=await(i.isElement==null?void 0:i.isElement(E))&&await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1},P=rp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:C,offsetParent:E,strategy:f}):C);return{top:(S.top-P.top+y.top)/A.y,bottom:(P.bottom-S.bottom+y.bottom)/A.y,left:(S.left-P.left+y.left)/A.x,right:(P.right-S.right+y.right)/A.x}}const RV=50,PV=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:MV},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}=zx(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:C}=k,{x:E,y:A,data:P,reset:T}=await C({x:p,y:m,initialPlacement:r,placement:g,strategy:a,middlewareData:y,rects:h,platform:u,elements:{reference:e,floating:t}});p=E??p,m=A??m,y[S]={...y[S],...P},T&&w<RV&&(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}=zx(h,g,f)),b=-1)}return{x:p,y:m,placement:g,strategy:a,middlewareData:y}},LV=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}=fi(e,t)||{};if(h==null)return{};const m=KC(p),g={x:n,y:r},w=Av(a),y=jv(w),b=await l.getDimensions(h),k=w==="y",S=k?"top":"left",C=k?"bottom":"right",E=k?"clientHeight":"clientWidth",A=i.reference[y]+i.reference[w]-g[w]-i.floating[y],P=g[w]-i.reference[w],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let M=T?T[E]:0;(!M||!await(l.isElement==null?void 0:l.isElement(T)))&&(M=u.floating[E]||i.floating[y]);const j=A/2-P/2,R=M/2-b[y]/2-1,L=dl(m[S],R),H=dl(m[C],R),D=M-b[y]-H,B=M/2-b[y]/2+j,V=WC(L,B,D),W=!f.arrow&&gd(a)!=null&&B!==V&&i.reference[y]/2-(B<L?L:H)-b[y]/2<0,K=W?B<L?B-L:B-D:0;return{[w]:g[w]+K,data:{[w]:V,centerOffset:B-V-K,...W&&{alignmentOffset:K}},reset:W}}}),$V=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}=fi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=fl(a),C=yo(u),E=fl(u)===u,A=await(f.isRTL==null?void 0:f.isRTL(h.floating)),P=g||(E||!b?[np(u)]:SV(u)),T=y!=="none";!g&&T&&P.push(...AV(u,b,y,A));const M=[u,...P],j=await f.detectOverflow(t,k),R=[];let L=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&R.push(j[S]),m){const V=kV(a,l,A);R.push(j[V[0]],j[V[1]])}if(L=[...L,{placement:a,overflows:R}],!R.every(V=>V<=0)){var H,D;const V=(((H=i.flip)==null?void 0:H.index)||0)+1,W=M[V];if(W&&(!(m==="alignment"?C!==yo(W):!1)||L.every(_=>yo(_.placement)===C?_.overflows[0]>0:!0)))return{data:{index:V,overflows:L},reset:{placement:W}};let K=(D=L.filter(F=>F.overflows[0]<=0).sort((F,_)=>F.overflows[1]-_.overflows[1])[0])==null?void 0:D.placement;if(!K)switch(w){case"bestFit":{var B;const F=(B=L.filter(_=>{if(T){const O=yo(_.placement);return O===C||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];F&&(K=F);break}case"initialPlacement":K=u;break}if(a!==K)return{reset:{placement:K}}}return{}}}};function Bx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ux(e){return bV.some(t=>e[t]>=0)}const TV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=fi(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),u=Bx(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Ux(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),u=Bx(l,n.floating);return{data:{escapedOffsets:u,escaped:Ux(u)}}}default:return{}}}}},GC=new Set(["left","top"]);async function DV(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=fl(n),u=gd(n),f=yo(n)==="y",h=GC.has(l)?-1:1,p=i&&f?-1:1,m=fi(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 HV=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 DV(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}}}}},OV=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:C=>{let{x:E,y:A}=C;return{x:E,y:A}}},...h}=fi(e,t),p={x:n,y:r},m=await i.detectOverflow(t,h),g=yo(a),w=Cv(g);let y=p[w],b=p[g];const k=(C,E)=>WC(E+m[C==="y"?"top":"left"],E,E-m[C==="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}}}}}},IV=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}=fi(e,t),g={x:a,y:i},w=yo(l),y=Cv(w);let b=g[y],k=g[w];const S=fi(h,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:(n=S.mainAxis)!=null?n:0,crossAxis:(r=S.crossAxis)!=null?r:0};if(p){const P=y==="y"?"height":"width",T=u.reference[y]-u.floating[P]+C.mainAxis,M=u.reference[y]+u.reference[P]-C.mainAxis;b<T?b=T:b>M&&(b=M)}if(m){var E,A;const P=y==="y"?"width":"height",T=GC.has(fl(l)),M=u.reference[w]-u.floating[P]+(T&&((E=f.offset)==null?void 0:E[w])||0)+(T?0:C.crossAxis),j=u.reference[w]+u.reference[P]+(T?0:((A=f.offset)==null?void 0:A[w])||0)-(T?C.crossAxis:0);k<M?k=M:k>j&&(k=j)}return{[y]:b,[w]:k}}}},FV=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}=fi(e,t),f=await a.detectOverflow(t,u),h=fl(n),p=gd(n),m=yo(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,C=dl(w-f[y],k),E=dl(g-f[b],S),A=t.middlewareData.shift,P=!A;let T=C,M=E;A!=null&&A.enabled.x&&(M=S),A!=null&&A.enabled.y&&(T=k),P&&!p&&(m?M=g-2*Jo(f.left,f.right):T=w-2*Jo(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 lm(){return typeof window<"u"}function vd(e){return YC(e)?(e.nodeName||"").toLowerCase():"#document"}function Ls(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bi(e){var t;return(t=(YC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function YC(e){return lm()?e instanceof Node||e instanceof Ls(e).Node:!1}function jo(e){return lm()?e instanceof Element||e instanceof Ls(e).Element:!1}function El(e){return lm()?e instanceof HTMLElement||e instanceof Ls(e).HTMLElement:!1}function Wx(e){return!lm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ls(e).ShadowRoot}function cm(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ao(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function _V(e){return/^(table|td|th)$/.test(vd(e))}function um(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const VV=/transform|translate|scale|rotate|perspective|filter/,ZV=/paint|layout|strict|content/,Gl=e=>!!e&&e!=="none";let Qg;function Nv(e){const t=jo(e)?Ao(e):e;return Gl(t.transform)||Gl(t.translate)||Gl(t.scale)||Gl(t.rotate)||Gl(t.perspective)||!Mv()&&(Gl(t.backdropFilter)||Gl(t.filter))||VV.test(t.willChange||"")||ZV.test(t.contain||"")}function zV(e){let t=gc(e);for(;El(t)&&!G0(t);){if(Nv(t))return t;if(um(t))return null;t=gc(t)}return null}function Mv(){return Qg==null&&(Qg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qg}function G0(e){return/^(html|body|#document)$/.test(vd(e))}function Ao(e){return Ls(e).getComputedStyle(e)}function dm(e){return jo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gc(e){if(vd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Wx(e)&&e.host||bi(e);return Wx(t)?t.host:t}function qC(e){const t=gc(e);return G0(t)?(e.ownerDocument||e).body:El(t)&&cm(t)?t:qC(t)}function Y0(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=qC(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=Ls(a);if(i){const u=P6(l);return t.concat(l,l.visualViewport||[],cm(a)?a:[],u&&n?Y0(u):[])}else return t.concat(a,Y0(a,[],n))}function P6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function XC(e){const t=Ao(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=El(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=tp(n)!==i||tp(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function Rv(e){return jo(e)?e:e.contextElement}function Fu(e){const t=Rv(e);if(!El(t))return ei(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=XC(t);let l=(i?tp(n.width):n.width)/r,u=(i?tp(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const BV=ei(0);function QC(e){const t=Ls(e);return!Mv()||!t.visualViewport?BV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function UV(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ls(e)}function vc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=Rv(e);let l=ei(1);t&&(r?jo(r)&&(l=Fu(r)):l=Fu(e));const u=UV(i,n,r)?QC(i):ei(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=Ls(i),w=jo(r)?Ls(r):r;let y=g,b=P6(y);for(;b&&w!==y;){const k=Fu(b),S=b.getBoundingClientRect(),C=Ao(b),E=S.left+(b.clientLeft+parseFloat(C.paddingLeft))*k.x,A=S.top+(b.clientTop+parseFloat(C.paddingTop))*k.y;f*=k.x,h*=k.y,p*=k.x,m*=k.y,f+=E,h+=A,y=Ls(b),b=P6(y)}}return rp({width:p,height:m,x:f,y:h})}function fm(e,t){const n=dm(e).scrollLeft;return t?t.left+n:vc(bi(e)).left+n}function JC(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-fm(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function WV(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=bi(r),u=t?um(t.floating):!1;if(r===l||u&&i)return n;let f={scrollLeft:0,scrollTop:0},h=ei(1);const p=ei(0),m=El(r);if((m||!i)&&((vd(r)!=="body"||cm(l))&&(f=dm(r)),m)){const w=vc(r);h=Fu(r),p.x=w.x+r.clientLeft,p.y=w.y+r.clientTop}const g=l&&!m&&!i?JC(l,f):ei(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 KV(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function GV(e){const t=dm(e),n=e.ownerDocument.body,r=Jo(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=Jo(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+fm(e);const l=-t.scrollTop;return Ao(n).direction==="rtl"&&(i+=Jo(e.clientWidth,n.clientWidth)-r),{width:r,height:a,x:i,y:l}}const YV=25;function qV(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",a=Ls(e),i=bi(e),l=a.visualViewport;let u=i.clientWidth,f=i.clientHeight,h=0,p=0;if(l){const g=!Mv()||t==="fixed";r?g||(h=-l.offsetLeft,p=-l.offsetTop):(u=l.width,f=l.height,g&&(h=l.offsetLeft,p=l.offsetTop))}if(fm(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<=YV&&(u-=S)}return{width:u,height:f,x:h,y:p}}function XV(e,t){const n=vc(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Fu(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 Kx(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=qV(e,n,t);else if(t==="document")r=GV(bi(e));else if(jo(t))r=XV(t,n);else{const a=QC(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return rp(r)}function QV(e,t){const n=t.get(e);if(n)return n;let r=Y0(e,[],!1).filter(u=>jo(u)&&vd(u)!=="body"),a=null;const i=Ao(e).position==="fixed";let l=i?gc(e):e;for(;jo(l)&&!G0(l);){const u=Ao(l),f=Nv(l),h=a?a.position:i?"fixed":"";!f&&(h==="fixed"||h==="absolute"&&u.position==="static")?r=r.filter(m=>m!==l):a=u,l=gc(l)}return t.set(e,r),r}function JV(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?um(t)?[]:QV(t,this._c):[].concat(n),r],u=Kx(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=Kx(t,l[g],a);f=Jo(w.top,f),h=dl(w.right,h),p=dl(w.bottom,p),m=Jo(w.left,m)}return{width:h-m,height:p-f,x:m,y:f}}function eZ(e){const{width:t,height:n}=XC(e);return{width:t,height:n}}function tZ(e,t,n){const r=El(t),a=bi(t),i=n==="fixed",l=vc(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const f=ei(0);if((r||!i)&&((vd(t)!=="body"||cm(a))&&(u=dm(t)),r)){const g=vc(t,!0,i,t);f.x=g.x+t.clientLeft,f.y=g.y+t.clientTop}!r&&a&&(f.x=fm(a));const h=a&&!r&&!i?JC(a,u):ei(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 Jg(e){return Ao(e).position==="static"}function Gx(e,t){if(!El(e)||Ao(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return bi(e)===n&&(n=n.ownerDocument.body),n}function ej(e,t){const n=Ls(e);if(um(e))return n;if(!El(e)){let a=gc(e);for(;a&&!G0(a);){if(jo(a)&&!Jg(a))return a;a=gc(a)}return n}let r=Gx(e,t);for(;r&&_V(r)&&Jg(r);)r=Gx(r,t);return r&&G0(r)&&Jg(r)&&!Nv(r)?n:r||zV(e)||n}const nZ=async function(e){const t=this.getOffsetParent||ej,n=this.getDimensions,r=await n(e.floating);return{reference:tZ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rZ(e){return Ao(e).direction==="rtl"}const sZ={convertOffsetParentRelativeRectToViewportRelativeRect:WV,getDocumentElement:bi,getClippingRect:JV,getOffsetParent:ej,getElementRects:nZ,getClientRects:KV,getDimensions:eZ,getScale:Fu,isElement:jo,isRTL:rZ};function tj(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function aZ(e,t,n){let r=null,a;const i=bi(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=hh(y),C=hh(i.clientWidth-(w+b)),E=hh(i.clientHeight-(y+k)),A=hh(w),T={rootMargin:-S+"px "+-C+"px "+-E+"px "+-A+"px",threshold:Jo(0,dl(1,m))||1};let M=!0;function j(R){const L=R[0].intersectionRatio;if(!tj(g,e.getBoundingClientRect()))return u();if(L!==m){if(!M)return u();L?u(!1,L):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=Ls(e),h=()=>u(n);return f.addEventListener("resize",h),u(!0),()=>{f.removeEventListener("resize",h),l()}}function nj(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=Rv(e),p=a||i?[...h?Y0(h):[],...t?Y0(t):[]]:[];p.forEach(S=>{a&&S.addEventListener("scroll",n),i&&S.addEventListener("resize",n)});const m=h&&u?aZ(h,n,i):null;let g=-1,w=null;l&&(w=new ResizeObserver(S=>{let[C]=S;C&&C.target===h&&w&&t&&(w.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=w)==null||E.observe(t)})),n()}),h&&!f&&w.observe(h),t&&w.observe(t));let y,b=f?vc(e):null;f&&k();function k(){const S=vc(e);b&&!tj(b,S)&&n(),b=S,y=requestAnimationFrame(k)}return n(),()=>{var S;p.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),m==null||m(),(S=w)==null||S.disconnect(),w=null,f&&cancelAnimationFrame(y)}}const rj=HV,sj=OV,aj=$V,oZ=FV,iZ=TV,L6=LV,lZ=IV,oj=(e,t,n)=>{const r=new Map,a=n??{},i={...sZ,...a.platform,_c:r};return PV(e,t,{...a,platform:i})};var cZ=typeof document<"u",uZ=function(){},Zh=cZ?s.useLayoutEffect:uZ;function sp(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(!sp(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)&&!sp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ij(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yx(e,t){const n=ij(e);return Math.round(t*n)/n}function e8(e){const t=s.useRef(e);return Zh(()=>{t.current=e}),t}function dZ(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);sp(g,r)||w(r);const[y,b]=s.useState(null),[k,S]=s.useState(null),C=s.useCallback(_=>{_!==T.current&&(T.current=_,b(_))},[]),E=s.useCallback(_=>{_!==M.current&&(M.current=_,S(_))},[]),A=i||y,P=l||k,T=s.useRef(null),M=s.useRef(null),j=s.useRef(p),R=f!=null,L=e8(f),H=e8(a),D=e8(h),B=s.useCallback(()=>{if(!T.current||!M.current)return;const _={placement:t,strategy:n,middleware:g};H.current&&(_.platform=H.current),oj(T.current,M.current,_).then(O=>{const Y={...O,isPositioned:D.current!==!1};V.current&&!sp(j.current,Y)&&(j.current=Y,zr.flushSync(()=>{m(Y)}))})},[g,t,n,H,D]);Zh(()=>{h===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,m(_=>({..._,isPositioned:!1})))},[h]);const V=s.useRef(!1);Zh(()=>(V.current=!0,()=>{V.current=!1}),[]),Zh(()=>{if(A&&(T.current=A),P&&(M.current=P),A&&P){if(L.current)return L.current(A,P,B);B()}},[A,P,B,L,R]);const W=s.useMemo(()=>({reference:T,floating:M,setReference:C,setFloating:E}),[C,E]),K=s.useMemo(()=>({reference:A,floating:P}),[A,P]),F=s.useMemo(()=>{const _={position:n,left:0,top:0};if(!K.floating)return _;const O=Yx(K.floating,p.x),Y=Yx(K.floating,p.y);return u?{..._,transform:"translate("+O+"px, "+Y+"px)",...ij(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Y}},[n,u,K.floating,p.x,p.y]);return s.useMemo(()=>({...p,update:B,refs:W,elements:K,floatingStyles:F}),[p,B,W,K,F])}const fZ=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?L6({element:r.current,padding:a}).fn(n):{}:r?L6({element:r,padding:a}).fn(n):{}}}},hZ=(e,t)=>{const n=rj(e);return{name:n.name,fn:n.fn,options:[e,t]}},pZ=(e,t)=>{const n=sj(e);return{name:n.name,fn:n.fn,options:[e,t]}},mZ=(e,t)=>({fn:lZ(e).fn,options:[e,t]}),gZ=(e,t)=>{const n=aj(e);return{name:n.name,fn:n.fn,options:[e,t]}},vZ=(e,t)=>{const n=oZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},wZ=(e,t)=>{const n=iZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},yZ=(e,t)=>{const n=fZ(e);return{name:n.name,fn:n.fn,options:[e,t]}};var bZ=Object.defineProperty,xZ=(e,t)=>bZ(e,"name",{value:t,configurable:!0}),kZ=s.forwardRef(xZ(function(t,n){const{children:r,width:a=10,height:i=5,...l}=t;return o.jsx(vn.svg,{...l,ref:n,width:a,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),SZ=kZ,EZ=Object.defineProperty,ti=(e,t)=>EZ(e,"name",{value:t,configurable:!0}),lj="Popper",[cj,Cl]=Ds(lj),[CZ,uj]=cj(lj),jZ=ti(e=>{const{__scopePopper:t,children:n}=e,[r,a]=s.useState(null),[i,l]=s.useState(void 0);return o.jsx(CZ,{scope:t,anchor:r,onAnchorChange:a,placementState:i,setPlacementState:l,children:n})},"Popper"),AZ="PopperAnchor",NZ=s.forwardRef(ti(function(t,n){const{__scopePopper:r,virtualRef:a,...i}=t,l=uj(AZ,r),u=s.useRef(null),f=l.onAnchorChange,h=s.useCallback(b=>{u.current=b,b&&f(b)},[f]),p=pn(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&&hm(l.placementState),w=g==null?void 0:g[0],y=g==null?void 0:g[1];return a?null:o.jsx(vn.div,{"data-radix-popper-side":w,"data-radix-popper-align":y,...i,ref:p})},"PopperAnchor")),dj="PopperContent",[MZ,RZ]=cj(dj),PZ=s.forwardRef(ti(function(t,n){var ee,Q,he,Me,ce,ke,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=uj(dj,r),[C,E]=s.useState(null),A=pn(n,E),[P,T]=s.useState(null),M=UC(P),j=(M==null?void 0:M.width)??0,R=(M==null?void 0:M.height)??0,L=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(fj),altBoundary:B},{refs:W,floatingStyles:K,placement:F,isPositioned:_,middlewareData:O}=dZ({strategy:"fixed",placement:L,whileElementsMounted:ti((...ft)=>nj(...ft,{animationFrame:y==="always"}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[hZ({mainAxis:i+R,alignmentAxis:u}),h&&pZ({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?mZ():void 0,...V}),h&&gZ({...V}),vZ({...V,apply:ti(({elements:ft,rects:Ue,availableWidth:Qe,availableHeight:Pe})=>{const{width:G,height:se}=Ue.reference,We=ft.floating.style;We.setProperty("--radix-popper-available-width",`${Qe}px`),We.setProperty("--radix-popper-available-height",`${Pe}px`),We.setProperty("--radix-popper-anchor-width",`${G}px`),We.setProperty("--radix-popper-anchor-height",`${se}px`)},"apply")}),P&&yZ({element:P,padding:f}),DZ({arrowWidth:j,arrowHeight:R}),w&&wZ({strategy:"referenceHidden",...V,boundary:B?V.boundary:void 0})]}),Y=S.setPlacementState;kr(()=>(Y(F),()=>{Y(void 0)}),[F,Y]);const[z,X]=hm(F),Z=br(b);kr(()=>{_&&(Z==null||Z())},[_,Z]);const J=(ee=O.arrow)==null?void 0:ee.x,me=(Q=O.arrow)==null?void 0:Q.y,ne=((he=O.arrow)==null?void 0:he.centerOffset)!==0,[fe,re]=s.useState();return kr(()=>{C&&re(window.getComputedStyle(C).zIndex)},[C]),o.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:_?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(Me=O.transformOrigin)==null?void 0:Me.x,(ce=O.transformOrigin)==null?void 0:ce.y].join(" "),...((ke=O.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(MZ,{scope:r,placedSide:z,placedAlign:X,onArrowChange:T,arrowX:J,arrowY:me,shouldHideArrow:ne,children:o.jsx(vn.div,{"data-side":z,"data-align":X,...k,ref:A,style:{...k.style,animation:_?(Be=k.style)==null?void 0:Be.animation:"none"}})})})},"PopperContent")),LZ="PopperArrow",$Z={top:"bottom",right:"left",bottom:"top",left:"right"},TZ=s.forwardRef(ti(function(t,n){const{__scopePopper:r,...a}=t,i=RZ(LZ,r),l=$Z[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(SZ,{...a,ref:n,style:{...a.style,display:"block"}})})},"PopperArrow"));function fj(e){return e!==null}ti(fj,"isNotNull");var DZ=ti(e=>({name:"transformOrigin",options:e,fn(t){var k,S,C;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]=hm(n),m={start:"0%",center:"50%",end:"100%"}[p],g=(((S=a.arrow)==null?void 0:S.x)??0)+u/2,w=(((C=a.arrow)==null?void 0:C.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 hm(e){const[t,n="center"]=e.split("-");return[t,n]}ti(hm,"getSideAndAlignFromPlacement");var pm=jZ,Mf=NZ,mm=PZ,HZ=TZ,OZ=Object.defineProperty,Pv=(e,t)=>OZ(e,"name",{value:t,configurable:!0}),t8=!1;function hj(){const[e,t]=s.useState(t8);return s.useEffect(()=>{t8||(t8=!0,t(!0))},[]),e}Pv(hj,"useIsHydrated");var pj=Ac[" useSyncExternalStore ".trim().toString()];function mj(){return()=>{}}Pv(mj,"subscribe");function gj(){return pj(mj,()=>!0,()=>!1)}Pv(gj,"useIsHydratedModern");var IZ=typeof pj=="function"?gj:hj,FZ=Object.defineProperty,$c=(e,t)=>FZ(e,"name",{value:t,configurable:!0}),n8="rovingFocusGroup.onEntryFocus",_Z={bubbles:!1,cancelable:!0},gm="RovingFocusGroup",[$6,vj,VZ]=sm(gm),[ZZ,wj]=Ds(gm,[VZ]),[zZ,BZ]=ZZ(gm),UZ=s.forwardRef($c(function(t,n){return o.jsx($6.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx($6.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(WZ,{...t,ref:n})})})},"RovingFocusGroup")),WZ=s.forwardRef($c(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=pn(n,w),b=Ef(l),[k,S]=ui({prop:u,defaultProp:f??null,onChange:h,caller:gm}),[C,E]=s.useState(!1),A=br(p),P=vj(r),T=s.useRef(!1),[M,j]=s.useState(0);return s.useEffect(()=>{const R=w.current;if(R)return R.addEventListener(n8,A),()=>R.removeEventListener(n8,A)},[A]),o.jsx(zZ,{scope:r,orientation:a,dir:b,loop:i,currentTabStopId:k,onItemFocus:s.useCallback(R=>S(R),[S]),onItemShiftTab:s.useCallback(()=>E(!0),[]),onFocusableItemAdd:s.useCallback(()=>j(R=>R+1),[]),onFocusableItemRemove:s.useCallback(()=>j(R=>R-1),[]),children:o.jsx(vn.div,{tabIndex:C||M===0?-1:0,"data-orientation":a,...g,ref:y,style:{outline:"none",...t.style},onMouseDown:jt(t.onMouseDown,()=>{T.current=!0}),onFocus:jt(t.onFocus,R=>{const L=!T.current;if(R.target===R.currentTarget&&L&&!C){const H=new CustomEvent(n8,_Z);if(R.currentTarget.dispatchEvent(H),!H.defaultPrevented){const D=P().filter(F=>F.focusable),B=D.find(F=>F.active),V=D.find(F=>F.id===k),K=[B,V,...D].filter(Boolean).map(F=>F.ref.current);Lv(K,m)}}T.current=!1}),onBlur:jt(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),KZ="RovingFocusGroupItem",GZ=s.forwardRef($c(function(t,n){const{__scopeRovingFocusGroup:r,focusable:a=!0,active:i=!1,tabStopId:l,children:u,...f}=t,h=ka(),p=l||h,m=BZ(KZ,r),g=m.currentTabStopId===p,w=vj(r),{onFocusableItemAdd:y,onFocusableItemRemove:b,currentTabStopId:k}=m,S=IZ();return kr(()=>{if(!(!S||!a))return y(),()=>b()},[S,a,y,b]),s.useEffect(()=>{if(!(S||!a))return y(),()=>b()},[S,a,y,b]),o.jsx($6.ItemSlot,{scope:r,id:p,focusable:a,active:i,children:o.jsx(vn.span,{tabIndex:g?0:-1,"data-orientation":m.orientation,...f,ref:n,onMouseDown:jt(t.onMouseDown,C=>{a?m.onItemFocus(p):C.preventDefault()}),onFocus:jt(t.onFocus,()=>m.onItemFocus(p)),onKeyDown:jt(t.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){m.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const E=bj(C,m.orientation,m.dir);if(E!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let P=w().filter(T=>T.focusable).map(T=>T.ref.current);if(E==="last")P.reverse();else if(E==="prev"||E==="next"){E==="prev"&&P.reverse();const T=P.indexOf(C.currentTarget);P=m.loop?xj(P,T+1):P.slice(T+1)}setTimeout(()=>Lv(P))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:k!=null}):u})})},"RovingFocusGroupItem")),YZ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function yj(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}$c(yj,"getDirectionAwareKey");function bj(e,t,n){const r=yj(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return YZ[r]}$c(bj,"getFocusIntent");function Lv(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}$c(Lv,"focusFirst");function xj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}$c(xj,"wrapArray");var qZ=UZ,XZ=GZ,QZ=Object.defineProperty,$n=(e,t)=>QZ(e,"name",{value:t,configurable:!0}),T6=["Enter"," "],JZ=["ArrowDown","PageUp","Home"],kj=["ArrowUp","PageDown","End"],ez=[...JZ,...kj],tz={ltr:[...T6,"ArrowRight"],rtl:[...T6,"ArrowLeft"]},nz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},vm="Menu",[q0,rz,sz]=sm(vm),[Tc,wm]=Ds(vm,[sz,Cl,wj]),$v=Cl(),Sj=wj(),[az,Dc]=Tc(vm),[oz,Rf]=Tc(vm),iz=$n(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:l=!0}=e,u=$v(t),[f,h]=s.useState(null),p=s.useRef(!1),m=br(i),g=Ef(a);return s.useEffect(()=>{const w=$n(()=>{p.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},"handleKeyDown"),y=$n(()=>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=$n(()=>m(!1),"handleBlur");return window.addEventListener("blur",w),()=>window.removeEventListener("blur",w)},[n,m]),o.jsx(pm,{...u,children:o.jsx(az,{scope:t,open:n,onOpenChange:m,content:f,onContentChange:h,children:o.jsx(oz,{scope:t,onClose:s.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:g,modal:l,children:r})})})},"Menu"),Ej=s.forwardRef($n(function(t,n){const{__scopeMenu:r,...a}=t,i=$v(r);return o.jsx(Mf,{...i,...a,ref:n})},"MenuAnchor")),Cj="MenuPortal",[lz,jj]=Tc(Cj,{forceMount:void 0}),cz=$n(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=Dc(Cj,t);return o.jsx(lz,{scope:t,forceMount:n,children:o.jsx(ds,{present:n||i.open,children:o.jsx(jf,{asChild:!0,container:a,children:r})})})},"MenuPortal"),Ba="MenuContent",[uz,Tv]=Tc(Ba),dz=s.forwardRef($n(function(t,n){const r=jj(Ba,t.__scopeMenu),{forceMount:a=r.forceMount,...i}=t,l=Dc(Ba,t.__scopeMenu),u=Rf(Ba,t.__scopeMenu);return o.jsx(q0.Provider,{scope:t.__scopeMenu,children:o.jsx(ds,{present:a||l.open,children:o.jsx(q0.Slot,{scope:t.__scopeMenu,children:u.modal?o.jsx(fz,{...i,ref:n}):o.jsx(hz,{...i,ref:n})})})})},"MenuContent")),fz=s.forwardRef($n(function(t,n){const r=Dc(Ba,t.__scopeMenu),a=s.useRef(null),i=pn(n,a);return s.useEffect(()=>{const l=a.current;if(l)return om(l)},[]),o.jsx(Dv,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:jt(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),hz=s.forwardRef($n(function(t,n){const r=Dc(Ba,t.__scopeMenu);return o.jsx(Dv,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),pz=Ya("MenuContent.ScrollLock"),Dv=s.forwardRef($n(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=Dc(Ba,r),C=Rf(Ba,r),E=$v(r),A=Sj(r),P=rz(r),[T,M]=s.useState(null),j=s.useRef(null),R=pn(n,j,S.onContentChange),L=s.useRef(0),H=s.useRef(""),D=s.useRef(0),B=s.useRef(null),V=s.useRef("right"),W=s.useRef(0),K=b?Af:s.Fragment,F=b?{as:pz,allowPinchZoom:!0}:void 0,_=$n(Y=>{var re,ee;const z=H.current+Y,X=P().filter(Q=>!Q.disabled),Z=document.activeElement,J=(re=X.find(Q=>Q.ref.current===Z))==null?void 0:re.textValue,me=X.map(Q=>Q.textValue),ne=Tj(me,z,J),fe=(ee=X.find(Q=>Q.textValue===ne))==null?void 0:ee.ref.current;$n((function Q(he){H.current=he,window.clearTimeout(L.current),he!==""&&(L.current=window.setTimeout(()=>Q(""),1e3))}),"updateSearch")(z),fe&&setTimeout(()=>fe.focus())},"handleTypeaheadSearch");s.useEffect(()=>()=>window.clearTimeout(L.current),[]),md();const O=s.useCallback(Y=>{var X,Z;return V.current===((X=B.current)==null?void 0:X.side)&&Hj(Y,(Z=B.current)==null?void 0:Z.area)},[]);return o.jsx(uz,{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(K,{...F,children:o.jsx(pd,{asChild:!0,trapped:i,onMountAutoFocus:jt(l,Y=>{var z;Y.preventDefault(),(z=j.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:o.jsx(Cf,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:w,onDismiss:y,children:o.jsx(qZ,{asChild:!0,...A,dir:C.dir,orientation:"vertical",loop:a,currentTabStopId:T,onCurrentTabStopIdChange:M,onEntryFocus:jt(h,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(mm,{role:"menu","aria-orientation":"vertical","data-state":Ov(S.open),"data-radix-menu-content":"",dir:C.dir,...E,...k,ref:R,style:{outline:"none",...k.style},onKeyDown:jt(k.onKeyDown,Y=>{const X=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,Z=Y.ctrlKey||Y.altKey||Y.metaKey,J=Y.key.length===1;X&&(Y.key==="Tab"&&Y.preventDefault(),!Z&&J&&_(Y.key));const me=j.current;if(Y.target!==me||!ez.includes(Y.key))return;Y.preventDefault();const fe=P().filter(re=>!re.disabled).map(re=>re.ref.current);kj.includes(Y.key)&&fe.reverse(),Lj(fe)}),onBlur:jt(t.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(L.current),H.current="")}),onPointerMove:jt(t.onPointerMove,ed(Y=>{const z=Y.target,X=W.current!==Y.clientX;if(Y.currentTarget.contains(z)&&X){const Z=Y.clientX>W.current?"right":"left";V.current=Z,W.current=Y.clientX}}))})})})})})})},"MenuContentImpl")),Aj=s.forwardRef($n(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(vn.div,{role:"group",...a,ref:n})},"MenuGroup")),mz=s.forwardRef($n(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(vn.div,{...a,ref:n})},"MenuLabel")),D6="MenuItem",qx="menu.itemSelect",Hv=s.forwardRef($n(function(t,n){const{disabled:r=!1,onSelect:a,...i}=t,l=s.useRef(null),u=Rf(D6,t.__scopeMenu),f=Tv(D6,t.__scopeMenu),h=pn(n,l),p=s.useRef(!1),m=$n(()=>{const g=l.current;if(!r&&g){const w=new CustomEvent(qx,{bubbles:!0,cancelable:!0});g.addEventListener(qx,y=>a==null?void 0:a(y),{once:!0}),vv(g,w),w.defaultPrevented?p.current=!1:u.onClose()}},"handleSelect");return o.jsx(Nj,{...i,ref:h,disabled:r,onClick:jt(t.onClick,m),onPointerDown:g=>{var w;(w=t.onPointerDown)==null||w.call(t,g),p.current=!0},onPointerUp:jt(t.onPointerUp,g=>{var w;p.current||(w=g.currentTarget)==null||w.click()}),onKeyDown:jt(t.onKeyDown,g=>{r||g.target!==g.currentTarget||f.searchRef.current!==""&&g.key===" "||T6.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})},"MenuItem")),Nj=s.forwardRef($n(function(t,n){const{__scopeMenu:r,disabled:a=!1,textValue:i,...l}=t,u=Tv(D6,r),f=Sj(r),h=s.useRef(null),p=pn(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(q0.ItemSlot,{scope:r,disabled:a,textValue:i??w,children:o.jsx(XZ,{asChild:!0,...f,focusable:!a,children:o.jsx(vn.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:p,onPointerMove:jt(t.onPointerMove,ed(b=>{a?u.onItemLeave(b):(u.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:jt(t.onPointerLeave,ed(b=>u.onItemLeave(b))),onFocus:jt(t.onFocus,()=>g(!0)),onBlur:jt(t.onBlur,()=>g(!1))})})})},"MenuItemImpl")),gz=s.forwardRef($n(function(t,n){const{checked:r=!1,onCheckedChange:a,...i}=t;return o.jsx(Rj,{scope:t.__scopeMenu,checked:r,children:o.jsx(Hv,{role:"menuitemcheckbox","aria-checked":X0(r)?"mixed":r,...i,ref:n,"data-state":ym(r),onSelect:jt(i.onSelect,()=>a==null?void 0:a(X0(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),vz="MenuRadioGroup",[wz,yz]=Tc(vz,{value:void 0,onValueChange:$n(()=>{},"onValueChange")}),bz=s.forwardRef($n(function(t,n){const{value:r,onValueChange:a,...i}=t,l=br(a);return o.jsx(wz,{scope:t.__scopeMenu,value:r,onValueChange:l,children:o.jsx(Aj,{...i,ref:n})})},"MenuRadioGroup")),xz="MenuRadioItem",kz=s.forwardRef($n(function(t,n){const{value:r,...a}=t,i=yz(xz,t.__scopeMenu),l=r===i.value;return o.jsx(Rj,{scope:t.__scopeMenu,checked:l,children:o.jsx(Hv,{role:"menuitemradio","aria-checked":l,...a,ref:n,"data-state":ym(l),onSelect:jt(a.onSelect,()=>{var u;return(u=i.onValueChange)==null?void 0:u.call(i,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Mj="MenuItemIndicator",[Rj,Sz]=Tc(Mj,{checked:!1}),Ez=s.forwardRef($n(function(t,n){const{__scopeMenu:r,forceMount:a,...i}=t,l=Sz(Mj,r);return o.jsx(ds,{present:a||X0(l.checked)||l.checked===!0,children:o.jsx(vn.span,{...i,ref:n,"data-state":ym(l.checked)})})},"MenuItemIndicator")),Cz=s.forwardRef($n(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(vn.div,{role:"separator","aria-orientation":"horizontal",...a,ref:n})},"MenuSeparator")),jz="MenuSub",[Gde,Pj]=Tc(jz),ph="MenuSubTrigger",Az=s.forwardRef($n(function(t,n){const r=Dc(ph,t.__scopeMenu),a=Rf(ph,t.__scopeMenu),i=Pj(ph,t.__scopeMenu),l=Tv(ph,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=pn(n,i.onTriggerChange);return o.jsx(Ej,{asChild:!0,...p,children:o.jsx(Nj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?i.contentId:void 0,"data-state":Ov(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:jt(t.onPointerMove,ed(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:jt(t.onPointerLeave,ed(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,C=S==="right",E=C?-5:5,A=y[C?"left":"right"],P=y[C?"right":"left"];l.onPointerGraceIntentChange({area:[{x:w.clientX+E,y:w.clientY},{x:A,y:y.top},{x:P,y:y.top},{x:P,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:jt(t.onKeyDown,w=>{var b;t.disabled||w.target!==w.currentTarget||l.searchRef.current!==""&&w.key===" "||tz[a.dir].includes(w.key)&&(r.onOpenChange(!0),(b=r.content)==null||b.focus(),w.preventDefault())})})})},"MenuSubTrigger")),Nz="MenuSubContent",Mz=s.forwardRef($n(function(t,n){const r=jj(Ba,t.__scopeMenu),{forceMount:a=r.forceMount,align:i="start",...l}=t,u=Dc(Ba,t.__scopeMenu),f=Rf(Ba,t.__scopeMenu),h=Pj(Nz,t.__scopeMenu),p=s.useRef(null),m=pn(n,p);return o.jsx(q0.Provider,{scope:t.__scopeMenu,children:o.jsx(ds,{present:a||u.open,children:o.jsx(q0.Slot,{scope:t.__scopeMenu,children:o.jsx(Dv,{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:jt(t.onFocusOutside,g=>{g.target!==h.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:jt(t.onEscapeKeyDown,g=>{f.onClose(),g.preventDefault()}),onKeyDown:jt(t.onKeyDown,g=>{var b;const w=g.currentTarget.contains(g.target),y=nz[f.dir].includes(g.key);w&&y&&(u.onOpenChange(!1),(b=h.trigger)==null||b.focus(),g.preventDefault())})})})})})},"MenuSubContent"));function Ov(e){return e?"open":"closed"}$n(Ov,"getOpenState");function X0(e){return e==="indeterminate"}$n(X0,"isIndeterminate");function ym(e){return X0(e)?"indeterminate":e?"checked":"unchecked"}$n(ym,"getCheckedState");function Lj(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}$n(Lj,"focusFirst");function $j(e,t){return e.map((n,r)=>e[(t+r)%e.length])}$n($j,"wrapArray");function Tj(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=$j(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}$n(Tj,"getNextMatch");function Dj(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}$n(Dj,"isPointInPolygon");function Hj(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Dj(n,t)}$n(Hj,"isPointerInGraceArea");function ed(e){return t=>t.pointerType==="mouse"?e(t):void 0}$n(ed,"whenMouse");var Oj=iz,Ij=Ej,Fj=cz,_j=dz,Vj=Aj,Zj=mz,zj=Hv,Bj=gz,Uj=bz,Wj=kz,Kj=Ez,Gj=Cz,Yj=Az,qj=Mz,Rz=Object.defineProperty,Yr=(e,t)=>Rz(e,"name",{value:t,configurable:!0}),Iv="ContextMenu",[Pz,Yde]=Ds(Iv,[wm]),Hs=wm(),[Lz,Xj]=Pz(Iv),$z=Yr(e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,dir:i,modal:l=!0}=e,u=s.useRef(!1),[f,h]=ui({prop:a,defaultProp:!1,onChange:r,caller:Iv}),p=Hs(t);return o.jsx(Lz,{scope:t,open:f,onOpenChange:h,modal:l,hasInteractedRef:u,children:o.jsx(Oj,{...p,dir:i,open:f,onOpenChange:h,modal:l,children:n})})},"ContextMenu"),Tz="ContextMenuTrigger",Dz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,disabled:a=!1,...i}=t,l=Xj(Tz,r),u=Hs(r),[f,h]=s.useState({x:0,y:0}),p=s.useMemo(()=>({current:{getBoundingClientRect:Yr(()=>DOMRect.fromRect({width:0,height:0,...f}),"getBoundingClientRect")}}),[f]),m=s.useRef(0),g=s.useCallback(()=>window.clearTimeout(m.current),[]),w=Yr(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(Ij,{...u,virtualRef:p}),o.jsx(vn.span,{"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,...i,ref:n,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:a?t.onContextMenu:jt(t.onContextMenu,y=>{g(),w(y),y.preventDefault()}),onPointerDown:a?t.onPointerDown:jt(t.onPointerDown,k0(y=>{g(),l.open&&l.onOpenChange(!1),m.current=window.setTimeout(()=>w(y),700)})),onPointerMove:a?t.onPointerMove:jt(t.onPointerMove,k0(g)),onPointerCancel:a?t.onPointerCancel:jt(t.onPointerCancel,k0(g)),onPointerUp:a?t.onPointerUp:jt(t.onPointerUp,k0(g))})]})},"ContextMenuTrigger")),Hz=Yr(e=>{const{__scopeContextMenu:t,...n}=e,r=Hs(t);return o.jsx(Fj,{...r,...n})},"ContextMenuPortal"),Oz="ContextMenuContent",Iz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Xj(Oz,r),l=Hs(r),u=s.useRef(!1);return o.jsx(_j,{...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")),Fz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Vj,{...i,...a,ref:n})},"ContextMenuGroup")),_z=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Zj,{...i,...a,ref:n})},"ContextMenuLabel")),Vz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(zj,{...i,...a,ref:n})},"ContextMenuItem")),Zz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Bj,{...i,...a,ref:n})},"ContextMenuCheckboxItem")),zz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Uj,{...i,...a,ref:n})},"ContextMenuRadioGroup")),Bz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Wj,{...i,...a,ref:n})},"ContextMenuRadioItem")),Uz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Kj,{...i,...a,ref:n})},"ContextMenuItemIndicator")),Wz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Gj,{...i,...a,ref:n})},"ContextMenuSeparator")),Kz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(Yj,{...i,...a,ref:n})},"ContextMenuSubTrigger")),Gz=s.forwardRef(Yr(function(t,n){const{__scopeContextMenu:r,...a}=t,i=Hs(r);return o.jsx(qj,{...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 k0(e){return t=>t.pointerType!=="mouse"?e(t):void 0}Yr(k0,"whenTouchOrPen");var Yz=$z,qz=Dz,Qj=Hz,Xz=Iz,Qz=Fz,Jz=_z,eB=Vz,tB=Zz,nB=zz,rB=Bz,Jj=Uz,sB=Wz,aB=Kz,oB=Gz,iB=Object.defineProperty,Os=(e,t)=>iB(e,"name",{value:t,configurable:!0}),Fv="DropdownMenu",[lB,qde]=Ds(Fv,[wm]),Is=wm(),[cB,eA]=lB(Fv),uB=Os(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,f=Is(t),h=s.useRef(null),[p,m]=ui({prop:a,defaultProp:i??!1,onChange:l,caller:Fv});return o.jsx(cB,{scope:t,triggerId:ka(),triggerRef:h,contentId:ka(),open:p,onOpenChange:m,onOpenToggle:s.useCallback(()=>m(g=>!g),[m]),modal:u,children:o.jsx(Oj,{...f,open:p,onOpenChange:m,dir:r,modal:u,children:n})})},"DropdownMenu"),dB="DropdownMenuTrigger",fB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,disabled:a=!1,...i}=t,l=eA(dB,r),u=Is(r),f=pn(n,l.triggerRef);return o.jsx(Ij,{asChild:!0,...u,children:o.jsx(vn.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...i,ref:f,onPointerDown:jt(t.onPointerDown,h=>{!a&&h.button===0&&h.ctrlKey===!1&&(l.onOpenToggle(),l.open||h.preventDefault())}),onKeyDown:jt(t.onKeyDown,h=>{a||(["Enter"," "].includes(h.key)&&l.onOpenToggle(),h.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})},"DropdownMenuTrigger")),hB=Os(e=>{const{__scopeDropdownMenu:t,...n}=e,r=Is(t);return o.jsx(Fj,{...r,...n})},"DropdownMenuPortal"),pB="DropdownMenuContent",mB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=eA(pB,r),l=Is(r),u=s.useRef(!1);return o.jsx(_j,{id:i.contentId,"aria-labelledby":i.triggerId,...l,...a,ref:n,onCloseAutoFocus:jt(t.onCloseAutoFocus,f=>{var h;u.current||(h=i.triggerRef.current)==null||h.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:jt(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")),gB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Vj,{...i,...a,ref:n})},"DropdownMenuGroup")),vB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Zj,{...i,...a,ref:n})},"DropdownMenuLabel")),wB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(zj,{...i,...a,ref:n})},"DropdownMenuItem")),yB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Bj,{...i,...a,ref:n})},"DropdownMenuCheckboxItem")),bB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Uj,{...i,...a,ref:n})},"DropdownMenuRadioGroup")),xB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Wj,{...i,...a,ref:n})},"DropdownMenuRadioItem")),kB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Kj,{...i,...a,ref:n})},"DropdownMenuItemIndicator")),SB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Gj,{...i,...a,ref:n})},"DropdownMenuSeparator")),EB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(Yj,{...i,...a,ref:n})},"DropdownMenuSubTrigger")),CB=s.forwardRef(Os(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Is(r);return o.jsx(qj,{...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")),jB=uB,AB=fB,tA=hB,NB=mB,MB=gB,RB=vB,PB=wB,LB=yB,$B=bB,TB=xB,nA=kB,DB=SB,HB=EB,OB=CB,IB=Object.defineProperty,FB=(e,t)=>IB(e,"name",{value:t,configurable:!0});function rA(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])}FB(rA,"usePrevious");var _B=Object.defineProperty,VB=(e,t)=>_B(e,"name",{value:t,configurable:!0});function ap(e,[t,n]){return Math.min(n,Math.max(t,e))}VB(ap,"clamp");var ZB=Object.defineProperty,Lo=(e,t)=>ZB(e,"name",{value:t,configurable:!0}),_v="Popover",[sA,Xde]=Ds(_v,[Cl]),bm=Cl(),[zB,jl]=sA(_v),BB=Lo(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!1}=e,u=bm(t),f=s.useRef(null),[h,p]=s.useState(!1),[m,g]=ui({prop:r,defaultProp:a??!1,onChange:i,caller:_v});return o.jsx(pm,{...u,children:o.jsx(zB,{scope:t,contentId:ka(),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"),UB="PopoverAnchor",WB=s.forwardRef(Lo(function(t,n){const{__scopePopover:r,...a}=t,i=jl(UB,r),l=bm(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=i;return s.useEffect(()=>(u(),()=>f()),[u,f]),o.jsx(Mf,{...l,...a,ref:n})},"PopoverAnchor")),KB="PopoverTrigger",GB=s.forwardRef(Lo(function(t,n){const{__scopePopover:r,...a}=t,i=jl(KB,r),l=bm(r),u=pn(n,i.triggerRef),f=o.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Vv(i.open),...a,ref:u,onClick:jt(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?f:o.jsx(Mf,{asChild:!0,...l,children:f})},"PopoverTrigger")),aA="PopoverPortal",[YB,qB]=sA(aA,{forceMount:void 0}),XB=Lo(e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=jl(aA,t);return o.jsx(YB,{scope:t,forceMount:n,children:o.jsx(ds,{present:n||i.open,children:o.jsx(jf,{asChild:!0,container:a,children:r})})})},"PopoverPortal"),Q0="PopoverContent",QB=s.forwardRef(Lo(function(t,n){const r=qB(Q0,t.__scopePopover),{forceMount:a=r.forceMount,...i}=t,l=jl(Q0,t.__scopePopover);return o.jsx(ds,{present:a||l.open,children:l.modal?o.jsx(eU,{...i,ref:n}):o.jsx(tU,{...i,ref:n})})},"PopoverContent")),JB=Ya("PopoverContent.RemoveScroll"),eU=s.forwardRef(Lo(function(t,n){const r=jl(Q0,t.__scopePopover),a=s.useRef(null),i=pn(n,a),l=s.useRef(!1);return s.useEffect(()=>{const u=a.current;if(u)return om(u)},[]),o.jsx(Af,{as:JB,allowPinchZoom:!0,children:o.jsx(oA,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:jt(t.onCloseAutoFocus,u=>{var f;u.preventDefault(),l.current||(f=r.triggerRef.current)==null||f.focus()}),onPointerDownOutside:jt(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:jt(t.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),tU=s.forwardRef(Lo(function(t,n){const r=jl(Q0,t.__scopePopover),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(oA,{...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")),oA=s.forwardRef(Lo(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=jl(Q0,r),y=bm(r);return md(),o.jsx(pd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Cf,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:m,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>w.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(mm,{"data-state":Vv(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")),nU="PopoverClose",rU=s.forwardRef(Lo(function(t,n){const{__scopePopover:r,...a}=t,i=jl(nU,r);return o.jsx(vn.button,{type:"button",...a,ref:n,onClick:jt(t.onClick,()=>i.onOpenChange(!1))})},"PopoverClose"));function Vv(e){return e?"open":"closed"}Lo(Vv,"getState");var sU=BB,aU=WB,oU=GB,iU=XB,lU=QB,cU=rU,uU=Object.defineProperty,An=(e,t)=>uU(e,"name",{value:t,configurable:!0});function iA(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}An(iA,"useStateMachine");var lA="ScrollArea",[cA,Qde]=Ds(lA),[dU,Ma]=cA(lA),fU=s.forwardRef(An(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),[C,E]=s.useState(0),[A,P]=s.useState(0),[T,M]=s.useState(!1),[j,R]=s.useState(!1),L=pn(n,h),H=Ef(i);return o.jsx(dU,{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:E,onCornerHeightChange:P,children:o.jsx(vn.div,{dir:H,...u,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})},"ScrollArea")),hU="ScrollAreaViewport",pU=s.forwardRef(An(function(t,n){const{__scopeScrollArea:r,children:a,nonce:i,...l}=t,u=Ma(hU,r),f=s.useRef(null),h=pn(n,f,u.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx(mU,{nonce:i}),o.jsx(vn.div,{"data-radix-scroll-area-viewport":"",...l,ref:h,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})},"ScrollAreaViewport")),mU=s.memo(An(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),xi="ScrollAreaScrollbar",gU=s.forwardRef(An(function(t,n){const{forceMount:r,...a}=t,i=Ma(xi,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(vU,{...a,ref:n,forceMount:r}):i.type==="scroll"?o.jsx(wU,{...a,ref:n,forceMount:r}):i.type==="auto"?o.jsx(uA,{...a,ref:n,forceMount:r}):i.type==="always"?o.jsx(Zv,{...a,ref:n,"data-state":"visible"}):null},"ScrollAreaScrollbar")),vU=s.forwardRef(An(function(t,n){const{forceMount:r,...a}=t,i=Ma(xi,t.__scopeScrollArea),[l,u]=s.useState(!1);return s.useEffect(()=>{const f=i.scrollArea;let h=0;if(f){const p=An(()=>{window.clearTimeout(h),u(!0)},"handlePointerEnter"),m=An(()=>{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(ds,{present:r||l,children:o.jsx(uA,{"data-state":l?"visible":"hidden",...a,ref:n})})},"ScrollAreaScrollbarHover")),wU=s.forwardRef(An(function(t,n){const{forceMount:r,...a}=t,i=Ma(xi,t.__scopeScrollArea),l=t.orientation==="horizontal",u=Lf(()=>h("SCROLL_END"),100),[f,h]=iA("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=An(()=>{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(ds,{present:r||f!=="hidden",children:o.jsx(Zv,{"data-state":f==="hidden"?"hidden":"visible",...a,ref:n,onPointerEnter:jt(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:jt(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),uA=s.forwardRef(An(function(t,n){const r=Ma(xi,t.__scopeScrollArea),{forceMount:a,...i}=t,[l,u]=s.useState(!1),f=t.orientation==="horizontal",h=Lf(()=>{if(r.viewport){const p=r.viewport.offsetWidth<r.viewport.scrollWidth,m=r.viewport.offsetHeight<r.viewport.scrollHeight;u(f?p:m)}},10);return wc(r.viewport,h),wc(r.content,h),o.jsx(ds,{present:a||l,children:o.jsx(Zv,{"data-state":l?"visible":"hidden",...i,ref:n})})},"ScrollAreaScrollbarAuto")),Zv=s.forwardRef(An(function(t,n){const{orientation:r="vertical",...a}=t,i=Ma(xi,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=zv(f.viewport,f.content),m={...a,sizes:f,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:An(w=>l.current=w,"onThumbChange"),onThumbPointerUp:An(()=>u.current=0,"onThumbPointerUp"),onThumbPointerDown:An(w=>u.current=w,"onThumbPointerDown")};function g(w,y){return pA(w,u.current,f,y)}return An(g,"getScrollPosition"),r==="horizontal"?o.jsx(yU,{...m,ref:n,onThumbPositionChange:()=>{if(i.viewport&&l.current){const w=i.viewport.scrollLeft,y=O6(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(bU,{...m,ref:n,onThumbPositionChange:()=>{if(i.viewport&&l.current){const w=i.viewport.scrollTop,y=O6(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")),yU=s.forwardRef(An(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,l=Ma(xi,t.__scopeScrollArea),[u,f]=s.useState(),h=s.useRef(null),p=pn(n,h,l.onScrollbarXChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(fA,{"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":Pf(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),Uv(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:J0(u.paddingLeft),paddingEnd:J0(u.paddingRight)}})}})},"ScrollAreaScrollbarX")),bU=s.forwardRef(An(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,l=Ma(xi,t.__scopeScrollArea),[u,f]=s.useState(),h=s.useRef(null),p=pn(n,h,l.onScrollbarYChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(fA,{"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":Pf(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),Uv(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:J0(u.paddingTop),paddingEnd:J0(u.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[xU,dA]=cA(xi),fA=s.forwardRef(An(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=Ma(xi,r),[b,k]=s.useState(null),S=pn(n,k),C=s.useRef(null),E=s.useRef(""),A=y.viewport,P=a.content-a.viewport,T=br(m),M=br(h),j=Lf(g,10);function R(L){if(C.current){const H=L.clientX-C.current.left,D=L.clientY-C.current.top;p({x:H,y:D})}}return An(R,"handleDragScroll"),s.useEffect(()=>{const L=An(H=>{const D=H.target;(b==null?void 0:b.contains(D))&&T(H,P)},"handleWheel");return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[A,b,P,T]),s.useEffect(M,[a,M]),wc(b,j),wc(y.content,j),o.jsx(xU,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:br(l),onThumbPointerUp:br(u),onThumbPositionChange:M,onThumbPointerDown:br(f),children:o.jsx(vn.div,{...w,ref:S,style:{position:"absolute",...w.style},onPointerDown:jt(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),C.current=b.getBoundingClientRect(),E.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),R(L))}),onPointerMove:jt(t.onPointerMove,R),onPointerUp:jt(t.onPointerUp,L=>{const H=L.target;H.hasPointerCapture(L.pointerId)&&H.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=E.current,y.viewport&&(y.viewport.style.scrollBehavior=""),C.current=null})})})},"ScrollAreaScrollbarImpl")),H6="ScrollAreaThumb",kU=s.forwardRef(An(function(t,n){const{forceMount:r,...a}=t,i=dA(H6,t.__scopeScrollArea);return o.jsx(ds,{present:r||i.hasThumb,children:o.jsx(SU,{ref:n,...a})})},"ScrollAreaThumb")),SU=s.forwardRef(An(function(t,n){const{__scopeScrollArea:r,style:a,...i}=t,l=Ma(H6,r),u=dA(H6,r),{onThumbPositionChange:f}=u,h=pn(n,u.onThumbChange),p=s.useRef(void 0),m=Lf(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const g=l.viewport;if(g){const w=An(()=>{if(m(),!p.current){const y=jU(g,f);p.current=y,f()}},"handleScroll");return f(),g.addEventListener("scroll",w),()=>g.removeEventListener("scroll",w)}},[l.viewport,m,f]),o.jsx(vn.div,{"data-state":u.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:jt(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:jt(t.onPointerUp,u.onThumbPointerUp)})},"ScrollAreaThumbImpl")),hA="ScrollAreaCorner",EU=s.forwardRef(An(function(t,n){const r=Ma(hA,t.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(CU,{...t,ref:n}):null},"ScrollAreaCorner")),CU=s.forwardRef(An(function(t,n){const{__scopeScrollArea:r,...a}=t,i=Ma(hA,r),[l,u]=s.useState(0),[f,h]=s.useState(0),p=!!(l&&f),{onCornerWidthChange:m,onCornerHeightChange:g}=i;return wc(i.scrollbarX,()=>{var y;const w=((y=i.scrollbarX)==null?void 0:y.offsetHeight)||0;i.onCornerHeightChange(w),h(w)}),wc(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(vn.div,{...a,ref:n,style:{width:l,height:f,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function J0(e){return e?parseInt(e,10):0}An(J0,"toInt");function zv(e,t){const n=e/t;return isNaN(n)?0:n}An(zv,"getThumbRatio");function Pf(e){const t=zv(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}An(Pf,"getThumbSize");function pA(e,t,n,r="ltr"){const a=Pf(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 Bv([f,h],m)(e)}An(pA,"getScrollPositionFromPointer");function O6(e,t,n="ltr"){const r=Pf(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=ap(e,f);return Bv([0,l],[0,u])(h)}An(O6,"getThumbOffsetFromScroll");function Bv(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])}}An(Bv,"linearScale");function Uv(e,t){return e>0&&e<t}An(Uv,"isScrollingWithinScrollbarBounds");var jU=An((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return An((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 Lf(e,t){const n=br(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])}An(Lf,"useDebounceCallback");function wc(e,t){const n=br(t);kr(()=>{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])}An(wc,"useResizeObserver");var mA=fU,gA=pU,I6=gU,F6=kU,AU=EU,NU=Object.defineProperty,Vn=(e,t)=>NU(e,"name",{value:t,configurable:!0}),MU=[" ","Enter","ArrowUp","ArrowDown"],RU=[" ","Enter"],td="Select",[xm,Wv,PU]=sm(td),[Hc,Jde]=Ds(td,[PU,Cl]),Kv=Cl(),[LU,Al]=Hc(td),[$U,TU]=Hc(td);function vA(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=Kv(t),[S,C]=s.useState(null),[E,A]=s.useState(null),[P,T]=s.useState(!1),M=Ef(h),[j,R]=ui({prop:r,defaultProp:a??!1,onChange:i,caller:td}),[L,H]=ui({prop:l,defaultProp:u,onChange:f,caller:td}),D=s.useRef(null),B=s.useRef(L);s.useEffect(()=>{const X=y?S==null?void 0:S.ownerDocument.getElementById(y):S==null?void 0:S.form;if(X instanceof HTMLFormElement){const Z=Vn(()=>H(B.current),"reset");return X.addEventListener("reset",Z),()=>X.removeEventListener("reset",Z)}},[y,S,H]);const V=S?!!y||!!S.closest("form"):!0,[W,K]=s.useState(new Set),F=ka(),_=Array.from(W).map(X=>X.props.value).join(";"),O=s.useCallback(X=>{K(Z=>new Set(Z).add(X))},[]),Y=s.useCallback(X=>{K(Z=>{const J=new Set(Z);return J.delete(X),J})},[]),z={required:w,trigger:S,onTriggerChange:C,valueNode:E,onValueNodeChange:A,valueNodeHasChildren:P,onValueNodeHasChildrenChange:T,contentId:F,value:L,onValueChange:H,open:j,onOpenChange:R,dir:M,triggerPointerDownPosRef:D,disabled:g,name:p,autoComplete:m,form:y,nativeOptions:W,nativeSelectKey:_,isFormControl:V};return o.jsx(pm,{...k,children:o.jsx(LU,{scope:t,...z,children:o.jsx(xm.Provider,{scope:t,children:o.jsx($U,{scope:t,onNativeOptionAdd:O,onNativeOptionRemove:Y,children:bA(b)?b(z):n})})})})}Vn(vA,"SelectProvider");var DU=Vn(e=>{const{__scopeSelect:t,children:n,...r}=e;return o.jsx(vA,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:a})=>o.jsxs(o.Fragment,{children:[n,a?o.jsx(fW,{__scopeSelect:t}):null]})})},"Select"),HU="SelectTrigger",OU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,disabled:a=!1,...i}=t,l=Kv(r),u=Al(HU,r),f=u.disabled||a,h=pn(n,u.onTriggerChange),p=Wv(r),m=s.useRef("touch"),[g,w,y]=Gv(k=>{const S=p().filter(A=>!A.disabled),C=S.find(A=>A.value===u.value),E=Yv(S,k,C);E!==void 0&&u.onValueChange(E.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(Mf,{asChild:!0,...l,children:o.jsx(vn.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":$f(u.value)?"":void 0,...i,ref:h,onClick:jt(i.onClick,k=>{k.currentTarget.focus(),m.current!=="mouse"&&b(k)}),onPointerDown:jt(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:jt(i.onKeyDown,k=>{const S=g.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&w(k.key),!(S&&k.key===" ")&&MU.includes(k.key)&&(b(),k.preventDefault())})})})},"SelectTrigger")),IU="SelectValue",FU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,className:a,style:i,children:l,placeholder:u="",...f}=t,h=Al(IU,r),{onValueNodeHasChildrenChange:p}=h,m=l!==void 0,g=pn(n,h.onValueNodeChange);kr(()=>{p(m)},[p,m]);const w=$f(h.value);return o.jsx(vn.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")),_U=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,children:a,...i}=t;return o.jsx(vn.span,{"aria-hidden":!0,...i,ref:n,children:a||"▼"})},"SelectIcon")),VU="SelectPortal",[ZU,zU]=Hc(VU,{forceMount:void 0}),BU=Vn(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return o.jsx(ZU,{scope:e.__scopeSelect,forceMount:n,children:o.jsx(jf,{asChild:!0,...r})})},"SelectPortal"),yc="SelectContent",UU=s.forwardRef(Vn(function(t,n){const r=zU(yc,t.__scopeSelect),{forceMount:a=r.forceMount,...i}=t,l=Al(yc,t.__scopeSelect),[u,f]=s.useState();return kr(()=>{f(new DocumentFragment)},[]),o.jsx(ds,{present:a||l.open,children:({present:h})=>h?o.jsx(GU,{...i,ref:n}):o.jsx(WU,{...i,fragment:u})})},"SelectContent")),WU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,children:a,fragment:i}=t;return i?zr.createPortal(o.jsx(wA,{scope:r,children:o.jsx(xm.Slot,{scope:r,children:o.jsx("div",{ref:n,children:a})})}),i):null},"SelectContentFragment")),Fa=10,[wA,km]=Hc(yc),KU=Ya("SelectContent.RemoveScroll"),GU=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,...C}=t,E=Al(yc,r),[A,P]=s.useState(null),[T,M]=s.useState(null),j=pn(n,P),[R,L]=s.useState(null),[H,D]=s.useState(null),B=Wv(r),[V,W]=s.useState(!1),K=s.useRef(!1);s.useEffect(()=>{if(A)return om(A)},[A]),md();const F=s.useCallback(re=>{const[ee,...Q]=B().map(ce=>ce.ref.current),[he]=Q.slice(-1),Me=document.activeElement;for(const ce of re)if(ce===Me||(ce==null||ce.scrollIntoView({block:"nearest"}),ce===ee&&T&&(T.scrollTop=0),ce===he&&T&&(T.scrollTop=T.scrollHeight),ce==null||ce.focus(),document.activeElement!==Me))return},[B,T]),_=s.useCallback(()=>F([R,A]),[F,R,A]);s.useEffect(()=>{V&&_()},[V,_]);const{onOpenChange:O,triggerPointerDownPosRef:Y}=E;s.useEffect(()=>{if(A){let re={x:0,y:0};const ee=Vn(he=>{var Me,ce;re={x:Math.abs(Math.round(he.pageX)-(((Me=Y.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(he.pageY)-(((ce=Y.current)==null?void 0:ce.y)??0))}},"handlePointerMove"),Q=Vn(he=>{re.x<=10&&re.y<=10?he.preventDefault():he.composedPath().includes(A)||O(!1),document.removeEventListener("pointermove",ee),Y.current=null},"handlePointerUp");return Y.current!==null&&(document.addEventListener("pointermove",ee),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ee),document.removeEventListener("pointerup",Q,{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,X]=Gv(re=>{const ee=B().filter(Me=>!Me.disabled),Q=ee.find(Me=>Me.ref.current===document.activeElement),he=Yv(ee,re,Q);he&&setTimeout(()=>{var Me;return(Me=he.ref.current)==null?void 0:Me.focus()})}),Z=s.useCallback((re,ee,Q)=>{const he=!K.current&&!Q;(E.value!==void 0&&E.value===ee||he)&&(L(re),he&&(K.current=!0))},[E.value]),J=s.useCallback(()=>A==null?void 0:A.focus(),[A]),me=s.useCallback((re,ee,Q)=>{const he=!K.current&&!Q;(E.value!==void 0&&E.value===ee||he)&&D(re)},[E.value]),ne=a==="popper"?Xx:YU,fe=ne===Xx?{side:f,sideOffset:h,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:b,hideWhenDetached:k,avoidCollisions:S}:{};return o.jsx(wA,{scope:r,content:A,viewport:T,onViewportChange:M,itemRefCallback:Z,selectedItem:R,onItemLeave:J,itemTextRefCallback:me,focusSelectedItem:_,selectedItemText:H,position:a,isPositioned:V,searchRef:z,children:o.jsx(Af,{as:KU,allowPinchZoom:!0,children:o.jsx(pd,{asChild:!0,trapped:E.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:jt(i,re=>{var ee;(ee=E.trigger)==null||ee.focus({preventScroll:!0}),re.preventDefault()}),children:o.jsx(Cf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:o.jsx(ne,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:re=>re.preventDefault(),...C,...fe,onPlaced:()=>W(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:jt(C.onKeyDown,re=>{const ee=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ee&&re.key.length===1&&X(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let he=B().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(re.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Me=re.target,ce=he.indexOf(Me);he=he.slice(ce+1)}setTimeout(()=>F(he)),re.preventDefault()}})})})})})})},"SelectContentImpl")),YU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,onPlaced:a,...i}=t,l=Al(yc,r),u=km(yc,r),[f,h]=s.useState(null),[p,m]=s.useState(null),g=pn(n,m),w=Wv(r),y=s.useRef(!1),b=s.useRef(!0),{viewport:k,selectedItem:S,selectedItemText:C,focusSelectedItem:E}=u,A=s.useCallback(()=>{if(l.trigger&&l.valueNode&&f&&p&&k&&S&&C){const j=l.trigger.getBoundingClientRect(),R=p.getBoundingClientRect(),L=l.valueNode.getBoundingClientRect(),H=C.getBoundingClientRect();if(l.dir!=="rtl"){const Me=H.left-R.left,ce=L.left-Me,ke=j.left-ce,Be=j.width+ke,ft=Math.max(Be,R.width),Ue=window.innerWidth-Fa,Qe=ap(ce,[Fa,Math.max(Fa,Ue-ft)]);f.style.minWidth=Be+"px",f.style.left=Qe+"px"}else{const Me=R.right-H.right,ce=window.innerWidth-L.right-Me,ke=window.innerWidth-j.right-ce,Be=j.width+ke,ft=Math.max(Be,R.width),Ue=window.innerWidth-Fa,Qe=ap(ce,[Fa,Math.max(Fa,Ue-ft)]);f.style.minWidth=Be+"px",f.style.right=Qe+"px"}const D=w(),B=window.innerHeight-Fa*2,V=k.scrollHeight,W=window.getComputedStyle(p),K=parseInt(W.borderTopWidth,10),F=parseInt(W.paddingTop,10),_=parseInt(W.borderBottomWidth,10),O=parseInt(W.paddingBottom,10),Y=K+F+V+O+_,z=Math.min(S.offsetHeight*5,Y),X=window.getComputedStyle(k),Z=parseInt(X.paddingTop,10),J=parseInt(X.paddingBottom,10),me=j.top+j.height/2-Fa,ne=B-me,fe=S.offsetHeight/2,re=S.offsetTop+fe,ee=K+F+re,Q=Y-ee;if(ee<=me){const Me=D.length>0&&S===D[D.length-1].ref.current;f.style.bottom="0px";const ce=p.clientHeight-k.offsetTop-k.offsetHeight,ke=Math.max(ne,fe+(Me?J:0)+ce+_),Be=ee+ke;f.style.height=Be+"px"}else{const Me=D.length>0&&S===D[0].ref.current;f.style.top="0px";const ke=Math.max(me,K+k.offsetTop+(Me?Z:0)+fe)+Q;f.style.height=ke+"px",k.scrollTop=ee-me+k.offsetTop}f.style.margin=`${Fa}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,C,l.dir,a]);kr(()=>A(),[A]);const[P,T]=s.useState();kr(()=>{p&&T(window.getComputedStyle(p).zIndex)},[p]);const M=s.useCallback(j=>{j&&b.current===!0&&(A(),E==null||E(),b.current=!1)},[A,E]);return o.jsx(qU,{scope:r,contentWrapper:f,shouldExpandOnScrollRef:y,onScrollButtonChange:M,children:o.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:o.jsx(vn.div,{...i,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),Xx=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,align:a="start",collisionPadding:i=Fa,...l}=t,u=Kv(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")),[qU,XU]=Hc(yc,{}),Qx="SelectViewport",QU=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,nonce:a,...i}=t,l=km(Qx,r),u=XU(Qx,r),f=pn(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(xm.Slot,{scope:r,children:o.jsx(vn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:jt(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-Fa*2,k=parseFloat(g.style.minHeight),S=parseFloat(g.style.height),C=Math.max(k,S);if(C<b){const E=C+y,A=Math.min(b,E),P=E-A;g.style.height=A+"px",g.style.bottom==="0px"&&(m.scrollTop=P>0?P:0,g.style.justifyContent="flex-end")}}}h.current=m.scrollTop})})})]})},"SelectViewport")),JU="SelectGroup",[eW,tW]=Hc(JU),nW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t,i=ka();return o.jsx(eW,{scope:r,id:i,children:o.jsx(vn.div,{role:"group","aria-labelledby":i,...a,ref:n})})},"SelectGroup")),rW="SelectLabel",sW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t,i=tW(rW,r);return o.jsx(vn.div,{id:i.id,...a,ref:n})},"SelectLabel")),_6="SelectItem",[aW,yA]=Hc(_6),oW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,value:a,disabled:i=!1,textValue:l,...u}=t,f=Al(_6,r),h=km(_6,r),p=f.value===a,[m,g]=s.useState(l??""),[w,y]=s.useState(!1),b=br(A=>{var P;return(P=h.itemRefCallback)==null?void 0:P.call(h,A,a,i)}),k=pn(n,b),S=ka(),C=s.useRef("touch"),E=Vn(()=>{i||(f.onValueChange(a),f.onOpenChange(!1))},"handleSelect");return o.jsx(aW,{scope:r,value:a,disabled:i,textId:S,isSelected:p,onItemTextChange:s.useCallback(A=>{g(P=>P||((A==null?void 0:A.textContent)??"").trim())},[]),children:o.jsx(xm.ItemSlot,{scope:r,value:a,disabled:i,textValue:m,children:o.jsx(vn.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:k,onFocus:jt(u.onFocus,()=>y(!0)),onBlur:jt(u.onBlur,()=>y(!1)),onClick:jt(u.onClick,()=>{C.current!=="mouse"&&E()}),onPointerUp:jt(u.onPointerUp,()=>{C.current==="mouse"&&E()}),onPointerDown:jt(u.onPointerDown,A=>{C.current=A.pointerType}),onPointerMove:jt(u.onPointerMove,A=>{var P;C.current=A.pointerType,i?(P=h.onItemLeave)==null||P.call(h):C.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:jt(u.onPointerLeave,A=>{var P;A.currentTarget===document.activeElement&&((P=h.onItemLeave)==null||P.call(h))}),onKeyDown:jt(u.onKeyDown,A=>{var T;i||A.target!==A.currentTarget||((T=h.searchRef)==null?void 0:T.current)!==""&&A.key===" "||(RU.includes(A.key)&&E(),A.key===" "&&A.preventDefault())})})})})},"SelectItem")),mh="SelectItemText",iW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,className:a,style:i,...l}=t,u=Al(mh,r),f=km(mh,r),h=yA(mh,r),p=TU(mh,r),[m,g]=s.useState(null),w=br(E=>{var A;return(A=f.itemTextRefCallback)==null?void 0:A.call(f,E,h.value,h.disabled)}),y=pn(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:C}=p;return kr(()=>(S(k),()=>C(k)),[S,C,k]),o.jsxs(o.Fragment,{children:[o.jsx(vn.span,{id:h.textId,...l,ref:y}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!$f(u.value)?zr.createPortal(l.children,u.valueNode):null]})},"SelectItemText")),lW="SelectItemIndicator",cW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t;return yA(lW,r).isSelected?o.jsx(vn.span,{"aria-hidden":!0,...a,ref:n}):null},"SelectItemIndicator")),uW=s.forwardRef(Vn(function(t,n){const{__scopeSelect:r,...a}=t;return o.jsx(vn.div,{"aria-hidden":!0,...a,ref:n})},"SelectSeparator")),dW="SelectBubbleInput",fW=s.forwardRef(Vn(function({__scopeSelect:t,...n},r){const a=Al(dW,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=pn(r,y),k=i??"",S=rA(k),C=Array.from(g).some(E=>(E.props.value??"")==="");return s.useEffect(()=>{const E=y.current;if(!E)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(E,k),E.dispatchEvent(M)}},[S,k]),o.jsxs(vn.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:h,autoComplete:p,disabled:f,form:m,onChange:E=>l(E.target.value),...n,style:{...rC,...n.style},ref:b,defaultValue:k,children:[$f(i)&&!C?o.jsx("option",{value:""}):null,Array.from(g)]},w)},"SelectBubbleInput"));function bA(e){return typeof e=="function"}Vn(bA,"isFunction");function $f(e){return e===""||e===void 0}Vn($f,"shouldShowPlaceholder");function Gv(e){const t=br(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(Gv,"useTypeaheadSearch");function Yv(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=xA(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(Yv,"findNextItem");function xA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Vn(xA,"wrapArray");var hW=Object.defineProperty,Pr=(e,t)=>hW(e,"name",{value:t,configurable:!0}),[qv,e0e]=Ds("Tooltip",[Cl]),Sm=Cl(),pW="TooltipProvider",mW=700,V6="tooltip.open",[gW,Xv]=qv(pW),vW=Pr(e=>{const{__scopeTooltip:t,delayDuration:n=mW,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(gW,{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"),Z6="Tooltip",[wW,Tf]=qv(Z6),yW=Pr(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:l,delayDuration:u}=e,f=Xv(Z6,e.__scopeTooltip),h=Sm(t),[p,m]=s.useState(null),[g,w]=s.useState(void 0),y=ka(),b=s.useRef(0),k=l??f.disableHoverableContent,S=u??f.delayDuration,C=s.useRef(!1),[E,A]=ui({prop:r,defaultProp:a??!1,onChange:Pr(L=>{L?(f.onOpen(),document.dispatchEvent(new CustomEvent(V6))):f.onClose(),i==null||i(L)},"onChange"),caller:Z6}),P=s.useMemo(()=>E?C.current?"delayed-open":"instant-open":"closed",[E]),T=s.useCallback(()=>{window.clearTimeout(b.current),b.current=0,C.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(()=>{C.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(pm,{...h,children:o.jsx(wW,{scope:t,contentId:R,setContentId:w,open:E,stateAttribute:P,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"),Jx="TooltipTrigger",bW=s.forwardRef(Pr(function(t,n){const{__scopeTooltip:r,...a}=t,i=Tf(Jx,r),l=Xv(Jx,r),u=Sm(r),f=s.useRef(null),h=pn(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(Mf,{asChild:!0,...u,children:o.jsx(vn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...a,ref:h,onPointerMove:jt(t.onPointerMove,w=>{w.pointerType!=="touch"&&!m.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),m.current=!0)}),onPointerLeave:jt(t.onPointerLeave,()=>{i.onTriggerLeave(),m.current=!1}),onPointerDown:jt(t.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:jt(t.onFocus,()=>{p.current||i.onOpen()}),onBlur:jt(t.onBlur,i.onClose),onClick:jt(t.onClick,i.onClose)})})},"TooltipTrigger")),kA="TooltipPortal",[xW,kW]=qv(kA,{forceMount:void 0}),SW=Pr(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,i=Tf(kA,t);return o.jsx(xW,{scope:t,forceMount:n,children:o.jsx(ds,{present:n||i.open,children:o.jsx(jf,{asChild:!0,container:a,children:r})})})},"TooltipPortal"),ef="TooltipContent",EW=s.forwardRef(Pr(function(t,n){const r=kW(ef,t.__scopeTooltip),{forceMount:a=r.forceMount,side:i="top",...l}=t,u=Tf(ef,t.__scopeTooltip);return o.jsx(ds,{present:a||u.open,children:u.disableHoverableContent?o.jsx(SA,{side:i,...l,ref:n}):o.jsx(CW,{side:i,...l,ref:n})})},"TooltipContent")),CW=s.forwardRef(Pr(function(t,n){const r=Tf(ef,t.__scopeTooltip),a=Xv(ef,t.__scopeTooltip),i=s.useRef(null),l=pn(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,C={x:b.clientX,y:b.clientY},E=EA(C,S.getBoundingClientRect()),A=CA(C,E),P=jA(k.getBoundingClientRect()),T=NA([...A,...P]);f(T),g(!0)},[g]);return s.useEffect(()=>()=>w(),[w]),s.useEffect(()=>{if(h&&m){const b=Pr(S=>y(S,m),"handleTriggerLeave"),k=Pr(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=Pr(k=>{const S=k.target,C={x:k.clientX,y:k.clientY},E=(h==null?void 0:h.contains(S))||(m==null?void 0:m.contains(S)),A=!AA(C,u);E?w():A&&(w(),p())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[h,m,u,p,w]),o.jsx(SA,{...t,ref:l})},"TooltipContentHoverable")),jW=gv("TooltipContent"),SA=s.forwardRef(Pr(function(t,n){const{__scopeTooltip:r,children:a,"aria-label":i,id:l,onEscapeKeyDown:u,onPointerDownOutside:f,...h}=t,p=Tf(ef,r),m=Sm(r),{onClose:g}=p;s.useEffect(()=>(document.addEventListener(V6,g),()=>document.removeEventListener(V6,g)),[g]),s.useEffect(()=>{if(p.trigger){const y=Pr(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 kr(()=>(w(l),()=>{w(void 0)}),[l,w]),o.jsx(Cf,{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(jW,{children:a}),i?o.jsx(sC,{id:p.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl")),AW=s.forwardRef(Pr(function(t,n){const{__scopeTooltip:r,...a}=t,i=Sm(r);return o.jsx(HZ,{...i,...a,ref:n})},"TooltipArrow"));function EA(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")}}Pr(EA,"getExitSideFromRect");function CA(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}Pr(CA,"getPaddedExitPoints");function jA(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}]}Pr(jA,"getPointsFromRect");function AA(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}Pr(AA,"isPointInPolygon");function NA(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),MA(t)}Pr(NA,"getHull");function MA(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)}Pr(MA,"getHullPresorted");var NW=vW,MW=yW,RW=bW,PW=SW,LW=EW,$W=AW,r8={exports:{}};/*!
93
- Copyright (c) 2018 Jed Watson.
94
- Licensed under the MIT License (MIT), see
95
- http://jedwatson.github.io/classnames
96
- */var e5;function TW(){return e5||(e5=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})()})(r8)),r8.exports}var DW=TW();const Kt=N9(DW),to={asChild:{type:"boolean"}},So={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}},Qv={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}},HW=["1","2","3","4"],RA={...to,align:{type:"enum",className:"rt-r-align",values:["start","center"],default:"center"},size:{type:"enum",className:"rt-r-size",values:HW,default:"3",responsive:!0},width:So.width,minWidth:So.minWidth,maxWidth:{...So.maxWidth,default:"600px"},...Qv},PA=["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"],Nl={color:{type:"enum",values:PA,default:void 0}},Jv={color:{type:"enum",values:PA,default:""}},Oc={highContrast:{type:"boolean",className:"rt-high-contrast",default:void 0}},OW=["normal","start","end","both"],LA={trim:{type:"enum",className:"rt-r-lt",values:OW,responsive:!0}},IW=["left","center","right"],$A={align:{type:"enum",className:"rt-r-ta",values:IW,responsive:!0}},FW=["wrap","nowrap","pretty","balance"],TA={wrap:{type:"enum",className:"rt-r-tw",values:FW,responsive:!0}},DA={truncate:{type:"boolean",className:"rt-truncate"}},_W=["light","regular","medium","bold"],HA={weight:{type:"enum",className:"rt-r-weight",values:_W,responsive:!0}},VW=["h1","h2","h3","h4","h5","h6"],ZW=["1","2","3","4","5","6","7","8","9"],zW={as:{type:"enum",values:VW,default:"h1"},...to,size:{type:"enum",className:"rt-r-size",values:ZW,default:"6",responsive:!0},...HA,...$A,...LA,...DA,...TA,...Nl,...Oc},BW=["initial","xs","sm","md","lg","xl"],ew=new Set(BW);function OA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L0(e){return typeof e=="object"&&e!==null&&Object.keys(e).some(t=>ew.has(t))}function zi({className:e,customProperties:t,...n}){const r=op({allowArbitraryValues:!0,className:e,...n}),a=UW({customProperties:t,...n});return[r,a]}function op({allowArbitraryValues:e,value:t,className:n,propValues:r,parseValue:a=i=>i}){const i=[];if(t){if(typeof t=="string"&&r.includes(t))return t5(n,t,a);if(L0(t)){const l=t;for(const u in l){if(!OA(l,u)||!ew.has(u))continue;const f=l[u];if(f!==void 0){if(r.includes(f)){const h=t5(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 t5(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 UW({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]))),L0(t)){const i=t;for(const l in i){if(!OA(i,l)||!ew.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 ip(...e){let t={};for(const n of e)n&&(t={...t,...n});return Object.keys(t).length?t:void 0}function WW(...e){return Object.assign({},...e)}function Cr(e,...t){let n,r;const a={...e},i=WW(...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)&&!L0(u)&&(u=f.default),a[l]=u,"className"in f&&f.className){delete a[l];const h="responsive"in f;if(!u||L0(u)&&!h)continue;if(L0(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=op({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]=zi({className:f.className,customProperties:f.customProperties,propValues:p,parseValue:f.parseValue,value:u});r=ip(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=ip(r,e.style),a}const Yl=["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:Yl,responsive:!0,className:"rt-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:Yl,responsive:!0,className:"rt-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:Yl,responsive:!0,className:"rt-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:Yl,responsive:!0,className:"rt-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:Yl,responsive:!0,className:"rt-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:Yl,responsive:!0,className:"rt-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:Yl,responsive:!0,className:"rt-r-ml",customProperties:["--ml"]}},tw=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="h1",color:l,...u}=Cr(e,zW,$o);return s.createElement(Lc,{"data-accent-color":l,...u,ref:t,className:Kt("rt-Heading",r)},a?n:s.createElement(i,null,n))});tw.displayName="Heading";const KW=["span","div","label","p"],GW=["1","2","3","4","5","6","7","8","9"],YW={as:{type:"enum",values:KW,default:"span"},...to,size:{type:"enum",className:"rt-r-size",values:GW,responsive:!0},...HA,...$A,...LA,...DA,...TA,...Nl,...Oc},bc=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="span",color:l,...u}=Cr(e,YW,$o);return s.createElement(Lc,{"data-accent-color":l,...u,ref:t,className:Kt("rt-Text",r)},a?n:s.createElement(i,null,n))});bc.displayName="Text";function qW(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 XW=["none","small","medium","large","full"],Em={radius:{type:"enum",values:XW,default:void 0}},Gs={hasBackground:{default:!0},appearance:{default:"inherit"},accentColor:{default:"indigo"},grayColor:{default:"auto"},panelBackground:{default:"translucent"},radius:{default:"medium"},scaling:{default:"100%"}},pu=()=>{},lp=s.createContext(void 0);function nw(){const e=s.useContext(lp);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const no=s.forwardRef((e,t)=>s.useContext(lp)===void 0?s.createElement(NW,{delayDuration:200},s.createElement(FF,{dir:"ltr"},s.createElement(IA,{...e,ref:t}))):s.createElement(rw,{...e,ref:t}));no.displayName="Theme";const IA=s.forwardRef((e,t)=>{const{appearance:n=Gs.appearance.default,accentColor:r=Gs.accentColor.default,grayColor:a=Gs.grayColor.default,panelBackground:i=Gs.panelBackground.default,radius:l=Gs.radius.default,scaling:u=Gs.scaling.default,hasBackground:f=Gs.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[C,E]=s.useState(l);s.useEffect(()=>E(l),[l]);const[A,P]=s.useState(u);return s.useEffect(()=>P(u),[u]),s.createElement(rw,{...h,ref:t,isRoot:!0,hasBackground:f,appearance:p,accentColor:g,grayColor:y,panelBackground:k,radius:C,scaling:A,onAppearanceChange:m,onAccentColorChange:w,onGrayColorChange:b,onPanelBackgroundChange:S,onRadiusChange:E,onScalingChange:P})});IA.displayName="ThemeRoot";const rw=s.forwardRef((e,t)=>{const n=s.useContext(lp),{asChild:r,isRoot:a,hasBackground:i,appearance:l=(n==null?void 0:n.appearance)??Gs.appearance.default,accentColor:u=(n==null?void 0:n.accentColor)??Gs.accentColor.default,grayColor:f=(n==null?void 0:n.resolvedGrayColor)??Gs.grayColor.default,panelBackground:h=(n==null?void 0:n.panelBackground)??Gs.panelBackground.default,radius:p=(n==null?void 0:n.radius)??Gs.radius.default,scaling:m=(n==null?void 0:n.scaling)??Gs.scaling.default,onAppearanceChange:g=pu,onAccentColorChange:w=pu,onGrayColorChange:y=pu,onPanelBackgroundChange:b=pu,onRadiusChange:k=pu,onScalingChange:S=pu,...C}=e,E=r?Lc:"div",A=f==="auto"?qW(u):f,P=e.appearance==="light"||e.appearance==="dark",T=i===void 0?a||P:i;return s.createElement(lp.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(E,{"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,...C,className:Kt("radix-themes",{light:l==="light",dark:l==="dark"},C.className)}))});rw.displayName="ThemeImpl";const ki=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},Df=e=>s.createElement(cV,{...e});Df.displayName="AlertDialog.Root";const FA=s.forwardRef(({children:e,...t},n)=>s.createElement(uV,{...t,ref:n,asChild:!0},ki(e)));FA.displayName="AlertDialog.Trigger";const Hf=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=RA,{className:i}=Cr({align:e},{align:r}),{className:l,forceMount:u,container:f,...h}=Cr(t,a);return s.createElement(dV,{container:f,forceMount:u},s.createElement(no,{asChild:!0},s.createElement(fV,{className:"rt-BaseDialogOverlay rt-AlertDialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-AlertDialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${i}`},s.createElement(hV,{...h,ref:n,className:Kt("rt-BaseDialogContent","rt-AlertDialogContent",l)}))))))});Hf.displayName="AlertDialog.Content";const Of=s.forwardRef((e,t)=>s.createElement(gV,{asChild:!0},s.createElement(tw,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));Of.displayName="AlertDialog.Title";const If=s.forwardRef((e,t)=>s.createElement(vV,{asChild:!0},s.createElement(bc,{as:"p",size:"3",...e,asChild:!1,ref:t})));If.displayName="AlertDialog.Description";const Ff=s.forwardRef(({children:e,...t},n)=>s.createElement(pV,{...t,ref:n,asChild:!0},ki(e)));Ff.displayName="AlertDialog.Action";const _f=s.forwardRef(({children:e,...t},n)=>s.createElement(mV,{...t,ref:n,asChild:!0},ki(e)));_f.displayName="AlertDialog.Cancel";function QW(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 JW=["1","2","3"],eK=["solid","soft","surface","outline"],tK={...to,size:{type:"enum",className:"rt-r-size",values:JW,default:"1",responsive:!0},variant:{type:"enum",className:"rt-variant",values:eK,default:"soft"},...Jv,...Oc,...Em},_A=s.forwardRef((e,t)=>{const{asChild:n,className:r,color:a,radius:i,...l}=Cr(e,tK,$o),u=n?Lc:"span";return s.createElement(u,{"data-accent-color":a,"data-radius":i,...l,ref:t,className:Kt("rt-reset","rt-Badge",r)})});_A.displayName="Badge";const VA=Lc,nK=["div","span"],rK=["none","inline","inline-block","block","contents"],sK={as:{type:"enum",values:nK,default:"div"},...to,display:{type:"enum",className:"rt-r-display",values:rK,responsive:!0}},ql=["0","1","2","3","4","5","6","7","8","9"],aK={p:{type:"enum | string",className:"rt-r-p",customProperties:["--p"],values:ql,responsive:!0},px:{type:"enum | string",className:"rt-r-px",customProperties:["--pl","--pr"],values:ql,responsive:!0},py:{type:"enum | string",className:"rt-r-py",customProperties:["--pt","--pb"],values:ql,responsive:!0},pt:{type:"enum | string",className:"rt-r-pt",customProperties:["--pt"],values:ql,responsive:!0},pr:{type:"enum | string",className:"rt-r-pr",customProperties:["--pr"],values:ql,responsive:!0},pb:{type:"enum | string",className:"rt-r-pb",customProperties:["--pb"],values:ql,responsive:!0},pl:{type:"enum | string",className:"rt-r-pl",customProperties:["--pl"],values:ql,responsive:!0}},s8=["visible","hidden","clip","scroll","auto"],oK=["static","relative","absolute","fixed","sticky"],l0=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],iK=["0","1"],lK=["0","1"],cK=["start","center","end","baseline","stretch"],uK=["start","center","end","baseline","stretch"],ZA={...aK,...So,...Qv,position:{type:"enum",className:"rt-r-position",values:oK,responsive:!0},inset:{type:"enum | string",className:"rt-r-inset",customProperties:["--inset"],values:l0,responsive:!0},top:{type:"enum | string",className:"rt-r-top",customProperties:["--top"],values:l0,responsive:!0},right:{type:"enum | string",className:"rt-r-right",customProperties:["--right"],values:l0,responsive:!0},bottom:{type:"enum | string",className:"rt-r-bottom",customProperties:["--bottom"],values:l0,responsive:!0},left:{type:"enum | string",className:"rt-r-left",customProperties:["--left"],values:l0,responsive:!0},overflow:{type:"enum",className:"rt-r-overflow",values:s8,responsive:!0},overflowX:{type:"enum",className:"rt-r-ox",values:s8,responsive:!0},overflowY:{type:"enum",className:"rt-r-oy",values:s8,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:iK,responsive:!0},flexGrow:{type:"enum | string",className:"rt-r-fg",customProperties:["--flex-grow"],values:lK,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:cK,responsive:!0},justifySelf:{type:"enum",className:"rt-r-js",values:uK,responsive:!0}},$0=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=Cr(e,sK,ZA,$o);return s.createElement(r?VA:a,{...i,ref:t,className:Kt("rt-Box",n)})});$0.displayName="Box";const dK=["1","2","3","4"],fK=["classic","solid","soft","surface","outline","ghost"],n5={...to,size:{type:"enum",className:"rt-r-size",values:dK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:fK,default:"solid"},...Jv,...Oc,...Em,loading:{type:"boolean",className:"rt-loading",default:!1}},a8=["0","1","2","3","4","5","6","7","8","9"],hK={gap:{type:"enum | string",className:"rt-r-gap",customProperties:["--gap"],values:a8,responsive:!0},gapX:{type:"enum | string",className:"rt-r-cg",customProperties:["--column-gap"],values:a8,responsive:!0},gapY:{type:"enum | string",className:"rt-r-rg",customProperties:["--row-gap"],values:a8,responsive:!0}},pK=["div","span"],mK=["none","inline-flex","flex"],gK=["row","column","row-reverse","column-reverse"],vK=["start","center","end","baseline","stretch"],wK=["start","center","end","between"],yK=["nowrap","wrap","wrap-reverse"],bK={as:{type:"enum",values:pK,default:"div"},...to,display:{type:"enum",className:"rt-r-display",values:mK,responsive:!0},direction:{type:"enum",className:"rt-r-fd",values:gK,responsive:!0},align:{type:"enum",className:"rt-r-ai",values:vK,responsive:!0},justify:{type:"enum",className:"rt-r-jc",values:wK,parseValue:xK,responsive:!0},wrap:{type:"enum",className:"rt-r-fw",values:yK,responsive:!0},...hK};function xK(e){return e==="between"?"space-between":e}const Ts=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=Cr(e,bK,ZA,$o);return s.createElement(r?VA:a,{...i,ref:t,className:Kt("rt-Flex",n)})});Ts.displayName="Flex";const kK=["1","2","3"],SK={size:{type:"enum",className:"rt-r-size",values:kK,default:"2",responsive:!0},loading:{type:"boolean",default:!0}},Rr=s.forwardRef((e,t)=>{const{className:n,children:r,loading:a,...i}=Cr(e,SK,$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(Ts,{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(Ts,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,l))))});Rr.displayName="Spinner";const EK=sC;function zA(e,t){if(e!==void 0)return typeof e=="string"?t(e):Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r)]))}function CK(e){return e==="3"?"3":"2"}function jK(e){switch(e){case"1":return"1";case"2":case"3":return"2";case"4":return"3"}}const BA=s.forwardRef((e,t)=>{const{size:n=n5.size.default}=e,{className:r,children:a,asChild:i,color:l,radius:u,disabled:f=e.loading,...h}=Cr(e,n5,$o),p=i?Lc:"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(EK,null,a),s.createElement(Ts,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,s.createElement(Rr,{size:zA(n,jK)})))):a)});BA.displayName="BaseButton";const va=s.forwardRef(({className:e,...t},n)=>s.createElement(BA,{...t,ref:n,className:Kt("rt-Button",e)}));va.displayName="Button";const AK=["1","2","3"],NK=["soft","surface","outline"],r5={...to,size:{type:"enum",className:"rt-r-size",values:AK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:NK,default:"soft"},...Jv,...Oc},UA=s.createContext({}),z6=s.forwardRef((e,t)=>{const{size:n=r5.size.default}=e,{asChild:r,children:a,className:i,color:l,...u}=Cr(e,r5,$o),f=r?Lc:"div";return s.createElement(f,{"data-accent-color":l,...u,className:Kt("rt-CalloutRoot",i),ref:t},s.createElement(UA.Provider,{value:s.useMemo(()=>({size:n}),[n])},a))});z6.displayName="Callout.Root";const MK=s.forwardRef(({className:e,...t},n)=>s.createElement("div",{...t,className:Kt("rt-CalloutIcon",e),ref:n}));MK.displayName="Callout.Icon";const B6=s.forwardRef(({className:e,...t},n)=>{const{size:r}=s.useContext(UA);return s.createElement(bc,{as:"p",size:zA(r,CK),...t,asChild:!1,ref:n,className:Kt("rt-CalloutText",e)})});B6.displayName="Callout.Text";const RK=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"})));RK.displayName="ThickDividerHorizontalIcon";const wd=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"})));wd.displayName="ThickCheckIcon";const WA=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"})));WA.displayName="ChevronDownIcon";const sw=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"})));sw.displayName="ThickChevronRightIcon";const PK=["1","2","3"],c0={...to,size:{values:PK,default:"1"},...Em,scrollbars:{default:"both"}};function LK(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 Xl=$o.m.values;function $K(e){const[t,n]=zi({className:"rt-r-m",customProperties:["--margin"],propValues:Xl,value:e.m}),[r,a]=zi({className:"rt-r-mx",customProperties:["--margin-left","--margin-right"],propValues:Xl,value:e.mx}),[i,l]=zi({className:"rt-r-my",customProperties:["--margin-top","--margin-bottom"],propValues:Xl,value:e.my}),[u,f]=zi({className:"rt-r-mt",customProperties:["--margin-top"],propValues:Xl,value:e.mt}),[h,p]=zi({className:"rt-r-mr",customProperties:["--margin-right"],propValues:Xl,value:e.mr}),[m,g]=zi({className:"rt-r-mb",customProperties:["--margin-bottom"],propValues:Xl,value:e.mb}),[w,y]=zi({className:"rt-r-ml",customProperties:["--margin-left"],propValues:Xl,value:e.ml});return[Kt(t,r,i,u,h,m,w),ip(n,a,l,f,p,g,y)]}const Vf=s.forwardRef((e,t)=>{const{rest:n,...r}=LK(e),[a,i]=$K(r),{asChild:l,children:u,className:f,style:h,type:p,scrollHideDelay:m=p!=="scroll"?0:void 0,dir:g,size:w=c0.size.default,radius:y=c0.radius.default,scrollbars:b=c0.scrollbars.default,...k}=n;return s.createElement(mA,{type:p,scrollHideDelay:m,className:Kt("rt-ScrollAreaRoot",a,f),style:ip(i,h),asChild:l},QW({asChild:l,children:u},S=>s.createElement(s.Fragment,null,s.createElement(gA,{...k,ref:t,className:"rt-ScrollAreaViewport"},S),s.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),b!=="vertical"?s.createElement(I6,{"data-radius":y,orientation:"horizontal",className:Kt("rt-ScrollAreaScrollbar",op({className:"rt-r-size",value:w,propValues:c0.size.values}))},s.createElement(F6,{className:"rt-ScrollAreaThumb"})):null,b!=="horizontal"?s.createElement(I6,{"data-radius":y,orientation:"vertical",className:Kt("rt-ScrollAreaScrollbar",op({className:"rt-r-size",value:w,propValues:c0.size.values}))},s.createElement(F6,{className:"rt-ScrollAreaThumb"})):null,b==="both"?s.createElement(AU,{className:"rt-ScrollAreaCorner"}):null)))});Vf.displayName="ScrollArea";const TK=["1","2"],DK=["solid","soft"],bo={size:{type:"enum",className:"rt-r-size",values:TK,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:DK,default:"solid"},...Nl,...Oc},KA={...to,...Nl},GA={...Nl},YA={...Nl},Zf=e=>s.createElement(Yz,{...e});Zf.displayName="ContextMenu.Root";const zf=s.forwardRef(({children:e,...t},n)=>s.createElement(qz,{...t,ref:n,asChild:!0},ki(e)));zf.displayName="ContextMenu.Trigger";const qA=s.createContext({}),Bf=s.forwardRef((e,t)=>{const n=nw(),{size:r=bo.size.default,variant:a=bo.variant.default,highContrast:i=bo.highContrast.default}=e,{className:l,children:u,color:f,container:h,forceMount:p,...m}=Cr(e,bo),g=f||n.accentColor;return s.createElement(Qj,{container:h,forceMount:p},s.createElement(no,{asChild:!0},s.createElement(Xz,{"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(Vf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-ContextMenuViewport")},s.createElement(qA.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:g,highContrast:i}),[r,a,g,i])},u))))))});Bf.displayName="ContextMenu.Content";const HK=s.forwardRef(({className:e,...t},n)=>s.createElement(Jz,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuLabel","rt-ContextMenuLabel",e)}));HK.displayName="ContextMenu.Label";const Uf=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=KA.color.default,shortcut:i,...l}=e;return s.createElement(eB,{"data-accent-color":a,...l,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-ContextMenuItem",n)},s.createElement(rm,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},i))});Uf.displayName="ContextMenu.Item";const OK=s.forwardRef(({className:e,...t},n)=>s.createElement(Qz,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuGroup","rt-ContextMenuGroup",e)}));OK.displayName="ContextMenu.Group";const IK=s.forwardRef(({className:e,...t},n)=>s.createElement(nB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuRadioGroup","rt-ContextMenuRadioGroup",e)}));IK.displayName="ContextMenu.RadioGroup";const FK=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=YA.color.default,...i}=e;return s.createElement(rB,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-ContextMenuItem","rt-ContextMenuRadioItem",r)},s.createElement(rm,null,n),s.createElement(Jj,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(wd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})))});FK.displayName="ContextMenu.RadioItem";const _K=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=GA.color.default,...l}=e;return s.createElement(tB,{...l,asChild:!1,ref:t,"data-accent-color":i,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-ContextMenuItem","rt-ContextMenuCheckboxItem",r)},s.createElement(rm,null,n),s.createElement(Jj,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(wd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},a))});_K.displayName="ContextMenu.CheckboxItem";const VK=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(aB,{...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(sw,{className:"rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon"})))});VK.displayName="ContextMenu.SubTrigger";const ZK=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(qA),{className:l,children:u,container:f,forceMount:h,...p}=Cr({size:n,variant:r,color:a,highContrast:i,...e},bo);return s.createElement(Qj,{container:f,forceMount:h},s.createElement(no,{asChild:!0},s.createElement(oB,{"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(Vf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-ContextMenuViewport")},u)))))});ZK.displayName="ContextMenu.SubContent";const Cm=s.forwardRef(({className:e,...t},n)=>s.createElement(sB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuSeparator","rt-ContextMenuSeparator",e)}));Cm.displayName="ContextMenu.Separator";const aw=e=>s.createElement(yl,{...e,modal:!0});aw.displayName="Dialog.Root";const zK=s.forwardRef(({children:e,...t},n)=>s.createElement(Sv,{...t,ref:n,asChild:!0},ki(e)));zK.displayName="Dialog.Trigger";const ow=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=RA,{className:i}=Cr({align:e},{align:r}),{className:l,forceMount:u,container:f,...h}=Cr(t,a);return s.createElement(bl,{container:f,forceMount:u},s.createElement(no,{asChild:!0},s.createElement(xl,{className:"rt-BaseDialogOverlay rt-DialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-DialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${i}`},s.createElement(kl,{...h,ref:n,className:Kt("rt-BaseDialogContent","rt-DialogContent",l)}))))))});ow.displayName="Dialog.Content";const iw=s.forwardRef((e,t)=>s.createElement(Sl,{asChild:!0},s.createElement(tw,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));iw.displayName="Dialog.Title";const BK=s.forwardRef((e,t)=>s.createElement(Ev,{asChild:!0},s.createElement(bc,{as:"p",size:"3",...e,asChild:!1,ref:t})));BK.displayName="Dialog.Description";const UK=s.forwardRef(({children:e,...t},n)=>s.createElement(Nf,{...t,ref:n,asChild:!0},ki(e)));UK.displayName="Dialog.Close";const ys=e=>s.createElement(jB,{...e});ys.displayName="DropdownMenu.Root";const bs=s.forwardRef(({children:e,...t},n)=>s.createElement(AB,{...t,ref:n,asChild:!0},ki(e)));bs.displayName="DropdownMenu.Trigger";const XA=s.createContext({}),xs=s.forwardRef((e,t)=>{const n=nw(),{size:r=bo.size.default,variant:a=bo.variant.default,highContrast:i=bo.highContrast.default}=e,{className:l,children:u,color:f,container:h,forceMount:p,...m}=Cr(e,bo),g=f||n.accentColor;return s.createElement(tA,{container:h,forceMount:p},s.createElement(no,{asChild:!0},s.createElement(NB,{"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(Vf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},s.createElement(XA.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:g,highContrast:i}),[r,a,g,i])},u))))))});xs.displayName="DropdownMenu.Content";const U6=s.forwardRef(({className:e,...t},n)=>s.createElement(RB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e)}));U6.displayName="DropdownMenu.Label";const Xn=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=KA.color.default,shortcut:i,...l}=e;return s.createElement(PB,{"data-accent-color":a,...l,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",n)},s.createElement(rm,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});Xn.displayName="DropdownMenu.Item";const WK=s.forwardRef(({className:e,...t},n)=>s.createElement(MB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e)}));WK.displayName="DropdownMenu.Group";const cp=s.forwardRef(({className:e,...t},n)=>s.createElement($B,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e)}));cp.displayName="DropdownMenu.RadioGroup";const Pu=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=YA.color.default,...i}=e;return s.createElement(TB,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",r)},n,s.createElement(nA,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(wd,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Pu.displayName="DropdownMenu.RadioItem";const KK=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=GA.color.default,...l}=e;return s.createElement(LB,{...l,asChild:!1,ref:t,"data-accent-color":i,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",r)},n,s.createElement(nA,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(wd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},a))});KK.displayName="DropdownMenu.CheckboxItem";const GK=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(HB,{...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(sw,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});GK.displayName="DropdownMenu.SubTrigger";const YK=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(XA),{className:l,children:u,container:f,forceMount:h,...p}=Cr({size:n,variant:r,color:a,highContrast:i,...e},bo);return s.createElement(tA,{container:f,forceMount:h},s.createElement(no,{asChild:!0},s.createElement(OB,{"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(Vf,{type:"auto"},s.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},u)))))});YK.displayName="DropdownMenu.SubContent";const dc=s.forwardRef(({className:e,...t},n)=>s.createElement(DB,{...t,asChild:!1,ref:n,className:Kt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e)}));dc.displayName="DropdownMenu.Separator";const qK=["1","2","3","4"],XK={...to,size:{type:"enum",className:"rt-r-size",values:qK,default:"2",responsive:!0},width:So.width,minWidth:So.minWidth,maxWidth:{...So.maxWidth,default:"480px"},...Qv},nd=e=>s.createElement(sU,{...e});nd.displayName="Popover.Root";const rd=s.forwardRef(({children:e,...t},n)=>s.createElement(oU,{...t,ref:n,asChild:!0},ki(e)));rd.displayName="Popover.Trigger";const sd=s.forwardRef((e,t)=>{const{className:n,forceMount:r,container:a,...i}=Cr(e,XK);return s.createElement(iU,{container:a,forceMount:r},s.createElement(no,{asChild:!0},s.createElement(lU,{align:"start",sideOffset:8,collisionPadding:10,...i,ref:t,className:Kt("rt-PopperContent","rt-PopoverContent",n)})))});sd.displayName="Popover.Content";const QK=s.forwardRef(({children:e,...t},n)=>s.createElement(cU,{...t,ref:n,asChild:!0},ki(e)));QK.displayName="Popover.Close";const JK=s.forwardRef(({children:e,...t},n)=>s.createElement(aU,{...t,ref:n}));JK.displayName="Popover.Anchor";const eG=["1","2","3"],lw={size:{type:"enum",className:"rt-r-size",values:eG,default:"2",responsive:!0}},tG=["classic","surface","soft","ghost"],nG={variant:{type:"enum",className:"rt-variant",values:tG,default:"surface"},...Nl,...Em,placeholder:{type:"string"}},rG=["solid","soft"],sG={variant:{type:"enum",className:"rt-variant",values:rG,default:"solid"},...Nl,...Oc},cw=s.createContext({}),QA=e=>{const{children:t,size:n=lw.size.default,...r}=e;return s.createElement(DU,{...r},s.createElement(cw.Provider,{value:s.useMemo(()=>({size:n}),[n])},t))};QA.displayName="Select.Root";const JA=s.forwardRef((e,t)=>{const n=s.useContext(cw),{children:r,className:a,color:i,radius:l,placeholder:u,...f}=Cr({size:n==null?void 0:n.size,...e},{size:lw.size},nG,$o);return s.createElement(OU,{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(FU,{placeholder:u},r)),s.createElement(_U,{asChild:!0},s.createElement(WA,{className:"rt-SelectIcon"}))))});JA.displayName="Select.Trigger";const eN=s.forwardRef((e,t)=>{const n=s.useContext(cw),{className:r,children:a,color:i,container:l,...u}=Cr({size:n==null?void 0:n.size,...e},{size:lw.size},sG),f=nw(),h=i||f.accentColor;return s.createElement(BU,{container:l},s.createElement(no,{asChild:!0},s.createElement(UU,{"data-accent-color":h,sideOffset:4,...u,asChild:!1,ref:t,className:Kt({"rt-PopperContent":u.position==="popper"},"rt-SelectContent",r)},s.createElement(mA,{type:"auto",className:"rt-ScrollAreaRoot"},s.createElement(QU,{asChild:!0,className:"rt-SelectViewport"},s.createElement(gA,{className:"rt-ScrollAreaViewport",style:{overflowY:void 0}},a)),s.createElement(I6,{className:"rt-ScrollAreaScrollbar rt-r-size-1",orientation:"vertical"},s.createElement(F6,{className:"rt-ScrollAreaThumb"}))))))});eN.displayName="Select.Content";const tN=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(oW,{...a,asChild:!1,ref:t,className:Kt("rt-SelectItem",n)},s.createElement(cW,{className:"rt-SelectItemIndicator"},s.createElement(wd,{className:"rt-SelectItemIndicatorIcon"})),s.createElement(iW,null,r))});tN.displayName="Select.Item";const aG=s.forwardRef(({className:e,...t},n)=>s.createElement(nW,{...t,asChild:!1,ref:n,className:Kt("rt-SelectGroup",e)}));aG.displayName="Select.Group";const oG=s.forwardRef(({className:e,...t},n)=>s.createElement(sW,{...t,asChild:!1,ref:n,className:Kt("rt-SelectLabel",e)}));oG.displayName="Select.Label";const iG=s.forwardRef(({className:e,...t},n)=>s.createElement(uW,{...t,asChild:!1,ref:n,className:Kt("rt-SelectSeparator",e)}));iG.displayName="Select.Separator";const lG={content:{type:"ReactNode",required:!0},width:So.width,minWidth:So.minWidth,maxWidth:{...So.maxWidth,default:"360px"}},uw=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}=Cr(e,lG),w={open:a,defaultOpen:i,onOpenChange:l,delayDuration:u,disableHoverableContent:f};return s.createElement(MW,{...w},s.createElement(RW,{asChild:!0},n),s.createElement(PW,{container:p,forceMount:m},s.createElement(no,{asChild:!0},s.createElement(LW,{sideOffset:4,collisionPadding:10,...g,asChild:!1,ref:t,className:Kt("rt-TooltipContent",r)},s.createElement(bc,{as:"p",className:"rt-TooltipText",size:"1"},h),s.createElement($W,{className:"rt-TooltipArrow"})))))});uw.displayName="Tooltip";const Kr={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 nN(e,t){try{const n=localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}}const W6="scenri:pref-changed";function rN(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}try{window.dispatchEvent(new CustomEvent(W6,{detail:{key:e,value:t}}))}catch{}}function K6(e,t){try{const n=localStorage.getItem(e);return n===null?null:(localStorage.setItem(t,n),localStorage.removeItem(e),n)}catch{return null}}function Sa(e,t){const[n,r]=s.useState(()=>nN(e,t)),a=s.useRef(n);return s.useEffect(()=>{Object.is(a.current,n)||(a.current=n,rN(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(W6,i),()=>window.removeEventListener(W6,i)},[e]),[n,r]}function cG(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 o8(e,t){const[n,r]=Sa(e,t),[a,i]=s.useState(null);return[a??n,u=>{i(null),r(u)},i]}const uG=()=>nN(Kr.lastBrand,null),dG=e=>rN(Kr.lastBrand,e),G6="sc-theme",fG="bt-theme",hG=()=>window.matchMedia("(prefers-color-scheme: light)").matches,sN=s.createContext({choice:"system",mode:"dark",setChoice:()=>{},toggle:()=>{}}),pG=()=>s.useContext(sN);function mG(){const e=localStorage.getItem(G6)??K6(fG,G6);return e==="light"||e==="dark"||e==="system"?e:"system"}function gG({children:e}){const[t,n]=s.useState(mG),[r,a]=s.useState(()=>hG()?"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(G6,t)},[i,t]);const l=s.useMemo(()=>({choice:t,mode:i,setChoice:n,toggle:()=>n(i==="dark"?"light":"dark")}),[t,i]);return o.jsx(sN.Provider,{value:l,children:o.jsx(no,{appearance:i,accentColor:"gray",grayColor:"gray",radius:"large",scaling:"100%",children:e})})}const aN=s.createContext({push:()=>{}}),rr=()=>s.useContext(aN),vG=3,wG=140,T0=e=>{var t;return!!(e.action||(t=e.actions)!=null&&t.length)},yG=e=>{var t;return((t=e.actions)!=null&&t.length?e.actions:e.action?[e.action]:[]).slice(0,2)};function i8(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=T0(e)?9e3:4e3,r=T0(e)?14e3:8e3;return Math.min(n+Math.max(0,t-40)*45,r)}function bG(e,t,n){const r=n>1?` (${n} times)`:"";return`${e}${r}${t?` ${t}`:""}`}const xG=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function kG({kind:e}){if(e==="info")return null;const t=e==="success"?Gn:e==="warning"?nm:Pc;return o.jsx(t,{className:"sc-toast-ic",size:16,weight:"regular","aria-hidden":"true"})}function SG({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(C=>{a.current=C,n(C)},[]),m=s.useCallback(C=>{const E=C.kind==="error"?u.current:l.current;if(!E)return;const A=bG(C.title,C.detail,C.count);E.textContent=A,window.setTimeout(()=>{E.textContent===A&&(E.textContent="")},1e3)},[]),g=s.useCallback(C=>{const E=i.current.get(C);(E==null?void 0:E.handle)!=null&&window.clearTimeout(E.handle),i.current.delete(C),p(a.current.map(A=>A.id===C&&!A.leaving?{...A,leaving:!0}:A)),window.setTimeout(()=>p(a.current.filter(A=>A.id!==C)),wG+40)},[p]),w=s.useCallback((C,E)=>{if(!Number.isFinite(E))return;const A=i.current.get(C)??{remaining:E,since:0,handle:null};A.handle!=null&&window.clearTimeout(A.handle),A.remaining=E,A.since=Date.now(),A.handle=window.setTimeout(()=>g(C),E),i.current.set(C,A)},[g]),y=s.useCallback(C=>{const E=i.current.get(C);!E||E.handle==null||(window.clearTimeout(E.handle),E.handle=null,E.remaining=Math.max(0,E.remaining-(Date.now()-E.since)))},[]),b=s.useCallback(C=>{const E=i.current.get(C);!E||E.handle!=null||w(C,E.remaining)},[w]);s.useEffect(()=>{const C=()=>{const E=[...i.current.keys()];document.hidden?E.forEach(y):E.forEach(b)};return document.addEventListener("visibilitychange",C),()=>document.removeEventListener("visibilitychange",C)},[y,b]),s.useLayoutEffect(()=>{const C=f.current;if(!C)return;const E=new Map,A=!xG();for(const P of C.querySelectorAll("[data-toast-id]")){const T=Number(P.dataset.toastId),M=P.getBoundingClientRect().top;E.set(T,M);const j=h.current.get(T);if(!A||j===void 0||P.hasAttribute("data-leaving"))continue;const R=j-M;R&&(P.style.transition="none",P.style.transform=`translateY(${R}px)`,P.getBoundingClientRect(),P.style.transition="transform 160ms cubic-bezier(.2, .7, .3, 1)",P.style.transform="")}h.current=E},[t]),s.useLayoutEffect(()=>{const C=f.current;if(!C)return;const E=()=>{const T=document.querySelector(".sc-canvas-dock");if(!T||!t.length){delete C.dataset.overDock;return}const M=C.getBoundingClientRect(),j=T.getBoundingClientRect();M.left<j.right&&j.left<M.right?(C.style.setProperty("--sc-toasts-over-dock",`${Math.round(window.innerHeight-j.top+10)}px`),C.dataset.overDock=""):delete C.dataset.overDock};E(),window.addEventListener("resize",E);const A=document.querySelector(".sc-canvas-dock"),P=typeof ResizeObserver>"u"||!A?null:new ResizeObserver(E);return P==null||P.observe(A),()=>{window.removeEventListener("resize",E),P==null||P.disconnect()}},[t]);const k=s.useCallback(C=>{const E=a.current.filter(j=>!j.leaving),A=T0(C)?void 0:E.find(j=>j.kind===C.kind&&j.title===C.title&&j.detail===C.detail&&!T0(j));if(A){const j={...A,count:A.count+1};p(a.current.map(L=>L.id===A.id?j:L));const R=i.current.get(A.id);R&&R.handle==null?R.remaining=i8(j):w(A.id,i8(j)),j.quiet||m(j);return}const P={...C,id:r.current++,count:1},T=[...a.current,P],M=j=>!j.leaving;for(;T.filter(M).length>vG;){let j=T.findIndex(H=>M(H)&&H.kind!=="error"&&!T0(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],L=i.current.get(R.id);(L==null?void 0:L.handle)!=null&&window.clearTimeout(L.handle),i.current.delete(R.id)}p(T),w(P.id,i8(P)),P.quiet||m(P)},[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(aN.Provider,{value:S,children:[e,zr.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:s5,onMouseDown:s5,children:t.map(C=>{const E=yG(C);return o.jsx("div",{className:"sc-toast-wrap","data-toast-id":C.id,"data-leaving":C.leaving||void 0,children:o.jsxs("article",{className:"sc-toast","data-kind":C.kind,onPointerEnter:()=>y(C.id),onPointerLeave:()=>b(C.id),onFocus:()=>y(C.id),onBlur:A=>{A.currentTarget.contains(A.relatedTarget)||b(C.id)},children:[o.jsx(kG,{kind:C.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:[C.title,C.count>1?o.jsxs("span",{className:"sc-toast-n",children:["×",C.count]}):null]}),C.detail?o.jsx("small",{children:C.detail.slice(0,160)}):null]}),o.jsx("button",{type:"button",className:"sc-toast-x",onClick:()=>g(C.id),"aria-label":"Dismiss",children:o.jsx(Rn,{size:14,weight:"regular"})})]}),E.length?o.jsx("div",{className:"sc-toast-acts",children:E.map(A=>o.jsx("button",{type:"button",className:"sc-toast-act",onClick:()=>{A.onClick(),g(C.id)},children:A.label},A.label))}):null]})]})},C.id)})})]}),document.body)]})}function s5(e){e.stopPropagation(),e.type==="mousedown"&&e.target instanceof Element&&e.target.closest("button")&&e.preventDefault()}async function Ye(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 EG=(e,t,n)=>Ye("DELETE",`/api/brands/${e}/${t}/${n}`),Y6=(e,t)=>EG(e,"products",t);async function oN(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 CG=e=>`/api/brands/${e}/export`;async function jG(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 tf(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 up(e){if(!e||typeof e!="object")return e;const{products:t,scenes:n,characters:r,...a}=e;return a}function AG(e,t,n){try{return fetch(`/api/brands/${e}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({brand:up(t),keepAssets:!0,base:up(n)}),keepalive:!0}).then(r=>r.ok?r.json():null).catch(()=>null)}catch{return Promise.resolve(null)}}const $r=e=>`/api/images/${e}`,qr=e=>e!=null&&e.startsWith("asset:")?$r(e.slice(6)):null,iN={large:960,tile:640,small:320,micro:160},gn=(e,t)=>`${$r(e)}/thumb?w=${iN[t]}`,jm=(e,t)=>e!=null&&e.startsWith("asset:")?gn(e.slice(6),t):null,NG=/^\/api\/images\/([a-f0-9]{32})(?:\/thumb\?w=\d+)?$/,MG=/^(\/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 Tn(e,t){if(!e)return e;const n=NG.exec(e);if(n)return t==="full"?$r(n[1]):gn(n[1],t);const r=MG.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=${iN[t]}`}function cc(e){const t=Tn(e,"tile"),n=Tn(e,"large");if(!(!t||!n||t===n))return`${t} 640w, ${n} 960w`}const lN={large:"(max-width: 720px) 50vw, 360px",compact:"(max-width: 720px) 50vw, 240px"};function a5(e){return e.every(t=>t.kind==="root")}let cN=new Map;function RG(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 PG(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 Tr(e){const t=PG(e);return t||(e.promptHead??"").trim().split(/\s+/).slice(0,6).join(" ")||(e.kind==="edit"?"Edit":"Generation")}const uN=[{id:"newest",label:"Newest first"},{id:"oldest",label:"Oldest first"},{id:"cost",label:"Highest cost"},{id:"keepers",label:"Keepers first"}];function LG(e){return uN.some(t=>t.id===e)}const dN=[{id:"all",label:"All"},{id:"keepers",label:"Keepers"},{id:"archived",label:"Archived"}];function $G(e){return dN.some(t=>t.id===e)}function TG(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 q6(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 Lu=(e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id),Ne={brands:()=>Ye("GET","/api/brands"),createBrand:e=>Ye("POST","/api/brands",{brand:e}),brandFromUrl:e=>Ye("POST","/api/brands/from-url",{url:e}),updateBrand:(e,t,n)=>Ye("PUT",`/api/brands/${e}`,{brand:up(t),keepAssets:!0,base:up(n)}),deleteBrand:e=>Ye("DELETE",`/api/brands/${e}`),guide:()=>Ye("GET","/api/guide"),guideIntent:e=>Ye("POST","/api/guide",e,void 0,{keepalive:!0}),refreshBrandFromUrl:(e,t)=>Ye("POST",`/api/brands/${e}/refresh-from-url`,t?{url:t}:{}),updateLogo:(e,t,n)=>Ye("PATCH",`/api/brands/${e}/logos/${t}`,n),deleteLogo:(e,t)=>Ye("DELETE",`/api/brands/${e}/logos/${t}`),projects:e=>Ye("GET",`/api/projects?brandId=${encodeURIComponent(e)}`),createProject:(e,t)=>Ye("POST","/api/projects",{brandId:e,name:t}),tree:e=>Ye("GET",`/api/projects/${e}/tree`),activity:e=>Ye("GET",`/api/brands/${e}/activity`),workspace:e=>Ye("GET",`/api/brands/${e}/workspace`),feed:(e,t,n)=>Ye("GET",`/api/brands/${e}/feed${TG(t)}`,void 0,n),node:e=>Ye("GET",`/api/nodes/${e}`),lineage:e=>Ye("GET",`/api/nodes/${e}/lineage`),usage:e=>Ye("GET",`/api/brands/${e}/usage`),sets:e=>Ye("GET",`/api/brands/${e}/sets`),createSet:(e,t)=>Ye("POST",`/api/brands/${e}/sets`,{name:t}),renameSet:(e,t)=>Ye("PATCH",`/api/sets/${e}`,{name:t}),deleteSet:e=>Ye("DELETE",`/api/sets/${e}`),addToSet:(e,t)=>Ye("POST",`/api/sets/${e}/nodes`,{nodeIds:t}),removeFromSet:(e,t)=>Ye("POST",`/api/sets/${e}/nodes/remove`,{nodeIds:t}),engines:()=>Ye("GET","/api/engines"),codexStatus:(e={})=>Ye("GET",`/api/engines/codex/status${e.force?"?force=1":""}`),repairCodexEnv:e=>Ye("POST","/api/engines/codex/repair-env",{keys:e}),restoreCodexEnv:()=>Ye("POST","/api/engines/codex/restore-env"),installCodex:()=>Ye("POST","/api/engines/codex/install"),loginCodex:()=>Ye("POST","/api/engines/codex/login"),setCap:(e,t)=>Ye("PUT","/api/caps",{engineId:e,capUsd:t}),addNode:e=>Ye("POST","/api/nodes",e),cancelNode:e=>Ye("POST",`/api/nodes/${e}/cancel`),retryNode:e=>Ye("POST",`/api/nodes/${e}/retry`),scenes:()=>Ye("GET","/api/scenes"),presenters:()=>Ye("GET","/api/presenters"),presenterFrames:e=>Ye("GET",`/api/presenter-previews/${e}`),demoProducts:()=>Ye("GET","/api/demo-products"),demoProductFrames:e=>Ye("GET",`/api/demo-product-previews/${e}`),showcase:()=>Ye("GET","/api/showcase"),previewBrief:(e,t,n,r)=>Ye("POST","/api/brief/preview",{brief:e,engineId:t,brandId:n,...r?{parentId:r}:{}}),keep:(e,t)=>Ye("POST",`/api/nodes/${e}/keep`,{kept:t}),archiveNode:(e,t)=>Ye("POST",`/api/nodes/${e}/archive`,{archived:t}),deleteNode:e=>Ye("DELETE",`/api/nodes/${e}`),deleteNodesBatch:e=>Ye("POST","/api/nodes/delete-batch",{nodeIds:e}),settings:()=>Ye("GET","/api/settings"),saveSettings:e=>Ye("PUT","/api/settings",e),costs:()=>Ye("GET","/api/costs/summary"),home:()=>Ye("GET","/api/home"),reveal:()=>Ye("POST","/api/system/reveal"),version:()=>Ye("GET","/api/version"),updateStatus:()=>Ye("GET","/api/update/status"),updateCheck:()=>Ye("POST","/api/update/check"),updateApply:()=>Ye("POST","/api/update/apply"),updateRestart:()=>Ye("POST","/api/update/restart"),desktop:()=>Ye("GET","/api/desktop"),phone:(e=!1)=>Ye("GET",e?"/api/phone?fresh=1":"/api/phone"),phoneNewCode:()=>Ye("POST","/api/phone/code"),phoneHelp:()=>Ye("GET","/api/phone/help"),phoneAllow:()=>Ye("POST","/api/phone/allow"),desktopInstall:()=>Ye("POST","/api/desktop/install"),quit:()=>Ye("POST","/api/system/quit"),releaseNotes:()=>Ye("GET","/api/release/notes"),releaseSeen:e=>Ye("POST","/api/release/seen",{version:e}),releaseUsed:e=>Ye("POST","/api/release/used",{feature:e}),sceneFrames:e=>Ye("GET",`/api/scene-previews/${e}`),pickSceneView:(e,t)=>Ye("POST",`/api/scenes/${e}/views/${t}/pick`),deleteData:e=>Ye("DELETE",`/api/data?scope=${e}`),libraryProduct:(e,t)=>Ye("GET",`/api/brands/${e}/products-library/${encodeURIComponent(t)}`),productsLibrary:e=>Ye("GET",`/api/brands/${e}/products-library`),catalogImport:(e,t,n)=>Ye("POST",`/api/brands/${e}/catalog/import`,n?{url:t,urls:n}:{url:t}),catalogScan:(e,t)=>Ye("POST",`/api/brands/${e}/catalog/scan`,t?{url:t}:{}),catalogDetails:(e,t)=>Ye("POST",`/api/brands/${e}/catalog/details`,{urls:t}),catalogScanState:(e,t,n)=>Ye("GET",`/api/brands/${e}/catalog/scans/${t}`,void 0,n),cancelCatalogScan:(e,t)=>Ye("POST",`/api/brands/${e}/catalog/scans/${t}/cancel`),catalogJob:(e,t)=>Ye("GET",`/api/brands/${e}/catalog/jobs/${t}`),catalogJobs:e=>Ye("GET",`/api/brands/${e}/catalog/jobs`),cancelCatalogJob:(e,t)=>Ye("POST",`/api/brands/${e}/catalog/jobs/${t}/cancel`),deleteCatalogProduct:(e,t)=>Ye("DELETE",`/api/brands/${e}/catalog/products/${t}`),updateProduct:(e,t,n)=>Ye("PATCH",`/api/brands/${e}/products/${t}`,n),updateCatalogProduct:(e,t,n)=>Ye("PATCH",`/api/brands/${e}/catalog/products/${t}`,n),productSize:(e,t)=>Ye("GET",`/api/brands/${e}/products/${t}/size`),setProductSize:(e,t,n)=>Ye("PUT",`/api/brands/${e}/products/${t}/size`,{size:n}),setProductShots:(e,t,n)=>Ye("PUT",`/api/brands/${e}/products/${t}/shots`,{files:n}),assetBuildCapabilities:()=>Ye("GET","/api/asset-builds/capabilities"),startAssetBuild:(e,t)=>Ye("POST",`/api/brands/${e}/asset-builds`,t),assetBuild:(e,t)=>Ye("GET",`/api/brands/${e}/asset-builds/${t}`),assetBuilds:e=>Ye("GET",`/api/brands/${e}/asset-builds`),cancelAssetBuild:(e,t)=>Ye("POST",`/api/brands/${e}/asset-builds/${t}/cancel`),deleteAssetBuild:(e,t)=>Ye("DELETE",`/api/brands/${e}/asset-builds/${t}`),createProduct:(e,t)=>Ye("POST",`/api/brands/${e}/products`,t),createPresenterDraft:(e,t)=>Ye("POST",`/api/brands/${e}/presenter-drafts`,t),presenterDrafts:e=>Ye("GET",`/api/brands/${e}/presenter-drafts`),presenterDraft:(e,t)=>Ye("GET",`/api/brands/${e}/presenter-drafts/${t}`),updatePresenterDraft:(e,t,n)=>Ye("PATCH",`/api/brands/${e}/presenter-drafts/${t}`,n),generateDraftView:(e,t,n,r={})=>Ye("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/generate`,r),approveDraftView:(e,t,n)=>Ye("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/approve`),redoDraftView:(e,t,n)=>Ye("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/redo`),revertDraftView:(e,t,n)=>Ye("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/revert`),stopDraft:(e,t)=>Ye("POST",`/api/brands/${e}/presenter-drafts/${t}/stop`),restoreDraftView:(e,t,n,r)=>Ye("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/restore`,{hash:r}),savePresenterDraft:(e,t)=>Ye("POST",`/api/brands/${e}/presenter-drafts/${t}/save`),deletePresenterDraft:(e,t)=>Ye("DELETE",`/api/brands/${e}/presenter-drafts/${t}`),createPresenter:(e,t)=>Ye("POST",`/api/brands/${e}/presenters`,t),updatePresenter:(e,t,n)=>Ye("PATCH",`/api/brands/${e}/presenters/${t}`,n),deletePresenter:(e,t)=>Ye("DELETE",`/api/brands/${e}/presenters/${t}`),duplicatePresenter:(e,t,n)=>Ye("POST",`/api/brands/${e}/presenters/${t}/duplicate`,{name:n}),editPresenter:(e,t)=>Ye("POST",`/api/brands/${e}/presenters/${t}/edit`),revertPresenter:(e,t)=>Ye("POST",`/api/brands/${e}/presenters/${t}/revert`),createScene:(e,t)=>Ye("POST",`/api/brands/${e}/scenes`,t),updateScene:(e,t,n)=>Ye("PATCH",`/api/brands/${e}/scenes/${t}`,n),deleteScene:(e,t)=>Ye("DELETE",`/api/brands/${e}/scenes/${t}`),sceneExamples:(e,t)=>Ye("GET",`/api/brands/${e}/scenes/${t}/examples`),drawSceneExamples:(e,t,n)=>Ye("POST",`/api/brands/${e}/scenes/${t}/examples`,n),stopSceneExamples:(e,t)=>Ye("POST",`/api/brands/${e}/scenes/${t}/examples/stop`),removeSceneExample:(e,t,n)=>Ye("DELETE",`/api/brands/${e}/scenes/${t}/examples/${n}`),generateScenePreview:(e,t)=>Ye("POST",`/api/brands/${e}/scenes/${t}/preview`),rereadScene:(e,t,n)=>Ye("POST",`/api/brands/${e}/scenes/${t}/reread`,{correction:n}),startSceneStudioJob:(e,t)=>Ye("POST",`/api/brands/${e}/scene-studio/jobs`,t),sceneStudioJob:(e,t)=>Ye("GET",`/api/brands/${e}/scene-studio/jobs/${t}`),cancelSceneStudioJob:(e,t)=>Ye("POST",`/api/brands/${e}/scene-studio/jobs/${t}/cancel`),labelSceneStudioJob:(e,t,n)=>Ye("POST",`/api/brands/${e}/scene-studio/jobs/${t}/label`,{label:n}),attachSceneStudioJob:(e,t,n)=>Ye("POST",`/api/brands/${e}/scene-studio/jobs/${t}/attach`,{sceneId:n})},X6="scenri:guide-heading",DG=["first-shot","refine","product","presenter","scene","reuse"],HG=e=>DG.includes(e);function OG(){try{const e=typeof window>"u"?null:window.sessionStorage.getItem(X6);if(!e)return null;if(e.startsWith("{")){const t=JSON.parse(e);return typeof t.brandId=="string"&&HG(t.task)?{brandId:t.brandId,task:t.task}:null}return{brandId:e,task:"first-shot"}}catch{return null}}function fN(e){try{e?window.sessionStorage.setItem(X6,JSON.stringify(e)):window.sessionStorage.removeItem(X6)}catch{}}const IG={loaded:!1,heading:null,eligible:!1,welcome:null,hidden:!0,done:{},lessons:{},progress:{},dismissed:[],active:null,activeNodes:[],activeDraftId:null,counts:null};let qa={...IG,heading:OG()},o5=null,l8=null,i5=!1;const Q6=new Set;function fc(e){qa=e;for(const t of Q6)t()}function hN(e){const t=e;return{...t,lessons:t.lessons??{},progress:t.progress??{},loaded:!0,heading:qa.heading}}function dp(){return l8??(l8=Ne.guide().then(e=>fc(hN(e))).catch(()=>{qa.loaded||fc({...qa,loaded:!0})}).finally(()=>{l8=null})),l8}function FG(){return!i5&&typeof document<"u"&&(i5=!0,document.addEventListener("visibilitychange",()=>{!document.hidden&&qa.loaded&&dp()})),o5??(o5=dp()),o5}function c8(){return dp()}function _G(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 tc(e){const t=qa;return fc(_G(qa,e)),Ne.guideIntent(e).then(n=>fc(hN(n))).catch(()=>{fc(t),dp()})}function VG(e){return Q6.add(e),()=>Q6.delete(e)}const pN=e=>`scenri:guide-via-bar:${e}`,J6=(e,t)=>t==="first-shot"||t==="reuse"?pN(e):`scenri:guide-via:${e}:${t}`;function mN(e,t){const n={brandId:e,task:t};fN(n),fc({...qa,heading:n})}function e4(){fN(null),qa.heading&&fc({...qa,heading:null})}function zh(){return qa}function dw(){return s.useSyncExternalStore(VG,zh)}const ht={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:"*"},No=e=>us(ht.brand,{brandSlug:e.slug}),_u=e=>us(ht.products,{brandSlug:e.slug}),wa=(e,t)=>us(ht.product,{brandSlug:e.slug,productId:t}),sl=e=>us(ht.scenes,{brandSlug:e.slug}),Zr=(e,t)=>us(ht.scene,{brandSlug:e.slug,sceneId:t}),al=(e,t)=>us(ht.sceneStudio,{brandSlug:e.slug,convoId:t??void 0}),fw=(e,t,n)=>us(ht.sceneEdit,{brandSlug:e.slug,sceneId:t,convoId:n??void 0}),ni=e=>us(ht.presenters,{brandSlug:e.slug}),Ea=(e,t)=>us(ht.presenter,{brandSlug:e.slug,presenterId:t}),ol=(e,t)=>us(ht.presenterStudio,{brandSlug:e.slug,draftId:t??void 0}),Am=(e,t)=>us(ht.presenterEdit,{brandSlug:e.slug,presenterId:t}),xr=e=>us(ht.hub,{brandSlug:e.slug}),S0=(e,t)=>us(ht.set,{brandSlug:e.slug,setSlug:t.slug}),fp=e=>us(ht.whatsNew,{brandSlug:e.slug}),Nm=(e,t,n)=>t?us(ht.setShot,{brandSlug:e.slug,setSlug:t.slug,shotId:n}):us(ht.hubShot,{brandSlug:e.slug,shotId:n});function ZG(e,t=""){const[,,n,...r]=e.split("/");if(!n)return ht.root;const a=`/${n}${zG(r)}`;return t?a+t:a}function zG(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 u8="Scenri",l5=" - ",c5=40,BG=[["whatsnew","What's new"],["setup","Providers"],["settings","Settings"]],UG=[[ht.setup,"Set up",!1],[ht.hubShot,"Shot",!1],[ht.setShot,"Shot",!1],[ht.hub,"Create",!1],[ht.set,"Create",!0],[ht.kit,"Brand kit",!1],[ht.whatsNew,"What's new",!1],[ht.product,"Products",!0],[ht.products,"Products",!1],[ht.scene,"Scenes",!0],[ht.scenes,"Scenes",!1],[ht.presenter,"Presenters",!0],[ht.presenters,"Presenters",!1],[ht.brand,"Home",!1]];function WG(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 KG(e,t="",n=null){const r=new URLSearchParams(t);for(const[a,i]of BG)if(r.has(a))return i+l5+u8;for(const[a,i,l]of UG)if(cl(a,e))return((l?WG(n):null)??i)+l5+u8;return u8}const gN=s.createContext(null);function GG(){const{pathname:e,search:t}=Un(),[n,r]=s.useState(null);return s.useEffect(()=>{document.title=KG(e,t,n)},[e,t,n]),r}function Ic(e){const t=s.useContext(gN);s.useEffect(()=>{if(t)return t(e??null),()=>t(null)},[t,e])}const YG={scenes:[],collections:[],verticals:[],loaded:!1,error:!1};function qG(){const[e,t]=s.useState(YG),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ne.scenes().then(u=>{RG(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 XG={presenters:[],categories:[],styles:[],loaded:!1,error:!1};function QG(){const[e,t]=s.useState(XG),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ne.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 JG={demoProducts:[],categories:[],loaded:!1,error:!1};function eY(){const[e,t]=s.useState(JG),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ne.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 tY={showcase:[],categories:[],loaded:!1,error:!1};function nY(){const[e,t]=s.useState(tY),[n,r]=s.useState(0),a=s.useRef(!1);s.useEffect(()=>{let l=!0;return Ne.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 gh=[{id:"brand",label:"Brand kit",Icon:QI,scope:"brand",sub:e=>`What every shot for ${e} can draw on.`},{id:"usage",label:"Usage",Icon:OI,scope:"brand",sub:e=>`What ${e} has made, one square per day.`},{id:"engines",label:"Providers",Icon:W0,scope:"studio",sub:()=>"Where your images are made, and what each may spend."},{id:"appearance",label:"Appearance",Icon:FI,scope:"studio",sub:()=>"How Scenri looks on this device."},{id:"library",label:"Library",Icon:fv,scope:"studio",sub:()=>"Your work, as plain files on this computer. Back them up like anything else."},{id:"phone",label:"Local access",Icon:_I,scope:"studio",sub:()=>"Open Scenri on your phone, tablet or another computer, or from your desktop.",feature:"local-access"},{id:"updates",label:"Updates",Icon:Jh,scope:"studio",sub:()=>"How this copy of Scenri stays current."},{id:"about",label:"About",Icon:Jp,scope:"studio",sub:()=>"The copy of Scenri you are running."},{id:"danger",label:"Danger zone",Icon:tm,scope:"apart",sub:()=>"These do not come back. Export from Library first if you are not certain."}],vN={brand:"brand",usage:"usage",engines:"engines",budget:"engines",general:"appearance",appearance:"appearance",library:"library",phone:"phone",updates:"updates",about:"about",danger:"danger"},rY="index",wN=e=>e!==null&&Object.prototype.hasOwnProperty.call(vN,e),sY=e=>wN(e)?vN[e]:"brand",aY=e=>!wN(e),yN=["settings","setup","new","whatsnew","learn","welcome"];function Ml(){const{open:e}=Er("settings");return s.useCallback(t=>e(t??rY),[e])}function oY(){const{open:e}=Er("welcome");return s.useCallback(()=>e("1"),[e])}const t4={current:null};function bN(){const{open:e}=Er("learn");return s.useCallback((t="lessons")=>e(t),[e])}const u5="codex-cli";function Rl(){const{open:e}=Er("setup");return s.useCallback((t=u5)=>{e(typeof t=="string"?t:u5)},[e])}function xN(e){var t;e.preventDefault(),(t=e.currentTarget)==null||t.focus({preventScroll:!0})}function kN({failure:e,density:t,onRetry:n,dismiss:r}){const a=Ml(),i=Rl(),{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(Pc,{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(U0,{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 hw({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(Pc,{size:16,weight:"fill"}):o.jsx(Jp,{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 SN(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 Sr=SN(()=>localStorage),Fc=SN(()=>sessionStorage),EN=720*60*60*1e3;function CN(e){return e?e.phase==="ready"?e.blockReason!=="dev"&&e.blockReason!=="unsupervised"&&e.blockReason!=="launcher-too-old":e.canApply:!1}function iY(e){return!!(e!=null&&e.available)&&e.blockReason!=="dev"}function lY(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:CN(e)}}const cY=1800*1e3,d5=300*1e3,d8=e=>new Promise(t=>setTimeout(t,e)),jN="scenri:update-dismissed",uY=()=>Fc.get(jN),dY=e=>Fc.set(jN,e),AN=s.createContext(null);function Mm(){const e=s.useContext(AN);if(!e)throw new Error("useUpdateCenter must be used inside UpdateCenterProvider");return e}function fY({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState(!1),[i,l]=s.useState(uY),u=s.useRef(void 0),[f,h]=s.useState(!1);s.useEffect(()=>{let R=!0;return Ne.version().then(L=>R&&h(L.thisComputer===!0)).catch(()=>{}),()=>{R=!1}},[]),s.useEffect(()=>{let R=!0;const L=async()=>{if(R){if(!document.hidden)try{const D=await Ne.updateStatus();R&&n(D)}catch{}R&&(u.current=window.setTimeout(L,cY))}};L();const H=()=>{document.hidden||!R||(window.clearTimeout(u.current),L())};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 Ne.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&&(dY(R),l(R))},[t]),y=(t==null?void 0:t.latest)!=null&&t.latest===i,[b,k]=s.useState("idle"),[S,C]=s.useState(null),E=s.useCallback(async R=>{k("restarting");try{await Ne.updateRestart()}catch(H){if(typeof H.status=="number"){k("idle"),C(String((H==null?void 0:H.message)??H));return}}const L=Date.now()+3e4;for(;Date.now()<L;){await d8(800);try{if((await Ne.version()).version!==R){location.reload();return}}catch{}}k("idle"),C("The restart did not complete. Check the terminal Scenri runs in.")},[]),A=s.useCallback(async()=>{if(b!=="idle")return null;try{await Ne.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]),P=s.useCallback(async()=>{if(b!=="idle")return;C(null);const R=t==null?void 0:t.current;try{if((t==null?void 0:t.phase)!=="ready"){k("applying"),await Ne.updateApply();const L=Date.now()+d5;let H=!1;for(;Date.now()<L;){await d8(1500);const D=await Ne.updateStatus();if(n(D),D.phase==="ready"){H=!0;break}if(D.phase==="error"){C(D.error??"The update could not be staged."),k("idle");return}}if(!H){C("Couldn't download the update. Try again."),k("idle");return}}await E(R)}catch(L){C(String((L==null?void 0:L.message)??L)),k("idle")}},[b,t,E]),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 L=Date.now()+d5;return(async()=>{for(;R&&Date.now()<L;){if(await d8(1500),!R)return;try{const D=await Ne.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===ht.setup;return o.jsxs(AN.Provider,{value:{status:t,checking:r,checkNow:g,checkError:p,dismissed:y,dismiss:w,apply:P,quit:A,thisComputer:f,busy:b,applyError:S},children:[e,b!=="restarting"&&f&&iY(t)&&!y&&!j&&o.jsx(mY,{}),b==="restarting"&&o.jsx(hY,{version:(t==null?void 0:t.stagedVersion)??(t==null?void 0:t.latest)??null})]})}function hY({version:e}){return o.jsxs(pY,{children:[o.jsx(k7,{size:22}),o.jsx("b",{children:e?`Updating to Scenri ${e}`:"Updating Scenri"}),o.jsx("small",{children:"Restarting. This page reconnects by itself."})]})}function pY({children:e,className:t}){return zr.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 mY(){const{status:e,dismiss:t,apply:n,busy:r,applyError:a}=Mm(),i=Ml();if(!e)return null;const l=lY(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(ZI,{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 gY(e,t){return!e||t.updatedAt>=e.updatedAt}function vY(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0||e[n]===t||!gY(e[n],t))return e;const r=e.slice();return r[n]=t,r}function wY(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 pw=(e,t)=>`scenri:new-${e}-${t}`,yY=e=>Fc.get(e),bY=(e,t)=>Fc.set(e,t);function E0(e){Fc.del(e),Sr.del(e)}function f8(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 f5=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function NN(e,t){const n=pw(e,t),r=yY(n);if(!r)return null;let a;try{a=JSON.parse(r)}catch{return E0(n),null}if(typeof a!="object"||a===null)return E0(n),null;const i=a;if(i.v!==1||i.brandId!==e||i.kind!==t)return E0(n),null;const l=Date.now()-Date.parse(i.updatedAt??"");return!Number.isFinite(l)||l>EN?(E0(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:f5(i.facets),imageHashes:f5(i.imageHashes),importUrl:typeof i.importUrl=="string"?i.importUrl:"",pending:typeof i.pending=="string"?i.pending:null}}function h8(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};bY(pw(e,t),JSON.stringify(r))}function ju(e,t){E0(pw(e,t))}function xY(e,t,n){const r=NN(e,t);(r==null?void 0:r.pending)===n&&ju(e,t)}function kY(e,t){if(!e)return!1;if(e.pending===null)return!0;const n=t??"unknown";return n==="failed"||n==="cancelled"||n==="unknown"}const MN="the engine",RN=/no engine here can draw/i,SY=[{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=>`${po(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=>`${po(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=>`${po(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=>`${po(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=>`${po(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=>`${po(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=>`${po(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:RN,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=>`${po(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=>`${po(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=>`${po(e)} finished without making a picture.`,fix:"Run it again. This usually clears on a second try.",retryable:!0}];function po(e){return e===MN?"The engine":e}function ro(e,t){const n=(e??"").trim(),r=(t??"").replace(/\s*\(BYOK\)\s*$/i,"").trim()||MN;if(!n)return{kind:"unknown",title:"This shot did not finish.",raw:"",retryable:!0};for(const a of SY){if(!a.re.test(n))continue;const i=a.title(r)||EY(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 PN(){return{kind:"cancelled",title:"You stopped this shot.",fix:"The prompt is kept. Run it again whenever.",raw:"",retryable:!0}}function cn(e,t,n){const r=e instanceof Error?e.message:typeof e=="string"?e:String((e==null?void 0:e.message)??e),a=ro(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 EY(e){const t=e.trim();if(!t)return t;const n=t[0].toUpperCase()+t.slice(1);return/[.!?]$/.test(n)?n:`${n}.`}const Rm=[{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"}],Wf=e=>Rm.filter(e).map(t=>t.id),LN=Wf(()=>!0),CY=Wf(e=>e.tier==="core"),$N=Wf(e=>e.tier==="supplementary"),xc=Object.fromEntries(Rm.map(e=>[e.id,e.strip])),En=Object.fromEntries(Rm.map(e=>[e.id,e.name])),hc=e=>En[e],TN=Object.fromEntries(Rm.map(e=>[e.id,e.from])),n4=new Set(Wf(e=>e.gate===!0)),Go=e=>n4.has(e)?void 0:"auto",D0=4,h5=25*1024*1024,ri=e=>Wf(t=>{var n;return t.tier==="core"||!!e.extras||((n=e.views[t.id])==null?void 0:n.status)!=="empty"});function Pm(e){return ri(e).find(t=>e.views[t].status!=="approved")??null}const jY=e=>Pm(e)===null,si=e=>e.views.portrait.status==="approved"||!!e.views.portrait.prior,kc=e=>e.stage!=="idle"||!!e.activeView;function mw(e){if(kc(e))return null;const t=Pm(e);if(!t)return null;const n=e.views[t];return n.status!=="empty"&&n.status!=="stale"||n.error?null:TN[t].every(r=>e.views[r].status==="approved")?t:null}function DN(e,t){return t??(kc(e)?e.activeView:null)??Pm(e)??"portrait"}function HN(e,t){return ri(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:xc[n],state:a,hash:r.hash,photo:r.origin==="photo",drawing:e.activeView===n,approved:r.status==="approved",error:!!r.error}})}const AY={woman:"a woman",man:"a man",androgynous:"an androgynous person"},NY={woman:"her",man:"his",androgynous:"their"},hp=/\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,MY=/^(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 RY(e){const t=e.trim().split(/[^\p{L}\p{N}']+/u).filter(Boolean);return t.some(n=>hp.test(n))?t.every(n=>MY.test(n)||hp.test(n)):!1}const gw=/\b(\d0s|\d{2}\s*(years|yo)|teen|twenties|thirties|forties|fifties|sixties|seventies|elderly|young|old(er)?|middle-aged|adult)\b/i,PY=120,LY=18;function $Y(e){const t=e.match(/\d+/g);return t!=null&&t.length?t.every(n=>{const r=Number(n);return r>=LY&&r<=PY}):!1}const TY=/\b(hair|bald|shaved|buzz|blonde?|brunette|redhead|ginger|greying|silver|auburn|platinum)\b/i,DY=/\b(skin|complexion|fair|pale|light|olive|tan|tanned|brown|deep|dark|ebony|black|white|freckled|golden)\b/i,HY=/\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,OY=/\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,IY=/\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,ha=e=>HY.test(e)||gw.test(e)||TY.test(e)||DY.test(e)||OY.test(e)||IY.test(e);function FY(e,t){const n=t.trim();if(!n)return"";const r=[],a=e.steer&&!hp.test(n)?AY[e.steer]:"";if(a&&r.push(a),e.age&&!gw.test(n)){const l=e.steer?NY[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 _Y(e,t){var r;const n=((r=e.analysis)==null?void 0:r.suitableCategories)??[];return!n.length||t.length?null:n}function ON(e){return LN.some(t=>{const n=e.views[t];return!!n.hash&&n.origin!=="photo"&&n.status!=="empty"})}function VY(e,t){if(kc(e))return"Still drawing";for(const n of ri(e)){const r=e.views[n];if(r.status==="candidate")return`Decide on the ${hc(n)} first`;if(r.status==="stale")return`Redo the ${hc(n)} first`;if(r.status!=="approved")return`Use the ${hc(n)} first`}return t.trim()?null:"Give them a name"}const IN=/\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 FN(e,t,n){if(!e.trim())return{blocked:"Say what should change."};if(!si(n))return n.views.portrait.status!=="candidate"?{blocked:"Nothing to adjust yet."}:{view:"portrait",scope:"identity"};if(t==="portrait"||IN.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 ${hc(t)} yet.`}:{view:t,scope:"view"}}function p5(e,t){return si(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 ZY(e,t,n){const r=e.trim(),a=FN(r||"this",t,n);if("blocked"in a)return r?{chip:null,hint:a.blocked,tone:"alert"}:{chip:null,hint:p5(t,n)};const i=si(n)?a.scope==="identity"?"Changing the person":`Refining the ${En[a.view]}`:"Adjusting the face";return{chip:{view:a.view,label:i},hint:p5(t,n)}}const m5=e=>e.charAt(0).toUpperCase()+e.slice(1);function zY(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=ro(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=ri(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(hc).join(" and "):`${y.slice(0,-1).map(hc).join(", ")} and ${hc(y[y.length-1])}`,f=i.length?`${m5(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.":`${m5(u(l))} ${l.length===1?"is":"are"} drawn from them.`;return{text:[f,h].filter(Boolean).join(" ")}}const _N=e=>{var t;return(e.activeView?(t=e.views[e.activeView])==null?void 0:t.startedAt:void 0)??e.updatedAt};function VN(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 ${En[t]}`}function vw(e,t){return ZN(t).some(n=>!!e.views[n].hash)}function ZN(e){const t=new Set;for(let n=!0;n;){n=!1;for(const r of LN)r===e||t.has(r)||TN[r].some(a=>a===e||t.has(a))&&(t.add(r),n=!0)}return[...t]}function BY(e,t){const n=e.views[t].hash;return n?ZN(t).some(r=>{const a=e.views[r];return!!a.hash&&!(a.conditionedOn??[]).includes(n)}):!1}function zN(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 UY=["hero","close","hands","angle","bold"],Ua={hero:"Hero",close:"Close-up",hands:"Hands",angle:"Another angle",bold:"A bold one"},Vu={place:"Place",hero:"Hero",close:"Close-up",hands:"Hands",angle:"Angle",bold:"Bold"},g5={hero:"hero",close:"close-up",hands:"hands",angle:"other angle",bold:"bold one"},BN=(e,t)=>!!e&&e.status==="running"&&e.roles.includes(t)&&!e.done.includes(t)&&!e.failed.some(n=>n.role===t);function UN(e=[],t){const n=[];for(const r of UY){const a=e.find(l=>l.role===r);if(BN(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 WY(e,t=[],n){return e.filter(r=>!t.some(a=>a.role===r)&&!BN(n,r))}function KY(e=[]){return e.filter(t=>t.earlier).map(t=>t.role)}function ww(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 g5?g5[e.step]:null;return`${n?`Drawing the ${n}`:"Drawing examples"}${t}`}return e.done===1?"One example drawn":`${e.done??0} examples drawn`}function nf(e){const t=ro(e);return t.kind==="unknown"?null:[t.title,t.fix].filter(Boolean).join(" ")}const WN=50;function Za(e){return Date.parse(e.includes("T")?e:`${e.replace(" ","T")}Z`)}function za(e){return e.startedAt||e.createdAt}function Lm(e,t=Date.now()){const n=Za(e);return Number.isNaN(n)?0:Math.max(0,Math.round((t-n)/1e3))}function yw(e,t=Date.now()){const n=Lm(e,t);return n<20?"generating":n<60?"still generating":"taking longer than usual"}function Sc(e,t=Date.now()){const n=Lm(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 KN(e,t=Date.now()){const n=Lm(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 GN(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 YN=e=>e.setNames.length>0?`${e.setNames.join(", ")} · `:"";function GY(e){const t=ro(e);return t.kind==="restarted"?t.title:e??"failed"}function r4(e,t,n=Date.now(),r=1){const a=YN(e),i=r>1?`${r} shots`:"ready",l=e.status==="running"?`${a}${yw(za(e),n)}`:e.status==="error"?`${a}${GY(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 · ${Tr(e)}`:Tr(e),subtitle:l,thumb:e.images[0]??null,percent:null,startedAt:e.status==="running"?za(e):e.createdAt,href:Nm(t,null,e.id)}}function YY(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 r4(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=r4({...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:`${YN(a)}${i.length} of ${r.length} shots`}:u}function qY(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 XY="content:library";function QY(e){return{id:XY,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 JY(e,t){const n=qY(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:GN(e),startedAt:e.createdAt,href:_u(t)}}function eq(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"?Ea(t,e.assetId):Zr(t,e.assetId):null}}function tq(e){if(e.kind==="examples"){const n=ww(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 En?En[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 nq(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?fw(t,e.sceneId,e.conversation):al(t,e.conversation):e.attachTo?Zr(t,e.attachTo):null:e.presenterId?Am(t,e.presenterId):e.draftId?ol(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:tq(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 s4=e=>e.startsWith("scene:")||e.startsWith("presenter:")||e.startsWith("examples:");function v5(e,t){return e?e.split("?")[0].replace(/\/$/,"")===t.replace(/\/$/,""):!1}function w5(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(Sr.get(`scenri:scene-studio:${n}:${i[1]}`)??"null"))==null?void 0:l.sceneId)===r}catch{return!1}}function rq(e,t=12){const n=e.filter(a=>a.state==="running"),r=e.filter(a=>a.state!=="running").sort((a,i)=>Za(i.startedAt)-Za(a.startedAt)).slice(0,t);return n.sort((a,i)=>Za(a.startedAt)-Za(i.startedAt)),[...n,...r]}function sq(e,t,n=new Date){if(!e)return[];const r=[];for(const a of t){if(a.state==="running")continue;const i=e.get(a.id);i&&i.state!=="running"||r.push({id:a.id,kind:a.kind,state:a.state,title:a.title,subtitle:a.subtitle,thumb:a.thumb,at:n.toISOString(),href:a.href})}return r}function aq(e,t){if(!e)return[];const n=new Set(t.map(r=>r.id));return[...e.values()].filter(r=>r.state==="running"&&!n.has(r.id)&&(s4(r.id)||r.id.startsWith("build:"))).map(r=>({...r,state:"error",subtitle:"Lost when Scenri restarted. Start it again."}))}function oq(e,t){return e.length===0?null:new Map([...t.map(n=>[n.id,n]),...e.map(n=>[n.id,n])])}function iq(e,t,n=WN){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)=>Za(i.at)-Za(a.at)).slice(0,n)}function lq(e,t){const n=e.filter(a=>!a.watched);if(!t)return n.length;const r=Za(t);return n.filter(a=>Za(a.at)>r).length}const qN=e=>`scenri:notifications-${e}`,XN=e=>`scenri:notifications-seen-${e}`,QN=e=>Sr.get(e),JN=(e,t)=>Sr.set(e,t);function y5(e){const t=QN(qN(e));if(!t)return[];try{const n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}}const b5=(e,t)=>JN(qN(e),JSON.stringify(t.slice(0,WN))),x5=e=>QN(XN(e)),cq=(e,t)=>JN(XN(e),t),eM=e=>`scenri:activity-running-${e}`;function uq(e){const t=Fc.get(eM(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 dq=(e,t)=>Fc.set(eM(e),JSON.stringify(t.filter(n=>n.state==="running")));function p8(e,t){return e===t?!0:e.length!==t.length?!1:JSON.stringify(e)===JSON.stringify(t)}const fq=1500,hq=5e3,tM=s.createContext(null);function ea(){const e=s.useContext(tM);if(!e)throw new Error("useTaskCenter must be used inside TaskCenterProvider");return e}let m8=null;function pq({brand:e,onActivity:t,children:n}){const r=Bn(),{push:a}=rr(),{refreshBrands:i,noteContent:l}=Dn(),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(()=>y5(u)),[C,E]=s.useState(()=>x5(u)),[A,P]=s.useState(!1),T=s.useRef(null),M=s.useRef(!1),j=s.useRef(null),R=s.useRef(new Set),L=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),W=s.useRef(A);W.current=A;const K=s.useRef(r);K.current=r;const{pathname:F}=Un(),_=s.useRef(!1);_.current=/\/(create|sets)(\/|$)/.test(F);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,L.current=0,H.current=new Set,h([]),m([]),w([]),S(y5(u)),E(x5(u))},[u]);const z=s.useCallback(async()=>{var Qe,Pe;let ne,fe,re;try{const[{nodes:G,jobs:se,studio:We=[],boot:Ze,content:oe},{builds:q}]=await Promise.all([Ne.activity(u),Ne.assetBuilds(u)]);if(y.current.id!==u)return;fe=q,re=We,Ze&&j.current&&Ze!==j.current&&(M.current=!0),Ze&&(j.current=Ze),(Qe=Y.current)==null||Qe.call(Y,u,G),B.current(oe),oe!=null&&oe.arriving&&(m8??(m8=new Date().toISOString()));const ae=new Map,Le=[];for(const Je of G)Je.batchId?ae.set(Je.batchId,[...ae.get(Je.batchId)??[],Je]):Le.push(Je);const Ie=Date.now();ne=[...Le.map(Je=>r4(Je,y.current,Ie)),...[...ae.values()].map(Je=>YY(Je,y.current,Ie)),...se.map(Je=>JY(Je,y.current)),...q.map(Je=>eq(Je,y.current)),...We.map(Je=>nq(Je,y.current)),...oe!=null&&oe.arriving&&m8?[QY(m8)]:[]]}catch{M.current=!0;return}const ee=fe.filter(G=>G.finished&&G.assetId&&!H.current.has(G.id)),Q=new Set(fe.map(G=>G.id)),he=b.current.some(G=>!G.finished&&!Q.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 ce=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 ce)H.current.add(G);if(ee.length||he||Me.length||ce.length){for(const G of ee)H.current.add(G.id),xY(u,G.kind,G.id);if(await D.current(),y.current.id!==u)return}m(G=>p8(G,fe)?G:fe),w(G=>p8(G,re)?G:re);const ke=T.current??oq(uq(u),ne),Be=M.current?aq(ke,ne):[];M.current=!1;const ft=sq(ke,[...ne,...Be]);T.current=new Map(ne.map(G=>[G.id,G])),dq(u,ne),L.current=ne.filter(G=>G.state==="running").length;const Ue=rq(ne);if(h(G=>p8(G,Ue)?G:Ue),ft.length!==0&&(S(G=>{const se=window.location.pathname,We=ft.map(oe=>s4(oe.id)&&(v5(oe.href,se)||w5(oe,se,u))?{...oe,watched:!0}:_.current&&oe.state!=="error"?{...oe,watched:!0}:oe),Ze=iq(G,We);return b5(u,Ze),Ze}),!W.current))for(const G of ft){if(R.current.has(G.id)||(R.current.add(G.id),G.state==="cancelled"))continue;if(s4(G.id)){const Ze=window.location.pathname;if(v5(G.href,Ze)||w5(G,Ze,u))continue;const oe=G.href,q=oe?[{label:"Open",onClick:()=>K.current(oe)}]:void 0;if(G.state==="error"){O.current({kind:"error",title:`${G.title} did not finish`,detail:G.subtitle,actions:q});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:q});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:q});continue}if(G.state!=="error"&&_.current&&G.kind!=="presenter"&&G.kind!=="scene")continue;const se=G.href,We=se?{label:"View",onClick:()=>K.current(se)}:void 0;if(G.state==="error"){const Ze=_.current&&(G.kind==="generation"||G.kind==="edit");O.current({kind:"error",title:`${G.title} failed`,detail:G.subtitle,action:We,quiet:Ze});continue}if(G.kind==="presenter"||G.kind==="scene"){const Ze=G.id.startsWith("build:")?((Pe=fe.find(q=>`build:${q.id}`===G.id))==null?void 0:Pe.assetId)??null:null,oe=xr(y.current);O.current({kind:"success",title:`${G.title} is ready`,detail:G.subtitle,actions:se?[{label:G.kind==="presenter"?"View presenter":"View scene",onClick:()=>K.current(se)},{label:"Use in a shot",onClick:()=>K.current(`${oe}?${G.kind==="presenter"?"presenter":"scene"}=${Ze}&compose=1`)}]: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 ne=null,fe=!0,re=0;const ee=async he=>{if(!fe||he!==re||(document.hidden||await z(),!fe||he!==re))return;const Me=!document.hidden&&L.current>0;ne=setTimeout(()=>void ee(he),Me?fq:hq)},Q=()=>{ne&&clearTimeout(ne),ne=null,re+=1,document.hidden||ee(re)};return V.current=Q,ee(re),document.addEventListener("visibilitychange",Q),window.addEventListener("focus",Q),()=>{fe=!1,V.current=null,ne&&clearTimeout(ne),document.removeEventListener("visibilitychange",Q),window.removeEventListener("focus",Q)}},[z]);const X=s.useCallback(()=>{var ne;return(ne=V.current)==null?void 0:ne.call(V)},[]),Z=s.useCallback(()=>{const ne=new Date().toISOString();E(ne),cq(u,ne)},[u]),J=s.useCallback(()=>{S([]),b5(u,[]),Z()},[u,Z]),me=s.useMemo(()=>({tasks:f,running:f.filter(ne=>ne.state==="running").length,builds:p,studio:g,feed:k,unread:lq(k,C),markSeen:Z,clearFeed:J,panelOpen:A,setPanelOpen:P,poke:X}),[f,p,g,k,C,Z,J,A,X]);return o.jsx(tM.Provider,{value:me,children:n})}const nM=["primary","mark","wordmark","monochrome","alternate"],bw=["light","dark","any"],vh={primary:"Primary logo",mark:"Mark",wordmark:"Wordmark",monochrome:"Monochrome",alternate:"Alternate"},mq=/^[a-f0-9]{32}$/,gq=e=>{const t=String(e??"");if(!t.startsWith("asset:"))return null;const n=t.slice(6);return mq.test(n)?n:null},vq=e=>nM.includes(e)?e:"primary",wq=e=>bw.includes(e)?e:"any";function Kf(e){return(Array.isArray(e==null?void 0:e.logos)?e.logos:[]).filter(n=>n&&String(n.file??"").trim()).map(n=>{const r=gq(n.file),a=String(n.clearSpace??"").trim();return{hash:r,file:String(n.file),role:vq(n.role),background:wq(n.background),...a?{clearSpace:a}:{},attachable:r!==null}})}function Gf(e){return Kf(e).filter(t=>t.attachable)}function $m(e){return e.find(t=>t.role==="primary")??e[0]??null}function yq(e){return $m(Kf(e))}function bq(e){const t=Kf(e);return t.find(n=>n.role==="mark")??$m(t)}function xq(e){const t=Kf(e).filter(a=>a.hash),n=t.find(a=>a.role==="mark");if(n)return{mark:n,square:!0};const r=$m(t);return!r||r.role==="wordmark"?null:{mark:r,square:!1}}const kq=1.6,Sq=(e,t)=>t>0&&e/t<=kq;function Eq(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 Cq=e=>e.length>0&&e.every(t=>t>=200);function Tm(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 xw(e){const{brand:t}=un(),{pathname:n}=Un(),r=!!mn(ht.brand),a=!!mn({path:ht.hub,end:!1}),i=!!mn({path:ht.set,end:!1}),l=a||i,u=!!mn({path:ht.products,end:!1}),f=!!mn({path:ht.scenes,end:!1}),h=!!mn({path:ht.presenters,end:!1}),p=m=>m?"fill":"regular";return[{key:"home",label:"Home",icon:o.jsx(WI,{size:e,weight:p(r)}),active:r,to:No(t)},{key:"create",label:"Create",icon:o.jsx(tF,{size:e,weight:p(l)}),active:l,to:l?`${n}?compose=1`:`${xr(t)}?compose=1`},{key:"products",label:"Products",icon:o.jsx(em,{size:e,weight:p(u)}),active:u,to:_u(t)},{key:"presenters",label:"Presenters",icon:o.jsx(Qp,{size:e,weight:p(h)}),active:h,to:ni(t)},{key:"scenes",label:"Scenes",icon:o.jsx(Xp,{size:e,weight:p(f)}),active:f,to:sl(t)}]}const ya=e=>{var t,n;return((n=(t=e.json)==null?void 0:t.meta)==null?void 0:n.name)??e.slug};function jq(e){return([...e.trim()].find(n=>new RegExp("\\p{L}|\\p{N}","u").test(n))??"?").toUpperCase()}function Aq(e){const t=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!t)return"#ffffff";const[n,r,a]=[0,2,4].map(l=>Number.parseInt(t[1].slice(l,l+2),16)/255),i=l=>l<=.03928?l/12.92:((l+.055)/1.055)**2.4;return .2126*i(n)+.7152*i(r)+.0722*i(a)>.42?"#0a0a0a":"#ffffff"}const k5=new Map;function Nq(e,t){const n=e.naturalWidth,r=e.naturalHeight,a=t||Sq(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=Cq(Eq(n,r).map(([f,h])=>u.getImageData(f,h,1,1).data[3])))}catch{}return{fits:a,bleed:i}}function rM({brand:e,size:t=20,round:n=!1}){var h,p,m;const[,r]=s.useReducer(g=>g+1,0),a=xq(e.json),i=a?jm(a.mark.file,"micro"):null,l=i?k5.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:Aq(f)}},"aria-hidden":!0,children:[u?o.jsx("img",{src:u,alt:""}):jq(ya(e)),i&&!l&&o.jsx("img",{src:i,alt:"",hidden:!0,onLoad:g=>{k5.set(i,Nq(g.currentTarget,!!(a!=null&&a.square))),r()}})]})}function Mq(){const e=xw(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 Rq({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 Pq({mode:e,lead:t,running:n,unread:r,animate:a}){const i=Lq(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(Rq,{value:l?(t.percent??0)/100:0,indeterminate:!l,size:32}),t.thumb?o.jsx("img",{src:gn(t.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):o.jsx(Bg,{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(Bg,{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(Bg,{size:18})})}function Lq(e){return s.useRef(e).current}const pp=new Set;let Zu=0;const sM=e=>{Zu=requestAnimationFrame(sM);for(const t of pp)t(e/1e3)};function aM(e){pp.add(e),Zu||(Zu=requestAnimationFrame(sM))}function oM(e){pp.delete(e),!pp.size&&Zu&&(cancelAnimationFrame(Zu),Zu=0)}function $q(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 Tq(e,t,n){const r=$q(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 H0(e){const t=getComputedStyle(e),n=S5(t.getPropertyValue("--sc-fg").trim()||"#f5f5f5"),r=S5(t.getPropertyValue("--sc-raised").trim()||"#1a1a1a");return{ink:[0,1,2].map(a=>Math.round(n[a]*.22+r[a]*.78)),ground:r}}const a4=e=>(255<<24|e[2]<<16|e[1]<<8|e[0])>>>0,g8=(e,t,n)=>(.2126*e+.7152*t+.0722*n)/255,rf=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Dq(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 S5(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 mu=2,Hq=8,iM=.55,lM=Math.PI*2,Oq=e=>e<0?0:e>1?1:e,cM=e=>e-Math.floor(e),kw=e=>{const t=Oq(e);return t*t*(3-2*t)},mp=(e,t,n)=>kw((e-t)/(n-t)),Sw=(e,t)=>4*(.35*e+.8*t)/lM;function Iq(e){const t=Math.min(1,Math.max(.3,e/240));return{short:e*t,gain:1+(1-t)*.6}}function uM(e,t){const n=Math.max(4,Math.round(e/mu)),r=Math.max(4,Math.round(t/mu)),a=n*mu,i=r*mu,{short:l,gain:u}=Iq(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)*mu-a/2)/l,b=-((m+.5)*mu-i/2)/l,k=Math.hypot(y,b);f[g]=u*iM*kw(k**1.2),h[g]=1/Math.max(k,1e-6)**1.2,p[g]=6*Math.atan2(b,y)/lM}return{w:n,h:r,shape:f,curl:h,arm:p,thr:Tq(Hq,n,r)}}const Fq=.6,_q=(e,t)=>t===null?1:kw((e-t)/Fq);function o4(e,t,n,r){const a=e.getContext("2d"),i=a4(t.ink);let l=null,u=null,f=new Uint32Array(0);return{size(h,p){a&&(l=uM(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=_q(h,r),m=Sw(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 dM(e,t,n,r,a){const i=e.getContext("2d"),{w:l,h:u,shape:f,curl:h,arm:p,thr:m}=uM(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,C=g8(...n.ink)>g8(...n.ground),E=new Float32Array(l*u),A=new Float32Array(l*u);for(let L=0;L<E.length;L++){const H=L*4,D=g8(S[H],S[H+1],S[H+2]);E[L]=iM*(C?D:1-D);const B=E[L]>m[L]?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[L]=(1-V+m[L])/2}const P=zq(A),T=a4(n.ink),M=a4(n.ground),j=i.createImageData(l,u),R=new Uint32Array(j.data.buffer);return(L,H,D)=>{for(let B=0;B<R.length;B++){if(P[B]<H){R[B]=0;continue}const V=f[B]*cM(h[B]+p[B]+D);R[B]=V+(E[B]-V)*L>m[B]?T:M}i.putImageData(j,0,0)}}const gp=900;function Vq(e,t,n,r,a,i,l){const u=dM(e,t,n,a,i),f=gp/1e3;return{ms:gp,draw(h){const p=Math.min(h,.6);u==null||u(mp(h,0,.6),mp(h,.35,1),Sw(l+f*(p-p*p/1.2),r))}}}function Zq(e,t,n,r,a,i,l){const u=dM(e,t,n,a,i),f=gp/1e3;return{ms:gp,draw(h){const p=Math.max(0,h-.4);u==null||u(1-mp(h,.4,1),1-mp(h,0,.65),Sw(l+f-f*(.36-p*p)/1.2,r))}}}function zq(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 Bq=4;let Fi=null;function Uq(e,t){var l;const n=performance.now()/1e3,r=Fi&&Date.now()-Fi.epoch<2500?Fi:null;if(e)return r||(Fi={perf:n,epoch:Date.now()}),((l=r??Fi)==null?void 0:l.perf)??n;if(!t)return null;const a=Za(t);if(Number.isNaN(a))return null;const i=(Date.now()-a)/1e3;return i>Bq?null:Fi&&Math.abs(a-Fi.epoch)<2500?Fi.perf:n-Math.max(0,i)}const wh=new Map;function Ca({index:e=0,appear:t,since:n,from:r}){const a=s.useRef(null),i=s.useRef(null),[l]=s.useState(()=>Uq(t,n)),[u]=s.useState(r),[f,h]=s.useState(()=>!!u&&!rf());return s.useLayoutEffect(()=>{const p=a.current;if(!(p!=null&&p.getContext("2d")))return;const m=rf(),g=i.current,w=u&&(g!=null&&g.complete)&&g.naturalWidth?u:null,y=m||w?null:l;let b=o4(p,H0(p),e,y),k=!0;const S=()=>{const L=p.getBoundingClientRect();L.width<2||L.height<2||(b.size(L.width,L.height),b.draw(performance.now()/1e3))};let C=null,E=0,A=0;const P=()=>{C=null,g&&(g.style.visibility="hidden"),h(!1),S()};if(w&&g){const L=p.getBoundingClientRect(),H=performance.now();for(const[B,V]of wh)H-V>1e4&&wh.delete(B);const D=wh.get(w.at)??H;wh.set(w.at,D),C=Zq(p,g,H0(p),e,L.width,L.height,D/1e3),E=H-D,A=H,E<C.ms?C.draw(E/C.ms):P()}else g?P():S();const T=L=>{if(C){const H=L*1e3;E+=Math.min(50,Math.max(0,H-A)),A=H,E<C.ms?C.draw(E/C.ms):P()}else k&&b.draw(L)},M=new ResizeObserver(()=>{C||S()});M.observe(p);const j=new IntersectionObserver(([L])=>{k=L.isIntersecting});j.observe(p);const R=Dq(()=>{b=o4(p,H0(p),e,y),C||S()});return m||aM(T),()=>{oM(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 E5({onClose:e,onSeen:t,onOpenDetail:n}){const{tasks:r,feed:a,unread:i,clearFeed:l}=ea(),u=r.filter(S=>S.state==="running"),{brand:f}=un(),{push:h}=rr(),p=Gq(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 C;S.detail===0&&((C=g.current)==null||C.focus({preventScroll:!0})),t()},k=S=>{if(S.startsWith("node:")){Ne.cancelNode(S.slice(5)).catch(C=>h(cn(C,"Could not cancel this shot")));return}if(S.startsWith("build:")){Ne.cancelAssetBuild(f.id,S.slice(6)).catch(C=>h(cn(C,"Could not stop this build")));return}if(S.startsWith("scene:")){Ne.cancelSceneStudioJob(f.id,S.slice(6)).catch(C=>h(cn(C,"Could not stop this scene")));return}if(S.startsWith("presenter:")){const C=S.split(":")[1]??"";Ne.stopDraft(f.id,C).catch(E=>h(cn(E,"Could not stop this presenter")));return}S.startsWith("catalog:")&&Ne.cancelCatalogJob(f.id,S.slice(8)).catch(C=>h(cn(C,"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(Wq,{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(Kq,{item:S,now:p,onNavigate:e,onSeen:t},S.id))})]})]})}function fM({task:e}){return e.thumb?o.jsx("img",{src:gn(e.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):e.state==="running"?e.kind==="catalog"?o.jsx("span",{className:"sc-placeholder"}):o.jsx(Ca,{}):e.state==="error"?o.jsx(Pc,{size:17,weight:"fill"}):e.state==="cancelled"?o.jsx(lF,{size:17,color:"var(--sc-fg3)"}):e.kind==="catalog"?o.jsx(IE,{size:17}):e.kind==="presenter"?o.jsx(Qp,{size:17}):e.kind==="scene"?o.jsx(Xp,{size:17}):o.jsx(Na,{size:17})}function Wq({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(fM,{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?Sc(e.startedAt,t):KN(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 Kq({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(fM,{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:KN(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 Gq(e){const[t,n]=s.useState(()=>Date.now());return s.useEffect(()=>{const r=setInterval(()=>n(Date.now()),e);return()=>clearInterval(r)},[e]),t}function yd(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 hM({label:e,onClose:t,children:n}){const{sheet:r,grip:a}=yd(t);return s.useEffect(()=>{const i=l=>{l.key==="Escape"&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]),zr.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 pM(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 Yq=new Set(["Shift","Control","Alt","AltGraph","Meta","CapsLock","Fn","FnLock","Hyper","Super","OS"]);let vp=null;function C5(e){vp!==e&&(vp=e,document.documentElement.dataset.input=e)}function qq(){const e=n=>{n.isComposing||n.key==="Unidentified"||Yq.has(n.key)||C5("keyboard")},t=()=>C5("pointer");return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",t,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",t,!0)}}function Xq(){return vp}function Dm(e){return vp!=="pointer"&&e.matches(":focus-visible")}function dr({label:e,open:t,children:n}){return o.jsx(uw,{content:e,className:"sc-tip",maxWidth:"220px",...t?{open:!0}:{},children:gM(n)})}function mM(e,t,n){return n?t:o.jsx(dr,{label:e,children:t})}function gM(e){const t=e.props.onFocus;return s.cloneElement(e,{onFocus:n=>{t==null||t(n),Xq()==="pointer"&&n.preventDefault()}})}function Fs({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}=yd(i);s.useEffect(()=>{e&&window.dispatchEvent(new CustomEvent("scenri:modal-open"))},[e]);const g=l??xN,w=u;return o.jsx(yl,{open:e,onOpenChange:y=>!y&&i(),children:o.jsxs(bl,{children:[o.jsx(xl,{className:"sc-newdlg-scrim","data-tone":h}),o.jsx(kl,{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 ks({className:e,children:t}){return o.jsx(Sl,{className:e,children:t})}const Ss=s.forwardRef(function({children:t,...n},r){return o.jsx(Nf,{asChild:!0,ref:r,...n,children:t})});function Ec({className:e,asChild:t,children:n}){return o.jsx(Ev,{className:e,asChild:t,children:n})}const j5=300,Qq={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 i4({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 Ne.catalogJob(e,t);if(m)return;a(y),y.finishedAt||(g=setTimeout(w,j5))}catch{m||(g=setTimeout(w,j5*3))}};return w(),()=>{m=!0,g&&clearTimeout(g)}},[e,t]);const u=!!r&&!r.finishedAt,f=r?GN(r):0,h=(r==null?void 0:r.errors)??[],p=async()=>{l(!0);try{await Ne.cancelCatalogJob(e,t)}catch{l(!1)}};return o.jsxs(Fs,{open:!0,className:"sc-imp",maxWidth:"440px",described:!0,onDismiss:n,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ks,{className:"sc-newdlg-title",children:"Importing products"}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})})]}),o.jsx(Ec,{className:"sc-imp-sub",children:o.jsxs("span",{role:"status",children:[r?Qq[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 ta="(max-width: 767px)";function jr(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 A5=new Map;function Jq(e){let t=A5.get(e);if(!t){const n=window.matchMedia(e);t={mq:n,subscribe:r=>(n.addEventListener("change",r),()=>n.removeEventListener("change",r))},A5.set(e,t)}return t}function Ew(){const e=Jq("(hover: none)");return s.useSyncExternalStore(e.subscribe,()=>e.mq.matches,()=>!1)}function eX(){const{tasks:e,running:t,unread:n,panelOpen:r,setPanelOpen:a,markSeen:i}=ea(),{brand:l}=un(),u=jr(ta),f=tX(),[h,p]=s.useState(null);s.useEffect(()=>p(null),[l.id]),pM(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, ${Sc(m.startedAt,Date.now())}`:"Activity",b=o.jsx(Pq,{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(hM,{label:"Activity",onClose:()=>a(!1),children:o.jsx(E5,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})}):null,h?o.jsx(i4,{brandId:l.id,jobId:h,onDismiss:()=>p(null)}):null]}):o.jsxs(o.Fragment,{children:[o.jsxs(nd,{open:r,onOpenChange:a,children:[o.jsx(dr,{label:y,children:o.jsx(rd,{children:o.jsx("button",{type:"button",className:"sc-act-btn sc-notif-btn","data-mode":g,"aria-label":w,children:b})})}),o.jsx(sd,{align:"end",sideOffset:20,className:"sc-notif-pop","aria-label":"Activity",children:o.jsx(E5,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})})]}),h?o.jsx(i4,{brandId:l.id,jobId:h,onDismiss:()=>p(null)}):null]})}function tX(){const[e,t]=s.useState(!1),n=s.useRef(!1);return s.useEffect(()=>{n.current||(n.current=!0,t(!0))},[]),e}function nX(){const e=xw(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 l4=s.createContext(null);function vM({label:e,className:t,offset:n=22,trigger:r,children:a}){const i=jr(ta),[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 pM(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(hM,{label:e,onClose:h,children:o.jsxs("div",{className:"sc-menu-sheet",children:[o.jsx("div",{className:"sc-menu-head",children:e}),o.jsx(l4.Provider,{value:{close:h,focusTrigger:p},children:a})]})})]}):o.jsxs(ys,{open:l,onOpenChange:u,modal:!1,children:[o.jsx(bs,{children:s.cloneElement(r,{ref:f})}),o.jsxs(xs,{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(l4.Provider,{value:{close:null,focusTrigger:p},children:a})]})]})}function zu({className:e="sc-menu-item",to:t,onSelect:n,disabled:r,children:a,...i}){const l=s.useContext(l4),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(Xn,{asChild:!0,className:e,...i,children:o.jsx(Zn,{to:t,children:a})}):o.jsx(Xn,{className:e,onSelect:f,disabled:r,...i,children:a})}function wM(e,t){return[...e].sort((n,r)=>t(n).localeCompare(t(r),void 0,{sensitivity:"base"})||n.slug.localeCompare(r.slug))}function rX(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 wM(a,n)}function Qn({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(Df,{open:l,onOpenChange:w=>{w&&(h.current=!1),u==null||u(w)},children:[l===void 0&&o.jsx(FA,{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(Hf,{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(Of,{children:t}),o.jsx(If,{size:"2",children:n}),o.jsxs(Ts,{gap:"3",mt:"4",justify:"end",children:[o.jsx(_f,{children:o.jsx(va,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Ff,{children:o.jsx(va,{color:"red",onClick:p,disabled:r,children:e})})]})]})]})}function sX(){const{brand:e}=un(),t=Ml(),n=Bn(),r=Mm(),{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(vM,{label:"Brands",className:"sc-menu-brand",trigger:o.jsx("button",{type:"button",className:"sc-org-btn","aria-label":`${ya(e)}, brand and settings`,children:o.jsx(rM,{brand:e,size:32,round:!0})}),children:[o.jsx(oX,{}),o.jsx("div",{className:"sc-menu-rule"}),o.jsxs(zu,{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(zu,{onSelect:()=>t(),children:[o.jsx(VI,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Settings"})]}),r.thisComputer&&o.jsxs(zu,{"data-quit":"",onSelect:()=>l(!0),children:[o.jsx(nF,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Shut down Scenri"})]})]}),o.jsx(Qn,{open:i,onOpenChange:l,label:"Shut down Scenri",title:"Shut down Scenri?",body:"This stops the Scenri server on this machine. Every open tab loses the studio until you start it again, from your desktop icon or with npx scenri.",busy:r.busy!=="idle",onConfirm:()=>void u()})]})}const aX=7;function oX(){const{brands:e}=Dn(),{brand:t}=un(),n=Bn(),[r,a]=s.useState(""),i=g=>ya(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>=aX,f=r.trim(),h=u&&f?rX(e,f,ya):[],p=g=>{const w=g.id===t.id,y=(l.get(i(g))??0)>1;return o.jsxs(zu,{"data-current":w||void 0,"data-two-line":y||void 0,onSelect:w?void 0:()=>n(No(g)),children:[o.jsx(rM,{brand:g,size:20,round:!0}),o.jsxs("span",{className:"sc-menu-brand-lb",children:[o.jsx("span",{dir:"auto",children:ya(g)}),y&&o.jsxs("span",{className:"sc-menu-brand-sub",children:["/",g.slug]})]}),w&&o.jsxs(o.Fragment,{children:[o.jsx(Gn,{size:14,className:"sc-menu-check","aria-hidden":"true"}),o.jsx("span",{className:"sc-vh",children:", current brand"})]})]},g.id)},m=wM(e.filter(g=>g.id!==t.id),ya);return u?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"sc-menu-find",children:[o.jsx(Ju,{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(No(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 iX(){const e=jr("(min-width: 1024px)"),t=bN(),[n]=gl();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 hi(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 Cw(e){const t=qr(e.avatar);if(t)return{src:t};const n=a=>{var i;return Array.isArray(a)?qr((i=a[0])==null?void 0:i.file):null},r=qr(e.preview)??n(e.shots)??n(e.sourceRefs);return r?{src:r,crop:"top"}:{src:null}}const yM=["hero","close","hands","angle","bold"],c4=e=>Array.isArray(e)?e.map(t=>qr(t==null?void 0:t.file)).filter(t=>!!t):[],jw=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 sf(e){return e.length<2?[...e]:e.slice().reverse()}function bM(e){const t=e.filter(n=>n.origin!=="catalog");return t.length===e.length?sf(e):[...sf(t),...e.filter(n=>n.origin==="catalog")]}function Yf(e){return sf(jw(e).filter(t=>!t.supersededBy).map(xM))}function lX(e,t){const n=jw(e).find(r=>r.id===t);return n?xM(n):void 0}function Aw(e,t){var i;const n=jw(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 xM(e){var a;const t=c4(e.shots),n=c4(e.sourceRefs),r=qr(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:qr(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 _c(e){var n;const t=((n=e==null?void 0:e.json)==null?void 0:n.scenes)??[];return sf(t.map(uX))}function af(e,t){return _c(e).find(n=>n.id===t)}const cX=["place",...yM];function uX(e){var l;const t=c4(e.refs),n=qr(e.preview)??null,r=Array.isArray(e.examples)?e.examples.filter(u=>yM.includes(u==null?void 0:u.role)&&qr(u==null?void 0:u.file)).map(u=>({role:u.role,url:qr(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=cX.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 dX(e){const t=e.cover;return!t||t==="place"?"place":!e.examples||e.examples.some(n=>n.role===t&&!n.earlier)?t:"place"}function wp(e,t){const n=new Set(e.map(r=>r.id));return[...e,...t.filter(r=>!n.has(r.id))]}function u4(e,t){return t.map(n=>n.t==="character"&&n.id?{...n,id:Aw(e,n.id)}:n)}function kM(){const{brand:e,products:t}=un(),{scenes:n,presenters:r,demoProducts:a,showcase:i}=Dn();return s.useMemo(()=>{const l={presenters:Yf(e),scenes:_c(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 Tn(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 qr((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??hi(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??hi(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 fX=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:em},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:Qp},{kind:"scene",label:"Scene",line:"Where it takes place",noun:"scene",icon:Xp}],N5=(e,t)=>e===0?"None yet":`${e} ${t}${e===1?"":"s"}`;function hX({suggest:e,onPick:t}){const n=s.useRef(null),{close:r}=Er("new"),a=kM(),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(Fs,{className:"sc-newpick",maxWidth:"620px",onDismiss:r,onOpenAutoFocus:l=>{l.preventDefault(),i()},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ks,{className:"sc-newdlg-title",children:"Add to this brand"}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{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:fX.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}. ${N5(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:N5(g,h)})]},l)})})})]})}const Bu=14,pX=768,pi=[{px:190,label:"Compact",cells:3,cols:6,min:200},{px:320,label:"Large",cells:2,cols:5,min:280}];function mX(e){let t=pi[0];for(const n of pi)Math.abs(n.px-e)<Math.abs(t.px-e)&&(t=n);return t}const SM=320;function EM(e){const t=typeof e=="number"&&Number.isFinite(e)?e:SM;let n=pi[0].px;for(const r of pi)Math.abs(r.px-t)<Math.abs(n-t)&&(n=r.px);return n}const ad=5;function Vc(e){const t=typeof e=="number"?e:ad;return t===7||t===5?t:t===6?5:ad}const gX={5:8,7:14};function vX(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 wX(){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 v8(e,t){return Math.max(1,Math.floor((e-Bu*(t-1))/t))}function yX(e,t,n){if(e<=0)return{tile:t,cols:1};if(n)return{tile:Math.floor((e-Bu)/2),cols:2};const r=pi[1],a=pi[0],i=Math.min(r.cols,Math.max(1,Math.floor((e+Bu)/(r.min+Bu))));if(mX(t).px===r.px)return{tile:v8(e,i),cols:i};let l=Math.min(a.cols,i+1);return l>1&&v8(e,l)<a.min&&(l=i),{tile:v8(e,l),cols:l}}function M5(e){return Math.max(1,e)}function Hm(e){return Vc(e)===5?"large":"compact"}const qf=s.createContext("large");function CM(){return s.useContext(qf)}const bX=[{value:7,label:"Compact",hint:"More cards per row",cells:3},{value:5,label:"Large",hint:"Fewer, larger cards",cells:2}],xX=pi.map(e=>({value:e.px,label:e.label,hint:e.label==="Compact"?"More shots per row":"Fewer, larger shots",cells:e.cells}));function Om({value:e,onChange:t}){return o.jsx(jM,{label:"Grid size",value:Vc(e),options:bX,onChange:n=>t(n)})}function kX({value:e,onChange:t}){return o.jsx(jM,{label:"Shot size",value:EM(e),options:xX,onChange:t})}function jM({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(SX,{cells:i.cells})},i.value)})]})}function SX({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 Im(e){const t=Vc(e),n=(t===5?pi[1]:pi[0]).min;return{"--sc-wall-cols":String(t),"--sc-tile-min":`${n}px`}}function Uu({name:e}){const t={size:14,"aria-hidden":!0};switch(e){case"open":return o.jsx(nE,{...t});case"continue":return o.jsx(ma,{...t});case"open-tab":return o.jsx(mc,{...t});case"refine":return o.jsx(hE,{...t});case"select":return o.jsx(Gn,{...t,weight:"bold"});case"keep":return o.jsx(Ga,{...t});case"kept":return o.jsx(Ga,{...t,weight:"fill"});case"unset":return o.jsx(eE,{...t});case"versions":return o.jsx(DE,{...t});case"archive":return o.jsx(qp,{...t});case"restore":return o.jsx(U0,{...t});case"delete":case"discard":return o.jsx(wl,{...t});case"use":return o.jsx(mr,{...t});case"duplicate":return o.jsx(ep,{...t});case"rename":return o.jsx(eF,{...t});case"edit":return o.jsx(fd,{...t});case"cover":return o.jsx(KI,{...t})}}const AM=new Set;function NM(e){return AM.has(e)}function MM(e){e&&AM.add(e)}function ba({src:e,srcSet:t,sizes:n=lN.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(()=>{MM(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(Na,{size:20})});const w=NM(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 Nw(){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(Na,{size:20})})})})}function Mw({node:e,to:t}){return o.jsx(Zn,{className:"sc-lookcard","aria-label":`Open ${Tr(e)}`,to:t,children:o.jsx(ba,{src:gn(e.images[0],"tile"),blank:"sc-lookcard-blank"})})}function Wu({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(Aa,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-slider-arrow next","aria-label":"Next",onClick:()=>l(1),children:o.jsx(vl,{size:13,weight:"bold"})}),o.jsxs("div",{className:"sc-slider-track",ref:r,children:[t,t]})]})]})}function R5(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(Uu,{name:r.icon}),r.label]})]},r.key))}function EX({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:C,batching:E,onPick:A}){const[P,T]=s.useState(!1),M=s.useRef(null),j=Ew(),R=CM(),L=(J,me)=>mM(J,me,j),H=u==="use"&&!!f&&!!h&&!E,D=b??[],B=D.find(J=>J.key==="delete"),V=D.length>0,W=J=>{J.preventDefault(),J.stopPropagation(),A==null||A(e)};s.useEffect(()=>{if(!P)return;const J=me=>{var ne;(ne=M.current)!=null&&ne.contains(me.target)||T(!1)};return document.addEventListener("pointerdown",J),()=>document.removeEventListener("pointerdown",J)},[P]);const K=t?o.jsx(ba,{src:Tn(t,"tile"),srcSet:cc(t),sizes:lN[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(Na,{size:20})}),F=J=>{J.preventDefault(),J.stopPropagation()},_=V?o.jsxs(ys,{children:[L("More",o.jsx(bs,{children:o.jsxs("button",{type:"button",className:"sc-cell-ctl sc-lookcard-more","aria-label":`More for ${a}`,onClick:J=>J.stopPropagation(),onContextMenu:J=>J.stopPropagation(),children:[o.jsx(dv,{className:"sc-lookcard-more-vert",size:16,weight:"bold"}),o.jsx(uv,{className:"sc-lookcard-more-horiz",size:16,weight:"bold"})]})})),o.jsx(xs,{side:"top",align:"end",sideOffset:4,collisionPadding:12,children:R5(D,Xn,dc)})]}):null,O=_||B||y?o.jsxs("div",{className:"sc-corner",children:[_,B&&L(B.label,o.jsx("button",{type:"button",className:"sc-cell-ctl sc-lookcard-remove sc-cell-danger","aria-label":B.label,onClick:J=>{F(J),B.onSelect()},children:o.jsx(wl,{size:15})})),y&&L(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:J=>{F(J),y(e)},children:o.jsx(Ga,{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:[K,o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0}),o.jsx("span",{className:"sc-lookcard-tick","aria-hidden":!0,children:o.jsx(Gn,{size:11,weight:"bold"})})]}),Y]});const z=()=>{if(E&&A){A(e);return}if(H&&j){if(!P){T(!0);return}T(!1)}f?f(e):h==null||h(e)},X=()=>{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":P||void 0,"data-just-added":k||void 0,"data-picked":C||void 0,"data-batching":E||void 0,children:[o.jsxs("div",{className:"sc-lookcard-media",children:[p?o.jsxs(Zn,{className:"sc-lookcard-open",to:p,"aria-label":E?`${C?"Deselect":"Select"} ${a}`:r,onClick:J=>{if(E&&A){W(J);return}if(H&&j){if(!P){J.preventDefault(),T(!0);return}T(!1)}},children:[K,!E&&o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0})]}):o.jsxs("button",{type:"button",className:"sc-lookcard-open",onClick:z,"aria-label":E?`${C?"Deselect":"Select"} ${a}`:r,children:[K,!E&&o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0})]}),H&&o.jsx("button",{type:"button",className:"sc-lookcard-use",onClick:X,children:l}),A&&L(C?"Deselect":"Select",o.jsx("button",{type:"button",className:"sc-cell-ctl sc-lookcard-pick","data-on":C||void 0,"aria-pressed":!!C,"aria-label":C?`Deselect ${a}`:`Select ${a}`,onClick:W,children:o.jsx(Gn,{size:13,weight:"bold"})}))]}),O,Y]});return D.length===0||j?Z:o.jsxs(Zf,{children:[o.jsx(zf,{children:Z}),o.jsx(Bf,{children:R5(D,Uf,Cm)})]})}function Fm({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 bd=s.memo(EX),CX=/^(p|product|products|item|items|dp|sku)$/i;function jX(e){let t="";try{const r=new URL(e).pathname.split("/").filter(Boolean);t=[...r].reverse().find(a=>!CX.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 AX(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 w8=24,NX=12;function RM({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(w8),[y,b]=s.useState(()=>{const Z=new Map;for(const J of t.cards??[])J.url&&Z.set(J.url,{externalKey:J.externalKey,title:J.title,url:J.url,images:J.image?[{url:J.image}]:[]});for(const J of t.candidates)J.url&&Z.set(J.url,J);return Z}),k=s.useRef(new Set),S=s.useRef(y),C=s.useRef(!0),[E,A]=s.useState(0);s.useEffect(()=>(C.current=!0,()=>{C.current=!1}),[]);const[P,T]=s.useState(null),M=s.useRef(null),j=s.useMemo(()=>u.map(Z=>({url:Z,name:jX(Z)})),[u]),R=s.useMemo(()=>j.filter(Z=>AX(Z.name,f)),[j,f]),L=s.useMemo(()=>R.slice(0,g),[R,g]);s.useEffect(()=>w(w8),[f]);const H=s.useRef([]),D=s.useRef(0),B=s.useRef(()=>{}),V=2,W=120,K=s.useCallback(()=>{for(;D.current<V&&H.current.length;){const Z=H.current.splice(Math.max(0,H.current.length-NX));if(!Z.length)return;D.current++,A(D.current),Ne.catalogDetails(e,Z).then(({products:J})=>{if(!C.current)return;const me=new Map(S.current);for(const ne of J)ne.url&&me.set(ne.url,ne);for(let ne=0;ne<J.length&&ne<Z.length;ne++)me.has(Z[ne])||me.set(Z[ne],J[ne]);S.current=me,b(me)}).catch(()=>{for(const J of Z)k.current.delete(J)}).finally(()=>{D.current=Math.max(0,D.current-1),C.current&&(A(D.current),B.current())})}},[e]);B.current=K,s.useEffect(()=>{const Z=M.current;if(!Z)return;const J=new IntersectionObserver(me=>{let ne=!1;for(const fe of me){if(!fe.isIntersecting)continue;const re=fe.target.dataset.fbId;if(J.unobserve(fe.target),!(!re||S.current.has(re)||k.current.has(re))){for(k.current.add(re),H.current.push(re);H.current.length>W;){const ee=H.current.shift();ee&&k.current.delete(ee)}ne=!0}}ne&&B.current()},{root:Z,rootMargin:"250% 0px"});for(const me of Z.querySelectorAll("[data-fb-id]"))J.observe(me);return()=>J.disconnect()},[g,f]),s.useEffect(()=>{if(!P||g>=R.length)return;const Z=P.closest(".sc-wizpick-grid"),J=new IntersectionObserver(me=>{me.some(ne=>ne.isIntersecting)&&w(ne=>ne+w8)},{root:Z,rootMargin:"0px 0px 300% 0px"});return J.observe(P),()=>J.disconnect()},[P,g,R.length]);const F=s.useCallback(Z=>{m(J=>{const me=new Set(J);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 J=new Set(Z);for(const me of R)_?J.delete(me.url):J.add(me.url);return J})},z=p.size,X=z===1?"1 product":`${z.toLocaleString()} products`;return o.jsxs(Fs,{open:!0,className:"sc-wizpick",maxWidth:"760px",described:!0,onDismiss:l,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ks,{className:"sc-newdlg-title",children:"Products on your site"}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})})]}),o.jsx(Ec,{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(Ju,{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:[L.map(Z=>{var me,ne;const J=y.get(Z.url);return o.jsx(bd,{id:Z.url,previewUrl:((ne=(me=J==null?void 0:J.images)==null?void 0:me[0])==null?void 0:ne.url)??null,pending:!J,title:(J==null?void 0:J.title)??Z.name,primary:(J==null?void 0:J.title)??Z.name,secondary:(J==null?void 0:J.price)!=null?`${J.currency??""} ${J.price}`.trim():(J==null?void 0:J.category)??"",useLabel:"Import",variant:"select",selected:p.has(Z.url),onToggle:F,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}):E>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&&E>0,onClick:()=>O?i():a([...p]),children:n?"Importing":`Import ${X}`})]})]})}const y8=700,MX=45e3,RX=3e3;function PM(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 C=(A,P)=>{r(A),h(P),i(!1),u(!0)};return(async()=>{try{const{scanId:A}=await Ne.catalogScan(e,t);if(S=A,b||!g.current){Ne.cancelCatalogScan(e,A).catch(()=>{});return}const P=Date.now()+MX,T=async()=>{if(!(b||!g.current)){if(Date.now()>P){C(null,{kind:"timeout"});return}try{const M=await Ne.catalogScanState(e,A,AbortSignal.timeout(RX));if(b||!g.current)return;if(M.status==="running"){k=setTimeout(T,y8);return}M.result?C(M.result,null):C(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){C(null,{kind:"error",reason:"The look for a shop was interrupted."});return}k=setTimeout(T,y8)}}};k=setTimeout(T,y8)}catch{b||C(null,{kind:"error",reason:"The look for a shop could not start."})}})(),()=>{b=!0,k&&clearTimeout(k),S&&Ne.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 of=[{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"}]}],Rw=new Map(of.map(e=>[e.key,e]));Rw.get("other");function lf(e){var t;return e?((t=Rw.get(e))==null?void 0:t.label)??e:null}function PX(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 Pw(e){return e.category&&Rw.has(e.category)?e.category:PX(e.productType,e.tags)??null}function LX({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}=Er("new");return o.jsxs(Fs,{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(Aa,{size:15})}),o.jsx(ks,{className:"sc-newdlg-title",children:e}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{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(Rr,{size:"1"}):null,a]}),r&&o.jsx("p",{className:"sc-dlg-foot",children:r})]})]})}function LM({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 P5({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}=LM({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(Rr,{}):f,o.jsx("span",{className:"sc-dropzone-label",children:e}),t&&o.jsx("small",{children:t})]})}function $M({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(P5,{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:gn(h,"micro"),alt:`Reference ${p+1}`,loading:"lazy",decoding:"async"}),o.jsx("button",{type:"button",className:"sc-assetform-drop","aria-label":`Remove reference ${p+1}`,onClick:()=>l(h),children:o.jsx(Rn,{size:11,weight:"bold"})})]},h)),f>0&&o.jsx(P5,{label:`${f} more`,busy:a,onFiles:i,onReject:u,children:o.jsx(mr,{size:15})})]})}let C0=null;const TM=(e,t)=>`${e}:${t}`;function $X(e,t,n){C0={key:TM(e,t),fields:n}}function TX(e,t){if(!C0||C0.key!==TM(e,t))return null;const{fields:n}=C0;return C0=null,n}const L5={name:"",instruction:"",facets:[],imageHashes:[],importUrl:""};function DX(e,t,n){const r=n.restore??!1,[a,i]=s.useState(L5),[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 L=TX(e,t);if(L){i(L);return}}const M=NN(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))){ju(e,t);return}if(M&&!M.pending){ju(e,t);return}M&&kY(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&&f8(M)?h8(e,t,{...M,pending:m.current}):ju(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]),C=s.useCallback(()=>{var j;p.current&&clearTimeout(p.current);const M=b.current;if(m.current&&f8(M)){h8(e,t,{...M,pending:m.current});return}ju(e,t),f8(M)&&($X(e,t,M),(j=y.current)==null||j.call(y))},[e,t]);s.useEffect(()=>(window.addEventListener("beforeunload",C),()=>{window.removeEventListener("beforeunload",C),C()}),[C]);const E=s.useCallback(async M=>{u(!0),h(null);try{const j=n.max-b.current.imageHashes.length,R=[];for(const L of M.slice(0,j))R.push(await tf(L));S(L=>({imageHashes:[...new Set([...L.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]),P=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){ju(e,t),m.current=null,i(L5);return}m.current=M,i(j=>(h8(e,t,{...j,pending:M}),j))},[e,t]);return{fields:a,set:S,uploading:l,err:f,setErr:h,addFiles:E,removeHash:A,toggleFacet:P,submitted:T}}const $5=6,HX=3;function OX({onBack:e,onStarted:t,restore:n,onDiscarded:r}){var j,R;const{brand:a}=un(),{applyBrand:i}=Dn(),[l,u]=s.useState(!1),[f,h]=s.useState(!1),[p,m]=s.useState(!1),g=DX(a.id,"product",{max:$5,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:L,...H}=await Ne.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:L,name:D})}catch(L){g.setErr(String(L.message??L))}finally{u(!1)}},[k,S]=s.useState(null),{scan:C,scanning:E,settled:A}=PM(k?a.id:null,k??void 0),P=async L=>{const H=k??g.fields.importUrl.trim()??"";h(!0),g.setErr(null);try{await Ne.catalogImport(a.id,H,L),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 L=g.fields.importUrl.trim()||(((D=(H=a.json)==null?void 0:H.meta)==null?void 0:D.website)??"");L&&(g.setErr(null),S(L))};s.useEffect(()=>{!k||!A||C&&C.verdict==="found"&&C.candidates.length||P()},[C,A,k]);const M=L=>{L.key==="Enter"&&(L.preventDefault(),w&&!l&&b())};return o.jsxs(LX,{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:L=>void g.addFiles(L),children:[o.jsxs("div",{className:"sc-assetform",children:[o.jsx($M,{hashes:g.fields.imageHashes,max:$5,label:"Add packshots",hint:`Straight, well-lit packshots. The first ${HX} are the ones a shot attaches.`,busy:g.uploading,onAdd:L=>void g.addFiles(L),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:L=>g.set({name:L.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:of.map(L=>o.jsx("button",{type:"button",className:"sc-chip","data-on":g.fields.facets[0]===L.key||void 0,"aria-pressed":g.fields.facets[0]===L.key,onClick:()=>g.set({facets:g.fields.facets[0]===L.key?[]:[L.key]}),children:L.label},L.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:L=>g.set({importUrl:L.target.value}),onKeyDown:L=>{L.key==="Enter"&&T()}}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:f||E,onClick:T,children:E?"Looking…":f?"Starting…":"Import"})]})]}):o.jsx("button",{type:"button",className:"sc-newdlg-secmore",onClick:()=>m(!0),children:"Import a catalog from a store URL"})}),C&&C.verdict==="found"&&C.candidates.length>0&&o.jsx(RM,{brandId:a.id,scan:C,busy:f,onImport:L=>void P(L),onImportAll:()=>void P(),onDismiss:()=>S(null)})]})}const b8="1",IX={product:"Product",presenter:"Presenter",scene:"Scene"},FX=["product","presenter","scene"],_X=e=>!!e&&FX.includes(e),DM=s.createContext(null);function HM(){const e=s.useContext(DM);if(!e)throw new Error("useCreateAsset must be used inside AssetCreateHost");return e}function Pl(){return HM().open}function OM(){const e=!!mn({path:ht.products,end:!1}),t=!!mn({path:ht.presenters,end:!1}),n=!!mn({path:ht.scenes,end:!1});return e?"product":t?"presenter":n?"scene":null}function Lw(){const{announce:e,caps:t}=HM();return{announce:e,caps:t}}function VX({children:e}){const{brand:t}=un(),n=Bn(),r=Un(),{push:a}=rr(),{refreshBrands:i}=Dn(),{builds:l,poke:u}=ea(),f=Er("new"),h=f.value,p=OM(),m=!!mn({path:ht.presenterStudio}),g=!!mn({path:ht.presenterEdit}),w=!!mn({path:ht.sceneStudio}),y=!!mn({path:ht.sceneEdit}),[b,k]=s.useState(null),[S,C]=s.useState(!1),[E,A]=s.useState(!1),P=s.useRef(null),T=s.useRef(null),M=f.open,j=f.set,R=f.close,L=s.useCallback((Z,J)=>{if(P.current=Z==="choose"||!(J!=null&&J.onCreated)?null:{kind:Z,fn:J.onCreated},Z==="presenter"){n(ol(t));return}if(Z==="scene"){n(al(t),{state:{from:r.pathname+r.search}});return}T.current=document.activeElement instanceof HTMLElement?document.activeElement:null,C(Z==="choose"),A(!1),M(Z==="choose"?b8:Z)},[M,n,t,r.pathname,r.search]);s.useEffect(()=>{h==="presenter"&&n(ol(t),{replace:!0}),h==="scene"&&n(al(t),{replace:!0})},[h,n,t]);const H=s.useCallback(()=>{P.current=null,C(!1),R()},[R]),D=s.useCallback(Z=>{a({kind:"success",title:`${IX[Z]} discarded`,detail:"Nothing was saved.",action:{label:"Undo",onClick:()=>{A(!0),C(!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=Er("setup").value,W=Er("settings").value,K=!!V||!!W;s.useEffect(()=>{if(!B||K)return;let Z=!0,J=null;const me=ne=>Ne.assetBuildCapabilities().then(fe=>Z&&k(fe)).catch(()=>{Z&&ne&&(J=setTimeout(()=>me(!1),600))});return me(!0),()=>{Z=!1,J&&clearTimeout(J)}},[B,K]);const F=s.useCallback(Z=>{const J=l.find(me=>me.id===Z);return J?J.stage==="failed"?"failed":J.stage==="cancelled"?"cancelled":J.stage==="done"?"done":"running":"unknown"},[l]),_=s.useCallback((Z,J)=>{var re;const me=P.current;P.current=null,u();const ne=!!(J!=null&&J.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(wa(t,Z.id))},{label:"Use in a shot",onClick:()=>n(`${xr(t)}?product=${Z.id}&compose=1`)}]});return}if(Z.kind==="presenter"){if((me==null?void 0:me.kind)==="presenter"&&me.fn(Z),ne)return;a({kind:"success",title:`${Z.name} added`,actions:[{label:"Use in a shot",onClick:()=>n(`${xr(t)}?presenter=${Z.id}&compose=1`)}]});return}if(i(),(me==null?void 0:me.kind)==="scene"&&me.fn(Z),ne)return;const fe=(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:fe,actions:[{label:"Open",onClick:()=>n(Zr(t,Z.id))},{label:"Use in a shot",onClick:()=>n(`${xr(t)}?scene=${Z.id}&compose=1`)}]})},[t,n,u,a,i]),O=s.useCallback(Z=>{_(Z),H()},[H,_]),Y=s.useMemo(()=>({open:L,announce:_,caps:b}),[L,_,b]),z=_X(h)?h:null,X={onBack:S?()=>j(b8):void 0,onStarted:O,caps:b,pendingState:F,restore:E,onDiscarded:()=>z&&D(z)};return o.jsxs(DM.Provider,{value:Y,children:[e,h===b8&&o.jsx(hX,{suggest:p,onPick:Z=>{if(Z==="presenter"){n(ol(t),{replace:!0});return}if(Z==="scene"){n(al(t),{replace:!0});return}C(!0),j(Z)}}),z==="product"&&o.jsx(OX,{...X},"product")]})}const ZX=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:em},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:Qp},{kind:"scene",label:"Scene",line:"The place and its light",noun:"scene",icon:Xp}],zX={product:"New product",presenter:"New presenter",scene:"New scene"};function BX(){var f;const e=Pl(),t=OM(),n=kM(),{showcase:r}=Dn(),a=((f=r.find(h=>h.previewUrl))==null?void 0:f.previewUrl)??null,i=xw(16).find(h=>h.key==="create"),l=i?`${i.to}&attach=all`:"",u=t?zX[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(vM,{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(ul,{size:12,weight:"bold",className:"sc-new-caret","aria-hidden":"true"})}),children:[o.jsxs(zu,{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:Tn(a,"tile"),alt:"",loading:"lazy",decoding:"async"}):o.jsx("span",{className:"sc-start-glyph",children:o.jsx(y7,{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"}),ZX.map(h=>{const{url:p,count:m}=n[h.kind];return o.jsxs(zu,{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 UX=24,WX=8;function KX(){const e=jr(ta),{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<=WX:f>UX)&&(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 IM=["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"],GX=["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 YX(e){return o.jsx("svg",{viewBox:"0 0 263.79 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:[...IM,...GX].map(t=>o.jsx("path",{d:t},t))})}function qX(e){return o.jsx("svg",{viewBox:"0 0 64 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:IM.map(t=>o.jsx("path",{d:t},t))})}function XX(){const{brand:e}=un();return KX(),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:No(e),children:o.jsx(YX,{"aria-hidden":"true"})})}),o.jsx(nX,{}),o.jsxs("div",{className:"sc-topbar-end",children:[o.jsx(iX,{}),o.jsx(eX,{}),o.jsx(BX,{}),o.jsx(sX,{})]})]})}const QX=60;function JX(){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>QX?`${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 FM=s.createContext(null);function _M(){return s.useContext(FM)}function eQ({brand:e,children:t}){const n=e.id,[r,a]=s.useState({products:[],loaded:!1}),i=s.useRef(null),{tasks:l}=ea(),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 Ne.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(FM.Provider,{value:g,children:t})}function tQ({feature:e}){const{isNew:t}=Zc();return t(e)?o.jsx("span",{className:"sc-tag sc-tag-new",children:"New"}):null}function is({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 nQ={npx:"run with npx",global:"installed with npm",managed:"managed install",dev:"running from source",unknown:"local studio"};function rQ({version:e}){return o.jsxs(is,{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}`:""," · ",nQ[(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 d4({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 T5=()=>o.jsx("span",{className:"sc-setpop-tick","aria-hidden":!0,children:o.jsx(Gn,{size:12,weight:"bold"})});function qo({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 Xo=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})}),sQ=({children:e})=>o.jsx("p",{className:"sc-setpop-foot",children:e}),D5=[{id:"light",label:"Light"},{id:"dark",label:"Dark"},{id:"system",label:"System"}];function aQ(){const{choice:e,setChoice:t}=pG();return o.jsx(is,{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(qo,{label:"Theme",className:"sc-seg",value:e,ids:D5.map(n=>n.id),onChange:n=>t(n),children:D5.map(n=>o.jsx(Xo,{id:n.id,className:"sc-seg-o",on:e===n.id,label:n.label,onPick:()=>t(n.id),children:n.label},n.id))})]})})}function oQ({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(Rn,{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 iQ=["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"],H5=e=>e.trim().toLowerCase();function lQ(e){const t=new Set((e??[]).map(H5));return iQ.filter(n=>!t.has(H5(n)))}function cQ({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(oQ,{label:"Things this brand never shows",value:n,placeholder:"Or type your own",suggestions:lQ(n),max:24,onChange:r})})}function uQ(){const{brand:e}=un(),{applyBrand:t}=Dn(),{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 E=u.current;try{const A=await Ne.updateBrand(f.current.id,w(),{...p.current});t(A);for(const P of Object.keys(E))u.current[P]===E[P]?delete p.current[P]:p.current[P]=E[P];a(P=>{const T={...P};for(const M of Object.keys(E))P[M]===E[M]&&delete T[M];return T}),l(g.current?"pending":"idle")}catch(A){l("error"),n({...cn(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((E,A)=>{var M;h.current&&(clearTimeout(h.current),h.current=null);for(const j of Object.keys(E))j in p.current||(p.current[j]=((M=f.current.json)==null?void 0:M[j])??null);const P={...u.current,...E};u.current=P,a(P),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(E=>{a({}),u.current={},p.current={},t(E),l("idle")},[t]),C=e.id;return s.useEffect(()=>{a({}),u.current={},p.current={},l("idle")},[C]),s.useEffect(()=>{const E=()=>{Object.keys(u.current).length&&AG(f.current.id,w(),{...p.current}).then(A=>{A&&t(A)})};return window.addEventListener("beforeunload",E),()=>{window.removeEventListener("beforeunload",E),h.current&&clearTimeout(h.current),E()}},[w,t]),{json:w(),state:i,patch:b,flush:k,applyRow:S}}function $w(e){const t=s.useRef(e);t.current=e,s.useEffect(()=>()=>t.current(),[])}function dQ(e){return e==="saving"?"Saving…":e==="pending"?"Unsaved changes":e==="error"?"Not saved":"Saved"}function fQ({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=Kf(i),h=$m(f)??void 0,p=f.filter(b=>b!==h),m=b=>{const k={...l};for(const[S,C]of Object.entries(b)){const E=C.trim();E?k[S]=E: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(cn(S,b))}finally{a(!1)}},w=b=>void g("Could not upload that mark",async()=>{const k=await oN(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}=LM({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(hQ,{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",()=>Ne.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",()=>Ne.updateLogo(e.id,h.hash??"",{background:b.target.value})),"aria-label":"Sits on",children:bw.map(b=>o.jsx("option",{value:b,children:b==="any"?"Any background":`On ${b}`},b))})]}),o.jsx(O5,{label:"Name",value:l.name??"",placeholder:e.slug,maxLength:120,onCommit:b=>m({name:b})}),o.jsx(O5,{label:"Tagline",value:l.tagline??"",placeholder:"Add a tagline",maxLength:200,onCommit:b=>m({tagline:b})}),p.map(b=>o.jsx(pQ,{mark:b,busy:r,onRole:k=>void g("Could not retag that mark",()=>Ne.updateLogo(e.id,b.hash??"",{role:k})),onBackground:k=>void g("Could not update that mark",()=>Ne.updateLogo(e.id,b.hash??"",{background:k})),onRemove:()=>void g("Could not remove that mark",()=>Ne.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 O5({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 $w(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 hQ({mark:e,name:t,busy:n,onUpload:r}){const[a,i]=s.useState(null);if(e){const l=e.hash?$r(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(pv,{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 pQ({mark:e,busy:t,onRole:n,onBackground:r,onRemove:a}){const i=e.hash?$r(e.hash):e.file;return o.jsxs("div",{className:"sc-set-row",children:[o.jsx("span",{className:"txt",children:o.jsx("b",{children:vh[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:vh[e.role]})}),o.jsx("select",{className:"sc-in",value:e.role,disabled:t||!e.attachable,onChange:l=>n(l.target.value),"aria-label":"Mark role",children:nM.map(l=>o.jsx("option",{value:l,children:vh[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:bw.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 ${vh[e.role]}`,children:o.jsx(tm,{size:13})})]})]})}const I5={primary:"Primary",secondary:"Secondary",accent:"Accent",neutral:"Neutral"},mQ=(e,t)=>t<=1?I5[e]:`${I5[e]} ${t}`;function gQ(e){return/^(Primary|Secondary|Accent|Neutral)( [2-9]\d*)?$/.test(String(e??"").trim())}const vQ=/^#[0-9A-F]{6}$/;function cr(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 vQ.test(r)?r:null}const wQ=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;function yQ(e){const t=String(e??"").trim();return wQ.test(t)?cr(t):null}function qs(e){const t=[],n={primary:0,secondary:0,accent:0,neutral:0},r=(a,i)=>{const l=cr(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||mQ(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 Tw(e,t){const n={},r=[],a=[],i=p=>{const m=p.name.trim();return m&&!gQ(m)?{hex:p.hex,name:m}:{hex:p.hex}};for(const p of e){const m=cr(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 F5=e=>e.slot!=="neutral";function _m(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 VM(e,t){const n=cr(t);if(!n)return{palette:e,added:!1,swatch:null};const r=qs(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=Tw(i,e),u=qs(l).find(f=>f.hex===n)??null;return{palette:l,added:!0,swatch:u}}function bQ(e,t){const n=cr(t);if(!n)return{palette:e,removed:!1};const r=qs(e),a=r.filter(i=>i.hex!==n);return a.length===r.length?{palette:e,removed:!1}:{palette:Tw(a,e),removed:!0}}function Vm(){return(Vm=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 ZM(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 O0(e){var t=s.useRef(e),n=s.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var cf=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},I0=function(e){return"touches"in e},f4=function(e){return e&&e.ownerDocument.defaultView||self},_5=function(e,t,n){var r=e.getBoundingClientRect(),a=I0(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:cf((a.pageX-(r.left+f4(e).pageXOffset))/r.width),top:cf((a.pageY-(r.top+f4(e).pageYOffset))/r.height)}},V5=function(e){!I0(e)&&e.preventDefault()},zM=zn.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,a=ZM(e,["onMove","onKey","onEnd"]),i=s.useRef(null),l=O0(t),u=O0(n),f=O0(r),h=s.useRef(null),p=s.useRef(!1),m=s.useMemo(function(){var k=function(E){V5(E),(I0(E)?E.touches.length>0:E.buttons>0)&&i.current?l(_5(i.current,E,h.current)):(C(!1),f())},S=function(){C(!1),f()};function C(E){var A=p.current,P=f4(i.current),T=E?P.addEventListener:P.removeEventListener;T(A?"touchmove":"mousemove",k),T(A?"touchend":"mouseup",S)}return[function(E){var A=E.nativeEvent,P=i.current;if(P&&(V5(A),!(function(M,j){return j&&!I0(M)})(A,p.current)&&P)){if(I0(A)){p.current=!0;var T=A.changedTouches||[];T.length&&(h.current=T[0].identifier)}P.focus(),l(_5(P,A,h.current)),C(!0)}},function(E){var A=E.which||E.keyCode;A<37||A>40||(E.preventDefault(),u({left:A===39?.05:A===37?-.05:0,top:A===40?.05:A===38?-.05:0}))},function(E){var A=E.which||E.keyCode;A>=37&&A<=40&&f()},C]},[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",Vm({},a,{onTouchStart:g,onMouseDown:g,className:"react-colorful__interactive",ref:i,onKeyDown:w,onKeyUp:y,tabIndex:0,role:"slider"}))}),Dw=function(e){return e.filter(Boolean).join(" ")},BM=function(e){var t=e.color,n=e.left,r=e.top,a=r===void 0?.5:r,i=Dw(["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}}))},Gr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},xQ=function(e){return jQ(h4(e))},h4=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?Gr(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?Gr(parseInt(e.substring(6,8),16)/255,2):1}},kQ=function(e){return CQ(EQ(e))},SQ=function(e){var t=e.s,n=e.v,r=e.a,a=(200-t)*n/100;return{h:Gr(e.h),s:Gr(a>0&&a<200?t*n/100/(a<=100?a:200-a)*100:0),l:Gr(a/2),a:Gr(r,2)}},p4=function(e){var t=SQ(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},EQ=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:Gr(255*[r,u,l,l,f,r][h]),g:Gr(255*[f,r,r,u,l,l][h]),b:Gr(255*[l,l,f,r,r,u][h]),a:Gr(a,2)}},yh=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},CQ=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,i=a<1?yh(Gr(255*a)):"";return"#"+yh(t)+yh(n)+yh(r)+i},jQ=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:Gr(60*(u<0?u+6:u)),s:Gr(i?l/i*100:0),v:Gr(i/255*100),a}},AQ=zn.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,a=Dw(["react-colorful__hue",e.className]);return zn.createElement("div",{className:a},zn.createElement(zM,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:cf(t+360*i.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":Gr(t),"aria-valuemax":"360","aria-valuemin":"0"},zn.createElement(BM,{className:"react-colorful__hue-pointer",left:t/360,color:p4({h:t,s:100,v:100,a:1})})))}),NQ=zn.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,a={backgroundColor:p4({h:t.h,s:100,v:100,a:1})};return zn.createElement("div",{className:"react-colorful__saturation",style:a},zn.createElement(zM,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:cf(t.s+100*i.left,0,100),v:cf(t.v-100*i.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+Gr(t.s)+"%, Brightness "+Gr(t.v)+"%"},zn.createElement(BM,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:p4(t)})))}),UM=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},MQ=function(e,t){return e.toLowerCase()===t.toLowerCase()||UM(h4(e),h4(t))};function RQ(e,t,n,r){var a=O0(n),i=O0(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;UM(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 PQ=typeof window<"u"?s.useLayoutEffect:s.useEffect,LQ=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Z5=new WeakMap,$Q=function(e){PQ(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(!Z5.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=LQ();l&&i.setAttribute("nonce",l),Z5.set(r,i),a.appendChild(i)}}},[])},TQ=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=ZM(e,["className","colorModel","color","onChange","onChangeEnd"]),f=s.useRef(null);$Q(f);var h=RQ(n,a,i,l),p=h[0],m=h[1],g=h[2],w=Dw(["react-colorful",t]);return zn.createElement("div",Vm({},u,{ref:f,className:w}),zn.createElement(NQ,{hsva:p,onChange:m,onChangeEnd:g}),zn.createElement(AQ,{hue:p.h,onChange:m,onChangeEnd:g,className:"react-colorful__last-control"}))},DQ={defaultColor:"000",toHsva:xQ,fromHsva:function(e){return kQ({h:e.h,s:e.s,v:e.v,a:1})},equal:MQ},HQ=function(e){return zn.createElement(TQ,Vm({},e,{colorModel:DQ}))};function od({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=cr(e)??"#000000",[g,w]=s.useState(m),[y,b]=s.useState(!1);s.useEffect(()=>{y||w(m)},[m,y]);const k=P=>{const T=cr(P);T&&(w(T),f==="live"&&t(T))},S=P=>{const T=cr(P);T&&(w(T),t(T),f==="close"&&b(!1))},C=P=>{if(b(P),P||f!=="close")return;const T=cr(g);T&&T!==m&&t(T)},E=[...new Set((r??[]).map(P=>cr(P)).filter(P=>!!P))],A=o.jsx(rd,{children:o.jsx("button",{type:"button",className:a??"sc-cp-trigger",style:{background:m,...i},"aria-label":n,...l,children:p})});return o.jsxs(nd,{open:y,onOpenChange:C,children:[u?o.jsx(dr,{label:n,children:A}):A,o.jsxs(sd,{className:"sc-cp",align:h,sideOffset:6,width:"232px",children:[o.jsx(HQ,{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:P=>{w(P.target.value);const T=cr(P.target.value);T&&f==="live"&&t(T)},onBlur:()=>w(cr(g)??m),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),f==="close"?S(g):b(!1))}})]}),E.length>0&&o.jsx("div",{className:"sc-cp-presets",children:E.map(P=>o.jsx("button",{type:"button",style:{background:P},"data-on":P===g||void 0,title:P,"aria-label":P,onClick:()=>f==="close"?S(P):k(P)},P))})]})]})}function OQ({doc:e,suggestions:t}){var w;const n=(w=e.json)==null?void 0:w.palette,[r,a]=s.useState(()=>qs(n)),i=JSON.stringify(n??{});s.useEffect(()=>{a(qs(n))},[i]);const l=(y,b=0)=>{a(y),e.patch({palette:Tw(y,n)},{debounce:b})},u=(y,b,k=0)=>l(r.map((S,C)=>C===y?{...S,...b}:S),k),f=()=>l([...r,{hex:_m(r),name:"",slot:r.length?"accent":"primary"}]),h=(t??[]).filter(y=>{const b=cr(y.hex);return b&&!r.some(k=>k.hex===b)}),p=(y,b)=>o.jsx(IQ,{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])=>!F5(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])=>F5(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=cr(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 IQ({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=cr(a);u&&n(u),i(u??e.hex)};return $w(()=>{a!==e.hex&&l()}),o.jsxs("div",{className:"sc-pal-row",children:[o.jsx(od,{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(tm,{size:13})})]})}function FQ({onSaveState:e}){var w,y;const{brand:t}=un(),{push:n}=rr(),r=uQ();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 C;const b=h.trim(),k=b&&!/^https?:\/\//i.test(b)?`https://${b}`:b;p(k);const S={...((C=r.json)==null?void 0:C.meta)??{}};k?S.website=k:delete S.website,r.patch({meta:S})};$w(()=>{h.trim()!==f&&m()});const g=async()=>{var b,k,S;i(!0);try{await r.flush();const C=await Ne.refreshBrandFromUrl(t.id);r.applyRow(C),u(((b=C.suggestions)==null?void 0:b.palette)??[]),n({kind:(k=C.warnings)!=null&&k.length?"warning":"success",title:"Read the website again",detail:(S=C.warnings)!=null&&S.length?C.warnings.join(" "):"Your edits were kept."})}catch(C){n(cn(C,"Could not read that website"))}finally{i(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(is,{title:"Identity",sub:"The name and the mark.",children:o.jsx(fQ,{brand:t,doc:r})}),o.jsx(is,{title:"Palette",sub:"Favoured on a shot that asks for the kit.",children:o.jsx("div",{className:"sc-set-block",children:o.jsx(OQ,{doc:r,suggestions:l})})}),o.jsx(is,{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(cQ,{doc:r})})}),o.jsxs(is,{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(Rr,{size:"1"}):o.jsx(E7,{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:CG(t.id),download:!0,onClick:()=>void r.flush(),children:"Export"})]})]})]})}const il=e=>e.replace(/\s*\(BYOK\)\s*$/i,""),uf="codex-cli";function _Q(e,t){var n;return e.some(r=>r.id===t)?t:((n=e[0])==null?void 0:n.id)??uf}const VQ=e=>e.toFixed(3).replace(/0+$/,"").replace(/\.$/,"");function ZQ(e){return e.free?e.localOnly?"Runs on your ChatGPT plan":"No cost per image":`$${VQ(e.perGeneration)} / image`}function zQ(e,t){if(t)return e.available?"Manage":"Connect";if(e.available)return e.id===uf?"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 BQ(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 UQ({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=BQ(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 Ne.setCap(f.id,p),h(p),t()}catch(m){h(f.cap),a(cn(m,"Could not save that cap"))}};return r.length?o.jsx(is,{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:il(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":`${il(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(is,{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 WQ({onDone:e,thisComputer:t}){const{brand:n,resetShots:r}=un(),{refresh:a}=Dn(),i=Bn(),[l,u]=s.useState(!1),f=s.useCallback(async h=>{u(!0);try{await Ne.deleteData(h),e(),h==="shots"&&r(),h==="all"&&window.location.replace("/")}finally{u(!1)}},[e,r]);return o.jsxs(o.Fragment,{children:[o.jsx(is,{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 ",ya(n),", its sets and every shot. Other brands stay."]})]}),o.jsx(Qn,{label:"Delete brand",title:`Delete ${ya(n)}?`,body:"The kit, its sets and every shot go with it. Exports you already downloaded stay yours.",busy:l,onConfirm:()=>{u(!0),Ne.deleteBrand(n.id).then(()=>a()).then(()=>i("/",{replace:!0})).finally(()=>u(!1))}})]})}),t&&o.jsxs(is,{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(Qn,{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(Qn,{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 KQ(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 GQ({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 Ne.desktopInstall(),u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>u(!1),1600),t(await Ne.desktop())}catch(m){r(String((m==null?void 0:m.message)??m))}finally{i(!1)}}},p=KQ(e,n);return o.jsx(is,{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 WM(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 YQ(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 qQ(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 XQ=[{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"}],KM=e=>XQ.find(t=>t.engineId===e),GM={"codex-cli":{Mark:WM,size:16,plate:"#FFFFFF",ink:"#000000"},openrouter:{Mark:YQ,size:18,plate:"#FFFFFF",ink:"#7624F4"},replicate:{Mark:qQ,size:15,plate:"#E42022",ink:"#FFFFFF"}},YM=e=>{const t=GM[e];return t?{plate:t.plate,ink:t.ink}:void 0},QQ={demo:II};function qM({engineId:e,scale:t=1}){const n=GM[e];if(n){const a=Math.round(n.size*t);return o.jsx(n.Mark,{width:a,height:a})}const r=QQ[e]??W0;return o.jsx(r,{size:Math.round(15*t)})}const JQ=e=>[...e].sort((t,n)=>+(n.id===uf)-+(t.id===uf));function eJ({engines:e}){const t=Rl(),r=e.filter(a=>a.available).length===0;return o.jsx(is,{children:JQ(e).map(a=>{const i=KM(a.id),l=il(a.displayName),u=zQ(a,!!i),f=a.available?"Connected":null,h=!f&&a.reason&&(!u||a.code==="unverified"),p=YM(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(qM,{engineId:a.id})}),o.jsxs("span",{className:"sc-eng-name",children:[o.jsx("b",{children:l}),o.jsx("small",{children:ZQ(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 tJ=e=>e>1e9?`${(e/1e9).toFixed(1)} GB`:e>1e6?`${Math.round(e/1e6)} MB`:`${Math.round(e/1e3)} KB`,x8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function nJ(e){return e===0?0:e<3?1:e<6?2:e<12?3:4}function z5(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function B5(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=z5(m),w=e.get(g)??0;if(h+=w,l.push({key:g,level:nJ(w),title:w?`${w} run${w===1?"":"s"} on ${m.getDate()} ${x8[m.getMonth()]}`:`nothing on ${m.getDate()} ${x8[m.getMonth()]}`}),m.getDay()===0){const y=m.getMonth()!==f&&m.getDate()<=7;y&&(f=m.getMonth()),u.push({key:g,label:y?x8[m.getMonth()]:""})}}return{cells:l,months:u,sum:h,from:z5(a)}}function rJ({info:e,thisComputer:t}){const{push:n}=rr();return o.jsxs(is,{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,`${tJ(e.bytes)} across ${e.images} images`].filter(Boolean).join(" · "):"…"})]}),t&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void Ne.reveal().catch(r=>n(cn(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 sJ(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 xd=function(e,t){let a=e;const i=j0[t];let l=null,u=0,f=null;const h=[],p={},m=function(M,j){u=a*4+17,l=(function(R){const L=new Array(R);for(let H=0;H<R;H+=1){L[H]=new Array(R);for(let D=0;D<R;D+=1)L[H][D]=null}return L})(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)),C(f,j)},g=function(M,j){for(let R=-1;R<=7;R+=1)if(!(M+R<=-1||u<=M+R))for(let L=-1;L<=7;L+=1)j+L<=-1||u<=j+L||(0<=R&&R<=6&&(L==0||L==6)||0<=L&&L<=6&&(R==0||R==6)||2<=R&&R<=4&&2<=L&&L<=4?l[M+R][j+L]=!0:l[M+R][j+L]=!1)},w=function(){let M=0,j=0;for(let R=0;R<8;R+=1){m(!0,R);const L=Vi.getLostPoint(p);(R==0||M>L)&&(M=L,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=Vi.getPatternPosition(a);for(let j=0;j<M.length;j+=1)for(let R=0;R<M.length;R+=1){const L=M[j],H=M[R];if(l[L][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[L+D][H+B]=!0:l[L+D][H+B]=!1}},k=function(M){const j=Vi.getBCHTypeNumber(a);for(let R=0;R<18;R+=1){const L=!M&&(j>>R&1)==1;l[Math.floor(R/3)][R%3+u-8-3]=L}for(let R=0;R<18;R+=1){const L=!M&&(j>>R&1)==1;l[R%3+u-8-3][Math.floor(R/3)]=L}},S=function(M,j){const R=i<<3|j,L=Vi.getBCHTypeInfo(R);for(let H=0;H<15;H+=1){const D=!M&&(L>>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&&(L>>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},C=function(M,j){let R=-1,L=u-1,H=7,D=0;const B=Vi.getMaskFunction(j);for(let V=u-1;V>0;V-=2)for(V==6&&(V-=1);;){for(let W=0;W<2;W+=1)if(l[L][V-W]==null){let K=!1;D<M.length&&(K=(M[D]>>>H&1)==1),B(L,V-W)&&(K=!K),l[L][V-W]=K,H-=1,H==-1&&(D+=1,H=7)}if(L+=R,L<0||u<=L){L-=R,R=-R;break}}},E=function(M,j){let R=0,L=0,H=0;const D=new Array(j.length),B=new Array(j.length);for(let F=0;F<j.length;F+=1){const _=j[F].dataCount,O=j[F].totalCount-_;L=Math.max(L,_),H=Math.max(H,O),D[F]=new Array(_);for(let Z=0;Z<D[F].length;Z+=1)D[F][Z]=255&M.getBuffer()[Z+R];R+=_;const Y=Vi.getErrorCorrectPolynomial(O),X=df(D[F],Y.getLength()-1).mod(Y);B[F]=new Array(Y.getLength()-1);for(let Z=0;Z<B[F].length;Z+=1){const J=Z+X.getLength()-B[F].length;B[F][Z]=J>=0?X.getAt(J):0}}let V=0;for(let F=0;F<j.length;F+=1)V+=j[F].totalCount;const W=new Array(V);let K=0;for(let F=0;F<L;F+=1)for(let _=0;_<j.length;_+=1)F<D[_].length&&(W[K]=D[_][F],K+=1);for(let F=0;F<H;F+=1)for(let _=0;_<j.length;_+=1)F<B[_].length&&(W[K]=B[_][F],K+=1);return W},A=function(M,j,R){const L=U5.getRSBlocks(M,j),H=W5();for(let B=0;B<R.length;B+=1){const V=R[B];H.put(V.getMode(),4),H.put(V.getLength(),Vi.getLengthInBits(V.getMode(),M)),V.write(H)}let D=0;for(let B=0;B<L.length;B+=1)D+=L[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 E(H,L)};p.addData=function(M,j){j=j||"Byte";let R=null;switch(j){case"Numeric":R=aJ(M);break;case"Alphanumeric":R=oJ(M);break;case"Byte":R=iJ(M);break;case"Kanji":R=lJ(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=U5.getRSBlocks(M,i),R=W5();for(let H=0;H<h.length;H++){const D=h[H];R.put(D.getMode(),4),R.put(D.getLength(),Vi.getLengthInBits(D.getMode(),M)),D.write(R)}let L=0;for(let H=0;H<j.length;H++)L+=j[H].dataCount;if(R.getLengthInBits()<=L*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 L=0;L<p.getModuleCount();L+=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(L,H)?"#000000":"#ffffff",R+=";",R+='"/>';R+="</tr>"}return R+="</tbody>",R+="</table>",R},p.createSvgTag=function(M,j,R,L){let H={};typeof arguments[0]=="object"&&(H=arguments[0],M=H.cellSize,j=H.margin,R=H.alt,L=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,L=typeof L=="string"?{text:L}:L||{},L.text=L.text||null,L.id=L.text?L.id||"qrcode-title":null;const D=p.getModuleCount()*M+j*2;let B,V,W,K,F="",_;for(_="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",F+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',F+=H.scalable?"":' width="'+D+'px" height="'+D+'px"',F+=' viewBox="0 0 '+D+" "+D+'" ',F+=' preserveAspectRatio="xMinYMin meet"',F+=L.text||R.text?' role="img" aria-labelledby="'+P([L.id,R.id].join(" ").trim())+'"':"",F+=">",F+=L.text?'<title id="'+P(L.id)+'">'+P(L.text)+"</title>":"",F+=R.text?'<description id="'+P(R.id)+'">'+P(R.text)+"</description>":"",F+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',F+='<path d="',W=0;W<p.getModuleCount();W+=1)for(K=W*M+j,B=0;B<p.getModuleCount();B+=1)p.isDark(W,B)&&(V=B*M+j,F+="M"+V+","+K+_);return F+='" stroke="transparent" fill="black"/>',F+="</svg>",F},p.createDataURL=function(M,j){M=M||2,j=typeof j>"u"?M*4:j;const R=p.getModuleCount()*M+j*2,L=j,H=R-j;return fJ(R,R,function(D,B){if(L<=D&&D<H&&L<=B&&B<H){const V=Math.floor((D-L)/M),W=Math.floor((B-L)/M);return p.isDark(W,V)?0:1}else return 1})},p.createImgTag=function(M,j,R){M=M||2,j=typeof j>"u"?M*4:j;const L=p.getModuleCount()*M+j*2;let H="";return H+="<img",H+=' src="',H+=p.createDataURL(M,j),H+='"',H+=' width="',H+=L,H+='"',H+=' height="',H+=L,H+='"',R&&(H+=' alt="',H+=P(R),H+='"'),H+="/>",H};const P=function(M){let j="";for(let R=0;R<M.length;R+=1){const L=M.charAt(R);switch(L){case"<":j+="&lt;";break;case">":j+="&gt;";break;case"&":j+="&amp;";break;case'"':j+="&quot;";break;default:j+=L;break}}return j},T=function(M){M=typeof M>"u"?2:M;const R=p.getModuleCount()*1+M*2,L=M,H=R-M;let D,B,V,W,K;const F={"██":"█","█ ":"▀"," █":"▄"," ":" "},_={"██":"▀","█ ":"▀"," █":" "," ":" "};let O="";for(D=0;D<R;D+=2){for(V=Math.floor((D-L)/1),W=Math.floor((D+1-L)/1),B=0;B<R;B+=1)K="█",L<=B&&B<H&&L<=D&&D<H&&p.isDark(V,Math.floor((B-L)/1))&&(K=" "),L<=B&&B<H&&L<=D+1&&D+1<H&&p.isDark(W,Math.floor((B-L)/1))?K+=" ":K+="█",O+=M<1&&D+1>=H?_[K]:F[K];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,L=j,H=R-j;let D,B,V,W;const K=Array(M+1).join("██"),F=Array(M+1).join(" ");let _="",O="";for(D=0;D<R;D+=1){for(V=Math.floor((D-L)/M),O="",B=0;B<R;B+=1)W=1,L<=B&&B<H&&L<=D&&D<H&&p.isDark(V,Math.floor((B-L)/M))&&(W=0),O+=W?K:F;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 L=0;L<R;L++)for(let H=0;H<R;H++)M.fillStyle=p.isDark(L,H)?"black":"white",M.fillRect(H*j,L*j,j,j)},p};xd.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};xd.createStringToBytes=function(e,t){const n=(function(){const a=uJ(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 rs={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},j0={L:1,M:0,Q:3,H:2},_i={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Vi=(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 _i.PATTERN000:return function(u,f){return(u+f)%2==0};case _i.PATTERN001:return function(u,f){return u%2==0};case _i.PATTERN010:return function(u,f){return f%3==0};case _i.PATTERN011:return function(u,f){return(u+f)%3==0};case _i.PATTERN100:return function(u,f){return(Math.floor(u/2)+Math.floor(f/3))%2==0};case _i.PATTERN101:return function(u,f){return u*f%2+u*f%3==0};case _i.PATTERN110:return function(u,f){return(u*f%2+u*f%3)%2==0};case _i.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=df([1],0);for(let f=0;f<l;f+=1)u=u.multiply(df([1,Bi.gexp(f)],0));return u},a.getLengthInBits=function(l,u){if(1<=u&&u<10)switch(l){case rs.MODE_NUMBER:return 10;case rs.MODE_ALPHA_NUM:return 9;case rs.MODE_8BIT_BYTE:return 8;case rs.MODE_KANJI:return 8;default:throw"mode:"+l}else if(u<27)switch(l){case rs.MODE_NUMBER:return 12;case rs.MODE_ALPHA_NUM:return 11;case rs.MODE_8BIT_BYTE:return 16;case rs.MODE_KANJI:return 10;default:throw"mode:"+l}else if(u<41)switch(l){case rs.MODE_NUMBER:return 14;case rs.MODE_ALPHA_NUM:return 13;case rs.MODE_8BIT_BYTE:return 16;case rs.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})(),Bi=(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})(),df=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]^=Bi.gexp(Bi.glog(r.getAt(l))+Bi.glog(a.getAt(u)));return df(i,0)},r.mod=function(a){if(r.getLength()-a.getLength()<0)return r;const i=Bi.glog(r.getAt(0))-Bi.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]^=Bi.gexp(Bi.glog(a.getAt(u))+i);return df(l,0).mod(a)},r},U5=(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 j0.L:return e[(a-1)*4+0];case j0.M:return e[(a-1)*4+1];case j0.Q:return e[(a-1)*4+2];case j0.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})(),W5=function(){const e=[];let t=0;const n={};return n.getBuffer=function(){return e},n.getAt=function(r){const a=Math.floor(r/8);return(e[a]>>>7-r%8&1)==1},n.put=function(r,a){for(let i=0;i<a;i+=1)n.putBit((r>>>a-i-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(r){const a=Math.floor(t/8);e.length<=a&&e.push(0),r&&(e[a]|=128>>>t%8),t+=1},n},aJ=function(e){const t=rs.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},oJ=function(e){const t=rs.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},iJ=function(e){const t=rs.MODE_8BIT_BYTE,n=xd.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},lJ=function(e){const t=rs.MODE_KANJI,n=xd.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},XM=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},cJ=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},uJ=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},dJ=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 C=0;C<p;C+=1)w.add(String.fromCharCode(C));w.add(String.fromCharCode(p)),w.add(String.fromCharCode(m));const y=XM(),b=l(y);b.write(p,g);let k=0,S=String.fromCharCode(a[k]);for(k+=1;k<a.length;){const C=String.fromCharCode(a[k]);k+=1,w.contains(S+C)?S=S+C:(b.write(w.indexOf(S),g),w.size()<4095&&(w.size()==1<<g&&(g+=1),w.add(S+C)),S=C)}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},fJ=function(e,t,n){const r=dJ(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=XM();r.write(a);const i=cJ(),l=a.toByteArray();for(let u=0;u<l.length;u+=1)i.writeByte(l[u]);return i.flush(),"data:image/gif;base64,"+i};xd.stringToBytes;const k8=4;function hJ({value:e,label:t,size:n=200}){const{side:r,path:a}=s.useMemo(()=>{const i=xd(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+k8} ${f+k8}h1v1h-1z`);return{side:l+k8*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 pJ=3e4,mJ=5*6e4;function gJ(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 vJ=e=>e.url,wJ=e=>`${e.slice(0,3)} ${e.slice(3)}`;function yJ(e,t,n){return e.lastVisit&&e.lastVisit.at>=t-mJ?"connected":n-t>=pJ?"stuck":"waiting"}function bJ(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 xJ(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 kJ(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 SJ(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 EJ=2e3;function CJ(){const{markUsed:e}=Zc();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),C=s.useRef(null),{push:E}=rr(),A=s.useCallback(async(K=!1)=>{try{n(await Ne.phone(K)),a(!1)}catch{a(!0)}},[]),[P,T]=s.useState(!1),M=async()=>{T(!0);try{n(await Ne.phoneNewCode()),l(Date.now())}catch{E({kind:"warning",title:"Could not make a new code"})}finally{T(!1)}};s.useEffect(()=>{A();const K=setInterval(()=>{f(Date.now()),A()},EJ);return()=>{clearInterval(K),S.current&&clearTimeout(S.current)}},[A]);const j=t?vJ(t):null;s.useEffect(()=>{j&&i===null&&l(Date.now())},[j,i]);const R=t&&j&&i!==null?yJ(t,i,u):null;s.useEffect(()=>{R==="stuck"&&p(!0)},[R]);const L=!!j&&!!(t!=null&&t.thisComputer);s.useEffect(()=>{if(!L)return;let K=!0;return Ne.phoneHelp().then(F=>K&&g(F.firewall)).catch(()=>K&&g("unknown")),()=>{K=!1}},[L]);const H=gJ(t,r),D=t?xJ(m,t.platform):null,B=t?kJ(w,t.platform):null,V=async()=>{j&&(await sJ(j,C.current)?(k(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>k(!1),1600)):E({kind:"warning",title:"Could not copy the link",detail:j}))},W=async()=>{y("asking");try{const K=await Ne.phoneAllow();g(K.firewall),y(K.result)}catch{y("failed")}};return o.jsxs(is,{title:"Other devices",children:[o.jsxs("div",{className:"sc-set-row",ref:C,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(hJ,{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:wJ(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 W(),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:bJ(R,t)}),t.thisComputer&&o.jsxs("details",{className:"sc-phone-help",open:h,onToggle:K=>p(K.currentTarget.open),children:[o.jsx("summary",{children:"Not opening?"}),o.jsx("ul",{children:SJ(m,t).map(K=>o.jsx("li",{children:K},K))})]})]})]}),(t==null?void 0:t.thisComputer)&&j&&o.jsxs("div",{className:"sc-set-row",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"New code"}),o.jsx("small",{"data-prose":"",children:"Signs out every phone and tablet. They scan the new code to open Scenri again."})]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:P,onClick:()=>void M(),children:P?"Making…":"New code"})]})]})}function jJ(e){switch(e){case"npx":return"npx scenri update";case"global":case"managed":return"scenri update";default:return"npx scenri@latest"}}function AJ({version:e}){var k;const t=Mm(),n=Zc(),{brand:r}=un(),a=t.status,[i,l]=s.useState(null),[u,f]=s.useState(!1);s.useEffect(()=>{Ne.settings().then(S=>l(!!S.updateCheck)).catch(()=>{})},[]);const h=async()=>{if(i===null)return;const S=!i;l(S);try{await Ne.saveSettings({updateCheck:S})}catch{l(!S)}},p=s.useRef(null);s.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const m=jJ(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):CN(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(is,{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:fp(r),children:"Show"})]})]})}function K5({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 NJ({brandId:e}){const[t,n]=s.useState(null);s.useEffect(()=>{let u=!0;return n(null),Ne.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=B5(u,53),h=B5(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(is,{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(K5,{weeks:53,months:r.months,cells:r.cells}),o.jsx(K5,{weeks:13,months:a.months,cells:a.cells})]})})}function MJ({engines:e,brandId:t,onSaved:n}){const r=Er("settings"),a=r.value!==null,[i,l]=s.useState(null);s.useEffect(()=>{if(!a||i)return;let y=!0;return Ne.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 Ne.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 Ne.desktop().then(b=>y&&p(b)).catch(()=>{}),()=>{y=!1}},[a,m]);const[g,w]=s.useState("idle");return o.jsx(Fs,{open:a,className:"sc-set",maxWidth:"880px",onDismiss:r.close,children:o.jsx(RJ,{value:r.value,onPick:r.set,saved:o.jsx(PJ,{state:g}),page:y=>o.jsx(LJ,{page:y,engines:e,brandId:t,onSaved:n,onKitState:w,version:i,home:u,desktop:h,onDesktop:p})})})}function RJ({value:e,onPick:t,saved:n,page:r}){const a=jr(ta),{brand:i}=un(),l=sY(e),[u,f]=s.useState(()=>aY(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=gh.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(Aa,{size:15})}),o.jsx(ks,{className:"sc-newdlg-title",children:g.label}),l==="brand"&&n,o.jsx(G5,{})]}),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(ya(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(tQ,{feature:y.feature}),a&&o.jsx(vl,{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(ks,{className:"sc-newdlg-title",children:"Settings"}),o.jsx(G5,{})]}),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:gh.filter(y=>y.scope==="brand").map(w)}),o.jsx("p",{className:"sc-set-group",children:"Studio"}),o.jsx("ul",{children:gh.filter(y=>y.scope==="studio").map(w)}),o.jsx("p",{className:"sc-set-group",children:"Delete"}),o.jsx("ul",{className:"sc-set-apart",children:gh.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(ya(i))})]}),l==="brand"&&n]}),r(l)]},l)]})]},"index")}function PJ({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(Gn,{size:12,weight:"bold"}),dQ(e)]})}function LJ({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(FQ,{onSaveState:a});case"usage":return o.jsx(NJ,{brandId:n});case"engines":return o.jsxs(o.Fragment,{children:[o.jsx(eJ,{engines:t}),o.jsx(UQ,{engines:t,onSaved:r,thisComputer:h})]});case"appearance":return o.jsx(aQ,{});case"library":return o.jsx(rJ,{info:l,thisComputer:h});case"phone":return o.jsxs(o.Fragment,{children:[o.jsx(CJ,{}),h&&o.jsx(GQ,{status:u,onStatus:f})]});case"updates":return o.jsx(AJ,{version:i});case"about":return o.jsx(rQ,{version:i});case"danger":return o.jsx(WQ,{onDone:r,thisComputer:h})}}function G5(){return o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})})}function $J(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 TJ(e){return e>0?`See ${e} more update${e===1?"":"s"}`:"See all updates"}const QM="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",DJ="/assets/whatsnew-stage-DlyjaAn6.webp",HJ=["January","February","March","April","May","June","July","August","September","October","November","December"];function JM(e){const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return e;const n=HJ[Number(t[2])-1];return n?`${Number(t[3])} ${n} ${t[1]}`:e}function OJ(e){const t=JM(e);if(t===e)return e;const[n,r,a]=t.split(" ");return`${n} ${r.slice(0,3)} ${a}`}const IJ="/assets/0.16.0-local-access-D7XQonLd.webp",FJ="/assets/0.17.0-select-several-DdAw3yQ3.webp",_J="/assets/0.17.1-presenter-identity-BfgRpajU.webp",VJ="/assets/0.17.2-presenter-prompt-BiaRpVJN.webp",ZJ="/assets/0.18.0-portrait-standard-CrJ6Ixm2.webp",zJ="/assets/0.19.0-home-examples-Dv7HjKk9.webp",BJ="/assets/0.20.0-made-in-place-B0L_kS__.webp",UJ=Object.assign({"./assets/whatsnew/0.16.0-local-access.webp":IJ,"./assets/whatsnew/0.17.0-select-several.webp":FJ,"./assets/whatsnew/0.17.1-presenter-identity.webp":_J,"./assets/whatsnew/0.17.2-presenter-prompt.webp":VJ,"./assets/whatsnew/0.18.0-portrait-standard.webp":ZJ,"./assets/whatsnew/0.19.0-home-examples.webp":zJ,"./assets/whatsnew/0.20.0-made-in-place.webp":BJ});function WJ(e){return UJ[`./assets/whatsnew/${e}`]??null}const eR="Scenri could not read its release notes. If you are running a development server, it may predate this page; restart it and try again.",tR="There is nothing new to show here yet.",KJ={fetchpriority:"high"};function nR(e){var r;const t=(r=e==null?void 0:e.sections.find(a=>a.image))==null?void 0:r.image,n=t?WJ(t.file):null;return t&&n?{src:n,alt:t.alt}:null}function rR({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?KJ: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(DI,{size:14})})})]}):o.jsx("div",{className:"sc-wn-media","data-ready":u,children:f})}function GJ({src:e,alt:t,onClose:n}){const r=s.useRef(null);return o.jsx(yl,{open:!0,onOpenChange:a=>!a&&n(),children:o.jsxs(bl,{children:[o.jsx(xl,{className:"sc-wn-lb-scrim"}),o.jsxs(kl,{className:"sc-wn-lb","aria-describedby":void 0,onOpenAutoFocus:a=>{r.current=document.activeElement,xN(a)},onCloseAutoFocus:a=>{var i;a.preventDefault(),(i=r.current)!=null&&i.isConnected&&r.current.focus()},onClick:n,children:[o.jsx(Sl,{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(Nf,{className:"sc-icon-btn sc-wn-lb-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})]})]})})}function sR({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 YJ({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 aR({entry:e,current:t=!1,hideVersion:n=!1}){return o.jsxs("p",{className:"sc-wn-when",children:[!n&&o.jsx(sR,{version:e.version,current:t}),o.jsxs("time",{dateTime:e.date,children:[o.jsx("span",{"aria-hidden":"true",children:OJ(e.date)}),o.jsx("span",{className:"sc-vh",children:JM(e.date)})]})]})}function qJ({version:e,current:t}){return o.jsxs("div",{className:"sc-wn-media sc-wn-fallback","data-ready":!0,children:[o.jsx("img",{src:QM,alt:""}),o.jsx("span",{className:"sc-wn-fallback-chip","data-theme":"dark",children:o.jsx(sR,{version:e,current:t})})]})}function XJ({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(mc,{size:12,"aria-hidden":"true"})]})}function QJ(){const e=Er("whatsnew"),{brand:t}=un(),{status:n,featured:r,recent:a,unseen:i,lead:l,running:u,markSeen:f}=Zc(),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?nR(p):null,S=(k==null?void 0:k.src)??QM;s.useEffect(()=>{if(l)for(const A of[S,DJ]){const P=new Image;P.fetchPriority="high",P.src=A}},[l,S]);const C=s.useRef(!1),E=A=>{!A.metaKey&&!A.ctrlKey&&!A.shiftKey&&!A.altKey&&(C.current=!0)};return o.jsxs(Fs,{open:h,className:"sc-wn",tone:"dim",maxWidth:"520px",described:!0,onDismiss:g,onCloseAutoFocus:A=>{C.current&&(A.preventDefault(),C.current=!1)},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ks,{className:"sc-newdlg-title",children:"What's new"}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})})]}),o.jsx("div",{className:"sc-newdlg-body",children:p?o.jsxs("article",{className:"sc-wn-ex",children:[k?o.jsx(rR,{picture:k,eager:!0,onBroken:()=>b(p.version)},p.version):o.jsx(qJ,{version:p.version,current:p.version===u}),o.jsx(aR,{entry:p,current:p.version===u,hideVersion:!k}),o.jsx(Ec,{asChild:!0,children:o.jsx("h3",{className:"sc-wn-hed",children:o.jsx(Zn,{className:"sc-wn-ex-link",to:`${fp(t)}#v${p.version}`,replace:!0,onClick:E,children:p.title})})})]}):o.jsx(Ec,{className:"sc-wn-txt",children:n==="failed"?eR:tR})}),o.jsxs("div",{className:"sc-newdlg-foot sc-wn-foot",children:[a.length>0&&o.jsxs(Zn,{className:"sc-wn-link",to:fp(t),replace:!0,onClick:E,children:[TJ(m.current.more),o.jsx(ma,{size:13,"aria-hidden":"true"})]}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",children:"Got it"})})]})]})}function JJ(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 oR(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 eee(e){return`Scenri will start Codex without ${oR(e)}. Nothing on your computer changes, and you can undo this here later.`}function tee(e){return`Scenri is starting Codex without ${oR(e)} on this computer.`}const nee=2e3,ree=5*6e4;function see({engines:e,onSaved:t}){const n=Er("setup"),r=n.close,a=n.value,i=a?KM(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 Ne.version().then(g=>m&&p(g.thisComputer!==!1)).catch(()=>{}),()=>{m=!1}},[]),o.jsx(Fs,{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(aee,{provider:i,name:f?il(f.displayName):i.engineId,connected:!!(f!=null&&f.available),thisComputer:h,onSaved:t,onDone:r}):o.jsx(oee,{engines:e,onSaved:t,onDone:r})})}function iR({title:e}){return o.jsxs("div",{className:"sc-newdlg-head sc-setup-head",children:[o.jsx(ks,{className:"sc-newdlg-title sc-setup-title",children:e}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})})]})}function aee({provider:e,name:t,connected:n,thisComputer:r,onSaved:a,onDone:i}){const[l,u]=s.useState(""),[f,h]=s.useState(!1),[p,m]=s.useState(null),[g,w]=s.useState(!1),y=async()=>{const k=l.trim();if(k){h(!0),m(null);try{await Ne.saveSettings({[e.settingKey]:k}),u(""),a(),i()}catch(S){m(S.message)}finally{h(!1)}}},b=async()=>{h(!0),m(null);try{await Ne.saveSettings({[e.settingKey]:""});const k=await Ne.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(iR,{title:n?`${t} key`:`Connect ${t}`}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(lR,{engineId:e.engineId,name:t,state:n?"Connected":"Not connected",ready:n}),o.jsx("p",{className:"sc-setup-lead",children:r?n?`A key is saved for ${t}. Paste a new one to replace it, or disconnect to remove it from this computer.`:`Paste a key from ${t}. It is stored in your library folder on this computer, sent only to ${t}, and never shown again.`:"Keys are added on the computer running Scenri."})]}),r&&o.jsxs("form",{className:"sc-setup-key",onSubmit:k=>{k.preventDefault(),y()},children:[o.jsx("input",{className:"sc-in",type:"password",placeholder:e.hint,value:l,onChange:k=>u(k.target.value),autoComplete:"off",name:e.settingKey,"aria-label":`${t} key`}),o.jsxs("div",{className:"sc-setup-acts",children:[o.jsxs("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:f||!l.trim(),children:[f?o.jsx(Rr,{size:"1"}):o.jsx(gE,{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(mc,{size:13})]})]})]}),r&&n&&o.jsx("div",{className:"sc-setup-cut",children:o.jsx(Qn,{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(nm,{size:15})," ",p]})})]})]})}function oee({engines:e,onSaved:t,onDone:n}){const r=Rl(),[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([]),C=s.useRef(null),E=s.useCallback(()=>{C.current!==null&&(window.clearInterval(C.current),C.current=null)},[]),A=s.useCallback(async(K=!1)=>{const{state:F,reason:_,platform:O,conflictKeys:Y,ignoredKeys:z}=await Ne.codexStatus({force:K});return O&&m(O),w(_??null),b(Y??[]),S(z??[]),i(F),F},[]);s.useEffect(()=>(u(null),i("checking"),A().catch(()=>i("unverified")),E),[A,E]);const P=s.useCallback(()=>{u(null),i("checking"),A(!0).catch(()=>i("unverified"))},[A]),T=async()=>{u(null),i("repairing");try{const{state:K,conflictKeys:F,ignoredKeys:_,reason:O}=await Ne.repairCodexEnv(y);b(F??[]),S(_??[]),w(O??null),i(K)}catch(K){u({detail:K.message}),i("env-conflict")}},M=async()=>{u(null),i("checking");try{const{state:K,conflictKeys:F,ignoredKeys:_}=await Ne.restoreCodexEnv();b(F??[]),S(_??[]),i(K)}catch{A().catch(()=>i("unverified"))}};s.useEffect(()=>{a==="ready"&&t()},[a,t]);const j=async()=>{u(null),i("installing");try{const K=await Ne.installCodex();if(K.ok||K.state!=="not-installed"){i(K.state);return}u({detail:K.detail,command:K.fallbackCommand,docsUrl:K.docsUrl}),i(K.state)}catch(K){u({detail:K.message,command:"npm install -g @openai/codex"}),i("not-installed")}},R=async()=>{u(null),i("signing-in");const K=Date.now();E(),C.current=window.setInterval(()=>{if(Date.now()-K>ree){E(),i("not-authenticated"),u({detail:"Sign-in did not finish. Try again, or use the command below.",command:"codex login"});return}Ne.codexStatus().then(({state:F})=>{F==="ready"&&(E(),i("ready"))}).catch(()=>{})},nee);try{const F=await Ne.loginCodex();if(E(),F.ok||F.state==="ready"){i(F.state);return}u({detail:F.detail,command:F.fallbackCommand}),i(F.state)}catch(F){E(),u({detail:F.message,command:"codex login --device-auth"}),i("not-authenticated")}},L=s.useRef(null);s.useEffect(()=>()=>{L.current&&window.clearTimeout(L.current)},[]);const H=K=>{var F;(F=navigator.clipboard)==null||F.writeText(K).then(()=>{h(!0),L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>h(!1),1600)})},D=e.filter(K=>K.available&&K.id!=="codex-cli"&&!K.localOnly),B=a==="checking"||a==="installing"||a==="signing-in"||a==="repairing",V=a==="not-installed"||a==="installing"?{step:0,label:"Install Codex CLI",verb:a==="installing"?"Installing":"Install",busy:a==="installing",run:j}:a==="not-authenticated"||a==="signing-in"?{step:1,label:"Sign in with ChatGPT",verb:a==="signing-in"?"Waiting for your browser":"Sign in",busy:a==="signing-in",run: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,W=a==="not-installed"||a==="installing"||a==="not-authenticated"||a==="signing-in";return o.jsxs(o.Fragment,{children:[o.jsx(iR,{title:"Set up image generation"}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(lR,{engineId:"codex-cli",name:"Codex CLI",state:iee[a],ready:a==="ready",busy:B}),o.jsx("p",{className:"sc-setup-lead",children:lee[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(cee,{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:eee(y)}),a==="ready"&&k.length>0&&o.jsxs("p",{className:"sc-setup-note",children:[tee(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(Gn,{size:14}):o.jsx(ep,{size:14}),f?"Copied":"Copy"]})]}),p==="windows"&&o.jsxs("p",{className:"sc-setup-note",children:["Installed with the standalone installer instead? Update it in PowerShell:"," ",o.jsx("code",{children:"irm https://chatgpt.com/codex/install.ps1 | iex"})]})]}),a==="no-plan"&&D.length>0&&o.jsxs("p",{className:"sc-setup-note",children:[D.map(K=>il(K.displayName)).join(", ")," is already connected, so you can generate now."]}),l&&o.jsxs("div",{className:"sc-setup-problem",children:[o.jsxs("p",{"data-detail":"",children:[o.jsx(nm,{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(Gn,{size:14}):o.jsx(ep,{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(mc,{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:P,children:[o.jsx(Jh,{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:P,children:[o.jsx(Jh,{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(gE,{size:15})," Add a provider key"]}),o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:()=>void A(),children:"Back to Codex setup"})]}),W&&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 iee={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"},lee={checking:()=>"Checking that Codex can actually reach OpenAI from this computer.","not-installed":()=>"Scenri generates with Codex CLI, a small official helper from OpenAI that runs on this computer and uses your own ChatGPT plan. It needs to be installed once.",installing:()=>"Scenri generates with Codex CLI, a small official helper from OpenAI that runs on this computer and uses your own ChatGPT plan. It needs to be installed once.","not-authenticated":()=>"Codex CLI is installed. Sign in with the ChatGPT account whose plan should cover your images. This opens your browser, and Scenri never sees your password or token.","signing-in":()=>"Codex CLI is installed. Sign in with the ChatGPT account whose plan should cover your images. This opens your browser, and Scenri never sees your password or token.",ready:()=>"Codex CLI is ready. Your images run on your own ChatGPT plan, and Scenri adds nothing to the bill.","env-conflict":()=>"Codex is signed in, but an old OpenAI API key on this computer is being used instead of your ChatGPT plan, and OpenAI turned it down.",repairing:()=>"Codex is signed in, but an old OpenAI API key on this computer is being used instead of your ChatGPT plan, and OpenAI turned it down.",unverified:()=>"Scenri could not verify Codex on this computer. Something answered too slowly or not at all, so nothing is assumed to work.","update-needed":e=>`${e??"Codex CLI on this computer is too old for Scenri."} Update it once, then check again.`,"no-plan":()=>"Codex CLI draws on a ChatGPT plan, so without one there is nothing behind it to generate your images."};function lR({engineId:e,name:t,state:n,ready:r,busy:a}){const i=YM(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(qM,{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(Rr,{size:"1"}):r?o.jsx("span",{className:"d"}):null,n]})]})]})}function cee({phase:e,act:t}){const{installed:n,signedIn:r,connected:a}=JJ(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(Gn,{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(Rr,{size:"1"}):null,t.verb,g?null:o.jsx(ma,{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 uee(){const{brands:e}=Dn(),t=cR(e);return t?o.jsx(Ka,{to:No(t),replace:!0}):o.jsx(Ka,{to:"/setup",replace:!0})}function cR(e){const t=uG();return e.find(n=>n.id===t)??e[0]??null}const dee=48;function fee(e,t,n=dee){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&&Lu(u[u.length-1],a)<0)continue;r??(r=[...e]);let f=0;for(;f<r.length&&Lu(r[f],a)<=0;)f++;r.splice(f,0,a),r.length>n&&(r.length=n)}return r??e}const uR='[data-guide="library.new"]',kd=(e,t)=>({id:"go",voice:"ask",point:`[data-guide="nav.${e}"]`,side:"bottom",soft:!0,...t}),hee='[data-guide="compose"] .sc-attachpanel',pee='[data-guide="compose"] .sc-attachpanel .sc-ap-body',yp='[data-guide="compose"] .sc-promptcard',mee='[data-guide="compose.add"]',dR='[data-guide="compose"] .sc-brief-line',bp='[data-guide="compose.send"]',fR='[data-guide="compose.engine"]',Ku=".sc-pstudio",m4=`${Ku} .sc-convo-card`,gee=".sc-newdlg-layer",Gu=".sc-ovl",jn={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."}},ll=e=>`.sc-feed .sc-cell[data-fb-node="${e}"]`,Hw=e=>e.status==="done"&&e.images>0,Ow=e=>e.status==="error"||e.status==="cancelled"||e.status==="done"&&e.images===0,g4=e=>e.products+e.presenters+(e.scene?1:0)+e.others,Y5={product:"Products",presenter:"Presenters",scene:"Scenes"};function hR(e){if(!e.here)return e.heading?kd("create",jn.go):null;const t=e.composer,n=e.nodes.find(Hw);if(n)return{id:"result",voice:"note",point:ll(n.id),side:"bottom",...jn.result,done:!0};const r=e.nodes.find(u=>u.status==="running");if(r)return{id:"waiting",voice:"note",point:ll(r.id),side:"bottom",...jn.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||g4(t)>0||t.words,i=e.nodes.find(Ow);if(i&&!a)return{id:"failed",voice:"note",point:ll(i.id),side:"bottom",...jn.failed};if(t.engine!=="ready")return{id:"engine",voice:"ask",point:fR,side:"top",...jn.engine};if(!e.begun&&g4(t)===0&&!t.words)return{id:"intro",voice:"ask",live:[],start:!0,...jn.intro};const l=mR(t);return l?v4(l,t.pickerOpen):{id:"make",voice:"ask",point:bp,live:[dR,bp],side:"top",...jn.make}}function pR(e){if(!e.here)return e.heading?kd("create",jn.go):null;const t=e.composer,n=e.nodes.find(Hw);if(n)return{id:"again",voice:"note",point:ll(n.id),side:"bottom",...jn.reuseResult,done:!0};const r=e.nodes.find(l=>l.status==="running");if(r)return{id:"waiting",voice:"note",point:ll(r.id),side:"bottom",...jn.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||g4(t)>0||t.words,i=e.nodes.find(Ow);return i&&!a?{id:"failed",voice:"note",point:ll(i.id),side:"bottom",...jn.failed}:t.engine!=="ready"?{id:"engine",voice:"ask",point:fR,side:"top",...jn.engine}:t.products===0?v4("product",t.pickerOpen,jn.reuseProduct):t.scene?{id:"make",voice:"ask",point:bp,live:[dR,bp],side:"top",...jn.make}:v4("scene",t.pickerOpen,jn.reuseScene)}function mR(e){return e.products===0?"product":e.presenters===0?"presenter":e.scene?null:"scene"}function v4(e,t,n){const r=n??jn[e];return t?{id:e,voice:"ask",point:hee,live:[pee],lit:[yp],beside:!0,side:"right",...r}:{id:e,voice:"ask",point:mee,side:"top",...r}}const gR=`${Gu} .sc-promptcard`,vee=`${Gu} .sc-stage-img`,q5=`${Gu} .sc-trail`,X5=".sc-feed";function wee(e){if(e.heading)return kd("create",jn.refineGo);if(!e.here)return null;if(!e.open&&!e.armed)return{id:"choose",voice:"ask",point:X5,live:[X5],beside:!0,side:"left",...jn.refineChoose};const t=e.nodes.find(Hw);if(t)return e.open?{id:"refined",voice:"note",shell:Gu,point:q5,side:"top",...jn.refineResult,done:!0}:{id:"refined",voice:"note",point:ll(t.id),side:"bottom",...jn.refineResult,done:!0};if(e.nodes.some(r=>r.status==="running"))return{id:"refining",voice:"quiet"};const n=e.nodes.find(Ow);return n&&!e.asking?e.open?{id:"refine-failed",voice:"note",shell:Gu,point:q5,side:"top",...jn.refineFailed}:{id:"refine-failed",voice:"note",point:ll(n.id),side:"bottom",...jn.refineFailed}:e.open?{id:"ask",voice:"ask",shell:Gu,point:gR,also:[vee],beside:!0,side:"left",...jn.refineAsk}:{id:"ask",voice:"ask",point:yp,live:[yp],beside:!0,side:"top",...jn.refineAsk}}function vR(e){if(e.heading)return kd("presenters",jn.presenterGo);const t=e.studio;if(t){const n=`${Ku} [data-turn="q:${t.open}"]`,r=(a,i,l=[],u)=>({id:a,voice:"ask",shell:Ku,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",jn.presenterStart,[m4]);case"noengine":return r("engine",jn.presenterEngine);case"identity":case"revision":return r("face",jn.presenterFace,[".sc-pstudio-well",m4],[`${Ku} [data-turn]:has(+ [data-turn="q:${t.open}"])`]);case"save":return r("save",jn.presenterSave);default:return{id:"studio",voice:"quiet"}}}return e.onPage?{id:"new",voice:"ask",point:uR,side:"bottom",...jn.presenterNew}:null}function yee(e,t){return{id:e,voice:"ask",shell:gee,point:".sc-newdlg",beside:!0,side:"left",...t}}function wR(e){return{id:"new",voice:"ask",point:uR,side:"bottom",...e}}function bee(e){var n,r;if(e.heading)return kd("scenes",jn.sceneGo);const t=e.studio;if(t){const a=`${Ku} [data-turn="q:${t.open}"]`,i=(l,u)=>({id:l,voice:"ask",shell:Ku,point:`${a} .sc-convo-ask`,live:[a],also:[m4],beside:!0,side:"left",...u});return t.open==="source"?i("start",jn.sceneStart):(n=t.open)!=null&&n.startsWith("agree-")?i("words",jn.sceneWords):(r=t.open)!=null&&r.startsWith("decide-")?{id:"use",voice:"quiet"}:{id:"studio",voice:"quiet"}}return e.onPage?wR(jn.sceneNew):null}function xee(e){return e.heading?kd("products",jn.productGo):e.dialogOpen?yee("product",jn.productMake):e.onPage?wR(jn.productNew):null}function yR(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 kee(e,t,n){return e?yR(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 See(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 Eee={"first-shot":"shot",reuse:"shot",refine:"refine",product:"product",presenter:"presenter",scene:"scene"};function bh(e,t){return!(!t.eligible||t.hidden||t.active&&(t.active.task===e||t.active.task==="first-shot")||t.done[Eee[e]]||t.dismissed.includes(e)||e==="refine"&&!t.done.shot)}function Cee(e){return e.onMainPage&&e.eligible&&e.welcome===null&&e.ready&&e.visible&&!e.blocked&&!e.busy}const $u={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 jee(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 Aee(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 Nee="https://github.com/tonygorb/scenri";function Mee(){var S,C;const e=mn(ht.hub),t=mn(ht.set),n=!!e||!!t,r=Zc(),a=Mm(),i=!!((S=a.status)!=null&&S.available),l=i&&!a.dismissed||r.unread,u=Ml(),f=Rl(),h=bN(),p=oY(),{engines:m}=Dn(),g=!m.some(E=>E.available),{brand:w}=un(),{pathname:y}=Un(),b=s.useRef(!1),k=fp(w);return o.jsx("div",{className:"sc-help-float",children:o.jsxs(ys,{children:[o.jsx(dr,{label:"Help",children:o.jsx(bs,{children:o.jsxs("button",{type:"button",className:"sc-icon-btn sc-help-btn","aria-label":"Help",children:[o.jsx(rF,{size:16}),l&&o.jsx("span",{className:"sc-upd-dot","aria-hidden":"true"})]})})}),o.jsxs(xs,{align:"end",side:"top",sideOffset:8,className:"sc-menu sc-help-menu",onCloseAutoFocus:E=>{b.current&&(E.preventDefault(),b.current=!1)},children:[i&&o.jsxs(Xn,{className:"sc-menu-item","data-update":"",onSelect:()=>u("updates"),children:[o.jsx(k7,{size:18,className:"sc-menu-ic"}),o.jsxs("span",{className:"sc-menu-lb",children:["Update available · ",(C=a.status)==null?void 0:C.latest]})]}),o.jsxs(o.Fragment,{children:[o.jsxs(Xn,{className:"sc-menu-item",onSelect:()=>{t4.current="help",h()},children:[o.jsx(BI,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Learn"})]}),o.jsxs(Xn,{className:"sc-menu-item",onSelect:()=>p(),children:[o.jsx(UI,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:$u.again})]})]}),n&&o.jsxs(Xn,{className:"sc-menu-item",onSelect:()=>window.dispatchEvent(new Event("scenri:shortcuts")),children:[o.jsx(GI,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Keyboard shortcuts"})]}),o.jsx(Xn,{className:"sc-menu-item",asChild:!0,children:o.jsxs(Zn,{to:k,onClick:E=>{!E.metaKey&&!E.ctrlKey&&!E.shiftKey&&!E.altKey&&y!==k&&(b.current=!0)},children:[o.jsx(YI,{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(Xn,{className:"sc-menu-item",onSelect:()=>f(),children:[o.jsx(W0,{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(Xn,{className:"sc-menu-item",onSelect:()=>u("about"),children:[o.jsx(Jp,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"About Scenri"})]}),o.jsx(Xn,{className:"sc-menu-item",asChild:!0,children:o.jsxs("a",{href:Nee,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(zI,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Scenri on GitHub"})]})})]})]})})}function Ree(){return o.jsx(Mee,{})}const Pee={composer:null,overlay:null,studio:null,showing:!1};let Xa=Pee;const w4=new Set;function Zm(e){Xa=e;for(const t of w4)t()}const Iw=(e,t)=>e===t||JSON.stringify(e)===JSON.stringify(t);function Q5(e){Iw(Xa.composer,e)||Zm({...Xa,composer:e})}function J5(e){Iw(Xa.overlay,e)||Zm({...Xa,overlay:e})}function xp(e){Iw(Xa.studio,e)||Zm({...Xa,studio:e})}function ek(e){Xa.showing!==e&&Zm({...Xa,showing:e})}function bR(e){return w4.add(e),()=>w4.delete(e)}function Lee(){return Xa}function xR(){return s.useSyncExternalStore(bR,Lee)}function $ee(){return s.useSyncExternalStore(bR,()=>Xa.showing)}function kR(e){return e.milestones.map(t=>t.label)}const Yi=[{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"}],y4={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 Tee(e){return Yi.find(t=>t.id===e)??null}function Dee(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 Hee(e,t){return e.find(n=>t(n)!=="done")??null}const Fw=Object.fromEntries(Yi.map(e=>[e.id,Object.fromEntries(e.milestones.flatMap((t,n)=>t.moments.map(r=>[r,n])))]));function SR(e,t){let n=0;for(const r of t){const a=Fw[e][r];a!==void 0&&a>n&&(n=a)}return n}function Oee(e,t){return SR(e,t)>0}function Iee(e,t){var a;const n=Fw[e][t],r=((a=Yi.find(i=>i.id===e))==null?void 0:a.milestones.length)??0;return n===void 0||!r?null:{at:n+1,of:r}}const S8=e=>e.status==="done"&&e.images>0;function tk(e,t,n){const r=SR(e,t);return n?Math.max(Fee(e,n),r):r}function Fee(e,t){const n=t.moment?Fw[e][t.moment]:void 0;if(n!==void 0)return n;switch(e){case"first-shot":return t.nodes.some(S8)?5:t.nodes.length>0?4:0;case"reuse":return t.nodes.some(S8)?4:t.nodes.length>0?3:0;case"presenter":return t.draft?3:0;case"refine":return t.nodes.some(S8)||t.nodes.some(r=>r.status==="running")?3:0;default:return 0}}const b4={"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 _ee({open:e,pictures:t,note:n,onTake:r,onDecline:a}){return o.jsxs(Fs,{open:e,className:"sc-welcome",maxWidth:"440px",described:!0,tone:"guide",onDismiss:a,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsxs(ks,{className:"sc-newdlg-title",children:["Welcome to ",o.jsx("span",{className:"sc-accent",children:"Scenri"})]}),o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":$u.notNow,children:o.jsx(Rn,{size:16})})})]}),o.jsx(Ec,{className:"sc-welcome-lede",children:$u.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:$u.notNow}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:r,children:$u.take})]})]})}const nk=e=>e.t!=="format",_a=()=>[{t:"text",v:""}],Wa=e=>e.t==="product"?`p:${e.id}`:e.t==="template"?`t:${e.id}`:e.t==="ref"?`r:${e.imageHash}`:zm(e);function Vee(e,t){const n=new Set,r=l=>{const u=Wa(l);return u?n.has(u)?!1:(n.add(u),!0):!0},a=e.filter(nk).filter(r),i=t.filter(nk).filter(r);return{own:a,carried:i}}function _w(e){const{own:t,carried:n}=Vee(e.tokens??[],e.inherited??[]),r=[...t,...n],a=r.length?r:_a(),i=a.some(l=>l.t==="template");return e.templateId&&!i?[{t:"template",id:e.templateId},...a]:a}const sc="sc-token",Xf=`.${sc}`,zm=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}`:"",gs=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},ai="\uFEFF",Ll=//g,pc=e=>!!e&&e.nodeType===Node.TEXT_NODE&&e.textContent===ai,ER=e=>{var t;return e.length-(((t=e.match(Ll))==null?void 0:t.length)??0)};function go(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)?Sp(e,n.startContainer,n.startOffset):null}function Va(e,t){if(!e)return;let n=0;for(const r of Array.from(e.childNodes)){const a=id(r);if(r.nodeType===Node.TEXT_NODE){if(t<=n+a){Eo(e,r,kp(r,t-n));return}}else if(t<=n+a){const i=r.nextSibling;if((i==null?void 0:i.nodeType)===Node.TEXT_NODE){Eo(e,i,kp(i,0));return}break}n+=a}ac(e)}function kp(e,t){const n=e.textContent??"";if(n===ai)return 1;let r=0,a=0;for(;a<n.length&&r<t;)n[a]!==ai&&(r+=1),a+=1;return a}function ac(e){if(!e)return;e.focus({preventScroll:!0});const t=e.lastChild;if((t==null?void 0:t.nodeType)===Node.TEXT_NODE){Eo(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 Zee(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 Eo(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 id=e=>e.nodeType===Node.TEXT_NODE?ER(e.textContent??""):1;function Sp(e,t,n){if(t===e){let a=0;for(let i=0;i<n&&i<e.childNodes.length;i++)a+=id(e.childNodes[i]);return a}let r=0;for(const a of Array.from(e.childNodes)){if(a===t)return r+ER((a.textContent??"").slice(0,n));if(a.contains(t))return r+1;r+=id(a)}return r}function wo(e){var n,r;if(!e)return;const t=go(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(Ll,""),u=l.length?l:i.length?ai:"";u!==i&&(a.textContent=u),u||a.remove()}for(const a of Array.from(e.childNodes))pc(a)&&!$s(a.previousSibling)&&!$s(a.nextSibling)&&a.remove();for(const a of Array.from(e.childNodes))$s(a)&&(((n=a.previousSibling)==null?void 0:n.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(ai),a),((r=a.nextSibling)==null?void 0:r.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(ai),a.nextSibling));A0(e)||t!==null&&Va(e,t)}function zee(e){var n,r,a;if(!e)return!0;const t=e.childNodes;for(let i=0;i<t.length;i++){const l=t[i];if($s(l)){if(((n=l.previousSibling)==null?void 0:n.nodeType)!==Node.TEXT_NODE||((r=l.nextSibling)==null?void 0:r.nodeType)!==Node.TEXT_NODE)return!1;continue}if(l.nodeType!==Node.TEXT_NODE)continue;const u=l.textContent??"";if(!u||((a=t[i+1])==null?void 0:a.nodeType)===Node.TEXT_NODE||u.includes(ai)&&(u!==ai||!$s(l.previousSibling)&&!$s(l.nextSibling)))return!1}return!0}function Bee(e){return e.querySelector(Xf)?!1:!(e.textContent??"").replace(/[​ ]/g,"").trim()}function A0(e){if(!e)return!1;const t=Bee(e);return t&&e.firstChild&&e.replaceChildren(),e.toggleAttribute("data-empty",t),t}const $s=e=>!!e&&e.nodeType===Node.ELEMENT_NODE&&e.classList.contains(sc);function Vw(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 rk(e){var a;if(!e)return _a();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(Ll,"");continue}const l=i,u=(a=l.dataset)==null?void 0:a.tok;if(u){const f=gs(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 sk(e,t,n){if(e){e.textContent="";for(const r of Uee(t)){if(r.t==="text"){r.v&&e.appendChild(document.createTextNode(r.v));continue}e.appendChild(n(r))}wo(e)}}function Uee(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 E8(e,t){for(const n of Array.from(e.querySelectorAll(Xf))){const r=gs(n.dataset.tok??"");if(r&&Wa(r)===t)return n}return null}function CR(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 jR(){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 uc(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;Eo(e,a,pc(a)?1:n==="after"?0:a.length)}const Ep=9;function AR(e){if(!e.firstChild)return[];const t=document.createRange();return t.selectNodeContents(e),Array.from(t.getClientRects()).filter(n=>n.height>0)}function NR(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 ak(e,t,n){if(!e)return!1;const r=AR(e),a=NR(r,n);if(!a)return!1;const i=a.top+a.height/2;for(const u of Array.from(e.querySelectorAll(Xf))){const f=u.getBoundingClientRect();if(!(f.bottom<a.top||f.top>a.bottom)&&!(t<f.left-Ep||t>f.right+Ep))return uc(e,u,t<f.left+f.width/2?"before":"after"),!0}if(n>=a.top&&n<=a.bottom)return!1;const l=MR(t,i);return!l||!e.contains(l.node)||l.node.nodeType!==Node.TEXT_NODE?!1:(Eo(e,l.node,l.offset),!0)}function Wee(e,t,n){if(!e)return null;const r=NR(AR(e),n);if(!r)return null;const a=r.top+r.height/2;for(const l of Array.from(e.querySelectorAll(Xf))){const u=l.getBoundingClientRect();if(!(u.bottom<r.top||u.top>r.bottom)&&!(t<u.left-Ep||t>u.right+Ep))return{beside:l,side:t<u.left+u.width/2?"before":"after"}}const i=MR(t,a);return!i||!e.contains(i.node)?null:{node:i.node,offset:i.offset}}function MR(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 Kee(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){Va(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=Xee(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)}wo(e),Va(e,Qa(e,t)+1)}const Gee=["$","/","@","#"],Yee=e=>Gee.includes(e),Cp=e=>e===" "||e===`
100
- `||e===" "||e===ai;function qee(e){const t=CR(e);for(let n=t.length-1;n>=0;n--){const r=t[n];if(Cp(r))return null;if(Yee(r))return n===0||Cp(t[n-1])?{sigil:r,query:t.slice(n+1)}:null}return null}function Xee(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 C8(e,t){if(!e||!t)return;e.normalize();const n=Qa(e,t);t.remove(),wo(e),Va(e,n)}function Qa(e,t){let n=0;for(const r of Array.from(e.childNodes)){if(r===t)break;n+=id(r)}return n}function Qee(e,t){var u,f;const n=Vw(e);if(!n||!e)return!1;const{text:r,at:a}=n,i=pc(r);if(t==="right"){if(!$s(r.nextSibling)||!i&&a!==r.length)return!1;const h=(u=r.nextSibling)==null?void 0:u.nextSibling;return(h==null?void 0:h.nodeType)!==Node.TEXT_NODE?!1:(Eo(e,h,pc(h)?1:0),!0)}if(!$s(r.previousSibling)||!i&&a!==0)return!1;const l=(f=r.previousSibling)==null?void 0:f.previousSibling;return(l==null?void 0:l.nodeType)!==Node.TEXT_NODE?!1:(Eo(e,l,pc(l)?1:l.length),!0)}function ok(e,t){const n=Vw(e);if(!n)return null;const{text:r,at:a}=n,i=pc(r);return t==="Backspace"?$s(r.previousSibling)&&(i||a===0)?r.previousSibling:null:$s(r.nextSibling)&&(i||a===r.length)?r.nextSibling:null}function ik(e,t){const n=Vw(e);return!n||!pc(n.text)?!1:t==="Backspace"?!n.text.previousSibling:!n.text.nextSibling}function Jee(e,t){const n=go(e);if(!e||n==null)return null;const r=Array.from(e.childNodes).filter($s);if(t==="forward")return r.find(a=>Qa(e,a)>=n)??null;for(let a=r.length-1;a>=0;a--)if(Qa(e,r[a])<n)return r[a];return null}const Yu=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function ete(e){let t="",n="",r=!1;const a=i=>{var f;if(i.nodeType===Node.TEXT_NODE){const h=(i.textContent??"").replace(Ll,"");if(!h)return;t+=h,n+=Yu(h),r=!1;return}const l=i,u=(f=l.dataset)==null?void 0:f.tok;if(u){const h=Yo(l);t+=(r?" ":"")+h,r=!0,n+=`<span data-sc-tok="${Yu(u)}">${Yu(h)}</span>`;return}i.childNodes.forEach(a)};return e.cloneContents().childNodes.forEach(a),{text:t,html:`<span data-sc-brief="1">${n}</span>`}}function tte(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(Yu(l));continue}const i=t(a);n.push(i),r.push(`<span data-sc-tok="${Yu(zm(a))}">${Yu(i)}</span>`)}return{text:n.join(" "),html:`<span data-sc-brief="1">${r.join(" ")}</span>`}}function Yo(e){var t;return(((t=e.querySelector(".sc-token-label"))==null?void 0:t.textContent)??"").trim()}function nte(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(Ll,"");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=gs(u);r.push(f??l.textContent??"")};return n.childNodes.forEach(a),r.length?r:null}function RR(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=Qf(e);return r.filter((i,l)=>l===r.length-1||!/^[ \n]*$/.test(a.slice(i,r[l+1])))}const Qf=e=>e.map(t=>t.t==="text"?t.v:"").join(""),Zw=(e,t,n)=>{const r=n<=t?e.slice(n,t):e.slice(t+1,n);return/^[ \n]*$/.test(r)};function rte(e,t){const n=Qf(e);return RR(e).filter(r=>!Zw(n,t,r))}function ste(e,t){return e.find(n=>n>=t)??(e.length?e[e.length-1]:null)}function ate(e,t){let n=null,r=1/0;for(const a of e){const i=Math.abs(a-t);i<r&&(r=i,n=a)}return n}function PR(e,t,n){if(!e||!t.parentNode)return!1;const r=Qa(e,t);if(Zw(Qf(Bm(e)),r,n))return!1;let a=null,i=0;for(const l of Array.from(e.childNodes)){const u=id(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(kp(l,f))}else a=n===i?l:l.nextSibling;break}i+=u}return a===t?!1:(t.remove(),e.insertBefore(t,a),wo(e),!0)}function lk(e,t,n){if(!e)return!1;const r=Qa(e,t),a=rte(Bm(e),r),i=n===-1?[...a].reverse().find(l=>l<r):a.find(l=>l>r+1);return i===void 0?!1:PR(e,t,i)}function ote(e,t){if(!e)return t;const n=Qf(Bm(e));let r=t;for(;r>0&&(n[r-1]===" "||n[r-1]===`
102
- `);)r-=1;return r}function ck(e,t,n,r){if(!e)return null;const a=Wee(e,n,r);if(!a)return null;const i=Bm(e),l=Qa(e,t),u=RR(i),f="beside"in a?Qa(e,a.beside)+(a.side==="before"?0:1):a.node.nodeType===Node.TEXT_NODE||a.node===e?Sp(e,a.node,a.offset):null;if(f===null)return null;const h="beside"in a&&a.side==="after"?ste(u,f):ate(u,f);return h===null?null:{units:h,noop:Zw(Qf(i),l,h)}}function x4(e,t){const n=Yo(t)||"the chip",r=ite(t);if(r)return`Moved ${n} before ${r}.`;const a=lte(t);return a?`Moved ${n} after ${a}.`:Qa(e,t)===0?`Moved ${n} to the start of the brief.`:`Moved ${n} to the end of the brief.`}const LR=3;function ite(e){for(let t=e.nextSibling;t;t=t.nextSibling){if($s(t))return Yo(t)||null;const n=(t.textContent??"").replace(Ll,"").trim();if(n)return`"${n.split(/\s+/).slice(0,LR).join(" ")}"`}return null}function lte(e){for(let t=e.previousSibling;t;t=t.previousSibling){if($s(t))return Yo(t)||null;const n=(t.textContent??"").replace(Ll,"").trim();if(n)return`"${n.split(/\s+/).slice(-LR).join(" ")}"`}return null}function Bm(e){const t=[];let n="";for(const r of Array.from(e.childNodes)){if(r.nodeType===Node.TEXT_NODE){n+=(r.textContent??"").replace(Ll,"");continue}n&&(t.push({t:"text",v:n}),n=""),t.push({t:"ref",imageHash:""})}return n&&t.push({t:"text",v:n}),t}function k4(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 u0=e=>(e==null?void 0:e.querySelector('[data-kind="template"]'))??null,Ui=e=>{var t;return((t=e==null?void 0:e.closest)==null?void 0:t.call(e,Xf))??null};function j8(e,t,n={}){var a;if(!e)return!1;let r=!1;for(let i=0;i<32;i++){const l=ute(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)};hte(e,l.node,l.start,l.end,t(u)),r=!0}return r&&wo(e),r}function cte(e,t){var i;e.dataset.kind="color",e.dataset.tok=zm(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 ute(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=fte(a.textContent??"",t,(u,f)=>dte(a,f,u)),l=i[i.length-1];if(l)return{node:a,...l}}return null}function dte(e,t,n){if(n>0)return Cp(t[n-1]);const r=e.previousSibling;if(!r||$s(r))return!0;if(r.nodeType===Node.TEXT_NODE){const a=r.textContent??"";return!a.length||Cp(a[a.length-1]??"")}return!0}function fte(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=yQ(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 hte(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&&Eo(e,m,Math.min(h,(m.textContent??"").length));return}if(h<=r||!u.length){Eo(e,t,t.length);return}Eo(e,t,Math.min(h-r,t.length))}}function qu(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 pte(){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 d0="data-sc-coach-inert",mte=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function gte(e=document.body){let t=new Set;const n=a=>{a.hasAttribute("inert")&&!a.hasAttribute(d0)||(a.setAttribute(d0,""),a.setAttribute("inert",""))},r=a=>{a.hasAttribute(d0)&&(a.removeAttribute(d0),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)||mte.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(d0)))},release(){for(const a of t)r(a);t=new Set}}}const Bh=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),oi=e=>e.right-e.left,xo=e=>e.bottom-e.top;function $R(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 f0(e,t){return{left:e.left-t,top:e.top-t,right:e.right+t,bottom:e.bottom+t}}function uk(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 TR(e,t){return e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom}function dk(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 oi(n)>0&&xo(n)>0?n:null}function fk(e,t){let{top:n,bottom:r}=e;const a=(e.top+e.bottom)/2;for(const i of t)TR(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 vte=e=>e==="top"||e==="bottom";function wte(e,t,n){return t?vte(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 hk=e=>e==="top"?"bottom":e==="bottom"?"top":e==="left"?"right":"left",Ps=e=>Math.round(e*2)/2;function yte(e,t,n){const r=Ps(t),a=Ps(n),i=e.map(u=>{const f=Math.max(0,Ps(oi(u))),h=Math.max(0,Ps(xo(u))),p=Ps(Math.max(0,Math.min(u.radius,f/2,h/2)));return`<rect x='${Ps(u.left)}' y='${Ps(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 bte(e,t,n,r){const a=Ps(t),i=Ps(n),l=e.map(p=>{const m=Math.max(0,Ps(oi(p))),g=Math.max(0,Ps(xo(p))),w=Ps(Math.max(0,Math.min(p.radius,m/2,g/2)));return{x:Ps(p.left),y:Ps(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 xte(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=>oi(a)>0&&xo(a)>0)}const pk=0,kte=10,A8=14,h0=4,N8="data-guide-stage",Ste="rgba(255,255,255,0.05)",S4="[data-guide-shape]",mk=[],Ete="[data-radix-popper-content-wrapper], .sc-setpop, .sc-morepop, .sc-shotsheet, .sc-note-pop",gk='input, textarea, [contenteditable]:not([contenteditable="false"])',Cte=17,xh=12,jte=20,Ate=450,Nte=768,vk=90,Mte=8,wk=12,Rte=2e3,Pte=".sc-topbar, .sc-tabbar, .sc-filterbar, .sc-canvas-dock, .sc-help-float, .sc-pstudio-head, .sc-newdlg-head",Lte=120,$te="[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",M8=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 Tte(e){const{id:t,voice:n,target:r,live:a,side:i,container:l,onShown:u}=e,f=e.lit??mk,h=e.also??mk,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),C=s.useRef(null),E=s.useRef(null),A=s.useRef(null),P=s.useRef(null),T=s.useRef(null),M=s.useRef(null),j=s.useRef(null),[R,L]=s.useState("moving"),[H]=s.useState(_te),[D,B]=s.useState(()=>M8(e)),V=s.useRef(e);V.current=e;const W=s.useRef(!1),K=s.useRef(null),F=s.useRef([]),_=R==="shown"&&D.id===t?M8(e):D,O=R8(a),Y=R8(h),z=R8(f);s.useEffect(()=>{if(p)return j.current=gte(l),()=>{var Z;(Z=j.current)==null||Z.release(),j.current=null;for(const J of F.current)J.removeAttribute(N8);F.current=[]}},[p,l]),s.useLayoutEffect(()=>{var _t,Lt,Zt;const Z=b.current,J=k.current,me=S.current,ne=C.current,fe=E.current,re=A.current;if(p&&(!me||!ne||!fe||!re)||g&&(!Z||!J))return;let ee=!0,Q=0,he=0,Me=!1,ce=!1,ke="",Be=0,ft=0,Ue=0,Qe=null,Pe=null,G=null;const se=window.matchMedia("(prefers-reduced-motion: reduce)").matches,We=a[0]??r??l;let Ze="",oe=r?kh(r):null;L("moving");const q=()=>{var Mt;return(Mt=j.current)==null?void 0:Mt.set([...Z?[Z]:[],...me?[me]:[],...ne?[ne]:[],...fe?[fe]:[],...re?[re]:[],...a,...h,...[...document.querySelectorAll($te)].filter($t=>![...a,...h].some(Se=>$t.contains(Se)))])},ae=()=>{var Mt,$t;(Mt=j.current)==null||Mt.release(),ce=!1,L("away"),($t=r??a[0])!=null&&$t.isConnected&&Je()};if(p&&j.current&&W.current){q(),ce=!0;const Mt=a.find(Se=>Se.matches(gk)),$t=document.activeElement;Mt&&!a.some(Se=>Se.contains($t))&&yk(Mt)}const Le=async()=>{const Mt=++Q;if(r&&!r.isConnected||a.some(te=>!te.isConnected))return ae(),V.current.onLost();const $t=window.innerWidth,Se=window.innerHeight,Ke=window.visualViewport,kt=[{left:0,top:0,right:$t,bottom:Se},...Ke?[{left:Ke.offsetLeft,top:Ke.offsetTop,right:Ke.offsetLeft+Ke.width,bottom:Ke.offsetTop+Ke.height}]:[]],qe=te=>{const ie=te===r?oe:kh(te);return ie?[...kt,Bh(ie.getBoundingClientRect())]:kt},ot=Dte(We,l),rt=ot.filter(te=>oi(te)>$t/3),tn=r?dk(Bh(r.getBoundingClientRect()),qe(r)):null,Qt=tn&&fk(tn,rt);if(r&&!Qt)return!Me&&Ue<wk&&(Ue++,oe=kh(r),P8(r,oe,se).then(()=>ee&&ge())),ae();const on=[],Wt=[];for(const te of[...r?[r]:[],...a,...h,...f,...bk()]){const ie=xk(te);Wt.includes(ie)||Wt.push(ie)}const zt=new Set([...r?[r]:[],...a,...f,...bk()].map(xk));let Ut=null;for(const te of Wt){const ie=dk(Bh(te.getBoundingClientRect()),qe(te)),pe=ie&&fk(ie,rt);if(!pe)continue;const Fe=Uh(te);on.push(Fe>=4||te.matches("img, video, canvas")?{...f0(pe,pk),radius:Fe+pk}:{...f0(pe,kte),radius:A8}),zt.has(te)&&(Ut=Ut?$R(Ut,pe):pe)}if(!m&&!Qt&&!Ut)return ae();if(ce&&(a.some(te=>te.closest("[inert]"))||Z!=null&&Z.closest("[inert]"))&&(ce=!1),p&&me&&ne&&fe&&re){if(!on.length&&Qt){const pe=r,Fe=kk(pe);on.push({...f0(Qt,h0),radius:uk(Uh(pe),Fe.radius,h0,A8,xo(Qt),Fe.height,Fe.count)})}for(const pe of F.current)Wt.includes(pe)||pe.removeAttribute(N8);for(const pe of Wt)pe.setAttribute(N8,"");F.current=Wt;const ie=`${on.map(pe=>[pe.left,pe.top,pe.right,pe.bottom,pe.radius].map(Math.round).join(",")).join("|")}@${$t}x${Se}`;if(ie!==Ze&&(Ze=ie,Fte(me,ne,re,on,H)),r&&Qt){const pe=Bte(r),Fe=kk(r),Oe=pe??f0(Qt,h0);Object.assign(fe.style,{left:`${Oe.left}px`,top:`${Oe.top}px`,width:`${oi(Oe)}px`,height:`${xo(Oe)}px`,borderRadius:`${pe?zte:uk(Uh(r),Fe.radius,h0,A8,xo(Qt),Fe.height,Fe.count)}px`}),fe.hidden=!1}else fe.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(($t-Z.offsetWidth)/2)}px`,Z.style.top=`${Math.round((Se-Z.offsetHeight)/2)}px`,Z.dataset.side="centre",J&&(J.hidden=!0)),Z&&J&&r&&Qt){Z.style.right="";const te={top:xh+Hte(ot,Se),bottom:xh+Ote(ot,Se),left:xh,right:xh},ie=$t>=Nte;Pe!==ie&&(Pe!==null&&r&&(oe=kh(r),P8(r,oe,se)),Qe=null,Pe=ie);const pe=i==="left"||i==="right"?"top":i,Fe=!ie&&oi(Qt)>$t*.6,Oe=ie?i:Fe?`${pe}-start`:pe,mt=($e,Ge)=>oj(Ite($e,r),Z,{strategy:"fixed",placement:Qe??Oe,middleware:[rj(Cte),aj({padding:te,fallbackPlacements:Ge}),sj({padding:te}),L6({element:J,padding:jte})]}),yt=!ie&&Ut?{...Qt,top:Ut.top,bottom:Ut.bottom}:Qt,Et=($e,Ge)=>TR({left:$e,top:Ge,right:$e+Z.offsetWidth,bottom:Ge+Z.offsetHeight},f0(yt,h0)),Ae=ie&&(i==="left"||i==="right")?[hk(i),"top","bottom"]:ie?void 0:Fe?["bottom-start","top-start"]:["bottom","top"],xe=!p&&xo(Qt)>Se*.6,Xe=ie&&(e.beside||a.length>1),Ct=xe?{...Qt,top:Qt.bottom-1}:Xe?wte(Qt,Ut,i):yt;let ve=await mt(Ct,xe?["top"]:Ae);if(!ee||Mt!==Q||!xe&&Et(ve.x,ve.y)&&(ve=await mt(yt,void 0),!ee||Mt!==Q))return;if(!xe&&Et(ve.x,ve.y))return L("stowed");Qe=ve.placement;const lt=ve.placement.split("-")[0];Z.style.left=`${Math.round(ve.x)}px`,Z.style.top=`${Math.round(ve.y)}px`,Z.dataset.side=lt;const dt=ve.middlewareData.arrow;J.dataset.edge=hk(lt),J.style.left=(dt==null?void 0:dt.x)!=null?`${dt.x}px`:"",J.style.top=(dt==null?void 0:dt.y)!=null?`${dt.y}px`:"",J.hidden=!dt||Math.abs(dt.centerOffset)>1}if(p&&!ce&&(q(),ce=!0),!Me){if(Ute([...r?[r]:[],...a])&&++ft<wk){window.setTimeout(ge,vk);return}const te=[...r?[r]:[],...a,...h,...f].map(ie=>{const pe=ie.getBoundingClientRect();return[pe.left,pe.top,pe.right,pe.bottom].map(Math.round).join(",")}).join("|");if(te!==ke&&(ke=te,Be=0),++Be<2&&Be<Mte){window.setTimeout(ge,vk);return}}L("shown"),Me||(Me=!0,et(),Je())};let Ie=0;const Je=()=>{const Mt=r??a[0];if(!Mt)return;cancelAnimationFrame(Ie);let $t=Mt.getBoundingClientRect();const Se=performance.now()+Rte,Ke=()=>{if(!ee)return;const kt=Mt.getBoundingClientRect();(kt.top!==$t.top||kt.left!==$t.left||kt.height!==$t.height)&&($t=kt,ge()),performance.now()<Se&&(Ie=requestAnimationFrame(Ke))};Ie=requestAnimationFrame(Ke)},ge=()=>{cancelAnimationFrame(he),he=requestAnimationFrame(()=>void Le())},et=()=>{W.current=!0;let Mt=!1;if(p&&Z){const $t=kt=>!!kt&&a.some(qe=>qe.contains(kt)),Se=document.activeElement,Ke=a.find(kt=>kt.matches(gk))??null;M.current&&$t(Se)?M.current=null:M.current?(((M.current==="back"?P.current:null)??T.current??Z).focus({preventScroll:!0}),M.current=null):Ke&&!$t(Se)?yk(Ke):(!Se||Se===document.body||Se.closest("[inert]"))&&(Z.focus({preventScroll:!0}),Mt=!0)}u(t,Mt)},nt=W.current&&!se&&g&&K.current!==t?Lte:0;K.current=t,Vte(nt).then(()=>{if(ee)return zr.flushSync(()=>B(M8(V.current))),r?P8(r,oe,se):void 0}).then(()=>{ee&&(G=nj(We,Z??me??We,ge))});const pt=new ResizeObserver(ge);for(const Mt of a)pt.observe(Mt);r&&pt.observe(r),Z&&pt.observe(Z);for(const Mt of[...r?[r]:[],...a]){const $t=(_t=Mt==null?void 0:Mt.closest)==null?void 0:_t.call(Mt,S4);$t&&pt.observe($t)}(Lt=window.visualViewport)==null||Lt.addEventListener("resize",ge),(Zt=window.visualViewport)==null||Zt.addEventListener("scroll",ge);let St=0;const at=p?new MutationObserver(()=>{ce&&(cancelAnimationFrame(St),St=requestAnimationFrame(q))}):null;return at==null||at.observe(l,{childList:!0,subtree:!0}),()=>{var Mt,$t;ee=!1,document.documentElement.style.removeProperty("--sc-coach-h"),cancelAnimationFrame(he),cancelAnimationFrame(Ie),cancelAnimationFrame(St),at==null||at.disconnect(),G==null||G(),pt.disconnect(),(Mt=window.visualViewport)==null||Mt.removeEventListener("resize",ge),($t=window.visualViewport)==null||$t.removeEventListener("scroll",ge)}},[t,p,g,r,O,Y,z,i,l,u,H]),s.useEffect(()=>{if(!g||!r||!Zte(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 J=(r.getAttribute("aria-describedby")??"").split(/\s+/).filter(me=>me&&me!==y);J.length?r.setAttribute("aria-describedby",J.join(" ")):r.removeAttribute("aria-describedby")}},[g,r,y]);const{onEscape:X}=e;return s.useEffect(()=>{if(!p)return;const Z=ee=>!!ee&&a.some(Q=>Q.contains(ee)),J=ee=>{var ke;const Q=b.current,he=ee.target instanceof Node?ee.target:null,Me=Z(he),ce=document.activeElement;if(ee.key==="Escape"){if(ee.defaultPrevented||ce!=null&&ce.closest('[role="dialog"]:not(.sc-coach):not(.sc-attachpanel)')||Me&&(ce!=null&&ce.closest('input, textarea, select, [contenteditable="true"], [role="menu"], [role="listbox"]')))return;ee.preventDefault(),ee.stopPropagation(),X(t);return}Me||(!he||he===document.body||he===document.documentElement||Q!=null&&Q.contains(he)||(ke=C.current)!=null&&ke.contains(he))&&ee.stopPropagation()};let me=0,ne=!1;const fe=ee=>{ne=ee.target instanceof Node&&Z(ee.target)},re=ee=>{ee.relatedTarget||ne||!b.current||(cancelAnimationFrame(me),me=requestAnimationFrame(()=>{var he;if(!document.hasFocus())return;const Q=document.activeElement;(!Q||Q===document.body||Q.closest("[inert]"))&&((he=b.current)==null||he.focus({preventScroll:!0}))}))};return window.addEventListener("keydown",J,!0),window.addEventListener("pointerdown",fe,!0),document.addEventListener("focusout",re,!0),()=>{cancelAnimationFrame(me),window.removeEventListener("keydown",J,!0),window.removeEventListener("pointerdown",fe,!0),document.removeEventListener("focusout",re,!0)}},[t,p,O,X]),zr.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:Ek.map(Z=>o.jsx("div",{className:"sc-coach-panel"},Z))}),o.jsx("div",{ref:C,className:"sc-coach-catch","data-guide":"catch","data-state":R,"aria-hidden":"true",onMouseDown:Z=>Z.preventDefault(),children:Ek.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:E,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(dr,{label:e.closeLabel,children:o.jsx("button",{type:"button",className:"sc-coach-x","aria-label":e.closeLabel,onClick:()=>e.onClose(t),children:o.jsx(Rn,{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:P,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 yk(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}ac(e)}function bk(){return[...document.querySelectorAll(Ete)].filter(e=>e.getClientRects().length>0)}function R8(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 Dte(e,t){const n=[];for(const r of document.querySelectorAll(Pte))t.contains(r)&&(r.contains(e)||e.contains(r)||r.getClientRects().length===0||n.push(Bh(r.getBoundingClientRect())));return n}function Hte(e,t){return Math.max(0,...e.filter(n=>n.top<=0&&n.bottom<t/3).map(n=>n.bottom))}function Ote(e,t){return Math.max(0,...e.filter(n=>n.bottom>=t&&n.top>t*2/3).map(n=>t-n.top))}function Ite(e,t){const n={x:e.left,y:e.top,left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:oi(e),height:xo(e)};return{getBoundingClientRect:()=>n,contextElement:t}}function Fte(e,t,n,r,a){const i=window.innerWidth,l=window.innerHeight,u=r.reduce((h,p)=>h?$R(h,p):p,null),f=u?xte(u,i,l):[];if(a){const h=yte(r,i,l),p=e.style;p.maskImage=h,p.webkitMaskImage=h,n.style.backgroundImage=bte(r,i,l,Ste)}else Sk(e,f);Sk(t,f)}function Uh(e){return Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||0}function xk(e){return e.closest(S4)??e.querySelector(S4)??e}function kk(e){let t=0,n=0,r=0;for(const a of e.querySelectorAll("button, a[href], .sc-chip, .sc-btn"))a.getClientRects().length&&(r+=1,t=Math.max(t,Uh(a)),n=Math.max(n,a.getBoundingClientRect().height));return{radius:t,height:n,count:r}}function Sk(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:`${oi(a)}px`,height:`${xo(a)}px`})})}const Ek=[0,1,2,3];function _te(){return typeof CSS>"u"?!1:CSS.supports("mask-image",'url("x.svg")')||CSS.supports("-webkit-mask-image",'url("x.svg")')}function kh(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 P8(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,Ate)})}function Vte(e){return e>0?new Promise(t=>window.setTimeout(t,e)):Promise.resolve()}function Zte(e){return e.matches('button, a[href], input, select, textarea, [tabindex], [contenteditable="true"]')}const zte=10;function Bte(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 Ute(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 lr=e=>e.kind==="question"?`q:${e.question.id}`:`${e.kind}:${e.id}`;function Wte(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 Jf=320,zw=180,Kte=28,Gte=700;function Um(e){const t=e.split(/(\s+)/).filter(a=>a.length>0),n=t.filter(a=>!/^\s+$/.test(a)).length,r=Math.min(Kte,Math.floor(Gte/Math.max(1,n)));return{words:t,step:r,total:Jf+zw+r*n+160}}function L8(e,t){return e.every(n=>!!t[n.id])}function Yte(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 qte(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Xte=/^(hi|hello|hey|heya|hiya|yo|hola|shalom|sup|good (morning|afternoon|evening)|thanks|thank you|thx|cheers)\b/i,Qte=/^(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,Jte=/^(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,ene=/^(start over|start again|restart|reset|cancel|stop|quit|exit|go back|back|undo|never ?mind|forget it|close)\b/i,tne=/^(skip|next|continue|go|go on|proceed|generate|draw|render|build|show me|show|try|do it|let'?s go|begin|start)\b/i,Ck=/^(help|help me|how does this work|what do i do|what should i (write|say|type)|instructions|\?+)[\s!.,?]*$/i,nne=/\b(presenters?|avatars?|characters?|Scenri|create|creating|generate|generating|images?|pictures?|shoot|campaign|brand|product)\b/i,rne=/^(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,sne=/^[b-df-hj-np-tv-xz]{3,}$/i,ane=/(.)\1{3,}/,one=/\b(like|as|resembling|resembles|similar to|looks? like|looking like)\s+([A-Z][a-z]+)(?:\s+[A-Z][a-z]+)*\b/,ine=/^(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 Qo(e,t){const n=e.trim();if(!n)return null;const r=one.exec(n);if(r&&!ine.test(r[2]))return"likeness";if(t(n))return null;if(!new RegExp("\\p{L}","u").test(n))return Ck.test(n)?"help":"nonsense";const a=n.split(/\s+/).filter(Boolean),i=a.length;if(Ck.test(n))return"help";if(Xte.test(n)&&i<=4)return"greeting";if(Qte.test(n))return"ack";const l=u=>u.replace(/[^a-z]/gi,"");return i<=8&&a.some(u=>rne.test(l(u))||sne.test(l(u))||ane.test(l(u)||u))?"nonsense":Jte.test(n)||/\?\s*$/.test(n)?"question":ene.test(n)&&i<=4?"nav":nne.test(n)&&i<=10?"intent":tne.test(n)&&i<=4?"go":i===1&&/^[A-Z][a-z]+$/.test(n)?null:i<=2?"vague":null}const lne=e=>`aside-said-${e}`,jk=e=>e.startsWith("aside-said-")?e.slice(11):null,mi=(e,t=!1,n=!1)=>[...n?[]:[{kind:"you",id:lne(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}],jp=e=>(e.kind==="you"||e.kind==="scenri")&&e.id.startsWith("aside-");function DR(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question.id;if(!jp(n))return null}return null}const Ap=()=>new Date().toISOString();function cne({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 une({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(Ak,{dir:-1,live:r.back,onGo:l}),o.jsx("div",{className:"sc-convo-plates",ref:n,children:t}),f&&o.jsx(Ak,{dir:1,live:r.on,onGo:l})]})}function Ak({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(Aa,{size:14,weight:"bold"}):o.jsx(vl,{size:14,weight:"bold"})})}const dne=106;function Nk({options:e,picked:t,onPick:n}){return o.jsx(une,{step:dne,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 HR=6e4,fne=60*HR,$8=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),hne=e=>e.toLocaleDateString([],{day:"numeric",month:"short"});function pne(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 mne(e,t=Date.now()){const n=Math.max(0,t-e);if(n<45e3)return"just now";if(n<fne)return`${Math.max(1,Math.round(n/HR))} min ago`;const r=new Date(e),a=pne(r,new Date(t));return a===0?$8(r):a===1?`Yesterday ${$8(r)}`:`${hne(r)} ${$8(r)}`}const gne=e=>new Date(e).toLocaleString([],{dateStyle:"medium",timeStyle:"short"});function vne({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:C}){const[E]=s.useState(l),A=Uw(u,E),{playing:P,thinking:T}=VR(a,e,E,A==="true");return o.jsxs("div",{className:"sc-convo-turn","data-guide-shape":"","data-who":"scenri","data-arrive":P||void 0,"data-leave":A,"data-turn":f,"data-dim":h||void 0,style:P?{...OR(E),"--sc-convo-after":`${Um(e).total}ms`}:void 0,children:[i&&o.jsx(Bw,{thinking:T,at:n,now:r}),o.jsxs("p",{className:"sc-convo-say","data-tone":t,"data-reveal":P||void 0,children:[T&&o.jsx(FR,{}),o.jsx(_R,{text:e,playing:P})]}),p&&o.jsxs("span",{className:"sc-convo-shot","data-reveal":P||void 0,"data-current":w||void 0,children:[g&&C?o.jsx("button",{type:"button",className:"sc-convo-shot-pick","aria-label":m?`Show ${m} on the stage`:"Show this on the stage",onClick:()=>C(g),children:o.jsx(Mk,{thumb:p,label:m,current:w})}):o.jsx(Mk,{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 OR=e=>({"--sc-convo-start":`${e}ms`,"--sc-convo-think":`${Jf}ms`});function Bw({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(qX,{className:"sc-convo-mark"}),"Scenri",t?o.jsx(IR,{at:t,now:n}):null]})}function IR({at:e,now:t}){return o.jsx("time",{className:"sc-convo-time",dateTime:new Date(e).toISOString(),title:gne(e),children:mne(e,t)})}function wne({what:e="Thinking"}){return o.jsxs("div",{className:"sc-convo-turn","data-who":"scenri","data-working":"true",children:[o.jsx(Bw,{thinking:!0}),o.jsx("p",{className:"sc-convo-say",children:o.jsxs("span",{className:"sc-convo-work",children:[e,o.jsx(yne,{})]})})]})}function yne(){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 FR(){return o.jsxs("span",{className:"sc-convo-dots","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]})}function _R({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}=Um(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 VR(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+Um(t).total),p=setTimeout(()=>u(!1),n+Jf);return()=>{clearTimeout(h),clearTimeout(p)}},[a,t,n]),{playing:a&&!r,thinking:a&&l&&!r}}function Uw(e,t,n=Jf+zw){const r=s.useRef(performance.now());if(e)return performance.now()-r.current<t+n?"early":"true"}function Mk({thumb:e,label:t,current:n}){return o.jsx("img",{src:gn(e,"micro"),srcSet:`${gn(e,"micro")} 160w, ${gn(e,"small")} 320w, ${gn(e,"tile")} 640w`,sizes:"(max-width: 767px) 248px, 128px",alt:n&&t?`${t}, active`:t??""})}const bne=300,xne=e=>typeof e=="string"?e:null,kne=e=>Array.isArray(e)?e:[],Sne=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{};function Ene({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,Q,he,Me;const[S]=s.useState(a),C=Uw(i,S),{playing:E,thinking:A}=VR(t,e.prompt,S,C==="true"),P="given"in e?e.given:void 0,[T,M]=s.useState(()=>Sne(P)),[j,R]=s.useState(null),[L,H]=s.useState(()=>new Set(kne(P))),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=(ce,ke)=>{j||(R(ce),g==null||g(e.id,{picked:ce,picks:T}),m(ke))},W=j??xne(P),K=s.useRef(null),F=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 ce=F.current,ke=K.current;if(!ce||!ke||!Y||typeof IntersectionObserver>"u")return;const Be=new IntersectionObserver(ft=>ft.some(Ue=>Ue.isIntersecting)&&_.current(),{root:ke,rootMargin:"0px 0px 240px 0px"});return Be.observe(ce),()=>Be.disconnect()},[O,Y]);const z=O>0;s.useLayoutEffect(()=>{const ce=K.current;if(!ce||!z||typeof ResizeObserver>"u")return;const ke=()=>{const ft=ce.querySelector(".sc-convo-plate");ft&&ce.style.setProperty("--sc-pick-row",`${ft.getBoundingClientRect().height}px`)};ke();const Be=new ResizeObserver(ke);return Be.observe(ce),()=>Be.disconnect()},[z]);const X=e.kind==="pick"?(re=e.search)==null?void 0:re.value:void 0;s.useEffect(()=>{K.current&&(K.current.scrollTop=0)},[X]);const Z=Um(e.prompt),J=`sc-convo-q-${e.id}`,me=s.useRef(null),ne=e.reopened&&k&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost sc-convo-cancel",onClick:k,children:"Cancel"}),fe="attach"in e&&e.attach&&b&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass",onClick:()=>{var ce;return(ce=me.current)==null?void 0:ce.click()},children:[o.jsx(JI,{size:14,weight:"bold"}),e.attach]}),o.jsx("input",{ref:me,type:"file",accept:"image/*",hidden:!0,"aria-label":e.attach,onChange:ce=>{const ke=Array.from(ce.target.files??[]).filter(Be=>Be.type.startsWith("image/"));ce.target.value="",ke.length&&b(ke)}})]});return o.jsxs("div",{className:"sc-convo-turn","data-who":"scenri","data-arrive":E||void 0,"data-leave":C,"data-turn":u,"data-dim":f||void 0,"data-reopened":e.reopened||void 0,style:E?{...OR(S),"--sc-convo-after":`${Z.total}ms`}:void 0,children:[!e.reopened&&r&&o.jsx(Bw,{thinking:A,at:h,now:p}),!e.reopened&&o.jsxs("p",{className:"sc-convo-say",id:J,"data-tone":e.tone,"data-reveal":E||void 0,children:[A&&o.jsx(FR,{}),o.jsx(_R,{text:e.prompt,playing:E})]}),e.reopened&&o.jsx("span",{id:J,hidden:!0,children:e.prompt}),!e.reopened&&e.hint&&o.jsx("p",{className:"sc-convo-hint","data-reveal":E||void 0,children:e.hint}),o.jsxs("fieldset",{className:"sc-convo-q","aria-labelledby":J,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":E||void 0,"data-picked":!!j||void 0,disabled:n||void 0,children:[e.starters&&e.starters.length>0&&o.jsx("div",{className:"sc-convo-starters",children:e.starters.map(ce=>o.jsx(dr,{label:ce.text,children:o.jsx("button",{type:"button",className:"sc-convo-starter",onClick:()=>w==null?void 0:w(ce.text),children:ce.label})},ce.text))}),e.kind==="choice"&&((Q=e.options)==null?void 0:Q.some(ce=>ce.card))&&o.jsx(Nk,{options:e.options,picked:W,onPick:ce=>V(ce,{kind:"choice",id:ce})}),e.kind==="choice"&&e.options&&!e.groups&&!e.options.some(ce=>ce.card)&&o.jsx("div",{className:"sc-convo-choices sc-convo-ask","data-guide-shape":"",children:e.options.map(ce=>o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice","aria-pressed":e.multi?L.has(ce.id):void 0,"data-on":(e.multi?L.has(ce.id):W===ce.id)||void 0,onClick:()=>e.multi?H(ke=>{const Be=new Set(ke);return Be.delete(ce.id)||Be.add(ce.id),Be}):V(ce.id,{kind:"choice",id:ce.id}),children:ce.label},ce.id))}),e.kind==="choice"&&(e.describe||e.attach||e.skip)&&o.jsxs("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:[e.skip&&!e.multi&&!e.groups&&o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass","data-on":j==="skip"||!j&&e.skipped||void 0,onClick:()=>V("skip",{kind:"skip"}),children:e.skip}),e.describe&&y&&o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass","aria-pressed":e.saying===void 0?void 0:e.saying,"data-on":e.saying||void 0,onClick:y,children:e.describe}),fe,!e.multi&&ne]}),e.kind==="choice"&&!e.groups&&!e.multi&&!e.describe&&!e.attach&&ne&&o.jsx("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:ne}),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([...L].map(ce=>[ce,"on"]))}),children:e.submit??"Continue"}),e.skip&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-on":j==="skip"||!j&&e.skipped||void 0,onClick:()=>V("skip",{kind:"skip"}),children:e.skip}),ne]}),e.kind==="choice"&&e.groups&&o.jsxs("div",{className:"sc-convo-groups",children:[e.groups.map(ce=>o.jsxs("div",{className:"sc-convo-group",children:[o.jsx("span",{className:"sc-convo-group-lb",id:`sc-convo-g-${e.id}-${ce.id}`,children:ce.label}),o.jsx(qo,{label:ce.label,value:T[ce.id]??"",ids:ce.options.map(ke=>ke.id),onChange:ke=>M(Be=>({...Be,[ce.id]:ke})),className:"sc-convo-choices",children:ce.options.map(ke=>o.jsx(Xo,{id:ke.id,on:T[ce.id]===ke.id,label:ke.label,className:"sc-chip sc-convo-choice",onPick:()=>M(Be=>({...Be,[ce.id]:ke.id})),children:ke.label},ke.id))})]},ce.id)),o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary","aria-disabled":!L8(e.groups,T)||void 0,title:L8(e.groups,T)?void 0:"Pick one in each row, or skip.","data-on":j==="submit"||void 0,onClick:()=>{L8(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}),ne]})]}),e.kind==="swatches"&&o.jsxs("div",{className:"sc-convo-look",children:[e.row.options.some(ce=>ce.card)?e.layout==="grid"?o.jsx(cne,{options:e.row.options,picked:W,onPick:ce=>V(ce,{kind:"swatches",picks:{[e.row.id]:ce}})}):o.jsx(Nk,{options:e.row.options,picked:W,onPick:ce=>V(ce,{kind:"swatches",picks:{[e.row.id]:ce}})}):o.jsx("div",{className:"sc-convo-swatches",children:e.row.options.map(ce=>o.jsx(dr,{label:ce.label,children:o.jsx("button",{type:"button",className:ce.color?"sc-convo-swatch":"sc-chip sc-convo-choice",style:ce.color?{"--sc-swatch":ce.color}:void 0,"aria-label":ce.label,"aria-pressed":W===ce.id,"data-on":W===ce.id||void 0,onClick:()=>V(ce.id,{kind:"swatches",picks:{[e.row.id]:ce.id}}),children:ce.color?null:ce.label})},ce.id))}),(e.skip||e.describe||ne)&&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}),ne]})]}),e.kind==="photos"&&o.jsxs("div",{className:"sc-convo-photos-q",children:[o.jsx($M,{hashes:e.hashes,max:e.max,label:((he=e.drop)==null?void 0:he.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:ce=>m({kind:"photos",action:{type:"add",files:ce}}),onRemove:ce=>m({kind:"photos",action:{type:"remove",hash:ce}}),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:ce=>m({kind:"photos",action:{type:"attest",checked:ce.target.checked}})}),o.jsx("span",{children:e.attest.text})]}),o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary","aria-disabled":!!T8(e)||void 0,title:T8(e)??void 0,"data-on":j==="submit"||void 0,onClick:()=>{T8(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}),ne]})]}),e.kind==="pick"&&o.jsxs("div",{className:"sc-convo-pick",children:[e.search&&o.jsx("input",{type:"search",className:"sc-convo-pick-q",value:e.search.value,placeholder:e.search.label,"aria-label":e.search.label,onChange:ce=>m({kind:"pick",action:{type:"query",text:ce.target.value}}),onKeyDown:ce=>{var ke;ce.key!=="Escape"||!((ke=e.search)!=null&&ke.value)||(ce.preventDefault(),m({kind:"pick",action:{type:"query",text:""}}))}}),o.jsxs("fieldset",{ref:K,className:"sc-convo-pick-scroll","aria-labelledby":J,"aria-busy":e.loading||void 0,children:[e.items.length===0&&e.loading&&o.jsx("div",{className:"sc-convo-grid sc-convo-pick-grid","aria-hidden":!0,children:Array.from({length:8},(ce,ke)=>o.jsx("span",{className:"sc-convo-plate sc-convo-pick-wait",children:o.jsx("span",{className:"sc-convo-plate-in"})},ke))}),e.items.length>0&&o.jsx("div",{className:"sc-convo-grid sc-convo-pick-grid",children:e.items.map(ce=>o.jsx("button",{type:"button",className:"sc-convo-plate","aria-label":ce.alt,"aria-pressed":W===ce.id,"data-on":W===ce.id||void 0,onClick:()=>V(ce.id,{kind:"pick",action:{type:"pick",id:ce.id}}),children:o.jsx("span",{className:"sc-convo-plate-in",style:{backgroundImage:`url("${gn(ce.hash,"small")}")`}})},ce.id))}),e.items.length===0&&!e.loading&&e.empty&&o.jsx("p",{className:"sc-convo-pick-empty",children:e.empty}),e.more&&o.jsx("div",{ref:F,className:"sc-convo-pick-end","aria-hidden":!0})]}),o.jsx("p",{className:"sc-vh",role:"status",children:e.loading?"":e.status??""}),(e.back||ne)&&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}),ne]})]}),e.kind==="confirm"&&e.quote&&o.jsx(Cne,{text:e.quote,label:e.quoteLabel,folded:e.quoteFolded}),e.kind==="confirm"&&o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[e.options.map((ce,ke)=>o.jsx("button",{type:"button",className:`sc-btn ${ke===0&&!e.quiet?"sc-btn-primary":"sc-btn-ghost"}`,"data-on":j===ce.id||void 0,onClick:()=>V(ce.id,{kind:"confirm",id:ce.id}),children:ce.label},ce.id)),e.describe&&y&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","aria-pressed":e.saying===void 0?void 0:e.saying,"data-on":e.saying||void 0,onClick:y,children:e.describe}),fe,ne]}),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 Cne({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(Gn,{size:13,weight:"bold"}):o.jsx(ep,{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 T8(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 jne({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=Uw(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(IR,{at:n,now:r}):null,i&&g&&w?o.jsx(Ane,{text:e,onSave:g,onCancel:w}):o.jsxs("div",{className:"sc-convo-bubble",children:[a&&m&&o.jsx(dr,{label:"Change this answer",children:o.jsx("button",{type:"button",className:"sc-convo-edit","aria-label":"Change this answer",onClick:m,children:o.jsx(fd,{size:13})})}),o.jsx("p",{children:e}),t&&t.length>0&&o.jsx("div",{className:"sc-convo-photos",children:t.map((S,C)=>o.jsx("img",{src:gn(S,"micro"),alt:`Yours, ${C+1} of ${t.length}`},S))})]})]})}function Ane({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 Nne=180,Rk=3e3,ZR=460,Mne="cubic-bezier(0.22, 1, 0.36, 1)",Rne=220,Pne=450,Lne=48;function $ne({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 Ze;const b=s.useRef(null),k=s.useRef(!0),S=s.useRef(!!a),C=s.useRef(performance.now());S.current&&performance.now()-C.current>Rk&&(S.current=!1),s.useEffect(()=>{if(!S.current)return;const oe=()=>{S.current=!1},q=window.setTimeout(oe,Rk);return window.addEventListener("pointerdown",oe,{capture:!0}),window.addEventListener("keydown",oe,{capture:!0}),()=>{window.clearTimeout(q),window.removeEventListener("pointerdown",oe,{capture:!0}),window.removeEventListener("keydown",oe,{capture:!0})}},[]);const E=qte(),A=s.useRef(e),P=s.useRef(null),T=s.useRef(null),M=s.useRef(null),j=s.useRef(null),R=s.useRef(null),L=s.useRef([]),[,H]=s.useState(0),D=s.useRef(new Map),B=s.useRef(0),V=performance.now(),W=s.useRef(!1),K=Hne(e);if(K!==P.current){P.current=K,W.current=!0;const oe=j.current&&V<j.current.until?j.current:null,q=oe?Pk(A.current,oe):A.current,ae=new Set(e.map(lr)),Le=$k(e),Ie=$k(q),Je=ge=>ge.startsWith("you:")&&Le.has(Sh(ge))||ge.startsWith("q:")&&Ie.has(ge)&&ae.has(Sh(ge));if(L.current=q.map(lr).filter(ge=>!ae.has(ge)&&!Je(ge)),Le.size&&!Ie.size){const ge=Sh([...Le][0]),et=q.find(nt=>lr(nt)===ge);M.current=(et==null?void 0:et.kind)==="you"?{key:ge,text:et.text}:null}if(Ie.size>0&&Le.size===0){const ge=M.current;M.current=null;const et=ge?e.find(St=>lr(St)===ge.key):void 0,nt=!!ge&&((et==null?void 0:et.kind)!=="you"||et.text!==ge.text),pt=e[e.length-1];T.current=nt&&(pt==null?void 0:pt.kind)==="question"?lr(pt):null}if(!E&&L.current.length){const ge=L.current.some(pt=>!(oe!=null&&oe.gone.has(pt))),et=oe!=null&&oe.look&&L.current.includes(`q:${oe.look.qid}`)?oe.look:null,nt=R.current??et;j.current={from:q,gone:new Set(L.current),look:nt,until:ge?V+(R.current?bne:Nne):(oe==null?void 0:oe.until)??V}}else j.current=null;R.current=null,A.current=e}const F=j.current&&V<j.current.until?j.current:null;F||(j.current=null),s.useEffect(()=>{if(!F)return;const oe=window.setTimeout(()=>H(q=>q+1),Math.max(0,F.until-performance.now()));return()=>window.clearTimeout(oe)},[F]);const _=(oe,q)=>{R.current={qid:oe,look:q}},O=F?Pk(e,F):e,Y=s.useRef(null);if(Y.current===null){const oe=r?_ne(r):null;Y.current=oe??new Set(a||e.length>2?e.map(lr):[])}const z=s.useRef(null);z.current===null&&(z.current=(r?Ine(r):null)??new Map);const[X,Z]=s.useState(()=>Date.now()),J=Math.max(0,...z.current.values()),me=X-J<36e5;s.useEffect(()=>{if(!me)return;const oe=window.setInterval(()=>Z(Date.now()),3e4);return()=>window.clearInterval(oe)},[me]),T.current&&(Y.current.delete(T.current),T.current=null);const ne=new Set;for(const oe of O){const q=lr(oe);oe.kind==="question"&&oe.question.reopened||Y.current.has(q)||ne.add(q)}if(a&&S.current&&ne.size){for(const oe of ne)Y.current.add(oe);ne.clear()}const fe=[];let re=Number.POSITIVE_INFINITY;{const oe=new Set(O.map(lr));for(const q of[...D.current.keys()])oe.has(q)||D.current.delete(q);for(const q of O){const ae=lr(q);if(!ne.has(ae)){fe.push(q);continue}let Le=D.current.get(ae);if(Le===void 0){const Ie=q.kind==="you"||q.kind==="scenri"&&!!q.quiet;Le=Math.max(V,Ie?0:B.current,(F==null?void 0:F.until)??0),D.current.set(ae,Le),B.current=Math.max(B.current,Le+(Ie?Rne:Jf+zw))}Le<=V?fe.push(q):re=Math.min(re,Le-V)}}s.useEffect(()=>{if(re===Number.POSITIVE_INFINITY)return;const oe=window.setTimeout(()=>H(q=>q+1),re);return()=>window.clearTimeout(oe)},[re]),s.useEffect(()=>{const oe=Y.current;if(oe){for(const q of L.current)oe.delete(q);for(const q of fe){if(q.kind==="question"&&q.question.reopened)continue;const ae=lr(q);F!=null&&F.gone.has(ae)||oe.add(ae)}r&&Vne(r,oe),r&&z.current&&Fne(r,z.current)}});const ee=s.useRef(null),Q=s.useCallback(()=>{const oe=b.current;if(!oe)return null;const q=ee.current;return q!=null&&q.isConnected&&q.scrollHeight>q.clientHeight?q:(ee.current=E4(oe),ee.current)},[]);s.useEffect(()=>{const oe=()=>{const q=Q();q&&(k.current=q.scrollHeight-q.scrollTop-q.clientHeight<24)};return document.addEventListener("scroll",oe,{passive:!0,capture:!0}),()=>document.removeEventListener("scroll",oe,{capture:!0})},[Q]);const he=(()=>{const oe=e.find(ae=>ae.kind==="question"&&ae.question.reopened);if(oe)return lr(oe);const q=e.find(ae=>ae.kind==="you"&&ae.editing);return q?lr(q):null})();s.useLayoutEffect(()=>{var ae;if(!k.current||he)return;const oe=document.activeElement;if(oe instanceof HTMLInputElement&&oe.type==="search"&&((ae=b.current)!=null&&ae.contains(oe)))return;const q=Q();q&&(q.scrollTop=q.scrollHeight)});const Me=s.useRef(he);Me.current=he;const ce=e.length;s.useEffect(()=>{const oe=ce>0&&b.current?One(b.current):null;if(!oe||typeof ResizeObserver>"u")return;const q=new ResizeObserver(()=>{!k.current||Me.current||(oe.scrollTop=oe.scrollHeight)});return q.observe(oe),()=>q.disconnect()},[ce]);const ke=s.useRef(null);s.useLayoutEffect(()=>{var Je,ge,et,nt;if(he===ke.current)return;const oe=ke.current;ke.current=he;const q=b.current;if(!q)return;const ae=document.activeElement;if(!(!ae||ae===document.body||q.contains(ae)))return;if(he){if(k.current=!1,he.startsWith("you:"))return;(ge=(Je=p0(q,he))==null?void 0:Je.querySelector(".sc-convo-q"))==null||ge.focus({preventScroll:!0});return}if(!oe)return;const Ie=oe.startsWith("q:")?Sh(oe):oe;(nt=(et=p0(q,Ie))==null?void 0:et.querySelector(".sc-convo-edit"))==null||nt.focus({preventScroll:!0})}),s.useEffect(()=>{if(!he)return;const oe=window.setTimeout(()=>{const q=p0(b.current,he),ae=b.current&&E4(b.current);if(!q||!ae)return;const Le=q.getBoundingClientRect(),Ie=ae.getBoundingClientRect();Le.bottom-Ie.bottom>Lne&&Lk(q,E)},ZR);return()=>window.clearTimeout(oe)},[he,E]);const Be=e.length&&e[e.length-1].kind==="question"?lr(e[e.length-1]):null,ft=s.useRef(Be);s.useLayoutEffect(()=>{var Je,ge;const oe=b.current;if(he||!oe||Be===ft.current)return;const q=document.activeElement,ae=(Je=q==null?void 0:q.closest(".sc-convo-turn"))==null?void 0:Je.getAttribute("data-turn"),Le=!q||q===document.body||q!==oe&&q.contains(oe)||!!ae&&ae.startsWith("q:")&&ae!==Be;if(!Be||!Le){ft.current=Be;return}const Ie=(ge=p0(oe,Be))==null?void 0:ge.querySelector(".sc-convo-q:not([hidden])");Ie&&(ft.current=Be,Ie.focus({preventScroll:!0}))});const Ue=s.useRef(Be),Qe=s.useRef(null);s.useEffect(()=>{if(Be===Ue.current)return;if(!Be){he&&(Qe.current=Ue.current),Ue.current=null;return}const oe=p0(b.current,Be);if(!oe)return;Ue.current=Be;const q=Qe.current!==null,ae=Qe.current===Be;if(Qe.current=null,k.current||q&&ae)return;const Le=()=>{Dne(oe,b.current)||Lk(oe,E)};if(!q){Le();return}const Ie=window.setTimeout(Le,Pne);return()=>window.clearTimeout(Ie)},[Be,he,E]);const Pe=s.useRef(new Map);s.useLayoutEffect(()=>{const oe=b.current;if(!oe)return;const q=new Map,ae=W.current;W.current=!1;for(const Le of oe.querySelectorAll(".sc-convo-turn")){const Ie=Le.dataset.turn??"",Je=Le.offsetTop;q.set(Ie,Je);const ge=Pe.current.get(Ie);!ae||E||ge===void 0||Math.abs(ge-Je)<1||Tne(Le,ge-Je)}Pe.current=q});const G=new Set;if(he){G.add(he);const oe=he.slice(he.indexOf(":")+1);G.add(`scenri:asked-${oe}`);const q=fe.findIndex(ae=>lr(ae)===he);if(q>=0){for(let ae=q+1;ae<fe.length&&jp(fe[ae]);ae++)G.add(lr(fe[ae]));for(let ae=q-1;ae>=0&&jp(fe[ae]);ae--)G.add(lr(fe[ae]))}}for(const oe of fe){const q=lr(oe);z.current.has(q)||z.current.set(q,Date.now())}let se=!1;const We=[];for(const oe of fe){const q=lr(oe),ae=!!he&&!G.has(q),Le=z.current.get(q),Ie=!!(F!=null&&F.gone.has(q)),Je=Ie&&oe.kind==="question"&&((Ze=F==null?void 0:F.look)==null?void 0:Ze.qid)===oe.question.id,ge=oe.kind==="scenri"&&!!oe.quiet,et=!E&&!Ie&&ne.has(q)&&!ge,nt=0,pt=se;Ie||(se=oe.kind==="scenri"||oe.kind==="question"&&!oe.question.reopened),oe.kind==="you"?We.push(o.jsx(jne,{text:oe.text,photos:oe.photos,editable:oe.editable,editing:oe.editing,arrive:et,leave:Ie,delay:nt,turnId:q,dim:ae,at:Le,now:X,onEdit:oe.editable&&l?()=>l(oe.id):void 0,onSave:u?St=>u(oe.id,St):void 0,onCancel:f},q)):oe.kind==="scenri"?We.push(o.jsx(vne,{text:oe.text,tone:oe.tone,reveal:et,leave:Ie,eyebrow:!pt,delay:nt,turnId:q,dim:ae,at:Le,now:X,thumb:oe.thumb,label:oe.label,view:oe.view,current:oe.current,restore:oe.restore,onRestore:g,retry:oe.retry,onRetry:w,onShow:y},q)):We.push(o.jsx(Ene,{question:oe.question,reveal:et,leave:Ie&&!Je,spent:Ie,delay:nt,turnId:q,dim:ae,busy:t||ae,eyebrow:!pt,at:Le,now:X,onAnswer:St=>i(oe.question.id,St),onPick:_,onStarter:h,onDescribe:p,onAttachFiles:m,onCancel:f},q))}return o.jsx("div",{ref:b,className:"sc-convo-log",role:"log","aria-live":"polite","aria-relevant":"additions","data-changing":he?"true":void 0,children:o.jsxs("div",{className:"sc-convo-turns",children:[We,n&&o.jsx(wne,{what:n===!0?void 0:n})]})})}function Pk(e,t){const n=[],r=new Set(e.map(lr));let a=0;for(const i of t.from){const l=lr(i);if(t.gone.has(l)){r.has(l)||n.push(i);continue}for(;a<e.length&&lr(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 Tne(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:ZR,easing:Mne,fill:"both"});r.id="slide",r.onfinish=()=>{e.style.transform="",r.cancel()}}function Dne(e,t){if(!t)return!1;const n=E4(t),r=e.getBoundingClientRect(),a=n.getBoundingClientRect();return r.top>=a.top&&r.top<=a.bottom-24}function Lk(e,t){var n;(n=e==null?void 0:e.scrollIntoView)==null||n.call(e,{block:"nearest",behavior:t?"auto":"smooth"})}function p0(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 Hne(e){const t=[];for(const n of e){const r=lr(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 $k(e){const t=new Set;for(const n of e)n.kind==="question"&&n.question.reopened&&t.add(lr(n));return t}function Sh(e){return e.startsWith("you:")?`q:${e.slice(4)}`:e.startsWith("q:")?`you:${e.slice(2)}`:""}function E4(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 One(e){for(let t=e;t;t=t.parentElement){const{overflowY:n}=getComputedStyle(t);if(n==="auto"||n==="scroll")return t}return null}const Ww=e=>`scenri:convo-said:${e}`;function el(e){try{sessionStorage.removeItem(Ww(e)),sessionStorage.removeItem(Kw(e))}catch{}}const Kw=e=>`scenri:convo-at:${e}`;function Ine(e){try{const t=sessionStorage.getItem(Kw(e));return t?new Map(Object.entries(JSON.parse(t))):null}catch{return null}}function Fne(e,t){try{sessionStorage.setItem(Kw(e),JSON.stringify(Object.fromEntries(t)))}catch{}}function _ne(e){try{const t=sessionStorage.getItem(Ww(e));return t?new Set(JSON.parse(t)):null}catch{return null}}function Vne(e,t){try{sessionStorage.setItem(Ww(e),JSON.stringify([...t]))}catch{}}function D8(e){return`${["No","One","Two","Three","Four","Five"][e]??String(e)} picture${e===1?"":"s"}`}function H8(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? ${D8(t.length)} with a Scenri demo ${e} in the place: ${H8(t.map(n=>n.toLowerCase()))}.`,staleSet:e=>`${D8(e)} here show${e===1?"s":""} the place as it was before. Draw ${e===1?"it":"them"} again?`,moreViews:e=>`Add ${D8(e.length).toLowerCase()} of it in use? ${H8(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? ${H8(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."},Zne="part of the place itself, never a separate object that competes with the subject, and leaving the subject a clear place to stand",zR={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 Gw(e,t){const n=e?zR[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 zne(e){return Object.keys(zR).flatMap(t=>Gw(t,e)??[])}const Bne=["water","stone","colour","citrus","volcanic","dark","plaster","linen"],e1=["world","surface","light","signature"],da=(e,t)=>`scene-${e}-${t}`,hl={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:da("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:da("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:da("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:da("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:da("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:da("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:da("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:da("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:da("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:da("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:da("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:da("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"]}]}},Une=new Set([...hl.world.options.map(e=>e.card),...hl.light.options.filter(e=>e.card).map(e=>e.card),...Bne.flatMap(e=>["surface","light","signature"].flatMap(t=>(Gw(e,t)??[]).map(n=>n.card)))]);function Wne(e,t){return e==="world"?hl.world.options:Gw(t,e)??hl[e].options}function Kne(e,t){const n=Wne(e,t),r=n.every(a=>!!a.card&&Une.has(a.card));return{id:e,label:hl[e].prompt,options:n.map(a=>({id:a.id,label:a.label,...r?{card:a.card}:{}}))}}const Gne={world:"place",surface:"surface",light:"light",signature:"idea"},Tk=e=>Gne[e],Co=(e,t)=>{if(!t)return;const n=hl[e].options.find(r=>r.id===t);return n||e==="world"?n:zne(e).find(r=>r.id===t)},Yne="one signature idea that makes this place unforgettable, invented for it and never generic";function qne(e){const t=` ${e.toLowerCase().replace(/[^a-z0-9]+/g," ")} `,n={};for(const r of e1){let a=null;for(const i of hl[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 ld=4e3,BR=8e3,Xne=["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"],C4=["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"],UR=["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"],WR=["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"],KR=["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"],GR=["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"],YR={world:[...Xne,...C4],surface:C4,light:WR,signature:UR,stage:KR,camera:GR},Qne=e=>` ${e.toLowerCase().replace(/[^a-z0-9é]+/g," ").trim()} `,Jne=(e,t)=>e.includes(` ${t.replace(/[^a-z0-9é]+/g," ")} `);function qR(e){const t=Qne(e),n=r=>r.some(a=>Jne(t,a));return{world:n(YR.world),surface:n(C4),light:n(WR),signature:n(UR),stage:n(KR),camera:n(GR)}}const ere=e=>Object.keys(YR).filter(t=>e[t]);function tre(e){const t=["world","surface","light"].filter(r=>!e[r]),n=ere(e).length>=3?t.filter(r=>r==="world"):t.slice(0,2);return e.signature?n:[...n,"signature"]}const ii="__passed",N0=e=>{var t;return(t=e.source)==null?void 0:t.door},nre=e=>{var t;return N0(e)==="words"?tre(qR(((t=e.source)==null?void 0:t.text)??"")):[]},Wm=[{id:"source",applies:()=>!0},{id:"photos",applies:e=>N0(e)==="photos"},{id:"shot",applies:e=>N0(e)==="shot"},{id:"reuse",applies:e=>{var t;return N0(e)==="shot"&&!!((t=e.shot)!=null&&t.scene)}},...e1.map(e=>({id:e,applies:t=>N0(t)==="guided"||nre(t).includes(e)}))],Wh=Wm.map(e=>e.id),Np=e=>e1.includes(e),Dk=e=>Wh.includes(e),rre=e=>{var t;return!!e&&(!!e.pick||!!((t=e.words)!=null&&t.trim()))};function Yw(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":rre(t[e])}const sre=e=>Wm.filter(t=>t.applies(e)&&Yw(t.id,e)).map(t=>t.id);function XR(e){var t;return((t=Wm.find(n=>n.applies(e)&&!Yw(n.id,e)))==null?void 0:t.id)??null}const QR=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:e1.some(l=>Wi(l,e[l])!==null)},Hk=e=>!!e.source&&XR(e)===null&&QR(e),j4=(e,t)=>JSON.stringify(e)!==JSON.stringify(t);function qw(e,t){const n={...e},r=[];for(const[a,i]of Object.entries(t))j4(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=>Wh.indexOf(i)));for(const i of Wh)Wh.indexOf(i)<=a||i in t||delete n[i]}for(const a of Wm)n[a.id]!==void 0&&!a.applies(n)&&delete n[a.id];return n}function are(e,t,n){var r,a;if(e==="source")return t.kind!=="choice"?null:t.id==="photos"?{source:{door:"photos"},photos:{hashes:((r=n.photos)==null?void 0:r.hashes)??[],done:!1}}:t.id==="guided"?{source:{door:"guided"}}:null;if(e==="reuse")return t.kind==="choice"&&t.id==="read"?{reuse:"read"}:null;if(Np(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:ii,...i?{words:i}:{}}}}return null}function Ok(e){var t;return(e==null?void 0:e.pick)===ii?[Yne,(t=e.words)==null?void 0:t.trim()].filter(Boolean).join(", "):Wi("signature",e)}function Wi(e,t){var a,i;if(!t)return null;const n=t.pick&&t.pick!==ii?(a=Co(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 Ik=e=>e?`, ${Zne}`:"";function ore(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=Wi("world",e.world),b=Wi("light",e.light)??(qR(w).light?null:((f=Co("world",(u=e.world)==null?void 0:u.pick))==null?void 0:f.light)??null),k=Ok(e.signature),S=[y,Wi("surface",e.surface),b,k].filter(Boolean);return S.length?`${w.replace(/[.\s]+$/,"")}, ${S.join(", ")}${Ik(k)}.`:w}if(((h=e.source)==null?void 0:h.door)!=="guided")return"";const t=Wi("world",e.world),n=Wi("light",e.light)??((m=Co("world",(p=e.world)==null?void 0:p.pick))==null?void 0:m.light)??null,r=Ok(e.signature),i=`${[t??"a place",Wi("surface",e.surface),n,r].filter(Boolean).join(", ").replace(/^./,w=>w.toUpperCase())}${Ik(r)}.`;return(g=e.world)!=null&&g.pick?`${i.slice(0,-1)}. ${we.worldIsAStart}`:i}function ire(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 Fk=e=>/^image\/hei[cf]/i.test(e.type)||/\.hei[cf]$/i.test(e.name),lre={answers:{},revision:0,editing:null,held:null,asides:[]};function JR(e,t){var n,r;switch(t.type){case"answer":{const a=qw(e.answers,t.patch);return j4(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 JR(e,{type:"photos",hashes:[...((r=e.answers.photos)==null?void 0:r.hashes)??[],t.hash]});case"edit":return Yw(t.id,e.answers)?{...e,editing:t.id,held:e.answers}:e;case"cancel-edit":return!e.held||!j4(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 cre=e=>({answers:e.held??e.answers,revision:e.revision,asides:e.asides}),ure=/^[a-f0-9]{32}$/,_k=/^[\w.:-]{1,80}$/;function dre(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,ld)}:{}});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"&&_k.test(i.id)&&typeof i.hash=="string"&&ure.test(i.hash)){const u=i.scene,f=u&&typeof u.id=="string"&&_k.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 e1){const f=t.answers[u];if(!f||typeof f!="object")continue;const h=typeof f.pick=="string"&&(f.pick===ii||Co(u,f.pick))?f.pick:void 0,p=typeof f.words=="string"?f.words.slice(0,ld):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:qw({},n),revision:Number(t.revision)||0,editing:null,held:null,asides:l}}const Mp=4,eP=BR,Xw=60,tP={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 fre(e){return{...tP,place:e.place,pictures:e.pictures.slice(0,Mp),heldPictures:e.pictures.slice(Mp),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 Lr=e=>e.versions[e.current]??null,Vk=e=>e.versions.some(t=>!!t.hash);function hre(e,t){return!t||e.job||e.inputsRev===0||e.readRev!==null&&e.readRev===e.inputsRev||e.readTried===e.inputsRev?null:e.inputsRev}const nP=e=>e.readRev!==null&&e.readRev!==e.inputsRev;function pre(e,t){var n,r,a;switch(t.type){case"inputs":{const i=t.place.slice(0,eP),l=[...new Set(t.pictures)].slice(0,Mp);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,Xw),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:Zk({...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=Lr(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=Lr(e))==null?void 0:a.coverage)??[]:[],how:m},w=Lr(e),y=i.kind==="make"&&!l.hash&&w&&!w.hash&&w.how==="read",b=y?e.versions.map((S,C)=>C===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 Zk(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=Lr(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 Zk(e,t){return e.named||!(t!=null&&t.name)?e:{...e,name:t.name.slice(0,Xw)}}function mre(e){var n;const t=e.job?e.job.phase==="drawing"?e.job.pending:null:((n=Lr(e))==null?void 0:n.reading)??null;return t?!e.job&&nP(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 O8=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 gre(e){var r;const t=new Map;e.versions.forEach((a,i)=>{a.hash&&t.set(a.hash,i)});const n=((r=Lr(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 rP=e=>(e==null?void 0:e.hero)??(e==null?void 0:e.hash)??null,vre=(e,t)=>e.versions.slice(0,t+1).filter(n=>!!n.hash).length,wre=(e,t)=>e.versions.map(n=>n.hash).lastIndexOf(t);function yre(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?`${zk(e.figure)}, ${zk(e.figureTreatment)}.`:e.figure}),t}const zk=e=>e.replace(/[.\s]+$/,""),bre=/\b(presenters?|models?|influencers?|celebrit(y|ies)|actors?|actress(es)?)\b/i,xre=/\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,kre=/\b(add|put|place|include|show|feature|with|holding|wearing|sitting|standing)\b/i,Sre=/\b(no|without|remove|removing|empty|nobody|none|take out|get rid of|less)\b/i,Ere=/^\s*(undo|go back|revert|back to|previous|the (first|last|previous|old|earlier) (one|version))\b/i,Cre=/^\s*(hi|hello|hey|thanks|thank you|ok|okay|cool|nice|great|good|wow|yes|no)\b[\s!.]*$/i,jre=/^(?: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,sP=e=>{var t,n;return((n=(t=jre.exec(e.trim()))==null?void 0:t[1])==null?void 0:n.trim())||null};function Are(e){const t=e.trim(),n=sP(t);return n?{kind:"rename",name:n}:Ere.test(t)?{kind:"navigate",say:we.usePutBack}:Cre.test(t)||/\?\s*$/.test(t)&&!/\b(make|can you|could you|try)\b/i.test(t)?{kind:"chatter",say:we.sayAChange}:(bre.test(t)||xre.test(t))&&kre.test(t)&&!Sre.test(t)?{kind:"refuse",say:we.notInAScene}:{kind:"change"}}const Nre=(e,t)=>{var n;return!!((n=Lr(e))!=null&&n.ask)&&Lr(e).ask.trim().toLowerCase()===t.trim().toLowerCase()},aP=e=>!e.saved&&(e.versions.length>0||!!e.job||!!e.error),Bk=(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 Mre(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 oP=1;function Rre(e){return JSON.stringify({v:oP,...e})}function Pre(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||t.v!==oP)return null;const n=u=>Array.isArray(u)?u.filter(f=>typeof f=="string"):[],r=u=>!!u&&typeof u.prompt=="string"&&typeof u.name=="string",a=Array.isArray(t.versions)?t.versions.filter(u=>u&&r(u.reading)).map(u=>({reading:u.reading,hash:typeof u.hash=="string"?u.hash:null,...u.anchor===!0&&typeof u.hash=="string"?{anchor:!0}:{},...typeof u.hero=="string"&&typeof u.hash=="string"?{hero:u.hero,...u.heroWith&&typeof u.heroWith=="object"?{heroWith:u.heroWith}:{}}:{},ask:typeof u.ask=="string"?u.ask:void 0,coverage:n(u.coverage),how:["read","draw","again","change","edit"].includes(u.how)?u.how:u.hash?"draw":"read"})):[],i=t.job&&typeof t.job.id=="string"&&["make","again","change"].includes(t.job.kind)?{id:t.job.id,kind:t.job.kind,ask:typeof t.job.ask=="string"?t.job.ask:void 0,inputsRev:Number(t.job.inputsRev)||0,pending:r(t.job.pending)?t.job.pending:null,coverage:n(t.job.coverage),phase:["reading","changing","drawing"].includes(t.job.phase)?t.job.phase:null,since:typeof t.job.since=="string"?t.job.since:null,...t.job.stopping===!0?{stopping:!0}:{}}:null,l=Number.isInteger(t.current)&&t.current>=-1&&t.current<a.length?t.current:a.length-1;return{place:typeof t.place=="string"?t.place.slice(0,eP):"",pictures:n(t.pictures).slice(0,Mp),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,Xw):"",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 Lre(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 Uk(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 $re(e){return yre(e).map(t=>t.label===we.placeLabel?t.text:`${t.label}: ${t.text.replace(/[.\s]+$/,"")}.`).join(" ")}const Km=new Set([we.stopped,we.stoppedRead,we.stoppedDraw,we.stoppedChange,we.lost,we.failed,we.busyElsewhere]),Tre=e=>Km.has(e)?e:nf(e)??we.failedKept(e.replace(/[.\s]+$/,"")),Dre=new Set([we.stopped,we.stoppedRead,we.stoppedDraw,we.stoppedChange]),I8=e=>Dre.has(e)?{}:{tone:"alert"},Wk=e=>{if(Km.has(e))return e;const t=nf(e);return t?we.failedSaid(t):we.failedFirst(e.replace(/[.\s]+$/,""))},iP=e=>e&&!Km.has(e)?ro(e).remedy:void 0,A4=e=>{const t=iP(e);return t?[{id:`remedy:${t.opens}`,label:t.label}]:[]};function Kk(e){const t=!iP(e)&&!Km.has(e)&&!ro(e).retryable;return[...A4(e),...t?[{id:"reword",label:we.sayDifferently}]:[],{id:"retry",label:we.retry}]}function Gk(e,t,n,r,a){var y,b,k,S,C,E,A,P,T,M,j,R,L,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:((C=i.photos)==null?void 0:C.hashes)??[],max:4,busy:r>0,submit:we.readThem,back:we.guideInstead,drop:we.photosDrop,...l,...a&&a.any!==!1&&!((E=i.photos)!=null&&E.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:Lre(a),back:n?void 0:we.backToPictures,...l}}if(e==="reuse"){const D=((T=(P=i.shot)==null?void 0:P.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=Co("world",(M=i.world)==null?void 0:M.pick))==null?void 0:j.light:void 0,h=e==="surface"&&!!Co("world",(R=i.world)==null?void 0:R.pick),p=(u==null?void 0:u.pick)===ii||u==null?void 0:u.pick,m=(u==null?void 0:u.pick)===ii,g=u==null?void 0:u.words,w=((L=i.source)==null?void 0:L.door)==="words";return{id:e,kind:"swatches",prompt:lP(e,i),row:Kne(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 lP(e,t){var r,a,i;const n=e==="light"?(a=Co("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 hl[e].prompt}function Hre(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)??""):lP(e,t)}function Yk(e,t){var f,h,p,m,g,w,y,b,k,S,C;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 E=((m=t.photos)==null?void 0:m.hashes.length)??0;return{text:`${E} ${E===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)===ii&&((y=Co("world",(w=t.world)==null?void 0:w.pick))==null?void 0:y.light),a=e==="surface"&&(n==null?void 0:n.pick)===ii&&!!Co("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)===ii?i:(S=Co(e,n==null?void 0:n.pick))==null?void 0:S.label,u=(C=n==null?void 0:n.words)==null?void 0:C.trim();return{text:l&&u?`${l}, ${u}`:u??l??""}}const qk=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,Ore=e=>{const t=Lr(e);return t?`${t.hash?"decide":"agree"}-${e.current}`:null};function Ire(e){var w,y,b,k,S,C;const{setup:t,studio:n,edit:r}=e,a=t.answers,i=[],l=new Set,u=E=>{for(const A of t.asides.filter(P=>P.q===E&&!l.has(P)).sort(qk))l.add(A),i.push(...mi(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:XR(a);if(!r)for(const E of sre(a)){if(i.push({kind:"scenri",id:`asked-${E}`,text:Hre(E,a),quiet:!0}),u(E),t.editing===E){i.push({kind:"question",question:Gk(E,t,!0,e.uploading,e.shots)});continue}const A=Yk(E,a);i.push({kind:"you",id:E,text:A.text,photos:A.photos,editable:!n.job&&!n.saved})}const h=n.versions.findIndex(E=>!!E.hash);n.versions.forEach((E,A)=>{if(E.how==="read"&&A>0&&i.push({kind:"scenri",id:`reread-${A}`,text:we.readAgain}),E.how==="change"&&i.push({kind:"you",id:`ask-${A}`,text:E.ask??""}),E.hash&&(E.how==="draw"&&i.push({kind:"you",id:`draw-${A}`,text:we.draw}),E.how==="again"&&i.push({kind:"you",id:`again-${A}`,text:we.tryAgain}),A===h&&!r&&Xk(i,e),i.push({kind:"scenri",id:`pic-${A}`,text:E.how==="change"?we.changed:E.how==="again"?we.again:we.here,thumb:rP(E)??E.hash,label:we.version(vre(n,A)),view:"scene",current:A===n.current,restore:A===n.current||n.saved?void 0:{view:"scene",hash:E.hash}})),A===n.current)for(const[P,T]of E.coverage.entries())i.push({kind:"scenri",id:`cover-${A}-${P}`,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&&Xk(i,e),n.saved&&Fre(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",...Yk("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=Gk(f,t,!1,e.uploading,e.shots);else if(p){if(p.kind==="again"&&h<0&&!n.named&&!e.editingName){const E=((k=p.pending??((b=Lr(n))==null?void 0:b.reading))==null?void 0:k.name)??n.name;m={id:"name",kind:"text",prompt:we.name,starters:E?[{label:E,text:E}]:void 0}}}else if(n.saved)m=_re(e);else{const E=Lr(n);if(e.stale&&!r)n.error&&(m={id:"retry",kind:"confirm",...I8(n.error),prompt:Wk(n.error),options:Kk(n.error)});else if(!E&&n.error)m={id:"retry",kind:"confirm",...I8(n.error),prompt:Wk(n.error),options:Kk(n.error)};else if(E){n.error&&i.push({kind:"scenri",id:`error-${n.versions.length}`,text:Tre(n.error),...I8(n.error)});const A=$re(E.reading);if(E.hash){const P=!!r&&!r.changed;m={id:`decide-${n.current}`,kind:"confirm",prompt:P?we.decideSaved:(r?we.decideEdit:we.decide)(n.name.trim()||E.reading.name),quote:A,quoteLabel:we.readingHead,...E.how==="draw"||E.how==="again"?{quoteFolded:!0}:{},options:[...A4(n.error),...P?[]:[{id:"use",label:r?we.saveChanges:we.use}],...e.canDraw?[{id:"again",label:we.tryAgain}]:[]],...P?{quiet:!0}:{},describe:we.changeSomething}}else{const P=!r&&((S=a.source)==null?void 0:S.door)==="photos",T=!r&&((C=a.source)==null?void 0:C.door)==="shot",M=T?[{id:"another-shot",label:we.anotherShot}]:[],j=E.how==="change"?we.agreeChanged:P?we.agreePhotos:T?we.agreeShot:we.agree;m={id:`agree-${n.current}`,kind:"confirm",prompt:e.canDraw?E.reading.hero==="place"?j:`${j} ${we.drawsTwo}`:we.agreeBlind,quote:A,quoteLabel:we.readingHead,options:[...A4(n.error),...e.canDraw?[{id:"draw",label:we.draw}]:[{id:"use",label:r?we.saveChanges:we.saveWords}],...M]}}}}for(const E of t.asides.filter(A=>!l.has(A)).sort(qk))i.push(...mi(E));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 Fre(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:Ua[g.role],view:g.role,...a.running||n.job?{}:{retry:g.role}});else if(g.state==="failed"){const w=g.error?nf(g.error):null;e.push({kind:"scenri",id:`ex-failed-${g.role}`,text:w?we.exampleFailedSaid(Ua[g.role],w):we.exampleFailed(Ua[g.role],g.error??we.failed),tone:"alert"})}m()}function _re(e){var u;const{set:t,studio:n}=e,r=n.name.trim()||((u=Lr(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=>Ua[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=>Ua[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=Lr(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 Xk(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 Vre(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"?Uo({kind:"source"},we.sourcePlaceholder,!0):i&&Np(i)?Uo({kind:"row",id:i},we.rowPlaceholder(Tk(i))):i==="photos"?a(we.photosOff):i==="shot"?a(we.shotOff):i==="reuse"?a(we.reuseOff):!t&&!r.job&&n.answers.source&&!QR(n.answers)?Uo({kind:"source"},we.nothingSaidPlaceholder,!0):t?t.id==="source"?Uo({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):Np(t.id)?Uo({kind:"row",id:t.id},we.rowPlaceholder(Tk(t.id))):t.id==="name"?Uo({kind:"name"},we.namePlaceholder):t.id==="retry"?Uo({kind:"source"},we.nothingSaidPlaceholder,!0):t.id.startsWith("agree-")?e.canDraw?Uo({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-")?{...Uo({kind:"change"},we.changePlaceholder),action:we.change}:a(""):r.job?a("",!0):a("")}function Uo(e,t,n=!1){return{target:e,placeholder:t,label:t,action:we.send,working:!1,attach:n}}const Zre=/\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,uP=e=>Zre.test(e)||e.trim().split(/\s+/).length>=5&&!/\?\s*$/.test(e);function Qk(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 Jk(e,t){if(t==="source"){const r=Qo(e,uP);return r==="vague"?null:r}const n=Qo(e,()=>!1);return n==="vague"||n==="intent"||n==="likeness"?null:n}const dP=2;function zre(e,t){return JSON.stringify({v:dP,setup:cre(e),studio:Rre(t)})}function fP(e){if(!e)return null;try{const t=JSON.parse(e);return(t==null?void 0:t.v)!==dP?null:{setup:dre(t.setup),studio:Pre(typeof t.studio=="string"?t.studio:null)}}catch{return null}}const Qw=e=>`scenri:scene-studio:${e}:`;function Bre(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=fP(typeof(n==null?void 0:n.session)=="string"?n.session:null),a=r==null?void 0:r.studio;if(!a||!aP(a))return null;const i=[a.versions[a.current],...[...a.versions].reverse()].find(m=>m==null?void 0:m.hash),l=Lr(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 Ure(e,t,n=Wre()){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 Wre(){var t;const e=[];for(const n of Sr.keys("scenri:scene-studio:"))try{(t=JSON.parse(Sr.get(n)??"null"))!=null&&t.sceneId&&e.push(n.slice(n.lastIndexOf(":")+1))}catch{}return e}function Kre(e){return e.drawing?"Drawing":e.hash?"Drawn, not used yet":e.failed?"Did not finish":"Not drawn yet"}function Kh(e){const t=Qw(e);return Sr.keys(t).map(n=>Bre(n.slice(t.length),Sr.get(n))).filter(n=>!!n)}function Gre(e,t){Sr.set(e,JSON.stringify({at:Date.now(),sceneId:t,done:!0}))}function Yre(e,t){try{const n=JSON.parse(Sr.get(`${Qw(e)}${t}`)??"null");return(n==null?void 0:n.done)===!0&&typeof n.sceneId=="string"?n.sceneId:null}catch{return null}}function qre(e,t){const n=`${Qw(e)}${t}`;Sr.del(n),el(n)}function Xre(e,t,n,r){const a=Oee(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 hP(){const{brand:e,recent:t,products:n}=un(),r=Bn(),a=Pl(),i=!!mn(ht.hub),l=!!mn(ht.hubShot),u=!!mn(ht.products),f=!!mn(ht.scenes),h=!!mn(ht.presenters),p=!!mn(ht.presenterStudio),m=!!mn(ht.sceneStudio);return s.useCallback(async g=>{var E,A;const w=t.find(P=>P.kind!=="root"&&P.status==="done"&&P.images.length>0),y=g==="refine"&&!w?"first-shot":g==="reuse"&&n.length===0?"product":g,b=zh().active;(b==null?void 0:b.task)===y&&b.brandId===e.id&&!b.paused||await tc({start:{task:y,brandId:e.id}});const k=((A=(E=zh().progress)==null?void 0:E[y])==null?void 0:A.reached)??[],S=zh().activeDraftId,C=Xre(y,{onHub:i,onShot:l,onProducts:u,onScenes:f,onPresenters:h,onStudio:p,onSceneStudio:m},k,S);switch(C.kind!=="head"&&e4(),C.kind){case"stay":try{window.localStorage.removeItem(J6(e.id,y)),(y==="first-shot"||y==="reuse")&&window.localStorage.removeItem(pN(e.id))}catch{}return(y==="first-shot"||y==="reuse")&&i?r(xr(e)):void 0;case"head":return mN(e.id,y);case"hub":return r(xr(e));case"products":return r(_u(e));case"scenes":return r(sl(e));case"presenters":return r(ni(e));case"studio":return r(ol(e,S));case"sceneStudio":{const P=Kh(e.id).sort((T,M)=>M.at-T.at)[0];return r(al(e,(P==null?void 0:P.convo)??null))}case"dialog":return a(C.asset)}},[e,t,n,r,a,i,l,u,f,h,p,m])}const Qre=Number(window.localStorage.getItem("scenri:welcome-settle-ms")??900),Jre='[role="dialog"]:not(.sc-coach):not(.sc-attachpanel):not(.sc-swap), [role="alertdialog"], .sc-lightbox',ese='[data-guide="compose"] .sc-attachpanel';function tse(){var Oe,mt,yt,Et,st,vt,Ae;const e=dw(),t=xR(),n=Dn(),{brand:r,recent:a,subscribeActivity:i,products:l,importing:u}=un(),{tasks:f,builds:h}=ea(),{push:p}=rr(),m=hP(),g=Bn(),[w]=gl(),y=Er("new"),b=!!mn(ht.brand),k=!!mn(ht.hub),S=((Oe=mn(ht.hubShot))==null?void 0:Oe.params.shotId)??null,C=!!mn(ht.presenterStudio),E=!!mn(ht.sceneStudio),A=!!mn(ht.products),P=!!mn(ht.scenes),T=!!mn(ht.presenters),M=e.active,j=M&&M.brandId===r.id?M.task:null,R=j&&!(M!=null&&M.paused)?j:null,L=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(!(!L||!M))return i(xe=>B(Xe=>Aee(Xe,xe,M.since,L)))},[L,M,i]);const V=!!((mt=t.composer)!=null&&mt.busy),W=s.useRef(!1),[K,F]=s.useState(!1);s.useEffect(()=>{W.current&&!V&&L&&(F(!0),c8().finally(()=>F(!1))),W.current=V},[V,L]);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,X]=s.useState(()=>!document.hidden);s.useEffect(()=>{const xe=()=>X(!document.hidden);return document.addEventListener("visibilitychange",xe),()=>document.removeEventListener("visibilitychange",xe)},[]);const Z=!!R||H,J=yN.some(xe=>w.has(xe)),me=Z&&(J||[...document.querySelectorAll(Jre)].some(xe=>!xe.closest("[data-radix-popper-content-wrapper], .sc-shotsheet"))),ne=w.get("new"),fe=R?`scenri:guide-begun:${r.id}:${R}`:null,[re,ee]=s.useState(!1);s.useEffect(()=>{ee(!!fe&&window.localStorage.getItem(fe)==="1")},[fe]);const Q=s.useCallback(()=>{if(fe)try{window.localStorage.setItem(fe,"1")}catch{}ee(!0)},[fe]),he=e.heading,Me=xe=>!!xe&&(he==null?void 0:he.brandId)===r.id&&he.task===xe&&!me,ce=xe=>xe==="first-shot"||xe==="reuse"||xe==="refine"?k:xe==="product"?A:xe==="scene"?P:xe==="presenter"?T||C:!1,[ke,Be]=s.useState(!1);s.useEffect(()=>{let xe=!1;try{xe=!!R&&window.localStorage.getItem(J6(r.id,R))==="1"}catch{}Be(xe)},[R,r.id,he]),s.useEffect(()=>{if(!(!he||he.brandId!==r.id)&&ce(he.task)){try{window.localStorage.setItem(J6(r.id,he.task),"1")}catch{}Be(!0),(he.task==="first-shot"||he.task==="reuse")&&Q(),e4()}},[he,k,A,P,T,C,r.id,Q]);const ft=s.useRef(null);s.useEffect(()=>{const xe=ft.current;!xe||ce(xe)||(ft.current=null,mN(r.id,xe))},[k,A,P,T,C,r.id]),s.useEffect(()=>{e.loaded&&!j&&he&&e4()},[e.loaded,j,he]);let Ue=null;if(R==="first-shot"||R==="reuse"){const xe=((yt=t.composer)==null?void 0:yt.brandId)===r.id?t.composer:null,Xe=k&&Me(R),Ct={here:k&&!me,heading:Me(R)&&!k,composer:xe&&K?{...xe,busy:!0}:xe,nodes:D,begun:re||Xe||D.length>0};Ue=R==="reuse"?pR(Ct):hR(Ct)}else if(R==="refine"){const xe=((Et=t.composer)==null?void 0:Et.brandId)===r.id?t.composer:null,Xe=!!S;Ue=wee({here:Xe||k&&!me,heading:Me(R)&&!k&&!Xe,open:Xe,armed:k&&!!(xe!=null&&xe.refining),nodes:D,asking:Xe?!!Ql(gR):!!Ql(yp)})}else R==="presenter"?Ue=vR({heading:Me(R)&&!T&&!C,onPage:T&&!C&&!me,studio:C?t.studio:null}):R==="scene"?Ue=bee({heading:Me(R)&&!P&&!E,onPage:P&&!E&&!me,studio:E?t.studio:null}):R==="product"&&(Ue=xee({heading:Me(R)&&!A,onPage:A&&!me&&ne!=="product",dialogOpen:ne==="product"}));const Qe=((st=t.composer)==null?void 0:st.brandId)===r.id?t.composer:null,Pe=R==="first-shot"&&Qe?mR(Qe):R==="reuse"&&Qe?Qe.products===0?"product":Qe.scene?null:"scene":null,G=!!((vt=t.composer)!=null&&vt.pickerOpen);s.useEffect(()=>{G&&(R==="first-shot"&&!Pe?window.dispatchEvent(new Event("scenri:guide-close-picker")):Pe&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:Y5[Pe]}})))},[R,G,Pe]),s.useEffect(()=>{R==="first-shot"&&!Pe&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:null}}))},[R,Pe]),s.useEffect(()=>{if(R)return document.documentElement.dataset.guideTask=R,()=>{delete document.documentElement.dataset.guideTask}},[R]);const se=(Ue==null?void 0:Ue.point)===ese&&window.innerWidth<1024;if(s.useEffect(()=>{if(se)return document.documentElement.dataset.guidePicker="",()=>{delete document.documentElement.dataset.guidePicker}},[se]),R&&Ue&&Ue.voice!=="quiet"){const xe=Iee(R,Ue.id);xe&&(Ue={...Ue,...xe})}const We=R&&Ue&&Ue.voice!=="quiet"?Ue.id:null,Ze=s.useRef("");s.useEffect(()=>{var Xe,Ct;if(!R||!We)return;const xe=`${R}:${We}`;Ze.current!==xe&&(Ze.current=xe,!((Ct=(Xe=e.progress)==null?void 0:Xe[R])!=null&&Ct.reached.includes(We))&&tc({reached:{task:R,moment:We}}))},[R,We,e.progress]);const oe=Ue,q=s.useRef(new Set),ae=s.useCallback(xe=>{q.current.add(xe),tc({finish:xe})},[]),Le=s.useCallback(xe=>{tc({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)&&ae("first-shot")},[R,S,D,ae]),s.useEffect(()=>{R==="refine"&&S&&c8()},[R,S]);const Ie=s.useRef(!1);s.useEffect(()=>{if(R!=="refine"){Ie.current=!1;return}S?Ie.current=!0:Ie.current&&(Ie.current=!1,ae("refine"))},[R,S,ae]);const Je=j==="presenter"||j==="scene"||j==="product",ge=h.filter(xe=>!xe.finished).length;s.useEffect(()=>{Je&&c8()},[Je,r,l.length,ge,u]),s.useEffect(()=>{Je&&e.counts&&See(e,e.counts)&&ae(M==null?void 0:M.task)},[Je,e,M,ae]);const et=!!((Ae=t.overlay)!=null&&Ae.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&&et&&a.some(ve=>ve.id===S&&ve.status==="done")&&bh("refine",xe)?"refine":E&&bh("scene",xe)?"scene":ne==="product"&&bh("product",xe)?"product":C&&bh("presenter",xe)?"presenter":null;!Ct||q.current.has(Ct)||(q.current.add(Ct),tc({start:{task:Ct,brandId:r.id}}))},[e,M,S,et,a,ne,C,E,r.id]);const[nt,pt]=s.useState(""),St=s.useRef(oe);St.current=oe;const at=s.useCallback((xe,Xe)=>{if(pt(""),Xe)return;const Ct=St.current,ve=Ct?[Ct.title,Ct.body].filter(Boolean).join(". "):"";ve&&requestAnimationFrame(()=>pt(ve))},[]),[_t,Lt]=s.useState(!1),Zt=Er("welcome"),Mt=Zt.value!==null,$t=b&&n.showcaseLoaded||k,Se=h.some(xe=>!xe.finished)||f.some(xe=>xe.state==="running"&&xe.kind!=="catalog"),Ke=Cee({onMainPage:b||k,eligible:e.eligible,welcome:e.welcome,ready:$t&&!document.querySelector('[data-variant="skeleton"]'),visible:z,blocked:me,busy:Se});s.useEffect(()=>{if(!Ke)return;const xe=window.setTimeout(()=>Lt(!0),Qre);return()=>window.clearTimeout(xe)},[Ke]);const kt=s.useMemo(()=>jee(n.showcase).map(xe=>nse(xe.previewUrl)),[n.showcase]),qe=n.engines.some(xe=>xe.available),ot=l.length>0,rt=oe&&(oe.voice==="ask"||oe.voice==="note")?oe:null,tn=rt!=null&&rt.shell?Ql(rt.shell):document.body,Qt=rt!=null&&rt.point?Ql(rt.point):null,on=(rt==null?void 0:rt.live)??(rt!=null&&rt.point?[rt.point]:[]),Wt=on.map(xe=>Ql(xe)).filter(xe=>!!xe),zt=((rt==null?void 0:rt.also)??[]).map(xe=>Ql(xe)).filter(xe=>!!xe),Ut=((rt==null?void 0:rt.lit)??[]).map(xe=>Ql(xe)).filter(xe=>!!xe),te=!!rt&&!!tn&&(!rt.point||!!Qt)&&Wt.length===on.length,ie=rt&&!te?rt:null,pe=_t||te;s.useEffect(()=>ek(pe),[pe]),s.useEffect(()=>()=>ek(!1),[]),s.useEffect(()=>{if(!ie)return;const xe=(ie.shell?document.querySelector(ie.shell):null)??document.querySelector(".sc-feed")??document.body,Xe=new MutationObserver(Y);return Xe.observe(xe,{childList:!0,subtree:!0}),()=>Xe.disconnect()},[ie==null?void 0:ie.id,ie==null?void 0:ie.shell,Y]);const Fe=xe=>{R&&(xe.done?ae(R):Le(R))};return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:nt}),rt&&te&&o.jsx(Tte,{id:rt.id,voice:rt.voice,target:Qt,live:Wt,also:zt,lit:Ut,side:rt.side??"top",beside:rt.beside,soft:rt.soft,container:tn,title:rt.title,body:rt.body,at:rt.at,of:rt.of,canBack:kee(R,rt.id,ke||!!(k&&Me(R))),action:rt.start?{label:"Start"}:rt.done?{label:"Done"}:null,closeLabel:rt.done?"Close":"Close guide",onBack:()=>{const xe=R?yR(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:Y5[xe]}}));return}if(R==="presenter"&&(rt.id==="start"||rt.id==="face"||rt.id==="save"))return g(ni(r),{replace:!0});if((R==="product"||R==="scene")&&rt.id===R)return y.close();if(R==="refine"&&rt.id==="ask"){if(S)return g(xr(r),{replace:!0});window.dispatchEvent(new Event("scenri:guide-clear-refine"));return}if(ke&&R&&(rt.id==="new"||rt.id==="choose"||rt.id==="product"))return window.dispatchEvent(new Event("scenri:guide-close-picker")),ft.current=R,g(No(r))},onAction:()=>{if(rt.start)return Q();rt.done&&R&&ae(R)},onClose:()=>Fe(rt),onEscape:()=>Fe(rt),onShown:at,onLost:Y}),o.jsx(_ee,{open:_t||Mt,pictures:kt,note:$u.note({engineReady:qe,ownsProducts:ot}),onTake:()=>{const xe=_t;Lt(!1),Mt&&Zt.close(),xe?tc({welcome:"taken"}).then(()=>m("first-shot")):window.setTimeout(()=>void m("first-shot"),0)},onDecline:()=>{const xe=_t;Lt(!1),Mt&&Zt.close(),xe&&tc({welcome:"declined"})}})]})}function Ql(e){for(const t of document.querySelectorAll(e))if(t.getClientRects().length>0)return t;return null}function nse(e){return`${e}${e.includes("?")?"&":"?"}w=320`}const rse="lessons";function sse(){var F;const e=Er("learn"),t=e.value!==null,n=Tee(e.value),r=jr(ta),a=dw(),i=xR(),{brand:l,recent:u,products:f}=un(),h=hP(),[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=t4.current,t4.current=null)},[t]);const b=()=>{const _=g.current;if(g.current=!1,_)return;const O=y.current==="help";requestAnimationFrame(()=>{var X;if(document.activeElement!==document.body)return;const Y=O?".sc-help-btn":".sc-learn-btn",z=O?".sc-learn-btn":".sc-help-btn";(X=document.querySelector(Y)??document.querySelector(z))==null||X.focus()})},k=!!mn(ht.hub),S=!!mn(ht.presenterStudio),C=!!mn(ht.presenters),E=_=>{var O;return((O=a.heading)==null?void 0:O.brandId)===l.id&&a.heading.task===_},A=((F=a.active)==null?void 0:F.brandId)===l.id&&!a.active.paused?a.active.task:null,P=u.some(_=>_.kind!=="root"&&_.status==="done"&&_.images.length>0),T=_=>_.needs==="shot"&&!P||_.needs==="product"&&f.length===0?_.needs??null:null,M=_=>{var Z,J,me,ne,fe,re;const O=((J=(Z=a.progress)==null?void 0:Z[_.id])==null?void 0:J.reached)??[];if(A!==_.id)return tk(_.id,O,null);const Y=((me=i.composer)==null?void 0:me.brandId)===l.id?i.composer:null,z={here:k,heading:E(_.id),composer:k?Y:null,nodes:a.activeNodes,begun:!0},X=_.id==="first-shot"?((ne=hR(z))==null?void 0:ne.id)??null:_.id==="reuse"?((fe=pR(z))==null?void 0:fe.id)??null:_.id==="presenter"?((re=vR({heading:E("presenter"),onPage:C&&!S,studio:S?i.studio:null}))==null?void 0:re.id)??null:null;return tk(_.id,O,{moment:X,nodes:a.activeNodes,draft:!!a.activeDraftId})},j=_=>Dee(_.id,a,l.id,M(_)),R=Hee(Yi,j),L=n??R??Yi[0],H=Yi.filter(_=>j(_)==="done").length;s.useEffect(()=>{if(t)for(const _ of Object.values(b4))new Image().src=_.wide},[t]);const D=s.useRef(null),B=s.useRef(new Map),V=s.useRef(null),W=s.useRef(!1);s.useEffect(()=>{var Y;const _=t&&!W.current;if(W.current=t,!t)return;const O=()=>{var z,X;(z=D.current)==null||z.focus({preventScroll:!0}),(X=D.current)==null||X.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 K=(_,O)=>o.jsx(ase,{lesson:_,state:j(_),at:M(_),blocked:T(_),describe:O,actionRef:D,onBegin:()=>w(_.id)});return o.jsx(Fs,{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(rse),"aria-label":"All lessons",children:o.jsx(Aa,{size:15})}),o.jsx(ks,{className:"sc-newdlg-title",children:n.title}),o.jsx(eS,{})]}),o.jsx("div",{className:"sc-newdlg-body sc-learn-body",children:K(n,!0)})]},`one-${n.id}`):o.jsxs("div",{className:"sc-learn-level",children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ks,{className:"sc-newdlg-title",children:"Learn"}),o.jsxs("span",{className:"sc-learn-count",children:[H," of ",Yi.length," done"]}),o.jsx(eS,{})]}),o.jsx(Ec,{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:Yi.map(_=>o.jsx("li",{children:o.jsxs("button",{type:"button",className:"sc-learn-row","data-state":j(_),"aria-current":!r&&L.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:b4[_.id].square,alt:"",decoding:"async"})}),o.jsxs("span",{className:"sc-learn-say",children:[o.jsx("span",{className:"sc-learn-name",children:_.title}),o.jsx(pP,{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&&K(L,!1)]})]},"all")})}function ase({lesson:e,state:t,at:n,blocked:r,describe:a,actionRef:i,onBegin:l}){const u=r?y4[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(Ec,{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:b4[e.id].wide,alt:"",decoding:"async"})}),o.jsxs("div",{className:"sc-learn-copy",children:[o.jsx("div",{className:"sc-learn-kicker",children:o.jsx(pP,{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:kR(e).map((m,g)=>{const w=h(g),y=o.jsx("span",{className:"sc-learn-n","aria-hidden":"true",children:w==="done"?o.jsx(Gn,{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(ma,{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:y4[r].note})]})]})]})}function pP({lesson:e,state:t,at:n,blocked:r}){const a=kR(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(Gn,{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:y4[r].status}):o.jsxs("span",{className:"sc-learn-status",children:[a," step",a===1?"":"s"]})}function eS(){return o.jsx(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})})}const mP=s.createContext(null),ose={products:[],productsLoaded:!1,importing:!1,refreshProducts:async()=>{}};function un(){const e=s.useContext(mP),t=_M()??ose;if(!e)throw new Error("useBrand must be used inside BrandLayout");return s.useMemo(()=>({...e,...t}),[e,t])}const gP=s.createContext(null);function ise(){const e=s.useContext(gP);if(!e)throw new Error("useAssetsPanel must be used inside BrandLayout");return e}function lse(){const{brandSlug:e}=Qs(),{pathname:t,search:n}=Un(),r=mn({path:ht.brand,end:!1}),{brands:a,engines:i,refresh:l}=Dn(),[u,f]=s.useState(null),[h,p]=s.useState(null),[m,g]=s.useState([]),[w,y]=s.useState([]),[b,k]=s.useState({}),[S,C]=s.useState(!1),[E,A]=s.useState(0),P=s.useCallback(()=>A(re=>re+1),[]),T=Bn(),[M,j]=Sa(Kr.assetsOpen,window.innerWidth>=1280),R=s.useCallback(()=>j(re=>!re),[]),L=s.useMemo(()=>({open:M,toggle:R,setOpen:j}),[M,R]);JX();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 Ne.workspace(re);B.current===re&&(f(ee.project),p(ee.root),g(ee.recent),y(ee.sets),k(ee.membership),C(!0))},[D==null?void 0:D.id]),W=s.useRef(new Set),K=s.useCallback(re=>(W.current.add(re),()=>{W.current.delete(re)}),[]),F=s.useCallback(re=>{if(re.length){g(ee=>fee(ee,re));for(const ee of W.current)ee(re)}},[]),_=s.useCallback((re,ee)=>{!D||re!==D.id||F(ee)},[D==null?void 0:D.id,F]),O=s.useCallback(re=>y(ee=>ee.map(Q=>Q.id===re.id?re:Q)),[]),Y=s.useCallback(re=>y(ee=>ee.filter(Q=>Q.id!==re)),[]),z=s.useCallback(re=>y(ee=>ee.some(Q=>Q.id===re.id)?ee:[re,...ee]),[]),X=s.useCallback((re,ee)=>k(Q=>({...Q,[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:X,applyNodes:F,subscribeActivity:K,shotsEpoch:E,resetShots:P}:null,[D,u,h,m,w,b,S,V,O,Y,z,X,F,K,E,P]);s.useEffect(()=>{C(!1),g([]),p(null)},[D==null?void 0:D.id]),s.useEffect(()=>{D&&dG(D.id)},[D==null?void 0:D.id]),s.useEffect(()=>{V()},[V]);const J=s.useCallback(()=>{l(),V()},[l,V]),me=r?t.slice(r.pathnameBase.length):"",ne=!!D&&e!==D.slug,fe=D?No(D)+me+n:"";if(s.useEffect(()=>{ne&&T(fe,{replace:!0})},[ne,fe,T]),!D){const re=cR(a),ee=!!H.current&&!a.some(Me=>Me.id===H.current),Q=new URLSearchParams(n);ee&&(Q.delete("settings"),Q.delete("new"));const he=Q.toString();return o.jsx(Ka,{to:re?No(re)+me+(he?`?${he}`:""):ht.root,replace:!0})}return o.jsxs(mP.Provider,{value:Z,children:[o.jsx(MJ,{engines:i,brandId:D.id,onSaved:J}),o.jsx(see,{engines:i,onSaved:l}),o.jsx(QJ,{}),o.jsx(pq,{brand:D,onActivity:_,children:o.jsxs(eQ,{brand:D,children:[o.jsx(fse,{}),o.jsx(VX,{children:o.jsxs(gP.Provider,{value:L,children:[o.jsxs("div",{className:"sc-shell",children:[o.jsx(XX,{}),o.jsx(Rc,{}),o.jsx(Mq,{})]}),o.jsx(tse,{}),o.jsx(sse,{}),o.jsx(Ree,{})]})})]})})]})}const cse=Number(window.localStorage.getItem("scenri:whatsnew-settle-ms")??2500)||2500,vP=s.createContext(null);function Zc(){const e=s.useContext(vP);if(!e)throw new Error("useWhatsNew must be used inside WhatsNewProvider");return e}function use({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState("loading"),[i,l]=s.useState(!1),[u,f]=s.useState([]),h=Er("whatsnew");s.useEffect(()=>{let M=!0;return Ne.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)??tS,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}),Ne.releaseSeen(t.version).catch(()=>{}))},[t]),C=(t==null?void 0:t.releasesUrl)??null,E=s.useCallback(M=>C?`${C}/tag/v${M}`:null,[C]),A=s.useCallback(M=>u.includes(M),[u]),P=s.useCallback(M=>{u.includes(M)&&(f(j=>j.filter(R=>R!==M)),Ne.releaseUsed(M).catch(()=>{}))},[u]),T=s.useMemo(()=>({status:r,recent:p,history:(t==null?void 0:t.history)??tS,featured:m,running:t&&t.version!=="0.0.0"?t.version:null,unseen:(t==null?void 0:t.unseen)??dse,lead:g,releasesUrl:C,notesFor:E,unread:((t==null?void 0:t.unseen.length)??0)>0,autoOpenSpent:i,autoOpen:b,markSeen:S,isNew:A,markUsed:P}),[r,t,p,m,g,C,E,i,b,S,A,P]);return o.jsx(vP.Provider,{value:T,children:e})}const tS=[],dse=[];function fse(){var S;const e=Zc(),{running:t,builds:n}=ea(),{loaded:r}=un(),[a]=gl(),i=!!mn(ht.whatsNew),[l,u]=s.useState(()=>!document.hidden),f=s.useRef(!1),h=dw(),p=$ee(),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 C=()=>u(!document.hidden);return document.addEventListener("visibilitychange",C),()=>document.removeEventListener("visibilitychange",C)},[]);const k=yN.some(C=>a.has(C));return s.useEffect(()=>{if(!$J({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 E=window.setTimeout(()=>{f.current=!0,e.autoOpen()},cse);return()=>window.clearTimeout(E)},[e,r,l,k,t,n,w,i]),null}const hse=5e3,wP=s.createContext(null);function Dn(){const e=s.useContext(wP);if(!e)throw new Error("useAppData must be used inside AppShell");return e}function pse(){const e=GG(),[t,n]=s.useState(null),[r,a]=s.useState([]),[i,l]=s.useState(null),u=qG(),f=QG(),h=eY(),p=nY(),[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:C}=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,C])B({quiet:!0})},[m,b,k,S,C]);const E=s.useRef(0),A=s.useRef(new Map),P=s.useRef(0),T=s.useRef(!1),M=s.useCallback(D=>{A.current.set(D.id,++E.current),n(B=>B&&vY(B,D))},[]),j=s.useCallback(async()=>{const D=++E.current;P.current=D;const B=await Ne.brands();if(P.current!==D)return;const V=new Set;for(const[W,K]of A.current)K>D&&V.add(W);n(W=>wY(W,B,V))},[]),R=s.useCallback(()=>j().catch(()=>{}),[j]),L=s.useCallback(async()=>{try{await Promise.all([j(),Ne.engines().then(a)]),T.current=!0}catch(D){T.current||l(String(D.message??D))}},[j]);s.useEffect(()=>{L(),FG()},[L]),s.useEffect(()=>{let D=0;const B=()=>{document.hidden||Date.now()-D<hse||(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:L,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,L,R,M,m==null?void 0:m.arriving,w]);return i?o.jsx(Ts,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(hw,{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(Ts,{align:"center",justify:"center",height:"100vh",children:o.jsx(Rr,{size:"3"})}):o.jsx(wP.Provider,{value:H,children:o.jsx(gN.Provider,{value:e,children:o.jsx(fY,{children:o.jsxs(use,{children:[o.jsx(m7,{}),o.jsx(Rc,{})]})})})})}function Er(e){const[t,n]=gl(),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 Eh(e,t=""){const[n,r]=gl(),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 nS(e,t){const n=rS(t.name),r=sS(t.url);return!n&&!r?null:e.find(a=>{var i,l,u,f;return!!(r&&sS((l=(i=a.json)==null?void 0:i.meta)==null?void 0:l.website)===r||n&&rS(((f=(u=a.json)==null?void 0:u.meta)==null?void 0:f.name)??a.slug)===n)})??null}const rS=e=>String(e??"").trim().replace(/\s+/g," ").toLowerCase()||null,sS=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 mse(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 gse(e){return e.logo.status!=="primary"||e.colors.count===0||e.name.source==="hostname"}const m0=(e,t=!1)=>({key:"products",found:t,label:"Products",value:e});function vse(e){switch(e.kind){case"idle":return null;case"scanning":return m0("looking for a shop");case"timeout":return m0("this site took too long to search");case"error":return m0("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 m0(`${n?"about ":""}${t.count.toLocaleString()} found`,!0)}return m0("we could not load the catalogue")}}}function wse(e){return e.kind==="timeout"||e.kind==="error"?!0:e.kind==="result"&&(e.scan.verdict==="blocked"||e.scan.verdict==="likely")}function yse(e){var t;return!e||e.verdict!=="found"?!1:e.candidates.length>0||(((t=e.cards)==null?void 0:t.length)??0)>0}function bse(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 xse(){var re,ee,Q,he,Me,ce;const{brands:e,refresh:t}=Dn(),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),[C,E]=s.useState(!1),[A,P]=s.useState(null),[T,M]=s.useState(null),[j,R]=s.useState(null),[L,H]=s.useState(null),D=s.useRef(!1),B=s.useRef(null),V=async(ke,Be)=>{D.current=!0,B.current=null,b(ke),await t(),n(`${No(ke)}${Be?`?settings=${Be}`:""}`,{replace:!0})},W=s.useRef(!1);s.useEffect(()=>{W.current=!1;const ke=()=>{const Be=B.current;!Be||D.current||(B.current=null,fetch(`/api/brands/${Be}`,{method:"DELETE",keepalive:!0}).catch(()=>{}))};return window.addEventListener("pagehide",ke),()=>{W.current=!0,window.removeEventListener("pagehide",ke),ke()}},[]);const K=async(ke=!1)=>{var Be,ft;if(!ke){const Ue=nS(e,{url:a.trim()});if(Ue){H(Ue);return}}m(!0),w(null);try{const Ue=await Ne.brandFromUrl(a);if(W.current){fetch(`/api/brands/${Ue.id}`,{method:"DELETE",keepalive:!0}).catch(()=>{});return}b(Ue),B.current=Ue.id,P(Ue.report),M(((Be=Ue.report)==null?void 0:Be.read)===!1&&((ft=Ue.warnings)==null?void 0:ft.slice(0,2).join(" "))||null),m(!1)}catch(Ue){w(String(Ue.message??Ue)),m(!1)}},F=async(ke=!1)=>{if(!ke){const Be=nS(e,{name:l});if(Be){H(Be);return}}m(!0),w(null);try{await V(await Ne.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:X}=PM((y==null?void 0:y.id)??null),Z=vse(z),J=z.kind==="timeout"||z.kind==="error",me=async ke=>{var Be,ft;if(y){R(null),E(!0);try{await Ne.catalogImport(y.id,String(((ft=(Be=y.json)==null?void 0:Be.meta)==null?void 0:ft.website)??a),ke)}catch{R("That did not start. Check your connection and try again."),E(!1);return}E(!1),S(!1),await V(y)}},ne=y?qs((re=y.json)==null?void 0:re.palette):[],fe=y?qr((ee=yq(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(Aa,{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(Rr,{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"})})]}):J?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:X,children:["Look for products again ",o.jsx(ma,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y),children:"Continue without products"})})]}):yse(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(ma,{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(ma,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void V(y,"brand"),children:A&&gse(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:ke=>{u(ke.target.value),H(null)},onKeyDown:ke=>ke.key==="Enter"&&l.trim()&&!p&&void F()}),o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!l.trim()||p,onClick:()=>void F(),children:p?o.jsx(Rr,{size:"1"}):o.jsxs(o.Fragment,{children:["Create it ",o.jsx(ma,{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:ke=>{i(ke.target.value),H(null)},onKeyDown:ke=>ke.key==="Enter"&&a.trim()&&!p&&void K()}),o.jsx("p",{className:"sc-wiz-hint",children:"We only read public pages. Nothing leaves this machine."}),o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!a.trim()||p,onClick:()=>void K(),children:p?o.jsx(Rr,{size:"1"}):o.jsxs(o.Fragment,{children:["Build the kit ",o.jsx(ma,{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"})})]})]}),L&&o.jsxs(z6,{color:"amber",mt:"3",size:"1",children:[o.jsxs(B6,{children:["You already have ",ya(L),". 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(No(L)),children:["Open ",ya(L)," instead"]}),o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>{H(null),f?F(!0):K(!0)},children:"Create anyway"})]})]}),g&&o.jsx(z6,{color:"red",mt:"3",size:"1",children:o.jsx(B6,{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(Rr,{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:ne.length?16:0},children:[o.jsx("span",{className:"sc-kit-logo",style:{width:44,height:44,padding:7,borderRadius:12},children:fe?o.jsx("img",{src:fe,alt:""}):o.jsx(Na,{size:16,color:"var(--sc-fg3)"})}),o.jsxs("span",{children:[o.jsx("b",{dir:"auto",style:{fontFamily:"var(--sc-font-display)",fontSize:16},children:(he=(Q=y.json)==null?void 0:Q.meta)==null?void 0:he.name}),((ce=(Me=y.json)==null?void 0:Me.meta)==null?void 0:ce.tagline)&&o.jsx("small",{dir:"auto",style:{display:"block",color:"var(--sc-fg3)",fontSize:11.5},children:bse(String(y.json.meta.tagline),72)})]})]}),ne.length>0&&o.jsx("div",{style:{display:"flex",gap:8},children:ne.slice(0,5).map(ke=>o.jsx("span",{style:{flex:1,height:44,borderRadius:9,border:"1px solid var(--sc-line)",background:ke.hex}},ke.hex))}),A&&o.jsx("ul",{className:"sc-kit-lines",role:"status",children:[...mse(A),...Z?[Z]:[]].map(ke=>o.jsxs("li",{"data-found":ke.found?"":void 0,children:[ke.key==="products"&&Y?o.jsx(Rr,{size:"1"}):ke.found?o.jsx(Gn,{size:12,weight:"bold"}):o.jsx(qI,{size:12}),o.jsx("span",{className:"sc-kit-line-label",children:ke.label}),o.jsx("span",{className:"sc-kit-line-value",children:ke.value})]},ke.key))}),T&&o.jsx("p",{className:"sc-kit-note",role:"status",children:T}),!Y&&!J&&wse(z)&&o.jsx("button",{type:"button",className:"sc-wizpick-open",onClick:X,children:"Try the catalogue again"})]})]})]})}),k&&O&&y&&o.jsx(RM,{brandId:y.id,scan:O,busy:C,error:j,onImport:ke=>void me(ke),onImportAll:()=>void me(),onDismiss:()=>S(!1)})]})}const Au=e=>{const t=(e??"").trim();return t||null};function kse(e){const t=e;return{name:e.name,brand:Au(t.brand)??Au(t.vendor),qualifier:Au(t.format)??Au(t.subcategory)??Au(t.variant)}}function Sse(e){return!e.brand||e.name.toLowerCase().startsWith(e.brand.toLowerCase())?e.name:`${e.brand} ${e.name}`}function Mo(e,t){const n=kse(e);if(t==="chip")return n.name;const r=Sse(n);return t==="tooltip"?[r,n.qualifier].filter(Boolean).join(" · "):r}function pl(e,t){return t==="tooltip"?[e.name,Au(e.lighting)].filter(Boolean).join(" · "):e.name}function Rp(e){return[e.name,...e.legacyNames??[],...e.keywords??[],e.description,e.lighting,e.subject].concat(e.collections??[],e.verticals??[]).filter(Boolean).join(" ")}function Jw(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 Pp(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 Ese(e,t,n){return[e.title,e.category,n,t.product?Jw(t.product):null,t.presenter?Pp(t.presenter):null,t.scene?Rp(t.scene):null].filter(Boolean).join(" ")}function ey(){const{brand:e}=un(),t=Bn(),n=xr(e);return s.useCallback(r=>{t(`${n}?presenter=${encodeURIComponent(r)}&compose=1`)},[n,t])}function Gm(){const{brand:e}=un(),t=Bn(),n=xr(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`)},[n,t])}function N4(e){return{...e.brief,...e.quality?{quality:e.quality}:{},_at:Date.now()}}function Cse(){const{brand:e}=un(),t=Bn(),n=xr(e);return s.useCallback(r=>{t(`${n}?showcase=${encodeURIComponent(r)}`)},[n,t])}const Gh=e=>`sc-favscenes-${e}`,jse=e=>`sc-favlooks-${e}`,Ase=e=>`bt-favlooks-${e}`;function yP(e,t){return e==="presenter"?`sc-favpresenters-${t}`:e==="product"?`sc-favproducts-${t}`:Gh(t)}function bP(e){try{const t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function gi(e){try{const t=localStorage.getItem(Gh(e))??K6(jse(e),Gh(e))??K6(Ase(e),Gh(e));return bP(t)}catch{return[]}}function cd(e,t){try{return e==="scene"?gi(t):bP(localStorage.getItem(yP(e,t)))}catch{return[]}}function xP(e,t,n){try{localStorage.setItem(yP(e,t),JSON.stringify(n))}catch{}}function Ym(e,t,n){const r=cd(e,t),a=r.includes(n)?r.filter(i=>i!==n):[...r,n];return xP(e,t,a),a}function ty(e,t,n,r){const a=cd(e,t),i=r?[...a,...n.filter(l=>!a.includes(l))]:a.filter(l=>!n.includes(l));return xP(e,t,i),i}const kP=[{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"}],Nse=new Map(kP.map(e=>[e.key,e]));function F8(e){var t;return e?((t=Nse.get(e))==null?void 0:t.label)??e:null}function Mse(e){const t=new Map(kP.map((n,r)=>[n.key,r]));return[...e].sort((n,r)=>(t.get(n)??99)-(t.get(r)??99)||n.localeCompare(r))}function Rse(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=L=>{var H,D;window.removeEventListener("click",R,!0),!((D=(H=L.target).closest)!=null&&D.call(H,'[data-role="remove"]'))&&(L.stopPropagation(),L.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?Va(e,f):uc(e,R,"after"))},S=()=>{if(!a)return;const R=a;b(),y(),k(R),t.onCancelled()},C=R=>{if(R.button!==0||R.pointerType==="touch")return;const L=R.target;if(L.closest('[data-role="remove"]'))return;const H=Ui(L);H&&(r={chip:H,x:R.clientX,y:R.clientY})},E=R=>{var H,D;if(!r)return;f=go(e),a=r.chip,t.onDragStart(),(H=window.getSelection())==null||H.removeAllRanges(),e.setAttribute("data-chip-drag","");const L=a.getBoundingClientRect();p={dx:r.x-L.left,dy:r.y-L.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=`${L.width}px`,i.style.height=`${L.height}px`,i.style.fontSize=getComputedStyle(a).fontSize,m={w:L.width,h:L.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 L=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(${L}px, ${H}px, 0)`;const D=ck(e,a,R.clientX,R.clientY);if(u=D,!l)return;const B=D&&!D.noop?aS(e,D.units):null;if(!B||!D){l.style.display="none";return}const V=ote(e,D.units),W=V<D.units?aS(e,V):null,K=!!W&&Math.abs(W.top+W.height/2-(B.top+B.height/2))<B.height/2,F=W&&K?(W.left+B.left)/2:B.left;l.style.display="",l.style.transform=`translate3d(${F-1.5}px, ${B.top-2}px, 0)`,l.style.height=`${B.height+4}px`},P=R=>{if(r){if(Math.hypot(R.clientX-r.x,R.clientY-r.y)<5)return;R.preventDefault(),E(R);return}if(!a)return;R.preventDefault(),cancelAnimationFrame(g);const{clientX:L,clientY:H}=R;g=requestAnimationFrame(()=>A({clientX:L,clientY:H}))},T=R=>{if(r){r=null;return}if(!a)return;const L=a;let H;try{H=ck(e,L,R.clientX,R.clientY)??u}catch{H=u}finally{b()}if(y(),H&&!H.noop&&PR(e,L,H.units)){uc(e,L,"after"),t.onMoved(L,x4(e,L));return}k(L),t.onCancelled()},M=R=>{R.key==="Escape"&&a&&(R.stopPropagation(),S())},j=R=>{Ui(R.target)&&R.preventDefault()};return e.addEventListener("pointerdown",C),e.addEventListener("dragstart",j),e.addEventListener("lostpointercapture",S),window.addEventListener("pointermove",P),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",S),window.addEventListener("blur",S),window.addEventListener("keydown",M,!0),()=>{b(),e.removeEventListener("pointerdown",C),e.removeEventListener("dragstart",j),e.removeEventListener("lostpointercapture",S),window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",S),window.removeEventListener("blur",S),window.removeEventListener("keydown",M,!0)}}function aS(e,t){let n=0;const r=Array.from(e.childNodes);for(let l=0;l<r.length;l++){const u=r[l],f=id(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,kp(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 Pse({kind:e,label:t,thumb:n,onInspect:r,onMove:a,onRemove:i,onClose:l}){const{sheet:u,grip:f}=yd(()=>l("dismiss")),h=e==="mark"?"brand mark":"reference image";return o.jsx(yl,{open:!0,onOpenChange:p=>!p&&l("dismiss"),children:o.jsxs(bl,{children:[o.jsx(xl,{className:"sc-shotsheet-scrim"}),o.jsxs(kl,{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(Sl,{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(ma,{size:13})]})]}),i&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:i,children:[o.jsx(wl,{size:13}),"Remove ",e==="mark"?"mark":"reference"]})]})]})]})})}const Lse=440,$se=460,Tse=600,oS=156,SP=8,Yh=14,_8=20,yr=12,EP=200,Dse=240,CP=204;function Hse(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-yr*2),i=e.right+Yh+r+yr<=t.width?e.right+Yh:Math.max(yr,e.left-Yh-r),l=Math.max(yr,Math.min(e.top,t.height-yr-CP));return{left:i,top:l,width:r,maxHeight:Math.max(EP,t.height-l-yr),side:"beside"}}function Ose(e,t){const n=(r,a)=>Math.min(Math.max(r,_8),Math.max(_8,a-_8));return t.side==="beside"?{edge:t.left>=e.right?"left":"right",x:0,y:n((e.top+e.bottom)/2-t.top,CP)}:{edge:t.side==="above"?"bottom":"top",x:n((e.left+e.right)/2-t.left,t.width),y:0}}function Ise(e,t,n,r){if(e.bottom<0||e.top>t.height)return null;const a=SP,i=Math.min(n.width,t.width-yr*2),l=n.height,u=Math.min(Math.max(e.left+(e.right-e.left)/2-i/2,yr),Math.max(yr,t.width-i-yr)),h=e.top-a-yr>=l?e.top-a-l:Math.min(e.bottom+a,Math.max(yr,t.height-l-yr));return{left:u,top:h}}function ny(e,t,n){if(e.bottom<0||e.top>t.height)return null;const r=Math.min((n==null?void 0:n.width)??Lse,t.width-yr*2),a=(n==null?void 0:n.gap)??SP,i=e.top-a-yr,l=t.height-e.bottom-a-yr,u=i>=Dse||i>=l?"above":"below",f=u==="above"?i:l,h=Math.max(EP,Math.min((n==null?void 0:n.maxHeight)??$se,f)),p=Math.min(Math.max(e.left,yr),Math.max(yr,t.width-r-yr)),m=u==="above"?Math.max(yr,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 jP(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 Fse=["ref","mark","product","presenter","scene","shot"],qh=e=>Fse.includes(e),AP={ref:"Reference image",mark:"Brand mark",product:"Product",presenter:"Presenter",scene:"Scene",shot:"Shot"};function _se(e){return e.side==="below"||e.side==="beside"?{top:Math.round(e.top)}:{bottom:Math.round(window.innerHeight-(e.top+e.maxHeight))}}function Sd({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 C,E;const S=()=>{const A=window.visualViewport,P=e.getBoundingClientRect(),T={width:(A==null?void 0:A.width)??window.innerWidth,height:(A==null?void 0:A.height)??window.innerHeight},M=u==="beside"?Hse(P,T,{width:oS}):ny(P,T,{width:oS,gap:Yh});if(!M){m();return}w({...M,tail:Ose(P,M)})};return S(),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),(C=window.visualViewport)==null||C.addEventListener("resize",S),(E=window.visualViewport)==null||E.addEventListener("scroll",S),()=>{var A,P;window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),(A=window.visualViewport)==null||A.removeEventListener("resize",S),(P=window.visualViewport)==null||P.removeEventListener("scroll",S)}},[e,u,m]),s.useEffect(()=>{const S=C=>{C.key==="Escape"&&m()};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[m]),!g)return null;const k=l??AP[t];return zr.createPortal(o.jsxs("div",{className:"sc-chip-preview","data-kind":t,"data-side":g.side,"aria-hidden":"true",style:{left:Math.round(g.left),..._se(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(Na,{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 Vse=160,Zse=120;function Ed(){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),Vse)},[a]),l=s.useCallback(()=>{a(),n.current=setTimeout(()=>t(null),Zse)},[a]),u=s.useCallback(()=>{a(),t(null)},[a]);return s.useEffect(()=>a,[a]),{shown:e,open:i,keep:a,close:l,closeNow:u}}const M0="sc-insert-menu";function zse(e){var t;return!!(((t=e.nativeEvent)==null?void 0:t.isComposing)??e.isComposing)||e.keyCode===229}function Bse(e){return e==="/"?"Scenes":e==="@"?"Presenters":e==="#"?"Colors":"Products"}function Use(e){return e==="/"?"No matching scenes":e==="#"?"No matching colours":e==="@"?"No matching presenters":"No matching products"}function Wse({menuOpen:e,handled:t}){return!e&&!t}function Kse(e,t){return t||!e?{open:!1}:{open:!0,sigil:e.sigil,query:e.query}}function Gse(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 Yse(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.right-e.left,h:e.bottom-e.top}}function qse(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 Xse(e,t,n){return n?t:e||t}function Qse(e,t){return!t||e==null?!0:e===t?!1:!t.contains(e)}function V8(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 Jse(e,t,n){return Math.min(n,Math.max(0,e)+Math.max(0,t))}function eae(e,t,n){return n>0&&t>0&&e!==t}function tae(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 NP=320,Lp=320,nae=280,oc=8,nc=12,rae=8,iS=80,sae=120,MP=48;function RP(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>MP)}function aae(e){return{top:e.top,bottom:Math.min(e.bottom,e.top+22),left:e.left,right:e.left+2}}function PP(e,t,n,r){return Math.min(Math.max(e,r),Math.max(r,n.width-t-r))}function M4(e,t,n,r){const a=n?rae:nc,i=n?Math.max(0,e.right-e.left):Math.min(NP,t.width-a*2),l=n?e.left:PP(e.left,i,t,a),u=n?Math.min(nae,Math.floor(t.height*.4)):Lp,f=Math.min(u,r??u),h=e.top-oc-a,p=Math.max(0,Math.min(f,h)),m=Math.max(a,e.top-oc-p);return{left:l,top:m,width:i,maxHeight:p,side:"above",shell:"dock"}}function lS(e,t,n,r){const a=Math.min(NP,n.width-nc*2),i=PP(e.left,a,n,nc),l=e.top-oc-nc,u=n.height-e.bottom-oc-nc,f=l>=sae||l>=u?"above":"below",h=Math.min(Lp,r??Lp),p=f==="above"?l:u,m=Math.min(h,r==null?Math.max(iS,p):p);if(f==="above"){const w=Math.max(nc,e.top-oc-Math.min(h,l)),y=Math.min(h,e.top-oc-w);return r==null&&y<iS?M4(t,n,!1):{left:i,top:w,width:a,maxHeight:y,side:f,shell:"caret"}}const g=e.bottom+oc;return g+Math.min(m,u)>n.height-nc?M4(t,n,!1,r):{left:i,top:g,width:a,maxHeight:Math.min(h,u),side:f,shell:"caret"}}function oae(e,t,n,r={}){if(r.phone)return M4(t,n,!0,r.height);const a=r.line??t;if(RP(e,n)&&e)return lS(e,t,n,r.height);const i=e&&e.right-e.left>MP?e:a;return lS(aae(i),t,n,r.height)}function iae({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=jr(ta),[g,w]=s.useState(0),[y,b]=s.useState(null),k=s.useRef(null),S=s.useRef(null),C=s.useRef(null),E=s.useRef(null),A=`${u??""}\0${r}`,P=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;eae(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(()=>{E.current=null,P.current={}},[u]);const L=s.useCallback(V=>{var J;const W=t==null?void 0:t.getBoundingClientRect();if(!W)return null;const K=(n==null?void 0:n.getBoundingClientRect())??W,F=window.visualViewport,_={width:(F==null?void 0:F.width)??window.innerWidth,height:(F==null?void 0:F.height)??window.innerHeight},O=!!((J=k.current)!=null&&J.contains(document.activeElement)),Y=O?null:jR(),z=Y&&RP(Y,_)?Y:null;z&&(E.current=Yse(z,K));const X=E.current?qse(K,E.current):null,Z=Xse(z,X,O)??(O?null:(e==null?void 0:e.getBoundingClientRect())??null);return oae(Z,W,_,{phone:m,line:K,height:V})},[e,t,n,m]);s.useLayoutEffect(()=>{var F,_;P.current.sigil!==u&&(P.current={sigil:u});const V=()=>{const O=M.current>0?void 0:P.current.height,Y=L(O);b(z=>V8(z,Y)?z:Y)},W=O=>{Qse(O.target,k.current)&&V()};V();const K=requestAnimationFrame(V);return window.addEventListener("resize",V),window.addEventListener("scroll",W,!0),(F=window.visualViewport)==null||F.addEventListener("resize",V),(_=window.visualViewport)==null||_.addEventListener("scroll",V),()=>{var O,Y;cancelAnimationFrame(K),window.removeEventListener("resize",V),window.removeEventListener("scroll",W,!0),(O=window.visualViewport)==null||O.removeEventListener("resize",V),(Y=window.visualViewport)==null||Y.removeEventListener("scroll",V)}},[e,t,n,m,u,L]),s.useLayoutEffect(()=>{if(!y||!k.current)return;if(i>0){if(P.current.height==null&&P.current.sigil===(u??""))return;P.current={sigil:u??""};const O=L();O&&!V8(y,O)&&b(O);return}const V=k.current,W=S.current,K=W?V.offsetHeight-W.clientHeight:V.offsetHeight,F=Jse(K,(W==null?void 0:W.scrollHeight)??0,Lp);if(!(F>0)||P.current.height===F&&P.current.sigil===(u??""))return;P.current={sigil:u??"",height:F};const _=L(F);!_||V8(y,_)||b(_)},[y,A,L,i,a.length,u]),s.useLayoutEffect(()=>{const V=W=>{W.isComposing||W.keyCode===229||(W.key==="ArrowDown"?(W.preventDefault(),g>=a.length-1?R():w(K=>K+1)):W.key==="ArrowUp"?(W.preventDefault(),w(K=>Math.max(0,K-1))):(W.key==="Enter"||W.key==="Tab")&&a[g]?(W.preventDefault(),a[g].run()):W.key==="Escape"&&(W.preventDefault(),p()))};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[a,g,p,R]),s.useEffect(()=>{const V=S.current,W=V==null?void 0:V.querySelector('[data-active="true"]');V&&W&&tae(V,W)},[g]),s.useEffect(()=>{const V=C.current,W=S.current;if(!V||!W)return;const K=new IntersectionObserver(F=>{W.scrollTop<=0||F.some(_=>_.isIntersecting)&&R()},{root:W,rootMargin:"0px 0px 8px 0px"});return K.observe(V),()=>K.disconnect()},[y,A,R]);const H=a[g]?`${M0}-opt-${g}`:null;if(s.useEffect(()=>(h==null||h(H),()=>h==null?void 0:h(null)),[H,h]),s.useEffect(()=>{const V=W=>{W.target.closest(".sc-cmd")||(k4(W),p())};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[p]),!y)return null;const D=`${M0}-list`,B=Bse(u);return zr.createPortal(o.jsx("div",{className:"sc-cmd",id:M0,"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,W)=>{var F;const K=W===0||V.group!==((F=a[W-1])==null?void 0:F.group);return o.jsxs("div",{children:[K&&o.jsx(cS,{name:V.group,total:l}),o.jsxs("button",{type:"button",id:`${M0}-opt-${W}`,className:"sc-cmd-row",role:"option","aria-selected":W===g,"data-active":W===g,onMouseEnter:()=>w(W),onMouseDown:_=>k4(_),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(lae,{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(cS,{name:B,total:l}),o.jsx("div",{className:"sc-cmd-empty",children:Use(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:C,className:"sc-cmd-sentinel","aria-hidden":!0})]})]})}),document.body)}function cS({name:e,total:t}){return o.jsxs("div",{className:"sc-cmd-group",children:[e," ",o.jsx("span",{className:"sc-cmd-n",children:t})]})}function lae({text:e,query:t}){return o.jsx("span",{className:"sc-cmd-label",children:Gse(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 cae={fragrance:["Fragrance"],footwear:["Footwear"],apparel:["Apparel"],furniture:["Furniture","Home"],beauty:["Beauty"],electronics:["Electronics"],accessories:["Accessories"],beverage:["Food & drink"],jewelry:["Jewelry"],food:["Food & drink"]},uae={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 dae(e,t){if(!t)return!1;const n=cae[t];return!!n&&n.some(r=>e.verticals.includes(r))}function fae(e,t){if(!t)return!1;const n=uae[t];return!!n&&n.some(r=>e.suitableCategories.includes(r))}function uS(e){return e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").replace(/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g,"").toLowerCase()}const hae=4;function Ro(e,t){const n=uS(t).trim().split(/\s+/).filter(Boolean);if(!n.length)return!0;const r=uS(e);return n.every(a=>r.includes(a)||a.length>=hae&&a.endsWith("s")&&r.includes(a.slice(0,-1)))}function ry(e,t){return{visible:e.slice(0,t),remaining:Math.max(0,e.length-t)}}function LP(e,t){return[...e].sort((n,r)=>Number(t(r))-Number(t(n)))}function $P(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 t1={product:"product",presenter:"presenter",scene:"scene"},tl=48;function pae(e){return e?e.t==="product"?"product":e.t==="character"?"presenter":e.t==="template"?"scene":null:null}function Nu(e){const t=pae(e);return t||((e==null?void 0:e.t)==="color"?"color":null)}function mae(e){const t=Nu(e);return t||((e==null?void 0:e.t)==="ref"||(e==null?void 0:e.t)==="mark"?e.t:null)}function Z8(e){return(e==null?void 0:e.t)==="ref"||(e==null?void 0:e.t)==="mark"?e.imageHash:null}const F0=e=>{const t=(e??"").trim();return t||void 0},dS=e=>(e==null?void 0:e.custom)===!0;function nl(e,t){return e==="product"?[...(t.libraryProducts.length?t.libraryProducts:t.brandProducts).map(r=>{var a,i;return fS(r,"brand",jm((i=(a=r.shots)==null?void 0:a[0])==null?void 0:i.file,"tile"))}),...t.demoProducts.map(r=>fS(r,"catalog",r.previewUrl??null))]:e==="presenter"?[...t.presenters.map(n=>{const r=hi(n);return{kind:"presenter",id:n.id,label:n.name,full:[n.name,F0(n.descriptor)].filter(Boolean).join(" · "),sub:F0(n.descriptor),search:Pp(n),thumb:Tn(r.src,"tile"),crop:r.crop,source:dS(n)?"brand":"catalog",recommended:fae(n,t.productCategory),token:{t:"character",id:n.id}}}),...t.cast.map(n=>{const r=Cw(n);return{kind:"presenter",id:n.id,label:n.name,full:n.name,search:n.name,thumb:Tn(r.src,"tile"),crop:r.crop,source:"brand",token:{t:"character",id:n.id}}})]:t.scenes.map(n=>({kind:"scene",id:n.id,label:pl(n,"card"),full:pl(n,"tooltip"),sub:F0(n.lighting),search:Rp(n),thumb:Tn(n.previewUrl??null,"tile"),tint:qu(n.previewColor),source:dS(n)?"brand":"catalog",recommended:dae(n,t.productCategory),token:{t:"template",id:n.id}}))}function fS(e,t,n){return{kind:"product",id:e.id,label:Mo(e,"chip"),full:Mo(e,"tooltip"),sub:gae(e),search:Jw(e),thumb:n,source:t,token:{t:"product",id:e.id}}}function gae(e){const t=e;return F0(t.brand)??F0(t.vendor)}function Xu(e,t){const n=t.trim();return n?e.filter(r=>Ro(r.search,n)):e}function hS(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 qm(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=[...Xu(a,n.query)].sort((h,p)=>hS(e,h,n.bookmarked)-hS(e,p,n.bookmarked)).map(h=>n.bookmarked.has(h.id)?{...h,bookmarked:!0}:h),{visible:u,remaining:f}=ry(l,n.shown??tl);return{current:r,items:u,remaining:f,total:l.length}}const vae={$:"product","/":"scene","@":"presenter"},TP={Products:8,Presenters:8,Colors:16,Scenes:8},DP={$:"Products","/":"Scenes","@":"Presenters","#":"Colors"};function g0(e){return TP[DP[e??"$"]]}function HP(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 wae(e,t,n){return qm(e,t,{currentId:null,query:"",bookmarked:n,shown:t.length}).items.map(HP)}function pS(e,t){const{visible:n,remaining:r}=ry(e,t);return{items:n,remaining:r,total:e.length}}function yae(e,t,n={query:""}){const r=n.query.trim(),a=n.bookmarked??new Set,i=n.shown??TP[DP[e]];if(e==="#"){const h=(t.colors??[]).map(bae),p=r?h.filter(m=>Ro(m.search??m.label,r)):h;return pS(p,i)}const l=vae[e],u=l==="product"?t.products:l==="presenter"?t.presenters:t.scenes??[],f=r?Xu(u,r).map(HP):wae(l,u,a);return pS(f,i)}function bae(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 xae="(pointer: coarse)";function kae(e){return jr(ta)?o.jsx(Nae,{...e}):o.jsx(Aae,{...e,onMove:void 0})}function Sae(){return!jr(xae)}const Eae=e=>`Remove ${t1[e]}`;function mS(e,t,n){const r={slug:t};return e==="product"?wa(r,n):e==="presenter"?Ea(r,n):Zr(r,n)}function OP({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),C=async F=>{if(!(!g||k)){S(!0);try{await g.onPick(F)}finally{S(!1)}}},[E,A]=s.useState(tl),P=s.useRef(null),T=s.useRef(null),[M,j]=s.useState(0),R=s.useMemo(()=>e==="scene"?new Set(gi(r)):new Set,[e,r]);s.useEffect(()=>{A(tl),j(0)},[y]);const L=s.useMemo(()=>qm(e,n,{currentId:t,query:y,bookmarked:R,shown:E}),[e,n,t,y,R,E]);s.useLayoutEffect(()=>{var F;w&&((F=P.current)==null||F.focus({preventScroll:!0}))},[w]),s.useEffect(()=>{j(F=>Math.max(0,Math.min(F,L.items.length-1)))},[L.items.length]);const H=s.useCallback(F=>{var O;const _=(O=T.current)==null?void 0:O.querySelectorAll("[data-nav]")[F];_&&(j(F),_.focus({preventScroll:!0}),_.scrollIntoView({block:"nearest"}))},[]),D=s.useCallback(()=>{const F=T.current;return F?Math.max(1,getComputedStyle(F).gridTemplateColumns.split(" ").filter(Boolean).length):1},[]),B=F=>{var z;if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),h("escape");return}const _=F.target===P.current;if(_&&F.key==="ArrowDown"){F.preventDefault(),H(0);return}if(_&&F.key==="Enter"){F.preventDefault(),L.items[0]&&u(L.items[0]);return}if(_)return;const O=D(),Y=F.key==="ArrowRight"?1:F.key==="ArrowLeft"?-1:F.key==="ArrowDown"?O:F.key==="ArrowUp"?-O:0;if(Y){F.preventDefault();const X=M+Y;X<0&&Y===-O?(z=P.current)==null||z.focus():X>=0&&X<L.items.length&&H(X);return}F.key==="Home"?(F.preventDefault(),H(0)):F.key==="End"&&(F.preventDefault(),H(L.items.length-1))},V=t1[e],W=e==="product",K=!!L.current&&!!g&&g.options.length>1&&!y.trim();return o.jsxs("div",{className:"sc-swap-inner","data-sections":K||void 0,onKeyDown:B,children:[o.jsx("div",{className:"sc-swap-head",children:o.jsxs("span",{className:"sc-swap-search",children:[o.jsx(Ju,{size:13}),o.jsx("input",{ref:P,type:"text",value:y,onChange:F=>b(F.target.value),placeholder:`Search ${V}s`,"aria-label":`Search ${V}s`,autoComplete:"off",spellCheck:!1})]})}),L.current&&!K&&o.jsxs("div",{className:"sc-swap-cur",title:L.current.full,children:[o.jsx(gS,{src:L.current.thumb,tinted:!!L.current.tint,crop:L.current.crop}),o.jsxs("span",{className:"sc-swap-curtext",children:[o.jsx("b",{dir:"auto",children:L.current.label}),L.current.sub&&o.jsx("span",{dir:"auto",children:L.current.sub})]}),o.jsx("a",{className:"sc-swap-open",href:mS(e,a,L.current.id),target:"_blank",rel:"noreferrer",title:`Open this ${V} in a new tab`,"aria-label":`Open ${L.current.label} in a new tab`,children:o.jsx(mc,{size:14})}),o.jsx("span",{className:"sc-swap-tick","aria-hidden":!0,children:o.jsx(Gn,{size:11,weight:"bold"})})]}),o.jsxs("div",{className:"sc-swap-body",children:[K&&L.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:L.current.label}),o.jsxs("a",{className:"sc-ap-sec-act sc-swap-sec-open",href:mS(e,a,L.current.id),target:"_blank",rel:"noreferrer","aria-label":`Open ${L.current.label} in a new tab`,children:["Open",o.jsx(mc,{size:12})]})]}),o.jsxs("fieldset",{className:"sc-swap-this","aria-label":`${L.current.label}: the picture a shot follows`,"aria-busy":k||void 0,children:[o.jsx(Cae,{views:g.options,on:!g.picked,disabled:k,onPress:()=>void C(null)}),g.options.map(F=>o.jsx(jae,{option:F,on:g.picked===F.view,disabled:k,onPress:()=>void C(g.picked===F.view?null:F)},F.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:L.total})]})})]}),L.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:L.items.map((F,_)=>o.jsxs("div",{className:"sc-swap-card",role:"option","aria-selected":!1,"data-nav":_,tabIndex:_===M?0:-1,title:F.full,style:F.tint?{"--tint":F.tint}:void 0,onFocus:()=>j(_),onClick:()=>u(F),onKeyDown:O=>{O.key!=="Enter"&&O.key!==" "||(O.preventDefault(),u(F))},children:[o.jsx(gS,{src:F.thumb,tinted:!!F.tint,crop:F.crop}),o.jsxs("b",{dir:"auto",children:[F.bookmarked&&o.jsxs(o.Fragment,{children:[o.jsx(Ga,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Kept. "})]}),F.label]}),W&&F.sub&&o.jsx("span",{dir:"auto",children:F.sub}),e==="scene"&&o.jsx(sy,{})]},F.id))}),L.remaining>0&&o.jsxs("button",{type:"button",className:"sc-swap-more",onClick:()=>A(F=>F+tl),children:["Show ",Math.min(tl,L.remaining)," more of ",L.total]})]}),o.jsxs("div",{className:"sc-swap-foot",children:[t&&!L.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(ma,{size:13})]})]}),f&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:f,children:[o.jsx(wl,{size:13}),Eae(e)]})]})]})}function sy(){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(Gn,{className:"sc-ap-puck-on",size:11,weight:"bold"}),o.jsx(Rn,{className:"sc-ap-puck-off",size:11,weight:"bold"})]})}function Cae({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:Tn(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(sy,{})]})}function jae({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:Tn(e.thumb,"small"),alt:"",loading:"lazy"})}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:e.name})}),o.jsx(sy,{})]})}function gS({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(Na,{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 Aae(e){const{anchor:t,kind:n,onClose:r}=e,a=Sae(),[i,l]=s.useState(null),u=s.useRef(null);return s.useLayoutEffect(()=>{var h,p;const f=()=>{const m=window.visualViewport,g=ny(t.getBoundingClientRect(),{width:(m==null?void 0:m.width)??window.innerWidth,height:(m==null?void 0:m.height)??window.innerHeight},n==="scene"?{maxHeight:Tse}: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?zr.createPortal(o.jsx("div",{ref:u,className:"sc-swap","data-kind":n,"data-side":i.side,role:"dialog","aria-label":`Change ${t1[n]}`,style:jP(i),children:o.jsx(OP,{...e,autoFocusSearch:a})}),document.body):null}function Nae(e){const{kind:t,onClose:n}=e,{sheet:r,grip:a}=yd(()=>n("dismiss"));return o.jsx(yl,{open:!0,onOpenChange:i=>!i&&n("dismiss"),children:o.jsxs(bl,{children:[o.jsx(xl,{className:"sc-shotsheet-scrim"}),o.jsxs(kl,{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(Sl,{className:"sc-vh",children:["Change ",t1[t]]})]}),o.jsx(OP,{...e,autoFocusSearch:!1})]})]})})}const Mae=260;function Rae(e){return jr(ta)?o.jsx(Lae,{...e}):o.jsx(Pae,{...e,onMove:void 0})}function gu(e,t){const n=e?cr(e):null,r=t?cr(t):null;return!!n&&n===r}function IP({currentHex:e,currentName:t,palette:n,onPick:r,onRemove:a,onClose:i,onMove:l}){const u=s.useMemo(()=>{const S=new Set,C=[],E=P=>{const T=cr(P.hex);!T||S.has(T)||(S.add(T),C.push({...P,hex:T}))},A=e?cr(e):null;A&&!n.some(P=>gu(P.hex,A))&&E({hex:A,name:t||A,slot:"accent"});for(const P of n)E(P);return C},[n,e,t]),f=s.useRef(null),[h,p]=s.useState(()=>Math.max(0,u.findIndex(S=>gu(S.hex,e))));s.useEffect(()=>{p(S=>Math.max(0,Math.min(S,Math.max(0,u.length-1))))},[u.length]),s.useLayoutEffect(()=>{var C,E;const S=Math.max(0,u.findIndex(A=>gu(A.hex,e)));(E=(C=f.current)==null?void 0:C.querySelectorAll("[data-nav]")[S])==null||E.focus({preventScroll:!0})},[]);const m=s.useCallback(S=>{var E;const C=(E=f.current)==null?void 0:E.querySelectorAll("[data-nav]")[S];C&&(p(S),C.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 C=h+(S.key==="ArrowDown"?1:-1);C>=0&&C<u.length&&m(C)}},w=S=>r({t:"color",hex:S.hex,name:S.name||void 0}),y=(S,C)=>{const E=u.find(A=>gu(A.hex,S));r({t:"color",hex:S,name:(E==null?void 0:E.name)||void 0},{live:!0})},b=e?cr(e):null,k=!!b&&!n.some(S=>gu(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,C)=>{const E=gu(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}),E&&o.jsx("span",{className:"sc-swap-tick","aria-hidden":!0,children:o.jsx(Gn,{size:11,weight:"bold"})})]});return k&&E?o.jsx(od,{className:"sc-swap-swatch",triggerStyle:{background:"none"},value:S.hex,presets:n.map(P=>P.hex),commitMode:"live",align:"start",label:`Edit ${S.name}`,triggerProps:{role:"option","aria-selected":!0,"data-on":"","data-nav":C,tabIndex:C===h?0:-1,title:`${S.name} ${S.hex}`,onFocus:()=>p(C)},onChange:P=>y(P),children:A},"current-custom"):o.jsx("div",{className:"sc-swap-swatch",role:"option","aria-selected":E,"data-on":E||void 0,"data-nav":C,tabIndex:C===h?0:-1,title:`${S.name} ${S.hex}`,onFocus:()=>p(C),onClick:()=>w(S),onKeyDown:P=>{P.key!=="Enter"&&P.key!==" "||(P.preventDefault(),w(S))},children:A},S.hex)})})}),o.jsxs("div",{className:"sc-swap-foot",children:[o.jsxs(od,{className:"sc-swap-swatch sc-swap-custom",triggerStyle:{background:"none"},value:e??_m(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(ma,{size:13})]})]}),a&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:a,children:[o.jsx(wl,{size:13}),"Remove colour"]})]})]})}function Pae(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=ny(t.getBoundingClientRect(),{width:(h==null?void 0:h.width)??window.innerWidth,height:(h==null?void 0:h.height)??window.innerHeight},{width:Mae});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?zr.createPortal(o.jsx("div",{ref:i,className:"sc-swap","data-kind":"color","data-side":r.side,role:"dialog","aria-label":"Change colour",style:jP(r),children:o.jsx(IP,{...e})}),document.body):null}function Lae(e){const{onClose:t}=e,{sheet:n,grip:r}=yd(()=>t("dismiss"));return o.jsx(yl,{open:!0,onOpenChange:a=>!a&&t("dismiss"),children:o.jsxs(bl,{children:[o.jsx(xl,{className:"sc-shotsheet-scrim"}),o.jsxs(kl,{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(Sl,{className:"sc-vh",children:"Change colour"})]}),o.jsx(IP,{...e})]})]})})}function n1(e){const{brand:t,products:n}=un(),{scenes:r,presenters:a,demoProducts:i}=Dn(),l=s.useMemo(()=>wp(_c(t),r),[t,r]),u=s.useMemo(()=>wp(Yf(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 sf(((p=t==null?void 0:t.json)==null?void 0:p.products)??[])},[t]);return s.useMemo(()=>({libraryProducts:bM(n),brandProducts:h,demoProducts:i,presenters:u,cast:f,scenes:l,productCategory:e??null}),[n,h,i,u,f,l,e])}const v0=new Map,$ae=64;function FP(e){let t=v0.get(e);if(!t)for(t=Dae(e).then(n=>n?Hae(n.data,4):null).catch(()=>null),v0.set(e,t);v0.size>$ae;)v0.delete(v0.keys().next().value);return t}function Tae(e,t){FP(t).then(n=>{const r=qu(n??void 0);!r||!e.isConnected||(e.dataset.tinted="true",e.style.setProperty("--tint",r))})}async function Dae(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 Hae(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}=Oae(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:Iae(r.r/r.score,r.g/r.score,r.b/r.score)}function Oae(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 Iae(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 vS=["hero","place","close","hands","angle","bold"],wS=e=>[...e].sort((t,n)=>vS.indexOf(t.view)-vS.indexOf(n.view));function Fae(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 Ne.sceneFrames(n).then(l=>{if(!i)return;const u=l.views.map(f=>({view:f.view,name:Vu[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:Vu.place,thumb:t.placeUrl,hash:t.previewHash});for(const l of t.examples??[])i.push({view:l.role,name:Vu[l.role],thumb:l.url,hash:l.hash});return wS(i)}return r&&r.id===n?wS(r.views):[]}function _ae(e){return!e||e.cap==null||e.cap<=0?null:e.cap}function Vae(e){const t=new Set;if(!e||e.cap==null||e.cap<=0)return t;const n=new Set(e.attachments.map(r=>ic(r.role,r.id??r.hash)));for(const r of e.dropped){const a=ic(r.role,r.id??r.hash);r.reason!=="missing"&&!n.has(a)&&t.add(a)}return t}const ic=(e,t)=>`${e}:${t}`,R0=new Set(["product","character","ref","mark","template"]),$p=12,R4=`Shot is full: ${$p} identities. Remove one to add another.`,os=[{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 li(e){const t=os.find(n=>n.id===e);return t?t.w/t.h:1}function Zae(e,t=0){var i,l;const n=os.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 os.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 Ch=6,zae=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:C,onDropFiles:E},A){var Rt,nn,Nt,Jt,Ce,_e,tt;const P=s.useRef(null),T=s.useRef(null),M=s.useId(),[j,R]=s.useState(""),L=s.useCallback(I=>{R(""),requestAnimationFrame(()=>R(I))},[]),H=s.useRef(null),[D,B]=s.useState(null),[V,W]=s.useState(null),K=Ed(),{shown:F,closeNow:_}=K,O=s.useRef(V);s.useEffect(()=>{O.current=V},[V]);const Y=s.useRef(g);s.useEffect(()=>{Y.current=g},[g]);const[z,X]=s.useState(""),[Z,J]=s.useState(g0("$")),[me,ne]=s.useState(null),fe=s.useRef(!1),re=s.useRef(0),[ee,Q]=s.useState(!1),he=s.useRef(0),{products:Me}=un(),ce=Me.length?Me:((Rt=r.json)==null?void 0:Rt.products)??[],ke=((nn=r.json)==null?void 0:nn.characters)??[],Be=s.useMemo(()=>Gf(r.json),[r]),ft=s.useCallback((I,ue)=>{var dn,Nn,Kn;const be=document.createElement("span");be.className=sc,be.contentEditable="false",be.dir="ltr",be.dataset.kind=I.t,be.dataset.tok=zm(I),be.dataset.uid=ue??`u${re.current++}`;let Ve="",Re=null,bt,Ot=null;const It=$P(I,{products:ce,demoProducts:l,cast:ke,presenters:i,scenes:a});if((It==null?void 0:It.kind)==="scene"){const sn=It.scene;Ve=sn?pl(sn,"chip"):"missing template",Re=Tn((sn==null?void 0:sn.previewUrl)??null,"micro"),sn&&I.t==="template"&&I.view&&(Re=gn(I.view,"micro"),I.viewName&&(Ve=`${Ve} · ${I.viewName}`));const ar=qu(sn==null?void 0:sn.previewColor);ar&&(be.dataset.tinted="true",be.style.setProperty("--tint",ar)),!ar&&Re&&It.custom&&Tae(be,Re)}else if((It==null?void 0:It.kind)==="product"){const sn=It.product??It.demo;Ve=sn?Mo(sn,"chip"):"missing product",Re=It.product?jm((Nn=(dn=It.product.shots)==null?void 0:dn[0])==null?void 0:Nn.file,"micro"):Tn(((Kn=It.demo)==null?void 0:Kn.previewUrl)??null,"micro")}else if((It==null?void 0:It.kind)==="presenter"){const{character:sn,presenter:ar}=It;Ve=(sn==null?void 0:sn.name)??(ar==null?void 0:ar.name)??"missing person";const fs=sn?Cw(sn):ar?hi(ar):{src:null};Re=Tn(fs.src,"micro"),bt=fs.crop}else if(I.t==="color")Ve=I.name??I.hex,Ot=I.hex;else if(I.t==="ref")Ve=I.label??"Image",Re=gn(I.imageHash,"micro");else if(I.t==="mark"){const sn=Be.find(ar=>ar.hash===I.imageHash);Ve=sn?Tm(r.json,sn):"missing mark",Re=gn(I.imageHash,"micro")}if(Ve.startsWith("missing ")&&(be.dataset.missing=""),Re){const sn=document.createElement("img");sn.src=Re,sn.alt="",bt&&(sn.dataset.crop=bt),sn.onerror=()=>sn.remove(),be.appendChild(sn)}else if(Ot){const sn=document.createElement("span");sn.className="sc-token-swatch",sn.style.background=Ot,be.appendChild(sn)}const Dt=document.createElement("span");Dt.className="sc-token-label",Dt.dir="auto",Dt.textContent=Ve,be.appendChild(Dt);const wn=(g==null?void 0:g(I))??null;wn&&(be.title=wn,I.t!=="template"&&(be.dataset.warn="1")),w!=null&&w(I)&&(be.dataset.described="1");const Bt=Nu(I);if(Bt){const sn=Bt==="color"?"colour":t1[Bt];be.tabIndex=-1,be.setAttribute("role","button"),be.setAttribute("aria-haspopup","dialog"),be.setAttribute("aria-expanded","false"),be.setAttribute("aria-label",`${sn}: ${Ve}. Change or remove.`)}else be.tabIndex=-1,be.setAttribute("role","button"),be.setAttribute("aria-haspopup","dialog"),be.setAttribute("aria-expanded","false"),be.setAttribute("aria-label",`${I.t==="mark"?"brand mark":"reference image"}: ${Ve}. Open, remove or move.`);be.setAttribute("aria-keyshortcuts","Alt+ArrowLeft Alt+ArrowRight"),be.setAttribute("aria-describedby",M),be.setAttribute("draggable","false");const In=document.createElement("button");return In.type="button",In.tabIndex=-1,In.setAttribute("aria-hidden","true"),In.dataset.role="remove",In.appendChild(pte()),be.appendChild(In),be},[a,ce,ke,i,l,Be,r,g,w,M]),Ue=s.useCallback(()=>{const I=P.current;I&&n(rk(I))},[n]);s.useEffect(()=>{const I=P.current;I&&(sk(I,t!=null&&t.length?t:_a(),ue=>ft(ue)),A0(I))},[]);const Qe=s.useCallback((I,ue)=>{var Re;const be=P.current,Ve=be==null?void 0:be.querySelector(`[data-uid="${CSS.escape(I)}"]`);if(be&&Ve&&lk(be,Ve,ue)){uc(be,Ve,"after");const bt=go(be);bt!==null&&(H.current=bt,((Re=O.current)==null?void 0:Re.uid)===I&&(O.current={...O.current,caret:bt}),W(Ot=>Ot&&Ot.uid===I?{...Ot,caret:bt}:Ot)),Ue(),L(x4(be,Ve))}},[Ue,L]);s.useEffect(()=>{const I=P.current;if(I)return Rse(I,{onDragStart:()=>{B(null),X(""),_()},onMoved:(ue,be)=>{Ue(),L(be)},onCancelled:()=>L("Reorder cancelled.")})},[Ue,L,_]),s.useEffect(()=>{const I=P.current;if(I)for(const ue of I.querySelectorAll(`.${sc}`)){const be=gs(ue.dataset.tok??"");if(!be)continue;const Ve=(g==null?void 0:g(be))??null;Ve&&be.t!=="template"?ue.dataset.warn="1":delete ue.dataset.warn,w!=null&&w(be)?ue.dataset.described="1":delete ue.dataset.described,Ve&&!("open"in ue.dataset)?ue.title=Ve:ue.removeAttribute("title")}},[g,w]),s.useEffect(()=>{const I=()=>{const ue=go(P.current);ue!==null&&(H.current=ue)};return document.addEventListener("selectionchange",I),()=>document.removeEventListener("selectionchange",I)},[]);const Pe=s.useCallback(I=>{const ue=P.current;if(!ue)return;if(I.t==="template"){const bt=u0(ue);if(bt){bt.replaceWith(ft(I,bt.dataset.uid)),wo(ue),Ue(),B(null),X("");return}}const be=Wa(I);if(be){const bt=E8(ue,be);if(bt){B(null),X(""),L(`${Yo(bt)||"That"} is already in the brief.`);return}}if(R0.has(I.t)&&!(I.t==="template"&&u0(ue))&&Array.from(ue.querySelectorAll(`.${sc}`)).filter(Ot=>R0.has(Ot.dataset.kind??"")).length>=$p){B(null),X(""),L(R4);return}Kee(ue,ft(I),{eatQuery:!!D,fallbackUnits:H.current});const Re=go(ue);Re!==null&&(H.current=Re),Ue(),B(null),X("")},[D,ft,Ue,L]),G=s.useRef(Pe);s.useEffect(()=>{G.current=Pe},[Pe]);const se=s.useCallback((I,ue)=>{const be=P.current,Ve=be==null?void 0:be.querySelector(`[data-uid="${CSS.escape(I)}"]`);return!be||!Ve?!1:(Ve.replaceWith(ft(ue,I)),wo(be),Ue(),!0)},[ft,Ue]),We=s.useCallback(I=>{const ue=P.current,be=ue==null?void 0:ue.querySelector(`[data-uid="${CSS.escape(I)}"]`);if(!ue||!be)return null;const Ve=Qa(ue,be);return C8(ue,be),Ue(),Ve},[Ue]),Ze=()=>{var I;return document.documentElement.dataset.guideTask==="first-shot"&&!!((I=P.current)!=null&&I.closest('[data-guide="compose"]'))},oe=(I,ue)=>{var bt;const be=[...I.querySelectorAll(".sc-token")];if(!be.length)return!1;const[Ve]=((bt=ue.getTargetRanges)==null?void 0:bt.call(ue))??[];if(!Ve)return!1;const Re=document.createRange();return Re.setStart(Ve.startContainer,Ve.startOffset),Re.setEnd(Ve.endContainer,Ve.endOffset),be.some(Ot=>Re.intersectsNode(Ot))},q=s.useRef(We);s.useEffect(()=>{q.current=We},[We]),s.useEffect(()=>{const I=P.current;if(!I)return;const ue=be=>{if(be.inputType.startsWith("delete")&&Ze()&&oe(I,be))return be.preventDefault();const Ve=be.inputType==="deleteContentBackward"?"Backspace":be.inputType==="deleteContentForward"?"Delete":null;if(!Ve)return;const Re=ok(I,Ve);if(!(Re!=null&&Re.dataset.uid)){ik(I,Ve)&&be.preventDefault();return}be.preventDefault();const bt=q.current(Re.dataset.uid);bt!=null&&Va(I,bt)};return I.addEventListener("beforeinput",ue),()=>I.removeEventListener("beforeinput",ue)},[]);const ae=s.useCallback(I=>{const ue=gs(I.dataset.tok??"");if(!ue||ue.t!=="ref"&&ue.t!=="mark")return!1;const be=P.current,Ve=be?go(be):null;return Ve!=null&&(H.current=Ve),_(),b==null||b({src:$r(ue.imageHash),kind:ue.t,label:ue.t==="mark"?Yo(I):null}),!0},[b,_]),Le=s.useCallback((I,ue,be,Ve)=>{const Re=I.dataset.uid;Re&&(_(),I.dataset.open="",I.hasAttribute("aria-haspopup")&&I.setAttribute("aria-expanded","true"),I.removeAttribute("title"),B(null),X(""),W({uid:Re,kind:ue,anchor:I,caret:be,touch:Ve}))},[_]),Ie=s.useCallback((I,ue)=>{var Ot;const be=O.current;if(O.current=null,W(null),!be)return;const Ve=P.current,Re=Ve==null?void 0:Ve.querySelector(`[data-uid="${CSS.escape(be.uid)}"]`);if(Re){delete Re.dataset.open,Re.hasAttribute("aria-haspopup")&&Re.setAttribute("aria-expanded","false");const It=gs(Re.dataset.tok??""),Dt=It?((Ot=Y.current)==null?void 0:Ot.call(Y,It))??null:null;Dt&&(Re.title=Dt)}const bt=ue!==void 0?ue:be.caret;if(be.touch){bt!=null&&(H.current=bt);return}Ve&&(Ve.focus({preventScroll:!0}),bt!=null?Va(Ve,bt):ac(Ve))},[]);s.useEffect(()=>{if(!V)return;const I=P.current;I!=null&&I.querySelector(`[data-uid="${CSS.escape(V.uid)}"]`)||Ie("outside")},[V,Ie]),s.useEffect(()=>{var I;F&&((I=P.current)!=null&&I.contains(F.anchor)||_())},[F,_]),s.useEffect(()=>{const I=F==null?void 0:F.anchor;if(!I)return;I.dataset.open="";const ue=I.getAttribute("title");return ue&&I.removeAttribute("title"),()=>{delete I.dataset.open,ue&&I.setAttribute("title",ue)}},[F]),s.useImperativeHandle(A,()=>({insert:I=>G.current(I),setTokens:I=>{const ue=P.current;ue&&(sk(ue,I.length?I:_a(),be=>ft(be)),A0(ue),n(rk(ue)))},removeTemplate:()=>{const I=P.current,ue=I?u0(I):null;!I||!ue||(C8(I,ue),Ue())},remove:I=>{const ue=P.current;if(!ue)return;const be=E8(ue,Wa(I));be&&(C8(ue,be),Ue())},openMenu:I=>{X(""),J(g0("$")),B({anchor:I})},focus:()=>ac(P.current),restoreCaret:()=>{const I=P.current;if(!I)return;I.focus({preventScroll:!0});const ue=H.current;ue!=null?Va(I,ue):ac(I)}}));const Je=n1(k),ge=s.useCallback(I=>nl(I,Je),[Je]),et=s.useMemo(()=>new Set(gi(r.id)),[r.id]),nt=s.useMemo(()=>{var I;return D?yae(D.sigil??"$",{products:nl("product",Je),presenters:nl("presenter",Je),scenes:f?[]:nl("scene",Je),colors:qs((I=r.json)==null?void 0:I.palette)},{query:z,bookmarked:et,shown:Z}):{items:[],remaining:0,total:0}},[D,Je,z,et,Z,f,(Nt=r.json)==null?void 0:Nt.palette]),pt=s.useMemo(()=>nt.items.map(I=>({...I,run:()=>I.token.t==="template"?u(I.token.id):G.current(I.token)})),[nt.items,u]),St=s.useCallback(()=>{nt.remaining<=0||J(I=>I+g0(D==null?void 0:D.sigil))},[nt.remaining,D==null?void 0:D.sigil]),at=I=>{const ue=P.current,be=I.target;if(be.closest('[data-role="remove"]')){if(I.preventDefault(),Ze())return;const Dt=Ui(be);V&&(Dt==null?void 0:Dt.dataset.uid)===V.uid&&Ie("remove"),Dt!=null&&Dt.dataset.uid&&We(Dt.dataset.uid),B(null);return}const Ve=Ui(be),Re=Ve==null?void 0:Ve.getBoundingClientRect();if(!(!!Ve&&!!Re&&I.clientX-Re.left>Ch&&Re.right-I.clientX>Ch)){if(Zee(ue))return;ak(ue,I.clientX,I.clientY);return}ak(ue,I.clientX,I.clientY);const Ot=Ve.dataset.uid??null;if(Ot&&(V==null?void 0:V.uid)===Ot){I.detail!==0&&Ie("outside");return}const It=Nu(gs(Ve.dataset.tok??""));if(!It){ae(Ve);return}Le(Ve,It,go(ue),!1)},_t=I=>{if(I.pointerType!=="mouse")return;const ue=P.current;if(V||D||ue&&"chipDrag"in ue.dataset)return;const be=Ui(I.target),Ve=be==null?void 0:be.dataset.uid;if(!be||!Ve||!Lt(be)){K.close();return}if((F==null?void 0:F.uid)===Ve){K.keep();return}K.open({uid:Ve,anchor:be})},Lt=I=>{const ue=gs(I.dataset.tok??"");if(Z8(ue))return!0;const be=Nu(ue);return!!(be&&be!=="color"&&qh(be)&&I.querySelector("img"))},Zt=I=>{const ue=Ui(I.target),be=ue==null?void 0:ue.dataset.uid;!ue||!be||V||D||Lt(ue)&&Dm(ue)&&K.open({uid:be,anchor:ue})},Mt=I=>{if(I.pointerType==="mouse")return;const ue=I.target;if(ue.closest('[data-role="remove"]'))return;const be=Ui(ue);if(!be)return;const Ve=be.getBoundingClientRect();if(I.clientX-Ve.left<=Ch||Ve.right-I.clientX<=Ch)return;const Re=mae(gs(be.dataset.tok??""));if(!Re||be.dataset.uid&&(V==null?void 0:V.uid)===be.dataset.uid)return;I.preventDefault();const bt=P.current,Ot=document.activeElement===bt,It=Ot?go(bt):H.current;Ot&&(bt==null||bt.blur()),Le(be,Re,It,!0)},$t=I=>{const ue=P.current,be=Ui(I.target);if(be&&!V){const Ve=()=>{uc(ue,be,"after"),ue==null||ue.focus({preventScroll:!0})};if(I.altKey&&(I.key==="ArrowLeft"||I.key==="ArrowRight")){I.preventDefault(),ue&&lk(ue,be,I.key==="ArrowLeft"?-1:1)&&(be.focus({preventScroll:!0}),Ue(),L(x4(ue,be)));return}if(I.key==="ArrowLeft"||I.key==="ArrowRight"){I.preventDefault(),uc(ue,be,I.key==="ArrowLeft"?"before":"after"),ue==null||ue.focus({preventScroll:!0});return}if(I.key==="Tab"){I.preventDefault(),uc(ue,be,I.shiftKey?"before":"after"),ue==null||ue.focus({preventScroll:!0});return}if(I.key==="Enter"||I.key===" "){I.preventDefault();const Re=Nu(gs(be.dataset.tok??""));Re&&ue?Le(be,Re,Qa(ue,be)+1,!1):ae(be);return}if(I.key==="Backspace"||I.key==="Delete"){if(I.preventDefault(),Ze())return;const Re=be.dataset.uid?We(be.dataset.uid):null;ue==null||ue.focus({preventScroll:!0}),Re!=null&&Va(ue,Re);return}if(I.key==="Escape"){I.preventDefault(),Ve();return}}if(I.key==="Escape"&&D){I.preventDefault(),B(null),X("");return}if(I.key==="Enter"&&!I.shiftKey){const Ve=I.defaultPrevented;I.preventDefault(),Wse({menuOpen:!!D,handled:Ve})&&C();return}if(!(D||V)&&!zse(I)){if(I.key==="Tab"&&!I.altKey&&!I.metaKey&&!I.ctrlKey){const Ve=Jee(ue,I.shiftKey?"back":"forward");Ve&&(I.preventDefault(),Ve.focus({preventScroll:!0}));return}if(!I.shiftKey&&!I.altKey&&!I.metaKey&&!I.ctrlKey){if(I.key==="ArrowLeft"||I.key==="ArrowRight"){Qee(ue,I.key==="ArrowLeft"?"left":"right")&&I.preventDefault();return}if(I.key==="Backspace"||I.key==="Delete"){const Ve=ok(ue,I.key);if(Ve!=null&&Ve.dataset.uid){if(I.preventDefault(),Ze())return;const Re=We(Ve.dataset.uid);Re!=null&&Va(ue,Re);return}if(ik(ue,I.key)){I.preventDefault();return}}}if((I.key==="$"||I.key==="/"||I.key==="@"||I.key==="#")&&!Ze()){const Ve=P.current,Re=CR(Ve),bt=Re.slice(-1);if(Re.length&&!/[\s\u00a0]/.test(bt))return;X(""),J(g0(I.key)),B({anchor:{getBoundingClientRect:()=>jR()??(Ve==null?void 0:Ve.getBoundingClientRect())??new DOMRect},sigil:I.key})}}},Se=s.useCallback(I=>{var ue,be;return(be=qs((ue=r.json)==null?void 0:ue.palette).find(Ve=>Ve.hex===I))==null?void 0:be.name},[(Jt=r.json)==null?void 0:Jt.palette]),Ke=s.useCallback(()=>{requestAnimationFrame(()=>{const I=T.current;if(!I)return;I.scrollHeight-I.scrollTop-I.clientHeight>1?I.dataset.more="":delete I.dataset.more})},[]);s.useEffect(()=>{const I=T.current;if(!I)return;Ke();const ue=new ResizeObserver(Ke);ue.observe(I);for(const be of I.children)ue.observe(be);return()=>ue.disconnect()},[Ke]);const kt=I=>{Ke();const ue=P.current,be=I==null?void 0:I.nativeEvent;if(be!=null&&be.isComposing)return;zee(ue)||wo(ue),A0(ue)&&ac(ue);const Ve=fe.current;fe.current=!1;const Re=j8(ue,Ot=>ft(Ot),{commit:Ve,nameFor:Se});Re&&(B(null),X(""));const bt=Re?{open:!1}:Kse(qee(ue),Ve);bt.open?D&&(bt.query!==z&&J(g0(bt.sigil)),X(bt.query)):D&&(B(null),X("")),Ue()},qe=I=>{const ue=window.getSelection();if(!ue||ue.rangeCount===0||ue.isCollapsed)return null;const be=ue.getRangeAt(0),{text:Ve,html:Re}=ete(be);return Ve?(I.clipboardData.setData("text/plain",Ve),I.clipboardData.setData("text/html",Re),I.preventDefault(),be):null},ot=I=>{qe(I)},rt=I=>{const ue=qe(I);ue&&(ue.deleteContents(),wo(P.current),Ue())},tn=s.useCallback(I=>I.t==="template"?a.some(ue=>ue.id===I.id):I.t==="product"?ce.some(ue=>ue.id===I.id)||l.some(ue=>ue.id===I.id):I.t==="character"?ke.some(ue=>ue.id===I.id)||i.some(ue=>ue.id===I.id):I.t==="mark"?Be.some(ue=>ue.hash===I.imageHash):!0,[a,ce,ke,i,l,Be]);s.useEffect(()=>{const I=P.current;if(I)for(const ue of I.querySelectorAll(`.${sc}[data-missing]`)){const be=gs(ue.dataset.tok??"");be&&tn(be)&&ue.replaceWith(ft(be,ue.dataset.uid))}},[tn,ft]);const Qt=I=>{Array.from(I.dataTransfer.types).includes("Files")&&(I.preventDefault(),he.current++,Q(!0))},on=I=>I.preventDefault(),Wt=()=>{he.current=Math.max(0,he.current-1),he.current===0&&Q(!1)},zt=I=>{I.preventDefault(),he.current=0,Q(!1),I.dataTransfer.files.length&&(E==null||E(I.dataTransfer.files))},Ut=I=>{I.preventDefault();const ue=I.clipboardData.files;if(ue.length&&Array.from(ue).some(Re=>Re.type.startsWith("image/"))){E==null||E(ue);return}fe.current=!0;const be=nte(I.clipboardData.getData("text/html"));if(be&&te(be)){const Re=P.current;j8(Re,bt=>ft(bt),{commit:!0,nameFor:Se})&&Ue();return}const Ve=I.clipboardData.getData("text/plain");Ve&&document.execCommand("insertText",!1,Ve)},te=I=>{const ue=P.current,be=window.getSelection();if(!ue||!be||be.rangeCount===0||!ue.contains(be.getRangeAt(0).startContainer))return!1;const Ve=be.getRangeAt(0);Ve.deleteContents();let Re=!1,bt=Array.from(ue.querySelectorAll(`.${sc}`)).filter(Nn=>R0.has(Nn.dataset.kind??"")).length,Ot=!1;const It=new Set,Dt=[];for(const Nn of I){if(typeof Nn=="string"){Dt.push(Nn);continue}if(!tn(Nn)){Dt.push(Wae(Nn,a,ce));continue}if(Nn.t==="template"){if(Re)continue;Re=!0}const Kn=Wa(Nn);if(Kn){if(It.has(Kn)||E8(ue,Kn))continue;It.add(Kn)}if(R0.has(Nn.t)&&!(Nn.t==="template"&&u0(ue))){if(bt>=$p){Ot=!0;continue}bt+=1}Dt.push(Nn)}Ot&&L(R4);const wn=Re?u0(ue):null,Bt=document.createDocumentFragment();for(const Nn of Dt)Bt.appendChild(typeof Nn=="string"?document.createTextNode(Nn):ft(Nn));const In=Bt.lastChild;Ve.insertNode(Bt),wn&&wn.remove();const dn=In?In.nodeType===Node.TEXT_NODE?Sp(ue,In,In.length):Sp(ue,ue,Array.from(ue.childNodes).indexOf(In)+1):go(ue)??0;return wo(ue),Va(ue,dn),Ue(),!0},ie=s.useCallback(()=>{requestAnimationFrame(()=>{const I=P.current;I&&document.activeElement===I&&A0(I)&&ac(I)})},[]),pe=V?gs(V.anchor.dataset.tok??""):null,Fe=Z8(pe),Oe=(V==null?void 0:V.kind)==="scene"&&(pe==null?void 0:pe.t)==="template"?a.find(I=>I.id===pe.id)??null:null,mt=Fae(Oe),yt=(pe==null?void 0:pe.t)==="template"&&pe.view?((Ce=mt.find(I=>I.hash===pe.view)??mt.find(I=>I.name===pe.viewName))==null?void 0:Ce.view)??null:null,Et=async I=>{if(!V||(pe==null?void 0:pe.t)!=="template")return;const{uid:ue}=V,{id:be,setup:Ve}=pe;let Re=(I==null?void 0:I.hash)??null;if(I&&!Re)try{Re=(await Ne.pickSceneView(be,I.view)).hash}catch{return}se(ue,{t:"template",id:be,...Ve?{setup:Ve}:{},...I&&Re?{view:Re,viewName:I.name}:{}}),Ie("pick")},st=pe?(g==null?void 0:g(pe))??null:null,vt=pe&&(w!=null&&w(pe))?y??null:null,Ae=F?gs(F.anchor.dataset.tok??""):null,xe=Z8(Ae),Xe=((_e=F==null?void 0:F.anchor.querySelector("img"))==null?void 0:_e.getAttribute("src"))??null,Ct=xe?gn(xe,"tile"):Tn(Xe,"tile"),ve=Nu(Ae),lt=Ae&&qh(Ae.t)?Ae.t:ve&&ve!=="color"&&qh(ve)?ve:null,dt=Ae?(g==null?void 0:g(Ae))??null:null,$e=Ae&&(w!=null&&w(Ae))?y??null:null,Ge=Ze()?void 0:()=>{if(!V)return;const I=We(V.uid);Ie("remove",I)};return o.jsxs("div",{className:"sc-brief",ref:T,onScroll:Ke,"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:P,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?M0: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:at,onPointerDown:Mt,onPointerOver:_t,onPointerLeave:I=>I.pointerType==="mouse"&&K.close(),onFocusCapture:Zt,onKeyDown:$t,onInput:kt,onCopy:ot,onCut:rt,onPaste:Ut,onDragEnter:Qt,onDragOver:on,onDragLeave:Wt,onDrop:zt,onFocus:ie,onBlur:()=>{const I=P.current;j8(I,ue=>ft(ue),{commit:!0,nameFor:Se})&&(B(null),X("")),Ue()}}),D&&o.jsx(iae,{anchor:D.anchor,composer:{getBoundingClientRect:()=>{var I,ue,be;return((ue=(I=P.current)==null?void 0:I.closest(".sc-promptcard"))==null?void 0:ue.getBoundingClientRect())??((be=P.current)==null?void 0:be.getBoundingClientRect())??new DOMRect}},line:{getBoundingClientRect:()=>{var I;return((I=P.current)==null?void 0:I.getBoundingClientRect())??new DOMRect}},query:z,options:pt,remaining:nt.remaining,total:nt.total,sigil:D.sigil,onMore:St,onActiveId:ne,onClose:()=>{B(null),X("")}}),F&&Ct&&lt&&o.jsx(Sd,{anchor:F.anchor,kind:lt,src:Ct,label:Yo(F.anchor),warning:dt,note:$e,onOpen:()=>{const I=F.anchor;if(xe){ae(I);return}_(),b==null||b({src:Ct,kind:lt,label:Yo(I)})},onHoverIn:K.keep,onHoverOut:K.close,onClose:_},F.uid),(V==null?void 0:V.kind)==="ref"||(V==null?void 0:V.kind)==="mark"?o.jsx(Pse,{kind:V.kind,label:Yo(V.anchor),thumb:Fe?gn(Fe,"micro"):null,onInspect:()=>ae(V.anchor),onMove:I=>Qe(V.uid,I),onRemove:Ge,onClose:Ie},V.uid):(V==null?void 0:V.kind)==="color"?o.jsx(Rae,{anchor:V.anchor,currentHex:jh(V.anchor),currentName:Bae(V.anchor),palette:qs((tt=r.json)==null?void 0:tt.palette),onPick:(I,ue)=>{var Ve;const be=V.uid;if(ue!=null&&ue.live){const Re=(Ve=P.current)==null?void 0:Ve.querySelector(`[data-uid="${CSS.escape(be)}"]`);Re&&cte(Re,I),Ue();return}if(Uae(I.hex,jh(V.anchor))){Ie("pick");return}se(be,I),Ie("pick")},onRemove:Ge,onMove:I=>Qe(V.uid,I),onClose:Ie},V.uid):V?o.jsx(kae,{kind:V.kind,anchor:V.anchor,currentId:jh(V.anchor),candidates:ge(V.kind),brandId:r.id,brandSlug:r.slug,warning:st,note:vt,onAttachRequest:S?I=>{Ie("outside"),S(I)}:void 0,onPick:I=>{const ue=V.uid;if(I.id===jh(V.anchor)){Ie("pick");return}I.kind==="scene"?u(I.id):se(ue,I.token),Ie("pick")},onRemove:Ge,onMove:I=>Qe(V.uid,I),onClose:Ie,views:V.kind==="scene"?{options:mt,picked:yt,onPick:Et}:void 0},V.uid):null]})});function jh(e){const t=gs(e.dataset.tok??"");return t?t.t==="color"?t.hex:"id"in t?t.id:null:null}function Bae(e){const t=gs(e.dataset.tok??"");return(t==null?void 0:t.t)==="color"?t.name:void 0}function Uae(e,t){const n=e?cr(e):null,r=t?cr(t):null;return!!n&&n===r}function Wae(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 Ah(e,t){return t===null?e===null:e===t}function Kae(e){const t=e.closest(".sc-filterbar, .sc-toolbar"),n=t==null?void 0:t.closest("[data-page-scroll]");if(!t||!n)return;let r=t.nextElementSibling;for(;r&&r.getBoundingClientRect().height===0;)r=r.nextElementSibling;if(!r)return;const i=r.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop-Number.parseFloat(getComputedStyle(t).marginBottom)-t.offsetHeight;if(n.scrollTop<=i+1)return;const l=window.matchMedia("(prefers-reduced-motion: reduce)").matches;n.scrollTo({top:i,behavior:l?"auto":"smooth"})}function ay({"aria-label":e,activeKey:t,items:n,onSelect:r}){const a=s.useRef(null),i=s.useRef(null),l=n.map(p=>`${p.value??""}:${p.count??""}`).join("|");s.useLayoutEffect(()=>{const p=a.current,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 P=A.querySelector(".sc-vlabel")??A;return m.style.setProperty("--sc-ink-x",`${A.offsetLeft+P.offsetLeft}px`),m.style.setProperty("--sc-ink-w",`${P.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 P=m.scrollWidth-m.clientWidth;if(P<=0)return;const T=[...m.querySelectorAll(":scope > button")],M=T.indexOf(A);if(M<0)return;const j=72,R=m.scrollLeft,L=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 W=R;if(B>L)W=Math.min(P,B-m.clientWidth);else if(V<R)W=V;else return;if(Math.abs(W-R)<1)return;const K=window.matchMedia("(prefers-reduced-motion: reduce)").matches;m.scrollTo({left:W,behavior:K?"auto":"smooth"})},k=w();k&&b(k),y(),m.dataset.inkReady||requestAnimationFrame(()=>{m.dataset.inkReady=""});const S=()=>{g||(g=requestAnimationFrame(()=>{g=0,y()}))},C=A=>{if(m.scrollWidth<=m.clientWidth+1||Math.abs(A.deltaX)>Math.abs(A.deltaY)||A.deltaY===0)return;const P=m.scrollWidth-m.clientWidth,T=Math.max(0,Math.min(P,m.scrollLeft+A.deltaY));T!==m.scrollLeft&&(A.preventDefault(),m.scrollLeft=T,y())},E=new ResizeObserver(()=>{w(),y()});E.observe(m);for(const A of m.querySelectorAll(":scope > button"))E.observe(A);return m.addEventListener("scroll",S,{passive:!0}),m.addEventListener("wheel",C,{passive:!1}),()=>{g&&cancelAnimationFrame(g),E.disconnect(),m.removeEventListener("scroll",S),m.removeEventListener("wheel",C)}},[t,l]);const u=p=>{Ah(t,p)||(a.current&&Kae(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=>Ah(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=>Ah(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=Ah(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 Cd({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;zr.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(Ju,{size:16})}),o.jsxs("div",{className:"sc-libsearch-field",children:[o.jsx(Ju,{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(Rn,{size:12,weight:"bold"})})]})]})}function _P({why:e,children:t}){return e?o.jsx(uw,{content:e,className:"sc-tip",maxWidth:"220px",children:gM(t)}):t}const Gae=["All","Products","Presenters","Scenes","Colors","Brand","Shots"],Tp=Gae.filter(e=>e!=="All"),yS={Products:"Products",Presenters:"Presenters",Scenes:"Scenes",Colors:"Brand colors",Brand:"Brand marks",Shots:"Shots"},Yae={Products:"Product",Presenters:"Presenter",Scenes:"Scene",Colors:"Brand color",Brand:"Brand mark",Shots:"Reference shot"},P4={Products:"products",Presenters:"presenters",Scenes:"scenes",Colors:"brand colors",Brand:"brand marks",Shots:"shots"},qae={Products:"square",Presenters:"square",Scenes:"square",Colors:"swatch",Brand:"square",Shots:"square"},VP={Products:132,Presenters:132,Scenes:132,Colors:132,Brand:132,Shots:132},L4={Products:96,Presenters:96,Scenes:96,Colors:96,Brand:96,Shots:96},bS=10;function Xae(e,t,n){const r=(n?L4:VP)[e];return r<=0||t<=0?1:Math.max(1,Math.floor((t+bS)/(r+bS)))}const Qae={product:"Products",presenter:"Presenters",scene:"Scenes"};function Jae(e){const t=Qae[e.kind];return{key:Wa(e.token),group:t,shape:qae[t],label:e.label,sub:e.kind==="product"?e.sub:void 0,full:e.recommended?`${e.full} · Recommended`:e.full,search:e.search,thumb:Tn(e.thumb??null,"small"),crop:e.crop,recommended:e.recommended,bookmarked:e.bookmarked,token:e.token}}function eoe(e){const t=Gf(e).map(r=>{const a=r.hash,i=Tm(e,r);return{key:`m:${a}`,group:"Brand",shape:"square",label:i,full:`${i} · the mark itself`,search:i,thumb:gn(a,"micro"),token:{t:"mark",imageHash:a}}}),n=qs(e==null?void 0:e.palette).map(r=>{const a={t:"color",hex:r.hex,name:r.name};return{key:Wa(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 toe(e,t){return e.map((n,r)=>{const a=`Shot ${Math.max(1,t-r)}`;return{key:`r:${n.images[0]}`,group:"Shots",shape:"square",label:a,full:`${a} · joins the shot as a reference image`,search:a,thumb:gn(n.images[0],"micro"),token:{t:"ref",imageHash:n.images[0],label:"Shot"}}})}const xS=(e,t)=>Ro(`${e.label} ${e.sub??""} ${e.search}`,t),ZP=`
106
- `;function noe(e){return e.map(Wa).filter(t=>t.length>0).join(ZP)}function roe(e){return new Set(e?e.split(ZP):[])}const soe=new Set(["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"]);function aoe(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 ooe(e,t){const n=t.trim();return e==="All"?n?`Nothing matches “${n}”.`:"Nothing to add yet.":n?`No matching ${P4[e]}.`:e==="Shots"?"No finished shots yet.":`No ${P4[e]} yet.`}function ioe(e){return[{value:null,label:"All",count:Tp.reduce((n,r)=>n+e[r],0)},...Tp.map(n=>({value:n,label:n,count:e[n]}))]}const loe=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(coe,{src:t.thumb,crop:t.crop}),o.jsxs("span",{className:"sc-ap-cap",children:[o.jsxs("span",{className:"sc-vh",children:[Yae[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(Gn,{className:"sc-ap-puck-on",size:11,weight:"bold"}),o.jsx(Rn,{className:"sc-ap-puck-off",size:11,weight:"bold"})]}),a&&o.jsx("span",{className:"sc-vh",children:" In the shot."})]});return o.jsx(_P,{why:h,children:p})});function coe({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(Na,{size:16}):o.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async","data-crop":t,onError:()=>r(!0)})})}function kS({onClick:e}){return o.jsxs("button",{type:"button",className:"sc-ap-card sc-ap-add sc-ap-upload-tile",title:"Add an image from your phone. It joins the shot as a reference.",onClick:e,children:[o.jsx("span",{className:"sc-ap-thumb",children:o.jsx(pv,{size:22,"aria-hidden":!0})}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:"Upload image"})})]})}const uoe=48,doe={items:[],total:0,hasMore:!1,loading:!1,settled:!1,error:null,loadMore:()=>{}};function oy(e,t,n=!0){const r=t.trim(),{shotsEpoch:a,subscribeActivity:i}=un(),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 E;(E=w.current)==null||E.abort();const C=new AbortController;w.current=C,p(!0),g(null);try{const A=await Ne.feed(e,{lens:"all",sort:"newest",q:r,limit:uoe,cursor:S??void 0},C.signal);if(C.signal.aborted)return;f(P=>{var M;const T=S===null||P.key!==l;return{key:l,items:T?A.items:[...P.items,...A.items],next:A.next,total:((M=A.counts)==null?void 0:M.all)??(T?A.items.length:P.total)}})}catch(A){if(C.signal.aborted)return;g(String(A.message??A))}finally{C.signal.aborted||p(!1)}},[e,r,l]);s.useEffect(()=>{if(!n)return;const S=u.key===""?0:150,C=setTimeout(()=>void y(null),S);return()=>clearTimeout(C)},[y,n]),s.useEffect(()=>()=>{var S;return(S=w.current)==null?void 0:S.abort()},[]),s.useEffect(()=>i(S=>{const C=new Map(S.map(E=>[E.id,E]));f(E=>{if(!E.items.some(P=>C.has(P.id)))return E;const A=E.items.flatMap(P=>{const T=C.get(P.id);return T?T.archived?[]:[{...P,...T}]:[P]});return{...E,items:A,total:Math.max(0,E.total-(E.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}:{...doe,loading:h,error:m,loadMore:k}}const z8={Products:"product",Presenters:"presenter",Scenes:"scene"};function foe({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=n1(b),S=s.useMemo(()=>new Set(gi(e.id)),[e.id]),C=Pl(),{applyBrand:E}=Dn(),{push:A}=rr(),[P,T]=s.useState(!1),[M,j]=s.useState(""),R=s.useDeferredValue(M),[L,H]=s.useState(tl),[D,B]=s.useState(0),[V,W]=s.useState(f?347:696),K=s.useRef(null),F=s.useRef(null);s.useEffect(()=>{H(tl),B(0)},[t,R]),s.useLayoutEffect(()=>{const Pe=F.current;if(!Pe)return;const G=()=>W(Pe.clientWidth-2*poe(Pe));G();const se=new ResizeObserver(G);return se.observe(Pe),()=>se.disconnect()},[]);const _=s.useMemo(()=>({product:nl("product",k),presenter:nl("presenter",k),scene:nl("scene",k)}),[k]),O=s.useMemo(()=>eoe(e.json),[e.json]),Y=oy(e.id,R),z=s.useMemo(()=>toe(Y.items,Y.total),[Y.items,Y.total]),X=s.useMemo(()=>{const Pe={};for(const G of Tp){const se=z8[G];Pe[G]=G==="Shots"?Y.total:se?Xu(_[se],R).length:O.filter(We=>We.group===G&&xS(We,R)).length}return Pe},[_,O,R,Y.total]),Z=s.useCallback((Pe,G)=>{const se=z8[Pe];if(se){const Ze=qm(se,_[se],{currentId:null,query:R,bookmarked:S,shown:G});return{group:Pe,items:Ze.items.map(Jae),total:Ze.total,remaining:Ze.remaining}}if(Pe==="Shots"){const Ze=z.slice(0,G),oe=Y.hasMore?Math.max(1,Y.total-z.length):Math.max(0,z.length-G);return{group:Pe,items:Ze,total:Y.total,remaining:oe}}const We=O.filter(Ze=>Ze.group===Pe&&xS(Ze,R));return{group:Pe,items:We.slice(0,G),total:We.length,remaining:Math.max(0,We.length-G)}},[_,O,R,S,z,Y.hasMore,Y.total]),J=s.useMemo(()=>{if(t==="All"){const Pe=[];for(const G of Tp){const se=Xae(G,V,f),We=Z(G,f&&Pe.length===0?Math.max(1,se-1):se);We.items.length>0&&Pe.push(We)}return Pe}return[Z(t,t==="Shots"?Number.MAX_SAFE_INTEGER:L)]},[t,Z,L,V,f]),{flat:me,navGroups:ne}=s.useMemo(()=>{const Pe=[],G=[];for(const se of J)se.items.length&&(G.push({start:Pe.length,end:Pe.length+se.items.length-1}),Pe.push(...se.items));return{flat:Pe,navGroups:G}},[J]);s.useEffect(()=>{B(Pe=>Math.max(0,Math.min(Pe,me.length-1)))},[me.length]);const fe=s.useCallback(Pe=>{var se;const G=(se=F.current)==null?void 0:se.querySelector(`[data-nav="${Pe}"]`);G&&(B(Pe),G.focus({preventScroll:!0}),G.scrollIntoView({block:"nearest"}))},[]),re=s.useRef(null),ee=s.useRef(()=>{});ee.current=()=>{const Pe=J[0];!Pe||t==="All"||Pe.remaining<=0||(Pe.group==="Shots"?Y.loading||Y.loadMore():H(G=>G+tl))},s.useEffect(()=>{const Pe=re.current,G=F.current;if(!Pe||!G)return;const se=new IntersectionObserver(We=>{We.some(Ze=>Ze.isIntersecting)&&ee.current()},{root:G,rootMargin:"0px 0px 240px 0px"});return se.observe(Pe),()=>se.disconnect()},[t,J]);const Q=s.useCallback(Pe=>{var se,We;const G=me[Pe];G&&(u.has(G.key)?m(G):p(G),h&&((We=(se=document.activeElement)==null?void 0:se.blur)==null||We.call(se)))},[me,u,h,p,m]),he=Pe=>{const G=Pe.clipboardData.files;!G.length||!Array.from(G).some(se=>se.type.startsWith("image/"))||(Pe.preventDefault(),w(G))},Me=Pe=>{var oe,q;const G=Pe.target,se=G instanceof HTMLInputElement&&!!((oe=K.current)!=null&&oe.contains(G));if(Pe.key==="Escape"){if(se)return;Pe.preventDefault(),Pe.stopPropagation(),y();return}if(se){Pe.key==="ArrowDown"?(Pe.preventDefault(),Pe.stopPropagation(),fe(0)):Pe.key==="Enter"&&(Pe.preventDefault(),Pe.stopPropagation(),Q(0));return}if(!soe.has(Pe.key)||(Pe.stopPropagation(),G.closest('[role="tablist"]')))return;const We=G.closest("[data-nav]");if(!We)return;Pe.preventDefault();const Ze=aoe(D,Pe.key,hoe(We.closest(".sc-ap-grid")),ne);if(Ze==="search"){const ae=K.current;(q=(ae==null?void 0:ae.querySelector(".sc-libsearch[data-open] input"))??(ae==null?void 0:ae.querySelector(".sc-libsearch-toggle")))==null||q.focus()}else Ze!=null&&fe(Ze)},ce=async Pe=>{T(!0);try{const G=await oN(e.id,Pe);E(G);const se=G.logoHash;se&&p({key:`m:${se}`,group:"Brand",shape:"square",label:"Logo",full:"Logo",search:"",token:{t:"mark",imageHash:se}});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(cn(G,"Could not upload that logo"))}finally{T(!1)}},ke=Pe=>C(Pe,{onCreated:G=>{if(G.kind===Pe){if(G.kind==="product"){const se={t:"product",id:G.id};p({key:Wa(se),group:"Products",shape:"square",label:"Product",full:"",search:"",token:se});return}if(G.kind==="presenter"){const se={t:"character",id:G.id};p({key:Wa(se),group:"Presenters",shape:"square",label:"Presenter",full:G.name,search:G.name,token:se});return}n("Scenes")}}}),Be=async Pe=>{var We;const G=VM((We=e.json)==null?void 0:We.palette,Pe);if(!G.swatch)return;if(G.added)try{const Ze=await Ne.updateBrand(e.id,{...e.json??{},palette:G.palette},e.json);E(Ze)}catch(Ze){A(cn(Ze,"Could not save the brand"));return}const se={t:"color",hex:G.swatch.hex,name:G.swatch.name};p({key:Wa(se),group:"Colors",shape:"swatch",label:G.swatch.name,full:"",search:"",swatch:G.swatch.hex,token:se})},ft=Pe=>i&&Pe==="Scenes"?"Scenes set up a new shot. Press X on Refining to use one.":l&&Pe!=="Colors"?l:null,Ue=me.length===0;let Qe=0;return o.jsxs("div",{className:"sc-ap-inner",onKeyDown:Me,onPaste:he,children:[o.jsxs("div",{className:"sc-ap-head",ref:K,children:[o.jsx("div",{className:"sc-ap-tabs",children:o.jsx(ay,{"aria-label":"What to add",activeKey:t==="All"?null:t,items:ioe(X),onSelect:Pe=>n(Pe??"All")})}),o.jsxs("div",{className:"sc-ap-actions",children:[o.jsxs("div",{className:"sc-ap-actions-add",children:[o.jsx(Cd,{value:M,onChange:j,noun:t==="All"?"everything":P4[t],total:t==="All"?void 0:X[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(pv,{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(Rn,{size:14})})]})]}),o.jsxs("div",{className:"sc-ap-body",ref:F,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."}),J.map((Pe,G)=>{var ae,Le,Ie;const se=ft(Pe.group),We=Qe;Qe+=Pe.items.length;const Ze=z8[Pe.group],q={"--ap-min":`${(f?L4:VP)[Pe.group]}px`,"--ap-lines":Ze==="product"?2:1};return o.jsxs("section",{className:"sc-ap-group","aria-label":yS[Pe.group],children:[o.jsxs("div",{className:"sc-ap-sec",children:[o.jsxs("span",{className:"sc-ap-sec-title",children:[yS[Pe.group],o.jsx("span",{className:"sc-ap-sec-n",children:Pe.total})]}),t==="All"&&Pe.total>Pe.items.length&&o.jsxs("button",{type:"button",className:"sc-ap-sec-act",onClick:()=>n(Pe.group),children:["Show all ",Pe.total]}),t==="Products"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>ke("product"),children:"Add product"}),t==="Presenters"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>ke("presenter"),children:"Create presenter"}),t==="Scenes"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>ke("scene"),children:"Create scene"}),t==="Colors"&&o.jsx(od,{className:"sc-ap-sec-act sc-ap-add",triggerStyle:{background:"none"},value:_m(qs((ae=e.json)==null?void 0:ae.palette)),presets:qs((Le=e.json)==null?void 0:Le.palette).map(Je=>Je.hex),commitMode:"close",align:"end",label:"Add color",onChange:Je=>void Be(Je),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":P||void 0,children:[o.jsx("input",{type:"file",accept:"image/*",className:"sc-vh",disabled:P,onChange:Je=>{var et;const ge=(et=Je.target.files)==null?void 0:et[0];Je.target.value="",ge&&ce(ge)}}),"Add logo"]})]}),o.jsxs("div",{className:"sc-ap-grid","data-shape":((Ie=Pe.items[0])==null?void 0:Ie.shape)??"square",style:q,children:[f&&G===0&&!r&&o.jsx(kS,{onClick:g}),Pe.items.map((Je,ge)=>o.jsx(loe,{card:Je,index:We+ge,active:We+ge===D,ticked:u.has(Je.key),why:se,onPick:Q,onFocus:B},Je.key))]}),t!=="All"&&Pe.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:[Pe.items.length," of ",Pe.total]})]})]},Pe.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":`${L4.Products}px`},children:o.jsx(kS,{onClick:g})}),Ue&&!(t==="Shots"&&(!Y.settled||Y.loading||Y.error))&&o.jsx("p",{className:"sc-ap-empty",children:ooe(t,M)})]})]})}function hoe(e){return e?Math.max(1,getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length):1}function poe(e){return Number.parseFloat(getComputedStyle(e).paddingLeft)||0}const moe="(pointer: coarse)";function goe(e){const t=jr(ta),n=jr(moe),[r,a]=s.useState(e.initialTab??"All");s.useEffect(()=>{a(e.initialTab??"All")},[e.initialTab,e.tabNonce]);const[i]=gl(),l=i.get("new")!==null;return o.jsx(voe,{id:e.id,phone:t,touch:n,creating:l,onClose:e.onClose,children:o.jsx(foe,{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 voe({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,C=m.getBoundingClientRect().top-S-16;p.style.setProperty("--ap-avail",`${Math.max(160,Math.round(C))}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(),k4(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 woe({target:e,onOpenImage:t,onClear:n}){var f;const r=Ed(),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()||Tr(e),u=s.useCallback(()=>{a&&(r.closeNow(),t())},[a,r.closeNow,t]);return o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"sc-token sc-target-chip",role:"button",tabIndex:0,"aria-haspopup":"dialog","aria-label":n?`Version being refined: ${l}. Open the image, or remove to make a new shot.`:`Version being refined: ${l}. Open the image.`,onPointerEnter:h=>{h.pointerType==="mouse"&&a&&r.open({anchor:h.currentTarget})},onPointerLeave:h=>h.pointerType==="mouse"&&r.close(),onClick:u,onKeyDown:h=>{h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u())},children:[a?o.jsx("img",{src:gn(a,"micro"),alt:""}):o.jsx("span",{className:"sc-target-thumb",children:o.jsx(Ca,{})}),"Refining",n&&o.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),r.closeNow(),n()},"aria-label":"Make a new shot instead",children:o.jsx(Rn,{size:12})})]}),r.shown&&a&&o.jsx(Sd,{anchor:r.shown.anchor,kind:"shot",src:gn(a,"tile"),label:l,noun:"Refining this shot",onOpen:u,onHoverIn:r.keep,onHoverOut:r.close,onClose:r.closeNow})]})}function ud({src:e,kind:t,label:n,noun:r,actions:a,onRestoreFocus:i,onClose:l}){const[u,f]=s.useState(!1),h=r??AP[t],p=s.useRef(null);return o.jsxs(Fs,{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(Ss,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Rn,{size:16})})})}),o.jsx("div",{className:"sc-lightbox-frame","data-kind":t,children:u?o.jsxs("span",{className:"sc-lightbox-blank",children:[o.jsx(Na,{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 yoe={"codex-cli":{sizing:"advisory"},openrouter:{sizing:"ratio"},replicate:{sizing:"ratio"},fal:{sizing:"exact"},demo:{sizing:"exact"}},boe={sizing:"exact"},zP=e=>yoe[e]??boe;function xoe(e,t){const n=zP(e).formats;return!n||n.includes(t)}const iy=e=>zP(e).sizing,koe="portrait",Soe=1,Eoe="standard",rl=[{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"}],Dp=[1,2,3,4],BP=e=>os.filter(t=>!xoe(e,t.id)).map(t=>t.id),$4=(e,t)=>t.length===0?void 0:`${e} cannot make ${os.filter(n=>t.includes(n.id)).map(n=>n.hint).join(" or ")}.`,ly=e=>{var n;e.preventDefault();const t=e.currentTarget??e.target;(n=t==null?void 0:t.querySelector('[role="radiogroup"]'))==null||n.focus()};function B8({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(nd,{open:r,onOpenChange:a,children:[o.jsx(rd,{children:o.jsx("button",{type:"button",className:"sc-var","aria-label":e,"data-guide":u,children:n})}),o.jsx(sd,{ref:f,className:"sc-setpop",align:"end",sideOffset:8,width:t,onOpenAutoFocus:ly,onCloseAutoFocus:l,onInteractOutside:h=>{var p;(p=h.target)!=null&&p.closest(".sc-prompt-pills")&&h.preventDefault()},children:i(()=>a(!1))})]})}function Coe({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=os.find(T=>T.id===r)??os[0],w=rl.find(T=>T.id===u)??rl[1],y=BP(t),b=iy(t),[k,S]=s.useState(null),C=s.useRef(null);C.current=k;const E=T=>{T.preventDefault(),C.current===null&&(h==null||h(T))},A={aspect:"shape",variants:"count",resolution:"quality"},P=T=>({open:k===T,onCloseAutoFocus:E,guide:p?`compose.${A[T]}`:void 0,onOpenChange:M=>{!M&&C.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(B8,{...P("aspect"),aria:`Aspect ${g.label}, ${g.hint}`,width:"178px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(d4,{w:g.w,h:g.h,slot:15,box:13}),g.label]}),children:T=>o.jsxs(o.Fragment,{children:[o.jsx(qo,{label:"Aspect ratio",className:"sc-setpop-list",value:r,ids:os.map(M=>M.id),unavailable:y,onChange:a,children:os.map(M=>o.jsxs(Xo,{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(d4,{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(T5,{})]},M.id))}),$4(n,y)&&o.jsx(sQ,{children:$4(n,y)})]})}),e==="generation"&&o.jsx(B8,{...P("variants"),aria:`${i} shot${i===1?"":"s"}`,width:"156px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(DE,{size:14}),i]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(qo,{label:"Shots",className:"sc-seg",value:String(i),ids:Dp.map(String),onChange:M=>l(Number(M)),children:Dp.map(M=>o.jsx(Xo,{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(B8,{...P("resolution"),aria:`Resolution ${w.label}, ${w.edge} px`,width:"192px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(nE,{size:14}),w.label]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(qo,{label:"Resolution",className:"sc-setpop-list",value:u,ids:rl.map(M=>M.id),onChange:M=>f(M),children:rl.map(M=>o.jsxs(Xo,{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(T5,{})]},M.id))})})})]})}function UP({mode:e,engineId:t,engineName:n,formatId:r,onFormat:a,count:i,onCount:l,quality:u,onQuality:f,engineChoices:h,onEngine:p}){const m=BP(t),g=iy(t);return o.jsxs(o.Fragment,{children:[h&&p&&h.length>1&&o.jsx(Nh,{label:"Engine",children:o.jsx(qo,{label:"Engine",className:"sc-seg",value:t,ids:h.map(w=>w.id),onChange:p,children:h.map(w=>o.jsx(Xo,{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(Nh,{label:"Aspect ratio",note:$4(n,m),children:o.jsx(qo,{label:"Aspect ratio",className:"sc-seg",value:r,ids:os.map(w=>w.id),unavailable:m,onChange:a,children:os.map(w=>o.jsxs(Xo,{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(d4,{w:w.w,h:w.h,slot:17,box:14}),w.hint]},w.id))})}),e==="generation"&&o.jsx(Nh,{label:"Shots",children:o.jsx(qo,{label:"Shots",className:"sc-seg",value:String(i),ids:Dp.map(String),onChange:w=>l(Number(w)),children:Dp.map(w=>o.jsx(Xo,{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(Nh,{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(qo,{label:"Resolution",className:"sc-seg",value:u,ids:rl.map(w=>w.id),onChange:w=>f(w),children:rl.map(w=>o.jsx(Xo,{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 Nh({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 joe({guide:e,onSettle:t,...n}){const[r,a]=s.useState(!1),i=f=>{!f&&r&&(t==null||t()),a(f)},{sheet:l,grip:u}=yd(()=>i(!1));return o.jsxs(yl,{open:r,onOpenChange:i,children:[o.jsx(Sv,{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(hv,{size:16})})}),o.jsxs(bl,{children:[o.jsx(xl,{className:"sc-shotsheet-scrim"}),o.jsxs(kl,{ref:l,className:"sc-shotsheet","aria-describedby":void 0,onOpenAutoFocus:ly,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(Sl,{className:"sc-vh",children:"Shot settings"})]}),o.jsx(UP,{...n})]})]})]})}const WP=e=>e.t==="template"&&typeof e.view=="string"&&Object.hasOwn(Vu,e.view);async function Aoe(e){return Promise.all(e.map(async t=>{if(t.t!=="template"||!WP(t))return t;const{view:n,viewName:r,...a}=t,i=await Ne.pickSceneView(t.id,n).then(l=>l.hash,()=>null);return i?{...a,view:i,...r?{viewName:r}:{}}:a}))}const Tu=e=>`scenri:draft-${e}`,Noe=e=>Sr.get(e),Moe=(e,t)=>Sr.set(e,t),Xh=e=>Sr.del(e);function SS(e,t){return e.some(n=>n.t==="text"?!!n.v.trim():n.t!=="template")||Object.values(t).some(n=>!!n.trim())}function Roe(e){const t=Noe(Tu(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 Xh(Tu(e)),null;const a=Date.now()-Date.parse(r.updatedAt??"");return!Number.isFinite(a)||a>EN?(Xh(Tu(e)),null):{v:1,brandId:e,updatedAt:r.updatedAt,tokens:r.tokens,tplFields:r.tplFields,setSlug:r.setSlug??null}}function KP(e,t){const n={v:1,brandId:e,updatedAt:new Date().toISOString(),tokens:t.tokens,tplFields:t.tplFields,setSlug:t.setSlug??null};Moe(Tu(e),JSON.stringify(n))}function ES(e){Xh(Tu(e))}function CS(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 Poe(e,t){return e>0&&t>0&&Math.abs(Math.log(t))<Math.abs(Math.log(e))-.01?"crop":"extend"}const U8=2,Loe=.15;function $oe(e,t){if(Poe(e,t)==="crop")return"crop";if(!(e>0&&t>0))return"extend";const n=t>e?t/e:e/t;return(n>U8?Math.max(U8,n*(1-Loe)):n)>U8+1e-9?"crop":"extend"}const T4=4,Hp=24,_0=24,GP={product:[],presenter:[],scene:null,ref:[],color:[]};function Toe(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 Doe(e){return`${e.product.join(",")}|${e.presenter.join(",")}|${e.scene??""}|${e.ref.join(",")}|${e.color.join(",")}`}function Hoe(e,t,n){const r=e.slice(0,n);return{visible:r,more:Math.max(0,e.length-r.length)}}const cy=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,onSeedsSpent:w,openAttachTab:y,onQueued:b,onSending:k,onAttached:S,onCeiling:C,target:E,holdFor:A,onClearTarget:P,sourceImage:T,onRestoreBranchId:M,setSlug:j,persistDraft:R=!0,variant:L="dock",guided:H=!1},D){var Ho,Bc;const{products:B,productsLoaded:V}=un(),{demoProducts:W,demoProductsLoaded:K,loaded:F}=Dn(),_=n1(),O=_.scenes,Y=_.presenters,z=Ml(),X=Rl(),{push:Z}=rr(),J=r.filter(Ee=>Ee.available),[me,ne]=Sa(Kr.engine,uf);s.useEffect(()=>{const Ee=_Q(J,me);Ee!==me&&ne(Ee)},[J,me,ne]);const fe=J.length===0&&r.some(Ee=>Ee.code==="not-installed"||Ee.code==="not-authenticated"),re=J.length===0,ee=re?fe?{icon:o.jsx(WM,{}),title:"Image generation is not set up yet",detail:"About a minute, using the ChatGPT account you already have.",action:"Set up",onAct:()=>X(),info:!0}:{icon:o.jsx(W0,{size:15}),title:"No image provider connected",detail:"Add a provider key and this prompt is ready to run.",action:"Open settings",onAct:()=>z("engines"),info:!1}:null,[Q,he]=s.useState(_a()),[Me,ce]=s.useState(void 0),[ke,Be,ft]=o8(Kr.format,koe),[Ue,Qe]=s.useState({}),Pe=E&&E.kind!=="root"?E:null,G=Pe?Zae(Pe.brief):void 0,se=Pe?Ue[Pe.id]??G??ke:ke,We=Ee=>{Pe?Qe(wt=>({...wt,[Pe.id]:Ee})):Be(Ee)},[Ze,oe]=s.useState({}),[q,ae,Le]=o8(Kr.count,Soe),[Ie,Je]=s.useState(!1),[ge,et]=s.useState(null),[nt,pt]=s.useState(null),[St,at]=s.useState(!1),[_t,Lt]=s.useState("All"),[Zt,Mt]=s.useState(0),[$t,Se]=s.useState(null),[Ke,kt,qe]=o8(Kr.quality,Eoe),[ot,rt]=s.useState(!1),[tn,Qt]=s.useState(!1),on=Ee=>Qt(Ee);jr("(hover: hover) and (min-width: 1024px)");const Wt=jr("(max-width: 767px)"),zt=s.useRef(null),Ut=s.useRef(null),te=s.useRef(null),ie=s.useId(),pe=s.useRef({tokens:Q,tplFields:Ze,branchId:(E==null?void 0:E.id)??null});pe.current={tokens:Q,tplFields:Ze,branchId:(E==null?void 0:E.id)??null};const Fe=s.useRef(null),Oe=s.useRef(null),mt=s.useRef(void 0),yt=s.useRef(void 0),Et=s.useRef(void 0),st=s.useRef(void 0),vt=s.useCallback(Ee=>{if(Oe.current&&(clearTimeout(Oe.current),Oe.current=null),!R)return;const wt=pe.current;wt.branchId||(SS(wt.tokens,wt.tplFields)?KP(Ee,{tokens:wt.tokens,tplFields:wt.tplFields,setSlug:j}):ES(Ee))},[j,R]);s.useEffect(()=>{y&&(Lt(y),at(!0))},[y]),s.useEffect(()=>{if(!i)return;const Ee=(i.tokens??[]).find(yn=>yn.t==="format");Ee&&ft(Ee.id),Le(i.variants??null),i.quality&&qe(i.quality),oe(i.templateFields??{});const wt=_w(i);if(!wt.some(WP)){ce(wt);return}let rn=!0;return Aoe(wt).then(yn=>{rn&&ce(yn)}),()=>{rn=!1}},[i]),s.useEffect(()=>{var Hn;const Ee=Fe.current,wt=!!Ee&&Ee!==n.id;wt&&vt(Ee);const rn=!R||!wt&&(!!i||!!l),yn=Ee!==n.id;let en=null,Pn=null;if(!rn&&yn){const Cn=Roe(n.id);Cn&&SS(Cn.tokens,Cn.tplFields)?(en=u4(n,Cn.tokens),Pn=Cn.tplFields):wt&&(en=_a(),Pn={})}wt&&(ft(null),Le(null),qe(null),Qe({}));let Dr=!1;if(u&&u!==mt.current){mt.current=u,Dr=!0;const Cn=en??_a(),Jn=Cn.find(Pa=>Pa.t==="template"),Hr=(Jn==null?void 0:Jn.id)??null,u2=((Hn=O.find(Pa=>Pa.id===u))==null?void 0:Hn.name)??"this scene",Pd=CS(Hr,u,u2,null,null),Ld=m&&/^[a-f0-9]{32}$/.test(m)?m:null,l1=g&&g in Vu?Vu[g]:void 0;if((Pd.changed||Ld)&&(en=[{t:"template",id:u,...f?{setup:f}:{},...Ld?{view:Ld,...l1?{viewName:l1}:{}}:{}},...Cn.filter(Pa=>Pa.t!=="template")],Pd.toast)){const Pa=Pd.toast;Z({kind:"info",title:Pa.title,action:{label:"Undo",onClick:()=>{var $d,c1;Pa.prevSceneId?($d=zt.current)==null||$d.insert({t:"template",id:Pa.prevSceneId}):(c1=zt.current)==null||c1.removeTemplate()}}})}}if(h&&h!==yt.current){yt.current=h,Dr=!0;const Cn=en??_a();Cn.some(Hr=>Hr.t==="character"&&Hr.id===h)||(en=[...Cn,{t:"character",id:h}])}if(p&&p!==Et.current){Et.current=p,Dr=!0;const Cn=en??_a();Cn.some(Hr=>Hr.t==="product"&&Hr.id===p)||(en=[...Cn,{t:"product",id:p}])}if(m&&!u&&/^[a-f0-9]{32}$/.test(m)&&m!==st.current){st.current=m,Dr=!0;const Cn=en??_a();Cn.some(Hr=>Hr.t==="ref"&&Hr.imageHash===m)||(en=[...Cn,{t:"ref",imageHash:m,label:"Scene view"}])}en&&(ce(en),oe(Pn??{})),Dr&&(w==null||w()),Fe.current=n.id},[n.id,u,h,p,m]),s.useEffect(()=>{var Ee;Me&&((Ee=zt.current)==null||Ee.setTokens(Me),ce(void 0))},[Me]);const Ae=s.useMemo(()=>{var en;const Ee=os.find(Pn=>Pn.id===se)??os[0],rn=(((en=rl.find(Pn=>Pn.id===Ke))==null?void 0:en.edge)??1024)/Math.max(Ee.w,Ee.h),yn=Pn=>Math.max(256,Math.round(Pn*rn/8)*8);return{t:"format",id:Ee.id,w:yn(Ee.w),h:yn(Ee.h)}},[se,Ke]),xe=s.useMemo(()=>[Ae,...Q],[Ae,Q]),Xe=s.useMemo(()=>({tokens:xe,templateFields:Ze,variants:q,quality:Ke,format:se}),[xe,Ze,q,Ke,se]),Ct=Q.some(Ee=>Ee.t==="text"?!!Ee.v.trim():!0),ve=s.useMemo(()=>{const Ee=Q.find(wt=>wt.t==="template");return Ee?O.find(wt=>wt.id===Ee.id)??null:null},[Q,O]),lt=s.useMemo(()=>{const Ee=Q.find(wt=>wt.t==="template");return(Ee==null?void 0:Ee.id)??null},[Q]),dt=s.useCallback(Ee=>{var Pn,Dr;const wt=(ve==null?void 0:ve.id)??null,rn=(E==null?void 0:E.id)??null,yn=((Pn=O.find(Hn=>Hn.id===Ee))==null?void 0:Pn.name)??"this scene",en=CS(wt,Ee,yn,rn,E?Tr(E):null);if(en.changed&&((Dr=zt.current)==null||Dr.insert({t:"template",id:Ee}),en.toast)){const Hn=en.toast;Z({kind:"info",title:Hn.title,action:{label:"Undo",onClick:()=>{var Cn,Jn;Hn.prevSceneId?(Cn=zt.current)==null||Cn.insert({t:"template",id:Hn.prevSceneId}):(Jn=zt.current)==null||Jn.removeTemplate(),Hn.branchWasCleared&&rn&&(M==null||M(rn))}}})}},[ve,E,O,Z,M]);s.useImperativeHandle(D,()=>({insertToken:Ee=>{var wt;return(wt=zt.current)==null?void 0:wt.insert(Ee)},removeToken:Ee=>{var wt;return(wt=zt.current)==null?void 0:wt.remove(Ee)},applyScene:Ee=>dt(Ee),removeTemplate:()=>{var Ee;return(Ee=zt.current)==null?void 0:Ee.removeTemplate()},openAttach:Ee=>xn(Ee),showAttach:()=>{Br.current||xn("All")},focus:()=>{var Ee;return(Ee=zt.current)==null?void 0:Ee.focus()},submit:()=>{sa()}}));const $e=s.useMemo(()=>Toe(Q),[Q]),Ge=Doe($e),Rt=noe(Q),nn=s.useMemo(()=>roe(Rt),[Rt]),Nt=s.useRef($e);Nt.current=$e,s.useEffect(()=>{S==null||S(Nt.current)},[Ge,S]),s.useEffect(()=>{var Ee;!F||!lt||ve||((Ee=zt.current)==null||Ee.removeTemplate(),Z({kind:"warning",title:"That scene is no longer available",detail:"Removed from the brief."}))},[F,lt,ve,Z]);const Jt=s.useRef(null);s.useEffect(()=>(Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>vt(Fe.current??n.id),500),()=>{Oe.current&&clearTimeout(Oe.current)}),[Q,Ze,E==null?void 0:E.id,n.id,vt]),s.useEffect(()=>()=>vt(Fe.current??n.id),[vt]),s.useEffect(()=>{const Ee=()=>vt(Fe.current??n.id);return window.addEventListener("beforeunload",Ee),()=>window.removeEventListener("beforeunload",Ee)},[vt,n.id]);const Ce=r.find(Ee=>Ee.id===me),_e=Ce?il(Ce.displayName):"This engine",tt=!!E&&E.kind!=="root"&&E.status==="running",I=E&&E.kind!=="root"&&E.status==="done"&&E.images.length>0||tt,ue=!!(Ce!=null&&Ce.supportsEdit),Ve=!!Pe&&!!G&&G!==se&&I&&!ve,Re=Ve?$oe(li(G),li(se)):null,bt=Re==="crop",Ot=Re==="extend"&&ue,It=os.find(Ee=>Ee.id===se),Dt=It?`${It.label} ${It.hint}`:se,[wn,Bt]=s.useState(null),In=()=>{E!=null&&E.images[0]&&Bt({src:$r(E.images[0]),kind:"shot",label:Tr(E),noun:"Refining this shot"})},dn=I&&!ve&&(ue||bt||Ot)?"edit":"generation",Nn=dn==="edit"&&!!E&&L!=="overlay",Kn=I?ve?"A scene starts a new shot.":bt||Ot||ue?null:`${(Ce==null?void 0:Ce.displayName)??"This engine"} cannot edit. This makes a new shot.`:null,sn=s.useMemo(()=>{const Ee=os.find(Pn=>Pn.id===se)??os[0],wt=`Aspect ${Ee.label} ${Ee.hint}`;if(dn==="edit")return wt;const rn=rl.find(Pn=>Pn.id===Ke),yn=iy(me),en=yn==="ratio"||!rn?null:yn==="advisory"?`${rn.label}, asking for ${rn.edge} px`:`${rn.label} ${rn.edge} px`;return[wt,`${q} shot${q===1?"":"s"}`,en&&`resolution ${en}`].filter(Boolean).join(", ")},[dn,se,q,Ke,me]),ar=s.useRef(void 0),fs=s.useRef(void 0);s.useEffect(()=>{var yn;const Ee=I?(E==null?void 0:E.id)??null:null,wt=Ee!==ar.current&&ar.current!==void 0;ar.current=Ee;const rn=lt!==fs.current;fs.current=lt,!(!ve||!I)&&(wt&&!rn&&Ee?(yn=zt.current)==null||yn.removeTemplate():P==null||P())},[ve,lt,I,E,P]);const Mn=(nt==null?void 0:nt.warnings.filter(Ee=>Ee.includes("built around a product")))??[],_s=Ve&&!Ct,na=bt&&Ct,ra=Y.length>0&&Q.some(Ee=>Ee.t==="character"&&!Y.some(wt=>wt.id===Ee.id)),so=!Ie&&(Ct||_s)&&!na&&!ra&&!!t&&!tt&&!A&&(bt||!re),ln=re&&!bt?"Image generation is not set up yet":Ie?"Working on the last one":t?tt?"Wait for this version to finish, or press X to start a new shot":A?"Wait for this refinement to finish":na?"This shape is reached by cropping, and a crop uses no words. Clear the prompt, or keep the current shape.":ra?"Remove the presenter who is no longer in your roster":!Ct&&!_s?"Write a prompt first":null:"Still opening this brand";s.useEffect(()=>{const Ee=dn==="edit"&&!!E;if(bt||!Ct&&!Ee){pt(null);return}Jt.current&&clearTimeout(Jt.current);const wt=Xe;return Jt.current=setTimeout(()=>{Ne.previewBrief(Xe,me,n.id,Ee?E.id:void 0).then(rn=>pt({...rn,forBrief:wt})).catch(()=>pt(null))},280),()=>{Jt.current&&clearTimeout(Jt.current)}},[Xe,me,n.id,Ct,dn,E,bt]);const bn=Ee=>{var wt;We(Ee),(wt=zt.current)==null||wt.focus()},Wn=Ee=>{var wt;kt(Ee),(wt=zt.current)==null||wt.focus()},fr=Ee=>{var wt;ae(Ee),(wt=zt.current)==null||wt.focus()},hr=Ee=>{var wt;Ee.preventDefault(),(wt=zt.current)==null||wt.focus()},xn=Ee=>{Lt(Ee),Mt(wt=>wt+1),at(!0)},Br=s.useRef(!1);Br.current=St;const ao=s.useRef(xn);ao.current=xn;const Vs=s.useCallback(({restore:Ee})=>{var wt;Br.current&&(Br.current=!1,at(!1),Ee&&((wt=zt.current)==null||wt.restoreCaret()))},[]),Ar=s.useRef(dt);Ar.current=dt;const $l=s.useRef(Q);$l.current=Q;const To=s.useCallback(Ee=>{var rn;const wt=Ee.token;wt.t==="template"?Ar.current(wt.id):(rn=zt.current)==null||rn.insert(wt)},[]),Do=s.useCallback(Ee=>{var rn,yn;const wt=Ee.token;wt.t==="template"?(rn=zt.current)==null||rn.removeTemplate():(yn=zt.current)==null||yn.remove(wt)},[]),le=async Ee=>{var rn;if(!(Ee!=null&&Ee.length))return;const wt=Array.from(Ee).filter(yn=>yn.type.startsWith("image/"));if(!wt.length){Z({kind:"warning",title:"Only images can be attached here"});return}rt(!0),et(null);try{for(const yn of wt.slice(0,4)){const en=await tf(yn);(rn=zt.current)==null||rn.insert({t:"ref",imageHash:en,label:Ooe(yn.name)})}wt.length>4&&Z({kind:"warning",title:"Only the first 4 images were attached",detail:`${wt.length-4} more ${wt.length-4===1?"was":"were"} skipped. Attach ${wt.length-4===1?"it":"them"} in another pick.`})}catch(yn){et(String(yn.message??yn)),Z(cn(yn,"Could not attach that image"))}finally{rt(!1),te.current&&(te.current.value="")}},De=nt&&nt.forBrief===Xe?nt:null,it=s.useMemo(()=>Q.filter(Ee=>R0.has(Ee.t)).length,[Q]),Gt=s.useRef(null),Yt=s.useMemo(()=>it===0?(Gt.current=null,null):(De&&(Gt.current={cap:_ae(De),described:Vae(De),preview:De}),Gt.current),[De,it]),_n=(Yt==null?void 0:Yt.cap)??null,fn=(Yt==null?void 0:Yt.preview)??null,Ln=(Ce==null?void 0:Ce.displayName)??"This engine",kn=it>=$p?R4:null;s.useEffect(()=>{C==null||C(kn)},[kn,C]);const Zs=Ee=>{const wt=Yt==null?void 0:Yt.described;return!wt||wt.size===0?!1:Ee.t==="product"?wt.has(ic("product",Ee.id)):Ee.t==="character"?wt.has(ic("character",Ee.id)):Ee.t==="template"?wt.has(ic("scene",Ee.id)):Ee.t==="ref"?wt.has(ic("reference",Ee.imageHash)):Ee.t==="mark"?wt.has(ic("brand",Ee.imageHash)):!1},Ad=_n!=null?`Described in words: ${Ln} pictures ${_n} per shot, products and presenters first. Drag it earlier to picture it.`:null,oo=ve?Mn.length>0?"This scene builds around a product. Attach one.":(fn==null?void 0:fn.warnings.some(Ee=>Ee.includes("built around a person")))??!1?"This scene builds around a person. Without a presenter, only the set renders.":null:null,zc=Ee=>{var Pn,Dr;if(Ee.t==="template")return oo;if(Ee.t==="product"&&V&&K&&!((B.length?B:((Pn=n.json)==null?void 0:Pn.products)??[]).some(Jn=>Jn.id===Ee.id)||W.some(Jn=>Jn.id===Ee.id)))return"This product is no longer in your library. Remove it from the brief.";if(Ee.t==="mark"&&!Gf(n.json).some(Hn=>Hn.hash===Ee.imageHash))return"This mark is no longer in your brand kit. Remove it from the brief.";if(!fn)return null;const wt=(Ce==null?void 0:Ce.displayName)??"this engine",rn=fn.cap,yn=Hn=>`${Hn} won't reach ${wt} this time.`,en=(Hn,Cn)=>{var Jn;return((Jn=fn.dropped)==null?void 0:Jn.some(Hr=>Hr.role===Hn&&Hr.id===Cn&&Hr.reason==="missing"))??!1};if(Ee.t==="ref"&&!fn.attachments.some(Hn=>Hn.hash===Ee.imageHash))return rn===0?`This reference won't reach ${wt}. Choose an engine that reads images, or remove it.`:rn==null?yn("This reference"):null;if(Ee.t==="mark"&&!fn.attachments.some(Hn=>Hn.role==="brand"&&Hn.hash===Ee.imageHash))return rn===0?`The brand mark won't reach ${wt}, so the logo can't be drawn from it. Choose an engine that reads images.`:rn==null?`${yn("The brand mark")} The logo can't be drawn from it.`:null;if(Ee.t==="mark"){const Hn=fn.warnings.find(Cn=>Cn.includes("px across"));if(Hn)return Hn}if(Ee.t==="product"){const Cn=(B.length?B:((Dr=n.json)==null?void 0:Dr.products)??[]).find(Jn=>Jn.id===Ee.id)??W.find(Jn=>Jn.id===Ee.id);if(Cn&&!fn.attachments.some(Jn=>Jn.role==="product"&&Jn.id===Cn.id))return en("product",Cn.id)?`${Cn.name} has no usable photo. Re-add one, or remove this.`:null}if(Ee.t==="character"){const Hn=Y.find(Cn=>Cn.id===Ee.id);if(!Hn&&Y.length>0)return"This presenter is no longer in your roster. Remove them from the brief.";if(Hn&&!fn.attachments.some(Cn=>Cn.role==="character"&&Cn.id===Hn.id))return en("character",Hn.id)?`${Hn.name} has no usable photo. Re-add one, or remove this.`:null}return null},Nd=s.useCallback(zc,[fn,Ce==null?void 0:Ce.displayName,oo,B,V,n.json,W,K,Y]),i1=s.useCallback(Zs,[Yt]),sa=async()=>{var wt,rn,yn;if(!so)return;Je(!0),et(null);const Ee=Q.flatMap(en=>en.t==="text"?[en.v]:[]).join(" ").replace(/\s+/g," ").trim();k==null||k({said:Ee||"Your shot",count:dn==="generation"?q:1,format:se});try{if(!t)throw new Error("the workspace is still loading");const en=await Ne.addNode({projectId:t,parentId:dn==="edit"&&E?E.id:a,kind:dn,engineId:me,count:q,brief:{...Xe,tokens:u4(n,Xe.tokens)},...dn==="edit"&&T?{sourceImage:T}:{},...dn==="edit"&&Re?{reshape:Re}:{}}),Pn=en.warnings??[];Pn.length===1?Z({kind:"warning",title:"Sent, with one thing to know",detail:Pn[0]}):Pn.length>1&&Z({kind:"warning",title:`Sent, with ${Pn.length} things to know`,detail:Pn.join(" ")}),(wt=zt.current)==null||wt.setTokens(_a()),oe({}),ft(null),Qe({}),Le(null),qe(null),R&&ES(n.id),b(en.id,dn,(rn=en.siblings)==null?void 0:rn.map(Dr=>Dr.id),(yn=en.siblings)!=null&&yn.length?en.siblings:[en])}catch(en){const Pn=String(en.message??en);et(Pn),Z(cn(en,"That did not send",Ce==null?void 0:Ce.displayName)),k==null||k(null)}finally{Je(!1)}},Si=(Ho=Q.find(Ee=>Ee.t==="product"))==null?void 0:Ho.id,Tl=Si?B.find(Ee=>Ee.id===Si)??(((Bc=n.json)==null?void 0:Bc.products)??[]).find(Ee=>Ee.id===Si)??W.find(Ee=>Ee.id===Si)??null:null,Md=Tl?Pw(Tl):null,Dl=H?{brandId:n.id,products:Q.filter(Ee=>Ee.t==="product").length,presenters:Q.filter(Ee=>Ee.t==="character").length,scene:!!ve,others:Q.filter(Ee=>Ee.t==="color"||Ee.t==="ref"||Ee.t==="mark").length,words:Q.some(Ee=>Ee.t==="text"&&!!Ee.v.trim()),busy:Ie,pickerOpen:St,refining:dn==="edit"&&!!E,engine:re?fe?"setup":"settings":"ready"}:null;s.useEffect(()=>{Dl&&Q5(Dl)}),s.useEffect(()=>{if(H)return()=>Q5(null)},[H]),s.useEffect(()=>{if(!H||!St)return;const Ee=()=>Vs({restore:!0});return window.addEventListener("scenri:guide-close-picker",Ee),()=>window.removeEventListener("scenri:guide-close-picker",Ee)},[H,St,Vs]),s.useEffect(()=>{if(!H)return;const Ee=wt=>{var Pn;const{kind:rn}=wt.detail,yn=rn==="presenter"?"character":rn==="scene"?"template":"product",en=[...$l.current].reverse().find(Dr=>Dr.t===yn);en&&((Pn=zt.current)==null||Pn.remove(en))};return window.addEventListener("scenri:guide-take-back",Ee),()=>window.removeEventListener("scenri:guide-take-back",Ee)},[H]),s.useEffect(()=>{if(!P)return;const Ee=()=>P();return window.addEventListener("scenri:guide-clear-refine",Ee),()=>window.removeEventListener("scenri:guide-clear-refine",Ee)},[P]),s.useEffect(()=>{if(!H)return;const Ee=wt=>{const{tab:rn}=wt.detail;Se(rn??null),rn&&ao.current(rn)};return window.addEventListener("scenri:guide-picker",Ee),()=>{window.removeEventListener("scenri:guide-picker",Ee),Se(null)}},[H]);const[Ei,Rd]=s.useState(!1),Xr=L==="overlay"&&(Ei||Q.some(Ee=>Ee.t==="text"&&!!Ee.v.trim()));return s.useEffect(()=>{L==="overlay"&&J5({engaged:Xr})},[L,Xr]),s.useEffect(()=>{if(L==="overlay")return()=>J5(null)},[L]),o.jsxs("div",{className:"sc-composer","data-guide":H?"compose":void 0,onPointerDownCapture:L==="overlay"&&!Ei?()=>Rd(!0):void 0,onKeyDownCapture:L==="overlay"&&!Ei?()=>Rd(!0):void 0,children:[o.jsx("input",{ref:te,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:Ee=>void le(Ee.target.files)}),wn&&o.jsx(ud,{src:wn.src,kind:wn.kind,label:wn.label,noun:wn.noun,onRestoreFocus:()=>{var Ee;return(Ee=zt.current)==null?void 0:Ee.restoreCaret()},onClose:()=>Bt(null)}),St&&o.jsx(goe,{brand:n,activeProductCategory:Md,refining:Nn,full:kn,initialTab:_t,tabNonce:Zt,only:$t,id:ie,attached:nn,onUpload:()=>{var Ee;return(Ee=te.current)==null?void 0:Ee.click()},onFiles:Ee=>void le(Ee),onPick:To,onRemove:Do,onClose:Vs}),ee&&o.jsx("div",{className:"sc-notes","data-guide-shape":H?"":void 0,children:ee&&o.jsxs("div",{className:"sc-banner","data-tone":"action",children:[o.jsx("span",{className:"sc-banner-ic",children:ee.icon}),o.jsxs("span",{className:"sc-banner-txt",children:[o.jsx("b",{children:ee.title}),o.jsxs("small",{children:[ee.detail,ee.info&&o.jsxs(nd,{children:[o.jsx(rd,{children:o.jsx("button",{type:"button",className:"sc-note-info","aria-label":"What a ChatGPT account has to do with this",children:o.jsx(Jp,{size:13})})}),o.jsxs(sd,{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:()=>z("engines"),children:"Use a provider key instead"})]})]})]})]}),o.jsx("button",{type:"button",className:"sc-banner-act","data-primary":"","data-guide":H?"compose.engine":void 0,onClick:ee.onAct,children:ee.action})]})}),o.jsxs("div",{className:"sc-promptcard","data-guide-shape":H?"":void 0,children:[I&&(P||L==="overlay"&&dn==="edit")&&o.jsxs("div",{className:"sc-target","data-note":Kn?"":void 0,children:[o.jsx(woe,{target:E,onOpenImage:In,onClear:P}),Kn&&o.jsx("small",{className:"sc-target-note",children:Kn})]}),I&&!P&&Kn&&!(L==="overlay"&&dn==="edit")&&o.jsx("small",{className:"sc-target-note sc-target-note-alone",children:Kn}),Ve&&(bt||Ot)&&o.jsxs("small",{className:"sc-reshape-hint","aria-live":"polite",children:[bt?"Will crop to":"Will extend to"," ",Dt]}),o.jsx(zae,{ref:zt,onChange:he,brand:n,templates:O,presenters:Y,demoProducts:W,onTemplatePick:dt,scenesSitOut:Nn,flag:Nd,described:i1,describedNote:Ad,onInspect:Ee=>Bt(Ee),onAttachRequest:Ee=>xn(Ee),activeProductCategory:Md,placeholder:ve?"Add art direction, or run it as written":dn==="edit"?"Say what to change about this shot":"What should we shoot? (use $ / @ #)",placeholderSm:ve||dn==="edit"?void 0:"What should we shoot? ($ / @ #)",label:ve?"Art direction":dn==="edit"?"What to change":"Shot brief",onSubmit:()=>void sa(),onDropFiles:Ee=>void le(Ee)}),o.jsxs("div",{className:"sc-prompt-row",children:[o.jsxs("div",{className:"sc-prompt-left",children:[o.jsx("button",{type:"button",ref:Ut,className:"sc-icon-btn sc-attach-toggle","data-guide":H?"compose.add":void 0,"aria-expanded":St,"aria-controls":St?ie:void 0,"aria-label":"Add to shot",title:"Add a product, a presenter, a scene, a colour or an image",onClick:()=>St?Vs({restore:!1}):xn("All"),children:ot?o.jsx(Rr,{size:"1"}):o.jsx(mr,{size:16})}),J.length>1&&o.jsxs(QA,{value:me,onValueChange:ne,children:[o.jsxs(JA,{variant:"ghost",className:"sc-mini-sel",children:[o.jsx(W0,{size:14}),o.jsx("span",{className:"sc-mini-sel-t",children:Ce?il(Ce.displayName):"Demo"})]}),o.jsx(eN,{children:J.map(Ee=>o.jsx(tN,{value:Ee.id,children:il(Ee.displayName)},Ee.id))})]})]}),o.jsxs("div",{className:"sc-prompt-right",children:[o.jsx(Coe,{mode:dn,engineId:me,engineName:_e,formatId:se,onFormat:bn,count:q,onCount:fr,quality:Ke,onQuality:Wn,onCloseAutoFocus:hr,guided:H}),o.jsxs(nd,{open:tn,onOpenChange:on,children:[o.jsx(rd,{children:o.jsxs("button",{type:"button",className:"sc-var sc-more","aria-label":`Shot settings. ${sn}`,"data-guide":H&&!Wt?"compose.settings":void 0,children:[o.jsx(hv,{size:14}),"More"]})}),o.jsx(sd,{className:"sc-morepop",align:"end",sideOffset:8,width:"300px",onOpenAutoFocus:ly,onCloseAutoFocus:hr,children:o.jsx(UP,{mode:dn,engineId:me,engineName:_e,formatId:se,onFormat:bn,count:q,onCount:fr,quality:Ke,onQuality:Wn})})]}),o.jsx(joe,{guide:H&&Wt?"compose.settings":void 0,mode:dn,engineId:me,engineName:_e,formatId:se,onFormat:bn,count:q,onCount:fr,quality:Ke,onQuality:Wn}),o.jsxs("button",{type:"button",className:"sc-send","data-guide":H?"compose.send":void 0,"aria-disabled":!so||void 0,onClick:()=>void sa(),"aria-label":dn==="edit"?"Refine":"Generate",title:ge??oo??ln??`${dn==="edit"?"Refine":"Generate"} (enter)`,children:[o.jsx("span",{className:"sc-send-ico",children:Ie?o.jsx(Rr,{size:"1"}):o.jsx(P7,{size:17,weight:"bold"})}),o.jsx("span",{className:"sc-send-lb",children:dn==="edit"?"Refine":"Generate"})]})]})]})]})]})});function Ooe(e){return e.replace(/\.[a-z0-9]{2,5}$/i,"").trim()||"Image"}function uy(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 YP({full:e=!0,children:t}){const[n,r]=s.useState(null);return uy(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 dy(){const{brand:e}=un(),{tasks:t}=ea(),[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=bq(e.json),w=qr(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(IE,{size:13,weight:"regular"})}),o.jsx("span",{className:"sc-impbar-count",children:h.subtitle}),o.jsx("span",{className:"sc-impbar-clock",children:Sc(h.startedAt,l)})]}),p&&o.jsxs("button",{type:"button",className:"sc-impbar-stop",disabled:m,"aria-label":"Stop importing",onClick:()=>{r(h.id),Ne.cancelCatalogJob(e.id,p).catch(()=>r(null))},children:[o.jsx(Rn,{size:12,weight:"bold"}),m?"Stopping":"Stop"]})]}),a&&o.jsx(i4,{brandId:e.id,jobId:a,onDismiss:()=>i(null)})]})}const Ioe={presenter:"Presenter",product:"Product",scene:"Scene"};function qP({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:C}=Dn(),E=[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,P=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(bd,{id:e.id,previewUrl:e.previewUrl,pending:!e.previewUrl&&C,title:e.title,primary:e.title,secondary:b?"":E,useLabel:"Recreate this",variant:"use",onOpen:p,onUse:p,size:S}),(A||P||T)&&o.jsx(_oe,{presenter:A,product:P,scene:T})]})}function Foe(e){return o.jsx(Fm,{...e,caption:!1})}function _oe({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(jS,{credit:e,open:r==="presenter",onEnter:()=>a("presenter"),children:Zoe(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(jS,{credit:h,open:r===h.key,onEnter:()=>a(h.key),style:f(),children:Voe({credit:h,step:p===0?1:2})})]},h.key))]})]})}function jS({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=CM(),p=h==="large"?144:88,m=h==="large"?168:112;if(s.useLayoutEffect(()=>{var S,C;if(!t||!e.previewUrl){f(null);return}const w=()=>{const E=i.current;if(!E)return;const A=E.getBoundingClientRect(),P=l.current,T=(P==null?void 0:P.offsetWidth)||p,M=(P==null?void 0:P.offsetHeight)||m,j=window.visualViewport,R=Ise(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),(C=window.visualViewport)==null||C.addEventListener("scroll",w),()=>{var E,A;cancelAnimationFrame(y),k==null||k.disconnect(),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w),(E=window.visualViewport)==null||E.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=Ioe[e.key];return o.jsxs("span",{ref:i,className:"sc-credit-tip","data-open":t||void 0,onPointerEnter:n,style:a,children:[r,t&&zr.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:Tn(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 Voe({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:Tn(r,"micro"),alt:""}):null}):o.jsx("span",{className:"sc-showcase-chip","data-step":t,children:r?o.jsx("img",{src:Tn(r,"micro"),alt:n}):o.jsx("span",{className:"sc-vh",children:n})})}function Zoe(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:Tn(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:Tn(n,"micro"),alt:""}):null,o.jsx("span",{className:"sc-showcase-badge-name",children:t})]})}function AS(e){return{key:"open-tab",icon:"open-tab",label:"Open in new tab",onSelect:()=>window.open(e,"_blank")}}function NS(e){return{key:"select",icon:"select",label:"Select",onSelect:e}}function ml(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(AS(e.draft.href)),e.select&&n.push(NS(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(AS(e.href)),e.use&&t.push({key:"use",icon:"use",label:e.use.label,onSelect:e.use.run}),e.select&&t.push(NS(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 as(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 vi(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 Xm(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 Qm({kind:e,count:t,openLabel:n,onOpen:r,href:a,onDeselect:i,onAct:l,onKeep:u,allKept:f}){const h=as(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=Xm(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 Op(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 D4({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:C="grid"}){const A=S?Qm({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}):ml(!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(bd,{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:C})}function XP(e){return o.jsx(Fm,{...e})}function ff({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?Qm({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}):ml(!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(bd,{id:e.id,previewUrl:e.previewUrl,title:e.description||pl(e,"tooltip"),primary:pl(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 QP(e){return o.jsx(Fm,{...e})}const Mu=new Map,zoe=50;function Boe(e,t){for(Mu.delete(e),Mu.set(e,t);Mu.size>zoe;)Mu.delete(Mu.keys().next().value)}function Uoe(e){return Mu.get(e)}const Woe=1e3;function ls({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=Uoe(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,Woe);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||Boe(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 Jm({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 e2({mode:e,group:t}){if(e==="none"||!t)return null;const n=[{value:null,label:t.everyLabel,count:t.everyCount},...t.options.map(r=>({value:r.value,label:r.label,count:r.count}))];return o.jsx(ay,{"aria-label":t.label,activeKey:t.selected,items:n,onSelect:t.onSelect})}const fy=o.jsx(Ga,{size:21,weight:"regular"});function ko({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 t2({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(ko,{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 Koe=150;function r1(e){const[t,n]=gl(),r=t.get("q")??"",a=e.join(","),i=s.useMemo(()=>{const C={};for(const E of a.split(",").filter(Boolean))C[E]=t.get(E)||null;return C},[t,a]),l=s.useCallback(C=>{n(E=>{const A=new URLSearchParams(E);for(const[P,T]of Object.entries(C))T===null||T===""?A.delete(P):A.set(P,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(C=>{f(C),m(),p.current=setTimeout(()=>{p.current=null,h.current=C,l({q:C||null})},Koe)},[l,m]),w=s.useCallback((C,E)=>l({[C]:E}),[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 C={q:null};for(const E of a.split(",").filter(Boolean))C[E]=null;l(C)},[l,m,a]);return{q:u,setQ:g,facets:i,setFacet:w,setFacets:y,active:b,clearSearch:k,clear:S}}const Goe=6,qi=new Map;function MS(e){return qi.get(e)??null}function Yoe(e){if(e.key)for(qi.delete(e.key),qi.set(e.key,e);qi.size>Goe;)qi.delete(qi.keys().next().value)}function qoe(e){for(const[t,n]of qi)n.brandId===e&&qi.delete(t)}const Xoe=8;function Qoe(){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}=Dn(),{brand:m,workspace:g,root:w,products:y,applyNodes:b}=un(),k=t,{poke:S}=ea(),C=Pl(),E=Bn(),{push:A}=rr(),P=ey(),T=Gm(),M=Cse(),j=jr(ta),{q:R,setQ:L,facets:H,setFacet:D,clearSearch:B,clear:V}=r1(["category"]),W=H.category,K=Ze=>D("category",Ze),F=R.trim().length>0,[_,O]=Sa(Kr.wallDensity,ad),Y=Vc(_),z=Ze=>O(Ze),X=Im(Y),Z=Hm(Y),J=gX[Y],me=Ze=>{const oe=new URLSearchParams(Ze??{}).toString();E(`${xr(m)}${oe?`?${oe}`:""}`)},ne=y.length?y:((We=m.json)==null?void 0:We.products)??[],fe=Ze=>{var Le,Ie,Je;const oe=(Le=Ze.brief.tokens.find(ge=>ge.t==="product"))==null?void 0:Le.id,q=(Ie=Ze.brief.tokens.find(ge=>ge.t==="character"))==null?void 0:Ie.id,ae=(Je=Ze.brief.tokens.find(ge=>ge.t==="template"))==null?void 0:Je.id;return{product:oe?i.find(ge=>ge.id===oe):void 0,presenter:q?r.find(ge=>ge.id===q):void 0,scene:ae?k.find(ge=>ge.id===ae):void 0}},re=s.useMemo(()=>{const Ze=new Map;for(const oe of l){const{product:q,presenter:ae,scene:Le}=fe(oe);Ze.set(oe.id,Ese(oe,{product:q,presenter:ae,scene:Le},F8(oe.category)))}return Ze},[l,i,r,k]),ee=s.useMemo(()=>(W?l.filter(oe=>oe.category===W):l).filter(oe=>Ro(re.get(oe.id)??oe.title,R)),[l,W,R,re]),Q=s.useMemo(()=>{const Ze=Mse(u);return{key:"category",label:"Categories",everyLabel:"All examples",everyCount:l.length,selected:W,onSelect:K,options:Ze.map(oe=>({value:oe,label:F8(oe)??oe,count:l.filter(q=>q.category===oe).length}))}},[l,u,W,K]),he=Ze=>{const{product:oe,presenter:q,scene:ae}=fe(Ze);return{productName:oe?Mo(oe,"chip"):null,productPreviewUrl:(oe==null?void 0:oe.previewUrl)??null,productId:(oe==null?void 0:oe.id)??null,presenterName:(q==null?void 0:q.name)??null,presenterPreviewUrl:q?hi(q).src:null,presenterId:(q==null?void 0:q.id)??null,sceneName:ae?pl(ae,"chip"):null,scenePreviewUrl:(ae==null?void 0:ae.previewUrl)??null,sceneId:(ae==null?void 0:ae.id)??null}},[Me,ce]=s.useState(null),Be=j?M:Ze=>{const oe=l.find(q=>q.id===Ze);oe&&(ce(N4(oe)),A({kind:"info",title:`Starting from "${oe.title}"`}))},ft=()=>{const oe=[...gi(m.id)].reverse().find(q=>k.some(ae=>ae.id===q));me(oe?{scene:oe,attach:"products",compose:"1"}:{attach:"products",compose:"1"})},Ue=s.useMemo(()=>wp(Yf(m),r),[m,r]),Qe=Ue.slice(0,J),Pe=s.useMemo(()=>{const Ze=gi(m.id);return wp(_c(m),LP(k,oe=>Ze.includes(oe.id)))},[k,m]),G=Pe.slice(0,J),se=s.useMemo(()=>{var Je,ge,et,nt,pt;const Ze=new Set,oe=St=>!St||Ze.has(St)?null:(Ze.add(St),Tn(St,"tile")),q=St=>{for(const at of St){const _t=l.find(Zt=>Zt.id===at&&Zt.previewUrl),Lt=oe(_t==null?void 0:_t.previewUrl);if(Lt)return Lt}return null},ae=St=>{for(const at of St){const _t=k.find(Zt=>Zt.id===at&&Zt.previewUrl),Lt=oe(_t==null?void 0:_t.previewUrl);if(Lt)return Lt}return null},Le=St=>{for(const at of l)if(!(!at.previewUrl||Ze.has(at.previewUrl))&&!(St&&!at.brief.tokens.some(_t=>_t.t===St)))return oe(at.previewUrl);return null},Ie=ne.find(St=>{var at,_t;return qr((_t=(at=St==null?void 0:St.shots)==null?void 0:at[0])==null?void 0:_t.file)});return{compose:oe(Ie?qr((ge=(Je=Ie.shots)==null?void 0:Je[0])==null?void 0:ge.file):null)??q(["c15-orange-pool","orris-waterline","hoops-painted-canvas"])??oe((et=i.find(St=>St.id==="calder-vane-c15-serum"))==null?void 0:et.previewUrl)??oe((nt=i.find(St=>St.previewUrl))==null?void 0:nt.previewUrl)??Le("product"),product:q(["ridgeline-tyre-top","ridgeline-boulder-gap","yuzu-ice-burst"])??oe((pt=i.find(St=>St.id==="voss-rowe-ridgeline-trail"))==null?void 0:pt.previewUrl)??Le("product"),presenter:oe(hi(r.find(St=>St.id==="odette")??r.find(St=>St.avatarUrl)??r[0]??{}).src)??Le("character"),scene:ae(["travertine-window-light","palm-shade-garden","lantern-room","cobalt-container","sunlit-color-field"])??q(["lounge-chair-travertine","lounge-chair-snowfall","capsule-model-village"])??Le("template")}},[k,r,ne,i,l]);return o.jsx(qf.Provider,{value:Z,children:o.jsxs(ls,{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:ft,children:[o.jsx(JP,{thumbUrl:se.compose,fallback:o.jsx(y7,{size:22,weight:"fill"})}),o.jsx("b",{children:"Create an image"})]}),o.jsx(W8,{tone:"product",title:"Add a product",count:ne.length,thumbUrl:se.product,icon:o.jsx(em,{size:22,weight:"fill"}),onClick:()=>C("product")}),o.jsx(W8,{tone:"presenter",title:"Create a presenter",thumbUrl:se.presenter,icon:o.jsx(aF,{size:22,weight:"fill"}),onClick:()=>C("presenter")}),o.jsx(W8,{tone:"scene",title:"Create a scene",thumbUrl:se.scene,icon:o.jsx(XI,{size:22,weight:"fill"}),onClick:()=>C("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:X,"aria-hidden":!0,children:o.jsx(Foe,{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(Jm,{filters:o.jsx(e2,{mode:"tabs",group:Q}),search:l.length>=Xoe&&o.jsx(Cd,{value:R,onChange:L,noun:"examples",total:l.length}),density:o.jsx(Om,{value:Y,onChange:z})}),ee.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":Z,style:X,children:ee.map(Ze=>o.jsx(qP,{entry:Ze,size:"grid",hideRecipe:!0,onOpen:Be,productHref:oe=>wa(m,oe),presenterHref:oe=>Ea(m,oe),sceneHref:oe=>Zr(m,oe),...he(Ze)},Ze.id))}),ee.length===0&&(F?o.jsx(t2,{noun:"examples",q:R,facet:W?F8(W):null,onClearSearch:B,onClearAll:V}):o.jsx("p",{className:"sc-looks-empty",children:"No example carries that category yet."}))]})]}),(!a||Qe.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:X,children:Qe.map(Ze=>o.jsx(D4,{presenter:Ze,variant:"navigate",size:"grid",onOpen:P},Ze.id))}):o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:X,"aria-hidden":!0,children:o.jsx(XP,{size:"grid",count:J})}),(!a||Ue.length>Qe.length)&&o.jsx("div",{className:"sc-lib-more",children:o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:ni(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:X,children:G.map(Ze=>o.jsx(ff,{scene:Ze,variant:"navigate",size:"grid",onOpen:T},Ze.id))}):o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Z,style:X,"aria-hidden":!0,children:o.jsx(QP,{size:"grid",count:J})}),(!n||Pe.length>G.length)&&o.jsx("div",{className:"sc-lib-more",children:o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:sl(m),children:n?`Show all ${Pe.length} scenes`:"Show all scenes"})})]})]}),!j&&o.jsxs(YP,{children:[o.jsx(dy,{}),o.jsx(cy,{projectId:(g==null?void 0:g.id)||null,brand:m,engines:e,parentId:w,initialBrief:Me,onQueued:(Ze,oe,q,ae)=>{ae!=null&&ae.length&&b(ae),S(),qoe(m.id),E(xr(m))}})]})]})})}function W8({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(JP,{thumbUrl:a,fallback:n}),o.jsxs("b",{children:[t,r?o.jsx(_A,{variant:"soft",radius:"full",size:"1",children:r}):null]})]})}function JP({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 eL({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=Ew(),y=m?Qm({kind:"draft",count:m.count,openLabel:"Continue",onOpen:()=>g(i),href:i,onDeselect:()=>p==null?void 0:p(e),onAct:m.onAct}):ml(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:gn(n,"tile"),alt:""}):o.jsx("span",{className:"sc-lookcard-blank",children:l}),r&&o.jsx(Ca,{}),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(Gn,{size:13,weight:"bold"})}),u&&!h&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Discard ${t}`,onClick:()=>u(e),children:o.jsx(Rn,{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(Zf,{children:[o.jsx(zf,{children:b}),o.jsx(Bf,{children:y.map(k=>o.jsxs("span",{style:{display:"contents"},children:[k.separated&&o.jsx(Cm,{}),o.jsxs(Uf,{color:k.danger?"red":void 0,onSelect:k.onSelect,children:[o.jsx(Uu,{name:k.icon}),k.label]})]},k.key))})]})}function hy({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(Fs,{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(ks,{className:"sc-newdlg-title",children:e}),o.jsx(Ss,{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 tL({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":`${yw(e,t)}, ${Sc(e,t)}`,children:Sc(e,t)})}function Joe({build:e,onCancel:t,onRetry:n,onDismiss:r}){const a=e.stage==="failed",i=a?ro(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(Ca,{since:e.startedAt}),o.jsx(tL,{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(Rn,{size:13})}),a&&r&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Dismiss ${e.name}`,onClick:()=>r(e.id),children:o.jsx(Rn,{size:13})}),a&&n&&o.jsxs("button",{type:"button",className:"sc-lookcard-use",onClick:()=>n(e),children:[o.jsx(E7,{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(K8,{label:l.label,onClick:l.onAct,children:o.jsx(Ga,{size:17,weight:l.filled?"fill":"regular"})}),o.jsx(K8,{label:n,tone:a?"danger":void 0,onClick:i,children:o.jsx(eie,{name:r})})]}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-exit",children:o.jsx(K8,{label:"Done",onClick:u,children:o.jsx(Rn,{size:16,weight:"bold"})})})]})}function eie(e){return o.jsx(wl,{size:17})}function K8({label:e,tone:t,onClick:n,children:r}){return o.jsx(dr,{label:e,children:o.jsx("button",{type:"button",className:"sc-picked-tool","data-tone":t,"aria-label":e,onClick:n,children:r})})}const w0=()=>({kind:null,ids:new Set});function my(e){const[t,n]=s.useState(w0),r=s.useCallback(()=>n(w0()),[]);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}:w0()})},[]),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}:w0()})},[]),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}:w0()})},[]),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 gy({label:e}){return o.jsx("div",{className:"sc-starter-rule",children:o.jsx("span",{children:e})})}const G8=60;function hf(e,t){const[n,r]=s.useState(G8);s.useEffect(()=>{r(G8)},[t]);const{visible:a,remaining:i}=ry(e,n),l=s.useCallback(()=>r(u=>u+G8),[]);return{visible:a,remaining:i,showMore:l}}const tie=24,nie=8,Y8="__bookmarked";function rie(){const{scenes:e,collections:t,verticals:n,loaded:r,error:a,refetch:i,applyBrand:l,refreshBrands:u}=Dn(),{brand:f}=un(),h=e,{push:p}=rr(),m=Bn(),[g,w]=s.useState(()=>gi(f.id)),y=Ae=>w(Ym("scene",f.id,Ae)),b=Gm(),{builds:k,poke:S,studio:C}=ea(),E=Pl(),A=s.useMemo(()=>_c(f),[f]),P=k.filter(Ae=>Ae.kind==="scene"&&(!Ae.finished||Ae.stage==="failed")),T=!!mn({path:ht.sceneStudio}),[M,j]=s.useState(()=>Kh(f.id)),R=C.filter(Ae=>Ae.kind==="scene").map(Ae=>`${Ae.id}:${Ae.status}`).join("|");s.useEffect(()=>{T||j(Kh(f.id))},[T,f.id,R]);const L=s.useMemo(()=>Ure(M,C),[M,C]),[H,D]=s.useState(null),B=Ae=>{Ae.drawing&&Ae.jobId&&Ne.cancelSceneStudioJob(f.id,Ae.jobId).catch(()=>{}),qre(f.id,Ae.convo),j(Kh(f.id))},V=Ae=>{const xe=L.find(Xe=>Xe.convo===Ae);xe&&(xe.hash||xe.drawing?D(xe):B(xe))},{q:W,setQ:K,facets:F,setFacets:_,clearSearch:O,clear:Y}=r1(["vertical","bookmarked"]),z=F.vertical,X=F.bookmarked==="1",Z=my(`${f.id}|${W}|${z??""}|${X?"1":""}`),J=W.trim().length>0,[me,ne]=Sa(Kr.wallDensity,ad),fe=Vc(me),re=Ae=>ne(Ae),ee=Im(fe),Q=Hm(fe),he=Ae=>m(Zr(f,Ae)),[Me,ce]=s.useState(null),[ke,Be]=s.useState(!1),[ft,Ue]=s.useState(null),[Qe,Pe]=s.useState(!1),[G,se]=s.useState(null),[We,Ze]=s.useState(!1),oe=s.useCallback(Ae=>{const xe=A.find(Xe=>Xe.id===Ae);xe&&ce(xe)},[A]),q=s.useCallback(Ae=>{const xe=A.find(Xe=>Xe.id===Ae);xe&&(se(null),Ue(xe))},[A]),ae=async Ae=>{if(!(!ft||Qe)){Pe(!0),se(null);try{l((await Ne.updateScene(f.id,ft.id,{name:Ae})).brand),Ue(null)}catch(xe){const Xe=cn(xe,"Could not rename this scene");se([Xe.title,Xe.detail].filter(Boolean).join(" "))}finally{Pe(!1)}}},Le=async()=>{if(!(!Me||ke)){Be(!0);try{l((await Ne.deleteScene(f.id,Me.id)).brand),Z.forget(Me.id),ce(null)}catch(Ae){(Ae==null?void 0:Ae.status)===404?(await u(),Z.forget(Me.id),ce(null)):p(cn(Ae,"Could not delete this scene"))}finally{Be(!1)}}},Ie=s.useMemo(()=>X?h.filter(Ae=>g.includes(Ae.id)):z?h.filter(Ae=>Ae.verticals.includes(z)):h,[h,z,X,g]),ge=!(A.length>0||P.length>0||L.length>0),et=[...h,...A].reduce((Ae,xe)=>Ae+(g.includes(xe.id)?1:0),0),nt=X&&et===0,pt=nt&&ge,St=nt&&!ge,at=J||X&&!pt,_t=s.useMemo(()=>pt?h:Ie,[pt,h,Ie]),Lt=s.useMemo(()=>_t.filter(Ae=>Ro(Rp(Ae),W)),[_t,W]),[Zt,Mt]=s.useState(()=>new Set),{visible:$t,remaining:Se,showMore:Ke}=hf(Lt,`${z??""}|${X?"bookmarked":""}|${pt?"browse":""}|${W}`),kt=Ae=>[...A,...h].filter(xe=>!xe.verticals.length||xe.verticals.includes(Ae)).length,qe=[{value:Y8,label:"Keepers",count:et},...n.map(Ae=>({value:Ae,label:Ae,count:kt(Ae)}))],ot=h.length>0?"tabs":"none",rt={key:"vertical",label:"Vertical",everyLabel:"All scenes",everyCount:h.length+A.length,selected:X?Y8:z,onSelect:Ae=>_(Ae===Y8?{bookmarked:"1",vertical:null}:{bookmarked:null,vertical:Ae}),options:qe},tn=s.useMemo(()=>A.filter(Ae=>z?!Ae.verticals.length||Ae.verticals.includes(z):!0).filter(Ae=>Ro(Rp(Ae),W)).filter(Ae=>X?g.includes(Ae.id):!0),[A,z,W,X,g]),Qt=X?tn.length>0:L.length>0||P.length>0||tn.length>0,{visible:on,remaining:Wt,showMore:zt}=hf(tn,`${f.id}|${z??""}|${X?"bookmarked":""}|${W}`),[Ut,te]=s.useState(null);s.useEffect(()=>{if(!Ut||Wt<=0)return;const Ae=new IntersectionObserver(xe=>{xe.some(Xe=>Xe.isIntersecting)&&zt()},{root:Ut.closest(".sc-home"),rootMargin:"200% 0px"});return Ae.observe(Ut),()=>Ae.disconnect()},[Ut,Wt,zt]);const ie=()=>{Z.ids.size===1?oe([...Z.ids][0]):Ze(!0)},pe=[...Z.ids],Fe=pe.length>0&&pe.every(Ae=>g.includes(Ae)),Oe=()=>w(ty("scene",f.id,pe,!Fe)),mt=Xm(Z.ids.size,Fe,"scenes"),yt=async()=>{if(ke)return;const Ae=[...Z.ids];Be(!0);try{const{failed:xe,error:Xe}=await Op(Ae,Ct=>Ne.deleteScene(f.id,Ct));await u(),Z.retain(xe),Ze(!1),Xe&&p(cn(Xe,"Could not delete these scenes"))}finally{Be(!1)}},Et=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>E("scene"),children:[o.jsx(mr,{size:12})," Create scene"]}),st=(Ae,xe=!1)=>o.jsx("div",{className:"sc-masonry","data-wall":xe||void 0,"data-density":!0,"data-density-size":Q,style:ee,children:Ae.map(Xe=>o.jsx(ff,{scene:Xe,variant:"use",size:"grid",onOpen:he,href:Zr(f,Xe.id),onUse:b,bookmarked:g.includes(Xe.id),onBookmark:y},Xe.id))}),vt=o.jsx(Jm,{title:"Scenes",filters:o.jsx(e2,{mode:ot,group:rt}),density:o.jsx(Om,{value:fe,onChange:re}),search:h.length>=nie&&o.jsx(Cd,{value:W,onChange:K,noun:"scenes",total:h.length})});return o.jsxs(qf.Provider,{value:Q,children:[o.jsx(ls,{children:o.jsxs("main",{className:"sc-looks sc-scenes",id:"main","data-hero":ge||void 0,onClick:Z.onBlank,children:[!ge&&vt,Qt&&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":Q,style:ee,children:[!X&&L.map(Ae=>o.jsx(eL,{id:Ae.convo,name:Ae.name||"Untitled scene",hash:Ae.hash,drawing:Ae.drawing,state:Kre(Ae),href:al(f,Ae.convo),blank:o.jsx(_E,{size:44,weight:"thin"}),onDiscard:V},Ae.convo)),H&&o.jsx(Qn,{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:Ae=>{Ae||D(null)},onConfirm:()=>{B(H),D(null)}}),!X&&P.map(Ae=>o.jsx(Joe,{build:Ae,onCancel:xe=>void Ne.cancelAssetBuild(f.id,xe).then(S),onDismiss:xe=>void Ne.deleteAssetBuild(f.id,xe).then(S),onRetry:()=>E("scene")},Ae.id)),on.map(Ae=>o.jsx(ff,{scene:Ae,variant:"use",size:"grid",onOpen:he,href:Zr(f,Ae.id),onUse:b,bookmarked:g.includes(Ae.id),onBookmark:y,onDelete:oe,onRename:q,chosen:Z.ids.has(Ae.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(Ae.id)?{count:Z.ids.size,onAct:ie,onKeep:Oe,allKept:Fe}:null},Ae.id))]}),Wt>0&&o.jsx("div",{ref:te,"aria-hidden":!0}),Wt>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:zt,children:["Show ",Math.min(Wt,60)," more"]})}),ft&&o.jsx(hy,{title:"Rename scene",name:ft.name,maxLength:60,busy:Qe,error:G,onConfirm:Ae=>void ae(Ae),onDismiss:()=>{Qe||Ue(null)}}),Me&&o.jsx(Qn,{label:"Delete scene",title:`Delete ${Me.name}?`,body:vi("owned-scene",1),open:!0,busy:ke,onOpenChange:Ae=>{!Ae&&!ke&&ce(null)},onConfirm:()=>void Le()}),We&&o.jsx(Qn,{label:as("owned-scene",Z.ids.size).menu,title:`${as("owned-scene",Z.ids.size).menu}?`,body:vi("owned-scene",Z.ids.size),open:!0,busy:ke,onOpenChange:Ae=>{!Ae&&!ke&&Ze(!1)},onConfirm:()=>void yt()})]}),ge&&r&&!a&&h.length>0&&o.jsx(ko,{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:Et}),Qt&&r&&!a&&Ie.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(gy,{label:"Or start from one of ours"}),vt]}),!r&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":Q,style:ee,"aria-hidden":!0,children:o.jsx(QP,{size:"grid",count:8})}),r&&a&&o.jsx(ko,{shape:"error",title:"Couldn't load this library",body:"Something went wrong reaching the catalog.",onRetry:()=>i()}),r&&!a&&!at&&t.map(Ae=>{const xe=_t.filter(ve=>ve.collections.includes(Ae));if(!xe.length)return null;const Ct=Zt.has(Ae)?xe:xe.slice(0,tie);return o.jsxs("section",{className:"sc-coll",children:[o.jsx("h2",{children:Ae}),st(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:()=>Mt(ve=>new Set(ve).add(Ae)),children:["Show all ",xe.length]})})]},Ae)}),r&&!a&&at&&$t.length>0&&st($t,!0),r&&!a&&St&&o.jsx(ko,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a scene from its card and it stays here.",mark:fy,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>_({bookmarked:null}),children:"Browse every scene"})}),r&&!a&&h.length>0&&!St&&Lt.length===0&&tn.length===0&&o.jsx(t2,{noun:"scenes",q:W,facet:pt?null:X?"Keepers":z,onClearSearch:O,onClearAll:Y}),at&&Se>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:Ke,children:["Show ",Math.min(Se,60)," more"]})})]})}),o.jsx(Rc,{}),Z.kind==="owned-scene"&&Z.ids.size>0&&o.jsx("div",{className:"sc-wall-dock",children:o.jsx(py,{count:Z.ids.size,loaded:on.length,tool:as("owned-scene",Z.ids.size).tool,icon:as("owned-scene",Z.ids.size).icon,danger:!0,onAct:ie,keep:{label:mt.tool,filled:Fe,onAct:Oe},onClear:Z.clear,onSelectAll:()=>Z.selectAll("owned-scene",on.map(Ae=>Ae.id))})})]})}function vy(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 Ne.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 H4=[{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"}],nL=4;function sie(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 wy({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 yy({kind:e,brandId:t,id:n}){const[r,a]=s.useState(()=>cd(e,t).includes(n));s.useEffect(()=>{a(cd(e,t).includes(n))},[e,t,n]);const i=r?"Remove from Keepers":"Add to Keepers";return o.jsx(dr,{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(Ym(e,t,n).includes(n)),children:o.jsx(Ga,{size:15,weight:r?"fill":"regular"})})})}function aie({items:e,placeholder:t,open:n,hit:r,onRemove:a,onOpen:i}){return o.jsxs("div",{className:"sc-chipfield","data-state":n?"open":void 0,children:[r,o.jsxs("span",{className:"sc-chipfield-row",children:[e.length===0&&t?o.jsx("span",{className:"sc-chipfield-ph",children:t}):null,e.map(l=>o.jsxs("span",{className:"sc-chipfield-chip",onClick:()=>i==null?void 0:i(),children:[l,a&&o.jsx("button",{type:"button","data-role":"remove","aria-label":`Remove ${l}`,onPointerDown:u=>u.stopPropagation(),onClick:u=>{u.preventDefault(),u.stopPropagation(),a(l)},children:o.jsx(Rn,{size:10,weight:"bold"})})]},l))]}),o.jsx(ul,{size:13,className:"sc-chipfield-caret","aria-hidden":!0})]})}function oie({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(P=>!n.some(T=>vu(T,P)))],b=m.trim(),k=b?y.filter(P=>P.toLowerCase().includes(b.toLowerCase())):y,S=e.length>=u,C=b.length>0&&!y.some(P=>vu(P,b))&&!S,E=P=>{const T=e.some(M=>vu(M,P));!T&&S||t(T?e.filter(M=>!vu(M,P)):[...e,P])},A=()=>{var P;C&&(t([...e,b.slice(0,f)]),g(""),(P=w.current)==null||P.focus())};return s.useEffect(()=>{if(!h)return;const P=setTimeout(()=>{var T;return(T=w.current)==null?void 0:T.focus()},0);return()=>clearTimeout(P)},[h]),o.jsxs(ys,{open:h,onOpenChange:P=>{p(P),P||g("")},children:[o.jsx(aie,{items:e,placeholder:a,open:h,onOpen:()=>p(!0),onRemove:P=>t(e.filter(T=>!vu(T,P))),hit:o.jsx(bs,{children:o.jsx("button",{type:"button",className:"sc-chipfield-hit","aria-label":r})})}),o.jsxs(xs,{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:P=>g(P.target.value),onKeyDown:P=>{P.stopPropagation(),P.key==="Enter"?(P.preventDefault(),C?A():k.length===1&&E(k[0])):P.key==="Escape"&&p(!1)}}),o.jsxs("div",{className:"sc-chippick-list",children:[k.map(P=>{const T=e.some(M=>vu(M,P));return o.jsxs(Xn,{className:"sc-menu-item","data-on":T||void 0,"data-off":!T&&S?"":void 0,onSelect:M=>{M.preventDefault(),E(P)},children:[o.jsx("span",{className:"sc-menu-lb",children:P}),T&&o.jsx(Gn,{size:14,className:"sc-menu-check","aria-hidden":"true"})]},P)}),!k.length&&!C&&o.jsx("p",{className:"sc-chippick-none",children:l})]}),C&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-menu-sep"}),o.jsxs(Xn,{className:"sc-menu-item",onSelect:P=>{P.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 vu=(e,t)=>e.trim().toLowerCase()===t.trim().toLowerCase();function rL({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(),C=S.length>0,E=M=>M.map(j=>j.id).join(" "),A=S!==e.trim()||w.join(" ")!==t.join(" ")||!!a&&E(b)!==E(a),P=b.length>=(l??Number.POSITIVE_INFINITY)?[]:(i??[]).filter(M=>!b.some(j=>j.id===M.id)),T=()=>{if(!(!C||u)){if(!A)return p();h({name:S,categories:w,...a?{ways:b}:{}})}};return o.jsxs(Fs,{className:"sc-newdlg sc-pdetails",maxWidth:"min(460px, 94vw)",onDismiss:p,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ks,{className:"sc-newdlg-title",children:"Details"}),o.jsx(Ss,{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(oie,{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(Rn,{size:13,weight:"bold","aria-hidden":!0})})]},M.id)),P.length>0&&o.jsxs(ys,{children:[o.jsx(bs,{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(xs,{children:P.map(M=>o.jsx(Xn,{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:!C,"data-busy":u||void 0,onClick:T,children:u?"Saving":"Save"})]})]})}function sL(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 pf({count:e,label:t,className:n,trackClassName:r,style:a,children:i}){const{shellRef:l,railRef:u,page:f}=sL(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(Aa,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-rail-arrow next","aria-label":`${t}, later`,onClick:()=>f(1),children:o.jsx(vl,{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 n2(){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 Du({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(ys,{children:[o.jsx(dr,{label:"More",children:o.jsx(bs,{children:o.jsxs("button",{type:"button",className:"sc-cell-ctl sc-lookcard-more","aria-label":`More for ${t}`,children:[o.jsx(dv,{className:"sc-lookcard-more-vert",size:16,weight:"bold"}),o.jsx(uv,{className:"sc-lookcard-more-horiz",size:16,weight:"bold"})]})})}),o.jsxs(xs,{side:"bottom",align:"end",sideOffset:4,collisionPadding:12,children:[r&&o.jsxs(Xn,{onSelect:r,children:[o.jsx(Uu,{name:"open"}),"Open"]}),a&&o.jsxs(Xn,{disabled:l,onSelect:a,children:[o.jsx(Uu,{name:"use"}),"Use this view"]}),u&&o.jsxs(Xn,{disabled:l,onSelect:i,children:[o.jsx(Uu,{name:"cover"}),"Set as cover"]})]})]})})]})}function Ip({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 RS=1500;function aL(e,t,n){const{refreshBrands:r}=Dn(),[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 E=!0,A=null;const P=async()=>{var T;try{const M=await Ne.sceneExamples(e,t);if(!E)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(),!E)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(P,RS))}catch(M){E&&(M==null?void 0:M.status)!==404&&(A=setTimeout(P,RS*2))}};return P(),()=>{E=!1,A&&clearTimeout(A)}},[e,t,n,g]);const C=s.useCallback(()=>{b(!0),w(E=>E+1)},[]);return{job:a,first:l,more:f,read:p,waiting:y,again:C}}const iie=["no","one","two","three","four","five"];function lie({brandId:e,scene:t,onError:n}){var _;const{applyBrand:r}=Dn(),a=Gm(),i=n2(),{job:l,first:u,again:f}=aL(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=UN(t.examples,l),C=(l==null?void 0:l.status)==="running",E=KY(t.examples),A=async()=>{if(m||!u.length)return;const O=i();g(!0),n(null);try{await Ne.drawSceneExamples(e,t.id,{first:!0}),f()}catch(Y){O()&&n(String((Y==null?void 0:Y.message)??Y))}finally{O()&&g(!1)}},P=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:[E.length?"Draw them again":"Draw it in use",`, ${iie[u.length]??u.length} picture${u.length===1?"":"s"}`]})}):null,T=async O=>{const Y=H4.find(X=>X.id===O);if(!Y||h)return;const z=i();p(!0),n(null);try{const X=t.setups??[];if(!X.some(Z=>Z.id===Y.id)){const Z=await Ne.updateScene(e,t.id,{setups:[...X,Y]});r(Z.brand)}if(!z())return;a(t.id,Y.id)}catch(X){z()&&n(String((X==null?void 0:X.message)??X))}finally{z()&&p(!1)}},M=async O=>{const Y=i();y(!0),n(null);try{const z=await Ne.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=dX(t),R=(O,Y)=>O?()=>a(t.id,void 0,O,Y):void 0,L=t.placeUrl?{src:t.placeUrl,label:"The place",view:"place",...t.previewHash?{hash:t.previewHash}:{}}:null,H=O=>o.jsx(Du,{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&&!L)return o.jsx(Nw,{});if(!S.length&&L)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":`${L.label}, open`,onClick:()=>k(L),children:o.jsx(ba,{src:Tn(L.src,"tile"),srcSet:cc(L.src)})}),o.jsx(Du,{variant:"tile",label:L.label,isCover:!0,onOpen:()=>k(L),onUse:R(L.hash,"place")})]}),P,b&&o.jsx(ud,{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?H4.find(O=>O.id===D.setup):void 0,V=!!B&&((t.setups??[]).some(O=>O.id===B.id)||(t.setups??[]).length<nL),W=C&&l?ww({status:l.status,step:l.current,done:l.done.length,total:l.roles.length,error:l.error}):E.length>0?`${E.length===1?`The ${Ua[E[0]].toLowerCase()} shows`:"These show"} an earlier picture of this place.`:null,K=((_=S[0])==null?void 0:_.role)==="hero",F=L?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(L),children:o.jsx(ba,{src:Tn(L.src,"tile"),srcSet:cc(L.src)})}),o.jsx(Du,{variant:"tile",label:L.label,isCover:j==="place",onOpen:()=>k(L),onUse:R(L.hash,"place"),onCover:()=>void M("place"),busy:w})]}),o.jsx(Ip,{label:"The place",isCover:j==="place"})]},"place"):null;return o.jsxs(o.Fragment,{children:[o.jsxs(pf,{count:S.length+(L?1:0),label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:[!K&&F,S.map((O,Y)=>{const z=Ua[O.role],X=()=>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(ba,{src:Tn(O.url,"tile"),srcSet:cc(O.url)}),o.jsx(Ca,{})]}):O.state==="failed"?o.jsxs("span",{className:"sc-refset-tile","data-state":"failed",role:"img","aria-label":`${z} did not draw`,title:O.error?nf(O.error)??O.error:void 0,children:[o.jsx(Pc,{size:20,"aria-hidden":!0}),o.jsx("span",{children:"Did not draw"}),O.error&&o.jsx("small",{className:"sc-refset-why",children:nf(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:X,children:o.jsx(ba,{src:Tn(O.url,"tile"),srcSet:cc(O.url)})}),o.jsx(Du,{variant:"tile",label:z,isCover:j===O.role,onOpen:X,onUse:R(O.hash,O.role),onCover:()=>void M(O.role),busy:w})]}),o.jsx(Ip,{label:z,isCover:j===O.role})]}),K&&Y===0&&F]},O.role)})]}),W&&o.jsx("p",{className:"sc-scenepage-examples-state","aria-live":"polite",children:W}),P,b&&o.jsx(ud,{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 PS=["hero","place","close","hands","angle","bold"],LS=3;function cie(){var Be,ft,Ue,Qe,Pe;const{sceneId:e}=Qs(),{scenes:t,loaded:n,error:r,refetch:a,applyBrand:i,refreshBrands:l}=Dn(),{brand:u}=un(),f=t,h=Bn(),p=Gm(),m=u.id,[g,w]=s.useState([]),[y,b]=s.useState([]),[k,S]=s.useState(null),[C,E]=s.useState(!1),[A,P]=s.useState(null),T=G=>h(Zr(u,G)),M=af(u,e??""),j=M??f.find(G=>G.id===e);Ic(j==null?void 0:j.name);const R=!!M;s.useEffect(()=>{let G=!0;if(w([]),b([]),!R)return Ne.sceneFrames(e??"").then(se=>{G&&(w(se.frames),b(se.views??[]),S(e??""))}).catch(()=>{G&&(w([]),S(e??""))}),()=>{G=!1}},[e,R]);const L=vy(u.id,[e??""]),H=s.useMemo(()=>{if(!j||R)return[];return f.filter(We=>We.id!==j.id).sort((We,Ze)=>se(Ze)-se(We)).slice(0,8);function se(We){const Ze=We.lighting.split(/[ ,]+/).some(q=>q.length>3&&j.lighting.toLowerCase().includes(q.toLowerCase())),oe=We.collections.some(q=>j.collections.includes(q));return(Ze?2:0)+(oe?1:0)}},[f,j,R]),D=s.useMemo(()=>{if(j||!n||r)return[];const G=gi(m);return LP(f,se=>G.includes(se.id)).slice(0,6)},[j,n,r,f,m]),[B,V]=s.useState(null),[W,K]=s.useState(!1),[F,_]=s.useState(!1),[O,Y]=s.useState(!1),z=s.useRef(!1),X=n2(),Z=s.useMemo(()=>[...new Set([...f.flatMap(G=>G.verticals),..._c(u).flatMap(G=>G.verticals)])].sort((G,se)=>G.localeCompare(se)),[f,u]),J=async G=>{if(M){_(!0),V(null);try{const se=await Ne.updateScene(u.id,M.id,{name:G.name,verticals:G.categories,...G.ways?{setups:G.ways}:{}});i(se.brand),Y(!1)}catch(se){V(String(se.message??se))}finally{_(!1)}}},me=async()=>{if(!M||z.current)return;z.current=!0;const G=X(),se=sl(u);K(!0);try{const We=await Ne.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)),K(!1));return}await l()}G()&&h(se,{replace:!0})};if(!n&&!M)return o.jsx(ls,{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(ls,{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(ls,{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:`${xr(u)}?compose=1`,children:"Start from scratch"}),o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:sl(u),children:"Browse all scenes"})]}),D.length>0&&o.jsx(Wu,{label:"You might like",children:D.map(G=>o.jsx(ff,{scene:G,variant:"navigate",size:"slider",onOpen:T,href:Zr(u,G.id)},G.id))})]})});const ne=y.length?[...y].sort((G,se)=>PS.indexOf(G.view)-PS.indexOf(se.view)).map(G=>({src:G.url,label:G.view==="place"?"The place":Ua[G.view],view:G.view})):g.length?g.map((G,se)=>({src:G,label:`Example ${se+1}`})):j.previewUrl?[{src:j.previewUrl,label:j.cover&&j.cover!=="place"?Ua[j.cover]:"The place"}]:[],fe=async G=>{if(C)return;const se=X();E(!0),V(null);try{const{hash:We}=await Ne.pickSceneView(j.id,G);if(!se())return;p(j.id,void 0,We,G)}catch(We){V(String((We==null?void 0:We.message)??We))}finally{E(!1)}},re=(M==null?void 0:M.setups)??[],ee=((M==null?void 0:M.refs)??[]).filter(G=>G!==(M==null?void 0:M.placeUrl)),Q=((ft=(Be=M==null?void 0:M.examples)==null?void 0:Be.find(G=>!G.earlier))==null?void 0:ft.with)??((Qe=(Ue=M==null?void 0:M.examples)==null?void 0:Ue[0])==null?void 0:Qe.with),he=!!M&&(M.anchor===!0||!!(M.figure&&M.figureTreatment)),Me=M!=null&&M.previewHash||(Pe=M==null?void 0:M.examples)!=null&&Pe.length?" Use a view to shoot like it.":"",ce=M?M.figure&&he?`The person in it is a stand-in: with a presenter attached, the picture goes with the shot and they take the role.${Me}`:he?`${Q?`Shown in use with a Scenri demo ${Q}. `:""}Shots are given its picture as their world and find their own frame in it.${Me}`:Q?`Shown in use with a Scenri demo ${Q}. Shots are told the words.${Me}`:M.placeUrl?`Shots are told the words.${Me}`:"":"",ke=M?sie({refs:ee,setups:M.setups},ce):"";return o.jsx(ls,{children:o.jsxs("main",{className:"sc-lookpage sc-scenepage",id:"main",children:[o.jsx(wy,{to:sl(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(ys,{children:[o.jsx(bs,{children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary sc-splitbtn-more","aria-label":"Use it a way",children:o.jsx(ul,{size:12,weight:"bold","aria-hidden":!0})})}),o.jsx(xs,{children:re.map(G=>o.jsx(Xn,{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:fw(u,M.id),children:"Edit scene"}),o.jsx(yy,{kind:"scene",brandId:m,id:j.id}),M&&o.jsx(dr,{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(fd,{size:17})})})]}),B&&o.jsx("p",{className:"sc-assetform-err",children:B}),M?o.jsx(lie,{brandId:u.id,scene:M,onError:V},M.id):k!==(e??"")?o.jsx(pf,{count:LS,label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:Array.from({length:LS},(G,se)=>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(Ip,{label:"",isCover:!1})]},se))}):ne.length>1?o.jsx(pf,{count:ne.length,label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:ne.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:()=>P(G),children:o.jsx(ba,{src:Tn(G.src,"tile"),srcSet:cc(G.src)})}),G.view&&o.jsx(Du,{variant:"tile",label:G.label,isCover:!1,onOpen:()=>P(G),onUse:()=>void fe(G.view),busy:C})]}),o.jsx(Ip,{label:G.label,isCover:!1})]},G.src))}):ne.length===1?o.jsx("div",{className:"sc-scenepage-place",children:o.jsx("button",{type:"button",className:"sc-scenepage-open","aria-label":`${ne[0].label}, open`,onClick:()=>P(ne[0]),children:o.jsx(ba,{src:Tn(ne[0].src,"tile"),srcSet:cc(ne[0].src)})})}):o.jsx(Nw,{}),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,se)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${se+1}, open`,onClick:()=>P({src:G,label:`Source photo ${se+1}`}),children:o.jsx(ba,{src:Tn(G,"micro")})},G))})]}),M&&o.jsxs("div",{className:"sc-prec",children:[ke&&o.jsx("p",{className:"sc-prec-note",children:ke}),o.jsx(Qn,{label:"Delete scene",title:`Delete ${M.name}?`,body:vi("owned-scene",1),busy:W,onConfirm:()=>void me()})]}),L.length>0&&o.jsx(Wu,{label:`Shots made in ${j.name}`,children:L.map(G=>o.jsx(Mw,{node:G,to:Nm(u,null,G.id)},G.id))}),H.length>0&&o.jsx(Wu,{label:"Other scenes, similar light",children:H.map(G=>o.jsx(ff,{scene:G,variant:"navigate",size:"slider",onOpen:T,href:Zr(u,G.id)},G.id))}),O&&M&&o.jsx(rL,{name:M.name,categories:M.verticals,known:Z,hint:"The verticals this place suits, so it surfaces where you work.",ways:re,wayChoices:H4,wayMax:nL,busy:F,error:B,onSave:G=>void J(G),onDismiss:()=>Y(!1)}),A&&o.jsx(ud,{src:A.src,kind:"scene",label:A.label,noun:j.name,onClose:()=>P(null),actions:A.view?o.jsx(Du,{variant:"sheet",label:A.label,isCover:!1,onUse:()=>void fe(A.view),busy:C}):void 0})]})})}function uie({draft:e,href:t,onDiscard:n,chosen:r,batching:a,onPick:i,batch:l}){return o.jsx(eL,{id:e.id,name:e.name.trim()||"Untitled presenter",hash:e.hash,drawing:!!e.drawing,state:die(e),href:t,blank:o.jsx(oF,{size:44,weight:"thin"}),onDiscard:n,chosen:r,batching:a,onPick:i,batch:l})}function die(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 fie({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(Fs,{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(ks,{className:"sc-newdlg-title",children:"Duplicate presenter"}),o.jsx(Ss,{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 hie=60;function pie(e,t,n=hie){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 mie=8,q8="__bookmarked";function gie(){const{presenters:e,presenterCategories:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:l}=Dn(),{brand:u}=un(),f=Bn(),h=ey(),{push:p}=rr(),{q:m,setQ:g,facets:w,setFacets:y,clearSearch:b,clear:k}=r1(["category","bookmarked"]),S=w.category,C=w.bookmarked==="1",[E,A]=s.useState(()=>cd("presenter",u.id)),P=ve=>A(Ym("presenter",u.id,ve)),T=my(`${u.id}|${m}|${S??""}|${C?"1":""}`),M=Pl(),j=s.useMemo(()=>Yf(u),[u]),[R,L]=Sa(Kr.wallDensity,ad),H=Vc(R),D=ve=>L(ve),B=Im(H),V=Hm(H),W=ve=>f(Ea(u,ve)),K=ve=>f(Am(u,ve)),F=s.useMemo(()=>S?e.filter(ve=>ve.suitableCategories.includes(S)):e,[e,S]),_=s.useMemo(()=>F.filter(ve=>Ro(Pp(ve),m)),[F,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"]}),[X,Z]=s.useState([]),J=s.useRef(0),me=s.useCallback(()=>{const ve=++J.current;return Ne.presenterDrafts(u.id).then(lt=>{ve===J.current&&Z(lt.drafts.filter(dt=>!dt.presenterId))}).catch(()=>{}),()=>{ve===J.current&&J.current++}},[u.id]),ne=!!mn({path:ht.presenterStudio}),{tasks:fe}=ea(),re=fe.filter(ve=>ve.id.startsWith("presenter:")).map(ve=>`${ve.id}:${ve.state}:${ve.percent??""}`).join("|");s.useEffect(()=>{if(!ne)return me()},[ne,me,re]);const ee=s.useCallback(ve=>{const lt=Math.max(0,X.findIndex(dt=>dt.id===ve));Q.current=lt,T.forget(ve),Z(dt=>dt.filter($e=>$e.id!==ve)),Ne.deletePresenterDraft(u.id,ve).finally(()=>me())},[u.id,X,me,T.forget]),Q=s.useRef(null);s.useEffect(()=>{var $e;const ve=Q.current;if(ve===null)return;Q.current=null;const lt=($e=O.current)==null?void 0:$e.querySelectorAll("[data-build] .sc-cardpuck"),dt=lt!=null&&lt.length?lt[Math.min(ve,lt.length-1)]:Y.current??document.querySelector(".sc-new-go");dt==null||dt.focus()},[X]);const[he,Me]=s.useState(null),[ce,ke]=s.useState(!1),[Be,ft]=s.useState(!1),Ue=s.useCallback(ve=>{const lt=X.find(dt=>dt.id===ve);lt!=null&&lt.drawn?Me(lt):ee(ve)},[X,ee]),[Qe,Pe]=s.useState(null),[G,se]=s.useState(null),[We,Ze]=s.useState(null),[oe,q]=s.useState(!1),[ae,Le]=s.useState(null),[Ie,Je]=s.useState(null),ge=s.useCallback(ve=>{const lt=j.find(dt=>dt.id===ve);lt&&(Le(null),Pe(lt))},[j]),et=s.useCallback(ve=>{const lt=j.find(dt=>dt.id===ve);lt&&(Le(null),se(lt))},[j]),nt=async ve=>{if(!(!G||oe)){q(!0),Le(null);try{i((await Ne.updatePresenter(u.id,G.id,{name:ve})).brand),se(null)}catch(lt){const dt=cn(lt,"Could not rename this presenter");Le([dt.title,dt.detail].filter(Boolean).join(" "))}finally{q(!1)}}},pt=s.useCallback(ve=>{const lt=j.find(dt=>dt.id===ve);lt&&Ze(lt)},[j]),St=s.useRef(null);s.useEffect(()=>{var $e;const ve=St.current;if(ve===null)return;St.current=null;const lt=($e=O.current)==null?void 0:$e.querySelectorAll(".sc-lookcard:not([data-build]) .sc-lookcard-more"),dt=lt!=null&&lt.length?lt[Math.min(ve,lt.length-1)]:Y.current??document.querySelector(".sc-new-go");dt==null||dt.focus()},[e,u]);const at=async ve=>{if(!(!Qe||oe)){q(!0),Le(null);try{const lt=await Ne.duplicatePresenter(u.id,Qe.id,ve);i(lt.brand),Pe(null),Je(lt.presenter.id)}catch(lt){const dt=cn(lt,"Could not duplicate this presenter");Le([dt.title,dt.detail].filter(Boolean).join(" "))}finally{q(!1)}}},_t=async()=>{if(!(!We||oe)){St.current=Math.max(0,Lt.findIndex(ve=>ve.id===We.id)),q(!0);try{const ve=await Ne.deletePresenter(u.id,We.id);i(ve.brand),T.forget(We.id),Ze(null)}catch(ve){(ve==null?void 0:ve.status)===404?(await l(),T.forget(We.id),Ze(null)):p(cn(ve,"Could not delete this presenter"))}finally{q(!1)}}};s.useEffect(()=>{var lt,dt;if(!Ie)return;(dt=(lt=O.current)==null?void 0:lt.querySelector(".sc-lookcard[data-just-added]"))==null||dt.scrollIntoView({block:"nearest"});const ve=window.setTimeout(()=>Je(null),1800);return()=>window.clearTimeout(ve)},[Ie]);const Lt=s.useMemo(()=>j.filter(ve=>S?!ve.suitableCategories.length||ve.suitableCategories.includes(S):!0).filter(ve=>Ro(Pp(ve),m)).filter(ve=>C?E.includes(ve.id):!0),[j,S,m,C,E]),Mt=!(j.length>0||X.length>0),$t=[...j,...e].reduce((ve,lt)=>ve+(E.includes(lt.id)?1:0),0),Se=C&&$t===0,Ke=Se&&Mt,kt=Se&&!Mt,qe=!C||Ke,ot=Lt.filter(ve=>!C||Ke||E.includes(ve.id)),rt=qe&&X.length>0||ot.length>0,{visible:tn,remaining:Qt,showMore:on}=hf(ot,`${u.id}|${S??""}|${C?"keepers":""}|${Ke?"browse":""}|${m}`),[Wt,zt]=s.useState(null);s.useEffect(()=>{if(!Wt||Qt<=0)return;const ve=new IntersectionObserver(lt=>{lt.some(dt=>dt.isIntersecting)&&on()},{root:Wt.closest(".sc-home"),rootMargin:"200% 0px"});return ve.observe(Wt),()=>ve.disconnect()},[Wt,Qt,on]);const Ut=s.useMemo(()=>!C||Ke?_:_.filter(ve=>E.includes(ve.id)),[_,C,Ke,E]),{visible:te,remaining:ie,showMore:pe}=hf(Ut,`${S??""}|${C?"keepers":""}|${Ke?"browse":""}|${m}`),Fe=e.length+j.length>0?"tabs":"none",Oe=s.useCallback(async ve=>{const{failed:lt,error:dt}=await Op(ve,$e=>Ne.deletePresenterDraft(u.id,$e));Z($e=>$e.filter(Ge=>lt.includes(Ge.id)||!ve.includes(Ge.id))),T.retain(lt),me(),dt&&p(cn(dt,"Could not discard these drafts"))},[u.id,me,T.retain,p]),mt=()=>{const ve=X.filter(lt=>T.ids.has(lt.id));ve.some(lt=>lt.drawn)?ve.length===1?Me(ve[0]):ke(!0):Oe(ve.map(lt=>lt.id))},yt=()=>{const ve=[...T.ids];ve.length===1?pt(ve[0]):ft(!0)},Et=[...T.ids],st=T.kind==="presenter"&&Et.length>0&&Et.every(ve=>E.includes(ve)),vt=()=>A(ty("presenter",u.id,Et,!st)),Ae=Xm(T.ids.size,st,"presenters"),xe=async()=>{if(oe)return;const ve=[...T.ids];q(!0);try{const{failed:lt,error:dt}=await Op(ve,$e=>Ne.deletePresenter(u.id,$e));await l(),T.retain(lt),ft(!1),dt&&p(cn(dt,"Could not delete these presenters"))}finally{q(!1)}},Xe={key:"category",label:"Category",everyLabel:"All presenters",everyCount:e.length+j.length,selected:C?q8:S,onSelect:ve=>y(ve===q8?{bookmarked:"1",category:null}:{bookmarked:null,category:ve}),options:[{value:q8,label:"Keepers",count:$t},...t.map(ve=>({value:ve,label:ve,count:[...j,...e].filter(lt=>!lt.suitableCategories.length||lt.suitableCategories.includes(ve)).length}))]},Ct=o.jsx(Jm,{title:"Presenters",filters:o.jsx(e2,{mode:Fe,group:Xe}),density:o.jsx(Om,{value:H,onChange:D}),search:e.length>=mie&&o.jsx(Cd,{value:m,onChange:g,noun:"presenters",total:e.length})});return o.jsxs(qf.Provider,{value:V,children:[o.jsx(ls,{children:o.jsxs("main",{className:"sc-looks sc-presenters",id:"main","data-hero":Mt||void 0,onClick:T.onBlank,children:[!Mt&&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&&X.map(ve=>o.jsx(uie,{draft:ve,href:ol(u,ve.id),onDiscard:Ue,chosen:T.ids.has(ve.id),batching:T.batching==="draft",onPick:T.picking("draft")?lt=>T.toggle("draft",lt):void 0,batch:T.kind==="draft"&&T.ids.has(ve.id)?{count:T.ids.size,onAct:mt}:null},ve.id)),he&&o.jsx(Qn,{label:"Discard",title:`Discard ${he.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:ve=>{ve||Me(null)},onConfirm:()=>{ee(he.id),Me(null)}}),tn.map(ve=>o.jsx(D4,{presenter:ve,variant:"use",size:"grid",onOpen:W,href:Ea(u,ve.id),onUse:h,onDuplicate:ge,onEdit:K,onDelete:pt,onRename:et,bookmarked:E.includes(ve.id),onBookmark:P,fresh:ve.id===Ie,chosen:T.ids.has(ve.id),batching:T.batching==="presenter",onPick:T.picking("presenter")?lt=>T.toggle("presenter",lt):void 0,batch:T.kind==="presenter"&&T.ids.has(ve.id)?{count:T.ids.size,onAct:yt,onKeep:vt,allKept:st}:null},ve.id)),G&&o.jsx(hy,{title:"Rename presenter",name:G.name,maxLength:60,busy:oe,error:ae,onConfirm:ve=>void nt(ve),onDismiss:()=>{oe||se(null)}}),Qe&&o.jsx(fie,{suggested:pie(Qe.name,j.map(ve=>ve.name)),busy:oe,error:ae,onConfirm:ve=>void at(ve),onDismiss:()=>{oe||Pe(null)}}),We&&o.jsx(Qn,{label:"Delete presenter",title:`Delete ${We.name}?`,body:vi("presenter",1),open:!0,busy:oe,onOpenChange:ve=>{!ve&&!oe&&Ze(null)},onConfirm:()=>void _t()}),Be&&o.jsx(Qn,{label:as("presenter",T.ids.size).menu,title:`${as("presenter",T.ids.size).menu}?`,body:vi("presenter",T.ids.size),open:!0,busy:oe,onOpenChange:ve=>{!ve&&!oe&&ft(!1)},onConfirm:()=>void xe()}),ce&&o.jsx(Qn,{label:as("draft",T.ids.size).menu,title:`${as("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:ve=>{ve||ke(!1)},onConfirm:()=>{const ve=[...T.ids];ke(!1),Oe(ve)}})]}),Qt>0&&o.jsx("div",{ref:zt,"aria-hidden":!0}),Qt>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:on,children:["Show ",Math.min(Qt,60)," more"]})})]}),Mt&&n&&!r&&e.length>0&&o.jsx(ko,{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&&te.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(XP,{size:"grid",count:8})}),n&&r&&o.jsx(ko,{shape:"error",title:"Couldn't load the presenter library",body:"Something went wrong reaching the catalog.",onRetry:()=>a()}),Mt&&n&&!r&&e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gy,{label:"Or cast someone from ours"}),Ct]}),n&&!r&&te.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:te.map(ve=>o.jsx(D4,{presenter:ve,variant:"use",size:"grid",onOpen:W,href:Ea(u,ve.id),onUse:h,bookmarked:E.includes(ve.id),onBookmark:P},ve.id))}),n&&!r&&kt&&o.jsx(ko,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a presenter from its card and it stays here.",mark:fy,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>y({bookmarked:null}),children:"Browse every presenter"})}),n&&!r&&!kt&&!Ut.length&&e.length>0&&o.jsx(t2,{noun:"presenters",q:m,facet:C?"Keepers":S,onClearSearch:b,onClearAll:k}),n&&!r&&!e.length&&o.jsx(ko,{shape:"zero",body:"The presenter library is still being cast. Check back soon."}),ie>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:pe,children:["Show ",Math.min(ie,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"?X.length:tn.length,tool:as(T.kind,T.ids.size).tool,icon:as(T.kind,T.ids.size).icon,danger:as(T.kind,T.ids.size).danger,onAct:T.kind==="draft"?mt:yt,keep:T.kind==="presenter"?{label:Ae.tool,filled:st,onAct:vt}:null,onClear:T.clear,onSelectAll:()=>T.selectAll(T.kind==="draft"?"draft":"presenter",(T.kind==="draft"?X:tn).map(ve=>ve.id))})}),o.jsx(Rc,{})]})}const $S={portrait:"Face",identity:"Face",front:"Full body","three-quarter":"Three-quarter",back:"Back",left:"Left",right:"Right","left-profile":"Left","right-profile":"Right"},TS=3;function vie(){var ne;const{presenterId:e=""}=Qs(),{presenters:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:l,presenterCategories:u}=Dn(),{brand:f}=un(),h=Bn(),p=n2(),m=s.useRef(!1),g=ey(),[w,y]=s.useState([]),[b,k]=s.useState(null),[S,C]=s.useState(null),E=lX(f,e),A=E??t.find(fe=>fe.id===e);Ic(A==null?void 0:A.name);const P=!!E,[T,M]=s.useState(null);s.useEffect(()=>{let fe=!0;if(y([]),!P)return Ne.presenterFrames(e).then(re=>{fe&&(y(re.frames),M(e))}).catch(()=>{fe&&(y([]),M(e))}),()=>{fe=!1}},[e,P]);const j=!!mn({path:ht.presenterEdit});s.useEffect(()=>{let fe=!0;if(C(null),!(!P||j))return Ne.presenterDrafts(f.id).then(re=>{if(!fe)return;const ee=re.drafts.find(Q=>Q.presenterId===e);C((ee==null?void 0:ee.id)??null)}).catch(()=>{}),()=>{fe=!1}},[f.id,e,P,j]);const R=((ne=f.json)==null?void 0:ne.characters)??[],L=R.find(fe=>fe.presenterId===e),H=R.find(fe=>fe.id===e),D=vy(f.id,[e??"",(L==null?void 0:L.id)??""]),[B,V]=s.useState(null),[W,K]=s.useState(!1),[F,_]=s.useState(!1),O=async fe=>{if(E){K(!0),V(null);try{const re=await Ne.updatePresenter(f.id,E.id,fe);i(re.brand),_(!1)}catch(re){V(String(re.message??re))}finally{K(!1)}}},Y=async()=>{if(!E||m.current)return;m.current=!0;const fe=p(),re=ni(f);K(!0);try{const ee=await Ne.deletePresenter(f.id,E.id);i(ee.brand)}catch(ee){if((ee==null?void 0:ee.status)!==404){m.current=!1,fe()&&(V(String(ee.message??ee)),K(!1));return}await l()}fe()&&h(re,{replace:!0})},z=Aw(f,e);if(z!==e)return o.jsx(Ka,{to:Ea(f,z),replace:!0});if(!n&&!E)return o.jsx(ls,{children:o.jsx("main",{className:"sc-lookpage",id:"main",children:o.jsx("div",{className:"sc-tplrow","aria-hidden":!0})})});if(r&&!E)return o.jsx(ls,{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(ls,{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:ni(f),children:"Browse presenters"})})]})});const X=E?(Array.isArray(H==null?void 0:H.shots)?H.shots:[]).map((fe,re)=>({src:qr(fe==null?void 0:fe.file),label:$S[(fe==null?void 0:fe.angle)??""]??`Reference ${re+1}`,angle:typeof(fe==null?void 0:fe.angle)=="string"?fe.angle:void 0})).filter(fe=>!!fe.src):w.length?w.map((fe,re)=>({src:fe.url,label:$S[fe.angle]??`Reference ${re+1}`,angle:fe.angle})):A.previewUrl?[{src:A.previewUrl,label:"Preview"}]:[],Z=Am(f,e),J=hi(E??A),me=[...new Set([...u,...Yf(f).flatMap(fe=>fe.suitableCategories??[])])].sort((fe,re)=>fe.localeCompare(re));return o.jsx(ls,{children:o.jsxs("main",{className:"sc-lookpage sc-presenterpage",id:"main",children:[o.jsx(wy,{to:ni(f),wall:"Presenters",where:E?"Yours":"Scenri library"}),J.src&&o.jsx("div",{className:"sc-presenterpage-avatar",children:o.jsx(ba,{src:Tn(J.src,"small"),crop:J.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(fe=>o.jsx("li",{className:"sc-chip","data-static":!0,children:fe},fe))}),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"}),E&&o.jsx(Zn,{className:"sc-btn sc-btn-ghost",to:Z,children:S?"Continue editing":"Edit presenter"}),o.jsx(yy,{kind:"presenter",brandId:f.id,id:e}),E&&o.jsx(dr,{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(fd,{size:17})})})]}),B&&o.jsx("p",{className:"sc-assetform-err",children:B}),!E&&T!==e?o.jsx(pf,{count:TS,label:"Reference set",className:"sc-refset-rail",trackClassName:"sc-refset",children:Array.from({length:TS},(fe,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))}):X.length>0?o.jsx(pf,{count:X.length,label:"Reference set",className:"sc-refset-rail",trackClassName:"sc-refset",children:X.map(fe=>o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-refset-tile","data-role":fe.angle,"aria-label":`${fe.label}, open`,onClick:()=>k(fe),children:o.jsx(ba,{src:Tn(fe.src,"small")})}),o.jsx("span",{className:"sc-refset-lb","aria-hidden":!0,children:fe.label})]},fe.label))}):o.jsx(Nw,{}),E&&E.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:E.sourceRefs.map((fe,re)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${re+1}, open`,onClick:()=>k({src:fe,label:`Source photo ${re+1}`}),children:o.jsx(ba,{src:Tn(fe,"micro")})},fe))})]}),E&&o.jsxs("div",{className:"sc-prec",children:[o.jsxs("p",{className:"sc-prec-note",children:[A.ageRange?`${A.ageRange} · `:"",E.source==="synthetic"?"Created in Scenri. Not a real person.":E.source==="photos"?"Built from your photographs.":"Saved in Scenri.",E.likeness?` Likeness confirmed ${new Date(E.likeness.attestedAt).toLocaleDateString()}.`:""]}),o.jsx(Qn,{label:"Delete presenter",title:`Delete ${E.name}?`,body:vi("presenter",1),busy:W,onConfirm:()=>void Y()})]}),D.length>0&&o.jsx(Wu,{label:`Shots featuring ${A.name}`,children:D.map(fe=>o.jsx(Mw,{node:fe,to:Nm(f,null,fe.id)},fe.id))}),F&&E&&o.jsx(rL,{name:E.name,categories:A.suitableCategories,known:me,hint:"The verticals they suit, so they surface where you work.",busy:W,error:B,onSave:fe=>void O({name:fe.name,suitableCategories:fe.categories}),onDismiss:()=>_(!1)}),b&&o.jsx(ud,{src:b.src,kind:"presenter",label:b.label,noun:A.name,onClose:()=>k(null)})]})})}function wie({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:C,colour:E,refs:A,onSend:P}){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 X=Number.parseFloat(getComputedStyle(z).maxHeight)||Number.POSITIVE_INFINITY;z.style.height=`${Math.min(z.scrollHeight,X)}px`,z.style.overflowY=z.scrollHeight>X?"auto":"hidden"},[i]);const[L,H]=s.useState(!1),D=jr(ta);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 X=setTimeout(()=>H(!1),700);return()=>clearTimeout(X)}},[w,j,f,D]);const B=f||m,V=!!(E!=null&&E.hex)||!!(A!=null&&A.some(z=>!z.busy)),W=!i.trim()&&!u&&!V,K=()=>{B||W||P(i)},F=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:W&&!f?"Nothing typed yet.":null,Y=o.jsxs("button",{type:"button",className:"sc-convo-send","aria-disabled":(_?!!b:m||B||W)||void 0,"aria-busy":m||_||void 0,"data-stop":_||void 0,onClick:_?b?void 0:y:m?void 0:K,children:[o.jsx("span",{className:"sc-convo-send-ico",children:m||_?o.jsx("span",{className:"sc-convo-spin","aria-hidden":"true"}):o.jsx(P7,{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":L||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(Rn,{size:11,weight:"bold"})})]},z.key)),E&&o.jsxs("span",{className:"sc-token","data-kind":"color","data-empty":E.hex?void 0:"",dir:"ltr",children:[o.jsxs(od,{className:"sc-convo-chip",triggerStyle:{background:"none"},value:E.hex??E.seed??"#808080",commitMode:"live",align:"start",label:E.hex?`${E.label}. Change the colour.`:"Pick a colour",onChange:E.onPick,children:[o.jsx("span",{className:"sc-token-swatch",style:E.hex?{background:E.hex}:void 0}),o.jsx("span",{className:"sc-token-label",children:E.label})]}),E.hex&&o.jsx("button",{type:"button",className:"sc-convo-chip-x","aria-label":"Remove colour",onClick:E.onClear,children:o.jsx(Rn,{size:11,weight:"bold"})})]}),o.jsx("textarea",{ref:T,className:"sc-in",rows:1,maxLength:ld,"aria-label":t,placeholder:E!=null&&E.hex&&!i?"":f&&h?h:e,value:i,disabled:f,onChange:z=>l(z.target.value),onKeyDown:z=>{z.key!=="Enter"||z.shiftKey||(z.preventDefault(),K())}})]}),o.jsxs("div",{className:"sc-convo-row",children:[(k||S)&&o.jsxs(o.Fragment,{children:[o.jsx(dr,{label:B&&h?h:C??"Add photos",children:o.jsx("button",{type:"button",className:"sc-convo-attach","aria-label":C??"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":C??"Add a picture",onChange:z=>{const X=Array.from(z.target.files??[]).filter(Z=>Z.type.startsWith("image/"));z.target.value="",X.length&&S(X)}})]}),O?o.jsx(dr,{label:O,children:Y}):Y]})]}),F.text?o.jsx("small",{className:"sc-convo-line",role:F.tone==="alert"?"alert":void 0,"data-tone":F.tone,children:F.text}):null]})}function oL({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 DS=500,iL=400,lL=760,wu=e=>Math.min(lL,Math.max(iL,Math.round(e)));function yie({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);uy(w,"--sc-pstudio-dock-h"),s.useEffect(()=>{const A=P=>{P.key!=="Escape"||P.defaultPrevented||(P.preventDefault(),m())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[m]);const[b,k]=Sa(Kr.pstudioRailW,DS),S=s.useRef(0),C=s.useRef(0),E=s.useRef(null);return zr.createPortal(o.jsx(pd,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:A=>{var P;E.current=document.activeElement instanceof HTMLElement?document.activeElement:null,A.preventDefault(),(P=g.current)==null||P.focus({preventScroll:!0})},onUnmountAutoFocus:A=>{var P,T;(P=E.current)!=null&&P.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":`${wu(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 P=Array.from(((T=A.dataTransfer)==null?void 0:T.files)??[]);P.length&&(A.preventDefault(),p(P))},onPaste:A=>{var T;if(!h)return;const P=Array.from(((T=A.clipboardData)==null?void 0:T.files)??[]).filter(M=>M.type.startsWith("image/"));P.length&&(A.preventDefault(),h(P))},children:[o.jsxs("div",{className:"sc-pstudio-grid",children:[o.jsx(dr,{label:"Close (esc)",children:o.jsx("button",{type:"button",className:"sc-pstudio-close",onClick:m,"aria-label":"Close",children:o.jsx(Rn,{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(Rn,{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":iL,"aria-valuemax":lL,"aria-valuenow":wu(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 P=A.currentTarget.closest(".sc-pstudio");S.current=A.clientX,!C.current&&(C.current=requestAnimationFrame(()=>{C.current=0,P==null||P.style.setProperty("--sc-pstudio-rail-set",`${wu(window.innerWidth-S.current)}px`)}))},onPointerUp:A=>{A.currentTarget.releasePointerCapture(A.pointerId),C.current&&(cancelAnimationFrame(C.current),C.current=0),k(wu(window.innerWidth-A.clientX))},onDoubleClick:()=>k(DS),onKeyDown:A=>{if(A.key==="ArrowLeft")k(P=>wu(P+16));else if(A.key==="ArrowRight")k(P=>wu(P-16));else return;A.preventDefault()}})]}),l]})}),document.body)}function bie({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=xie(n),[w,y]=s.useState(null),b=f??[],k=Math.max(0,b.findIndex(L=>w?L.hash===w:L.current)),S=b[k];s.useEffect(()=>y(null),[e]);const C=kie(w&&b.some(L=>L.hash===w)?w:e),[E,A]=s.useState(void 0);s.useEffect(()=>{C||A(void 0)},[C]);const P=L=>{const H=b[k+L];H&&y(H.hash)},T=s.useRef(null),[M,j]=s.useState(!1);s.useLayoutEffect(()=>{const L=T.current,H=!!(L!=null&&L.complete&&L.naturalWidth);j(!H),H&&(L!=null&&L.naturalHeight)&&A(L.naturalWidth/L.naturalHeight)},[C]);const R=!!e&&!C;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:E?{"--sc-well-ar":E}:void 0,children:[e&&C?o.jsx("img",{ref:T,src:$r(C),srcSet:`${gn(C,"tile")} 640w, ${$r(C)} 1024w`,sizes:"(max-width: 767px) 92vw, 44vw",alt:t,decoding:"async","data-waiting":M||void 0,onLoad:L=>{const H=L.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(oL,{glyph:m,lead:p==null?void 0:p.lead,hint:p==null?void 0:p.hint})}),(n&&!e||R)&&o.jsx(Ca,{}),n&&o.jsxs("span",{className:"sc-pstudio-doing",children:[o.jsx("span",{children:u??"Drawing"}),r&&o.jsx("time",{"aria-hidden":"true",children:Sc(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&&P(-1),children:o.jsx(Aa,{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&&P(1),children:o.jsx(vl,{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(L=>{const H=L.label+(L.approved?", used":L.state==="stale"?", to be drawn again":"")+(L.photo?", your photo":"")+(L.drawing?", drawing":"")+(L.error?", failed":"");return o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-pstudio-slot","data-state":L.state,"data-view":L.view,"aria-current":L.state==="current"?"step":void 0,"aria-label":H,disabled:!i,onClick:()=>i==null?void 0:i(L.view),children:o.jsxs("span",{className:"sc-pstudio-slot-inner",children:[L.hash?o.jsx("img",{src:gn(L.hash,"micro"),alt:""}):null,L.drawing?o.jsx(Ca,{}):null,L.approved&&!L.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","aria-hidden":!0,children:o.jsx(Gn,{size:11,weight:"bold"})}):null,L.error&&!L.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","data-tone":"alert","aria-hidden":!0,children:o.jsx(nm,{size:11,weight:"bold"})}):null]})}),o.jsx("span",{className:"sc-pstudio-slot-lb","data-on":L.state==="current"||void 0,"aria-hidden":!0,children:L.label})]},L.view)})})]})}function xie(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 kie(e){const[t,n]=s.useState(e);return s.useEffect(()=>{if(!e||e===t){e||n(void 0);return}let r=!0;const a=()=>{r&&n(e)},i=new Image;i.srcset=`${gn(e,"tile")} 640w, ${$r(e)} 1024w`,i.sizes="(max-width: 767px) 92vw, 44vw",i.src=$r(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 by({surface:e,onClose:t}){var h,p,m;const n=jr(ta),r=e,a=(h=r.stage)==null?void 0:h.onPick,i=a?g=>a(g):void 0,l=Wte(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(iF,{size:32}),f=n?null:r.stage?o.jsx(bie,{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(oL,{glyph:u,lead:(p=r.stageEmpty)==null?void 0:p.lead,hint:(m=r.stageEmpty)==null?void 0:m.hint})})})})});return o.jsx(yie,{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($ne,{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(wie,{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 jd=[{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"}]}}],Ra=e=>jd.find(t=>t.id===e),Sie=/\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 cL(e){return Sie.test(e??"")}function Eie(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&&!cL(n)?`${n} ${r}`:n:r?`${((l=Ra(e))==null?void 0:l.label.toLowerCase())??e} ${r}`:""}function HS(e,t){const n=(t??[]).filter(r=>/\b(left|right)\b/i.test(r.words)&&(e==="front"||!Cie.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 Cie=new Set(["tattoo","prosthetic"]),r2=["who","age","heritage","skin","hair","length","facial","eyes","build","height"],Cc="either",jc=e=>{var t,n;return[(e==null?void 0:e.pick)===Cc?"":(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(", ")},uL=e=>{var t;return!!(e!=null&&e.pick||(t=e==null?void 0:e.words)!=null&&t.trim())},s2=e=>{var t;return((t=e.source)==null?void 0:t.door)==="scratch"},O4=e=>{var t;return s2(e)&&((t=e.source)==null?void 0:t.via)==="taps"},a2=e=>{var t;return s2(e)&&((t=e.source)==null?void 0:t.via)!=="taps"},o2=e=>{var t;return((t=e.source)==null?void 0:t.door)==="photos"},jie=/\b(slim|slender|athletic|average|fuller|curvy|broad|lean|muscular|petite|stocky|heavy|thin|plus.size)\b/i;function xy(e){const t=e.trim(),n=t.split(/\s+/).filter(Boolean).length,r=[];return hp.test(t)||r.push("who"),gw.test(t)||r.push("age"),r.length&&!jie.test(t)&&n<8&&r.push("build"),r}const Aie=(e,t)=>r2.every(n=>!vL(`look-${n}`,e,t)||e[`look-${n}`]!==void 0),dL=e=>a2(e)&&e.describe!==void 0&&xy(e.describe).length>0,Nie=e=>a2(e)&&e.describe!==void 0&&(!dL(e)||e.gaps!==void 0),Mie=(e,t)=>{var n;return o2(e)&&!!t.draft&&t.draft.source==="photos"&&t.canGenerate&&t.draft.stage!=="analyzing"&&(e.traits!==void 0||!((n=t.draft.keep)!=null&&n.trim()))},fL=(e,t)=>O4(e)?Aie(e,t):a2(e)?Nie(e):Mie(e,t),Rie=(e,t)=>s2(e)||o2(e)&&!!t.draft,hL=e=>t=>{var n;return!!((n=t.traits)!=null&&n.includes(e))},pL=e=>t=>uL(t[`trait-${e}`]),mL=e=>t=>{var n;return hL(e)(t)&&pL(e)(t)&&!!((n=Ra(e))!=null&&n.where)&&!cL(jc(t[`trait-${e}`]))},Mh=(e,t)=>Array.isArray(e)&&e.includes(t),Pie=(e,t)=>{var n;return fL(e,t)&&(((n=e.traits)==null?void 0:n.every(r=>pL(r)(e)&&(!mL(r)(e)||e[`trait-${r}-where`]!==void 0)))??!1)},Lie=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),$ie=(e,t)=>{var r;if(!o2(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)},ci=[{id:"source",applies:()=>!0},{id:"photos",applies:o2},{id:"weakphotos",applies:$ie},...r2.map(e=>({id:`look-${e}`,applies:e==="facial"?t=>{var n;return O4(t)&&((n=t["look-who"])==null?void 0:n.pick)!=="woman"}:O4})),{id:"describe",applies:a2},{id:"gaps",applies:dL,dependsOn:[{on:"describe"}]},{id:"traits",applies:Rie,ready:fL},...jd.flatMap(e=>[{id:`trait-${e.id}`,applies:hL(e.id),dependsOn:[{on:"traits",changed:(t,n)=>Mh(t,e.id)!==Mh(n,e.id)}]},{id:`trait-${e.id}-where`,applies:mL(e.id),dependsOn:[{on:`trait-${e.id}`,changed:(t,n)=>jc(t)!==jc(n)},{on:"traits",changed:(t,n)=>Mh(t,e.id)!==Mh(n,e.id)}]}]),{id:"keep",applies:s2,ready:Pie,optional:!0,sticky:!0}],gL=new Map(ci.map(e=>[e.id,e])),Tie=ci.map(e=>e.id),mf=e=>{const t=ci.findIndex(n=>n.id===e);return t<0?ci.length:t},Die=e=>gL.get(e);function vL(e,t,n){return Die(e).applies(t,n)}function wL(e,t,n){if(e==="photos")return!!n.draft&&n.draft.source==="photos";const r=t[e];return r===void 0?!1:ur(e)||Oie(e)?uL(r):!0}function yL(e,t){return ci.filter(n=>n.applies(e,t)&&wL(n.id,e,t)).map(n=>n.id)}function i2(e,t){var n;return((n=ci.find(r=>{var a;return!r.optional&&r.applies(e,t)&&(((a=r.ready)==null?void 0:a.call(r,e,t))??!0)&&!wL(r.id,e,t)}))==null?void 0:n.id)??null}function OS(e,t,n){const r={...e},a=new Set,i=new Set(Object.keys(t));for(const[u,f]of Object.entries(t))Lie(e[u],f)&&(f===void 0?delete r[u]:r[u]=f,a.add(u));if(a.size){const u=ci.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 ci)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 ci){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 Hie(e){const t={};for(const n of e.traits??[]){const r=e[`trait-${n}`];r&&(t[n]={words:jc(r)||void 0,where:jc(e[`trait-${n}-where`])||void 0,refs:r.refs.length?r.refs:void 0})}return t}function bL(e){const t={};for(const n of r2){const r=e[`look-${n}`];r!==void 0&&(t[n]=r)}return t}const xL=e=>jd.map(t=>t.id).filter(t=>e.includes(t)),ur=e=>e.startsWith("look-"),Oie=e=>e.startsWith("trait-"),Ys=e=>gL.has(e);function cs(e){if(!e.startsWith("trait-"))return null;const t=e.endsWith("-where"),n=t?e.slice(6,-6):e.slice(6);return Ra(n)?{id:n,part:t?"where":"what"}:null}const Iie=[{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"}],Fie=[{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"}],_ie=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"]),Vie=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 Zie(e){const[t,n,r]=Vie(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 zie=e=>{var t;return((t=Iie.find(n=>e<n.to))==null?void 0:t.name)??"red"};function Bie(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 Uie(e){return e<.18?"deep":e<.34?"dark":e>=.88?"pale":e>=.74?"light":""}function kL(e){var u;const{h:t,s:n,l:r}=Zie(e);if(n<.09){const f=((u=Fie.find(h=>r<h.to))==null?void 0:u.name)??"grey";return{name:f,family:f,h:t,s:n,l:r}}const a=zie(t),i=Bie(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=Uie(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 Wie(e){const{family:t,h:n,s:r,l:a}=kL(e);return _ie.has(t)?!0:n>=16&&n<=60&&a>=.7&&r<.7||r<.09}const ky=[{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"}],SL=[{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"}],Sy=[{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"}],EL=[{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"}],Kie=[{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"}],Ey=[{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"}],CL=[{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"}],jL=[{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"}],Gie={},AL=[{id:"woman",label:"Woman"},{id:"man",label:"Man"},{id:"androgynous",label:"Androgynous"}],NL=["20s","30s","40s","50s","60+"].map(e=>({id:e,label:e})),s1={who:{row:{id:"who",label:"Who",options:AL},prompt:"Who are they?"},age:{row:{id:"age",label:"Age",options:NL},prompt:"Roughly how old?"},heritage:{row:{id:"heritage",label:"Heritage",options:Kie},prompt:"Where are they from?"},skin:{row:{id:"skin",label:"Skin",options:Sy},prompt:"And their skin?"},eyes:{row:{id:"eyes",label:"Eyes",options:Ey},prompt:"What colour are their eyes?"},facial:{row:{id:"facial",label:"Facial hair",options:CL},prompt:"Any facial hair?"},hair:{row:{id:"hair",label:"Hair",options:ky},prompt:"What colour is their hair?"},length:{row:{id:"length",label:"Length",options:SL},prompt:"And the length?"},build:{row:{id:"build",label:"Build",options:EL},prompt:"And their build?"},height:{row:{id:"height",label:"Height",options:jL},prompt:"And how tall?"}};r2.map(e=>s1[e]);const IS=new Set(["hair","skin","eyes"]),Yie={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"},qie=e=>e==="man"?"man":e==="woman"?"woman":"androgynous",Xie=new Set(["length","height","build"]),Qie=900;function Cy(e,t,n){const r=Jie(e,t);if(r.far<Qie)return r.id;const a=kL(e).name;return n==="hair"&&!Wie(e)?`dyed ${a}`:a}function Jie(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 FS=e=>e==="skin"?Sy:e==="eyes"?Ey:ky,Qh=e=>e.charAt(0).toUpperCase()+e.slice(1);function ML(e){const t=H=>H!=null&&H.pick&&H.pick!==Cc?H.pick:"",n=(H,D,B)=>{var W;const V=t(H);return V?V.startsWith("#")?Cy(V,D,B):V:((W=H==null?void 0:H.words)==null?void 0:W.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,SL),S=i(e.hair,ky,"hair"),C=[k,S].filter(Boolean).join(" ");C&&b.push(a(`${C} hair`,r(e.length),r(e.hair)));const E=i(e.facial,CL);E&&b.push(a(E,r(e.facial)));const A=i(e.eyes,Ey);A&&b.push(a(`${A} eyes`,r(e.eyes)));const P=i(e.skin,Sy,"skin");P&&b.push(a(`${P} skin`,r(e.skin)));const T=i(e.height,jL),M=i(e.build,EL),j=T?a(Gie[T]??T,r(e.height)):"",R=M?a(`${/^[aeiou]/.test(M)?"an":"a"} ${M} build`,r(e.build)):"",L=[j,R&&(j?`with ${R}`:R)].filter(Boolean).join(" ");return L&&b.push(L),b.length&&g.push(`with ${b.join(", ")}`),a(g.join(" "),r(e.who))}function ele(e,t){var i,l;const n=t.pick,r=n===Cc?"Either way":n!=null&&n.startsWith("#")?Qh(Cy(n,e.options,e.id)):n?((i=e.options.find(u=>u.id===n))==null?void 0:i.label)??Qh(n):"",a=((l=t.words)==null?void 0:l.trim())??"";return r?a?`${r}, ${a}`:r:Qh(a)}function tle(e){return Qh(ML(e))}const gf=e=>typeof e=="string"&&e.startsWith("aside:"),nle=e=>e.slice(6),Fp={answers:{},revision:0,editing:null,saying:null,says:0,text:"",colour:null,composing:null,asides:[],unsure:null,extrasDeclined:!1,held:!1,uploading:0},rle="That did not read as a description of someone.",RL=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function sle(e){if(!e||e==="name")return null;if(e==="keep")return"keep";const t=cs(e);return t&&t.part==="what"?`trait-${t.id}`:null}function _S(e,t){var r;const n=sle(t);return n?{id:n,refs:((r=e.answers[n])==null?void 0:r.refs)??[]}:null}function X8(e){const t=e.composing;if(!t)return e.answers;const n=e.answers[t.id];if(!n||RL(n.refs,t.refs))return e.answers;if(!jc(n)&&!t.refs.length){const r={...e.answers};return delete r[t.id],r}return{...e.answers,[t.id]:{...n,refs:t.refs}}}function ale(e,t){var r;if(!ur(t)&&!cs(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 I4(e,t,n,r){return e.filter(a=>!a.q||!Ys(a.q)?!0:!vL(a.q,t,n)||a.edit&&t[a.q]!==void 0?!1:r===void 0||mf(a.q)<=r)}function ole(e){const t=Object.keys(e).filter(n=>Ys(n));return t.length?Math.min(...t.map(mf)):void 0}function PL(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 Q8(e,t){const n=e.unsure;if(!n)return e;const r=i2(e.answers,t),a=u=>u&&(u===r||Ys(u)&&e.answers[u]!==void 0)?u:null,i=e.asides.map(u=>u.q==="unsure"?{...u,q:a(n.q)}:u),l=PL(i,{said:n.said,reply:rle,q:a(n.q),at:n.at});return{...e,unsure:null,asides:I4([...i,l],e.answers,t)}}function ile(e,t){var n,r,a;switch(t.type){case"answer":{const i=OS(e.answers,t.patch,t.ctx),l=!RL(i,e.answers),u=Q8(e,t.ctx);return{...u,answers:i,revision:l?e.revision+1:e.revision,asides:I4(u.asides,i,t.ctx,ole(t.patch)),editing:null,saying:null,colour:null,composing:null,text:""}}case"edit":{const i=gf(t.id)||t.id==="name"?void 0:ale(e,t.id);return{...e,answers:X8(e),composing:gf(t.id)?null:_S(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&&Ys(i.q)?i.q:null,u=l&&e.answers[l]!==void 0?OS(e.answers,{[l]:void 0},t.ctx):e.answers,f=I4(e.asides.filter(h=>h.at<=t.at),u,t.ctx,l?mf(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:X8(e),composing:null,editing:null,saying:null,colour:null,text:""};case"say":{const i=e.saying===t.id?null:t.id;return{...e,answers:X8(e),composing:_S(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&&Ys(t.aside.q)&&e.answers[t.aside.q]!==void 0?{...t.aside,after:!0}:t.aside;return{...e,asides:[...e.asides,PL(e.asides,l)],text:""}}case"unsure":return{...Q8(e,t.ctx),unsure:t.unsure,text:""};case"settle-unsure":return Q8(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{...Fp,revision:e.revision+1,text:t.text??""};case"restore":return{...Fp,answers:t.answers,revision:t.revision,asides:t.asides??[],extrasDeclined:!!t.extrasDeclined,held:!!t.held}}}function F4(e,t){return i2(e.answers,t)===null&&!e.editing&&!e.saying}const LL=5,$L=40;function lle(e){return JSON.stringify({v:LL,answers:e.answers,revision:e.revision,asides:e.asides.slice(-$L),...e.extrasDeclined?{extrasDeclined:!0}:{},...e.held?{held:!0}:{}})}function cle(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 ule(e){var r;if(ur(e))return s1[e.slice(5)].row.options;const t=cs(e),n=t&&Ra(t.id);return n?t.part==="where"?((r=n.where)==null?void 0:r.options)??[]:n.options:[]}function VS(e,t){return t===Cc||/^#[0-9a-f]{6}$/i.test(t)?{pick:t}:ule(e).some(n=>n.id===t)?{pick:t}:{words:t}}function dle(e,t){if(e==="keep")return typeof t=="string"?{words:t,refs:[]}:t;if(typeof t=="string"&&(ur(e)||cs(e)))return VS(e,t);const n=cs(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}:{...VS(e,r.words),refs:a}}return t}function _p(e){if(!e)return null;try{const t=JSON.parse(e);if(t.v!==LL&&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))Ys(a)&&(n[a]=dle(a,i));const r=(Array.isArray(t.asides)?t.asides:[]).map(cle).filter(a=>a!==null).slice(-$L);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 qn={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."},TL=e=>e==="photos"?"the photos":"the face",DL=[{id:"photos",label:"Add photos"},{id:"scratch",label:"Describe someone"}],fle={photos:/\b(photos?|pictures?|pics?|upload|images?|selfies?)\b/,scratch:/\b(scratch|describe|description|invent|make (someone|one|them) up|imagine|new person)\b/},hle=[{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 HL(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"}.`}HL(null);function ple(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 mle=(e,t)=>`${e} is larger than ${Math.round(t/1024/1024)}MB. Choose a smaller copy of it.`,gle=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.`,vle="First portrait appears here",wle=(e,t)=>!e||e==="portrait"||!t?vle:`The ${t} appears here`;function yle(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 OL=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 ble(e){return e===1?"One photo":`${e} photos`}function xle(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 kle="That does not read as a description yet. Draw from it anyway, or describe them: age, hair, build, skin, presence.",Sle=e=>e===0?void 0:e===1?"Changing this asks the one after it again.":`Changing this asks the ${e} after it again.`,Ele="Change this answer?",Cle="The face is drawn again from the change, and the views built on it follow. Nothing already saved changes.",jle="The views drawn from the photos are drawn again with the change. The photos themselves stay as they are.",Ale={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"},Nle={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"}},ms=e=>e.charAt(0).toUpperCase()+e.slice(1);function Jl(e,t,n,r="",a,i=!1){const l=t==="look"?Nle[a??""]??null:null,u=(l==null?void 0:l.how)??Ale[t],f=i?"":` ${ms(u)}.`;if(n>=2&&e!=="likeness"){const h=t==="look"||t==="detail"?"Or Skip it and we will choose.":"";return i?h||`${ms(u)}.`:`${ms(u)}.${h?` ${h}`:""}`}switch(e){case"likeness":return"Describe them by looks. Scenri does not draw a named person.";case"help":return l?`${ms(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"?`${ms(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. ${ms(u)}.`;case"intent":return l?`${ms(u)}.`:t==="refine"?`Nothing changes until it is said what: ${u}.`:`That is what we are here for. Who are they? ${ms(u)}.`;case"nonsense":return l?`That is not ${l.thing}.${f}`:t==="name"?`That is not a name. ${ms(u)}.`:t==="refine"?`That does not say what should change. ${ms(u)}.`:t==="detail"?`That does not say what it looks like. ${ms(u)}.`:`That does not describe anyone. ${ms(u)}.`;case"greeting":return n?`Still here.${f}`:/^(hi|hello|hey|heya|hiya|yo|hola|shalom|good)\b/i.test(r.trim())?`Hi.${f}`:`${ms(u)}.`;case"ack":return n?`Still here.${f}`:i?"Go ahead.":`Go ahead: ${u}.`;case"vague":return n?`Still here. ${ms(u)}.`:`${ms(u)}.`}}const Mle=e=>e.trim().replace(/[.\s]+$/,""),jy=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 l2(e,t,n=jy(null)){const r=ro(t);if(r.kind==="unknown")return{text:`${e}: ${Mle(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 _4=e=>e&&$N.includes(e)?[{id:"skip-extras",label:"Not now"}]:[];function IL(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 Rh(e,t){const n=e==="portrait"?"face":En[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"},..._4(e)]}:IL(l2(`The ${n} could not be drawn`,t,jy(e)),_4(e))}function Rle(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 Ple(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 Lle=e=>e.charAt(0).toUpperCase()+e.slice(1);function $le({draft:e,ui:t,afterCoverage:n,asides:r,openId:a,placed:i}){var re;const l=[],u=(ee,Q,he)=>l.push({kind:"scenri",id:ee,text:Q,tone:he}),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:qn.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:qn.name}),w=(ee,Q=[])=>t.failedView?Rh(t.failedView,ee):IL(l2("That did not go through",ee),Q),y=()=>{h||g()};if(e.stage==="analyzing")return u("reading",`Reading ${TL(e.source)}.`),h?m():g(),l;const b=zY(e);b&&u("coverage",b.text,b.tone),l.push(...n);const k=e.views.portrait,S=e.activeView,C=e.asks??[],E=C[C.length-1],A=E?e.views[E.view]:null,P=!!E&&!!A&&(A.status==="generating"&&e.activeView===E.view||A.status==="candidate"&&A.adjustment===E.text||!!A.error),T=ee=>ee==="portrait"&&!si(e)?qn.identity(p):qn.change,M=(e.results??[]).filter(ee=>ee.how!=="restored"),j=e.decisions??[],R=!e.activeView&&e.stage==="idle",L=new Map,H=new Map,D=new Map;for(const ee of M){const Q=`${ee.view}:${ee.hash}`;if(D.set(Q,ee),L.has(Q))continue;const he=(H.get(ee.view)??0)+1;H.set(ee.view,he),L.set(Q,he)}const B=ee=>L.get(`${ee.view}:${ee.hash}`)??1,V=(ee,Q)=>{const he=B(ee),Me=e.views[ee.view].hash===ee.hash,ce=(H.get(ee.view)??0)>1;return{kind:"scenri",id:Q,text:`Here is ${En[ee.view]} ${he}.`,thumb:ee.hash,view:ee.view,label:`${xc[ee.view]} ${he}`,current:ce&&Me&&D.get(`${ee.view}:${ee.hash}`)===ee,restore:R&&!Me&&!vw(e,ee.view)?{view:ee.view,hash:ee.hash}:void 0}},W=new Set,K=new Map(C.map(ee=>{const Q=M.find(he=>!W.has(he)&&he.how==="drawn"&&he.view===ee.view&&he.ask===ee.text&&he.at>=ee.at);return Q&&W.add(Q),[ee,Q]})),F=new Map;for(const ee of j)ee.what==="use"&&!F.has(ee.view)&&F.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 ${En[ee]}. Use it, or keep the previous one.`,O=ee=>{const Q=ee===F.get(ee.view),he=ee.view==="portrait"&&Q,Me=ee.what==="again"?"Try again":ee.what==="keep"?"Keep previous":he?"Use this person":ee.view==="portrait"?"Use this":"Use it";return[{kind:"scenri",id:`asked-decided-${ee.at}`,text:he?qn.identity(p):Q?qn.landed(En[ee.view]):_(ee.view),quiet:!0},{kind:"you",id:`decided-${ee.at}`,text:Me,editable:!1}]},Y=()=>{const ee=P?C.slice(0,-1):C,Q=Ple(e),he=r.filter(ke=>!i.has(ke)&&(ke.q!==a||ke.at<=Q));for(const ke of he)i.add(ke);const Me=M.find(ke=>$N.includes(ke.view)),ce=[...ee.map(ke=>{const Be=K.get(ke);return{at:ke.at,turns:[{kind:"scenri",id:`asked-ask-${ke.at}`,text:T(ke.view),quiet:!0},{kind:"you",id:`ask-${ke.at}`,text:ke.text,editable:!1},...Be?[V(Be,`redrew-${ke.at}`)]:[]]}}),...M.filter(ke=>!W.has(ke)).map(ke=>({at:ke.at,turns:[V(ke,`result-${ke.at}`)]})),...j.map(ke=>({at:ke.at,turns:O(ke)})),...he.map(ke=>({at:ke.at,turns:mi(ke)})),...si(e)&&(e.extras||t.extrasDeclined)?[{at:Me?Me.at.slice(0,-1):"~",turns:[{kind:"scenri",id:"asked-extras",text:qn.extras,quiet:!0},{kind:"you",id:"extras",text:e.extras?"Add them":"Not now",editable:!1}]}]:[]];ce.sort((ke,Be)=>ke.at<Be.at?-1:ke.at>Be.at?1:0);for(const ke of ce)l.push(...ke.turns)},z=()=>{!P||!E||(l.push({kind:"scenri",id:`asked-ask-${E.at}`,text:T(E.view),quiet:!0}),l.push({kind:"you",id:`ask-${E.at}`,text:E.text,editable:!1}))};if(!si(e)){const ee=k.status==="generating"||S==="portrait"&&k.status!=="candidate";return ee&&!C.length?(u("drawing-face","Drawing their face."),h?m():g(),l):(m(),Y(),ee?(z(),u("drawing-face",P?"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(Rh("portrait",k.error)),l):(k.status==="candidate"&&(y(),z(),f({id:"identity",kind:"confirm",prompt:P?"Adjusted. Use this person, or try again.":qn.identity(p),hint:HS("portrait",e.keepItems),options:[{id:"use",label:"Use this person"},{id:"again",label:"Try again"}],describe:"Change something"})),l))}m(),Y();const X=Object.keys(e.views),Z=ri(e),J=[...Z].reverse().find(ee=>n4.has(ee)),me=Z.find(ee=>!n4.has(ee)),ne=X.find(ee=>e.views[ee].status==="candidate"),fe=Z.find(ee=>!!e.views[ee].error);if(t.failed&&!S)return y(),f(w(t.failed,_4(Pm(e)))),l;if(S)return z(),u(`drawing-${S}`,P&&(E==null?void 0:E.view)===S?`Redrawing the ${En[S]}.`:S===J&&!e.views[S].hash?`Drawing the ${En[S]} from this face.`:S===me&&!e.views[S].hash&&J?`Building the rest of the set from the ${En[J]}.`:`Drawing the ${En[S]}.`),h||g(),l;if(ne){y(),z();const ee=e.views[ne],Q=!!ee.prior,he=ce=>ce?L.get(`${ne}:${ce}`)??0:0,Me=!!ee.hash&&!!ee.prior&&he(ee.hash)<he(ee.prior);if(ee.error){const ce=Rh(ne,ee.error);u(`failed-${ne}`,ce.prompt,ee.error==="cancelled"?void 0:"alert")}return ee.hash&&l.push({kind:"scenri",id:`candidate-${ne}-${ee.hash}`,text:Me?`Here is ${En[ne]} ${he(ee.hash)} again.`:ee.error?`Here is the ${En[ne]} as it is.`:Q?ne==="portrait"?`Here is ${p} with the change.`:`Redrew the ${En[ne]}.`:`Here is the ${En[ne]}.`,thumb:ee.hash,label:xc[ne],view:ne,current:!0}),f({id:ne==="portrait"?"revision":"view-revision",kind:"confirm",prompt:Q?ne==="portrait"?`Use this, or keep the previous one.${BY(e,ne)?" Using it redraws the views built on the face.":""}`:"Use it, or keep the previous one.":"Use it, or try again.",hint:ne==="portrait"||ne==="front"?HS(ne,e.keepItems):void 0,options:[{id:"use",label:ne==="portrait"?"Use this":"Use it"},...Q?[{id:"keep",label:"Keep previous"}]:[],{id:"again",label:"Try again"}]}),l}return fe?(y(),z(),f(Rh(fe,e.views[fe].error??"")),l):jY(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:qn.extras,noEnter:!0,options:[{id:"add",label:"Add them"},{id:"save",label:"Not now"}]}),l):h?(f({id:"save",kind:"confirm",prompt:`${Lle(p)} is ready.${Rle(e)}`,options:[{id:"save",label:"Save presenter"}]}),l):(g(),l):(h||g(),l)}const Tle={who:{label:"Who",options:AL},age:{label:"Age",options:NL},build:{label:"Build",options:["slender","average","athletic","fuller"].map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1)}))}},Vp=e=>e.charAt(0).toUpperCase()+e.slice(1);function Dle(e){return!e||e==="skipped"?"Draw as is":Object.values(e).map(t=>Vp(t)).join(", ")}function Hle(e){const t=e.map(n=>{var r;return((r=Ra(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 Ole=e=>Yte(e,DL,fle),FL=(e,t)=>e.trim().slice(0,t).trimEnd(),Ile=BR;function a1(e){return FL(Fle(e),Ile)}function Fle(e){var a;if(((a=e.source)==null?void 0:a.via)==="taps"){const i=bL(e),l=jc(i.who);return ML(l&&!ha(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 FY({steer:n.who??null,age:n.age??null},r)}function _le(e){return c2(e).map(t=>t.words)}const Vle=ld,Zle=12;function c2(e){var i,l;const t=Hie(e),n=(u,f,h)=>({id:u,words:FL(f,Vle),...h!=null&&h.length?{refs:h.slice(0,4)}:{}}),r=[];for(const u of xL(e.traits??[])){const f=t[u],h=f?Eie(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,Zle)}function ZS(e){const t=_le(e);return t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function zle(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 Ble(e,t,n,r){const a=r.toLowerCase().split(/[^a-z0-9]+/).filter(l=>l.length>2);if(!a.length)return!0;const i=a1({...e,[t]:n}).toLowerCase();return a.every(l=>i.includes(l))}function Ule(e){const t=_p(e.setup??null);return t&&Object.keys(t.answers).length?{answers:t.answers,asides:t.asides,...t.extrasDeclined?{extrasDeclined:t.extrasDeclined}:{}}:{answers:Wle(e),asides:[]}}function Wle(e){const t=_p(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},...zS(e)}:{source:{door:"scratch",via:"typed"},describe:e.direction??"",gaps:"skipped",traits:[],...zS(e)}}function zS(e){const t=e.keepItems??[];if(!t.length)return{};const n={},r=[];let a;for(const i of t){const l=jd.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 _L=(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 Kle(e,t,n){var a,i;if(e==="source")return t.kind==="choice"?{source:{door:t.id,via:"taps"}}:null;if(ur(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:Cc,...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:jd.map(l=>l.id).filter(l=>t.picks[l])}:t.kind==="skip"?{traits:[]}:null;const r=cs(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 Gle(e,t){var r;return`the ${((r=Ra(e))==null?void 0:r.label.toLowerCase())??"detail"} in the attached ${t===1?"picture":"pictures"}`}const BS="A scar, a ring, anything we missed",Yle=new Set(["describe","keep"]),qle=new Set(["likeness","help","question","greeting","ack","nav","intent","go","nonsense"]);function US(e,t){const n=(t==null?void 0:t.trim())??"";return e?n?`${e}, ${n}`:e:Vp(n)}const Xle=/^(?:but|and|though|although|only|just|except(?: that)?|with|without|plus)\s+/i,WS=e=>Xle.test(e.trim());function J8(e){return e.trim().replace(/[.\s]+$/,"").replace(/^(?:but|and|though|although|only|just|except(?: that)?)\s+/i,"").trim()}function vf(e,t){if(!e)return!1;if(Yle.has(e))return!0;if(!ur(e)&&!cs(e))return!1;const n=t[e];return!!n&&!n.pick&&!!n.words}function Ph(e,t,n){const r=t.trim();return r?e==="look-age"&&$Y(r)?null:e!=="look-who"&&(ur(e)||e.startsWith("trait-"))&&RY(r)?"nonsense":ur(e)||e.startsWith("trait-")||e==="keep"?Jle(r,n):e==="describe"||e==="source"?Qo(r,n):null:"vague"}function e6(e,t,n){if(e&&ur(e))return"look";if(e==="keep"||e!=null&&e.startsWith("trait-"))return"detail";const r=e??t;if(r&&ur(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 KS=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"]),Qle=/^[a-z]{1,10}\d+$/i,Jle=(e,t)=>{const n=e.trim(),r=n.toLowerCase().replace(/[^a-z ]/g,"");if(KS.has(r)||KS.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=>Qle.test(l)))return"nonsense";const i=Qo(e,t);return i&&qle.has(i)?i:null};function ece(e,t){return e==="name"?"metadata":t?e==="source"||e==="photos"?"start-over":"redraw":"plain"}function GS(e,t,n,r){var f,h,p,m,g,w,y,b,k;const a=t.answers,i=r?{reopened:!0,cost:Sle(yL(a,n).filter(S=>S!=="keep"&&mf(S)>mf(e)).length)}:{};switch(e){case"source":return{id:e,kind:"choice",prompt:qn.source,options:DL,given:(f=a.source)==null?void 0:f.door,...i};case"weakphotos":return{id:e,kind:"confirm",prompt:qn.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:qn.photos,hint:xle(S.hashes.length,D0),hashes:S.hashes,max:D0,busy:t.uploading>0,attest:{text:HL(n.engine),checked:S.attested},submit:"Continue",back:"Describe someone instead"}}case"describe":return{id:e,kind:"text",prompt:qn.describe,starters:hle};case"gaps":{const S=xy(a.describe??"");return{id:e,kind:"choice",prompt:OL(S.length),groups:S.map(C=>({id:C,...Tle[C]})),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?qn.traitsPhotos:qn.traits,multi:!0,options:jd.map(C=>({id:C.id,label:C.label})),submit:"Continue",skip:S?"Nothing to add":"Nothing else",given:a.traits,...i}}case"keep":return{id:e,kind:"text",prompt:qn.keep}}if(ur(e)){const S=e.slice(5),{row:C,prompt:E}=s1[S],A=qie((p=a["look-who"])==null?void 0:p.pick),P=Xie.has(S)?{...C,options:C.options.map(T=>T.card?{...T,card:`${T.card}-${A}`}:T)}:C;return{id:e,kind:"swatches",prompt:E,hint:S==="who"?qn.lookHint:void 0,row:P,skip:"Skip",describe:S==="who"?"Describe them instead":void 0,saying:t.saying===e,given:((m=a[e])==null?void 0:m.pick)===Cc||(g=a[e])==null?void 0:g.pick,skipped:((w=a[e])==null?void 0:w.pick)===Cc,note:(y=a[e])==null?void 0:y.words,...i}}const l=cs(e),u=l?Ra(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(C=>({id:C.id,label:C.label,card:C.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 t6(e,t){var a,i,l;switch(e){case"source":return qn.source;case"photos":return qn.photos;case"describe":return((a=t.source)==null?void 0:a.via)==="typed"?qn.source:qn.describe;case"gaps":return OL(xy(t.describe??"").length);case"traits":return((i=t.source)==null?void 0:i.door)==="photos"?qn.traitsPhotos:qn.traits;case"keep":return qn.keep}if(ur(e))return s1[e.slice(5)].prompt;const n=cs(e),r=n?Ra(n.id):void 0;return!n||!r?"":n.part==="where"?((l=r.where)==null?void 0:l.ask)??"":r.ask}function YS(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:ble(y.length),photos:y}}case"describe":return{text:(t.describe??"").trim()};case"gaps":return{text:Dle(t.gaps)};case"traits":return{text:Hle(xL(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(ur(e)){const y=e.slice(5);return{text:ele(s1[y].row,t[e]??{})}}const r=cs(e),a=r?Ra(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)??Vp(y.pick):"";return{text:US(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)??Vp(i.pick):"";return{text:US(l,i==null?void 0:i.words),photos:i!=null&&i.refs.length?i.refs:void 0}}function tce(e){const t=e.state.asides,n=t.length?DR(qS(e,[],null)):null;return qS(e,t,n)}const VL=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,Zp=(e,t)=>gf(e.editing)&&nle(e.editing)===t.at;function qS(e,t,n){const r=new Set,a=nce(e,t,n,r),i=a.length&&a[a.length-1].kind==="question"?a.pop():null,l=t.filter(f=>!r.has(f)).sort(VL),u=e.state.unsure;for(const f of l)(!u||f.at<u.at)&&a.push(...mi(f,Zp(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:kle,options:[{id:"use",label:"Use it anyway"}]}});for(const f of l)f.at>=u.at&&a.push(...mi(f,Zp(e.state,f)))}return a}function nce({state:e,draft:t,canGenerate:n,engine:r,failed:a,failedView:i,awaiting:l},u,f,h){var R,L,H,D,B,V;const p=_L(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=(W,K,F=!1)=>{const _=u.filter(O=>!h.has(O)&&!!O.q&&O.q!==f&&K.includes(O.q)&&!!O.after===F).sort(VL);for(const O of _)h.add(O),W.push(...mi(O,Zp(e,O)))},k=W=>u.find(K=>K.edit&&K.q===W&&!h.has(K)),S=(W,K,F=!0)=>{var O;if(W.push({kind:"scenri",id:`asked-${K}`,text:t6(K,m),quiet:!0}),b(W,K==="describe"&&((O=m.source)==null?void 0:O.via)==="typed"?["source","describe"]:[K]),!F){const Y=k(K);Y&&(h.add(Y),W.push({kind:"you",id:K,text:Y.said}),W.push(...mi(Y,Zp(e,Y),!0))),b(W,[K],!0);return}const _=YS(K,m,t);W.push({kind:"you",id:K,text:_.text,photos:_.photos,editable:!0,editing:e.editing===K&&vf(K,m)||void 0}),b(W,[K],!0)},C=new Set(yL(m,p)),E=Tie.filter(W=>C.has(W)||u.some(K=>K.edit&&K.q===W));for(const W of E){const K=y&&t&&W!=="source"&&W!=="photos"?w:g;if(e.editing===W&&!vf(W,m)){K.push({kind:"scenri",id:`asked-${W}`,text:t6(W,m),quiet:!0}),b(K,[W]),K.push({kind:"question",question:GS(W,e,p,!0)}),b(K,[W],!0);continue}W==="source"&&((L=m.source)==null?void 0:L.via)==="typed"||S(K,W,C.has(W))}let A=null;const P=((H=m.source)==null?void 0:H.door)==="photos"&&e.held&&!t,T=!n&&(t?!!mw(t):((D=m.source)==null?void 0:D.door)==="scratch"||P)&&!(t&&e.editing);if(P&&!n&&((B=m.photos)!=null&&B.hashes.length)&&(g.push({kind:"scenri",id:"asked-photos",text:t6("photos",m),quiet:!0}),g.push({kind:"you",id:"photos",...YS("photos",m,null)})),T)A={id:"noengine",kind:"confirm",quiet:!0,prompt:qn.noEngine,options:[{id:"setup",label:"Set up"},...P?[{id:"change",label:"Change photos"}]:[]]};else{const W=i2(m,p);W?A=GS(W,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:qn.agree,quote:m.source.via==="taps"?`${tle(bL(m))}${ZS(m)?`, and always ${ZS(m)}`:""}.`:a1(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=$le({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(W=>W.kind!=="question"):M];return A&&j.push({kind:"question",question:A}),j}function ZL(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question;if(!jp(n))return null}return null}function rce(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 ${TL(t.source)}`:t!=null&&t.activeView?"Drawing":n}const Wo={placeholder:"Nothing to type yet",label:"Message",action:"Send"},XS=(e,t)=>({placeholder:t?Yie[e]??"In your words":IS.has(e)?"Tap a swatch above, or say the colour":"Pick one above, or describe it",label:"Describe it",action:"Send",color:IS.has(e)});function QS(e,t){const n=cs(e),r=n?Ra(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 zL(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)&&!ha(r)}function sce(e,t,n,r){const a=ace(e,t,n,r);return a.action==="Refine"&&!a.off&&zL(t.text,n,(e==null?void 0:e.id)??null)?{...a,label:"Their name",action:"Send"}:a}function ace(e,t,n,r){if(t.editing!==null&&(t.editing==="name"||gf(t.editing)||vf(t.editing,t.answers)))return{...Wo,off:"Finish the change above."};if(t.saying==="keep")return{placeholder:BS,label:"What should stay the same about them",action:"Send"};if(t.saying&&ur(t.saying))return XS(t.saying.slice(5),!0);if(t.saying)return QS(t.saying,!0);if(t.editing!==null)return{...Wo,off:"Finish the change above."};if(e){if(ur(e.id))return XS(e.id.slice(5),!1);if(e.id.startsWith("trait-"))return QS(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:BS,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{...Wo,off:"Add their photos above."};case"noengine":return{...Wo,off:"Set up image generation above."};case"retry":return{...Wo,off:"Retry above."}}}return n?n.stage==="analyzing"?{...Wo,off:`Reading ${n.source==="photos"?"the photos":"the face"}.`}:kc(n)?si(n)?{placeholder:JS(r,n),label:"What should change",action:"Refine",off:""}:{...Wo,off:""}:si(n)?{placeholder:JS(r,n),label:"What should change",action:"Refine"}:{...Wo,off:"The face comes first."}:{...Wo,off:"Starting the draft."}}function JS(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: ${En[e]}`}function e9(e,t){return e.saying?e.saying:t&&Ys(t.id)&&(t.id==="source"||t.id==="describe")||t&&Ys(t.id)&&(ur(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 oce=/\b(here|in this (view|one|picture|image|frame)|this (view|one|picture|image|frame))\b/i,ice=/\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,lce=/\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,cce=/\b(simpler|plainer|plain|neutral|cleaner|tidier)\b/i,uce=/\b(outfit|clothes|clothing|top|wardrobe|wearing)\b/i;function BL(e,t,n){const r=e.trim();if(!r)return{blocked:"Say what should change."};if(lce.test(r)&&!(cce.test(r)&&uce.test(r)))return{scope:"out-of-scope"};const a=IN.test(r),i=ice.test(r),l=oce.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 ${En[t]} yet.`}:{scope:"view",view:t}}const UL=e=>`Use Create for wardrobe, products and scenes. Edits here change who ${e} is.`;function dce(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=BL(a,t,n);return"blocked"in l?{chip:null,hint:l.blocked,tone:"alert"}:l.scope==="out-of-scope"?{chip:null,hint:UL(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 ${En[l.view]}`},hint:"Changes this view only. Hair, skin, age or build change the person."}}const fce=e=>e.replace(/^asset:/,"");function Ay(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??"",fce(i.file)]));for(const i of ri(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 t9(e,t){var n,r;return!Ay(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 n9=(e,t)=>t==="cancelled"?{text:`Stopped drawing the ${En[e]}. Nothing finished was touched.`,stopped:!0}:{...l2(`The ${En[e]} could not be drawn`,t,jy(e)),stopped:!1},hce=e=>CY.filter(t=>e.views[t].status==="empty"&&t!=="portrait"),pce=e=>e.length<=2?e.map(t=>En[t]).join(" and "):`${e.slice(0,-1).map(t=>En[t]).join(", ")} and ${En[e[e.length-1]]}`,mce={building:!1,buildDeclined:!1,scopeAsk:null,failed:null,conflict:null},gce="Say what should change: hair, age or build change the person; anything else changes the view on the stage.",vce="Still here. Select a view and say what is wrong with it, or say what should change about them.";function wce(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?vce:gce}}const rc={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 yce(e){const t=e.ui.asides??[],n=t.length?DR(r9(e,[],null)):null;return r9(e,t,n)}function r9({draft:e,base:t,name:n,selected:r,canGenerate:a,ui:i},l,u){var ee;const f=[{kind:"scenri",id:"opening",text:rc.opening(n)}],h=new Set,p=()=>{for(const Q of l)h.has(Q)||f.push(...mi(Q));return f},m=(Q,he,Me)=>{Me&&f.push({kind:"scenri",id:`asked-${Q}`,text:Me}),f.push({kind:"you",id:Q,text:he,editable:!1})},g=(Q,he,Me)=>f.push({kind:"scenri",id:Q,text:he,tone:Me}),w=Q=>f.push({kind:"question",question:Q});if(!e)return p();const y=hce(e),b=e.source!=="synthetic"||!!((ee=e.direction)!=null&&ee.trim()),k=ri(e).some(Q=>e.views[Q].status==="candidate");if(y.length&&b&&!k&&!i.building&&!i.buildDeclined&&!kc(e)&&a){const Q=ri(e).filter(he=>e.views[he].status==="approved").length;return w({id:"legacy",kind:"confirm",prompt:`${n} has ${Q===1?"one reference":`${Q} references`}. Build the ${pce(y)} from it?`,options:[{id:"build",label:"Build them"},{id:"not",label:"Not now"}]}),p()}const S=ri(e),C=e.activeView,E=S.find(Q=>e.views[Q].status==="candidate"),A=S.find(Q=>!!e.views[Q].error),P=(t==null?void 0:t.identityEdits)??[];(e.identityEdits??[]).filter(Q=>!P.includes(Q)).forEach((Q,he)=>{m(`edit-${he}`,Q,rc.change),g(`changed-${he}`,`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,L=!!j&&!!R&&(R.status==="generating"&&e.activeView===j.view||R.status==="candidate"&&R.adjustment===j.text||!!R.error),H=new Set((e.identityEdits??[]).map(Q=>Q.toLowerCase())),D=(L?M.slice(0,-1):M).filter(Q=>!(Q.view==="portrait"&&H.has(Q.text.replace(/\s+/g," ").toLowerCase()))),B=[...M,...e.results??[],...e.decisions??[]].map(Q=>Q.at).reduce((Q,he)=>he>Q?he:Q,""),V=l.filter(Q=>!h.has(Q)&&(Q.q!==u||Q.at<=B));for(const Q of V)h.add(Q);const W=(e.results??[]).filter(Q=>Q.how!=="restored"),K=!e.activeView&&e.stage==="idle",F=new Map,_=new Map,O=new Map;for(const Q of W){const he=`${Q.view}:${Q.hash}`;if(O.set(he,Q),F.has(he))continue;const Me=(_.get(Q.view)??0)+1;_.set(Q.view,Me),F.set(he,Me)}const Y=Q=>F.get(`${Q.view}:${Q.hash}`)??1,z=(Q,he)=>{const Me=Y(Q),ce=e.views[Q.view].hash===Q.hash,ke=(_.get(Q.view)??0)>1;return{kind:"scenri",id:he,text:`Here is ${En[Q.view]} ${Me}.`,thumb:Q.hash,view:Q.view,label:`${xc[Q.view]} ${Me}`,current:ke&&ce&&O.get(`${Q.view}:${Q.hash}`)===Q,restore:K&&!ce?{view:Q.view,hash:Q.hash}:void 0}},X=new Set,Z=new Map(M.map(Q=>{const he=W.find(Me=>!X.has(Me)&&Me.how==="drawn"&&Me.view===Q.view&&Me.ask===Q.text&&Me.at>=Q.at);return he&&X.add(he),[Q,he]})),J=(e.decisions??[]).filter(Q=>!(Q.view==="portrait"&&Q.what==="use")),me=Q=>[{kind:"scenri",id:`asked-decided-${Q.at}`,text:Q.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 ${En[Q.view]}. Use it, or keep the previous one.`},{kind:"you",id:`decided-${Q.at}`,text:Q.what==="again"?"Try again":Q.what==="keep"?"Keep previous":"Use it",editable:!1}],ne=[...D.map(Q=>{const he=Z.get(Q);return{at:Q.at,turns:[{kind:"scenri",id:`asked-ask-${Q.at}`,text:rc.change},{kind:"you",id:`ask-${Q.at}`,text:Q.text,editable:!1},...he?[z(he,`redrew-${Q.at}`)]:[]]}}),...W.filter(Q=>!X.has(Q)).map(Q=>({at:Q.at,turns:[z(Q,`result-${Q.at}`)]})),...J.map(Q=>({at:Q.at,turns:me(Q)})),...V.map(Q=>({at:Q.at,turns:mi(Q)}))];ne.sort((Q,he)=>Q.at<he.at?-1:Q.at>he.at?1:0);for(const Q of ne)f.push(...Q.turns);if(i.scopeAsk)return m("scope-ask",i.scopeAsk.said),w({id:"scope",kind:"choice",prompt:rc.scope,options:[{id:"view",label:`This view (the ${En[r]})`},{id:"identity",label:"The presenter"}]}),p();const fe=()=>{L&&j&&m(`ask-${j.at}`,j.text,rc.change)};if(C){const Q=e.views[C];return fe(),g(`drawing-${C}`,L&&(j==null?void 0:j.view)===C?C==="portrait"?`Changing ${n}. Everything else stays.`:`Redrawing the ${En[C]}.`:Q.status==="stale"||S.some(he=>e.views[he].status==="stale")?`Redrawing the views built on the face. The ${En[C]} first.`:`Drawing the ${En[C]}.`),p()}if(E){fe();const Q=e.views[E];if(Q.error){const he=n9(E,Q.error);g(`failed-${E}`,he.text,he.stopped?void 0:"alert")}return Q.hash&&f.push({kind:"scenri",id:`candidate-${E}-${Q.hash}`,text:Q.error?`Here is the ${En[E]} as it is.`:E==="portrait"?`Here is ${n} with the change.`:`Redrew the ${En[E]}.`,thumb:Q.hash,label:xc[E],view:E,current:!0}),w({id:E==="portrait"?"revision":"view-revision",kind:"confirm",prompt:E==="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:E==="portrait"?"Use this":"Use it"},{id:"keep",label:"Keep previous"},{id:"again",label:"Try again"}]}),p()}if(i.failed||A){fe();const Q=A?n9(A,e.views[A].error??""):{...l2("That did not go through",i.failed??""),stopped:!1};return w({id:"retry",kind:"confirm",...Q.stopped?{quiet:!0}:{tone:"alert"},prompt:Q.text,options:[...Q.remedy?[{id:`remedy:${Q.remedy.opens}`,label:Q.remedy.label}]:[],{id:"retry",label:Q.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(Q=>e.views[Q].status==="stale");return re?(g(`drawing-${re}`,`Redrawing the views built on the face. The ${En[re]} first.`),p()):(t&&Ay(e,t)&&w({id:"save",kind:"confirm",prompt:`The set is coherent. ${rc.saved}`,options:[{id:"save",label:"Save changes"}]}),p())}function bce(e,t,n){return!(!n||t.id!==n||e&&e.id===t.id&&t.updatedAt<e.updatedAt)}function WL(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}=ea(),w=s.useRef(!0);s.useEffect(()=>(w.current=!0,()=>{w.current=!1}),[]);const y=s.useRef(t);y.current=t;const b=s.useCallback(K=>{w.current&&r(F=>bce(F,K,y.current)?K:F)},[]),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 K=t;try{b(await Ne.presenterDraft(e,K)),k.current&&w.current&&y.current===K&&(k.current=!1,u(null))}catch(F){if(!w.current||y.current!==K)return;/HTTP 404|not found/i.test(String((F==null?void 0:F.message)??F))?i(!0):(k.current=!0,h(null),u(String((F==null?void 0:F.message)??F)))}},[e,t,b]);s.useEffect(()=>{S()},[S]);const C=!!n&&(n.stage!=="idle"||!!n.activeView);s.useEffect(()=>{if(!C)return;const K=setInterval(()=>void S(),1500);return()=>clearInterval(K)},[C,S]);const E=s.useCallback(async(K,F=null)=>{const _=y.current;m(!0),u(null),k.current=!1;try{return b(await K()),g(),!0}catch(O){return!w.current||y.current!==_?!1:(O==null?void 0:O.status)===409?(S(),!1):(k.current=!1,h(F),u(String((O==null?void 0:O.message)??O)),!1)}finally{w.current&&m(!1)}},[b,S,g]),A=s.useCallback((K,F,_)=>E(async()=>(await Ne.generateDraftView(e,t??"",K,{...F?{adjustment:F}:{},..._?{decide:_}:{}})).draft,K),[E,e,t]),P=s.useCallback(K=>E(()=>Ne.approveDraftView(e,t??"",K)),[E,e,t]),T=s.useCallback(K=>E(()=>Ne.redoDraftView(e,t??"",K)),[E,e,t]),M=s.useRef(!1),j=s.useCallback(async K=>{if(M.current)return!1;M.current=!0;try{return await E(K)}finally{M.current=!1}},[E]),R=s.useCallback(K=>j(()=>Ne.revertDraftView(e,t??"",K)),[j,e,t]),[L,H]=s.useState(!1),D=s.useCallback(async()=>{H(!0);try{return await E(()=>Ne.stopDraft(e,t??""))}finally{w.current&&H(!1)}},[E,e,t]),B=s.useCallback((K,F)=>j(()=>Ne.restoreDraftView(e,t??"",K,F)),[j,e,t]),V=s.useCallback(K=>E(()=>Ne.updatePresenterDraft(e,t??"",K)),[E,e,t]),W=s.useCallback(()=>{k.current=!1,u(null)},[]);return{draft:n,gone:a,err:l,errView:f,busy:p,drawing:C,reload:S,generate:A,approve:P,redo:T,revert:R,stop:D,stopping:L,restore:B,update:V,clearErr:W}}function xce({presenterId:e,onLeave:t,caps:n}){var Ze,oe;const{brand:r}=un(),{applyBrand:a,refreshBrands:i}=Dn(),l=Rl(),u=Ml(),f=Er("setup").value,h=Er("settings").value,p=!!f||!!h,m=!!(n!=null&&n.canGenerate),[g,w]=s.useState(null),[y,b]=s.useState(null),[k,S]=s.useState(mce),[C,E]=s.useState(""),[A,P]=s.useState(null),[T,M]=s.useState(!1),[j,R]=s.useState(null),[L,H]=s.useState(!1),[D,B]=s.useState(!1),V=s.useRef(new Set),W=(((Ze=r.json)==null?void 0:Ze.characters)??[]).find(q=>q.id===e),K=((oe=W==null?void 0:W.name)==null?void 0:oe.trim())||"them",F=W?{shots:W.shots??[],identityEdits:W.identityEdits??[]}:null;s.useEffect(()=>{let q=!0;return w(null),b(null),Ne.editPresenter(r.id,e).then(ae=>{q&&w(ae.id)}).catch(ae=>{q&&b(String((ae==null?void 0:ae.message)??ae))}),()=>{q=!1}},[r.id,e]);const _=WL(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 q=mw(O);if(!q||O.views[q].status==="empty"&&!k.building)return;const ae=`${q}:${O.views[q].attempts}:${O.generations}:${O.views[q].status}`;V.current.has(ae)||(V.current.add(ae),_.generate(q,void 0,Go(q)))},[O,_.busy,_.generate,m,_.err,k.building]);const X=O?DN(O,A):"portrait",Z=O?O.views[X]:null,J=!!O&&(O.activeView===X||O.stage==="analyzing"),me=!!O&&!O.activeView&&O.stage==="idle",ne=_.err&&O&&!O.activeView?_.err:null,fe=s.useMemo(()=>yce({draft:O,base:F,name:K,selected:X,canGenerate:m,ui:{...k,failed:ne}}),[O,F,K,X,m,k,ne]),re=ZL(fe),ee=!!O&&!!F&&Ay(O,F),Q=!!O&&!!F&&t9(O,F),he=s.useCallback(q=>{Y&&el(Y),t(q)},[Y,t]),Me=s.useCallback(async()=>{if(!(!O||L)){H(!0),R(null);try{const q=await Ne.savePresenterDraft(r.id,O.id);he(q.presenter.id),a(q.brand)}catch(q){H(!1);const ae=String((q==null?void 0:q.message)??q);/changed elsewhere|HTTP 409/i.test(ae)?S(Le=>({...Le,conflict:ae})):R(ae)}}},[O,L,r.id,a,he]),ce=s.useCallback(async()=>{B(!0);try{O&&await Ne.deletePresenterDraft(r.id,O.id)}catch{}he(e)},[O,r.id,e,he]),ke=s.useCallback(async()=>{if(!(!O||!F)){B(!0);try{t9(await Ne.presenterDraft(r.id,O.id),F)&&await Ne.deletePresenterDraft(r.id,O.id)}catch{}he(e)}},[O,F,r.id,e,he]),Be=s.useCallback(async()=>{B(!0);try{const q=await Ne.revertPresenter(r.id,e);O&&await Ne.deletePresenterDraft(r.id,O.id).catch(()=>{}),he(q.presenter.id),a(q.brand)}catch(q){B(!1),R(String((q==null?void 0:q.message)??q))}},[r.id,e,O,a,he]),ft=s.useCallback((q,ae)=>{var Le;if(R(null),!!O)switch(q){case"legacy":if(ae.kind!=="confirm")return;S(Ie=>({...Ie,building:ae.id==="build",buildDeclined:ae.id!=="build"}));return;case"scope":{if(ae.kind!=="choice")return;const Ie=((Le=k.scopeAsk)==null?void 0:Le.said)??"";S(Je=>({...Je,scopeAsk:null})),ae.id==="identity"?_.generate("portrait",Ie):_.generate(X,Ie,Go(X)),P(ae.id==="identity"?"portrait":X);return}case"revision":case"view-revision":{if(ae.kind!=="confirm")return;const Ie=Object.keys(O.views).find(Je=>O.views[Je].status==="candidate")??X;ae.id==="use"&&_.approve(Ie),ae.id==="keep"&&_.revert(Ie),ae.id==="again"&&_.generate(Ie,O.views[Ie].adjustment,Go(Ie)),M(!1);return}case"retry":{if(ae.kind==="confirm"&&ae.id.startsWith("remedy:")){const Je=ae.id.slice(7);Je==="setup"?l():u(Je);return}if(_.err){_.clearErr(),V.current=new Set;return}const Ie=Object.keys(O.views).find(Je=>!!O.views[Je].error);Ie&&_.generate(Ie,O.views[Ie].adjustment,Go(Ie));return}case"conflict":S(Ie=>({...Ie,conflict:null})),B(!0),Promise.all([i(),Ne.deletePresenterDraft(r.id,O.id).catch(()=>{})]).finally(()=>he(e));return;case"save":Me();return}},[O,k.scopeAsk,_,X,Me,i,he,e,r.id,l,u]),Ue=s.useCallback(q=>{const ae=q.trim();if(!ae||!O)return!1;R(null);const Le=(re==null?void 0:re.id)??null,Ie=Ap(),Je=(pt,St)=>({...pt,asides:[...pt.asides??[],{said:ae,reply:St,q:Le,at:Ie}]}),ge=pt=>pt.scopeAsk?{...pt,scopeAsk:null,asides:[...pt.asides??[],{said:pt.scopeAsk.said,reply:rc.scope,q:"scope",at:pt.scopeAsk.at}]}:pt,et=Qo(ae,ha);if(et&&et!=="vague")return S(pt=>Je(pt,wce(et,K,(pt.asides??[]).some(St=>St.q===Le)))),E(""),!0;if(!m)return R("Image generation is not set up, so nothing can be redrawn yet."),!1;const nt=BL(ae,X,O);return"blocked"in nt?(R(nt.blocked),!1):nt.scope==="out-of-scope"?(S(pt=>Je(ge(pt),UL(K))),E(""),!0):nt.scope==="ambiguous"?(S(pt=>({...ge(pt),scopeAsk:{said:ae,at:Ie}})),E(""),!0):(S(pt=>ge(pt)),P(nt.view),M(!1),_.generate(nt.view,ae,nt.scope==="view"?Go(nt.view):void 0),E(""),!0)},[O,m,X,_,re==null?void 0:re.id,K]),Qe=O?dce(C,X,O,K):null,Pe=Qe?{chip:Qe.chip?{label:Qe.chip.label,thumb:O!=null&&O.views[Qe.chip.view].hash?gn(O.views[Qe.chip.view].hash,"micro"):void 0}:null,hint:Qe.hint,tone:Qe.tone}:null,G=T&&(Z!=null&&Z.prior)?Z.prior:Z==null?void 0:Z.hash,se=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:W,name:K,view:X,slot:Z,dirty:ee,saving:L,leaving:D,openErr:y,canRevert:!!(W!=null&&W.revisionOf),discard:ce,revert:Be,closeUntouched:Q?()=>void ke():null,keepPrevious:Z&&Z.status==="approved"&&Z.prior&&!J&&!(O!=null&&O.activeView)&&(O==null?void 0:O.stage)==="idle"?()=>void _.revert(X):null,surface:{title:"Edit presenter",memoryKey:Y,resumed:z,turns:fe,busy:_.busy||L||D||p,stage:O?{hash:G,alt:`${xc[X]}${(Z==null?void 0:Z.status)==="candidate"?", candidate":""}`,drawing:J,since:_N(O),doing:VN(O),takes:vw(O,X)?[]:zN(O,X),onTake:me?q=>{_.busy||_.restore(X,q)}:void 0,items:HN(O,X),onPick:q=>{P(q),M(!1)},compare:Z&&Z.status==="candidate"&&Z.prior?{on:T,toggle:()=>M(q=>!q)}:void 0}:null,composer:We?{placeholder:X==="portrait"?`What should change about ${K}?`:`Change this view: ${En[X]}`,label:"What should change",action:"Refine",scope:se?null:Pe,hint:null,why:se??void 0,error:j,disabled:_.busy||L||D||!!se,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:C,onText:E,onSend:Ue,onAnswer:ft,onRestore:(q,ae)=>{_.busy||(P(q),_.restore(q,ae))}},setupNeeded:m?null:l}}function kce({onClose:e,...t}){const n=xce(t),r=o.jsxs(o.Fragment,{children:[n.canRevert&&o.jsx(Qn,{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(Qn,{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 ",En[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(by,{surface:{...n.surface,headAction:r,dock:a},onClose:n.closeUntouched??e})}function Sce(){const{presenterId:e=""}=Qs(),{brand:t}=un(),n=Bn(),{caps:r}=Lw();Ic("Edit presenter");const a=s.useRef(!1);s.useEffect(()=>(a.current=!0,()=>{a.current=!1}),[]);const[i]=s.useState(()=>Aw(t,e)),l=s.useCallback(f=>{a.current&&n(Ea(t,f),{replace:!0})},[n,t]),u=s.useCallback(()=>n(Ea(t,e),{replace:!0}),[n,t,e]);return i!==e?o.jsx(Ka,{to:Am(t,i),replace:!0}):o.jsx(kce,{presenterId:e,onLeave:l,onClose:u,caps:r})}function Ece(e,t){return(t.source!=="synthetic"||(t.direction??"")===a1(e.answers))&&Cce(t.keepItems,c2(e.answers))}function Cce(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 jce(e,t){return{...t.source==="synthetic"?{direction:a1(e.answers)}:{},keepItems:c2(e.answers)}}const Ace=e=>e.source==="photos"?e.views.front.hash?"front":null:e.views.portrait.hash?"portrait":null;function KL(e){if(!e.draftId)return!1;const t=e.draft;return t?e.seededFor!==t.id&&(!e.state.answers.source||!F4(e.state,e.ctx)):!0}function Nce(e){const{state:t,draft:n,ctx:r}=e;if(e.busy||e.err)return[];if(n){if(KL(e))return[{kind:"seed",...Ule(n)}];if(!F4(t,r))return[];const i=[];Ece(t,n)||i.push({kind:"sync",patch:jce(t,n),redo:Ace(n)});const l=e.canDraw?mw(n):null;return l&&i.push({kind:"draw",view:l,decide:Go(l)}),i}if(e.draftId)return[];if(!e.canDraw||!F4(t,r))return[];const a=t.answers.source;return(a==null?void 0:a.door)==="scratch"&&a.via!=="taps"&&!t.held?[{kind:"start"}]:[]}function Mce(e){for(const t of Nce(e))if(!e.done.has(GL(t,e)))return t;return null}function GL(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 yu=(e,t)=>`scenri:presenter-setup:${e}:${t}`,Ki={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 s9(e,t){let n=Ki.read("scenri:tab");return n||(n=[...crypto.getRandomValues(new Uint8Array(6))].map(r=>r.toString(16).padStart(2,"0")).join(""),Ki.write("scenri:tab",n)),`${n}:${e}:${t}`}function Rce(e,t){var r,a,i;const n=t==="keep"?"detail":((a=Ra(((r=cs(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 a9(e,t,n){const r=e.editing&&e.editing!=="name"?e.editing:e.saying??i2(e.answers,t);if(r==="keep"||!r&&n==="agree")return"keep";if(!r)return null;const a=cs(r);return a&&a.part==="what"?`trait-${a.id}`:null}function Pce({draftId:e,convoKey:t,onOpenDraft:n,onLeaveDraft:r,onStarted:a,caps:i}){var Rt,nn,Nt,Jt;const{brand:l}=un(),{presenterCategories:u,applyBrand:f}=Dn(),h=Rl(),p=Ml(),m=Er("setup").value,g=Er("settings").value,w=!!m||!!g,[y,b]=s.useState(!1);s.useEffect(()=>b(!1),[i]);const k=!!(i!=null&&i.canGenerate)&&!y,[S,C]=s.useReducer(ile,{brandId:l.id,convoKey:t},Ce=>{const _e=_p(Ki.read(yu(Ce.brandId,Ce.convoKey)));return _e?{...Fp,answers:_e.answers,revision:_e.revision,asides:_e.asides,extrasDeclined:!!_e.extrasDeclined,held:!!_e.held}:Fp}),E=s.useRef(S);E.current=S;const A=lle(S),P=Object.keys(S.answers).length>0||S.asides.length>0,T=s.useRef(t);s.useEffect(()=>{P?Ki.write(yu(l.id,t),A):Ki.remove(yu(l.id,t));const Ce=T.current;T.current=t,Ce!==t&&e&&t===e&&(Ki.remove(yu(l.id,Ce)),el(`presenter-create:${l.id}:${Ce}`))},[l.id,t,e,A,P]);const M=s.useRef(null);s.useEffect(()=>{if(!e||M.current===A)return;const Ce=setTimeout(()=>{M.current=A,Ne.updatePresenterDraft(l.id,e,{setup:A}).catch(()=>{M.current=null})},800);return()=>clearTimeout(Ce)},[l.id,e,A]);const[j,R]=s.useState(null),[L,H]=s.useState(!1),[D,B]=s.useState(null),[V,W]=s.useState([]),[K,F]=s.useState(!1),[_,O]=s.useState(null),[Y,z]=s.useState(!1),[X,Z]=s.useState(null),[J,me]=s.useState(null),[ne,fe]=s.useState(0),[re,ee]=s.useState([]),Q=s.useRef(new Map),[he]=s.useState(()=>!!e||!!_p(Ki.read(yu(l.id,t))));s.useEffect(()=>()=>{for(const Ce of Q.current.values())URL.revokeObjectURL(Ce)},[]);const Me=s.useRef(!1),ce=s.useRef(new Set),ke=s.useRef(!1),Be=s.useRef(null),ft=s.useRef(!1),Ue=s.useRef(!0);s.useEffect(()=>(Ue.current=!0,()=>{Ue.current=!1}),[]);const Qe=s.useRef(new Set),Pe=s.useRef(0),G=WL(l.id,e),se=G.draft,We=(i==null?void 0:i.engineName)??null,Ze=s.useMemo(()=>_L(se,k,We),[se,k,We]);s.useEffect(()=>{ce.current=new Set,Me.current=!1,W([]),M.current=null,e||(ft.current=!1)},[e]),s.useEffect(()=>{if(Me.current||!se)return;const Ce=_Y(se,V);Ce&&(Me.current=!0,W(Ce))},[se,V]),s.useEffect(()=>{G.gone&&r()},[G.gone,r]);const oe=s.useCallback(()=>{Ki.remove(yu(l.id,t)),el(`presenter-create:${l.id}:${t}`)},[l.id,t]),q=s.useCallback(Ce=>n(Ce,!0),[n]),ae=s.useCallback(Ce=>{if(!RN.test(Ce)){B(Ce);return}b(!0),C({type:"hold",held:!0})},[]),Le=s.useCallback(async()=>{const Ce=E.current;if(!k||Y)return;const _e=Ce.revision;C({type:"hold",held:!1}),z(!0),B(null);try{const tt=c2(Ce.answers),I=await Ne.createPresenterDraft(l.id,{source:"synthetic",direction:a1(Ce.answers),...tt.length?{keepItems:tt}:{},clientKey:s9(t,_e)});if(E.current.revision!==_e||!Ue.current){Ne.deletePresenterDraft(l.id,I.id).catch(()=>{});return}q(I.id)}catch(tt){ae(String((tt==null?void 0:tt.message)??tt))}finally{z(!1)}},[l.id,k,Y,q,t,ae]),Ie=s.useCallback(async()=>{const Ce=E.current,_e=Ce.answers.photos;if(!(_e!=null&&_e.hashes.length)||!_e.attested||Y)return;if(!k){C({type:"hold",held:!0});return}C({type:"hold",held:!1});const tt=Ce.revision;z(!0),B(null);try{const I=await Ne.createPresenterDraft(l.id,{source:"photos",imageHashes:_e.hashes,attestation:!0,clientKey:s9(t,tt)});if(E.current.revision!==tt||!Ue.current){Ne.deletePresenterDraft(l.id,I.id).catch(()=>{});return}q(I.id)}catch(I){ae(String((I==null?void 0:I.message)??I))}finally{z(!1)}},[l.id,k,Y,q,t,ae]),Je=s.useCallback(async Ce=>{B(null);const _e=()=>{var Ve;return((Ve=E.current.answers.photos)==null?void 0:Ve.hashes)??[]},tt=Ce.slice(0,Math.max(0,D0-_e().length-Pe.current));Pe.current+=tt.length;const I=[];let ue=0;C({type:"upload-begin"});try{for(const Ve of tt){if(Ve.size>h5){I.push(mle(Ve.name,h5));continue}try{const Re=await tf(Ve);_e().includes(Re)&&(ue+=1),C({type:"uploaded",hash:Re,max:D0})}catch{I.push(gle(Ve.name))}}}finally{Pe.current-=tt.length,C({type:"upload-end"})}const be=ple({over:Ce.length-tt.length,same:ue,failed:I,max:D0});be&&B(be)},[]),ge=s.useCallback(Ce=>{C({type:"answer",patch:Ce,ctx:Ze}),!k&&Ce.describe!==void 0&&C({type:"hold",held:!0})},[Ze,k]),et=s.useCallback(async Ce=>{const _e=Ce??se;if(!_e||K)return;const tt=VY(_e,_e.name);if(tt){O(tt);return}F(!0),O(null);try{await Ne.updatePresenterDraft(l.id,_e.id,{facets:V});const I=await Ne.savePresenterDraft(l.id,_e.id);f(I.brand),oe(),C({type:"start-over"}),a({kind:"presenter",id:I.presenter.id,name:I.presenter.name})}catch(I){F(!1),O(String((I==null?void 0:I.message)??I))}},[se,K,k,l.id,V,oe,a,f]),nt=s.useCallback(async()=>{const _e=E.current.answers.describe||(se==null?void 0:se.direction)||"";ft.current=!!e,oe(),C({type:"start-over",text:_e}),B(null),Z(null),me(null),ce.current=new Set,se&&!ON(se)&&await Ne.deletePresenterDraft(l.id,se.id).catch(()=>{}),r()},[se,e,l.id,oe,r]),pt=se?G.err&&!kc(se)?G.err:null:D,St=s.useMemo(()=>tce({state:S,draft:se,canGenerate:k,engine:We,failed:pt,failedView:G.errView,awaiting:KL({state:S,draft:se,ctx:Ze,draftId:e,seededFor:Be.current})}),[S,se,k,We,pt,G.errView,e,Ze]),at=ZL(St),_t=s.useRef(null);_t.current=(at==null?void 0:at.id)??null;const Lt=se?DN(se,j):"portrait",Zt=se?se.views[Lt]:null,Mt=!!se&&(se.activeView===Lt||se.stage==="analyzing"),$t=!!se&&!se.activeView&&se.stage==="idle",Se={state:S,draft:se,ctx:Ze,canDraw:k,busy:G.busy||Y||ke.current||ft.current||(se?kc(se):!1),err:!!G.err||!se&&!!D,draftId:e,seededFor:Be.current,done:ce.current},Ke=Mce(Se),kt=s.useRef(Ke);kt.current=Ke;const qe=Ke?GL(Ke,Se):"";s.useEffect(()=>{var _e;se&&Be.current!==se.id&&!Se.busy&&!Se.err&&((_e=kt.current)==null?void 0:_e.kind)!=="seed"&&(Be.current=se.id);const Ce=kt.current;if(!(!Ce||ce.current.has(qe)))switch(ce.current.add(qe),Ce.kind){case"seed":Be.current=(se==null?void 0:se.id)??null,C({type:"restore",answers:Ce.answers,revision:E.current.revision+1,asides:Ce.asides,extrasDeclined:Ce.extrasDeclined});return;case"start":Le();return;case"sync":ke.current=!0,(async()=>{if(!(await G.update(Ce.patch)||await G.update(Ce.patch))){ce.current.delete(qe);return}Ce.redo&&await G.redo(Ce.redo)})().finally(()=>{ke.current=!1});return;case"draw":G.generate(Ce.view,void 0,Ce.decide);return}},[qe,se,Le,G.update,G.redo,G.generate]);const ot=s.useCallback((Ce,_e,tt,I,ue=!1)=>{C({type:"aside",aside:{said:Ce,reply:_e,q:tt,at:Ap(),kind:I,...ue?{edit:!0}:{}}})},[]),rt=s.useCallback((Ce,_e)=>{B(null);const tt=E.current;if(Ys(Ce)){if(Ce==="weakphotos"&&_e.kind==="confirm"){_e.id==="again"&&nt(),_e.id==="anyway"&&ge({weakphotos:{pick:"anyway"}});return}const I=Kle(Ce,_e,tt.answers);if(I){const ue=tt.text.trim(),be=I[Ce],Ve=(ur(Ce)||!!cs(Ce))&&be&&typeof be=="object"&&!be.words;ge(Ve&&ue?{...I,[Ce]:{...be,words:J8(ue)}}:I);return}if(Ce==="photos"&&_e.kind==="photos"){const ue=_e.action;ue.type==="add"&&Je(ue.files),ue.type==="remove"&&C({type:"remove-photo",hash:ue.hash}),ue.type==="attest"&&C({type:"attest",checked:ue.checked}),ue.type==="reject"&&B("That was not an image. Drop a photo, or choose a file."),ue.type==="submit"&&Ie(),ue.type==="back"&&ge({source:{door:"scratch",via:"taps"}})}return}switch(Ce){case"unsure":{if(_e.kind!=="confirm"||_e.id!=="use"||!tt.unsure)return;const I=tt.unsure.said,ue=tt.unsure.q==="describe"?"describe":"source";C({type:"settle-unsure",ctx:Ze}),ge(ue==="describe"?{describe:I}:{source:{door:"scratch",via:"typed"},describe:I});return}case"noengine":_e.kind==="confirm"&&_e.id==="setup"&&h(),_e.kind==="confirm"&&_e.id==="change"&&C({type:"hold",held:!1});return;case"agree":{if(_e.kind!=="confirm")return;_e.id==="draw"&&Le();return}case"identity":if(_e.kind!=="confirm"||!se)return;_e.id==="use"&&(G.approve("portrait"),R(null)),_e.id==="again"&&G.generate("portrait");return;case"revision":case"view-revision":{if(_e.kind!=="confirm"||!se)return;const I=Ce==="revision"?"portrait":Object.keys(se.views).find(ue=>se.views[ue].status==="candidate")??Lt;_e.id==="use"&&G.approve(I),_e.id==="keep"&&G.revert(I),_e.id==="again"&&G.generate(I,se.views[I].adjustment,Go(I)),H(!1);return}case"retry":{if(_e.kind==="confirm"&&_e.id.startsWith("remedy:")){const ue=_e.id.slice(7);ue==="setup"?h():p(ue);return}if(_e.kind==="confirm"&&_e.id==="skip-extras"){G.clearErr(),G.update({extras:!1}),C({type:"extras-declined"});return}if(!se){ce.current=new Set,B(null);return}if(G.err){G.clearErr(),ce.current=new Set([...ce.current].filter(ue=>ue.startsWith("sync:")));return}const I=Object.keys(se.views).find(ue=>!!se.views[ue].error);I&&G.generate(I,se.views[I].adjustment,Go(I));return}case"extras":if(_e.kind!=="confirm")return;_e.id==="add"&&G.update({extras:!0}),_e.id==="save"&&C({type:"extras-declined"});return;case"save":et();return}},[ge,Je,Ie,Le,h,p,se,G,Lt,et]),tn=s.useCallback(Ce=>{var Kn,sn,ar,fs,Mn,_s,na,ra,so;const _e=Ce.trim(),tt=E.current,I=e9(tt,at),ue=I&&((Kn=tt.colour)==null?void 0:Kn.step)===I?tt.colour.hex:null,be=I&&ur(I)?I.slice(5):null,Ve=I==="keep"?(((sn=tt.answers.keep)==null?void 0:sn.refs)??[]).length:I!=null&&I.startsWith("trait-")?(((ar=tt.answers[I])==null?void 0:ar.refs)??[]).length:0,Re=_e||ue||"";if(!Re&&!Ve)return!1;if(B(null),I==="name"){const ln=Re.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||Re;return se&&G.update({name:ln.slice(0,60)}),C({type:"text",text:""}),!0}const bt=(ln,bn)=>tt.asides.filter(Wn=>Wn.q===ln&&Wn.kind===bn).length,Ot=(ln,bn=null)=>e6(ln,bn,!!(se!=null&&se.views.portrait.hash)),It=(ln,bn,Wn,fr)=>{const hr=Wn!==null&&tt.editing===Wn;hr&&ge({[Wn]:void 0}),ot(ln,bn,Wn,fr,hr)};if(I&&I!=="keep"&&I.startsWith("trait-")){const ln=cs(I);if(!ln)return!1;const bn=ln.part==="what"?((fs=tt.answers[I])==null?void 0:fs.refs)??[]:[];if(!_e&&bn.length)return ge({[I]:{pick:(Mn=tt.answers[I])==null?void 0:Mn.pick,words:Gle(ln.id,bn.length),refs:bn}}),!0;const Wn=Ph(I,_e,ha);if(!_e||Wn)return It(_e,Jl(Wn??"vague",Ot(I),bt(I,Wn??"vague"),_e,void 0,!0),I,Wn??"vague"),!0;const fr=WS(_e),hr=fr?J8(_e):_e;if(ln.part==="where"){const xn=tt.answers[I];ge({[I]:{pick:fr?xn==null?void 0:xn.pick:void 0,words:hr}})}else{const xn=tt.answers[I];ge({[I]:{pick:fr?xn==null?void 0:xn.pick:void 0,words:hr,refs:(xn==null?void 0:xn.refs)??[]}})}return!0}if(I==="keep"){const ln=tt.answers.keep,bn=(ln==null?void 0:ln.refs)??[],Wn=_e||(bn.length&&!(ln!=null&&ln.words)?"the detail in the attached picture":"");return Wn?(ge({keep:{words:[(_s=ln==null?void 0:ln.words)==null?void 0:_s.trim(),Wn].filter(Boolean).join(", "),refs:bn}}),!0):!1}if(I&&ur(I)&&be){const ln=_e&&!/^#[0-9a-f]{6}$/i.test(_e)?Ph(I,_e,ha):null;if(ln)return It(_e,Jl(ln,Ot(I),bt(I,ln),_e,be,!0),I,ln),!0;const bn=tt.answers[I],Wn=!_e||WS(_e),fr=ue??(Wn?bn==null?void 0:bn.pick:void 0),hr={pick:fr,words:_e?Wn?J8(_e):_e:bn==null?void 0:bn.words};if(_e&&!fr&&!Ble(tt.answers,I,hr,_e)){const xn=tt.answers.keep;return ge({keep:{words:[(na=xn==null?void 0:xn.words)==null?void 0:na.trim(),zle(_e)].filter(Boolean).join(", "),refs:(xn==null?void 0:xn.refs)??[]}}),!0}return ge({[I]:hr}),!0}const Dt=(at==null?void 0:at.id)??null,wn=Dt==="unsure"?((ra=tt.unsure)==null?void 0:ra.q)??"source":Dt;if(Dt==="traits"){const ln=Qo(Re,ha);if(ln)return ot(Re,Jl(ln,Ot(null,Dt),bt(Dt,ln),Re),Dt,ln),!0;const bn=tt.answers.keep;return ge({traits:[],keep:{words:[(so=bn==null?void 0:bn.words)==null?void 0:so.trim(),Re].filter(Boolean).join(", "),refs:(bn==null?void 0:bn.refs)??[]}}),!0}if(Dt==="gaps"){const ln=Qo(Re,ha);if(ln)return ot(Re,Jl(ln,Ot(null,Dt),bt(Dt,ln),Re),Dt,ln),!0;const bn=(tt.answers.describe??"").trim().replace(/[.\s]+$/,"");return ge({describe:bn?`${bn}, ${Re}`:Re}),!0}const Bt=Ot(null,wn),In=wn==="source"?Ole(Re):null,dn=In?null:Qo(Re,ha);if(dn&&(Bt==="source"||Bt==="describe"||dn!=="vague"))return ot(Re,Jl(dn,Bt,bt(Dt,dn),Re),Dt,dn),!0;if((wn==="source"||wn==="describe")&&!In&&!ha(Re))return C({type:"unsure",unsure:{said:Re,q:Dt,at:Ap()},ctx:Ze}),!0;if((wn==="source"||wn==="describe")&&C({type:"settle-unsure",ctx:Ze}),wn==="source")return In?(ge({source:{door:In,via:"taps"}}),!0):(ge({source:{door:"scratch",via:"typed"},describe:Re}),!0);if(wn==="describe")return ge({describe:Re}),!0;if(zL(Re,se,wn))return G.update({name:Re.slice(0,60)}),C({type:"text",text:""}),!0;if(wn==="name"){const ln=Re.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||Re;return se&&G.update({name:ln.slice(0,60)}),C({type:"text",text:""}),!0}if(!se)return!1;if(wn==="identity")return G.generate("portrait",Re),C({type:"text",text:""}),!0;const Nn=FN(Re,Lt,se);return"blocked"in Nn?(B(Nn.blocked),!1):(R(Nn.view),H(!1),G.generate(Nn.view,Re,Nn.scope==="view"?Go(Nn.view):void 0),C({type:"text",text:""}),!0)},[at,ge,ot,se,G,Lt]),Qt=s.useCallback(Ce=>{if(Ce==="name"){C({type:"edit",id:"name"});return}const _e=jk(Ce);if(_e){C({type:"edit",id:`aside:${_e}`});return}if(!Ys(Ce))return;const tt=ece(Ce,se);if(tt==="start-over"){Z("start-over");return}if(tt==="redraw"){me(Ce),Z("redraw");return}C({type:"edit",id:Ce})},[se]),on=s.useCallback(()=>{Z(null),J&&C({type:"edit",id:J}),me(null)},[J]),Wt=s.useCallback((Ce,_e)=>{const tt=E.current.answers;if(Ce==="keep"||Ce.startsWith("trait-")&&!Ce.endsWith("-where")){const I=tt[Ce];ge({[Ce]:{pick:Ce==="keep"||I==null?void 0:I.pick,words:_e,refs:(I==null?void 0:I.refs)??[]}});return}if(ur(Ce)||Ce.startsWith("trait-")){const I=tt[Ce];ge({[Ce]:{pick:I==null?void 0:I.pick,words:_e}});return}ge({[Ce]:_e})},[ge]),zt=s.useCallback((Ce,_e)=>{const tt=_e.trim();if(!tt)return;if(Ce==="name"){C({type:"cancel-edit"}),se&&G.update({name:tt.slice(0,60)});return}const I=jk(Ce);if(I){const be=E.current,Ve=be.asides.find(Bt=>Bt.at===I);if(!Ve)return;const Re=Ve.q&&Ys(Ve.q)?Ve.q:null,bt=Re?Ph(Re,tt,ha):Qo(tt,ha);if(!bt&&Re){C({type:"drop-aside",at:I}),Wt(Re,tt);return}const Ot=e6(Re,Ve.q,!!(se!=null&&se.views.portrait.hash)),It=Re&&ur(Re)?Re.slice(5):void 0,Dt=bt??"vague",wn=be.asides.filter(Bt=>Bt.q===Ve.q&&Bt.at<Ve.at&&Bt.kind===Dt).length;C({type:"amend-aside",at:I,said:tt,reply:Jl(Dt,Ot,wn,tt,It),kind:Dt,ctx:Ze});return}if(!Ys(Ce)||!vf(Ce,E.current.answers))return;const ue=Ph(Ce,tt,ha);if(ue){const be=E.current,Ve=e6(Ce,Ce,!!(se!=null&&se.views.portrait.hash)),Re=ur(Ce)?Ce.slice(5):void 0,bt=be.asides.filter(Ot=>Ot.q===Ce&&Ot.kind===ue).length;ge({[Ce]:void 0}),ot(tt,Jl(ue,Ve,bt,tt,Re),Ce,ue);return}Wt(Ce,tt)},[se,G.update,ge,Wt,tn,at,Ze]),Ut=s.useCallback(()=>C({type:"cancel-edit"}),[]),te=s.useCallback(()=>{const Ce=E.current,_e=Ce.editing&&Ce.editing!=="name"&&!gf(Ce.editing)?Ce.editing:null,tt=_e&&!vf(_e,Ce.answers)?_e:at==null?void 0:at.id;if(tt==="agree"){C({type:"say",id:"keep"});return}if(tt==="identity"){fe(I=>I+1);return}if(!(!tt||!Ys(tt))){if(tt==="look-who"){ge({source:{door:"scratch",via:"words"}});return}C({type:"say",id:tt})}},[at==null?void 0:at.id,ge]),ie=s.useCallback(()=>a9(E.current,Ze,_t.current),[Ze]),pe=s.useCallback(Ce=>{const _e=ie();if(_e){B(null),E.current.saying!==_e&&C({type:"say",id:_e});for(const tt of Ce.slice(0,1)){const I=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ue=URL.createObjectURL(tt);ee(be=>[...be,{key:I,id:_e,url:ue}]),tf(tt).then(be=>{if(Qe.current.delete(I)){URL.revokeObjectURL(ue);return}Q.current.has(be)?URL.revokeObjectURL(ue):Q.current.set(be,ue),C({type:"ref",id:_e,hash:be}),ee(Ve=>Ve.filter(Re=>Re.key!==I))}).catch(be=>{Qe.current.delete(I)||B(String((be==null?void 0:be.message)??be)),ee(Ve=>Ve.filter(Re=>Re.key!==I)),URL.revokeObjectURL(ue)})}}},[ie]),Fe=(Ce,_e,tt)=>{const I=Cy(Ce,_e,tt);return I.charAt(0).toUpperCase()+I.slice(1)},Oe=Ce=>FS(Ce).flatMap(_e=>{const tt=_e.color?cr(_e.color):null;return tt?[{hex:tt,name:_e.label,slot:"accent"}]:[]}),mt=a9(S,Ze,(at==null?void 0:at.id)??null),yt=(()=>{var bt,Ot,It;if(!mt)return;const Ce=((bt=S.answers[mt])==null?void 0:bt.refs)??[],_e=mt==="keep"?Ce.slice(((Ot=S.composing)==null?void 0:Ot.id)==="keep"?S.composing.refs.length:Ce.length):Ce,tt=re.filter(Dt=>Dt.id===mt);if(!_e.length&&!tt.length)return;const I=mt==="keep"?null:cs(mt),ue=I&&((It=Ra(I.id))==null?void 0:It.label)||"Detail",be=_e.length+tt.length>1;let Ve=0;const Re=()=>be?`${ue} ${++Ve}`:ue;return[..._e.map(Dt=>({key:Dt,src:Q.current.get(Dt)??gn(Dt,"micro"),label:Re(),onRemove:()=>C({type:"ref",id:mt,hash:Dt,remove:!0})})),...tt.map(Dt=>({key:Dt.key,src:Dt.url,label:Re(),busy:!0,onRemove:()=>{Qe.current.add(Dt.key),ee(wn=>wn.filter(Bt=>Bt.key!==Dt.key))}}))]})(),Et=sce(at,S,se,Lt),st=G.busy||Y||!!Et.off,vt=mt,Ae=e9(S,at),xe=Ae==="name"?null:Ae,Xe=xe&&ur(xe)?xe.slice(5):null,Ct=Et.color&&Xe?Oe(Xe):null,ve=xe&&((Rt=S.colour)==null?void 0:Rt.step)===xe?S.colour.hex:null,lt=se&&si(se)&&!Et.off&&!(at!=null&&at.id.match(/^(name|describe)$/))?(()=>{const Ce=ZY(S.text,Lt,se),_e=Ce.chip?se.views[Ce.chip.view].hash:void 0;return{chip:Ce.chip?{label:Ce.chip.label,thumb:_e?gn(_e,"micro"):void 0}:null,hint:Ce.hint,tone:Ce.tone}})():null,dt=se?HN(se,Lt):[],$e=(Zt==null?void 0:Zt.hash)??((se==null?void 0:se.stage)==="analyzing"?se.sources[0]:void 0),Ge=L&&(Zt!=null&&Zt.prior)?Zt.prior:$e;return{d:se,view:Lt,slot:Zt,facets:V,setFacets:W,presenterCategories:u,saving:K,saveErr:_,confirming:X,setConfirming:Z,confirmEdit:on,pendingEdit:J,startOver:nt,begun:Object.keys(S.answers).length>0||!!se,unsaved:!e&&!se&&Object.keys(S.answers).length>0,leave:()=>{oe(),C({type:"start-over"})},revision:S.revision,open:(at==null?void 0:at.id)??null,keepPrevious:Zt&&Zt.status==="approved"&&Zt.prior&&!Mt&&!(se!=null&&se.activeView)&&(se==null?void 0:se.stage)==="idle"?()=>void G.revert(Lt):null,surface:{title:"Create presenter",memoryKey:`presenter-create:${l.id}:${t}`,resumed:he,turns:St,busy:G.busy||Y||w,working:rce(St,se,Y||G.busy),stageEmpty:{lead:wle(se?Lt:void 0,En[Lt]),hint:yle((at==null?void 0:at.id)??null,((nn=S.answers.photos)==null?void 0:nn.hashes.length)??0)},stage:se?{hash:Ge,alt:`${xc[Lt]}${(Zt==null?void 0:Zt.status)==="candidate"?", candidate":""}`,drawing:Mt,since:_N(se),doing:VN(se),takes:vw(se,Lt)?[]:zN(se,Lt),onTake:$t?Ce=>void G.restore(Lt,Ce):void 0,items:dt,onPick:Ce=>{R(Ce),H(!1)},compare:Zt&&Zt.status==="candidate"&&Zt.prior?{on:L,toggle:()=>H(Ce=>!Ce)}:void 0}:null,composer:{placeholder:Et.placeholder,label:Et.label,action:Et.action,scope:lt,hint:null,why:Et.off??void 0,error:D??_,disabled:st,working:!!se&&!!se.activeView&&(at==null?void 0:at.id)!=="name",onStop:se!=null&&se.activeView?()=>void G.stop():void 0,stopping:G.stopping,focusKey:at&&!(at.id==="agree"&&!S.saying)?`${at.id}:${(se==null?void 0:se.id)??"setup"}:${ne}:${S.saying??""}:${S.says}`:void 0,onAttach:!vt&&!se&&(at==null?void 0:at.id)==="source"?()=>ge({source:{door:"photos",via:"taps"}}):void 0,onAttachFiles:vt?pe:void 0,attachLabel:vt?Rce(S,vt):"Add photos",refs:yt,colour:Ct&&Xe?{hex:ve,label:ve?Fe(ve,FS(Xe),Xe):"Pick a colour",seed:(Nt=Ct[Math.floor(Ct.length/2)])==null?void 0:Nt.hex,onPick:Ce=>C({type:"colour",hex:Ce,step:xe}),onClear:()=>C({type:"colour",hex:null,step:xe})}:null},text:S.text,onText:Ce=>C({type:"text",text:Ce}),onSend:tn,onAnswer:rt,onRestore:(Ce,_e)=>{R(Ce),G.restore(Ce,_e)},onEdit:Qt,onSaveEdit:zt,onCancelEdit:Ut,onDescribe:te,onAttachRef:pe,onStarter:Ce=>{(at==null?void 0:at.id)==="agree"&&C({type:"say",id:"keep"}),C({type:"text",text:Ce})},onPaste:!se&&((Jt=S.answers.source)==null?void 0:Jt.door)==="photos"?Ce=>void Je(Ce):void 0}}}function Lce({onClose:e,...t}){const n=Pce(t),r=n.d,{push:a}=rr();s.useEffect(()=>xp({open:n.open}),[n.open]),s.useEffect(()=>()=>xp(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(Qn,{label:"Start over",tone:"quiet",title:"Start over?",body:`This conversation begins again from the first question. ${ON(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 ",En[n.view],"."]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:n.keepPrevious,children:"Keep previous"})]})}),p=o.jsx(Qn,{label:"Change it",title:Ele,body:(r==null?void 0:r.source)==="photos"?jle:Cle,busy:!1,open:n.confirming==="redraw",onOpenChange:g=>{g||n.setConfirming(null)},onConfirm:n.confirmEdit}),m=o.jsxs(o.Fragment,{children:[p,o.jsx(Qn,{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(by,{surface:{...n.surface,headAction:f,dock:h,overlay:m},onClose:u})}function $ce(){const{draftId:e=null}=Qs(),{key:t}=Un(),{brand:n}=un(),r=Bn(),{announce:a,caps:i}=Lw();Ic("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(ol(n,g),{replace:w}))},[r,n]),p=s.useCallback(()=>{l.current&&(u.current=null,r(ol(n),{replace:!0}))},[r,n]),m=s.useCallback(()=>r(ni(n),{replace:!0}),[r,n]);return o.jsx(Lce,{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"?Ea(n,g.id):ni(n),{replace:!0})},caps:i},f.current)}const o9=1e3,Tce=3,Dce=1e3;function i9(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 Hce(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),C=s.useRef(e.onSaved);C.current=e.onSaved;const{poke:E}=ea(),A=s.useCallback(async(B,V={})=>{if(!(S.current||b.current.job)){S.current=!0,g(!0);try{const W=b.current,K=Lr(W),F=B==="make"?{kind:B,instruction:W.place,imageHashes:W.pictures,draw:V.draw??!1,...V.shot?{shot:!0}:{}}:B==="again"?{kind:B,reading:K==null?void 0:K.reading,imageHashes:W.pictures}:{kind:B,reading:K==null?void 0:K.reading,ask:V.ask,from:(K==null?void 0:K.hash)??void 0,...K!=null&&K.hash&&K.anchor?{fromAnchor:!0}:{},...K!=null&&K.hash&&K.hero?{fromHero:K.hero,...K.heroWith?{heroWith:K.heroWith}:{}}:{},imageHashes:W.pictures,draw:V.draw},_=W.name.trim()||(K==null?void 0:K.reading.name)||void 0,{jobId:O,job:Y,existing:z}=await Ne.startSceneStudioJob(r,{...F,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}),E()}catch(W){n({type:"error",text:String((W==null?void 0:W.message)??W)}),y(K=>K+1)}finally{S.current=!1,g(!1)}}},[r,n,E]);s.useEffect(()=>{const B=b.current;if(B.job||!B.versions.length&&!B.inputsRev)return;let V=!0;return Ne.activity(r).then(W=>{var F;const K=(F=W.studio)==null?void 0:F.find(_=>_.kind==="scene"&&_.conversation===i&&_.status==="running"&&!!_.job);!V||!(K!=null&&K.job)||b.current.job||S.current||n({type:"started",id:K.id.slice(6),kind:K.job,since:K.startedAt})}).catch(()=>{}),()=>{V=!1}},[r,i,n]);const P=t.named?t.name.trim():"",T=((H=t.job)==null?void 0:H.id)??null;s.useEffect(()=>{!T||!P||Ne.labelSceneStudioJob(r,T,P).catch(()=>{})},[T,P,r]);const M=((D=t.job)==null?void 0:D.id)??null;s.useEffect(()=>{if(!M)return;let B=!0,V=0,W=!0,K;const F=async()=>{var _;try{const O=await Ne.sceneStudioJob(r,M);if(!B)return;V=0,f(!1),W&&O.status==="running"&&((_=b.current.job)!=null&&_.stopping)&&Ne.cancelSceneStudioJob(r,M).catch(()=>{}),W=!1,O.status==="running"?(n({type:"progress",job:O}),K=setTimeout(F,o9)):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>=Tce&&f(!0),K=setTimeout(F,Math.min(o9*2**Math.min(V,3),8e3))}};return F(),()=>{B=!1,clearTimeout(K)}},[M,r,n]);const j=s.useCallback(()=>{const B=b.current.job;if(!B||B.stopping)return Promise.resolve(!0);n({type:"stopping",id:B.id});const V=()=>Ne.cancelSceneStudioJob(r,B.id);return V().catch(()=>new Promise(W=>setTimeout(W,Dce)).then(V)).then(()=>!0,()=>(n({type:"stop-failed",id:B.id}),!1))},[r,n]),R=s.useCallback(B=>{const V=wre(b.current,B);V>=0&&n({type:"put-back",index:V})},[n]),L=s.useCallback(async(B={})=>{var _,O,Y,z;const V=b.current,W=((_=Lr(V))==null?void 0:_.reading.name)||((Y=(O=V.job)==null?void 0:O.pending)==null?void 0:Y.name)||"",K={...V,name:V.name.trim()||W},F=mre(K);if(!(!F.can||!F.words||S.current)){S.current=!0,p(!0);try{const X=((z=V.job)==null?void 0:z.phase)==="drawing"?V.job.id:null,Z=i9(K,F.words,X?null:Lr(V)??null),J=k.current,me=J?Lr(J):null,ne=a&&!B.asNew?await Ne.updateScene(r,a,J&&me?Mre(Z,i9(J,me.reading,me)):Z):await Ne.createScene(r,{...Z,conversation:i});l(ne.brand);const fe=ne.scene;if(X){const re=await Ne.attachSceneStudioJob(r,X,fe.id).catch(()=>null);(re==null?void 0:re.state)==="landed"&&l(re.brand)}n({type:"saved",id:fe.id}),C.current({id:fe.id,name:fe.name,verticals:fe.verticals??[]},!!B.asNew)}catch(X){n({type:"error",text:String((X==null?void 0:X.message)??X)})}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:L}}const Oce="scenri:scene-studio:",Ice=10080*60*1e3;function YL(e){const t=Sr.get(e);if(!t)return null;try{return JSON.parse(t)}catch{return null}}function Fce(e){const t=YL(e);return fP(typeof(t==null?void 0:t.session)=="string"?t.session:null)}function _ce(e,t,n){Sr.set(e,JSON.stringify({at:Date.now(),sceneId:n,session:t}))}function Vce(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 l9(e){Sr.del(e)}function Zce(e=Date.now()){var t;for(const n of Sr.keys(Oce)){let r=0;try{r=Number((t=JSON.parse(Sr.get(n)??"null"))==null?void 0:t.at)||0}catch{}e-r>Ice&&Sr.del(n)}}function zce(e){var xe,Xe,Ct,ve,lt,dt;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(()=>{Zce();const $e=Fce(l);return $e||el(l),$e}),[p,m]=s.useReducer(JR,null,()=>(h==null?void 0:h.setup)??lre),[g,w]=s.useReducer(pre,null,()=>(h==null?void 0:h.studio)??a??tP),[y,b]=s.useState(0),[k,S]=s.useState(""),C=s.useRef(null),[E,A]=s.useState(!1),[P,T]=s.useState(void 0),[M,j]=s.useState(null),R=s.useRef(!1),L=s.useRef(p);L.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 W=Hce({s:g,dispatch:w,brandId:t.id,sceneId:r,conversation:i,seed:a,applyBrand:n,onSaved:($e,Ge)=>V.current($e,r&&!Ge?"updated":"created")}),K=s.useRef(!1);s.useEffect(()=>{if(R.current)return;const $e=YL(l);if(($e==null?void 0:$e.done)===!0||K.current&&!$e){R.current=!0;return}const Ge=typeof($e==null?void 0:$e.sceneId)=="string"?$e.sceneId:null;_ce(l,zre(p,g),r??g.saved??Ge),K.current=!0},[p,g,l,r]);const F=g.saved,_=F?af(t,F):void 0,O=aL(t.id,F,(_==null?void 0:_.placeUrl)??null),Y=((xe=O.job)==null?void 0:xe.status)==="running",[z,X]=s.useState(!1),[Z,J]=s.useState(0),[me,ne]=s.useState(!1);s.useEffect(()=>{Y||ne(!1)},[Y]);const fe=s.useMemo(()=>UN(_==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 Ge,Rt;if(!F)return;const $e=(_==null?void 0:_.examples)??[];return{tiles:fe,running:Y||z||O.waiting,read:O.read,who:((Ge=$e[0])==null?void 0:Ge.with)??((Rt=O.job)==null?void 0:Rt.subject.kind)??((_==null?void 0:_.subject)==="person"||_!=null&&_.figure?"presenter":"product"),noSubject:O.read&&!O.job&&!$e.length&&O.more.length===0,missing:WY(O.more,$e,O.job),first:O.first,stale:O.first.length>0&&$e.some(nn=>nn.earlier),finish:e.finish}},[F,_,fe,Y,z,O.waiting,O.read,O.job,O.first,O.more,e.finish]),Q=s.useCallback($e=>{F&&(j(null),X(!0),Ne.drawSceneExamples(t.id,F,$e).then(()=>{X(!1),O.again()}).catch(Ge=>{X(!1),J(Rt=>Rt+1),"roles"in $e||w({type:"set-failed",more:"more"in $e}),j(String((Ge==null?void 0:Ge.message)??Ge))}))},[t.id,F,O.again]),he=s.useCallback(()=>{F&&(R.current=!0,Gre(l,F),el(l),re.current(F))},[F,l]),[Me,ce]=s.useState(null);s.useEffect(()=>ce(null),[g.current]),s.useEffect(()=>{f||p.editing||!Hk(p.answers)||w({type:"inputs",place:ore(p.answers),pictures:ire(p.answers)})},[p.answers,p.editing,f]);const ke=s.useRef(new Set),Be=hre(g,!f&&Hk(p.answers));s.useEffect(()=>{var $e;Be===null||W.starting||ke.current.has(Be)||(ke.current.add(Be),W.start("make",{draw:!1,shot:(($e=L.current.answers.source)==null?void 0:$e.door)==="shot"}))},[Be,W.starting,W.start]);const[ft,Ue]=s.useState(""),Qe=oy(t.id,ft,!f),Pe=s.useRef(Qe);Pe.current=Qe;const G=s.useRef([]);Qe.settled&&!Qe.error&&(G.current=Qe.items);const se=Qe.settled?Qe.items:G.current,We=!Qe.error&&(!Qe.settled||Qe.loading),{recent:Ze,loaded:oe}=un(),[q,ae]=s.useState(null);s.useEffect(()=>{!ft.trim()&&Qe.settled&&!Qe.error&&ae(Qe.items.length>0)},[ft,Qe.settled,Qe.error,Qe.items.length]);const Le=q??(Ze.length>0?!0:oe?!1:null),Ie=s.useMemo(()=>({any:Le,items:se.map($e=>({id:$e.id,hash:$e.images[0],alt:Vce($e.promptHead)})),query:ft,more:Qe.settled&&Qe.hasMore,loading:We,error:Qe.error}),[Le,se,ft,Qe.settled,Qe.hasMore,We,Qe.error]),Je=Dn().scenes,ge=(u==null?void 0:u.canRead)??!0,[et,nt]=s.useState(null),pt=s.useCallback(async $e=>{var Jt,Ce,_e;const Ge=G.current.find(tt=>tt.id===$e)??Qe.items.find(tt=>tt.id===$e);if(!(Ge!=null&&Ge.images[0]))return;const Rt=L.current.revision;let nn=Uk(Ge.brief);if(!nn&&Ge.kind==="edit"){const tt=await Ne.lineage(Ge.id).catch(()=>null);if(nn=Uk((Jt=tt==null?void 0:tt.ancestors.find(I=>I.kind==="generation"))==null?void 0:Jt.brief),L.current.revision!==Rt)return}const Nt=nn?((Ce=af(t,nn))==null?void 0:Ce.name)??((_e=Je.find(tt=>tt.id===nn))==null?void 0:_e.name):void 0;if(!ge&&!(nn&&Nt)){nt("shot");return}nt(null),kt({shot:{id:Ge.id,hash:Ge.images[0],...nn&&Nt?{scene:{id:nn,name:Nt}}:{}},reuse:void 0})},[t,Je,Qe.items,ge]),St=s.useCallback(()=>{var Ge;const $e=(Ge=L.current.answers.shot)==null?void 0:Ge.scene;$e&&(R.current=!0,l9(l),el(l),re.current($e.id,{existing:!0}))},[l]),at=(u==null?void 0:u.canDraw)??!0,_t=W.offline?we.offline:M,Lt={setup:p,studio:g,canDraw:at,canRead:ge,noReader:et,uploading:y,edit:f&&{...f,changed:Bk(g,a)},editingName:E,note:_t,stale:nP(g),shots:Ie,set:ee},Zt=W.failed+Z,Mt=s.useMemo(()=>Ire(Lt).map($e=>$e.kind==="question"&&Zt?{...$e,question:{...$e.question,attempt:Zt}}:$e),[p,g,at,ge,et,y,E,_t,f,Ie,ee,Zt]),$t=(()=>{const $e=Mt[Mt.length-1];return($e==null?void 0:$e.kind)==="question"?$e.question:null})(),Se=Vre(Lt,$t),Ke=($e,Ge,Rt)=>m({type:"aside",aside:{said:$e,reply:Ge,q:Rt,at:Ap()}}),kt=s.useCallback($e=>{const Ge=L.current,Rt=Ge.held??Ge.answers;Ge.editing&&Vk(H.current)&&JSON.stringify(qw(Rt,$e))!==JSON.stringify(Rt)&&w({type:"forget-record"}),m({type:"answer",patch:$e})},[]),qe=s.useRef(0),ot=s.useCallback(async $e=>{var Ce,_e;const Ge=$e.some(Fk),Rt=$e.filter(tt=>tt.type.startsWith("image/")&&!Fk(tt));if(!Rt.length){j(Ge?we.heicNotYet:we.onlyPictures);return}((Ce=L.current.answers.source)==null?void 0:Ce.door)!=="photos"&&kt({source:{door:"photos"}});const Nt=4-(((_e=L.current.answers.photos)==null?void 0:_e.hashes)??[]).length-qe.current;if(Nt<=0){j(we.fourPictures);return}const Jt=Rt.slice(0,Nt);j(Rt.length>Nt?we.fourPictures:Ge?we.heicNotYet:null),qe.current+=Jt.length,b(tt=>tt+1);try{for(const tt of Jt)try{m({type:"photo",hash:await tf(tt)})}catch(I){j(`${tt.name} could not be added: ${String((I==null?void 0:I.message)??I)}`)}finally{qe.current-=1}}finally{b(tt=>tt-1)}},[kt]),rt=s.useRef(fe);rt.current=fe;const tn=Ml(),Qt=Rl(),on=s.useCallback(($e,Ge)=>{var Rt,nn;if(j(null),Ge.kind==="confirm"&&Ge.id.startsWith("remedy:")){const Nt=Ge.id.slice(7);Nt==="setup"?Qt():(Nt==="engines"||Nt==="budget")&&tn(Nt);return}if(Ge.kind==="confirm"&&Ge.id==="reword"){T(String(Date.now()));return}if($e==="photos"&&Ge.kind==="photos"){const Nt=Ge.action,Jt=((Rt=L.current.answers.photos)==null?void 0:Rt.hashes)??[];Nt.type==="add"?ot(Nt.files):Nt.type==="instead"?kt({source:{door:"shot"}}):Nt.type==="remove"?m({type:"photos",hashes:Jt.filter(Ce=>Ce!==Nt.hash)}):Nt.type==="reject"?j(we.onlyPictures):Nt.type==="submit"&&Jt.length?ge?(nt(null),kt({photos:{hashes:Jt,done:!0}})):nt("photos"):Nt.type==="back"&&kt({source:{door:"guided"}});return}if($e==="shot"&&Ge.kind==="pick"){const Nt=Ge.action;Nt.type==="pick"?pt(Nt.id):Nt.type==="query"?Ue(Nt.text):Nt.type==="more"?Pe.current.loading||Pe.current.loadMore():Nt.type==="back"&&(Ue(""),kt({source:{door:"photos"},photos:{hashes:[],done:!1}}));return}if($e==="reuse"&&Ge.kind==="choice"&&Ge.id==="use"){St();return}if($e==="reuse"&&!ge){nt("shot");return}if($e==="noreader"){Ge.kind==="confirm"&&Ge.id==="unstop"&&nt(null);return}if(Dk($e)){const Nt=are($e,Ge,L.current.answers);Nt&&kt(Nt);return}if($e==="retry"){W.start("make",{draw:!1,shot:((nn=L.current.answers.source)==null?void 0:nn.door)==="shot"});return}if(Ge.kind==="confirm"){if($e==="set-start"){Ge.id==="draw-set"?(w({type:"set-drawn"}),Q({first:!0})):w({type:"set-declined"});return}if($e==="set-more"){Ge.id==="more"?(w({type:"ask-more"}),Q({more:!0})):w({type:"decline-more"});return}if($e==="set-done"){Ge.id==="retry-failed"?Q({roles:rt.current.filter(Nt=>Nt.state==="failed").map(Nt=>Nt.role)}):he();return}Ge.id==="draw"||Ge.id==="again"?W.start("again"):Ge.id==="use"?W.use():Ge.id==="another-shot"&&ie.current("shot")}},[ot,kt,W.start,W.use,Q,he,pt,St,tn,Qt,ge]),Wt=$e=>{$e.trim()?!C.current&&Se.target.kind!=="off"&&(C.current=Se.target):C.current=null,S($e)},zt=$e=>{const Ge=Ut($e);return Ge&&(C.current=null,S("")),Ge};function Ut($e){var Ge;{const Rt=$e.trim();if(!Rt)return!1;j(null);const nn=C.current??Se.target;if(nn.kind==="source"){if(uP(Rt))return kt({source:{door:"words",text:Rt.slice(0,ld)}}),!0;const Nt=qne(Rt),Jt=Object.keys(Nt);return Jt.length>0?(kt({source:{door:"guided"},...Object.fromEntries(Jt.map(Ce=>[Ce,{pick:Nt[Ce]}]))}),!0):(Ke(Rt,Qk(Jk(Rt,"source")??"vague","source"),"source"),!0)}if(nn.kind==="row"&&Np(nn.id)){const Nt=Jk(Rt,"row");if(Nt)return Ke(Rt,Qk(Nt,"row"),nn.id),!0;const Jt=(Ge=L.current.answers[nn.id])==null?void 0:Ge.pick;return kt({[nn.id]:{...Jt?{pick:Jt}:{},words:Rt.slice(0,ld)}}),!0}if(nn.kind==="name")return w({type:"name",text:sP(Rt)??Rt}),!0;if(nn.kind==="add"||nn.kind==="change"){if(g.job||W.starting)return!1;const Nt=Are(Rt),Jt=Ore(g);return Nt.kind==="rename"?(w({type:"name",text:Nt.name}),Ke(Rt,we.renamed(Nt.name),Jt),!0):Nt.kind!=="change"?(Ke(Rt,Nt.say,Jt),Nt.kind!=="refuse"):(nn.kind==="add"?W.start("change",{ask:Rt,draw:!1}):Nre(g,Rt)?W.start("again"):W.start("change",{ask:Rt}),!0)}return!1}}const te=s.useCallback($e=>{g.job||($e==="name"?A(!0):Dk($e)&&($e==="shot"&&Ue(""),Vk(g)?B($e):m({type:"edit",id:$e})))},[g]),ie=s.useRef(te);ie.current=te;const pe=s.useCallback(($e,Ge)=>{$e==="name"&&(Ge.trim()&&w({type:"name",text:Ge.trim()}),A(!1))},[]),Fe=s.useCallback(()=>{A(!1),m({type:"cancel-edit"})},[]),Oe=Lr(g),mt=Y&&O.job?ww({status:O.job.status,step:O.job.current,done:O.job.done.length,total:O.job.roles.length,error:O.job.error}):void 0,yt=g.job?O8(g):W.saving?"Saving":mt,Et=[];let st=null;const vt=$e=>({view:"place",label:"The place",state:$e==="place"?"current":"approved",hash:(Oe==null?void 0:Oe.hash)??void 0,photo:!1,drawing:!1,approved:!0,error:!1});if(F){const $e=Y?(Xe=O.job)==null?void 0:Xe.current:null,Ge=((Ct=[...fe].reverse().find(Jt=>Jt.state==="shown"))==null?void 0:Ct.role)??null,Rt=Me??$e??Ge??"place",nn=((ve=fe[0])==null?void 0:ve.role)==="hero"&&fe[0].state==="shown";nn||Et.push(vt(Rt));for(const[Jt,Ce]of fe.entries())Et.push({view:Ce.role,label:Ua[Ce.role],state:Rt===Ce.role?"current":Ce.state==="shown"?"approved":"todo",hash:Ce.hash,photo:!1,drawing:Ce.state==="drawing",approved:Ce.state==="shown",error:Ce.state==="failed"}),nn&&Jt===0&&Et.push(vt(Rt));const Nt=Et.find(Jt=>Jt.view===Rt)??Et[0];st={hash:Nt.hash,drawing:Nt.drawing}}else if(Oe!=null&&Oe.hash&&Oe.hero){const $e=Me==="place"?"place":"hero";Et.push({view:"hero",label:Ua.hero,state:$e==="hero"?"current":"approved",hash:Oe.hero,photo:!1,drawing:!1,approved:!0,error:!1},vt($e))}const Ae=!f&&(!!p.answers.source||g.versions.length>0);return{title:f?we.editTitle:we.title,turns:Mt,working:yt,busy:W.saving,resumed:!!h,memoryKey:l,stage:st?{hash:st.hash,alt:`${g.name.trim()||(Oe==null?void 0:Oe.reading.name)||"The scene"}, in use`,drawing:st.drawing||!!g.job&&g.job.phase==="drawing",doing:mt??O8(g),items:Et,onPick:$e=>ce($e)}:{hash:(Me==="place"?Oe==null?void 0:Oe.hash:rP(Oe))??void 0,alt:`Preview of ${g.name.trim()||(Oe==null?void 0:Oe.reading.name)||"the scene"}`,drawing:!!g.job&&g.job.phase==="drawing",since:((lt=g.job)==null?void 0:lt.since)??void 0,doing:O8(g),takes:g.job?void 0:gre(g),onTake:W.putBack,items:Et,onPick:$e=>ce($e)},composer:{placeholder:Se.placeholder,label:Se.label,action:Se.action,disabled:Se.target.kind==="off",why:Se.target.kind==="off"&&Se.target.why||null,working:Se.working,onStop:g.job?()=>{j(null),W.stop().then($e=>{$e||j(we.stopLost)})}:Y&&F?()=>{ne(!0),Ne.stopSceneExamples(t.id,F).then(()=>O.again()).catch(()=>{ne(!1),j(we.stopLost)})}:void 0,stopping:!!((dt=g.job)!=null&&dt.stopping)||me,focusKey:P,onAttachFiles:Se.attach?$e=>void ot($e):void 0,attachLabel:we.attachLabel},text:k,onText:Wt,onSend:zt,onAnswer:on,onEdit:te,onSaveEdit:pe,onCancelEdit:Fe,confirmingEdit:D!==null,confirmEdit:()=>{D&&m({type:"edit",id:D}),B(null)},cancelConfirm:()=>B(null),onRestore:($e,Ge)=>W.putBack(Ge),onRetry:$e=>Q({roles:[$e]}),onDescribe:()=>T(String(Date.now())),onStarter:$e=>{Wt($e),T(String(Date.now()))},onPaste:($t==null?void 0:$t.id)==="source"||($t==null?void 0:$t.id)==="photos"?$e=>void ot($e):void 0,canDraw:at,begun:Ae,unsaved:g.saved?!1:f?Bk(g,a):Ae,running:!!g.job||Y,saved:!!F,finish:he,keptAsDraft:!f&&aP(g),leave:()=>{W.stop(),R.current=!0,l9(l),el(l)}}}function Bce({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=zce({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],C=(S==null?void 0:S.kind)==="question"?S.question.id:null;s.useEffect(()=>xp({open:C}),[C]),s.useEffect(()=>()=>xp(null),[]);const E=!!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 P=!E&&g.begun&&!g.saved?o.jsx(Qn,{label:we.startOver,tone:"quiet",title:we.startOverTitle,body:we.startOverBody,busy:!1,onConfirm:()=>{g.leave(),f()}}):null;return o.jsx(by,{onClose:A,surface:{kind:"scene",glyph:o.jsx(_E,{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:P,overlay:o.jsxs(o.Fragment,{children:[o.jsx(Qn,{label:we.changeIt,title:we.changeTitle,body:we.changeBody,busy:!1,open:g.confirmingEdit,onOpenChange:T=>{T||g.cancelConfirm()},onConfirm:g.confirmEdit}),o.jsx(Qn,{label:E?we.discard:we.leave,title:E?we.discardTitle:we.leaveTitle,body:E?we.discardBody:we.leaveBody,busy:!1,open:w,onOpenChange:T=>{T||y(!1)},onConfirm:()=>{y(!1),g.leave(),u()}})]})}})}const V4=e=>{const t=/^asset:([a-f0-9]{32})$/.exec(String(e??""));return t?t[1]:null};function Uce(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=>V4(u==null?void 0:u.file)).filter(Boolean);return fre({place:String(r.instruction??""),pictures:i,reading:a,hash:V4(r.preview)??null,anchor:r.anchor===!0,...Wce(r),name:a.name})}function Wce(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=V4(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 Kce(){return[...crypto.getRandomValues(new Uint8Array(6))].map(t=>t.toString(16).padStart(2,"0")).join("")}function c9(){const{sceneId:e=null,convoId:t=null}=Qs(),{key:n,state:r}=Un(),{brand:a}=un(),{applyBrand:i}=Dn(),l=Bn(),{announce:u,caps:f}=Lw();Ic(e?"Edit scene":"Create scene");const[h]=s.useState(()=>e?Uce(a,e):null),p=typeof(r==null?void 0:r.from)=="string"?r.from:null,m=p&&(cl(ht.hub,p.split("?")[0])||cl(ht.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):sl(a)),{replace:!0})},[l,p,e,a]),w=s.useMemo(()=>t??Kce(),[t,n]);s.useEffect(()=>{t||e&&!h||l(e?fw(a,e,w):al(a,w),{replace:!0,state:r})},[t,w,e,h,a,l,r]);const y=s.useRef(null),b=s.useMemo(()=>t?Yre(a.id,t):null,[a.id,t]);return e&&!h?o.jsx(Ka,{to:Zr(a,e),replace:!0}):b?o.jsx(Ka,{to:Zr(a,b),replace:!0}):o.jsx(Bce,{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(al(a),{replace:!0,state:r}),onSaved:(k,S)=>{y.current={made:k,how:S}},finish:m?we.useInAShot:we.openScene,onDone:(k,S)=>{var C,E;if(!(S!=null&&S.existing)&&!af(a,k)){l(sl(a),{replace:!0});return}if(!(S!=null&&S.existing)){const A=af(a,k),P=((C=y.current)==null?void 0:C.made.id)===k?y.current.made:null;u({kind:"scene",id:k,name:(P==null?void 0:P.name)??(A==null?void 0:A.name)??"",verticals:(P==null?void 0:P.verticals)??(A==null?void 0:A.verticals)??[],how:((E=y.current)==null?void 0:E.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 qL(){const{brand:e}=un(),t=Bn(),n=xr(e);return s.useCallback(r=>{t(`${n}?product=${encodeURIComponent(r)}&compose=1`)},[n,t])}function Gce({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,C;const k=s.useMemo(()=>y?Qm({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}):ml({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(bd,{id:e.id,previewUrl:qr((C=(S=e.shots)==null?void 0:S[0])==null?void 0:C.file),title:Mo(e,"tooltip"),primary:Mo(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 Yce(e){return o.jsx(Fm,{...e})}const XL=s.memo(Gce);function qce({product:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:l,bookmarked:u,onBookmark:f,size:h="grid"}){const p=lf(e.category)??e.category,{contentArriving:m}=Dn(),g=s.useMemo(()=>ml({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(bd,{id:e.id,previewUrl:e.previewUrl,pending:!e.previewUrl&&m,title:`${Mo(e,"tooltip")} · ${p}`,primary:Mo(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 QL=s.memo(qce),Xce=8,n6="__bookmarked";function Qce(){var kt;const{brand:e,products:t,productsLoaded:n,refreshProducts:r}=un(),a=((kt=_M())==null?void 0:kt.importing)??!1,{demoProducts:i,applyBrand:l,refreshBrands:u}=Dn(),{push:f}=rr(),h=n&&t.length===0,p=Bn(),m=qL(),g=Pl(),{q:w,setQ:y,facets:b,setFacets:k,clearSearch:S,clear:C}=r1(["category","bookmarked"]),E=b.category,A=b.bookmarked==="1",[P,T]=s.useState(()=>cd("product",e.id)),M=qe=>T(Ym("product",e.id,qe)),j=my(`${e.id}|${w}|${E??""}|${A?"1":""}`),[R,L]=Sa(Kr.wallDensity,ad),H=Vc(R),D=s.useCallback(qe=>L(qe),[L]),B=s.useMemo(()=>Im(H),[H]),V=Hm(H),W=s.useMemo(()=>{const qe=a?t.filter(ot=>{var rt;return(((rt=ot.shots)==null?void 0:rt.length)??0)>0}):t;return bM(qe).map(ot=>({product:ot,category:Pw(ot),own:!0}))},[t,a]),K=s.useMemo(()=>i.map(qe=>({product:qe,category:qe.category,own:!1})),[i]),F=s.useMemo(()=>[...W,...K],[W,K]),_=s.useMemo(()=>F.reduce((qe,ot)=>qe+(P.includes(ot.product.id)?1:0),0),[F,P]),O=A&&_===0,Y=O&&h,z=O&&!h,X=s.useMemo(()=>{const qe=new Map;for(const{category:ot}of F)ot&&qe.set(ot,(qe.get(ot)??0)+1);return qe},[F]),Z=s.useMemo(()=>of.filter(qe=>X.has(qe.key)),[X]),J=F.length>0?"tabs":"none",me=s.useCallback(qe=>p(wa(e,qe)),[p,e]),[ne,fe]=s.useState(null),[re,ee]=s.useState(!1),[Q,he]=s.useState(null),[Me,ce]=s.useState(!1),[ke,Be]=s.useState(null),[ft,Ue]=s.useState(!1),Qe=s.useCallback(qe=>{const ot=t.find(rt=>rt.id===qe);ot&&fe(ot)},[t]),Pe=qe=>qe.origin==="catalog"||qe.id.startsWith("cat-"),G=s.useCallback(qe=>{const ot=t.find(rt=>rt.id===qe);!ot||Pe(ot)||(Be(null),he(ot))},[t]),se=async qe=>{if(!(!Q||Me)){ce(!0),Be(null);try{l(await Ne.updateProduct(e.id,Q.id,{name:qe})),he(null)}catch(ot){const rt=cn(ot,"Could not rename this product");Be([rt.title,rt.detail].filter(Boolean).join(" "))}finally{ce(!1)}}},We=async()=>{if(!ne||re)return;ee(!0);const qe=ne.origin==="catalog"||ne.id.startsWith("cat-");try{qe?(await Ne.deleteCatalogProduct(e.id,ne.id),await r()):l(await Y6(e.id,ne.id)),j.forget(ne.id),fe(null)}catch(ot){(ot==null?void 0:ot.status)===404?(await Promise.all([u(),r()]),j.forget(ne.id),fe(null)):f(cn(ot,"Could not delete this product"))}finally{ee(!1)}},Ze=s.useCallback(qe=>qe.filter(({product:ot})=>Y||!A||P.includes(ot.id)).filter(({category:ot})=>!E||ot===E).filter(({product:ot,category:rt})=>Ro([Jw(ot),lf(rt)].filter(Boolean).join(" "),w)).map(({product:ot})=>ot),[E,w,A,P,Y]),oe=s.useMemo(()=>Ze(W),[Ze,W]),q=s.useMemo(()=>Ze(K),[Ze,K]),{visible:ae,remaining:Le,showMore:Ie}=hf(oe,`${E??""}|${A?"keepers":""}|${w}`),[Je,ge]=s.useState(null);s.useEffect(()=>{if(!Je||Le<=0)return;const qe=Je.closest(".sc-home"),ot=new IntersectionObserver(rt=>{rt.some(tn=>tn.isIntersecting)&&Ie()},{root:qe,rootMargin:"200% 0px"});return ot.observe(Je),()=>ot.disconnect()},[Je,Le,Ie]);const et={key:"category",label:"Category",everyLabel:"All products",everyCount:F.length,selected:A?n6:E,onSelect:qe=>k(qe===n6?{bookmarked:"1",category:null}:{bookmarked:null,category:qe}),options:[{value:n6,label:"Keepers",count:_},...Z.map(qe=>({value:qe.key,label:qe.label,count:X.get(qe.key)??0}))]},nt=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>g("product"),children:[o.jsx(mr,{size:12})," Add product"]}),pt=h,St=t.length>0,at=o.jsx(Jm,{title:"Products",filters:o.jsx(e2,{mode:J,group:et}),density:o.jsx(Om,{value:H,onChange:D}),search:F.length>=Xce&&o.jsx(Cd,{value:w,onChange:y,noun:"products",total:F.length})}),_t=qe=>{const ot=t.find(tn=>tn.id===qe);return ot&&ot.origin==="catalog"||qe.startsWith("cat-")?Ne.deleteCatalogProduct(e.id,qe):Y6(e.id,qe)},Lt=()=>{const qe=[...j.ids];qe.length===1?Qe(qe[0]):Ue(!0)},Zt=[...j.ids],Mt=Zt.length>0&&Zt.every(qe=>P.includes(qe)),$t=()=>T(ty("product",e.id,Zt,!Mt)),Se=Xm(j.ids.size,Mt,"products"),Ke=async()=>{if(re)return;const qe=[...j.ids];ee(!0);try{const{failed:ot,error:rt}=await Op(qe,_t);await Promise.all([u(),r()]),j.retain(ot),Ue(!1),rt&&f(cn(rt,"Could not delete these products"))}finally{ee(!1)}};return o.jsx(qf.Provider,{value:V,children:o.jsxs(ls,{children:[o.jsxs("main",{className:"sc-looks sc-products",id:"main","data-hero":pt||void 0,onClick:j.onBlank,children:[n&&!pt&&at,!n&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":V,style:B,"aria-hidden":!0,children:o.jsx(Yce,{size:"grid",count:8})}),St&&ae.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:ae.map(qe=>o.jsx(XL,{product:qe,variant:"use",size:"grid",onOpen:me,href:wa(e,qe.id),onUse:m,bookmarked:P.includes(qe.id),onBookmark:M,onDelete:Qe,onRename:Pe(qe)?void 0:G,chosen:j.ids.has(qe.id),batching:j.batching==="product",onPick:j.picking("product")?ot=>j.toggle("product",ot):void 0,batch:j.kind==="product"&&j.ids.has(qe.id)?{count:j.ids.size,onAct:Lt,onKeep:$t,allKept:Mt}:null},qe.id))}),Le>0&&o.jsx("div",{ref:ge,"aria-hidden":!0}),Le>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:Ie,children:["Show ",Math.min(Le,60)," more"]})}),Q&&o.jsx(hy,{title:"Rename product",name:Q.name,maxLength:500,busy:Me,error:ke,onConfirm:qe=>void se(qe),onDismiss:()=>{Me||he(null)}}),ne&&o.jsx(Qn,{label:"Delete product",title:`Delete ${ne.name}?`,body:vi("product",1),open:!0,busy:re,onOpenChange:qe=>{!qe&&!re&&fe(null)},onConfirm:()=>void We()}),ft&&o.jsx(Qn,{label:as("product",j.ids.size).menu,title:`${as("product",j.ids.size).menu}?`,body:vi("product",j.ids.size),open:!0,busy:re,onOpenChange:qe=>{!qe&&!re&&Ue(!1)},onConfirm:()=>void Ke()})]}),pt&&o.jsx(ko,{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:nt}),St&&ae.length>0&&q.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri products"})}),pt&&K.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gy,{label:"Or borrow one of ours"}),at]}),n&&q.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":V,style:B,children:q.map(qe=>o.jsx(QL,{product:qe,variant:"use",size:"grid",onUse:m,onOpen:me,href:wa(e,qe.id),bookmarked:P.includes(qe.id),onBookmark:M},qe.id))}),n&&z&&o.jsx(ko,{shape:"zero",title:"Nothing in Keepers yet",body:"Keep a product from its card and it stays here.",mark:fy,action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>k({bookmarked:null}),children:"Browse every product"})}),n&&!z&&oe.length===0&&q.length===0&&o.jsx(t2,{noun:"products",q:w,facet:A?"Keepers":E?lf(E):null,onClearSearch:S,onClearAll:C})]}),o.jsxs("div",{className:"sc-wall-dock",children:[j.kind==="product"&&j.ids.size>0&&o.jsx(py,{count:j.ids.size,loaded:ae.length,tool:as("product",j.ids.size).tool,icon:as("product",j.ids.size).icon,danger:!0,onAct:Lt,keep:{label:Se.tool,filled:Mt,onAct:$t},onClear:j.clear,onSelectAll:()=>j.selectAll("product",ae.map(qe=>qe.id))}),o.jsx(dy,{})]})]})})}function Jce({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(P=>P.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:C}=sL(e.length),E=A=>{const P=A==null?void 0:A[0];P&&(i==null||i(P))};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(),E(A.dataTransfer.files)},children:[o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:a,onChange:A=>{E(A.target.files),A.target.value=""}}),a?o.jsx(Rr,{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(Na,{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:()=>C(-1),children:o.jsx(Aa,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-refrail-arrow next","aria-label":"Next references",onClick:()=>C(1),children:o.jsx(vl,{size:13,weight:"bold"})}),o.jsx("div",{className:"sc-refrail",ref:S,children:e.map((A,P)=>o.jsx("button",{type:"button",className:"sc-refrail-item","data-on":(p==null?void 0:p.file)===A.file?"":void 0,"data-spare":P>=t?"":void 0,"aria-label":`Reference ${P+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=>{E(A.target.files),A.target.value=""}}),a?o.jsx(Rr,{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($I,{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 eue({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 tue({value:e,onChange:t}){const n=lf(e)??"Other",r=e&&of.some(a=>a.key===e)?e:"other";return o.jsxs(ys,{children:[o.jsx(bs,{children:o.jsxs("button",{type:"button",className:"sc-pdetails-field sc-catpick","aria-label":`Category: ${n}`,children:[n,o.jsx(ul,{size:11,weight:"bold"})]})}),o.jsx(xs,{align:"center",sideOffset:8,children:o.jsx(cp,{value:r,children:of.map(a=>o.jsx(Pu,{value:a.key,onSelect:()=>t(a.key),children:a.label},a.key))})})]})}const r6='mm|cm|inches|inch|in|m|"';function u9(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 wf(e){const t=Number(e.trim().replace(",","."));return e.trim()&&Number.isFinite(t)&&t>0?String(t):""}const o1=["height","width","depth"],Z4={height:"Height",width:"Width",depth:"Depth"};function JL(e){var f,h,p,m,g,w;const t={unit:"cm",height:"",width:"",depth:""},n=e.trim();if(!n||!new RegExp(r6,"i").test(n))return t;const r={},a=(y,b)=>{if(r[b])return;const k=n.match(new RegExp(`(\\d+(?:[.,]\\d+)?)\\s*(${r6})?\\s*(?:${y})\\b`,"i"));if(!k)return;const S=wf(k[1]);S&&(r[b]={value:S,unit:u9(k[2])})};a("tall|high","height"),a("across|wide","width"),a("long","width"),a("deep","depth");const i=o1.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*(${r6})?`,"gi"))){const b=wf(y[1]);b&&l.push({value:b,unit:u9(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 nue(e){const t=JL(e),n=o1.flatMap(i=>t[i]?[`${Z4[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 rue={height:"tall",width:"across",depth:"deep"};function sue(e){return o1.map(t=>{const n=wf(e[t]);return n?`${n} ${e.unit} ${rue[t]}`:""}).filter(Boolean).join(" and ")}function aue(e,t){return o1.every(n=>wf(e[n])===wf(t[n]))}function oue({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(()=>JL(u)),[h,p]=s.useState(f),[m,g]=s.useState(l),w=(S,C)=>S.trim().toLowerCase()===C.trim().toLowerCase(),y=aue(h,f)?u:sue(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(Fs,{className:"sc-newdlg sc-pdetails",maxWidth:"min(460px, 94vw)",onDismiss:i,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ks,{className:"sc-newdlg-title",children:"Details"}),o.jsx(Ss,{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(tue,{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:o1.map(S=>o.jsxs("label",{className:"sc-size-dim",children:[o.jsx("span",{className:"sc-size-name",children:Z4[S]}),o.jsxs("span",{className:"sc-size-box",children:[o.jsx("input",{className:"sc-pdetails-field",inputMode:"decimal","aria-label":Z4[S],value:h[S],onChange:C=>p({...h,[S]:C.target.value}),onKeyDown:C=>C.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 iue=3;function lue(e){const t=e,n=(t.brand??t.vendor??"").trim();return!n||e.name.toLowerCase().startsWith(n.toLowerCase())?null:n}function cue(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 uue(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 due(){var Je;const{productId:e=""}=Qs(),{brand:t,products:n,productsLoaded:r,refreshProducts:a}=un(),{demoProducts:i,demoProductsLoaded:l,applyBrand:u,refreshBrands:f}=Dn(),h=Bn(),p=qL(),{push:m}=rr(),[g,w]=s.useState(!1),[y,b]=s.useState(!1),[k,S]=s.useState(null),C=s.useRef(null),E=s.useRef({}),A=s.useRef(!1),P=n2(),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 Ne.libraryProduct(t.id,T.id).then(et=>{ge&&j(et.product)}).catch(()=>{}),()=>{ge=!1}},[t.id,T]);const R=M&&T&&M.id===T.id?{...M,...T,shots:M.shots}:T,L=s.useMemo(()=>R?void 0:i.find(ge=>ge.id===e),[R,i,e]);Ic((Je=R??L)==null?void 0:Je.name);const[H,D]=s.useState([]);s.useEffect(()=>{if(!L){D([]);return}let ge=!0;return Ne.demoProductFrames(L.id).then(et=>{ge&&D(et.frames)}).catch(()=>{ge&&D([])}),()=>{ge=!1}},[L==null?void 0:L.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 W=vy(t.id,[e??""]),[K,F]=s.useState(null),[_,O]=s.useState(!1),[Y,z]=s.useState(!1),[X,Z]=s.useState(null),J=!!(R??L);s.useEffect(()=>{if(F(null),!J||!e)return;let ge=!0;return Ne.productSize(t.id,e).then(et=>{ge&&F(et.size)}).catch(()=>{}),()=>{ge=!1}},[t.id,e,J]);const me=async ge=>{if(!e)return!1;const et=P();z(!0),Z(null);try{const nt=await Ne.setProductSize(t.id,e,ge);return et()&&(F(nt.size),O(!1)),!0}catch(nt){return Z(String(nt.message??nt)),!1}finally{z(!1)}},ne=((R==null?void 0:R.origin)??"manual")==="manual",fe=async(ge,et)=>{et&&ge&&typeof ge=="object"&&"json"in ge?u(ge):await a()},re=ge=>{if(!R||A.current)return;E.current={...E.current,...ge},C.current&&clearTimeout(C.current);const et=t.id,nt=R.id,pt=ne;C.current=setTimeout(()=>{C.current=null;const St=E.current;E.current={},(pt?Ne.updateProduct(et,nt,St):Ne.updateCatalogProduct(et,nt,St)).then(_t=>fe(_t,pt)).catch(_t=>S(String(_t.message??_t)))},500)},ee=async ge=>{const et=(K==null?void 0:K.text)??"",nt=ge.size.trim().toLowerCase()!==et.trim().toLowerCase();nt&&!await me(ge.size)||(ge.category!==(Be??"other")&&re({category:ge.category}),nt||O(!1))},Q=async ge=>{const et=ne;w(!0),S(null);try{await fe(await ge,et)}catch(nt){S(String(nt.message??nt))}finally{w(!1)}},he=async()=>{if(!R||A.current)return;A.current=!0,C.current&&clearTimeout(C.current),C.current=null,E.current={};const ge=P(),et=_u(t),nt=R.origin==="catalog"||R.id.startsWith("cat-");b(!0),S(null);try{nt?(await Ne.deleteCatalogProduct(t.id,R.id),await a()):u(await Y6(t.id,R.id))}catch(pt){if((pt==null?void 0:pt.status)!==404){A.current=!1,ge()&&(S(String(pt.message??pt)),b(!1));return}await Promise.all([f(),a()])}ge()&&h(et,{replace:!0})};if(!R&&!L&&(!l||!r))return o.jsx(ls,{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&&!L)return o.jsx(ls,{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:_u(t),children:"Browse products"})})]})});const Me=L?"none":ne?"full":"fields",ce=R??L,ke=(R==null?void 0:R.id)??L.id,Be=R?Pw(R):(L==null?void 0:L.category)??null,ft=lue(ce),Ue=ge=>{const et=qr(ge.file);return et?[{file:ge.file,url:et,angle:ge.angle}]:[]},Qe=L?H.map(ge=>({file:ge.angle,url:ge.url,angle:ge.angle})):((R==null?void 0:R.shots)??[]).flatMap(Ue),Pe=ge=>{const et=Qe.map(pt=>pt.file),nt=et.indexOf(ge)+1;Q(Ne.setProductShots(t.id,ke,et.filter(pt=>pt!==ge))).then(()=>m({kind:"success",title:"Reference removed",detail:`Reference ${nt} of ${et.length}`,action:{label:"Undo",onClick:()=>void Q(Ne.setProductShots(t.id,ke,et))}}))},G=L?"Our reference set. Yours replaces it.":Qe.length===0?ne?"No reference yet.":"No reference yet. Images from your store are still arriving.":Qe.length===1?"One angle. A shot has to guess at every side it can't see.":Qe.length===2?"Two angles. A third pins the shape.":"The first three build every shot. Remove any that show a different colour or version.",se=Me==="none"?null:"Add image",We=R!=null&&R.descriptionHtml?uue(cue(R.descriptionHtml),200):"",Ze=(L==null?void 0:L.description)||We||null,oe=nue((K==null?void 0:K.text)??""),q=L?[L.subcategory]:[R==null?void 0:R.variant,R==null?void 0:R.material,oe.length?null:R==null?void 0:R.dimensions],ae=lf(Be),Le=q.filter(Boolean),Ie=L?i.filter(ge=>ge.id!==ke).slice(0,8):n.filter(ge=>ge.id!==ke).slice(0,8);return o.jsx(ls,{children:o.jsxs("main",{className:"sc-lookpage sc-productpage",id:"main",children:[o.jsx(wy,{to:_u(t),wall:"Products",where:L?"Scenri library":ne?"Yours":"From your store"}),ft&&o.jsx("p",{className:"sc-lookpage-house",children:o.jsx("em",{className:"sc-accent",children:ft})}),Me==="full"?o.jsx(eue,{label:"Product name",value:B,onChange:ge=>{V(ge),re({name:ge})}}):o.jsx("h1",{dir:"auto",children:ce.name}),(ae||oe.length>0)&&o.jsxs("div",{className:"sc-lookpage-marks",children:[ae&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Filed under",children:o.jsx("li",{className:"sc-chip","data-static":!0,children:ae})}),oe.length>0&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Size",children:oe.map(ge=>o.jsx("li",{className:"sc-chip","data-static":!0,children:ge},ge))})]}),Ze&&o.jsx("p",{className:"sc-lookpage-lede",children:Ze}),Le.length>0&&o.jsx("p",{className:"sc-lookpage-facts",children:Le.join(" · ")}),o.jsxs("div",{className:"sc-lookpage-acts",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>p(ke),children:"Use in a shot"}),o.jsx(yy,{kind:"product",brandId:t.id,id:ke}),Me!=="none"&&o.jsx(dr,{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(fd,{size:17})})})]}),k&&o.jsx("p",{className:"sc-assetform-err",children:k}),o.jsx(Jce,{refs:Qe,cap:iue,note:G,addLabel:se,busy:g,onAdd:Me==="none"?void 0:ge=>void Q(jG(t.id,ke,ge)),onPromote:Me==="none"?void 0:ge=>void Q(Ne.setProductShots(t.id,ke,[ge,...Qe.map(et=>et.file).filter(et=>et!==ge)])),onRemove:Me==="none"?void 0:Pe}),W.length>0&&o.jsx(Wu,{label:`Shots featuring ${ce.name}`,children:W.map(ge=>o.jsx(Mw,{node:ge,to:Nm(t,null,ge.id)},ge.id))}),Ie.length>0&&o.jsx(Wu,{label:L?"Other products in the library":"Other products",children:Ie.map(ge=>L?o.jsx(QL,{product:ge,variant:"navigate",size:"slider",onOpen:et=>h(wa(t,et)),href:wa(t,ge.id)},ge.id):o.jsx(XL,{product:ge,variant:"navigate",size:"slider",onOpen:et=>h(wa(t,et)),href:wa(t,ge.id)},ge.id))}),_&&o.jsx(oue,{size:K,category:Be,busy:Y,error:X,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(Qn,{label:"Delete product",title:`Delete ${R.name}?`,body:vi("product",1),busy:y,onConfirm:()=>void he()})})})]})})}function fue(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 hue=[{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 pue({open:e,onOpenChange:t}){return o.jsx(aw,{open:e,onOpenChange:t,children:o.jsxs(ow,{maxWidth:"360px","aria-describedby":void 0,children:[o.jsx(iw,{children:"Shortcuts"}),o.jsx("div",{className:"sc-keys",children:hue.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 Ny({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=o4(f,H0(f),n,null),p=f.getBoundingClientRect();h.size(p.width,p.height),h.draw(performance.now()/1e3);const m=g=>h.draw(g);return aM(m),()=>oM(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=Vq(f,h,H0(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(C){y+=Math.min(50,Math.max(0,C-b)),b=C;const E=Math.min(1,y/w.ms);w.draw(E),E<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 s6=NM,mue=MM;function gue({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(()=>s6(h)),[k,S]=s.useState(h);h!==k&&(S(h),m(!1),w(!1),b(s6(h)));const C=s.useRef(null),E=s.useCallback(()=>{mue(h),m(!0)},[h]),A=s.useCallback(j=>{C.current=j,j!=null&&j.complete&&j.naturalWidth&&E()},[E]);s.useLayoutEffect(()=>{const j=C.current;j!=null&&j.complete&&j.naturalWidth&&E()},[E]);const[P,T]=s.useState(()=>!i||rf()?null:s6(h)?d9(h)!==void 0?"run":null:"hold");P==="hold"&&p&&(e$.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(Na,{className:"sc-cellimg-broken",size:24,weight:"regular","aria-hidden":!0}):o.jsxs(o.Fragment,{children:[!p&&!y&&P!=="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:()=>E(),onError:()=>{t&&!u?f(!0):w(!0)}}),P&&o.jsx(Ny,{img:C,ready:P==="run",index:l,since:d9(h),onDone:M})]})})}const e$=new Map,d9=e=>{const t=e$.get(e);return t!==void 0&&performance.now()-t<2e3?t:void 0};function t$({name:e}){return o.jsx(Uu,{name:e})}function vue({node:e,chosen:t,picking:n,batching:r,armed:a,menu:i,onPick:l,onBranch:u,onToggleKeep:f,onArchive:h,onDelete:p}){const m=Tr(e),g=Ew(),w=(b,k)=>mM(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=$r(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(Gn,{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(Gn,{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(ys,{children:[w("More",o.jsx(bs,{children:o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-more","aria-label":`More for ${m}`,children:o.jsx(dv,{size:16,weight:"bold"})})})),o.jsx(xs,{align:"end",sideOffset:4,collisionPadding:12,children:i.map(b=>o.jsxs("span",{style:{display:"contents"},children:[b.separated&&o.jsx(dc,{}),o.jsxs(Xn,{color:b.danger?"red":void 0,onSelect:b.onSelect,children:[o.jsx(t$,{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(hE,{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(q7,{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(wl,{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(qp,{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(Ga,{size:15,weight:e.kept?"fill":"regular"})}))]})})]})}function n$(e,t){return e>1?`Remove ${e} shots from ${t}`:`Remove from ${t}`}function Lh(e,t,n){return e>1?n(e):t}function wue(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),C=!!(S&&b&&b.count>1);l&&k.push({key:"pick",icon:"select",label:t?C?"Deselect this shot":"Deselect":"Select",onSelect:()=>l(e.id)});const E=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:Lh(b.count,E(b.allKept),M=>A(b.allKept,M)),onSelect:b.onKeep,separated:C}):f&&k.push({key:"keep",icon:e.kept?"kept":"keep",label:E(e.kept),onSelect:()=>f(e)});const P=S?b==null?void 0:b.onRemoveFromSet:y,T=S?g?[g]:[]:g?[g]:w??[];if(P)for(const M of T)k.push({key:`unset-${M.id}`,icon:"unset",label:n$(S&&b?b.count:1,M.name),onSelect:()=>P(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?Lh(b.count,"Restore",M=>`Restore ${M} shots`):Lh(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:Lh(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 r$(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:li((l=e.brief)==null?void 0:l.format),guess:!0}}const yue=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=wue(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(Zf,{children:[o.jsx(zf,{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"} ${Tr(t)}`:`Open ${Tr(t)}`,onClick:w=>{var y;l&&(w.preventDefault(),(y=f.onPick)==null||y.call(f,t.id))},children:o.jsx(gue,{src:gn(t.images[0],"tile"),fallback:$r(t.images[0]),arrival:bue(t),index:t.batchIndex,...r$(t,0)})}),o.jsx(vue,{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(Bf,{children:g.map(w=>o.jsxs("span",{style:{display:"contents"},children:[w.separated&&o.jsx(Cm,{}),o.jsxs(Uf,{color:w.danger?"red":void 0,onSelect:w.onSelect,children:[o.jsx(t$,{name:w.icon}),w.label]})]},w.key))})]})});function bue(e){const t=Za(za(e));return Number.isFinite(t)&&Date.now()-(t+(e.durationMs??0))<9e4}const xue=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":li((i=t.brief)==null?void 0:i.format)},children:[o.jsxs(Zn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${Tr(t)}, still rendering`,children:[o.jsx(Ca,{index:t.batchIndex,since:za(t)}),o.jsx(tL,{since:za(t)})]}),a&&o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-cancel",onClick:()=>a(t),children:"Cancel"})]})}),kue=s.memo(function({node:t,selected:n,shotHref:r,engineName:a,onRetry:i,onArchive:l}){var h;const u=t.status==="cancelled",f=u?PN():ro(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":li(t.brief.format)}:void 0,children:[o.jsx(Zn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${Tr(t)}`}),o.jsx("span",{className:"sc-cell-failed",children:o.jsx(kN,{failure:f,density:"tile",onRetry:()=>i(t),dismiss:l?{label:t.archived?"Restore":"Dismiss",onClick:()=>l(t)}:void 0})})]})}),Sue=40,Eue=1,f9=64,Cue=e=>e>Sue,jue=e=>Math.floor(e/f9)*f9,Aue=112;function $h(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,Aue):i)+Bu}function h9(e){const t=new Array(e.length+1);let n=0;for(let r=0;r<e.length;r++)t[r]=n,n+=e[r];return t[e.length]=n,t}function Nue(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 p9(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 Mue(e,t){const n=t*Eue;return[e-n,e+t+n]}function My(e){const t=e.getBoundingClientRect().top,n=e.querySelector(".sc-toolbar");return n?Math.max(t,n.getBoundingClientRect().bottom):t}function Rue(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?Pue(e,My(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:jue(h.scrollTop-k),height:h.clientHeight};r(C=>C.top===S.top&&C.height===S.height?C: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 Pue(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 Lue(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+Bu},[n])}function $ue({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:C,onNearEnd:E,inSet:A,setsFor:P,onRemoveFromSet:T,onKeepPicked:M,onArchivePicked:j,onRestorePicked:R,onDeletePicked:L,onRemovePickedFromSet:H}){const D=e.filter(q=>q.kind!=="root"),B=!!p,V=B&&((h==null?void 0:h.size)??0)>0,W=s.useMemo(()=>{if(!h||h.size===0)return null;let q=0,ae=0,Le=0;for(const Ie of e)!h.has(Ie.id)||Ie.kind==="root"||(q+=1,Ie.kept&&(ae+=1),Ie.archived&&(Le+=1));return{count:h.size,allKept:q>0&&ae===q,archived:q>0&&Le===q}},[e,h]),[K,F]=s.useState(null),[_,O]=s.useState(!1),[Y,z]=s.useState(null),{tile:X,cols:Z}=yX(vX(Y),S,wX()<pX),[J,me]=s.useState(null);s.useEffect(()=>{if(!J||!E)return;const q=J.closest(".sc-canvas"),ae=new IntersectionObserver(Le=>{Le.some(Ie=>Ie.isIntersecting)&&E()},{root:q,rootMargin:"200% 0px"});return ae.observe(J),()=>ae.disconnect()},[J,E]);const ne=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:L,onRemovePickedFromSet:H});ne.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:L,onRemovePickedFromSet:H};const fe=!!f,re=!!L,ee=s.useMemo(()=>({onOpen:q=>ne.current.onOpen(q),shotHref:q=>ne.current.shotHref(q),onRetry:q=>ne.current.onRetry(q),onCancel:i?q=>{var ae,Le;return(Le=(ae=ne.current).onCancel)==null?void 0:Le.call(ae,q)}:void 0,onToggleKeep:l?q=>{var ae,Le;return(Le=(ae=ne.current).onToggleKeep)==null?void 0:Le.call(ae,q)}:void 0,onArchive:u?q=>{var ae,Le;return(Le=(ae=ne.current).onArchive)==null?void 0:Le.call(ae,q)}:void 0,onBranch:w?q=>{var ae,Le;return(Le=(ae=ne.current).onBranch)==null?void 0:Le.call(ae,q)}:void 0,onPick:p?q=>{var ae,Le;return(Le=(ae=ne.current).onPick)==null?void 0:Le.call(ae,q)}:void 0,onVersions:b?q=>{var ae,Le;return(Le=(ae=ne.current).onVersions)==null?void 0:Le.call(ae,q)}:void 0,onDeleteAsk:fe?q=>F(q):void 0,engineName:k?q=>{var ae,Le;return(Le=(ae=ne.current).engineName)==null?void 0:Le.call(ae,q)}:void 0,onRemoveFromSet:T?(q,ae)=>{var Le,Ie;return(Ie=(Le=ne.current).onRemoveFromSet)==null?void 0:Ie.call(Le,q,ae)}:void 0,onKeepPicked:M?()=>{var q,ae;return(ae=(q=ne.current).onKeepPicked)==null?void 0:ae.call(q)}:void 0,onArchivePicked:j?()=>{var q,ae;return(ae=(q=ne.current).onArchivePicked)==null?void 0:ae.call(q)}:void 0,onRestorePicked:R?()=>{var q,ae;return(ae=(q=ne.current).onRestorePicked)==null?void 0:ae.call(q)}:void 0,onDeletePickedAsk:re?()=>O(!0):void 0,onRemovePickedFromSet:H?q=>{var ae,Le;return(Le=(ae=ne.current).onRemovePickedFromSet)==null?void 0:Le.call(ae,q)}:void 0}),[!!i,!!l,!!u,!!w,!!p,!!b,fe,re,!!k,!!T,!!M,!!j,!!R,!!H]),Q=[...g?Array.from({length:Math.max(1,g.count)},(q,ae)=>({key:`sending-${ae}`,node:null,said:g.said,slot:ae})):[],...D.map(q=>({key:q.id,node:q}))],he=q=>q.status==="cancelled"||q.status==="error"||q.images.length===0,Me=q=>{const ae=q.node;return ae?ae.status==="running"?o.jsx(xue,{node:ae,selected:ae.id===t,shotHref:ee.shotHref,onCancel:ee.onCancel},ae.id):he(ae)?o.jsx(kue,{node:ae,selected:ae.id===t,shotHref:ee.shotHref,engineName:ee.engineName,onRetry:ee.onRetry,onArchive:ee.onArchive},ae.id):o.jsx(yue,{node:ae,selected:ae.id===t,armed:ae.id===y,chosen:(h==null?void 0:h.has(ae.id))??!1,picking:B,batching:V,versions:ae.childCount,handlers:ee,inSet:A,filedIn:P==null?void 0:P(ae.id),pickedMeta:W},ae.id):o.jsxs("div",{className:"sc-cell","data-running":"true","data-sending":"true",style:g!=null&&g.format?{"--sc-cell-ar":li(g.format)}:void 0,children:[o.jsx(Ca,{index:q.slot,appear:!0}),o.jsx("span",{className:"sc-cell-tag",children:"sending"}),o.jsx("span",{className:"sc-cell-said",dir:"auto",children:q.said})]},q.key)},ce=q=>{var Le,Ie;const ae=q.node;return ae?ae.status==="running"?$h("running",li((Le=ae.brief)==null?void 0:Le.format),X):he(ae)?$h("failed",(Ie=ae.brief)!=null&&Ie.format?li(ae.brief.format):3/2,X):$h("done",r$(ae,0).aspect,X):$h("sending",void 0,X)},ke=Cue(Q.length),Be=Rue(Y,ke),ft=Lue(Y,ke,X),Ue=M5(Z),Qe=`${Ue}:${X}`,Pe=s.useRef(Qe),G=s.useRef({items:Q,heightOf:ft,estimate:ce});G.current={items:Q,heightOf:ft,estimate:ce};const se=s.useRef(null);if(s.useLayoutEffect(()=>{const q=Pe.current;Pe.current=Qe;const ae=Be.anchor.current,Le=Y==null?void 0:Y.closest(".sc-canvas");if(!(q===Qe||!ae||!Y||!Le)){if(se.current={anchor:ae,until:performance.now()+Tue},Be.hold(ae,se.current.until),!m9(Y,Le,ae)){const{items:Ie,heightOf:Je,estimate:ge}=G.current,et=Ie.findIndex(at=>{var _t;return((_t=at.node)==null?void 0:_t.id)===ae.id});if(et<0)return;const nt=p9(Ie.length,Ue)[et%Ue],pt=h9(nt.map(at=>(Ie[at].node&&Je(Ie[at].node.id))??ge(Ie[at]))),St=Y.getBoundingClientRect().top+pt[Math.floor(et/Ue)];Le.scrollTop+=St-My(Le)-ae.offset}Be.resync()}},[Qe,Ue,Y,Be.anchor,Be.resync,Be.hold]),s.useLayoutEffect(()=>{const q=se.current,ae=Y==null?void 0:Y.closest(".sc-canvas");if(!(!q||!Y||!ae)){if(performance.now()>q.until){se.current=null;return}m9(Y,ae,q.anchor)}}),s.useEffect(()=>{const q=Y==null?void 0:Y.closest(".sc-canvas");if(!q)return;const ae=()=>{se.current=null,Be.hold(null)},Le=["wheel","touchstart","keydown","pointerdown"];for(const Ie of Le)q.addEventListener(Ie,ae,{passive:!0});return()=>{for(const Ie of Le)q.removeEventListener(Ie,ae)}},[Y,Be.hold]),C&&a5(D)&&!g){const q=Math.max(1,Math.min(Z,8));return o.jsx("div",{className:"sc-feed","aria-busy":"true",ref:z,style:{"--sc-tile":`${X}px`,"--sc-cols":q},children:Array.from({length:q},(ae,Le)=>o.jsx("div",{className:"sc-feed-col",children:Array.from({length:2},(Ie,Je)=>o.jsx("div",{className:"sc-cell sc-wait-late","data-placeholder":"true",children:o.jsx("span",{className:"sc-placeholder"})},`pending-${Le}-${Je}`))},`col-${q}-${Le}`))})}if(a5(D)&&!g)return o.jsx(o.Fragment,{children:m??o.jsx("p",{className:"sc-feed-empty",children:"Nothing here yet."})});const We=M5(Z),Ze=p9(Q.length,We),oe=ke?Mue(Be.top,Be.height):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-feed",ref:z,style:{"--sc-tile":`${X}px`,"--sc-cols":We},children:Ze.map((q,ae)=>{const Le=`col-${We}-${ae}`;if(!oe)return o.jsx("div",{className:"sc-feed-col",children:q.map(nt=>Me(Q[nt]))},Le);const Ie=q.map(nt=>(Q[nt].node&&ft(Q[nt].node.id))??ce(Q[nt])),Je=h9(Ie),[ge,et]=Nue(Je,oe[0],oe[1]);return o.jsxs("div",{className:"sc-feed-col",children:[ge>0&&o.jsx("div",{className:"sc-feed-pad",style:{height:Je[ge]},"aria-hidden":!0}),q.slice(ge,et).map(nt=>Me(Q[nt])),et<q.length&&o.jsx("div",{className:"sc-feed-pad",style:{height:Je[q.length]-Je[et]},"aria-hidden":!0})]},Le)})}),E&&o.jsx("div",{className:"sc-feed-end",ref:me,"aria-hidden":!0}),o.jsx(Df,{open:!!K||_,onOpenChange:q=>{q||(F(null),O(!1))},children:o.jsxs(Hf,{maxWidth:"420px",children:[o.jsx(Of,{children:_?`Delete ${(W==null?void 0:W.count)??0} shot${((W==null?void 0:W.count)??0)===1?"":"s"} permanently?`:"Delete this shot permanently?"}),o.jsx(If,{size:"2",children:"This cannot be undone."}),o.jsxs(Ts,{gap:"3",mt:"4",justify:"end",children:[o.jsx(_f,{children:o.jsx(va,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Ff,{children:o.jsx(va,{color:"red",onClick:()=>{_?L==null||L():K&&(f==null||f(K)),F(null),O(!1)},children:"Delete permanently"})})]})]})})]})}const Tue=800;function m9(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-My(t)-n.offset;return Math.abs(a)>=1&&(t.scrollTop+=a),!0}function Due(e){return e==="open"||e==="result"?"open":"compact"}function z4({name:e,kind:t,count:n,mode:r,onToggle:a,action:i,children:l}){const u=Due(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(ul,{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 s$({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(Na,{size:14})}),o.jsx("span",{className:"sc-acard-tick","aria-hidden":!0,children:o.jsx(Gn,{size:10,weight:"bold"})})]}),n&&o.jsxs("span",{className:"sc-acard-label",children:[e.bookmarked&&o.jsxs(o.Fragment,{children:[o.jsx(Ga,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Kept. "})]}),e.label]})]});return o.jsx(_P,{why:r?a:null,children:l})}function a6({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(Hp);return s.useEffect(()=>{a!=="open"&&y(Hp)},[a]),a==="result"&&n.length===0?null:o.jsx(z4,{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}=Hoe(n,g,b==="open"?w:T4);return o.jsxs("div",{className:b==="open"?"sc-acard-grid":"sc-arow",children:[k.map(C=>o.jsx(s$,{candidate:C,on:g.has(C.id),named:b==="open",disabled:!!f&&!g.has(C.id),title:f??void 0,onClick:()=>g.has(C.id)?u(C.id):l(C.id)},C.id)),b==="open"&&S>0&&o.jsxs("button",{type:"button",className:"sc-amore-tile",onClick:()=>y(C=>C+_0),"aria-label":`Show ${Math.min(S,_0)} more ${h}`,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",S]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})}})}const g9=220,v9="cubic-bezier(0.32, 0.72, 0, 1)";function o6(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 Hue(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 o6(a))for(const l of[...i.body.getAnimations(),...i.group.getAnimations()])l.finish();n.current=o6(a)}};return s.useLayoutEffect(()=>{const a=n.current;n.current=null;const i=e.current;if(!(!a||!i))for(const l of o6(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:g9,easing:v9}),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:g9,easing:v9})}}},[t]),r}function Oue({brand:e,shots:t,shotsTotal:n,attached:r=GP,full:a,onToken:i,offToken:l,onTemplate:u,offTemplate:f,onClose:h}){const p=n1(),m=Pl(),{applyBrand:g}=Dn(),{push:w}=rr(),[y,b]=cG(Kr.assetsExpanded,null),k=s.useRef(null),S=Hue(k,y),C=Z=>{S(),b(J=>J===Z?null:Z)},[E,A]=s.useState(""),P=E.trim().length>0,T=Z=>{S(),A(""),b(Z)},M=Z=>P?"result":y===null?"idle":y===Z?"open":"collapsed",j=s.useMemo(()=>new Set(gi(e.id)),[e.id]),R=s.useMemo(()=>{const Z=J=>{const me=nl(J,p);return qm(J,me,{currentId:null,query:"",bookmarked:j,shown:me.length}).items};return{product:Z("product"),presenter:Z("presenter"),scene:Z("scene")}},[p,j]),L=s.useMemo(()=>({product:Xu(R.product,E),presenter:Xu(R.presenter,E),scene:Xu(R.scene,E)}),[R,E]),H=s.useMemo(()=>{var Z;return qs((Z=e.json)==null?void 0:Z.palette)},[e]),D=s.useMemo(()=>P?H.filter(Z=>Ro(`${Z.name} ${Z.hex}`,E)):H,[H,E,P]),B=Z=>{(async()=>{var me;const J=VM((me=e.json)==null?void 0:me.palette,Z);if(J.swatch){if(J.added)try{const ne=await Ne.updateBrand(e.id,{...e.json??{},palette:J.palette},e.json);g(ne)}catch(ne){w(cn(ne,"Could not save the brand"));return}T("colors")}})()},V=Z=>{(async()=>{var me;const J=bQ((me=e.json)==null?void 0:me.palette,Z);if(J.removed)try{const ne=await Ne.updateBrand(e.id,{...e.json??{},palette:J.palette},e.json);g(ne)}catch(ne){w(cn(ne,"Could not save the brand"))}})()},W=M("shots")==="open",K=oy(e.id,"",W),F=s.useMemo(()=>{const Z=new Set,J=[];for(const me of[...t,...K.items])me.status!=="done"||me.images.length===0||Z.has(me.id)||(Z.add(me.id),J.push(me));return J},[t,K.items]),_=Math.max(n??0,K.total,F.length),[O,Y]=s.useState(Hp);s.useEffect(()=>{W||Y(Hp)},[W]);const z=()=>{Y(Z=>Z+_0),K.hasMore&&F.length<O+2*_0&&K.loadMore()},X=P&&!L.product.length&&!L.presenter.length&&!L.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(Rn,{size:12})})]}),o.jsx("div",{className:"sc-assets-searchbar",children:o.jsxs("div",{className:"sc-assets-search",children:[o.jsx(Ju,{size:12}),o.jsx("input",{value:E,onChange:Z=>A(Z.target.value),onKeyDown:Z=>{Z.key==="Escape"&&E&&(Z.stopPropagation(),A(""))},placeholder:"Search assets","aria-label":"Search assets in this panel"}),P&&o.jsx("button",{type:"button",className:"sc-assets-clear",onClick:()=>A(""),"aria-label":"Clear search",children:o.jsx(Rn,{size:11})})]})}),X&&o.jsxs("p",{className:"sc-assets-zero",children:["Nothing here matches “",E.trim(),"”."]}),o.jsx(a6,{kind:"product",title:"Products",items:L.product,attached:r.product,mode:M("product"),onToggle:C,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(a6,{kind:"presenter",title:"Presenters",items:L.presenter,attached:r.presenter,mode:M("presenter"),onToggle:C,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(a6,{kind:"scene",title:"Scenes",items:L.scene,attached:r.scene?[r.scene]:[],mode:M("scene"),onToggle:C,onPick:u,onUnpick:()=>f(),full:a,moreLabel:"scenes",createLabel:"Create scene",onCreate:()=>m("scene",{onCreated:Z=>{Z.kind==="scene"&&T("scene")}})}),!(P&&D.length===0)&&o.jsx(z4,{name:"Brand colors",count:D.length,mode:M("colors"),onToggle:()=>C("colors"),action:o.jsx(od,{className:"sc-aadd",triggerStyle:{background:"none"},value:_m(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,T4)).map(J=>{const me=r.color.includes(J.hex.toLowerCase());return o.jsxs("div",{className:"sc-aswatch-tile","data-on":me||void 0,children:[o.jsxs("button",{type:"button",title:`${J.name} ${J.hex}`,"aria-pressed":me,onClick:()=>me?l({t:"color",hex:J.hex,name:J.name}):i({t:"color",hex:J.hex,name:J.name}),children:[o.jsx("span",{className:"sc-aswatch",style:{background:J.hex}}),o.jsx("span",{className:"sc-acard-tick","aria-hidden":!0,children:o.jsx(Gn,{size:10,weight:"bold"})})]}),Z==="open"&&o.jsx("button",{type:"button",className:"sc-aswatch-x","aria-label":`Remove ${J.name}`,title:"Remove",onClick:()=>V(J.hex),children:o.jsx(Rn,{size:10,weight:"bold"})})]},J.hex)})})}),F.length>0&&!P&&o.jsx(z4,{name:"Recent shots",count:_,mode:M("shots"),onToggle:()=>C("shots"),children:Z=>o.jsxs("div",{className:Z==="open"?"sc-acard-grid":"sc-arow",children:[F.slice(0,Z==="open"?O:T4).map((J,me)=>{const ne=J.images[0],fe=r.ref.includes(ne);return o.jsx(s$,{candidate:{label:`Shot ${_-me}`,full:`Shot ${_-me} · as reference`,thumb:gn(ne,"micro")},on:fe,named:Z==="open",disabled:!!a&&!fe,title:a??void 0,onClick:()=>fe?l({t:"ref",imageHash:ne}):i({t:"ref",imageHash:ne,label:"Shot"})},J.id)}),Z==="open"&&(F.length>O||K.hasMore)&&o.jsxs("button",{type:"button",className:"sc-amore-tile",onClick:z,"aria-label":`Show ${_0} more shots`,"aria-busy":K.loading||void 0,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",Math.max(1,_-Math.min(F.length,O))]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})})]})}function Iue({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:C,onSort:E,tile:A,onTile:P,assets:T,onAssets:M,showAssets:j}){const R=t?t.id:n?"__ungrouped__":"__all__",L=t?t.name:n?"Not in a set":"All shots",H=!!t||n,D=jr(ta),[B,V]=s.useState(!1),[W,K]=s.useState(!1),[F,_]=s.useState(!1),[O,Y]=s.useState(""),z=s.useRef(null),X=s.useRef(!1),Z=()=>{X.current=!0,K(!0),Y(""),V(!0)},J=()=>{t&&(X.current=!1,K(!1),Y(t.name),V(!0))};s.useEffect(()=>{m&&Z()},[m]);const me=()=>{const he=O.trim();if(!he)return;const Me=X.current;X.current=!1,K(!1),V(!1),Me?u(he):h==null||h(he)},ne=he=>{if(he){V(!0);return}const Me=X.current;X.current=!1,K(!1),V(!1),Me&&(f==null||f())},fe=dN.map(he=>({value:he.id==="all"?null:he.id,label:he.label,count:w==null?void 0:w[he.id]})),re=o.jsxs(o.Fragment,{children:[o.jsxs(cp,{value:R,children:[o.jsx(Pu,{value:"__all__",onSelect:a,children:"All shots"}),o.jsxs(Pu,{value:"__ungrouped__",onSelect:i,children:["Not in a set",r>0?` · ${r}`:""]}),e.length>0&&o.jsx(dc,{}),e.map(he=>o.jsx(Pu,{value:he.id,onSelect:()=>l(he),children:he.name},he.id))]}),o.jsx(dc,{}),o.jsx(Xn,{onSelect:()=>{f==null||f(),Z()},children:"New set"}),t&&h&&o.jsx(Xn,{onSelect:J,children:"Rename"}),t&&p&&o.jsx(Xn,{color:"red",onSelect:()=>_(!0),children:"Delete set"})]}),ee=o.jsx(cp,{value:C,onValueChange:he=>E(he),children:uN.map(he=>o.jsx(Pu,{value:he.id,children:he.label},he.id))}),Q=H||C!=="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(Aa,{size:16})}),o.jsxs(ys,{children:[o.jsx(bs,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-place","data-on":H||void 0,"aria-label":L,children:[o.jsx(fv,{className:"sc-toolbar-place-ic",size:16}),o.jsx("span",{className:"sc-toolbar-place-t",children:L}),o.jsx(ul,{size:10,className:"sc-caret"})]})}),o.jsx(xs,{align:"start",children:re})]})]}),o.jsx(aw,{open:B,onOpenChange:ne,children:o.jsxs(ow,{maxWidth:"360px","aria-describedby":void 0,onOpenAutoFocus:he=>{he.preventDefault();const Me=z.current;Me&&(Me.focus(),Me.select())},children:[o.jsx(iw,{children:W?"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:he=>Y(he.target.value),onKeyDown:he=>{he.key==="Enter"&&me()}}),o.jsxs(Ts,{gap:"3",mt:"4",justify:"end",children:[o.jsx(va,{variant:"soft",color:"gray",onClick:()=>ne(!1),children:"Cancel"}),o.jsx(va,{onClick:me,disabled:!O.trim(),children:"Save"})]})]})}),o.jsx(Df,{open:F,onOpenChange:_,children:o.jsxs(Hf,{maxWidth:"420px",children:[o.jsx(Of,{children:"Delete this set?"}),o.jsx(If,{size:"2",children:"Shots stay in the library. Only the set goes."}),o.jsxs(Ts,{gap:"3",mt:"4",justify:"end",children:[o.jsx(_f,{children:o.jsx(va,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Ff,{children:o.jsx(va,{color:"red",onClick:()=>{p==null||p(),_(!1)},children:"Delete set"})})]})]})}),o.jsx(ay,{"aria-label":"Shot lenses",activeKey:g==="all"?null:g,items:fe,onSelect:he=>y(he??"all")})]}),o.jsxs("div",{className:"sc-toolbar-actions",children:[o.jsx(Cd,{value:b,onChange:k,noun:"shots",total:S}),D?o.jsxs(ys,{children:[o.jsx(bs,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-btn sc-toolbar-view","data-on":Q||void 0,"aria-label":`Set and sort: ${L}`,children:[o.jsx(hv,{size:15}),Q&&o.jsx("span",{className:"sc-toolbar-view-dot","aria-hidden":!0})]})}),o.jsxs(xs,{align:"end",children:[o.jsx(U6,{children:"Set"}),re,o.jsx(dc,{}),o.jsx(U6,{children:"Sort"}),ee]})]}):o.jsxs(ys,{children:[o.jsx(bs,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-btn","aria-label":"Sort shots",children:[o.jsx(TI,{size:14}),o.jsx("span",{className:"sc-toolbar-btn-t",children:"Sort"}),o.jsx(ul,{size:10})]})}),o.jsx(xs,{align:"end",children:ee})]}),o.jsx(kX,{value:A,onChange:P}),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(sF,{size:15,mirrored:!0})})]})]})}function Fue(e){const{push:t}=rr(),n=s.useCallback(l=>Ne.archiveNode(l.id,!0).then(u=>(e(u),t({kind:"success",title:"Archived",detail:Tr(l),action:{label:"Undo",onClick:()=>void Ne.archiveNode(l.id,!1).then(e)}}),!0)).catch(u=>(t(cn(u,"Could not archive this shot")),!1)),[e,t]),r=s.useCallback(l=>Ne.archiveNode(l.id,!1).then(u=>(e(u),!0)).catch(u=>(t(cn(u,"Could not restore this shot")),!1)),[e,t]),a=s.useCallback(l=>Promise.all(l.map(u=>Ne.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=>Ne.archiveNode(f.id,!1))).then(f=>{for(const h of f)e(h)})}}}),!0}).catch(u=>(t(cn(u,"Could not archive these shots")),!1)),[e,t]),i=s.useCallback(l=>Promise.all(l.map(u=>Ne.archiveNode(u,!1))).then(u=>{for(const f of u)e(f);return!0}).catch(u=>(t(cn(u,"Could not restore these shots")),!1)),[e,t]);return{archive:n,archiveBatch:a,unarchive:r,unarchiveBatch:i}}function _ue(e){const{push:t}=rr(),n=s.useCallback(a=>Ne.deleteNode(a.id).then(()=>e([a.id])).catch(i=>t(cn(i,"Could not delete this shot"))),[e,t]),r=s.useCallback(a=>Ne.deleteNodesBatch(a).then(()=>e(a)).catch(i=>t(cn(i,"Could not delete these shots"))),[e,t]);return{remove:n,removeBatch:r}}function Vue(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 Zue(e,t){const{product:n,presenter:r,scene:a}=Vue(e,t);return{productName:n?Mo(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?hi(r).src:null,presenterId:(r==null?void 0:r.id)??null,sceneName:a?pl(a,"chip"):null,scenePreviewUrl:(a==null?void 0:a.previewUrl)??null,sceneId:(a==null?void 0:a.id)??null}}function zue(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 C=()=>{const E=r.current;if(E===null)return;const A=E-p.scrollLeft;if(S+=1,Math.abs(A)<.5||S>45){p.scrollLeft=E,k(),l();return}p.scrollLeft+=A*.16,a.current=requestAnimationFrame(C)};a.current=requestAnimationFrame(C)},[u,l]);return{ref:t,page:f}}function Bue(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 Uue({entries:e,catalogs:t,stagedId:n,onUse:r,productHref:a,presenterHref:i,sceneHref:l}){const u=s.useMemo(()=>Bue(e).slice(0,10),[e]),{ref:f,page:h}=zue(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(Aa,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-shelf-arrow next","aria-label":"More examples",onClick:()=>h(1),children:o.jsx(vl,{size:13,weight:"bold"})}),o.jsx("div",{className:"sc-shelf-row",ref:f,children:[0,1,2].map(p=>u.map(m=>o.jsx(qP,{entry:m,size:"grid",hideRecipe:!0,decorative:p!==1,active:n===m.id,onOpen:()=>r(m),productHref:a,presenterHref:i,sceneHref:l,...Zue(m,t)},`${p}-${m.id}`)))})]})]})}function y0({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 Wue({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(bu,{label:"Restore",onClick:()=>g(m),children:o.jsx(U0,{size:17})}),o.jsx(bu,{label:`Delete ${e} permanently`,tone:"danger",onClick:()=>S(!0),children:o.jsx(wl,{size:17})})]}):o.jsxs(o.Fragment,{children:[o.jsx(bu,{label:h?"Remove from keepers":"Keep",onClick:u,children:o.jsx(Ga,{size:17,weight:h?"fill":"regular"})}),o.jsxs(ys,{children:[o.jsx(dr,{label:"Add to set",children:o.jsx(bs,{children:o.jsx("button",{type:"button",className:"sc-picked-tool","aria-label":"Add to set",children:o.jsx(fv,{size:17})})})}),o.jsxs(xs,{children:[t.filter(C=>C.id!==(n==null?void 0:n.id)).map(C=>o.jsx(Xn,{onSelect:()=>r(C),children:C.name},C.id)),t.some(C=>C.id!==(n==null?void 0:n.id))&&o.jsx(dc,{}),o.jsx(Xn,{onSelect:i,children:"New set…"})]})]}),n&&a&&o.jsx(bu,{label:n$(e,n.name),onClick:a,children:o.jsx(eE,{size:17})}),o.jsx(bu,{label:"Archive",tone:"danger",onClick:()=>f(m),children:o.jsx(qp,{size:17})})]})}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-exit",children:o.jsx(bu,{label:"Done",onClick:l,children:o.jsx(Rn,{size:16,weight:"bold"})})}),p&&o.jsx(Qn,{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 bu({label:e,tone:t,onClick:n,children:r}){return o.jsx(dr,{label:e,children:o.jsx("button",{type:"button",className:"sc-picked-tool","data-tone":t,"aria-label":e,onClick:n,children:r})})}function Kue(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 Gue(e){switch(e){case"oldest":return(t,n)=>Lu(n,t);case"cost":return(t,n)=>n.costUsd-t.costUsd||Lu(t,n);case"keepers":return(t,n)=>Number(n.kept)-Number(t.kept)||Lu(t,n);default:return Lu}}function a$(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 Yue(e,t){return t==="archived"?e.archived:t==="keepers"?!e.archived&&e.kept:!e.archived}function w9(e,t,n){var r;return(r=t.q)!=null&&r.trim()?null:a$(e,t,n)&&Yue(e,t.lens)}function y9(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 i6(e,t,n,r){if(!r)return e;const a=y9(t),i=y9(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 que(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}function B4(e,t){const n=e.findIndex(a=>a.id===t.id);if(n===-1||que(e[n],t))return e;const r=[...e];return r[n]=t,r}function b9(e,t){const n=new Set(t);return e.some(r=>n.has(r.id))?e.filter(r=>!n.has(r.id)):e}function Xue(e,t,n,r){if(e.some(u=>u.id===t.id))return B4(e,t);const a=Gue(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 Que(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 Jue(e,t){const n=new Set(t.map(r=>r.id));return[...t,...e.filter(r=>!n.has(r.id))]}const l6=60;function ede(e,t,n){const{shotsEpoch:r}=un(),a=`${Kue(e,t)}#${r}`,[i,l]=s.useState(()=>{const M=MS(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=MS(a);return j&&m.current.key!==a&&l({...j,error:null}),Ne.feed(e,{...g.current,limit:l6},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 L=String((R==null?void 0:R.message)??R);l(H=>H.key===a?{...H,error:L}:{brandId:e,key:a,items:[],next:null,counts:null,error:L})}).finally(()=>{M.signal.aborted||p(!1)}),()=>M.abort()},[e,a,u]),s.useEffect(()=>{i.key&&!i.error&&Yoe(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;Ne.feed(e,{...g.current,limit:l6,cursor:j}).then(R=>{l(L=>L.key!==a?L:{...L,items:Que(L.items,R.items),next:R.next,counts:R.counts??L.counts})}).catch(()=>{}).finally(()=>{y.current=!1,p(!1)})},[e,a]),S=s.useCallback(async()=>{const M=await Ne.feed(e,{...g.current,limit:l6});l(j=>j.key!==a?j:{...j,items:Jue(j.items,M.items),next:j.items.length?j.next:M.next,counts:M.counts??j.counts,error:null})},[e,a]),C=s.useCallback(M=>{l(j=>{const R=j.items.find(V=>V.id===M.id);if(!R)return j;const L=g.current,D=w9(M,L,w.current)===!1?b9(j.items,[M.id]):B4(j.items,M),B=j.counts?i6(j.counts,R,M,!0):j.counts;return D===j.items&&B===j.counts?j:{...j,items:D,counts:B}})},[]),E=s.useCallback((M,j)=>{let R=!1;l(L=>{let H=L.items,D=L.counts;const B=g.current;for(const V of M){if(H.some(_=>_.id===V.id)){H=B4(H,V);continue}const W=w9(V,B,w.current);if(W===null){R=!0;continue}const K=a$(V,B,w.current);W&&(H=Xue(H,V,B.sort,L.next===null));const F=(j==null?void 0:j.get(V.id))??null;D&&(D=i6(D,F,V,K))}return H===L.items&&D===L.counts?L:{...L,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 L=j.counts;if(L)for(const H of R)L=i6(L,H,null,!0);return{...j,items:b9(j.items,M),counts:L}})},[]),P=i.brandId===e?i.items:[],T=s.useMemo(()=>new Map(P.map(M=>[M.id,M])),[P]);return{items:P,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:C,insert:E,drop:A,refresh:S,retry:b}}function tde(){const e=mn(ht.hubShot),t=mn(ht.setShot);return(e==null?void 0:e.params.shotId)??(t==null?void 0:t.params.shotId)??null}function x9(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 Ne.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 o$({set:e}){const{engines:t,scenes:n,presenters:r,demoProducts:a,showcase:i,showcaseLoaded:l}=Dn(),{brand:u,workspace:f,root:h,recent:p,sets:m,membership:g,loaded:w,refresh:y,applySet:b,dropSet:k,insertSet:S,applyMembership:C,applyNodes:E,subscribeActivity:A,products:P}=un(),T=n,M=n1(),j=Bn(),[R,L]=gl(),H=tde(),[D,B]=s.useState(null),[V,W]=s.useState(!1);s.useEffect(()=>{const le=()=>W(!0);return window.addEventListener("scenri:shortcuts",le),()=>window.removeEventListener("scenri:shortcuts",le)},[]);const{open:K,toggle:F,setOpen:_}=ise(),O=jr("(min-width: 1280px)"),Y=O&&K,[z,X]=s.useState(null),[Z,J]=s.useState(GP),[me,ne]=s.useState(null),[fe,re]=s.useState(null),ee=s.useRef(!1);s.useEffect(()=>{if(!ee.current||H)return;ee.current=!1;const le=requestAnimationFrame(()=>{var De;return(De=et.current)==null?void 0:De.focus()});return()=>cancelAnimationFrame(le)},[H,fe]);const[Q,he]=s.useState(null),[Me,ce]=s.useState(new Set),[ke,Be]=Eh("tab","all"),[ft,Ue]=Eh("in",""),[Qe,Pe]=Eh("branch",""),[G,se]=Eh("lineage",""),[We,Ze]=Sa(Kr.tileSize,SM),oe=EM(We),{q,setQ:ae,clearSearch:Le}=r1([]),[Ie,Je]=Sa(Kr.feedSort,"newest"),ge=LG(Ie)?Ie:"newest",et=s.useRef(null),{push:nt}=rr(),{poke:pt}=ea(),[St,at]=s.useState(null),_t=(f==null?void 0:f.id)??"",Lt=e?S0(u,e):xr(u),Zt=s.useCallback(le=>{const De=R.toString();return`${Lt}/shots/${le}${De?`?${De}`:""}`},[Lt,R]),Mt=s.useCallback((le,De=!1)=>j(Zt(le),{replace:De}),[j,Zt]),$t=s.useCallback(()=>{const le=new URLSearchParams(R);le.delete("panel");const De=le.toString();j(`${Lt}${De?`?${De}`:""}`,{replace:!0})},[Lt,j,R]),Se=$G(ke)?ke:"all",Ke=!e&&ft==="ungrouped";s.useEffect(()=>{ke==="ungrouped"&&(Be(null),Ue("ungrouped"))},[ke,Be,Ue]);const kt=s.useMemo(()=>{const le=new Map;for(const De of m)for(const it of g[De.id]??[])le.has(it)||le.set(it,[]),le.get(it).push(De);return le},[m,g]),qe=s.useMemo(()=>({lens:Se,set:e==null?void 0:e.id,ungrouped:Ke||void 0,lineage:G||void 0,q:q.trim()||void 0,sort:ge}),[Se,e==null?void 0:e.id,Ke,G,q,ge]),ot=s.useRef(g);ot.current=g;const rt=s.useRef(kt);rt.current=kt;const tn=s.useRef(new Set),Qt=s.useMemo(()=>({inSet:le=>e?(ot.current[e.id]??[]).includes(le):!1,inAnySet:le=>rt.current.has(le),inLineage:le=>le.id===G||le.parentId!==null&&tn.current.has(le.parentId)}),[e==null?void 0:e.id,G]),on=ede(u.id,qe,Qt),{items:Wt,byId:zt,counts:Ut}=on,te=s.useRef(on);te.current=on,tn.current=s.useMemo(()=>new Set(Wt.map(le=>le.id)),[Wt]);const ie=s.useRef(new Map);s.useEffect(()=>{for(const le of Wt)ie.current.set(le.id,le)},[Wt]);const pe=s.useRef(null),[Fe,Oe]=s.useState("");s.useEffect(()=>A(le=>{const{messages:De,next:it}=fue(pe.current??new Map,le),Gt=pe.current===null;if(pe.current=it,!Gt&&De.length){const kn=De.join(" ");Oe(Zs=>Zs===kn?`${kn} `:kn)}const Yt=te.current;let _n=!1;const fn=[],Ln=new Map;for(const kn of le){if(Yt.byId.has(kn.id))Yt.patch(kn);else if(ie.current.has(kn.id)){const Zs=ie.current.get(kn.id);Zs&&Ln.set(kn.id,Zs),fn.push(kn)}else kn.kind!=="root"&&(_n=!0);ie.current.set(kn.id,kn)}fn.length&&Yt.insert(fn,Ln),_n&&Yt.ready&&Yt.refresh().catch(()=>{})}),[A]);const mt=w&&on.ready,yt=x9(G||null,zt);s.useEffect(()=>{!G||!yt.missing||(se(null),nt({kind:"info",title:"That shot is no longer available",detail:"Showing everything instead."}))},[G,yt.missing,se,nt]);const Et=s.useMemo(()=>{var Gt,Yt;const le=P.length?P:((Gt=u.json)==null?void 0:Gt.products)??[],De=((Yt=u.json)==null?void 0:Yt.characters)??[],it=M.scenes;return{product:_n=>{const fn=le.find(Ln=>Ln.id===_n)??a.find(Ln=>Ln.id===_n);return fn?Mo(fn,"chip"):null},person:_n=>{var fn,Ln;return((fn=De.find(kn=>kn.id===_n))==null?void 0:fn.name)??((Ln=r.find(kn=>kn.id===_n))==null?void 0:Ln.name)??null},scene:_n=>{const fn=it.find(Ln=>Ln.id===_n);return fn?pl(fn,"chip"):null}}},[P,a,u,r,M.scenes]),st=s.useMemo(()=>{const le=D?zt.get(D):void 0;return le||(Wt.find(De=>De.status!=="error")??Wt[0]??null)},[zt,Wt,D]),vt=x9(Qe||null,zt),Ae=s.useMemo(()=>{const le=vt.node;return!le||le.kind==="root"?null:le.status==="running"||le.status==="done"&&le.images.length>0?le:null},[vt.node]),xe=(Ae==null?void 0:Ae.images[0])??null,Xe=s.useCallback(()=>Pe(null),[Pe]),Ct=s.useRef(null),ve=s.useCallback((...le)=>{if(Ct.current){for(const it of le)Ct.current.add(it);return}const De=new Set(le);Ct.current=De,queueMicrotask(()=>{Ct.current=null,L(it=>{const Gt=new URLSearchParams(it);for(const Yt of De)Gt.delete(Yt);return Gt},{replace:!0})})},[L]),lt=s.useCallback(()=>ve("scene","setup","presenter","product","ref","view"),[ve]);s.useEffect(()=>{!Qe||!mt||(vt.node&&!Ae?(Xe(),nt({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})):vt.missing&&(Xe(),nt({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})))},[Qe,vt.node,vt.missing,Ae,mt,Xe,nt]);const dt=s.useCallback(le=>{var De;Pe(le),(De=et.current)==null||De.focus()},[Pe]),$e=le=>B(le),Ge=le=>H||/\/shots\//.test(window.location.pathname)?Mt(le,!0):$e(le),Rt=s.useCallback(le=>{for(const De of le)ie.current.set(De.id,De);te.current.insert(le),E(le),pt()},[E,pt]),nn=s.useCallback(async()=>{try{await y(),await te.current.refresh(),X(null)}catch(le){X(String(le.message??le))}},[y]),Nt=s.useCallback(le=>E([le]),[E]),{archive:Jt,archiveBatch:Ce,unarchive:_e,unarchiveBatch:tt}=Fue(Nt),I=s.useCallback(le=>te.current.drop(le),[]),{remove:ue,removeBatch:be}=_ue(I);s.useEffect(()=>{H&&B(H)},[H]);const Ve=s.useRef(new Set),Re=async le=>{var De,it;if(le.status==="running")return le.id;if(Ve.current.has(le.id))return null;if(le.status==="error"||le.status==="cancelled"){Ve.current.add(le.id);try{const Gt=await Ne.retryNode(le.id);return E([Gt]),pt(),Gt.id}catch(Gt){return nt(cn(Gt,"Could not run this again")),null}finally{Ve.current.delete(le.id)}}Ve.current.add(le.id);try{const Gt=await Ne.node(le.id),Yt=await Ne.addNode({projectId:_t,parentId:le.parentId,kind:le.kind==="edit"?"edit":"generation",prompt:Gt.prompt,engineId:le.engineId,count:1,brief:le.brief,...le.kind==="edit"&&((De=le.brief)!=null&&De.sourceImage)?{sourceImage:le.brief.sourceImage}:{}});return Rt((it=Yt.siblings)!=null&&it.length?Yt.siblings:[Yt]),(Yt==null?void 0:Yt.id)??null}catch(Gt){return nt(cn(Gt,"Could not run this again")),null}finally{Ve.current.delete(le.id)}},bt=async le=>{try{await Ne.cancelNode(le.id),E([{...le,status:"cancelled"}]),pt()}catch(De){nt(cn(De,"Could not cancel this shot"))}},Ot=s.useCallback(le=>{var De,it,Gt;le!=null&&le.scene&&((De=et.current)==null||De.applyScene(le.scene)),le!=null&&le.scenesPanel&&((it=et.current)==null||it.openAttach("Scenes")),(Gt=et.current)==null||Gt.focus()},[]);s.useEffect(()=>{var De;if(R.get("compose")===null)return;const le=R.get("attach")==="all";Ot(),le&&((De=et.current)==null||De.showAttach()),ve("compose",...le?["attach"]:[])},[R,Ot,ve]);const It=R.get("showcase"),Dt=s.useRef(null);s.useEffect(()=>{if(!It||!l||Dt.current===It)return;Dt.current=It;const le=i.find(De=>De.id===It);le?(re(N4(le)),nt({kind:"info",title:`Starting from "${le.title}"`})):nt({kind:"info",title:"That example is no longer available",detail:"Starting from scratch instead."}),L(De=>{const it=new URLSearchParams(De);return it.delete("showcase"),it},{replace:!0})},[It,l,i,L,nt]);const wn=async(le,De=!le.kept)=>{E([{...le,kept:De}]);try{E([await Ne.keep(le.id,De)])}catch(it){E([le]),nt(cn(it,"Could not update keeper status"))}},Bt=s.useMemo(()=>[...Me].map(le=>zt.get(le)).filter(le=>!!le),[zt,Me]),In=async()=>{const le=!(Bt.length>0&&Bt.every(it=>it.kept)),De=Bt.filter(it=>it.kept!==le);E(De.map(it=>({...it,kept:le})));try{E(await Promise.all(De.map(it=>Ne.keep(it.id,le))))}catch(it){E(De),nt(cn(it,"Could not update keeper status"))}},dn=le=>{const De=le.map(it=>zt.get(it)).filter(it=>!!it&&!it.archived);De.length&&E(De.map(it=>({...it,archived:!0}))),ce(new Set),Ce(le).then(it=>{it||E(De)})},Nn=le=>{const De=le.map(it=>zt.get(it)).filter(it=>!!it&&it.archived);De.length&&E(De.map(it=>({...it,archived:!1}))),ce(new Set),tt(le).then(it=>{it||E(De)})},Kn=s.useCallback((le,De)=>{ot.current={...ot.current,[le]:De},C(le,De)},[C]),sn=async le=>{try{const De=await Ne.addToSet(le.id,[...Me]);Kn(le.id,De.nodeIds),ce(new Set),(e||Ke)&&te.current.refresh()}catch(De){nt(cn(De,"Could not add to the set"))}},ar=async(le,De)=>{const it=ot.current[le.id]??[],Gt=it.filter(Yt=>!De.includes(Yt));Kn(le.id,Gt),ce(Yt=>{if(!De.some(fn=>Yt.has(fn)))return Yt;const _n=new Set(Yt);for(const fn of De)_n.delete(fn);return _n}),(e==null?void 0:e.id)===le.id&&te.current.drop(De);try{const Yt=await Ne.removeFromSet(le.id,De);Kn(le.id,Yt.nodeIds),Ke&&te.current.refresh()}catch(Yt){Kn(le.id,it),((e==null?void 0:e.id)===le.id||Ke)&&te.current.refresh(),nt(cn(Yt,"Could not remove from the set"))}},fs=le=>ar(le,[...Me]),Mn=(le,De)=>ar(De,[le.id]),_s=s.useRef([]),[na,ra]=s.useState(!1);s.useEffect(()=>{na&&ra(!1)},[na]);const so=async(le,De)=>{const it=De.trim();if(it)try{const Gt=await Ne.createSet(u.id,it);if(S(Gt),le.length>0){const Yt=await Ne.addToSet(Gt.id,le);Kn(Gt.id,Yt.nodeIds)}ce(new Set),j(S0(u,Gt))}catch(Gt){nt(cn(Gt,"Could not create the set"))}},ln=()=>{const le=_s.current;return _s.current=[],le},bn=async le=>{if(!e)return;const De=le.trim();if(!(!De||De===e.name))try{const it=await Ne.renameSet(e.id,De);b(it),j(S0(u,it),{replace:!0}),y()}catch(it){nt(cn(it,"Could not rename the set"))}},Wn=async()=>{if(e)try{await Ne.deleteSet(e.id),k(e.id),j(xr(u),{replace:!0}),y()}catch(le){nt(cn(le,"Could not delete the set"))}},fr=async le=>{var kn;const De=((kn=/\/shots\/([^/?#]+)/.exec(window.location.pathname))==null?void 0:kn[1])??null,it=De?zt.get(De)??null:st;if(!it)return;if(le==="left"||le==="right"){const{prev:Zs,next:Ad}=q6(Wt,it.id),oo=le==="left"?Zs:Ad;oo&&Ge(oo.id);return}const Gt=await Ne.lineage(it.id).catch(()=>null);if(!Gt)return;const Yt=Gt.history??[...Gt.ancestors,it,...Gt.children.slice(0,1)],{prev:_n,next:fn}=q6(Yt.filter(Zs=>Zs.id===it.id||Zs.images[0]),it.id),Ln=le==="up"?_n:fn;Ln&&Ge(Ln.id)};s.useEffect(()=>{const le=De=>{var fn,Ln;if(De.defaultPrevented)return;const it=document.activeElement,Gt=((it==null?void 0:it.tagName)??"").toUpperCase(),Yt=Gt==="INPUT"||Gt==="TEXTAREA"||Gt==="SELECT"||!!(it!=null&&it.closest('[contenteditable="true"]'))||!!(it!=null&&it.closest('[role="separator"]')),_n=!!(it!=null&&it.closest('button, a[href], [role="button"], [role="tab"], [role="menuitem"]'));if(De.key==="Enter"&&(De.metaKey||De.ctrlKey)){if(H||nde(it))return;(fn=et.current)==null||fn.submit(),De.preventDefault();return}if(!Yt){if(De.key==="?"){W(!0),De.preventDefault();return}if(De.key==="/"&&!H){(Ln=et.current)==null||Ln.focus(),De.preventDefault();return}if(De.key==="Escape"&&V){W(!1),De.preventDefault();return}if(De.key==="Escape"&&H){$t(),De.preventDefault();return}if(De.key==="Escape"&&Me.size>0){ce(new Set),De.preventDefault();return}if(De.key==="Escape"&&Qe){Xe(),De.preventDefault();return}if(st){if(De.key==="b"&&st.kind!=="root"&&st.status==="done"&&st.images.length>0){dt(st.id),De.preventDefault();return}if(De.key==="k"&&st.kind!=="root"&&st.status==="done"){wn(st),De.preventDefault();return}De.key==="ArrowLeft"?(fr("left"),De.preventDefault()):De.key==="ArrowRight"?(fr("right"),De.preventDefault()):De.key==="ArrowUp"?(fr("up"),De.preventDefault()):De.key==="ArrowDown"?(fr("down"),De.preventDefault()):De.key==="Enter"&&!H&&st.kind!=="root"&&!_n?Mt(st.id):De.key==="."&&!H&&O&&F()}}};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[st,H,V,Me.size,Qe,dt,Pe,h,O]);const hr=le=>ce(De=>{const it=new Set(De);return it.delete(le)||it.add(le),it}),xn=mt&&Ut!==null&&Ut.total===0,Br=Y||xn&&O,ao=xn?o.jsx(Uue,{entries:i,catalogs:{demoProducts:a,presenters:r,scenes:T},stagedId:Q,productHref:le=>wa(u,le),presenterHref:le=>Ea(u,le),sceneHref:le=>Zr(u,le),onUse:le=>{he(le.id),re(N4(le))}}):q.trim()?o.jsx(y0,{text:`No shots match “${q.trim()}”.`,onAll:Le,actionLabel:"Clear search"}):Se==="keepers"?o.jsx(y0,{text:"No keepers yet. Star a shot and it lands here.",onAll:()=>Be(null)}):Se==="archived"?o.jsx(y0,{text:"Nothing archived.",onAll:()=>Be(null)}):e?o.jsx(y0,{text:"Nothing in this set yet. Pick shots on All, then add them here."}):Ke?o.jsx(y0,{text:"Every shot is already in a set.",onAll:()=>Ue(null)}):null,Vs=s.useRef(0);!q.trim()&&Ut&&(Vs.current=Ut[Se]);const[Ar,$l]=Sa(Kr.feedCounts,null);s.useEffect(()=>{if(!Ut)return;const le={brandId:u.id,all:Ut.all,keepers:Ut.keepers,archived:Ut.archived};$l(De=>De&&De.brandId===le.brandId&&De.all===le.all&&De.keepers===le.keepers&&De.archived===le.archived?De:le)},[u.id,Ut,$l]);const To=s.useMemo(()=>Ut?{all:Ut.all,keepers:Ut.keepers,archived:Ut.archived}:(Ar==null?void 0:Ar.brandId)===u.id?{all:Ar.all,keepers:Ar.keepers,archived:Ar.archived}:null,[Ut,Ar,u.id]),Do={byId:zt,items:Wt,loadMore:on.loadMore,complete:on.complete,rootId:h,recent:p,loaded:mt,setsFor:le=>kt.get(le)??[],brand:u,engines:t,projectId:_t,close:$t,select:Ge,retry:le=>{Re(le).then(De=>{De&&Ge(De)})},cancel:le=>void bt(le),keep:le=>void wn(le),reload:nn,remix:le=>{var _n;const De=(_n=le.brief)==null?void 0:_n.tokens,it=le.prompt??le.promptHead,Gt=De!=null&&De.length||!it?le.brief:{...le.brief,tokens:[{t:"text",v:it}]},Yt=Gt!=null&&Gt.tokens?{...Gt,tokens:u4(u,Gt.tokens)}:Gt;re({...Yt,_at:Date.now()}),Yt&&KP(u.id,{tokens:_w(Yt),tplFields:Yt.templateFields??{}}),$t(),nt({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=>{dt(le.id),$t()},archive:le=>Jt(le).then(De=>{De&&$t()}),unarchive:le=>_e(le).then(()=>{}),delete:le=>void ue(le).then(()=>$t()),landed:Rt,refined:(le,De)=>{De==="edit"&&Pe(le)},subscribeActivity:A,tokenNames:Et};return o.jsxs("div",{className:"sc-work","data-assets":Br,children:[o.jsxs("main",{className:"sc-canvas",id:"main","data-page-scroll":"","data-firstrun":xn||void 0,onClick:le=>{if(Me.size===0&&!D)return;const De=le.target;De.closest(".sc-cell")||De.closest("button, a, input, select, textarea, label, [role], [contenteditable]")||(ce(new Set),B(null))},children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:Fe}),(z||on.error)&&o.jsx("div",{className:"sc-canvas-alert",children:o.jsx(hw,{failure:ro(z??on.error??""),action:on.error&&!z?o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:on.retry,children:"Try again"}):void 0})}),(!xn||e)&&o.jsx(Iue,{sets:m,active:e,ungrouped:Ke,ungroupedCount:(Ut==null?void 0:Ut.ungrouped)??0,onPlaceAll:()=>e?j(xr(u)):Ue(null),onPlaceUngrouped:()=>e?j(`${xr(u)}?in=ungrouped`):Ue("ungrouped"),onOpenSet:le=>j(S0(u,le)),onNewSet:le=>void so(ln(),le),onResetNewSet:()=>{_s.current=[]},onRenameSet:le=>void bn(le),onDeleteSet:()=>void Wn(),askCreate:na,lens:Se,lensCounts:To,onLens:le=>Be(le==="all"?null:le),q,onQ:ae,searchTotal:q.trim()?Vs.current:(Ut==null?void 0:Ut[Se])??0,sort:ge,onSort:Je,tile:oe,onTile:Ze,assets:Y,onAssets:F,showAssets:O}),G&&yt.node&&o.jsxs("div",{className:"sc-lineage-bar",children:[o.jsx("button",{type:"button",className:"sc-crumb-back",onClick:()=>se(null),children:"All shots"}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("b",{dir:"auto",children:Tr(yt.node)}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("span",{className:"sc-crumb-here",children:"versions"})]}),o.jsx($ue,{nodes:Wt,selectedId:D,onOpen:Mt,shotHref:Zt,onRetry:le=>void Re(le),onCancel:le=>void bt(le),onToggleKeep:le=>void wn(le),onArchive:le=>le.archived?_e(le):Jt(le),onDeletePermanently:ue,engineName:le=>{var De;return(De=t.find(it=>it.id===le))==null?void 0:De.displayName},picked:Me,onPick:hr,sending:St,onBranch:dt,branchingFrom:(Ae==null?void 0:Ae.id)??null,onVersions:se,tile:oe,empty:mt?ao:null,pending:!mt&&!on.error,onNearEnd:on.complete?void 0:on.loadMore,inSet:e,setsFor:le=>kt.get(le)??[],onRemoveFromSet:(le,De)=>void Mn(le,De),onKeepPicked:()=>void In(),onArchivePicked:()=>dn([...Me]),onRestorePicked:()=>Nn([...Me]),onDeletePicked:()=>void be([...Me]).then(()=>ce(new Set)),onRemovePickedFromSet:le=>void fs(le)})]}),Br&&o.jsx("div",{className:"sc-assets-backdrop",onClick:()=>_(!1),"aria-hidden":!0}),o.jsx(pue,{open:V,onOpenChange:W}),O&&o.jsx(Oue,{brand:u,shots:p,shotsTotal:(To==null?void 0:To.all)??0,attached:Z,full:me,onToken:le=>{var De;return(De=et.current)==null?void 0:De.insertToken(le)},offToken:le=>{var De;return(De=et.current)==null?void 0:De.removeToken(le)},onTemplate:le=>{var De;return(De=et.current)==null?void 0:De.applyScene(le)},offTemplate:()=>{var le;return(le=et.current)==null?void 0:le.removeTemplate()},onClose:()=>_(!1)}),o.jsxs(YP,{full:!Br,children:[o.jsx(dy,{}),Me.size>0&&o.jsx(Wue,{count:Me.size,sets:m,activeSet:e,onAdd:le=>void sn(le),onRemove:e?()=>void fs(e):void 0,onNew:()=>{_s.current=[...Me],ra(!0)},onClear:()=>ce(new Set),onKeep:()=>void In(),onArchiveBatch:le=>dn(le),allKept:Bt.length>0&&Bt.every(le=>le.kept),archivedLens:Se==="archived",pickedIds:[...Me],onRestoreBatch:le=>Nn(le),onDeleteBatch:le=>void be(le).then(()=>ce(new Set)),loaded:Wt.length,onSelectAll:()=>ce(new Set(Wt.map(le=>le.id)))}),o.jsx(cy,{ref:et,projectId:_t||null,brand:u,engines:t,parentId:h,initialBrief:fe,suppressDraftRestore:It!==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,onSeedsSpent:lt,openAttachTab:R.get("attach")==="scenes"?"Scenes":R.get("attach")==="products"?"Products":void 0,target:Ae,onClearTarget:Xe,onRestoreBranchId:Pe,guided:!0,setSlug:(e==null?void 0:e.slug)??null,onSending:at,onAttached:J,onCeiling:ne,sourceImage:xe??void 0,onQueued:(le,De,it,Gt)=>{re(null),L(Ln=>{const kn=new URLSearchParams(Ln);return kn.delete("scene"),kn.delete("attach"),kn.delete("presenter"),kn.delete("product"),kn},{replace:!0});const Yt=()=>at(null),_n=()=>{De!=="edit"||!le||L(Ln=>{const kn=new URLSearchParams(Ln);return kn.set("branch",le),kn},{replace:!0})},fn=()=>{Rt(Gt??[]),_n(),Yt()};e&&le?Ne.addToSet(e.id,it!=null&&it.length?it:[le]).then(Ln=>Kn(e.id,Ln.nodeIds)).catch(Ln=>nt(cn(Ln,"Could not add to the set"))).finally(fn):fn()}})]}),o.jsx(Rc,{context:Do})]})}const k9='[aria-modal="true"], [role="alertdialog"], .rt-BaseDialogContent, .sc-newdlg-layer';function nde(e){return e!=null&&e.closest(k9)?!0:!!(e!=null&&e.closest("[data-radix-popper-content-wrapper]"))&&!!document.querySelector(k9)}const U4=new Map,rde=4e3;function sde(e){U4.set(e,performance.now())}function ade(e){const t=U4.get(e);if(t!==void 0&&performance.now()-t<rde)return t;U4.delete(e)}function ode(e){var t;return li((t=e.brief)==null?void 0:t.format)}function ide(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 lde=e=>({"--sc-pic-ar":e[0]/e[1],"--sc-pic-w":`${e[0]}px`});function cde({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(C=>C+1),1e3);return()=>clearInterval(S)},[e.status]),e.status==="running"&&c6.add(e.id);const[,f]=s.useState(0),h=s.useRef(null),[p,m]=s.useState(null),g=s.useCallback(()=>{c6.delete(e.id),f(S=>S+1)},[e.id]);if(s.useEffect(()=>{e.status!=="done"&&(V0=null)},[e.status]),s.useEffect(()=>()=>{V0=null},[]),e.kind==="root")return o.jsx($0,{className:"sc-frame",p:"8",children:o.jsxs(Ts,{direction:"column",align:"center",gap:"2",py:"6",children:[o.jsx(bc,{className:"sc-display",size:"7",align:"center",children:"Blank canvas, full brand."}),o.jsx(bc,{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":ode(e)},children:[o.jsx(Ca,{since:za(e),from:ude(e.id)}),o.jsxs("div",{className:"sc-stage-wait-say",children:[o.jsx("span",{className:"sc-stage-wait-t",role:"timer","aria-label":`${yw(za(e))}, ${Lm(za(e))} seconds`,children:Sc(za(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 C=e.status==="cancelled"?PN():ro(e.error,r);return o.jsx(kN,{failure:C,density:"stage",onRetry:t})}const w=e.status==="done"?e.images[0]:void 0,y=w?ide(e)??(i==null?void 0:i.size)??null:null,b=!!w&&!!y&&e.status==="done"&&c6.has(e.id)&&!rf(),k=w?o.jsxs($0,{className:y?"sc-frame sc-stage-pic":"sc-frame sc-stage-free",style:y?lde(y):void 0,"data-arriving":b||void 0,children:[o.jsx(dde,{hash:w,alt:e.promptHead,imgRef:h,bare:b,onPainted:(S,C,E)=>{l({hash:S,size:[C,E]}),m(S),V0=S}}),b&&o.jsx(Ny,{img:h,ready:p===w,onDone:g})]}):o.jsx(Ts,{justify:"center",children:o.jsx($0,{className:"sc-frame",style:{display:"inline-block",maxWidth:"100%"}})});return a?o.jsxs(Zf,{children:[o.jsx(zf,{children:k}),a]}):k}const c6=new Set;let V0=null;function ude(e){const t=ade(e);return t!==void 0&&V0?{src:$r(V0),at:t}:void 0}function dde({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($r(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?$r(u.current):gn(e,"tile");return o.jsxs($0,{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:$r(e),alt:t,className:"sc-stage-img","data-ready":f||void 0,onLoad:m=>h(m.currentTarget)})]})}const fde=e=>((e==null?void 0:e.tokens)??[]).filter(t=>t&&typeof t.t=="string");function i$(e,t){return fde(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 W4=new Set;function l$({id:e}){return W4.add(e),null}function c$({id:e,src:t,active:n}){const r=s.useRef(null),[a,i]=s.useState(!1),[,l]=s.useState(0),u=s.useCallback(()=>{W4.delete(e),l(f=>f+1)},[e]);return!W4.has(e)||rf()?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(Ny,{img:r,ready:a,onDone:u})]})}const hde=e=>e===0?"Original":`Refinement ${e}`,pde=e=>e===0?"the original":`Refinement ${e}`,mde=(e,t)=>e.createdAt.localeCompare(t.createdAt)||e.id.localeCompare(t.id),gde=e=>e.status==="cancelled"?"Stopped":"Did not finish";function vde(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(mde):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:gde(g),from:null,state:w};const y=g.kind==="edit"?++h:0;return{node:g,index:y,label:hde(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:pde(p[y].index)}})}function wde(e,t){var n;return((n=e.find(r=>r.state==="pending"&&r.node.parentId===t))==null?void 0:n.node)??null}function u$(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 Th=28;function yde({trail:e,activeId:t,names:n,onSelect:r}){var w;const a=s.useRef(null),i=s.useMemo(()=>e.map(y=>i$(y.node,n)),[e,n]),l=Ed(),u=(y,b,k)=>l.open({key:y.node.id,src:gn(y.node.images[0],"tile"),label:y.label,said:i[b],from:y.from,el:k,id:y.node.id});s.useEffect(()=>{var y,b;(b=(y=a.current)==null?void 0:y.querySelector('[aria-pressed="true"]'))==null||b.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[t]);const[f,h]=s.useState(null);s.useEffect(()=>{const y=a.current;if(!y)return;const b=()=>{const C=y.scrollWidth-y.clientWidth;if(C<=1)return h(null);const E=y.scrollLeft;h(E<=1?"end":E>=C-1?"start":"both")},k=()=>{const C=y.querySelector("[data-pending]")??y.querySelector('[aria-pressed="true"]');if(!C)return;const E=C.getBoundingClientRect(),A=y.getBoundingClientRect();E.left<A.left+Th?y.scrollLeft-=A.left+Th-E.left:E.right>A.right-Th&&(y.scrollLeft+=E.right-(A.right-Th))};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 C,E;const b=[...((C=a.current)==null?void 0:C.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(),(E=b[S])==null||E.focus()},m=e.some(y=>y.node.id===t)?t:(w=e[0])==null?void 0:w.node.id,g=u$(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,C=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}${C?", still rendering":""}`,"aria-pressed":S,"data-pending":C||void 0,tabIndex:k.id===m?0:-1,onClick:()=>{l.closeNow(),r(k.id)},onPointerEnter:E=>E.pointerType==="mouse"&&y.state==="ready"&&u(y,b,E.currentTarget),onPointerLeave:E=>E.pointerType==="mouse"&&l.close(),onFocus:E=>Dm(E.currentTarget)&&y.state==="ready"&&u(y,b,E.currentTarget),children:y.state==="ready"?o.jsx(c$,{id:k.id,src:gn(k.images[0],"micro"),active:S}):C?o.jsxs("span",{className:"sc-thumb sc-thumb-wait","data-active":S,children:[o.jsx(Ca,{since:za(k)}),o.jsx(l$,{id:k.id})]}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":S,children:o.jsx(Pc,{size:14})})},k.id)})}),l.shown&&o.jsx(Sd,{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 bde=200,S9=32;function xde({shots:e,activeId:t,onSelect:n,onEndReached:r,complete:a}){var y;const i=s.useRef(null),l=Ed(),u=(b,k)=>l.open({key:b.id,src:gn(b.images[0],"tile"),label:Tr(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,C=b.scrollTop;k.style.setProperty("--sc-shotrail-start",S>1?Math.min(1,C/S9).toFixed(3):"0"),k.style.setProperty("--sc-shotrail-end",S>1?Math.min(1,(S-C)/S9).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-bde&&r()},g=b=>{var E,A;const k=[...((E=i.current)==null?void 0:E.querySelectorAll(".sc-shotrail-tile:not([aria-disabled])"))??[]],S=k.indexOf(document.activeElement);let C=-1;if(b.key==="ArrowDown")C=Math.min(k.length-1,S+1);else if(b.key==="ArrowUp")C=Math.max(0,S-1);else if(b.key==="Home")C=0;else if(b.key==="End")C=k.length-1;else return;b.preventDefault(),b.stopPropagation(),(A=k[C])==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",C=b.status==="done"&&!!b.images[0];return o.jsx("button",{type:"button",className:"sc-thumb-btn sc-shotrail-tile","aria-label":S?`${Tr(b)}, still rendering`:Tr(b),"aria-pressed":k,tabIndex:b.id===w?0:-1,onClick:()=>{l.closeNow(),n(b.id)},onPointerEnter:E=>E.pointerType==="mouse"&&C&&u(b,E.currentTarget),onPointerLeave:E=>E.pointerType==="mouse"&&l.close(),onFocus:E=>Dm(E.currentTarget)&&C&&u(b,E.currentTarget),children:C?o.jsx(c$,{id:b.id,src:gn(b.images[0],"micro"),active:k}):S?o.jsxs("span",{className:"sc-thumb sc-thumb-wait","data-active":k,children:[o.jsx(Ca,{since:za(b)}),o.jsx(l$,{id:b.id})]}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":k,children:o.jsx(Pc,{size:14})})},b.id)})})}),l.shown&&o.jsx(Sd,{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 kde=60;function Sde({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)<kde||Math.abs(i)<2*Math.abs(l)||(i<0?e():t())},onPointerCancel:()=>{n.current=null}}}function Ede(e){const t=Bn(),n=Ed(),{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=>Dm(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(Sd,{anchor:u.el,kind:u.kind,src:Tn(u.src,"tile"),label:u.label,onOpen:()=>{const w=u;f(),w.to?t(w.to):p({src:Tn(w.src,"full"),kind:w.kind,label:w.label})},onHoverIn:n.keep,onHoverOut:()=>!i&&n.close(),onClose:f},u.key),h&&o.jsx(ud,{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 Cde({brief:e,prompt:t,brand:n,saidRef:r,expanded:a,clamped:i}){var T,M;const{scenes:l,presenters:u,demoProducts:f}=Dn(),h=Ede(".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=_c(n),y=Gf(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)||qu(R.previewColor))continue;const L=`t${j.id}`;FP(R.previewUrl).then(H=>{const D=qu(H??void 0);D&&k(B=>B[L]?B:{...B,[L]:D})})}});const S={products:m,demoProducts:f,cast:g,presenters:u,scenes:[...w,...l]},C=j=>{var L,H;const R=$P(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?jm((H=(L=D==null?void 0:D.shots)==null?void 0:L[0])==null?void 0:H.file,"micro"):(B==null?void 0:B.previewUrl)??null,to:n&&(D||B)?wa(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),W=D?Cw(D):B?hi(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:W.src,crop:W.crop,to:n&&V?Ea(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:qu(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:gn(j.imageHash,"micro"),previewHash:j.imageHash};if((j==null?void 0:j.t)==="mark"){const D=y.find(B=>B.hash===j.imageHash);return{key:`m${j.imageHash}`,kind:"mark",label:D?Tm(n==null?void 0:n.json,D):"brand mark",thumb:gn(j.imageHash,"micro"),previewHash:j.imageHash}}return null},E=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]}),L=j.tint??(j.custom?b[j.key]:void 0),H=L?{"--tint":L}:void 0,D=(j.previewHash?gn(j.previewHash,"tile"):Tn(j.thumb,"tile"))??(j.to?"":null);if(D!==null&&qh(j.kind)){const B=j.kind,V=h.isOpen(j.key),W={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":L?"":void 0,style:H,title:V?void 0:`${j.label}. Preview.`,"aria-label":`${j.label}. Preview.`,...h.bind(W),children:R},j.key)}return o.jsx("span",{className:"sc-ingredient","data-kind":j.kind,"data-tinted":L?"":void 0,style:H,title:`${j.kind}: ${j.label}`,children:R},j.key)},A=[];for(const j of p){if(j.t==="text"){const L=j.v.trim();L&&A.push(L);continue}const R=C(j);R&&A.push(E(R))}if(!A.length&&!t)return null;const P=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:P.length?P:t||""}),h.surface]})}const jde=256,Xi=new Map;function K4(e,t){for(Xi.delete(e),Xi.set(e,t);Xi.size>jde;)Xi.delete(Xi.keys().next().value)}function d$(e,t){const n=new Map(e.map(a=>[a.id,a])),r=[];for(let a=t.parentId?n.get(t.parentId):void 0;a;a=a.parentId?n.get(a.parentId):void 0)r.unshift(a);return{ancestors:r,siblings:e.filter(a=>a.parentId===t.parentId),children:e.filter(a=>a.parentId===t.id),history:e}}function Ade(e,t){K4(e,t);for(const n of t.history??[])n.id!==e&&K4(n.id,d$(t.history??[],n))}function E9(e){const t=e.parentId?Xi.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)K4(a.id,d$(r,a))}function Nde(e){var i;const[t,n]=s.useState(()=>{const l=Xi.get(e.id);return l?{id:e.id,lineage:l}:null});s.useEffect(()=>{let l=!0;return Ne.lineage(e.id).then(u=>{l&&(Ade(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:Xi.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 Mde=32,Qi=new Map;function Rde(e){for(Qi.delete(e.id),Qi.set(e.id,e);Qi.size>Mde;)Qi.delete(Qi.keys().next().value)}function Pde(e){const[t,n]=s.useState(()=>Qi.get(e.id)??null);return s.useEffect(()=>{const r=Qi.get(e.id);if(r){n(r);return}let a=!0;return Ne.node(e.id).then(i=>{a&&(Rde(i),n(i))}).catch(()=>{}),()=>{a=!1}},[e.id]),(t==null?void 0:t.id)===e.id?t:Qi.get(e.id)??null}const Lde="(max-width: 1023px)",f$=380,h$=480,C9=380,xu=e=>Math.min(h$,Math.max(f$,Math.round(e)));function $de({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:C,subscribeActivity:E,tokenNames:A}){const{ancestors:P,children:T,history:M}=Nde(e),j=Pde(e),R=s.useMemo(()=>l.find(Se=>Se.id===e.engineId),[l,e.engineId]),{push:L}=rr(),[H,D]=Sa(Kr.ovlPanelW,C9),B=s.useRef(0),V=s.useRef(0),W=s.useRef(null),K=s.useMemo(()=>{var Se;return(((Se=e.brief)==null?void 0:Se.tokens)??[]).some(Ke=>(Ke==null?void 0:Ke.t)&&Ke.t!=="text"&&Ke.t!=="format")},[e.brief]),F=s.useMemo(()=>{const Se=Gf(i.json);return{...A,mark:Ke=>{const kt=Se.find(qe=>qe.hash===Ke);return kt?Tm(i.json,kt):null}}},[A,i]),_=s.useMemo(()=>i$(j??e,F),[j,e,F]),[O,Y]=s.useState(!1),[z,X]=s.useState(!1),[Z,J]=s.useState(!1),[me,ne]=s.useState(!1),[fe,re]=s.useState(!1),[ee,Q]=s.useState(!1);s.useEffect(()=>{J(!1),Q(!1),ne(!1)},[e.id]),s.useEffect(()=>{if(!Z)return;const Se=setTimeout(()=>J(!1),1400);return()=>clearTimeout(Se)},[Z]),s.useEffect(()=>{if(!ee)return;const Se=setTimeout(()=>Q(!1),1400);return()=>clearTimeout(Se)},[ee]);const[he,Me]=s.useState(null);uy(he,"--sc-ovl-dock-h");const ce=s.useRef(null),[ke,Be]=s.useState(!1),[ft,Ue]=s.useState(!1);s.useEffect(()=>Be(!1),[e.id]),s.useLayoutEffect(()=>{const Se=ce.current;if(!Se||ke)return;const Ke=()=>Ue(Se.scrollHeight>Se.clientHeight+1);Ke();const kt=new ResizeObserver(Ke);return kt.observe(Se),()=>kt.disconnect()},[_,ke]);const[Qe,Pe]=s.useState([]);s.useEffect(()=>{if(!(!E||Qe.length===0))return E(Se=>{const Ke=new Map(Se.map(kt=>[kt.id,kt]));Pe(kt=>{const qe=kt.map(ot=>Ke.get(ot.id)??ot);return qe.some((ot,rt)=>ot!==kt[rt])?qe:kt})})},[E,Qe.length]);const G=s.useMemo(()=>vde(M??[...P,e,...T.slice(0,6)],e,Qe.length?[...n,...Qe]:n),[M,P,e,T,n,Qe]),se=s.useMemo(()=>wde(G,e.id),[G,e.id]);s.useEffect(()=>{const Se=Qe.find(Ke=>Ke.status==="done"&&Ke.images[0]);Se&&(Pe(Ke=>Ke.filter(kt=>kt.id!==Se.id)),E9(Se),e.id===Se.parentId&&h(Se.id))},[Qe,e.id,h]);const We=s.useMemo(()=>G.find(Se=>Se.node.id===e.id)??null,[G,e.id]),Ze=jr(Lde),oe=G.length>1&&Ze?u$(G,e.id):e.kind!=="edit"?"Shot":M&&We?We.label:"Refinement",q=s.useMemo(()=>q6(n,e.id),[n,e.id]);s.useEffect(()=>{q.at>=0&&!a&&n.length-q.at<=6&&r()},[q.at,n.length,a,r]);const ae=Se=>{const Ke=Se>0?q.next:q.prev;Ke&&h(Ke.id)},Le=Ed(),Ie=(Se,Ke)=>Se!=null&&Se.images[0]?{onPointerEnter:kt=>{kt.pointerType==="mouse"&&Le.open({key:Se.id,src:gn(Se.images[0],"tile"),label:Tr(Se),noun:Ke,el:kt.currentTarget,id:Se.id})},onPointerLeave:kt=>{kt.pointerType==="mouse"&&Le.close()}}:{},Je=Sde({onLeft:()=>ae(1),onRight:()=>ae(-1)});s.useEffect(()=>{const Se=Le.shown;if(!Se)return;const Ke=Se.noun==="Next shot"?q.next:q.prev;Ke!=null&&Ke.images[0]?Le.open({key:Ke.id,src:gn(Ke.images[0],"tile"),label:Tr(Ke),noun:Se.noun,el:Se.el,id:Ke.id}):Le.closeNow()},[e.id]),s.useEffect(()=>{var qe,ot;const Se=G.findIndex(rt=>rt.node.id===e.id),kt=[(qe=G[Se-1])==null?void 0:qe.node,(ot=G[Se+1])==null?void 0:ot.node,q.prev,q.next].filter(rt=>!!(rt!=null&&rt.images[0])).map(rt=>{var Qt;const tn=new Image;return tn.decoding="async",tn.src=gn(rt.images[0],"tile"),(Qt=tn.decode)==null||Qt.call(tn).catch(()=>{}),tn});return()=>{for(const rt of kt)rt.src=""}},[G,e.id,q.prev,q.next]);const ge=e.images[0],et=e.promptHead.slice(0,40).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"")||"shot",nt=async(Se=!1)=>{if(!z){X(!0);try{const Ke=fetch($r(ge)).then(kt=>{if(!kt.ok)throw new Error(`HTTP ${kt.status}`);return kt.blob()});await navigator.clipboard.write([new ClipboardItem({"image/png":Ke})]),Se?L({kind:"success",title:"Copied to clipboard"}):J(!0)}catch(Ke){L(cn(Ke,"Copy failed"))}finally{X(!1)}}},pt=async()=>{if(!me){ne(!0);try{await(e.archived?k(e):b(e))}finally{ne(!1)}}},St=async()=>{if(!fe){re(!0);try{const Se=e.brief?_w(e.brief):null;if(!Se||Se.every(Ke=>Ke.t==="text"&&!Ke.v.trim()))await navigator.clipboard.writeText(_);else{const Ke=ot=>{var rt;switch(ot.t){case"text":return ot.v;case"product":return F.product(ot.id)??"a product";case"character":return F.person(ot.id)??"a presenter";case"template":return F.scene(ot.id)??"a scene";case"color":return ot.name??ot.hex;case"ref":return"reference image";case"mark":return((rt=F.mark)==null?void 0:rt.call(F,ot.imageHash))??"brand mark"}},{text:kt,html:qe}=tte(Se,Ke);await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([kt],{type:"text/plain"}),"text/html":new Blob([qe],{type:"text/html"})})])}Q(!0)}catch(Se){L(cn(Se,"Copy failed"))}finally{re(!1)}}};s.useEffect(()=>{const Se=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Se}},[]);const at=[{key:"download",label:"Download",icon:o.jsx(q7,{size:14}),onClick:()=>{const Se=document.createElement("a");Se.href=$r(ge),Se.download=`${et}.png`,Se.click()}},{key:"keep",label:e.kept?"Remove from keepers":"Keep",icon:o.jsx(Ga,{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(Gn,{size:14,weight:"bold"}):o.jsx(Nx,{size:14}),onClick:()=>void nt(),onMenu:()=>void nt(!0),busy:z,said:Z?"Copied":void 0}],_t=[{key:"archive",label:e.archived?"Restore":"Archive",icon:e.archived?o.jsx(U0,{size:14}):o.jsx(qp,{size:14}),onClick:()=>void pt(),busy:me},...e.archived?[{key:"delete",label:"Delete permanently",icon:o.jsx(tm,{size:14}),onClick:()=>Y(!0),tint:"var(--sc-red)",dialog:!0}]:[]],Lt=e.status==="done"&&e.images.length>0,Zt=!Lt&&e.kind!=="edit"&&!!e.brief,Mt=Lt?[...at,..._t]:_t,$t=Lt?o.jsx(Bf,{children:Mt.map(Se=>o.jsxs(Uf,{onSelect:Se.onMenu??Se.onClick,disabled:Se.busy,color:Se.tint?"red":void 0,children:[Se.icon,Se.label]},Se.key))}):void 0;return zr.createPortal(o.jsx(pd,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:Se=>{var Ke;Se.preventDefault(),(Ke=W.current)==null||Ke.focus({preventScroll:!0})},children:o.jsxs("div",{ref:W,tabIndex:-1,className:"sc-ovl","data-fb":"shot-overlay","data-fb-node":e.id,role:"dialog","aria-modal":"true","aria-label":Tr(e),"data-rail":n.length>1?"":void 0,style:{"--sc-ovl-panel-w":`${xu(H)}px`},children:[n.length>1&&o.jsx(xde,{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(dr,{label:"Close (esc)",children:o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:f,"aria-label":"Close",children:o.jsx(Rn,{size:13})})}),q.at>=0&&n.length>1&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!q.prev,onClick:()=>q.prev&&h(q.prev.id),"aria-label":"Previous shot",...Ie(q.prev,"Previous shot"),children:o.jsx(Aa,{size:13})}),o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!q.next,onClick:()=>q.next&&h(q.next.id),"aria-label":"Next shot",...Ie(q.next,"Next shot"),children:o.jsx(vl,{size:13})})]})]}),Mt.length>0&&o.jsxs("div",{className:"sc-ovl-bar-r",children:[o.jsx("div",{className:"sc-ovl-acts",children:Mt.map(Se=>o.jsx(dr,{label:Se.said??Se.label,open:!!Se.said,children:o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:Se.onClick,"aria-label":Se.label,"aria-pressed":Se.on===void 0?void 0:Se.on,"data-on":Se.on||void 0,"aria-haspopup":Se.dialog?"dialog":void 0,"aria-busy":Se.busy||void 0,"data-busy":Se.busy||void 0,style:Se.tint?{color:Se.tint}:void 0,children:Se.icon})},Se.key))}),o.jsxs(ys,{children:[o.jsx(dr,{label:"More actions",children:o.jsx(bs,{children:o.jsx("button",{type:"button",className:"sc-icon-btn sc-ovl-overflow","aria-label":"More actions",children:o.jsx(uv,{size:18,weight:"bold"})})})}),o.jsx(xs,{align:"end",sideOffset:6,children:Mt.map(Se=>o.jsxs(Xn,{onSelect:Se.onMenu??Se.onClick,disabled:Se.busy,color:Se.tint?"red":void 0,children:[Se.icon,Se.label]},Se.key))})]})]})]}),o.jsx(Df,{open:O,onOpenChange:Y,children:o.jsxs(Hf,{maxWidth:"420px",children:[o.jsx(Of,{children:"Delete this shot permanently?"}),o.jsx(If,{size:"2",children:"This cannot be undone."}),o.jsxs(Ts,{gap:"3",mt:"4",justify:"end",children:[o.jsx(_f,{children:o.jsx(va,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(Ff,{children:o.jsx(va,{color:"red",onClick:()=>S(e),children:"Delete permanently"})})]})]})}),Le.shown&&o.jsx(Sd,{anchor:Le.shown.el,kind:"shot",noun:Le.shown.noun,src:Le.shown.src,label:Le.shown.label,onOpen:()=>{var Ke;const Se=(Ke=Le.shown)==null?void 0:Ke.id;Le.closeNow(),Se&&h(Se)},onHoverIn:Le.keep,onHoverOut:Le.close,onClose:Le.closeNow},Le.shown.key),o.jsxs("div",{className:"sc-ovl-stage","data-takes":G.length>1?"":void 0,...Je,children:[o.jsx(cde,{node:e,onRetry:()=>p(e),onCancel:()=>m(e),engineName:R==null?void 0:R.displayName,menu:$t}),G.length>1?o.jsx(yde,{trail:G,activeId:e.id,names:F,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":f$,"aria-valuemax":h$,"aria-valuenow":xu(H),tabIndex:0,onPointerDown:Se=>{Se.button===0&&(Se.preventDefault(),Se.stopPropagation(),Se.currentTarget.setPointerCapture(Se.pointerId))},onPointerMove:Se=>{if(!Se.currentTarget.hasPointerCapture(Se.pointerId))return;const Ke=Se.currentTarget.closest(".sc-ovl");B.current=Se.clientX,!V.current&&(V.current=requestAnimationFrame(()=>{V.current=0,Ke==null||Ke.style.setProperty("--sc-ovl-panel-w",`${xu(window.innerWidth-B.current)}px`)}))},onPointerUp:Se=>{Se.currentTarget.hasPointerCapture(Se.pointerId)&&(Se.currentTarget.releasePointerCapture(Se.pointerId),D(xu(window.innerWidth-Se.clientX)))},onDoubleClick:Se=>{Se.stopPropagation(),D(C9)},onKeyDown:Se=>{Se.key==="ArrowLeft"?D(Ke=>xu(Ke+16)):Se.key==="ArrowRight"&&D(Ke=>xu(Ke-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:oe}),e.archived&&o.jsx("small",{className:"sc-ovl-flag",children:"archived"}),Lt&&e.costUsd>0&&o.jsxs("small",{className:"sc-ovl-spend",title:"Of your API budget",children:["$",e.costUsd.toFixed(2)]})]}),e.kind!=="root"&&(_||K)&&o.jsxs("div",{className:"sc-ovl-sec sc-ovl-brief",children:[o.jsxs("div",{className:"sc-ovl-brief-head",children:[o.jsx("span",{className:"sc-eyebrow",children:"Prompt"}),o.jsx(dr,{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":fe||void 0,"data-busy":fe?"":void 0,onClick:()=>void St(),children:ee?o.jsx(Gn,{size:14,weight:"bold"}):o.jsx(Nx,{size:14})})})]}),o.jsx("div",{className:"sc-brief-record",children:o.jsx(Cde,{brief:e.brief,prompt:(j==null?void 0:j.prompt)??e.promptHead,brand:i,saidRef:ce,expanded:ke,clamped:ft&&!ke})}),(ft||ke)&&o.jsx("button",{type:"button",className:"sc-s sc-ovl-more","aria-expanded":ke,onClick:()=>Be(Se=>!Se),children:ke?o.jsxs(o.Fragment,{children:[o.jsx(HI,{size:12})," Show less"]}):o.jsxs(o.Fragment,{children:[o.jsx(ul,{size:12})," Show more"]})})]}),(Lt||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(fd,{size:12})," Edit the prompt"]}),Lt&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>p(e),title:"Run the same setup again for a different take",children:[o.jsx(U0,{size:12})," Try again"]}),Lt&&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(Jh,{size:12})," Reuse setup"]})]})]}),(Lt||e.status==="running")&&o.jsx("div",{className:"sc-ovl-edit sc-dock",ref:Me,children:o.jsx(cy,{variant:"overlay",projectId:u,brand:i,engines:l,parentId:t,target:e,holdFor:e.status==="running"?e:se,sourceImage:ge,persistDraft:!1,onQueued:(Se,Ke,kt,qe)=>{w(qe??[]);const ot=Ke==="edit"?qe==null?void 0:qe.find(rt=>rt.id===Se):void 0;ot?(sde(ot.id),E9(ot),Pe(rt=>[...rt.filter(tn=>tn.id!==ot.id),ot]),h(ot.id)):Se&&h(Se),Se&&(C==null||C(Se,Ke))}})})]})]})}),document.body)}function j9(){const{shotId:e}=Qs(),t=rH(),{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 Ne.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($de,{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(Rr,{size:"3"})})}const A9=10;function Tde(){const{status:e,recent:t,history:n,featured:r,running:a,releasesUrl:i,notesFor:l,markSeen:u}=Zc(),{hash:f}=Un(),h=f.startsWith("#v")?n.findIndex(S=>`#v${S.version}`===f)+1:0,[p,m]=s.useState(A9),g=Math.min(n.length,Math.max(p,t.length,h)),w=g<n.length,y=s.useRef(null),b=S=>{var C;y.current=S?((C=n[g])==null?void 0:C.version)??null:null,m(g+A9)};s.useEffect(()=>{var C,E;const S=y.current;y.current=null,!(!S||w)&&((E=(C=document.getElementById(`v${S}`))==null?void 0:C.querySelector("h2"))==null||E.focus())},[g,w]),s.useEffect(()=>{e==="ready"&&u()},[e,u]);const k=s.useRef(null);return s.useEffect(()=>{let S=0;const C=requestAnimationFrame(()=>{S=window.setTimeout(()=>{var E;return(E=k.current)==null?void 0:E.focus({preventScroll:!0})},0)});return()=>{cancelAnimationFrame(C),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(ls,{children:o.jsxs("main",{className:"sc-wn-page",id:"main","aria-labelledby":"sc-wn-title",children:[o.jsxs("header",{className:"sc-wn-page-head",children:[o.jsx("h1",{id:"sc-wn-title",ref:k,tabIndex:-1,children:"What's new"}),o.jsx("p",{children:"What changed in Scenri, newest first."})]}),e==="failed"?o.jsx("p",{className:"sc-wn-txt",children:eR}):e==="ready"&&n.length===0?o.jsx("p",{className:"sc-wn-txt",children:tR}):o.jsxs(o.Fragment,{children:[o.jsx("ol",{className:"sc-wn-list",children:n.slice(0,g).map(S=>o.jsx(Dde,{current:S.version===a,entry:S,lead:S.version===(r==null?void 0:r.version),notes:l(S.version)},S.version))}),w&&o.jsx(Hde,{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(mc,{size:13,"aria-hidden":"true"})]})]})]})})}function Dde({entry:e,lead:t,current:n,notes:r}){const a=!!e.announce,i=nR(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(aR,{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(rR,{picture:i,eager:t,onOpen:()=>u(!0)}),o.jsx(YJ,{sections:e.sections}),r&&o.jsx(XJ,{href:r,version:e.version})]}),l&&i&&o.jsx(GJ,{src:i.src,alt:i.alt,onClose:()=>u(!1)})]})}function Hde({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 Ode(){const e=f7();return o.jsx(Ts,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(hw,{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(va,{size:"1",variant:"soft",color:"gray",onClick:()=>window.location.reload(),children:"Reload"})})})}function Ide(){const{setSlug:e=""}=Qs(),{pathname:t,search:n}=Un(),{brand:r,sets:a,loaded:i,refresh:l}=un(),u=Bn(),f=mn({path:ht.set,end:!1}),h=a.find(g=>g.slug===e)??a.find(g=>g.id===e)??null;Ic(h==null?void 0:h.name);const[p,m]=s.useState(null);if(s.useEffect(()=>{if(!i||h)return;if(p===e){u(xr(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(Ka,{to:S0(r,h)+g+n,replace:!0})}return o.jsx(o$,{set:h},h.id)}function Fde(){const{pathname:e,search:t}=Un();return o.jsx(Ka,{to:ZG(e,t),replace:!0})}function _de(){const{brandSlug:e}=Qs();return o.jsx(Ka,{to:`/${e}?settings=brand`,replace:!0})}function Vde(){const{sceneId:e}=Qs();return o.jsxs(o.Fragment,{children:[o.jsx(cie,{},e),o.jsx(Rc,{})]})}function Zde(){const{presenterId:e}=Qs();return o.jsxs(o.Fragment,{children:[o.jsx(vie,{},e),o.jsx(Rc,{},e)]})}function zde(){const{productId:e}=Qs();return o.jsx(due,{},e)}const Bde=QH([{element:o.jsx(pse,{}),errorElement:o.jsx(Ode,{}),children:[{index:!0,element:o.jsx(uee,{})},{path:ht.setup,element:o.jsx(xse,{})},{path:ht.legacy,element:o.jsx(Fde,{})},{path:ht.brand,element:o.jsx(lse,{}),children:[{index:!0,element:o.jsx(Qoe,{})},{path:ht.hub,element:o.jsx(o$,{set:null}),children:[{path:ht.hubShot,element:o.jsx(j9,{})}]},{path:ht.set,element:o.jsx(Ide,{}),children:[{path:ht.setShot,element:o.jsx(j9,{})}]},{path:ht.kit,element:o.jsx(_de,{})},{path:ht.whatsNew,element:o.jsx(Tde,{})},{path:ht.products,element:o.jsx(Qce,{})},{path:ht.product,element:o.jsx(zde,{})},{path:ht.scenes,element:o.jsx(rie,{}),children:[{path:ht.sceneStudio,element:o.jsx(c9,{})}]},{path:ht.scene,element:o.jsx(Vde,{}),children:[{path:ht.sceneEdit,element:o.jsx(c9,{})}]},{path:ht.presenters,element:o.jsx(gie,{}),children:[{path:ht.presenterStudio,element:o.jsx($ce,{})}]},{path:ht.presenter,element:o.jsx(Zde,{}),children:[{path:ht.presenterEdit,element:o.jsx(Sce,{})}]}]},{path:ht.notFound,element:o.jsx(Ka,{to:ht.root,replace:!0})}]}]),u6=localStorage.getItem("sc-theme")??localStorage.getItem("bt-theme");document.documentElement.dataset.theme=u6==="light"||u6==="dark"?u6:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";qq();const Ude={color:"currentColor",size:"1em",weight:"regular",mirrored:!1,"aria-hidden":!0};FT.createRoot(document.getElementById("root")).render(o.jsx(zn.StrictMode,{children:o.jsx(v7.Provider,{value:Ude,children:o.jsx(gG,{children:o.jsx(SG,{children:o.jsx(kH,{router:Bde})})})})}));