scenri 0.13.2 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/{chunk-MHTA6O3A.js → chunk-LMXHCXUC.js} +39 -9
  3. package/dist/{cli-4A3QWRSC.js → cli-NXOTZTBT.js} +3 -3
  4. package/dist/index.js +2 -2
  5. package/dist/serve.js +5239 -3552
  6. package/dist/{src-INKSTJNC.js → src-XRZP3ZB5.js} +3 -3
  7. package/package.json +1 -1
  8. package/studio-dist/assets/{index-BVDd0Egc.css → index-CJQMppMU.css} +1 -1
  9. package/studio-dist/assets/index-D1DGL2hD.js +104 -0
  10. package/studio-dist/assets/scene-citrus-light-1-Wme0KapL.webp +0 -0
  11. package/studio-dist/assets/scene-citrus-light-2-yTOgxwBC.webp +0 -0
  12. package/studio-dist/assets/scene-citrus-light-3-Cdm9IoIB.webp +0 -0
  13. package/studio-dist/assets/scene-citrus-light-4-DCtAaq1r.webp +0 -0
  14. package/studio-dist/assets/scene-citrus-signature-1-Cml3IQXs.webp +0 -0
  15. package/studio-dist/assets/scene-citrus-signature-2-KzaKaiGG.webp +0 -0
  16. package/studio-dist/assets/scene-citrus-signature-3-CXTnZSxD.webp +0 -0
  17. package/studio-dist/assets/scene-citrus-signature-4-B096kyLn.webp +0 -0
  18. package/studio-dist/assets/scene-citrus-surface-1-_EhsQ6GX.webp +0 -0
  19. package/studio-dist/assets/scene-citrus-surface-2-jj2bR67l.webp +0 -0
  20. package/studio-dist/assets/scene-citrus-surface-3-CqmDcvcl.webp +0 -0
  21. package/studio-dist/assets/scene-citrus-surface-4-CVx7xz1x.webp +0 -0
  22. package/studio-dist/assets/scene-colour-light-2-CEzTzOPa.webp +0 -0
  23. package/studio-dist/assets/scene-colour-light-4-BWyfdaod.webp +0 -0
  24. package/studio-dist/assets/scene-colour-signature-1-S-vfEXj-.webp +0 -0
  25. package/studio-dist/assets/scene-colour-signature-2-DzMl3jIo.webp +0 -0
  26. package/studio-dist/assets/scene-colour-signature-3-BRXPef3C.webp +0 -0
  27. package/studio-dist/assets/scene-colour-signature-4-D8Mwy86u.webp +0 -0
  28. package/studio-dist/assets/scene-colour-surface-2-8xE9rtHz.webp +0 -0
  29. package/studio-dist/assets/scene-colour-surface-3-o3tD2BcW.webp +0 -0
  30. package/studio-dist/assets/scene-colour-surface-4-Be-8wcD7.webp +0 -0
  31. package/studio-dist/assets/scene-dark-light-1-DNyik_mP.webp +0 -0
  32. package/studio-dist/assets/scene-dark-light-2-D3lbZbkz.webp +0 -0
  33. package/studio-dist/assets/scene-dark-light-3-D8bct498.webp +0 -0
  34. package/studio-dist/assets/scene-dark-signature-1-Uyxq7eTB.webp +0 -0
  35. package/studio-dist/assets/scene-dark-signature-2-CgU_91ec.webp +0 -0
  36. package/studio-dist/assets/scene-dark-signature-3-BFmyRVQE.webp +0 -0
  37. package/studio-dist/assets/scene-dark-signature-4-B-pqY09v.webp +0 -0
  38. package/studio-dist/assets/scene-dark-surface-1-BOty0Ksz.webp +0 -0
  39. package/studio-dist/assets/scene-dark-surface-2-Csn7cpFS.webp +0 -0
  40. package/studio-dist/assets/scene-dark-surface-3-B3AUiSC2.webp +0 -0
  41. package/studio-dist/assets/scene-dark-surface-4-REXRBZcg.webp +0 -0
  42. package/studio-dist/assets/scene-light-2-B84yG8HI.webp +0 -0
  43. package/studio-dist/assets/scene-light-6-dWmIaxxA.webp +0 -0
  44. package/studio-dist/assets/scene-light-7-Cf_DQSe0.webp +0 -0
  45. package/studio-dist/assets/scene-linen-light-1-BGO7NJ2i.webp +0 -0
  46. package/studio-dist/assets/scene-linen-light-2-Nj4uZEQb.webp +0 -0
  47. package/studio-dist/assets/scene-linen-light-3-CQLLstOF.webp +0 -0
  48. package/studio-dist/assets/scene-linen-light-4-Ca0fvqvc.webp +0 -0
  49. package/studio-dist/assets/scene-linen-signature-1-BZSGTVTo.webp +0 -0
  50. package/studio-dist/assets/scene-linen-signature-2-CHn_V3kh.webp +0 -0
  51. package/studio-dist/assets/scene-linen-signature-3-CgDnLeo2.webp +0 -0
  52. package/studio-dist/assets/scene-linen-signature-4-D-J72W_0.webp +0 -0
  53. package/studio-dist/assets/scene-linen-surface-1-D2wLSLtm.webp +0 -0
  54. package/studio-dist/assets/scene-linen-surface-2-BtytXyl5.webp +0 -0
  55. package/studio-dist/assets/scene-linen-surface-3-wZabdFH0.webp +0 -0
  56. package/studio-dist/assets/scene-linen-surface-4-BNOUx8lY.webp +0 -0
  57. package/studio-dist/assets/scene-plaster-light-1-DuUR0x-f.webp +0 -0
  58. package/studio-dist/assets/scene-plaster-light-2-CTV4xOer.webp +0 -0
  59. package/studio-dist/assets/scene-plaster-light-3-DcHxylwu.webp +0 -0
  60. package/studio-dist/assets/scene-plaster-signature-1-GtNrVfYr.webp +0 -0
  61. package/studio-dist/assets/scene-plaster-signature-2-D9iLXrEC.webp +0 -0
  62. package/studio-dist/assets/scene-plaster-signature-3-8VdPMd3L.webp +0 -0
  63. package/studio-dist/assets/scene-plaster-signature-4-e0mDabT1.webp +0 -0
  64. package/studio-dist/assets/scene-plaster-surface-2-X5fj16GI.webp +0 -0
  65. package/studio-dist/assets/scene-plaster-surface-3-Bxtg39zJ.webp +0 -0
  66. package/studio-dist/assets/scene-plaster-surface-4-fJXikVlC.webp +0 -0
  67. package/studio-dist/assets/scene-stone-light-1-Ck-_NhFQ.webp +0 -0
  68. package/studio-dist/assets/scene-stone-light-2-CjBNlt4T.webp +0 -0
  69. package/studio-dist/assets/scene-stone-light-3-BP2OkaJp.webp +0 -0
  70. package/studio-dist/assets/scene-stone-light-4-CHqBjior.webp +0 -0
  71. package/studio-dist/assets/scene-stone-signature-1-DX1azXUT.webp +0 -0
  72. package/studio-dist/assets/scene-stone-signature-2-D88S1ZTv.webp +0 -0
  73. package/studio-dist/assets/scene-stone-signature-3-lrOljf4B.webp +0 -0
  74. package/studio-dist/assets/scene-stone-signature-4-l_vDAftm.webp +0 -0
  75. package/studio-dist/assets/scene-stone-surface-1-WXRrETPZ.webp +0 -0
  76. package/studio-dist/assets/scene-stone-surface-2-TXh8wgcH.webp +0 -0
  77. package/studio-dist/assets/scene-stone-surface-3-Cz_wRxxO.webp +0 -0
  78. package/studio-dist/assets/scene-stone-surface-4-I0MbY8K9.webp +0 -0
  79. package/studio-dist/assets/scene-volcanic-light-1-BSuk4LH5.webp +0 -0
  80. package/studio-dist/assets/scene-volcanic-light-2-CodmHsaU.webp +0 -0
  81. package/studio-dist/assets/scene-volcanic-light-3-DYW5TyYn.webp +0 -0
  82. package/studio-dist/assets/scene-volcanic-light-4-B_4FgKXC.webp +0 -0
  83. package/studio-dist/assets/scene-volcanic-signature-1-Qk4sUfIe.webp +0 -0
  84. package/studio-dist/assets/scene-volcanic-signature-2-CD-IFmSZ.webp +0 -0
  85. package/studio-dist/assets/scene-volcanic-signature-3-BHXZ-3OB.webp +0 -0
  86. package/studio-dist/assets/scene-volcanic-signature-4-DHeJHr5p.webp +0 -0
  87. package/studio-dist/assets/scene-volcanic-surface-1-DURXnZ3G.webp +0 -0
  88. package/studio-dist/assets/scene-volcanic-surface-2-aXSRFhs9.webp +0 -0
  89. package/studio-dist/assets/scene-volcanic-surface-3-3xTz8ity.webp +0 -0
  90. package/studio-dist/assets/scene-volcanic-surface-4-D-yZi4rg.webp +0 -0
  91. package/studio-dist/assets/scene-water-light-1-4dxiIQDI.webp +0 -0
  92. package/studio-dist/assets/scene-water-light-2-DBrtCynY.webp +0 -0
  93. package/studio-dist/assets/scene-water-light-3-Bn1XOxoW.webp +0 -0
  94. package/studio-dist/assets/scene-water-light-4-C8RMoKMt.webp +0 -0
  95. package/studio-dist/assets/scene-water-signature-1-DmzDkEsw.webp +0 -0
  96. package/studio-dist/assets/scene-water-signature-2-D3nTe3bP.webp +0 -0
  97. package/studio-dist/assets/scene-water-signature-3-DL6R7xH3.webp +0 -0
  98. package/studio-dist/assets/scene-water-signature-4-BTHnaJIJ.webp +0 -0
  99. package/studio-dist/assets/scene-water-surface-1-BboH0OO0.webp +0 -0
  100. package/studio-dist/assets/scene-water-surface-2-DrnvFxqP.webp +0 -0
  101. package/studio-dist/assets/scene-water-surface-3-B8K_8sJT.webp +0 -0
  102. package/studio-dist/assets/scene-water-surface-4-mS0WpsuW.webp +0 -0
  103. package/studio-dist/assets/scene-world-1-DTbMGqH6.webp +0 -0
  104. package/studio-dist/assets/scene-world-2-DKT-i3Wq.webp +0 -0
  105. package/studio-dist/assets/scene-world-4-BF8szsQ8.webp +0 -0
  106. package/studio-dist/assets/scene-world-5-D-z_9xds.webp +0 -0
  107. package/studio-dist/assets/scene-world-6-Te5EnrDc.webp +0 -0
  108. package/studio-dist/assets/scene-world-8-EqxlFjcK.webp +0 -0
  109. package/studio-dist/index.html +2 -2
  110. package/studio-dist/assets/index-Bxm2gLra.js +0 -107
@@ -0,0 +1,104 @@
1
+ var tb=e=>{throw TypeError(e)};var nb=(e,t,n)=>t.has(e)||tb("Cannot "+n);var zr=(e,t,n)=>(nb(e,t,"read from private field"),n?n.call(e):t.get(e)),rb=(e,t,n)=>t.has(e)?tb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),A2=(e,t,n,r)=>(nb(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function CP(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 c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).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 v5(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var N2={exports:{}},Ed={},M2={exports:{}},cn={};/**
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 sb;function jP(){if(sb)return cn;sb=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"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function v(Z){return Z===null||typeof Z!="object"?null:(Z=g&&Z[g]||Z["@@iterator"],typeof Z=="function"?Z:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function k(Z,K,z){this.props=Z,this.context=K,this.refs=x,this.updater=z||y}k.prototype.isReactComponent={},k.prototype.setState=function(Z,K){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,K,"setState")},k.prototype.forceUpdate=function(Z){this.updater.enqueueForceUpdate(this,Z,"forceUpdate")};function S(){}S.prototype=k.prototype;function E(Z,K,z){this.props=Z,this.context=K,this.refs=x,this.updater=z||y}var C=E.prototype=new S;C.constructor=E,b(C,k.prototype),C.isPureReactComponent=!0;var N=Array.isArray,M=Object.prototype.hasOwnProperty,T={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function A(Z,K,z){var Y,J={},de=null,ae=null;if(K!=null)for(Y in K.ref!==void 0&&(ae=K.ref),K.key!==void 0&&(de=""+K.key),K)M.call(K,Y)&&!L.hasOwnProperty(Y)&&(J[Y]=K[Y]);var W=arguments.length-2;if(W===1)J.children=z;else if(1<W){for(var ye=Array(W),ee=0;ee<W;ee++)ye[ee]=arguments[ee+2];J.children=ye}if(Z&&Z.defaultProps)for(Y in W=Z.defaultProps,W)J[Y]===void 0&&(J[Y]=W[Y]);return{$$typeof:e,type:Z,key:de,ref:ae,props:J,_owner:T.current}}function P(Z,K){return{$$typeof:e,type:Z.type,key:K,ref:Z.ref,props:Z.props,_owner:Z._owner}}function $(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function H(Z){var K={"=":"=0",":":"=2"};return"$"+Z.replace(/[=:]/g,function(z){return K[z]})}var O=/\/+/g;function Q(Z,K){return typeof Z=="object"&&Z!==null&&Z.key!=null?H(""+Z.key):K.toString(36)}function I(Z,K,z,Y,J){var de=typeof Z;(de==="undefined"||de==="boolean")&&(Z=null);var ae=!1;if(Z===null)ae=!0;else switch(de){case"string":case"number":ae=!0;break;case"object":switch(Z.$$typeof){case e:case t:ae=!0}}if(ae)return ae=Z,J=J(ae),Z=Y===""?"."+Q(ae,0):Y,N(J)?(z="",Z!=null&&(z=Z.replace(O,"$&/")+"/"),I(J,K,z,"",function(ee){return ee})):J!=null&&($(J)&&(J=P(J,z+(!J.key||ae&&ae.key===J.key?"":(""+J.key).replace(O,"$&/")+"/")+Z)),K.push(J)),1;if(ae=0,Y=Y===""?".":Y+":",N(Z))for(var W=0;W<Z.length;W++){de=Z[W];var ye=Y+Q(de,W);ae+=I(de,K,z,ye,J)}else if(ye=v(Z),typeof ye=="function")for(Z=ye.call(Z),W=0;!(de=Z.next()).done;)de=de.value,ye=Y+Q(de,W++),ae+=I(de,K,z,ye,J);else if(de==="object")throw K=String(Z),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(Z).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return ae}function V(Z,K,z){if(Z==null)return Z;var Y=[],J=0;return I(Z,Y,"","",function(de){return K.call(z,de,J++)}),Y}function ie(Z){if(Z._status===-1){var K=Z._result;K=K(),K.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=K)}if(Z._status===1)return Z._result.default;throw Z._result}var B={current:null},F={transition:null},te={ReactCurrentDispatcher:B,ReactCurrentBatchConfig:F,ReactCurrentOwner:T};function X(){throw Error("act(...) is not supported in production builds of React.")}return cn.Children={map:V,forEach:function(Z,K,z){V(Z,function(){K.apply(this,arguments)},z)},count:function(Z){var K=0;return V(Z,function(){K++}),K},toArray:function(Z){return V(Z,function(K){return K})||[]},only:function(Z){if(!$(Z))throw Error("React.Children.only expected to receive a single React element child.");return Z}},cn.Component=k,cn.Fragment=n,cn.Profiler=a,cn.PureComponent=E,cn.StrictMode=r,cn.Suspense=f,cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=te,cn.act=X,cn.cloneElement=function(Z,K,z){if(Z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+Z+".");var Y=b({},Z.props),J=Z.key,de=Z.ref,ae=Z._owner;if(K!=null){if(K.ref!==void 0&&(de=K.ref,ae=T.current),K.key!==void 0&&(J=""+K.key),Z.type&&Z.type.defaultProps)var W=Z.type.defaultProps;for(ye in K)M.call(K,ye)&&!L.hasOwnProperty(ye)&&(Y[ye]=K[ye]===void 0&&W!==void 0?W[ye]:K[ye])}var ye=arguments.length-2;if(ye===1)Y.children=z;else if(1<ye){W=Array(ye);for(var ee=0;ee<ye;ee++)W[ee]=arguments[ee+2];Y.children=W}return{$$typeof:e,type:Z.type,key:J,ref:de,props:Y,_owner:ae}},cn.createContext=function(Z){return Z={$$typeof:c,_currentValue:Z,_currentValue2:Z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},Z.Provider={$$typeof:i,_context:Z},Z.Consumer=Z},cn.createElement=A,cn.createFactory=function(Z){var K=A.bind(null,Z);return K.type=Z,K},cn.createRef=function(){return{current:null}},cn.forwardRef=function(Z){return{$$typeof:d,render:Z}},cn.isValidElement=$,cn.lazy=function(Z){return{$$typeof:p,_payload:{_status:-1,_result:Z},_init:ie}},cn.memo=function(Z,K){return{$$typeof:h,type:Z,compare:K===void 0?null:K}},cn.startTransition=function(Z){var K=F.transition;F.transition={};try{Z()}finally{F.transition=K}},cn.unstable_act=X,cn.useCallback=function(Z,K){return B.current.useCallback(Z,K)},cn.useContext=function(Z){return B.current.useContext(Z)},cn.useDebugValue=function(){},cn.useDeferredValue=function(Z){return B.current.useDeferredValue(Z)},cn.useEffect=function(Z,K){return B.current.useEffect(Z,K)},cn.useId=function(){return B.current.useId()},cn.useImperativeHandle=function(Z,K,z){return B.current.useImperativeHandle(Z,K,z)},cn.useInsertionEffect=function(Z,K){return B.current.useInsertionEffect(Z,K)},cn.useLayoutEffect=function(Z,K){return B.current.useLayoutEffect(Z,K)},cn.useMemo=function(Z,K){return B.current.useMemo(Z,K)},cn.useReducer=function(Z,K,z){return B.current.useReducer(Z,K,z)},cn.useRef=function(Z){return B.current.useRef(Z)},cn.useState=function(Z){return B.current.useState(Z)},cn.useSyncExternalStore=function(Z,K,z){return B.current.useSyncExternalStore(Z,K,z)},cn.useTransition=function(){return B.current.useTransition()},cn.version="18.3.1",cn}var ab;function xv(){return ab||(ab=1,M2.exports=jP()),M2.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 ob;function AP(){if(ob)return Ed;ob=1;var e=xv(),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 c(d,f,h){var p,g={},v=null,y=null;h!==void 0&&(v=""+h),f.key!==void 0&&(v=""+f.key),f.ref!==void 0&&(y=f.ref);for(p in f)r.call(f,p)&&!i.hasOwnProperty(p)&&(g[p]=f[p]);if(d&&d.defaultProps)for(p in f=d.defaultProps,f)g[p]===void 0&&(g[p]=f[p]);return{$$typeof:t,type:d,key:v,ref:y,props:g,_owner:a.current}}return Ed.Fragment=n,Ed.jsx=c,Ed.jsxs=c,Ed}var ib;function NP(){return ib||(ib=1,N2.exports=AP()),N2.exports}var o=NP(),s=xv();const Ln=v5(s),Yl=CP({__proto__:null,default:Ln},[s]);var l1={},R2={exports:{}},ps={},P2={exports:{}},L2={};/**
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 lb;function MP(){return lb||(lb=1,(function(e){function t(F,te){var X=F.length;F.push(te);e:for(;0<X;){var Z=X-1>>>1,K=F[Z];if(0<a(K,te))F[Z]=te,F[X]=K,X=Z;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var te=F[0],X=F.pop();if(X!==te){F[0]=X;e:for(var Z=0,K=F.length,z=K>>>1;Z<z;){var Y=2*(Z+1)-1,J=F[Y],de=Y+1,ae=F[de];if(0>a(J,X))de<K&&0>a(ae,J)?(F[Z]=ae,F[de]=X,Z=de):(F[Z]=J,F[Y]=X,Z=Y);else if(de<K&&0>a(ae,X))F[Z]=ae,F[de]=X,Z=de;else break e}}return te}function a(F,te){var X=F.sortIndex-te.sortIndex;return X!==0?X:F.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var f=[],h=[],p=1,g=null,v=3,y=!1,b=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(F){for(var te=n(h);te!==null;){if(te.callback===null)r(h);else if(te.startTime<=F)r(h),te.sortIndex=te.expirationTime,t(f,te);else break;te=n(h)}}function N(F){if(x=!1,C(F),!b)if(n(f)!==null)b=!0,ie(M);else{var te=n(h);te!==null&&B(N,te.startTime-F)}}function M(F,te){b=!1,x&&(x=!1,S(A),A=-1),y=!0;var X=v;try{for(C(te),g=n(f);g!==null&&(!(g.expirationTime>te)||F&&!H());){var Z=g.callback;if(typeof Z=="function"){g.callback=null,v=g.priorityLevel;var K=Z(g.expirationTime<=te);te=e.unstable_now(),typeof K=="function"?g.callback=K:g===n(f)&&r(f),C(te)}else r(f);g=n(f)}if(g!==null)var z=!0;else{var Y=n(h);Y!==null&&B(N,Y.startTime-te),z=!1}return z}finally{g=null,v=X,y=!1}}var T=!1,L=null,A=-1,P=5,$=-1;function H(){return!(e.unstable_now()-$<P)}function O(){if(L!==null){var F=e.unstable_now();$=F;var te=!0;try{te=L(!0,F)}finally{te?Q():(T=!1,L=null)}}else T=!1}var Q;if(typeof E=="function")Q=function(){E(O)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,V=I.port2;I.port1.onmessage=O,Q=function(){V.postMessage(null)}}else Q=function(){k(O,0)};function ie(F){L=F,T||(T=!0,Q())}function B(F,te){A=k(function(){F(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_continueExecution=function(){b||y||(b=!0,ie(M))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(F){switch(v){case 1:case 2:case 3:var te=3;break;default:te=v}var X=v;v=te;try{return F()}finally{v=X}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,te){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var X=v;v=F;try{return te()}finally{v=X}},e.unstable_scheduleCallback=function(F,te,X){var Z=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?Z+X:Z):X=Z,F){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=X+K,F={id:p++,callback:te,priorityLevel:F,startTime:X,expirationTime:K,sortIndex:-1},X>Z?(F.sortIndex=X,t(h,F),n(f)===null&&F===n(h)&&(x?(S(A),A=-1):x=!0,B(N,X-Z))):(F.sortIndex=K,t(f,F),b||y||(b=!0,ie(M))),F},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(F){var te=v;return function(){var X=v;v=te;try{return F.apply(this,arguments)}finally{v=X}}}})(L2)),L2}var cb;function RP(){return cb||(cb=1,P2.exports=MP()),P2.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 ub;function PP(){if(ub)return ps;ub=1;var e=xv(),t=RP();function n(l){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+l,m=1;m<arguments.length;m++)u+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+l+"; visit "+u+" 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(l,u){c(l,u),c(l+"Capture",u)}function c(l,u){for(a[l]=u,l=0;l<u.length;l++)r.add(u[l])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},g={};function v(l){return f.call(g,l)?!0:f.call(p,l)?!1:h.test(l)?g[l]=!0:(p[l]=!0,!1)}function y(l,u,m,w){if(m!==null&&m.type===0)return!1;switch(typeof u){case"function":case"symbol":return!0;case"boolean":return w?!1:m!==null?!m.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function b(l,u,m,w){if(u===null||typeof u>"u"||y(l,u,m,w))return!0;if(w)return!1;if(m!==null)switch(m.type){case 3:return!u;case 4:return u===!1;case 5:return isNaN(u);case 6:return isNaN(u)||1>u}return!1}function x(l,u,m,w,j,R,_){this.acceptsBooleans=u===2||u===3||u===4,this.attributeName=w,this.attributeNamespace=j,this.mustUseProperty=m,this.propertyName=l,this.type=u,this.sanitizeURL=R,this.removeEmptyString=_}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){k[l]=new x(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var u=l[0];k[u]=new x(u,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){k[l]=new x(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){k[l]=new x(l,2,!1,l,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(l){k[l]=new x(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){k[l]=new x(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){k[l]=new x(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){k[l]=new x(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){k[l]=new x(l,5,!1,l.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function E(l){return l[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(l){var u=l.replace(S,E);k[u]=new x(u,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var u=l.replace(S,E);k[u]=new x(u,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var u=l.replace(S,E);k[u]=new x(u,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){k[l]=new x(l,1,!1,l.toLowerCase(),null,!1,!1)}),k.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){k[l]=new x(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,u,m,w){var j=k.hasOwnProperty(u)?k[u]:null;(j!==null?j.type!==0:w||!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(b(u,m,j,w)&&(m=null),w||j===null?v(u)&&(m===null?l.removeAttribute(u):l.setAttribute(u,""+m)):j.mustUseProperty?l[j.propertyName]=m===null?j.type===3?!1:"":m:(u=j.attributeName,w=j.attributeNamespace,m===null?l.removeAttribute(u):(j=j.type,m=j===3||j===4&&m===!0?"":""+m,w?l.setAttributeNS(w,u,m):l.setAttribute(u,m))))}var N=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),T=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),$=Symbol.for("react.provider"),H=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),B=Symbol.for("react.offscreen"),F=Symbol.iterator;function te(l){return l===null||typeof l!="object"?null:(l=F&&l[F]||l["@@iterator"],typeof l=="function"?l:null)}var X=Object.assign,Z;function K(l){if(Z===void 0)try{throw Error()}catch(m){var u=m.stack.trim().match(/\n( *(at )?)/);Z=u&&u[1]||""}return`
34
+ `+Z+l}var z=!1;function Y(l,u){if(!l||z)return"";z=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(De){var w=De}Reflect.construct(l,[],u)}else{try{u.call()}catch(De){w=De}l.call(u.prototype)}else{try{throw Error()}catch(De){w=De}l()}}catch(De){if(De&&w&&typeof De.stack=="string"){for(var j=De.stack.split(`
35
+ `),R=w.stack.split(`
36
+ `),_=j.length-1,le=R.length-1;1<=_&&0<=le&&j[_]!==R[le];)le--;for(;1<=_&&0<=le;_--,le--)if(j[_]!==R[le]){if(_!==1||le!==1)do if(_--,le--,0>le||j[_]!==R[le]){var we=`
37
+ `+j[_].replace(" at new "," at ");return l.displayName&&we.includes("<anonymous>")&&(we=we.replace("<anonymous>",l.displayName)),we}while(1<=_&&0<=le);break}}}finally{z=!1,Error.prepareStackTrace=m}return(l=l?l.displayName||l.name:"")?K(l):""}function J(l){switch(l.tag){case 5:return K(l.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return l=Y(l.type,!1),l;case 11:return l=Y(l.type.render,!1),l;case 1:return l=Y(l.type,!0),l;default:return""}}function de(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case L:return"Fragment";case T:return"Portal";case P:return"Profiler";case A:return"StrictMode";case Q:return"Suspense";case I:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case H:return(l.displayName||"Context")+".Consumer";case $:return(l._context.displayName||"Context")+".Provider";case O:var u=l.render;return l=l.displayName,l||(l=u.displayName||u.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case V:return u=l.displayName||null,u!==null?u:de(l.type)||"Memo";case ie:u=l._payload,l=l._init;try{return de(l(u))}catch{}}return null}function ae(l){var u=l.type;switch(l.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=u.render,l=l.displayName||l.name||"",u.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return de(u);case 8:return u===A?"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 u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function W(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ye(l){var u=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function ee(l){var u=ye(l)?"checked":"value",m=Object.getOwnPropertyDescriptor(l.constructor.prototype,u),w=""+l[u];if(!l.hasOwnProperty(u)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var j=m.get,R=m.set;return Object.defineProperty(l,u,{configurable:!0,get:function(){return j.call(this)},set:function(_){w=""+_,R.call(this,_)}}),Object.defineProperty(l,u,{enumerable:m.enumerable}),{getValue:function(){return w},setValue:function(_){w=""+_},stopTracking:function(){l._valueTracker=null,delete l[u]}}}}function ge(l){l._valueTracker||(l._valueTracker=ee(l))}function re(l){if(!l)return!1;var u=l._valueTracker;if(!u)return!0;var m=u.getValue(),w="";return l&&(w=ye(l)?l.checked?"true":"false":l.value),l=w,l!==m?(u.setValue(l),!0):!1}function D(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function G(l,u){var m=u.checked;return X({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??l._wrapperState.initialChecked})}function Pe(l,u){var m=u.defaultValue==null?"":u.defaultValue,w=u.checked!=null?u.checked:u.defaultChecked;m=W(u.value!=null?u.value:m),l._wrapperState={initialChecked:w,initialValue:m,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function Ze(l,u){u=u.checked,u!=null&&C(l,"checked",u,!1)}function He(l,u){Ze(l,u);var m=W(u.value),w=u.type;if(m!=null)w==="number"?(m===0&&l.value===""||l.value!=m)&&(l.value=""+m):l.value!==""+m&&(l.value=""+m);else if(w==="submit"||w==="reset"){l.removeAttribute("value");return}u.hasOwnProperty("value")?oe(l,u.type,m):u.hasOwnProperty("defaultValue")&&oe(l,u.type,W(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(l.defaultChecked=!!u.defaultChecked)}function tt(l,u,m){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var w=u.type;if(!(w!=="submit"&&w!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+l._wrapperState.initialValue,m||u===l.value||(l.value=u),l.defaultValue=u}m=l.name,m!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,m!==""&&(l.name=m)}function oe(l,u,m){(u!=="number"||D(l.ownerDocument)!==l)&&(m==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+m&&(l.defaultValue=""+m))}var he=Array.isArray;function Ae(l,u,m,w){if(l=l.options,u){u={};for(var j=0;j<m.length;j++)u["$"+m[j]]=!0;for(m=0;m<l.length;m++)j=u.hasOwnProperty("$"+l[m].value),l[m].selected!==j&&(l[m].selected=j),j&&w&&(l[m].defaultSelected=!0)}else{for(m=""+W(m),u=null,j=0;j<l.length;j++){if(l[j].value===m){l[j].selected=!0,w&&(l[j].defaultSelected=!0);return}u!==null||l[j].disabled||(u=l[j])}u!==null&&(u.selected=!0)}}function ue(l,u){if(u.dangerouslySetInnerHTML!=null)throw Error(n(91));return X({},u,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function ke(l,u){var m=u.value;if(m==null){if(m=u.children,u=u.defaultValue,m!=null){if(u!=null)throw Error(n(92));if(he(m)){if(1<m.length)throw Error(n(93));m=m[0]}u=m}u==null&&(u=""),m=u}l._wrapperState={initialValue:W(m)}}function qe(l,u){var m=W(u.value),w=W(u.defaultValue);m!=null&&(m=""+m,m!==l.value&&(l.value=m),u.defaultValue==null&&l.defaultValue!==m&&(l.defaultValue=m)),w!=null&&(l.defaultValue=""+w)}function Ve(l){var u=l.textContent;u===l._wrapperState.initialValue&&u!==""&&u!==null&&(l.value=u)}function Xe(l){switch(l){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Re(l,u){return l==null||l==="http://www.w3.org/1999/xhtml"?Xe(u):l==="http://www.w3.org/2000/svg"&&u==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var Ie,st=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(u,m,w,j){MSApp.execUnsafeLocalFunction(function(){return l(u,m,w,j)})}:l})(function(l,u){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=u;else{for(Ie=Ie||document.createElement("div"),Ie.innerHTML="<svg>"+u.valueOf().toString()+"</svg>",u=Ie.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;u.firstChild;)l.appendChild(u.firstChild)}});function Ye(l,u){if(u){var m=l.firstChild;if(m&&m===l.lastChild&&m.nodeType===3){m.nodeValue=u;return}}l.textContent=u}var $e={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},Qe=["Webkit","ms","Moz","O"];Object.keys($e).forEach(function(l){Qe.forEach(function(u){u=u+l.charAt(0).toUpperCase()+l.substring(1),$e[u]=$e[l]})});function Fe(l,u,m){return u==null||typeof u=="boolean"||u===""?"":m||typeof u!="number"||u===0||$e.hasOwnProperty(l)&&$e[l]?(""+u).trim():u+"px"}function yt(l,u){l=l.style;for(var m in u)if(u.hasOwnProperty(m)){var w=m.indexOf("--")===0,j=Fe(m,u[m],w);m==="float"&&(m="cssFloat"),w?l.setProperty(m,j):l[m]=j}}var ht=X({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 yn(l,u){if(u){if(ht[l]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(n(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(n(61))}if(u.style!=null&&typeof u.style!="object")throw Error(n(62))}}function Oe(l,u){if(l.indexOf("-")===-1)return typeof u.is=="string";switch(l){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 wt=null;function pt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Nt=null,Ct=null,$t=null;function Yt(l){if(l=cd(l)){if(typeof Nt!="function")throw Error(n(280));var u=l.stateNode;u&&(u=Sf(u),Nt(l.stateNode,l.type,u))}}function Vn(l){Ct?$t?$t.push(l):$t=[l]:Ct=l}function pn(){if(Ct){var l=Ct,u=$t;if($t=Ct=null,Yt(l),u)for(l=0;l<u.length;l++)Yt(u[l])}}function ar(l,u){return l(u)}function bt(){}var kt=!1;function sn(l,u,m){if(kt)return l(u,m);kt=!0;try{return ar(l,u,m)}finally{kt=!1,(Ct!==null||$t!==null)&&(bt(),pn())}}function Ut(l,u){var m=l.stateNode;if(m===null)return null;var w=Sf(m);if(w===null)return null;m=w[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(l=l.type,w=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!w;break e;default:l=!1}if(l)return null;if(m&&typeof m!="function")throw Error(n(231,u,typeof m));return m}var Tn=!1;if(d)try{var Vt={};Object.defineProperty(Vt,"passive",{get:function(){Tn=!0}}),window.addEventListener("test",Vt,Vt),window.removeEventListener("test",Vt,Vt)}catch{Tn=!1}function ne(l,u,m,w,j,R,_,le,we){var De=Array.prototype.slice.call(arguments,3);try{u.apply(m,De)}catch(nt){this.onError(nt)}}var se=!1,pe=null,ve=!1,Ee=null,We={onError:function(l){se=!0,pe=l}};function Ke(l,u,m,w,j,R,_,le,we){se=!1,pe=null,ne.apply(We,arguments)}function Ue(l,u,m,w,j,R,_,le,we){if(Ke.apply(this,arguments),se){if(se){var De=pe;se=!1,pe=null}else throw Error(n(198));ve||(ve=!0,Ee=De)}}function Be(l){var u=l,m=l;if(l.alternate)for(;u.return;)u=u.return;else{l=u;do u=l,(u.flags&4098)!==0&&(m=u.return),l=u.return;while(l)}return u.tag===3?m:null}function ot(l){if(l.tag===13){var u=l.memoizedState;if(u===null&&(l=l.alternate,l!==null&&(u=l.memoizedState)),u!==null)return u.dehydrated}return null}function rt(l){if(Be(l)!==l)throw Error(n(188))}function me(l){var u=l.alternate;if(!u){if(u=Be(l),u===null)throw Error(n(188));return u!==l?null:l}for(var m=l,w=u;;){var j=m.return;if(j===null)break;var R=j.alternate;if(R===null){if(w=j.return,w!==null){m=w;continue}break}if(j.child===R.child){for(R=j.child;R;){if(R===m)return rt(j),l;if(R===w)return rt(j),u;R=R.sibling}throw Error(n(188))}if(m.return!==w.return)m=j,w=R;else{for(var _=!1,le=j.child;le;){if(le===m){_=!0,m=j,w=R;break}if(le===w){_=!0,w=j,m=R;break}le=le.sibling}if(!_){for(le=R.child;le;){if(le===m){_=!0,m=R,w=j;break}if(le===w){_=!0,w=R,m=j;break}le=le.sibling}if(!_)throw Error(n(189))}}if(m.alternate!==w)throw Error(n(190))}if(m.tag!==3)throw Error(n(188));return m.stateNode.current===m?l:u}function q(l){return l=me(l),l!==null?Te(l):null}function Te(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var u=Te(l);if(u!==null)return u;l=l.sibling}return null}var je=t.unstable_scheduleCallback,gt=t.unstable_cancelCallback,dt=t.unstable_shouldYield,jt=t.unstable_requestPaint,et=t.unstable_now,Pt=t.unstable_getCurrentPriorityLevel,Sn=t.unstable_ImmediatePriority,U=t.unstable_UserBlockingPriority,ce=t.unstable_NormalPriority,Ce=t.unstable_LowPriority,ze=t.unstable_IdlePriority,lt=null,mt=null;function _t(l){if(mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(lt,l,void 0,(l.current.flags&128)===128)}catch{}}var It=Math.clz32?Math.clz32:mn,an=Math.log,Bt=Math.LN2;function mn(l){return l>>>=0,l===0?32:31-(an(l)/Bt|0)|0}var on=64,An=4194304;function Dt(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Zn(l,u){var m=l.pendingLanes;if(m===0)return 0;var w=0,j=l.suspendedLanes,R=l.pingedLanes,_=m&268435455;if(_!==0){var le=_&~j;le!==0?w=Dt(le):(R&=_,R!==0&&(w=Dt(R)))}else _=m&~j,_!==0?w=Dt(_):R!==0&&(w=Dt(R));if(w===0)return 0;if(u!==0&&u!==w&&(u&j)===0&&(j=w&-w,R=u&-u,j>=R||j===16&&(R&4194240)!==0))return u;if((w&4)!==0&&(w|=m&16),u=l.entangledLanes,u!==0)for(l=l.entanglements,u&=w;0<u;)m=31-It(u),j=1<<m,w|=l[m],u&=~j;return w}function xt(l,u){switch(l){case 1:case 2:case 4:return u+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 u+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 On(l,u){for(var m=l.suspendedLanes,w=l.pingedLanes,j=l.expirationTimes,R=l.pendingLanes;0<R;){var _=31-It(R),le=1<<_,we=j[_];we===-1?((le&m)===0||(le&w)!==0)&&(j[_]=xt(le,u)):we<=u&&(l.expiredLanes|=le),R&=~le}}function Ot(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function rn(){var l=on;return on<<=1,(on&4194240)===0&&(on=64),l}function $n(l){for(var u=[],m=0;31>m;m++)u.push(l);return u}function or(l,u,m){l.pendingLanes|=u,u!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,u=31-It(u),l[u]=m}function Ir(l,u){var m=l.pendingLanes&~u;l.pendingLanes=u,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=u,l.mutableReadLanes&=u,l.entangledLanes&=u,u=l.entanglements;var w=l.eventTimes;for(l=l.expirationTimes;0<m;){var j=31-It(m),R=1<<j;u[j]=0,w[j]=-1,l[j]=-1,m&=~R}}function zn(l,u){var m=l.entangledLanes|=u;for(l=l.entanglements;m;){var w=31-It(m),j=1<<w;j&u|l[w]&u&&(l[w]|=u),m&=~j}}var xn=0;function Qo(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var Jo,zs,Ji,as,ha,ei=!1,Bs=[],os=null,Es=null,fe=null,_e=new Map,ft=new Map,Tt=[],gn="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 Bn(l,u){switch(l){case"focusin":case"focusout":os=null;break;case"dragenter":case"dragleave":Es=null;break;case"mouseover":case"mouseout":fe=null;break;case"pointerover":case"pointerout":_e.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":ft.delete(u.pointerId)}}function un(l,u,m,w,j,R){return l===null||l.nativeEvent!==R?(l={blockedOn:u,domEventName:m,eventSystemFlags:w,nativeEvent:R,targetContainers:[j]},u!==null&&(u=cd(u),u!==null&&zs(u)),l):(l.eventSystemFlags|=w,u=l.targetContainers,j!==null&&u.indexOf(j)===-1&&u.push(j),l)}function Rn(l,u,m,w,j){switch(u){case"focusin":return os=un(os,l,u,m,w,j),!0;case"dragenter":return Es=un(Es,l,u,m,w,j),!0;case"mouseover":return fe=un(fe,l,u,m,w,j),!0;case"pointerover":var R=j.pointerId;return _e.set(R,un(_e.get(R)||null,l,u,m,w,j)),!0;case"gotpointercapture":return R=j.pointerId,ft.set(R,un(ft.get(R)||null,l,u,m,w,j)),!0}return!1}function Jt(l){var u=sl(l.target);if(u!==null){var m=Be(u);if(m!==null){if(u=m.tag,u===13){if(u=ot(m),u!==null){l.blockedOn=u,ha(l.priority,function(){Ji(m)});return}}else if(u===3&&m.stateNode.current.memoizedState.isDehydrated){l.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}l.blockedOn=null}function is(l){if(l.blockedOn!==null)return!1;for(var u=l.targetContainers;0<u.length;){var m=vc(l.domEventName,l.eventSystemFlags,u[0],l.nativeEvent);if(m===null){m=l.nativeEvent;var w=new m.constructor(m.type,m);wt=w,m.target.dispatchEvent(w),wt=null}else return u=cd(m),u!==null&&zs(u),l.blockedOn=m,!1;u.shift()}return!0}function ti(l,u,m){is(l)&&m.delete(u)}function mc(){ei=!1,os!==null&&is(os)&&(os=null),Es!==null&&is(Es)&&(Es=null),fe!==null&&is(fe)&&(fe=null),_e.forEach(ti),ft.forEach(ti)}function el(l,u){l.blockedOn===u&&(l.blockedOn=null,ei||(ei=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mc)))}function ho(l){function u(j){return el(j,l)}if(0<Bs.length){el(Bs[0],l);for(var m=1;m<Bs.length;m++){var w=Bs[m];w.blockedOn===l&&(w.blockedOn=null)}}for(os!==null&&el(os,l),Es!==null&&el(Es,l),fe!==null&&el(fe,l),_e.forEach(u),ft.forEach(u),m=0;m<Tt.length;m++)w=Tt[m],w.blockedOn===l&&(w.blockedOn=null);for(;0<Tt.length&&(m=Tt[0],m.blockedOn===null);)Jt(m),m.blockedOn===null&&Tt.shift()}var ni=N.ReactCurrentBatchConfig,gc=!0;function sm(l,u,m,w){var j=xn,R=ni.transition;ni.transition=null;try{xn=1,ri(l,u,m,w)}finally{xn=j,ni.transition=R}}function Xu(l,u,m,w){var j=xn,R=ni.transition;ni.transition=null;try{xn=4,ri(l,u,m,w)}finally{xn=j,ni.transition=R}}function ri(l,u,m,w){if(gc){var j=vc(l,u,m,w);if(j===null)vm(l,u,w,tl,m),Bn(l,w);else if(Rn(j,l,u,m,w))w.stopPropagation();else if(Bn(l,w),u&4&&-1<gn.indexOf(l)){for(;j!==null;){var R=cd(j);if(R!==null&&Jo(R),R=vc(l,u,m,w),R===null&&vm(l,u,w,tl,m),R===j)break;j=R}j!==null&&w.stopPropagation()}else vm(l,u,w,null,m)}}var tl=null;function vc(l,u,m,w){if(tl=null,l=pt(w),l=sl(l),l!==null)if(u=Be(l),u===null)l=null;else if(m=u.tag,m===13){if(l=ot(u),l!==null)return l;l=null}else if(m===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;l=null}else u!==l&&(l=null);return tl=l,null}function Qu(l){switch(l){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Pt()){case Sn:return 1;case U:return 4;case ce:case Ce:return 16;case ze:return 536870912;default:return 16}default:return 16}}var Us=null,yc=null,nl=null;function Ju(){if(nl)return nl;var l,u=yc,m=u.length,w,j="value"in Us?Us.value:Us.textContent,R=j.length;for(l=0;l<m&&u[l]===j[l];l++);var _=m-l;for(w=1;w<=_&&u[m-w]===j[R-w];w++);return nl=j.slice(l,1<w?1-w:void 0)}function rl(l){var u=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&u===13&&(l=13)):l=u,l===10&&(l=13),32<=l||l===13?l:0}function be(){return!0}function ut(){return!1}function Ht(l){function u(m,w,j,R,_){this._reactName=m,this._targetInst=j,this.type=w,this.nativeEvent=R,this.target=_,this.currentTarget=null;for(var le in l)l.hasOwnProperty(le)&&(m=l[le],this[le]=m?m(R):R[le]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?be:ut,this.isPropagationStopped=ut,this}return X(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=be)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=be)},persist:function(){},isPersistent:be}),u}var Wt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ln=Ht(Wt),dn=X({},Wt,{view:0,detail:0}),ls=Ht(dn),Gt,Hn,Pn,Ha=X({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:om,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Pn&&(Pn&&l.type==="mousemove"?(Gt=l.screenX-Pn.screenX,Hn=l.screenY-Pn.screenY):Hn=Gt=0,Pn=l),Gt)},movementY:function(l){return"movementY"in l?l.movementY:Hn}}),wc=Ht(Ha),pa=X({},Ha,{dataTransfer:0}),pf=Ht(pa),mf=X({},dn,{relatedTarget:0}),am=Ht(mf),nR=X({},Wt,{animationName:0,elapsedTime:0,pseudoElement:0}),rR=Ht(nR),sR=X({},Wt,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),aR=Ht(sR),oR=X({},Wt,{data:0}),U4=Ht(oR),iR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lR={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"},cR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uR(l){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(l):(l=cR[l])?!!u[l]:!1}function om(){return uR}var dR=X({},dn,{key:function(l){if(l.key){var u=iR[l.key]||l.key;if(u!=="Unidentified")return u}return l.type==="keypress"?(l=rl(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?lR[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:om,charCode:function(l){return l.type==="keypress"?rl(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?rl(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),fR=Ht(dR),hR=X({},Ha,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),W4=Ht(hR),pR=X({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:om}),mR=Ht(pR),gR=X({},Wt,{propertyName:0,elapsedTime:0,pseudoElement:0}),vR=Ht(gR),yR=X({},Ha,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),wR=Ht(yR),bR=[9,13,27,32],im=d&&"CompositionEvent"in window,ed=null;d&&"documentMode"in document&&(ed=document.documentMode);var xR=d&&"TextEvent"in window&&!ed,G4=d&&(!im||ed&&8<ed&&11>=ed),K4=" ",Y4=!1;function q4(l,u){switch(l){case"keyup":return bR.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function X4(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var bc=!1;function kR(l,u){switch(l){case"compositionend":return X4(u);case"keypress":return u.which!==32?null:(Y4=!0,K4);case"textInput":return l=u.data,l===K4&&Y4?null:l;default:return null}}function SR(l,u){if(bc)return l==="compositionend"||!im&&q4(l,u)?(l=Ju(),nl=yc=Us=null,bc=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return G4&&u.locale!=="ko"?null:u.data;default:return null}}var ER={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 Q4(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u==="input"?!!ER[l.type]:u==="textarea"}function J4(l,u,m,w){Vn(w),u=bf(u,"onChange"),0<u.length&&(m=new ln("onChange","change",null,m,w),l.push({event:m,listeners:u}))}var td=null,nd=null;function CR(l){vy(l,0)}function gf(l){var u=Cc(l);if(re(u))return l}function jR(l,u){if(l==="change")return u}var ey=!1;if(d){var lm;if(d){var cm="oninput"in document;if(!cm){var ty=document.createElement("div");ty.setAttribute("oninput","return;"),cm=typeof ty.oninput=="function"}lm=cm}else lm=!1;ey=lm&&(!document.documentMode||9<document.documentMode)}function ny(){td&&(td.detachEvent("onpropertychange",ry),nd=td=null)}function ry(l){if(l.propertyName==="value"&&gf(nd)){var u=[];J4(u,nd,l,pt(l)),sn(CR,u)}}function AR(l,u,m){l==="focusin"?(ny(),td=u,nd=m,td.attachEvent("onpropertychange",ry)):l==="focusout"&&ny()}function NR(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return gf(nd)}function MR(l,u){if(l==="click")return gf(u)}function RR(l,u){if(l==="input"||l==="change")return gf(u)}function PR(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var ma=typeof Object.is=="function"?Object.is:PR;function rd(l,u){if(ma(l,u))return!0;if(typeof l!="object"||l===null||typeof u!="object"||u===null)return!1;var m=Object.keys(l),w=Object.keys(u);if(m.length!==w.length)return!1;for(w=0;w<m.length;w++){var j=m[w];if(!f.call(u,j)||!ma(l[j],u[j]))return!1}return!0}function sy(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function ay(l,u){var m=sy(l);l=0;for(var w;m;){if(m.nodeType===3){if(w=l+m.textContent.length,l<=u&&w>=u)return{node:m,offset:u-l};l=w}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=sy(m)}}function oy(l,u){return l&&u?l===u?!0:l&&l.nodeType===3?!1:u&&u.nodeType===3?oy(l,u.parentNode):"contains"in l?l.contains(u):l.compareDocumentPosition?!!(l.compareDocumentPosition(u)&16):!1:!1}function iy(){for(var l=window,u=D();u instanceof l.HTMLIFrameElement;){try{var m=typeof u.contentWindow.location.href=="string"}catch{m=!1}if(m)l=u.contentWindow;else break;u=D(l.document)}return u}function um(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u&&(u==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||u==="textarea"||l.contentEditable==="true")}function LR(l){var u=iy(),m=l.focusedElem,w=l.selectionRange;if(u!==m&&m&&m.ownerDocument&&oy(m.ownerDocument.documentElement,m)){if(w!==null&&um(m)){if(u=w.start,l=w.end,l===void 0&&(l=u),"selectionStart"in m)m.selectionStart=u,m.selectionEnd=Math.min(l,m.value.length);else if(l=(u=m.ownerDocument||document)&&u.defaultView||window,l.getSelection){l=l.getSelection();var j=m.textContent.length,R=Math.min(w.start,j);w=w.end===void 0?R:Math.min(w.end,j),!l.extend&&R>w&&(j=w,w=R,R=j),j=ay(m,R);var _=ay(m,w);j&&_&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==_.node||l.focusOffset!==_.offset)&&(u=u.createRange(),u.setStart(j.node,j.offset),l.removeAllRanges(),R>w?(l.addRange(u),l.extend(_.node,_.offset)):(u.setEnd(_.node,_.offset),l.addRange(u)))}}for(u=[],l=m;l=l.parentNode;)l.nodeType===1&&u.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m<u.length;m++)l=u[m],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var TR=d&&"documentMode"in document&&11>=document.documentMode,xc=null,dm=null,sd=null,fm=!1;function ly(l,u,m){var w=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;fm||xc==null||xc!==D(w)||(w=xc,"selectionStart"in w&&um(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),sd&&rd(sd,w)||(sd=w,w=bf(dm,"onSelect"),0<w.length&&(u=new ln("onSelect","select",null,u,m),l.push({event:u,listeners:w}),u.target=xc)))}function vf(l,u){var m={};return m[l.toLowerCase()]=u.toLowerCase(),m["Webkit"+l]="webkit"+u,m["Moz"+l]="moz"+u,m}var kc={animationend:vf("Animation","AnimationEnd"),animationiteration:vf("Animation","AnimationIteration"),animationstart:vf("Animation","AnimationStart"),transitionend:vf("Transition","TransitionEnd")},hm={},cy={};d&&(cy=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 yf(l){if(hm[l])return hm[l];if(!kc[l])return l;var u=kc[l],m;for(m in u)if(u.hasOwnProperty(m)&&m in cy)return hm[l]=u[m];return l}var uy=yf("animationend"),dy=yf("animationiteration"),fy=yf("animationstart"),hy=yf("transitionend"),py=new Map,my="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 si(l,u){py.set(l,u),i(u,[l])}for(var pm=0;pm<my.length;pm++){var mm=my[pm],$R=mm.toLowerCase(),DR=mm[0].toUpperCase()+mm.slice(1);si($R,"on"+DR)}si(uy,"onAnimationEnd"),si(dy,"onAnimationIteration"),si(fy,"onAnimationStart"),si("dblclick","onDoubleClick"),si("focusin","onFocus"),si("focusout","onBlur"),si(hy,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("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 ad="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(" "),OR=new Set("cancel close invalid load scroll toggle".split(" ").concat(ad));function gy(l,u,m){var w=l.type||"unknown-event";l.currentTarget=m,Ue(w,u,void 0,l),l.currentTarget=null}function vy(l,u){u=(u&4)!==0;for(var m=0;m<l.length;m++){var w=l[m],j=w.event;w=w.listeners;e:{var R=void 0;if(u)for(var _=w.length-1;0<=_;_--){var le=w[_],we=le.instance,De=le.currentTarget;if(le=le.listener,we!==R&&j.isPropagationStopped())break e;gy(j,le,De),R=we}else for(_=0;_<w.length;_++){if(le=w[_],we=le.instance,De=le.currentTarget,le=le.listener,we!==R&&j.isPropagationStopped())break e;gy(j,le,De),R=we}}}if(ve)throw l=Ee,ve=!1,Ee=null,l}function Wn(l,u){var m=u[Sm];m===void 0&&(m=u[Sm]=new Set);var w=l+"__bubble";m.has(w)||(yy(u,l,2,!1),m.add(w))}function gm(l,u,m){var w=0;u&&(w|=4),yy(m,l,w,u)}var wf="_reactListening"+Math.random().toString(36).slice(2);function od(l){if(!l[wf]){l[wf]=!0,r.forEach(function(m){m!=="selectionchange"&&(OR.has(m)||gm(m,!1,l),gm(m,!0,l))});var u=l.nodeType===9?l:l.ownerDocument;u===null||u[wf]||(u[wf]=!0,gm("selectionchange",!1,u))}}function yy(l,u,m,w){switch(Qu(u)){case 1:var j=sm;break;case 4:j=Xu;break;default:j=ri}m=j.bind(null,u,m,l),j=void 0,!Tn||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(j=!0),w?j!==void 0?l.addEventListener(u,m,{capture:!0,passive:j}):l.addEventListener(u,m,!0):j!==void 0?l.addEventListener(u,m,{passive:j}):l.addEventListener(u,m,!1)}function vm(l,u,m,w,j){var R=w;if((u&1)===0&&(u&2)===0&&w!==null)e:for(;;){if(w===null)return;var _=w.tag;if(_===3||_===4){var le=w.stateNode.containerInfo;if(le===j||le.nodeType===8&&le.parentNode===j)break;if(_===4)for(_=w.return;_!==null;){var we=_.tag;if((we===3||we===4)&&(we=_.stateNode.containerInfo,we===j||we.nodeType===8&&we.parentNode===j))return;_=_.return}for(;le!==null;){if(_=sl(le),_===null)return;if(we=_.tag,we===5||we===6){w=R=_;continue e}le=le.parentNode}}w=w.return}sn(function(){var De=R,nt=pt(m),at=[];e:{var Je=py.get(l);if(Je!==void 0){var St=ln,Mt=l;switch(l){case"keypress":if(rl(m)===0)break e;case"keydown":case"keyup":St=fR;break;case"focusin":Mt="focus",St=am;break;case"focusout":Mt="blur",St=am;break;case"beforeblur":case"afterblur":St=am;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":St=wc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":St=pf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":St=mR;break;case uy:case dy:case fy:St=rR;break;case hy:St=vR;break;case"scroll":St=ls;break;case"wheel":St=wR;break;case"copy":case"cut":case"paste":St=aR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":St=W4}var Rt=(u&4)!==0,ir=!Rt&&l==="scroll",Ne=Rt?Je!==null?Je+"Capture":null:Je;Rt=[];for(var xe=De,Le;xe!==null;){Le=xe;var ct=Le.stateNode;if(Le.tag===5&&ct!==null&&(Le=ct,Ne!==null&&(ct=Ut(xe,Ne),ct!=null&&Rt.push(id(xe,ct,Le)))),ir)break;xe=xe.return}0<Rt.length&&(Je=new St(Je,Mt,null,m,nt),at.push({event:Je,listeners:Rt}))}}if((u&7)===0){e:{if(Je=l==="mouseover"||l==="pointerover",St=l==="mouseout"||l==="pointerout",Je&&m!==wt&&(Mt=m.relatedTarget||m.fromElement)&&(sl(Mt)||Mt[po]))break e;if((St||Je)&&(Je=nt.window===nt?nt:(Je=nt.ownerDocument)?Je.defaultView||Je.parentWindow:window,St?(Mt=m.relatedTarget||m.toElement,St=De,Mt=Mt?sl(Mt):null,Mt!==null&&(ir=Be(Mt),Mt!==ir||Mt.tag!==5&&Mt.tag!==6)&&(Mt=null)):(St=null,Mt=De),St!==Mt)){if(Rt=wc,ct="onMouseLeave",Ne="onMouseEnter",xe="mouse",(l==="pointerout"||l==="pointerover")&&(Rt=W4,ct="onPointerLeave",Ne="onPointerEnter",xe="pointer"),ir=St==null?Je:Cc(St),Le=Mt==null?Je:Cc(Mt),Je=new Rt(ct,xe+"leave",St,m,nt),Je.target=ir,Je.relatedTarget=Le,ct=null,sl(nt)===De&&(Rt=new Rt(Ne,xe+"enter",Mt,m,nt),Rt.target=Le,Rt.relatedTarget=ir,ct=Rt),ir=ct,St&&Mt)t:{for(Rt=St,Ne=Mt,xe=0,Le=Rt;Le;Le=Sc(Le))xe++;for(Le=0,ct=Ne;ct;ct=Sc(ct))Le++;for(;0<xe-Le;)Rt=Sc(Rt),xe--;for(;0<Le-xe;)Ne=Sc(Ne),Le--;for(;xe--;){if(Rt===Ne||Ne!==null&&Rt===Ne.alternate)break t;Rt=Sc(Rt),Ne=Sc(Ne)}Rt=null}else Rt=null;St!==null&&wy(at,Je,St,Rt,!1),Mt!==null&&ir!==null&&wy(at,ir,Mt,Rt,!0)}}e:{if(Je=De?Cc(De):window,St=Je.nodeName&&Je.nodeName.toLowerCase(),St==="select"||St==="input"&&Je.type==="file")var Lt=jR;else if(Q4(Je))if(ey)Lt=RR;else{Lt=NR;var Zt=AR}else(St=Je.nodeName)&&St.toLowerCase()==="input"&&(Je.type==="checkbox"||Je.type==="radio")&&(Lt=MR);if(Lt&&(Lt=Lt(l,De))){J4(at,Lt,m,nt);break e}Zt&&Zt(l,Je,De),l==="focusout"&&(Zt=Je._wrapperState)&&Zt.controlled&&Je.type==="number"&&oe(Je,"number",Je.value)}switch(Zt=De?Cc(De):window,l){case"focusin":(Q4(Zt)||Zt.contentEditable==="true")&&(xc=Zt,dm=De,sd=null);break;case"focusout":sd=dm=xc=null;break;case"mousedown":fm=!0;break;case"contextmenu":case"mouseup":case"dragend":fm=!1,ly(at,m,nt);break;case"selectionchange":if(TR)break;case"keydown":case"keyup":ly(at,m,nt)}var zt;if(im)e:{switch(l){case"compositionstart":var Kt="onCompositionStart";break e;case"compositionend":Kt="onCompositionEnd";break e;case"compositionupdate":Kt="onCompositionUpdate";break e}Kt=void 0}else bc?q4(l,m)&&(Kt="onCompositionEnd"):l==="keydown"&&m.keyCode===229&&(Kt="onCompositionStart");Kt&&(G4&&m.locale!=="ko"&&(bc||Kt!=="onCompositionStart"?Kt==="onCompositionEnd"&&bc&&(zt=Ju()):(Us=nt,yc="value"in Us?Us.value:Us.textContent,bc=!0)),Zt=bf(De,Kt),0<Zt.length&&(Kt=new U4(Kt,l,null,m,nt),at.push({event:Kt,listeners:Zt}),zt?Kt.data=zt:(zt=X4(m),zt!==null&&(Kt.data=zt)))),(zt=xR?kR(l,m):SR(l,m))&&(De=bf(De,"onBeforeInput"),0<De.length&&(nt=new U4("onBeforeInput","beforeinput",null,m,nt),at.push({event:nt,listeners:De}),nt.data=zt))}vy(at,u)})}function id(l,u,m){return{instance:l,listener:u,currentTarget:m}}function bf(l,u){for(var m=u+"Capture",w=[];l!==null;){var j=l,R=j.stateNode;j.tag===5&&R!==null&&(j=R,R=Ut(l,m),R!=null&&w.unshift(id(l,R,j)),R=Ut(l,u),R!=null&&w.push(id(l,R,j))),l=l.return}return w}function Sc(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function wy(l,u,m,w,j){for(var R=u._reactName,_=[];m!==null&&m!==w;){var le=m,we=le.alternate,De=le.stateNode;if(we!==null&&we===w)break;le.tag===5&&De!==null&&(le=De,j?(we=Ut(m,R),we!=null&&_.unshift(id(m,we,le))):j||(we=Ut(m,R),we!=null&&_.push(id(m,we,le)))),m=m.return}_.length!==0&&l.push({event:u,listeners:_})}var HR=/\r\n?/g,IR=/\u0000|\uFFFD/g;function by(l){return(typeof l=="string"?l:""+l).replace(HR,`
38
+ `).replace(IR,"")}function xf(l,u,m){if(u=by(u),by(l)!==u&&m)throw Error(n(425))}function kf(){}var ym=null,wm=null;function bm(l,u){return l==="textarea"||l==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var xm=typeof setTimeout=="function"?setTimeout:void 0,FR=typeof clearTimeout=="function"?clearTimeout:void 0,xy=typeof Promise=="function"?Promise:void 0,_R=typeof queueMicrotask=="function"?queueMicrotask:typeof xy<"u"?function(l){return xy.resolve(null).then(l).catch(VR)}:xm;function VR(l){setTimeout(function(){throw l})}function km(l,u){var m=u,w=0;do{var j=m.nextSibling;if(l.removeChild(m),j&&j.nodeType===8)if(m=j.data,m==="/$"){if(w===0){l.removeChild(j),ho(u);return}w--}else m!=="$"&&m!=="$?"&&m!=="$!"||w++;m=j}while(m);ho(u)}function ai(l){for(;l!=null;l=l.nextSibling){var u=l.nodeType;if(u===1||u===3)break;if(u===8){if(u=l.data,u==="$"||u==="$!"||u==="$?")break;if(u==="/$")return null}}return l}function ky(l){l=l.previousSibling;for(var u=0;l;){if(l.nodeType===8){var m=l.data;if(m==="$"||m==="$!"||m==="$?"){if(u===0)return l;u--}else m==="/$"&&u++}l=l.previousSibling}return null}var Ec=Math.random().toString(36).slice(2),Ia="__reactFiber$"+Ec,ld="__reactProps$"+Ec,po="__reactContainer$"+Ec,Sm="__reactEvents$"+Ec,ZR="__reactListeners$"+Ec,zR="__reactHandles$"+Ec;function sl(l){var u=l[Ia];if(u)return u;for(var m=l.parentNode;m;){if(u=m[po]||m[Ia]){if(m=u.alternate,u.child!==null||m!==null&&m.child!==null)for(l=ky(l);l!==null;){if(m=l[Ia])return m;l=ky(l)}return u}l=m,m=l.parentNode}return null}function cd(l){return l=l[Ia]||l[po],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function Cc(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(n(33))}function Sf(l){return l[ld]||null}var Em=[],jc=-1;function oi(l){return{current:l}}function Gn(l){0>jc||(l.current=Em[jc],Em[jc]=null,jc--)}function Un(l,u){jc++,Em[jc]=l.current,l.current=u}var ii={},Fr=oi(ii),cs=oi(!1),al=ii;function Ac(l,u){var m=l.type.contextTypes;if(!m)return ii;var w=l.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===u)return w.__reactInternalMemoizedMaskedChildContext;var j={},R;for(R in m)j[R]=u[R];return w&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=u,l.__reactInternalMemoizedMaskedChildContext=j),j}function us(l){return l=l.childContextTypes,l!=null}function Ef(){Gn(cs),Gn(Fr)}function Sy(l,u,m){if(Fr.current!==ii)throw Error(n(168));Un(Fr,u),Un(cs,m)}function Ey(l,u,m){var w=l.stateNode;if(u=u.childContextTypes,typeof w.getChildContext!="function")return m;w=w.getChildContext();for(var j in w)if(!(j in u))throw Error(n(108,ae(l)||"Unknown",j));return X({},m,w)}function Cf(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||ii,al=Fr.current,Un(Fr,l),Un(cs,cs.current),!0}function Cy(l,u,m){var w=l.stateNode;if(!w)throw Error(n(169));m?(l=Ey(l,u,al),w.__reactInternalMemoizedMergedChildContext=l,Gn(cs),Gn(Fr),Un(Fr,l)):Gn(cs),Un(cs,m)}var mo=null,jf=!1,Cm=!1;function jy(l){mo===null?mo=[l]:mo.push(l)}function BR(l){jf=!0,jy(l)}function li(){if(!Cm&&mo!==null){Cm=!0;var l=0,u=xn;try{var m=mo;for(xn=1;l<m.length;l++){var w=m[l];do w=w(!0);while(w!==null)}mo=null,jf=!1}catch(j){throw mo!==null&&(mo=mo.slice(l+1)),je(Sn,li),j}finally{xn=u,Cm=!1}}return null}var Nc=[],Mc=0,Af=null,Nf=0,Ws=[],Gs=0,ol=null,go=1,vo="";function il(l,u){Nc[Mc++]=Nf,Nc[Mc++]=Af,Af=l,Nf=u}function Ay(l,u,m){Ws[Gs++]=go,Ws[Gs++]=vo,Ws[Gs++]=ol,ol=l;var w=go;l=vo;var j=32-It(w)-1;w&=~(1<<j),m+=1;var R=32-It(u)+j;if(30<R){var _=j-j%5;R=(w&(1<<_)-1).toString(32),w>>=_,j-=_,go=1<<32-It(u)+j|m<<j|w,vo=R+l}else go=1<<R|m<<j|w,vo=l}function jm(l){l.return!==null&&(il(l,1),Ay(l,1,0))}function Am(l){for(;l===Af;)Af=Nc[--Mc],Nc[Mc]=null,Nf=Nc[--Mc],Nc[Mc]=null;for(;l===ol;)ol=Ws[--Gs],Ws[Gs]=null,vo=Ws[--Gs],Ws[Gs]=null,go=Ws[--Gs],Ws[Gs]=null}var Cs=null,js=null,Yn=!1,ga=null;function Ny(l,u){var m=Xs(5,null,null,0);m.elementType="DELETED",m.stateNode=u,m.return=l,u=l.deletions,u===null?(l.deletions=[m],l.flags|=16):u.push(m)}function My(l,u){switch(l.tag){case 5:var m=l.type;return u=u.nodeType!==1||m.toLowerCase()!==u.nodeName.toLowerCase()?null:u,u!==null?(l.stateNode=u,Cs=l,js=ai(u.firstChild),!0):!1;case 6:return u=l.pendingProps===""||u.nodeType!==3?null:u,u!==null?(l.stateNode=u,Cs=l,js=null,!0):!1;case 13:return u=u.nodeType!==8?null:u,u!==null?(m=ol!==null?{id:go,overflow:vo}:null,l.memoizedState={dehydrated:u,treeContext:m,retryLane:1073741824},m=Xs(18,null,null,0),m.stateNode=u,m.return=l,l.child=m,Cs=l,js=null,!0):!1;default:return!1}}function Nm(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Mm(l){if(Yn){var u=js;if(u){var m=u;if(!My(l,u)){if(Nm(l))throw Error(n(418));u=ai(m.nextSibling);var w=Cs;u&&My(l,u)?Ny(w,m):(l.flags=l.flags&-4097|2,Yn=!1,Cs=l)}}else{if(Nm(l))throw Error(n(418));l.flags=l.flags&-4097|2,Yn=!1,Cs=l}}}function Ry(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;Cs=l}function Mf(l){if(l!==Cs)return!1;if(!Yn)return Ry(l),Yn=!0,!1;var u;if((u=l.tag!==3)&&!(u=l.tag!==5)&&(u=l.type,u=u!=="head"&&u!=="body"&&!bm(l.type,l.memoizedProps)),u&&(u=js)){if(Nm(l))throw Py(),Error(n(418));for(;u;)Ny(l,u),u=ai(u.nextSibling)}if(Ry(l),l.tag===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(n(317));e:{for(l=l.nextSibling,u=0;l;){if(l.nodeType===8){var m=l.data;if(m==="/$"){if(u===0){js=ai(l.nextSibling);break e}u--}else m!=="$"&&m!=="$!"&&m!=="$?"||u++}l=l.nextSibling}js=null}}else js=Cs?ai(l.stateNode.nextSibling):null;return!0}function Py(){for(var l=js;l;)l=ai(l.nextSibling)}function Rc(){js=Cs=null,Yn=!1}function Rm(l){ga===null?ga=[l]:ga.push(l)}var UR=N.ReactCurrentBatchConfig;function ud(l,u,m){if(l=m.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(n(309));var w=m.stateNode}if(!w)throw Error(n(147,l));var j=w,R=""+l;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===R?u.ref:(u=function(_){var le=j.refs;_===null?delete le[R]:le[R]=_},u._stringRef=R,u)}if(typeof l!="string")throw Error(n(284));if(!m._owner)throw Error(n(290,l))}return l}function Rf(l,u){throw l=Object.prototype.toString.call(u),Error(n(31,l==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":l))}function Ly(l){var u=l._init;return u(l._payload)}function Ty(l){function u(Ne,xe){if(l){var Le=Ne.deletions;Le===null?(Ne.deletions=[xe],Ne.flags|=16):Le.push(xe)}}function m(Ne,xe){if(!l)return null;for(;xe!==null;)u(Ne,xe),xe=xe.sibling;return null}function w(Ne,xe){for(Ne=new Map;xe!==null;)xe.key!==null?Ne.set(xe.key,xe):Ne.set(xe.index,xe),xe=xe.sibling;return Ne}function j(Ne,xe){return Ne=gi(Ne,xe),Ne.index=0,Ne.sibling=null,Ne}function R(Ne,xe,Le){return Ne.index=Le,l?(Le=Ne.alternate,Le!==null?(Le=Le.index,Le<xe?(Ne.flags|=2,xe):Le):(Ne.flags|=2,xe)):(Ne.flags|=1048576,xe)}function _(Ne){return l&&Ne.alternate===null&&(Ne.flags|=2),Ne}function le(Ne,xe,Le,ct){return xe===null||xe.tag!==6?(xe=x2(Le,Ne.mode,ct),xe.return=Ne,xe):(xe=j(xe,Le),xe.return=Ne,xe)}function we(Ne,xe,Le,ct){var Lt=Le.type;return Lt===L?nt(Ne,xe,Le.props.children,ct,Le.key):xe!==null&&(xe.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===ie&&Ly(Lt)===xe.type)?(ct=j(xe,Le.props),ct.ref=ud(Ne,xe,Le),ct.return=Ne,ct):(ct=e1(Le.type,Le.key,Le.props,null,Ne.mode,ct),ct.ref=ud(Ne,xe,Le),ct.return=Ne,ct)}function De(Ne,xe,Le,ct){return xe===null||xe.tag!==4||xe.stateNode.containerInfo!==Le.containerInfo||xe.stateNode.implementation!==Le.implementation?(xe=k2(Le,Ne.mode,ct),xe.return=Ne,xe):(xe=j(xe,Le.children||[]),xe.return=Ne,xe)}function nt(Ne,xe,Le,ct,Lt){return xe===null||xe.tag!==7?(xe=ml(Le,Ne.mode,ct,Lt),xe.return=Ne,xe):(xe=j(xe,Le),xe.return=Ne,xe)}function at(Ne,xe,Le){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return xe=x2(""+xe,Ne.mode,Le),xe.return=Ne,xe;if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case M:return Le=e1(xe.type,xe.key,xe.props,null,Ne.mode,Le),Le.ref=ud(Ne,null,xe),Le.return=Ne,Le;case T:return xe=k2(xe,Ne.mode,Le),xe.return=Ne,xe;case ie:var ct=xe._init;return at(Ne,ct(xe._payload),Le)}if(he(xe)||te(xe))return xe=ml(xe,Ne.mode,Le,null),xe.return=Ne,xe;Rf(Ne,xe)}return null}function Je(Ne,xe,Le,ct){var Lt=xe!==null?xe.key:null;if(typeof Le=="string"&&Le!==""||typeof Le=="number")return Lt!==null?null:le(Ne,xe,""+Le,ct);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case M:return Le.key===Lt?we(Ne,xe,Le,ct):null;case T:return Le.key===Lt?De(Ne,xe,Le,ct):null;case ie:return Lt=Le._init,Je(Ne,xe,Lt(Le._payload),ct)}if(he(Le)||te(Le))return Lt!==null?null:nt(Ne,xe,Le,ct,null);Rf(Ne,Le)}return null}function St(Ne,xe,Le,ct,Lt){if(typeof ct=="string"&&ct!==""||typeof ct=="number")return Ne=Ne.get(Le)||null,le(xe,Ne,""+ct,Lt);if(typeof ct=="object"&&ct!==null){switch(ct.$$typeof){case M:return Ne=Ne.get(ct.key===null?Le:ct.key)||null,we(xe,Ne,ct,Lt);case T:return Ne=Ne.get(ct.key===null?Le:ct.key)||null,De(xe,Ne,ct,Lt);case ie:var Zt=ct._init;return St(Ne,xe,Le,Zt(ct._payload),Lt)}if(he(ct)||te(ct))return Ne=Ne.get(Le)||null,nt(xe,Ne,ct,Lt,null);Rf(xe,ct)}return null}function Mt(Ne,xe,Le,ct){for(var Lt=null,Zt=null,zt=xe,Kt=xe=0,jr=null;zt!==null&&Kt<Le.length;Kt++){zt.index>Kt?(jr=zt,zt=null):jr=zt.sibling;var En=Je(Ne,zt,Le[Kt],ct);if(En===null){zt===null&&(zt=jr);break}l&&zt&&En.alternate===null&&u(Ne,zt),xe=R(En,xe,Kt),Zt===null?Lt=En:Zt.sibling=En,Zt=En,zt=jr}if(Kt===Le.length)return m(Ne,zt),Yn&&il(Ne,Kt),Lt;if(zt===null){for(;Kt<Le.length;Kt++)zt=at(Ne,Le[Kt],ct),zt!==null&&(xe=R(zt,xe,Kt),Zt===null?Lt=zt:Zt.sibling=zt,Zt=zt);return Yn&&il(Ne,Kt),Lt}for(zt=w(Ne,zt);Kt<Le.length;Kt++)jr=St(zt,Ne,Kt,Le[Kt],ct),jr!==null&&(l&&jr.alternate!==null&&zt.delete(jr.key===null?Kt:jr.key),xe=R(jr,xe,Kt),Zt===null?Lt=jr:Zt.sibling=jr,Zt=jr);return l&&zt.forEach(function(vi){return u(Ne,vi)}),Yn&&il(Ne,Kt),Lt}function Rt(Ne,xe,Le,ct){var Lt=te(Le);if(typeof Lt!="function")throw Error(n(150));if(Le=Lt.call(Le),Le==null)throw Error(n(151));for(var Zt=Lt=null,zt=xe,Kt=xe=0,jr=null,En=Le.next();zt!==null&&!En.done;Kt++,En=Le.next()){zt.index>Kt?(jr=zt,zt=null):jr=zt.sibling;var vi=Je(Ne,zt,En.value,ct);if(vi===null){zt===null&&(zt=jr);break}l&&zt&&vi.alternate===null&&u(Ne,zt),xe=R(vi,xe,Kt),Zt===null?Lt=vi:Zt.sibling=vi,Zt=vi,zt=jr}if(En.done)return m(Ne,zt),Yn&&il(Ne,Kt),Lt;if(zt===null){for(;!En.done;Kt++,En=Le.next())En=at(Ne,En.value,ct),En!==null&&(xe=R(En,xe,Kt),Zt===null?Lt=En:Zt.sibling=En,Zt=En);return Yn&&il(Ne,Kt),Lt}for(zt=w(Ne,zt);!En.done;Kt++,En=Le.next())En=St(zt,Ne,Kt,En.value,ct),En!==null&&(l&&En.alternate!==null&&zt.delete(En.key===null?Kt:En.key),xe=R(En,xe,Kt),Zt===null?Lt=En:Zt.sibling=En,Zt=En);return l&&zt.forEach(function(EP){return u(Ne,EP)}),Yn&&il(Ne,Kt),Lt}function ir(Ne,xe,Le,ct){if(typeof Le=="object"&&Le!==null&&Le.type===L&&Le.key===null&&(Le=Le.props.children),typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case M:e:{for(var Lt=Le.key,Zt=xe;Zt!==null;){if(Zt.key===Lt){if(Lt=Le.type,Lt===L){if(Zt.tag===7){m(Ne,Zt.sibling),xe=j(Zt,Le.props.children),xe.return=Ne,Ne=xe;break e}}else if(Zt.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===ie&&Ly(Lt)===Zt.type){m(Ne,Zt.sibling),xe=j(Zt,Le.props),xe.ref=ud(Ne,Zt,Le),xe.return=Ne,Ne=xe;break e}m(Ne,Zt);break}else u(Ne,Zt);Zt=Zt.sibling}Le.type===L?(xe=ml(Le.props.children,Ne.mode,ct,Le.key),xe.return=Ne,Ne=xe):(ct=e1(Le.type,Le.key,Le.props,null,Ne.mode,ct),ct.ref=ud(Ne,xe,Le),ct.return=Ne,Ne=ct)}return _(Ne);case T:e:{for(Zt=Le.key;xe!==null;){if(xe.key===Zt)if(xe.tag===4&&xe.stateNode.containerInfo===Le.containerInfo&&xe.stateNode.implementation===Le.implementation){m(Ne,xe.sibling),xe=j(xe,Le.children||[]),xe.return=Ne,Ne=xe;break e}else{m(Ne,xe);break}else u(Ne,xe);xe=xe.sibling}xe=k2(Le,Ne.mode,ct),xe.return=Ne,Ne=xe}return _(Ne);case ie:return Zt=Le._init,ir(Ne,xe,Zt(Le._payload),ct)}if(he(Le))return Mt(Ne,xe,Le,ct);if(te(Le))return Rt(Ne,xe,Le,ct);Rf(Ne,Le)}return typeof Le=="string"&&Le!==""||typeof Le=="number"?(Le=""+Le,xe!==null&&xe.tag===6?(m(Ne,xe.sibling),xe=j(xe,Le),xe.return=Ne,Ne=xe):(m(Ne,xe),xe=x2(Le,Ne.mode,ct),xe.return=Ne,Ne=xe),_(Ne)):m(Ne,xe)}return ir}var Pc=Ty(!0),$y=Ty(!1),Pf=oi(null),Lf=null,Lc=null,Pm=null;function Lm(){Pm=Lc=Lf=null}function Tm(l){var u=Pf.current;Gn(Pf),l._currentValue=u}function $m(l,u,m){for(;l!==null;){var w=l.alternate;if((l.childLanes&u)!==u?(l.childLanes|=u,w!==null&&(w.childLanes|=u)):w!==null&&(w.childLanes&u)!==u&&(w.childLanes|=u),l===m)break;l=l.return}}function Tc(l,u){Lf=l,Pm=Lc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&u)!==0&&(ds=!0),l.firstContext=null)}function Ks(l){var u=l._currentValue;if(Pm!==l)if(l={context:l,memoizedValue:u,next:null},Lc===null){if(Lf===null)throw Error(n(308));Lc=l,Lf.dependencies={lanes:0,firstContext:l}}else Lc=Lc.next=l;return u}var ll=null;function Dm(l){ll===null?ll=[l]:ll.push(l)}function Dy(l,u,m,w){var j=u.interleaved;return j===null?(m.next=m,Dm(u)):(m.next=j.next,j.next=m),u.interleaved=m,yo(l,w)}function yo(l,u){l.lanes|=u;var m=l.alternate;for(m!==null&&(m.lanes|=u),m=l,l=l.return;l!==null;)l.childLanes|=u,m=l.alternate,m!==null&&(m.childLanes|=u),m=l,l=l.return;return m.tag===3?m.stateNode:null}var ci=!1;function Om(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Oy(l,u){l=l.updateQueue,u.updateQueue===l&&(u.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function wo(l,u){return{eventTime:l,lane:u,tag:0,payload:null,callback:null,next:null}}function ui(l,u,m){var w=l.updateQueue;if(w===null)return null;if(w=w.shared,(kn&2)!==0){var j=w.pending;return j===null?u.next=u:(u.next=j.next,j.next=u),w.pending=u,yo(l,m)}return j=w.interleaved,j===null?(u.next=u,Dm(w)):(u.next=j.next,j.next=u),w.interleaved=u,yo(l,m)}function Tf(l,u,m){if(u=u.updateQueue,u!==null&&(u=u.shared,(m&4194240)!==0)){var w=u.lanes;w&=l.pendingLanes,m|=w,u.lanes=m,zn(l,m)}}function Hy(l,u){var m=l.updateQueue,w=l.alternate;if(w!==null&&(w=w.updateQueue,m===w)){var j=null,R=null;if(m=m.firstBaseUpdate,m!==null){do{var _={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};R===null?j=R=_:R=R.next=_,m=m.next}while(m!==null);R===null?j=R=u:R=R.next=u}else j=R=u;m={baseState:w.baseState,firstBaseUpdate:j,lastBaseUpdate:R,shared:w.shared,effects:w.effects},l.updateQueue=m;return}l=m.lastBaseUpdate,l===null?m.firstBaseUpdate=u:l.next=u,m.lastBaseUpdate=u}function $f(l,u,m,w){var j=l.updateQueue;ci=!1;var R=j.firstBaseUpdate,_=j.lastBaseUpdate,le=j.shared.pending;if(le!==null){j.shared.pending=null;var we=le,De=we.next;we.next=null,_===null?R=De:_.next=De,_=we;var nt=l.alternate;nt!==null&&(nt=nt.updateQueue,le=nt.lastBaseUpdate,le!==_&&(le===null?nt.firstBaseUpdate=De:le.next=De,nt.lastBaseUpdate=we))}if(R!==null){var at=j.baseState;_=0,nt=De=we=null,le=R;do{var Je=le.lane,St=le.eventTime;if((w&Je)===Je){nt!==null&&(nt=nt.next={eventTime:St,lane:0,tag:le.tag,payload:le.payload,callback:le.callback,next:null});e:{var Mt=l,Rt=le;switch(Je=u,St=m,Rt.tag){case 1:if(Mt=Rt.payload,typeof Mt=="function"){at=Mt.call(St,at,Je);break e}at=Mt;break e;case 3:Mt.flags=Mt.flags&-65537|128;case 0:if(Mt=Rt.payload,Je=typeof Mt=="function"?Mt.call(St,at,Je):Mt,Je==null)break e;at=X({},at,Je);break e;case 2:ci=!0}}le.callback!==null&&le.lane!==0&&(l.flags|=64,Je=j.effects,Je===null?j.effects=[le]:Je.push(le))}else St={eventTime:St,lane:Je,tag:le.tag,payload:le.payload,callback:le.callback,next:null},nt===null?(De=nt=St,we=at):nt=nt.next=St,_|=Je;if(le=le.next,le===null){if(le=j.shared.pending,le===null)break;Je=le,le=Je.next,Je.next=null,j.lastBaseUpdate=Je,j.shared.pending=null}}while(!0);if(nt===null&&(we=at),j.baseState=we,j.firstBaseUpdate=De,j.lastBaseUpdate=nt,u=j.shared.interleaved,u!==null){j=u;do _|=j.lane,j=j.next;while(j!==u)}else R===null&&(j.shared.lanes=0);dl|=_,l.lanes=_,l.memoizedState=at}}function Iy(l,u,m){if(l=u.effects,u.effects=null,l!==null)for(u=0;u<l.length;u++){var w=l[u],j=w.callback;if(j!==null){if(w.callback=null,w=m,typeof j!="function")throw Error(n(191,j));j.call(w)}}}var dd={},Fa=oi(dd),fd=oi(dd),hd=oi(dd);function cl(l){if(l===dd)throw Error(n(174));return l}function Hm(l,u){switch(Un(hd,u),Un(fd,l),Un(Fa,dd),l=u.nodeType,l){case 9:case 11:u=(u=u.documentElement)?u.namespaceURI:Re(null,"");break;default:l=l===8?u.parentNode:u,u=l.namespaceURI||null,l=l.tagName,u=Re(u,l)}Gn(Fa),Un(Fa,u)}function $c(){Gn(Fa),Gn(fd),Gn(hd)}function Fy(l){cl(hd.current);var u=cl(Fa.current),m=Re(u,l.type);u!==m&&(Un(fd,l),Un(Fa,m))}function Im(l){fd.current===l&&(Gn(Fa),Gn(fd))}var qn=oi(0);function Df(l){for(var u=l;u!==null;){if(u.tag===13){var m=u.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||m.data==="$?"||m.data==="$!"))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var Fm=[];function _m(){for(var l=0;l<Fm.length;l++)Fm[l]._workInProgressVersionPrimary=null;Fm.length=0}var Of=N.ReactCurrentDispatcher,Vm=N.ReactCurrentBatchConfig,ul=0,Xn=null,vr=null,Er=null,Hf=!1,pd=!1,md=0,WR=0;function _r(){throw Error(n(321))}function Zm(l,u){if(u===null)return!1;for(var m=0;m<u.length&&m<l.length;m++)if(!ma(l[m],u[m]))return!1;return!0}function zm(l,u,m,w,j,R){if(ul=R,Xn=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,Of.current=l===null||l.memoizedState===null?qR:XR,l=m(w,j),pd){R=0;do{if(pd=!1,md=0,25<=R)throw Error(n(301));R+=1,Er=vr=null,u.updateQueue=null,Of.current=QR,l=m(w,j)}while(pd)}if(Of.current=_f,u=vr!==null&&vr.next!==null,ul=0,Er=vr=Xn=null,Hf=!1,u)throw Error(n(300));return l}function Bm(){var l=md!==0;return md=0,l}function _a(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Er===null?Xn.memoizedState=Er=l:Er=Er.next=l,Er}function Ys(){if(vr===null){var l=Xn.alternate;l=l!==null?l.memoizedState:null}else l=vr.next;var u=Er===null?Xn.memoizedState:Er.next;if(u!==null)Er=u,vr=l;else{if(l===null)throw Error(n(310));vr=l,l={memoizedState:vr.memoizedState,baseState:vr.baseState,baseQueue:vr.baseQueue,queue:vr.queue,next:null},Er===null?Xn.memoizedState=Er=l:Er=Er.next=l}return Er}function gd(l,u){return typeof u=="function"?u(l):u}function Um(l){var u=Ys(),m=u.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=l;var w=vr,j=w.baseQueue,R=m.pending;if(R!==null){if(j!==null){var _=j.next;j.next=R.next,R.next=_}w.baseQueue=j=R,m.pending=null}if(j!==null){R=j.next,w=w.baseState;var le=_=null,we=null,De=R;do{var nt=De.lane;if((ul&nt)===nt)we!==null&&(we=we.next={lane:0,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),w=De.hasEagerState?De.eagerState:l(w,De.action);else{var at={lane:nt,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null};we===null?(le=we=at,_=w):we=we.next=at,Xn.lanes|=nt,dl|=nt}De=De.next}while(De!==null&&De!==R);we===null?_=w:we.next=le,ma(w,u.memoizedState)||(ds=!0),u.memoizedState=w,u.baseState=_,u.baseQueue=we,m.lastRenderedState=w}if(l=m.interleaved,l!==null){j=l;do R=j.lane,Xn.lanes|=R,dl|=R,j=j.next;while(j!==l)}else j===null&&(m.lanes=0);return[u.memoizedState,m.dispatch]}function Wm(l){var u=Ys(),m=u.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=l;var w=m.dispatch,j=m.pending,R=u.memoizedState;if(j!==null){m.pending=null;var _=j=j.next;do R=l(R,_.action),_=_.next;while(_!==j);ma(R,u.memoizedState)||(ds=!0),u.memoizedState=R,u.baseQueue===null&&(u.baseState=R),m.lastRenderedState=R}return[R,w]}function _y(){}function Vy(l,u){var m=Xn,w=Ys(),j=u(),R=!ma(w.memoizedState,j);if(R&&(w.memoizedState=j,ds=!0),w=w.queue,Gm(By.bind(null,m,w,l),[l]),w.getSnapshot!==u||R||Er!==null&&Er.memoizedState.tag&1){if(m.flags|=2048,vd(9,zy.bind(null,m,w,j,u),void 0,null),Cr===null)throw Error(n(349));(ul&30)!==0||Zy(m,u,j)}return j}function Zy(l,u,m){l.flags|=16384,l={getSnapshot:u,value:m},u=Xn.updateQueue,u===null?(u={lastEffect:null,stores:null},Xn.updateQueue=u,u.stores=[l]):(m=u.stores,m===null?u.stores=[l]:m.push(l))}function zy(l,u,m,w){u.value=m,u.getSnapshot=w,Uy(u)&&Wy(l)}function By(l,u,m){return m(function(){Uy(u)&&Wy(l)})}function Uy(l){var u=l.getSnapshot;l=l.value;try{var m=u();return!ma(l,m)}catch{return!0}}function Wy(l){var u=yo(l,1);u!==null&&ba(u,l,1,-1)}function Gy(l){var u=_a();return typeof l=="function"&&(l=l()),u.memoizedState=u.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:gd,lastRenderedState:l},u.queue=l,l=l.dispatch=YR.bind(null,Xn,l),[u.memoizedState,l]}function vd(l,u,m,w){return l={tag:l,create:u,destroy:m,deps:w,next:null},u=Xn.updateQueue,u===null?(u={lastEffect:null,stores:null},Xn.updateQueue=u,u.lastEffect=l.next=l):(m=u.lastEffect,m===null?u.lastEffect=l.next=l:(w=m.next,m.next=l,l.next=w,u.lastEffect=l)),l}function Ky(){return Ys().memoizedState}function If(l,u,m,w){var j=_a();Xn.flags|=l,j.memoizedState=vd(1|u,m,void 0,w===void 0?null:w)}function Ff(l,u,m,w){var j=Ys();w=w===void 0?null:w;var R=void 0;if(vr!==null){var _=vr.memoizedState;if(R=_.destroy,w!==null&&Zm(w,_.deps)){j.memoizedState=vd(u,m,R,w);return}}Xn.flags|=l,j.memoizedState=vd(1|u,m,R,w)}function Yy(l,u){return If(8390656,8,l,u)}function Gm(l,u){return Ff(2048,8,l,u)}function qy(l,u){return Ff(4,2,l,u)}function Xy(l,u){return Ff(4,4,l,u)}function Qy(l,u){if(typeof u=="function")return l=l(),u(l),function(){u(null)};if(u!=null)return l=l(),u.current=l,function(){u.current=null}}function Jy(l,u,m){return m=m!=null?m.concat([l]):null,Ff(4,4,Qy.bind(null,u,l),m)}function Km(){}function ew(l,u){var m=Ys();u=u===void 0?null:u;var w=m.memoizedState;return w!==null&&u!==null&&Zm(u,w[1])?w[0]:(m.memoizedState=[l,u],l)}function tw(l,u){var m=Ys();u=u===void 0?null:u;var w=m.memoizedState;return w!==null&&u!==null&&Zm(u,w[1])?w[0]:(l=l(),m.memoizedState=[l,u],l)}function nw(l,u,m){return(ul&21)===0?(l.baseState&&(l.baseState=!1,ds=!0),l.memoizedState=m):(ma(m,u)||(m=rn(),Xn.lanes|=m,dl|=m,l.baseState=!0),u)}function GR(l,u){var m=xn;xn=m!==0&&4>m?m:4,l(!0);var w=Vm.transition;Vm.transition={};try{l(!1),u()}finally{xn=m,Vm.transition=w}}function rw(){return Ys().memoizedState}function KR(l,u,m){var w=pi(l);if(m={lane:w,action:m,hasEagerState:!1,eagerState:null,next:null},sw(l))aw(u,m);else if(m=Dy(l,u,m,w),m!==null){var j=qr();ba(m,l,w,j),ow(m,u,w)}}function YR(l,u,m){var w=pi(l),j={lane:w,action:m,hasEagerState:!1,eagerState:null,next:null};if(sw(l))aw(u,j);else{var R=l.alternate;if(l.lanes===0&&(R===null||R.lanes===0)&&(R=u.lastRenderedReducer,R!==null))try{var _=u.lastRenderedState,le=R(_,m);if(j.hasEagerState=!0,j.eagerState=le,ma(le,_)){var we=u.interleaved;we===null?(j.next=j,Dm(u)):(j.next=we.next,we.next=j),u.interleaved=j;return}}catch{}finally{}m=Dy(l,u,j,w),m!==null&&(j=qr(),ba(m,l,w,j),ow(m,u,w))}}function sw(l){var u=l.alternate;return l===Xn||u!==null&&u===Xn}function aw(l,u){pd=Hf=!0;var m=l.pending;m===null?u.next=u:(u.next=m.next,m.next=u),l.pending=u}function ow(l,u,m){if((m&4194240)!==0){var w=u.lanes;w&=l.pendingLanes,m|=w,u.lanes=m,zn(l,m)}}var _f={readContext:Ks,useCallback:_r,useContext:_r,useEffect:_r,useImperativeHandle:_r,useInsertionEffect:_r,useLayoutEffect:_r,useMemo:_r,useReducer:_r,useRef:_r,useState:_r,useDebugValue:_r,useDeferredValue:_r,useTransition:_r,useMutableSource:_r,useSyncExternalStore:_r,useId:_r,unstable_isNewReconciler:!1},qR={readContext:Ks,useCallback:function(l,u){return _a().memoizedState=[l,u===void 0?null:u],l},useContext:Ks,useEffect:Yy,useImperativeHandle:function(l,u,m){return m=m!=null?m.concat([l]):null,If(4194308,4,Qy.bind(null,u,l),m)},useLayoutEffect:function(l,u){return If(4194308,4,l,u)},useInsertionEffect:function(l,u){return If(4,2,l,u)},useMemo:function(l,u){var m=_a();return u=u===void 0?null:u,l=l(),m.memoizedState=[l,u],l},useReducer:function(l,u,m){var w=_a();return u=m!==void 0?m(u):u,w.memoizedState=w.baseState=u,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:u},w.queue=l,l=l.dispatch=KR.bind(null,Xn,l),[w.memoizedState,l]},useRef:function(l){var u=_a();return l={current:l},u.memoizedState=l},useState:Gy,useDebugValue:Km,useDeferredValue:function(l){return _a().memoizedState=l},useTransition:function(){var l=Gy(!1),u=l[0];return l=GR.bind(null,l[1]),_a().memoizedState=l,[u,l]},useMutableSource:function(){},useSyncExternalStore:function(l,u,m){var w=Xn,j=_a();if(Yn){if(m===void 0)throw Error(n(407));m=m()}else{if(m=u(),Cr===null)throw Error(n(349));(ul&30)!==0||Zy(w,u,m)}j.memoizedState=m;var R={value:m,getSnapshot:u};return j.queue=R,Yy(By.bind(null,w,R,l),[l]),w.flags|=2048,vd(9,zy.bind(null,w,R,m,u),void 0,null),m},useId:function(){var l=_a(),u=Cr.identifierPrefix;if(Yn){var m=vo,w=go;m=(w&~(1<<32-It(w)-1)).toString(32)+m,u=":"+u+"R"+m,m=md++,0<m&&(u+="H"+m.toString(32)),u+=":"}else m=WR++,u=":"+u+"r"+m.toString(32)+":";return l.memoizedState=u},unstable_isNewReconciler:!1},XR={readContext:Ks,useCallback:ew,useContext:Ks,useEffect:Gm,useImperativeHandle:Jy,useInsertionEffect:qy,useLayoutEffect:Xy,useMemo:tw,useReducer:Um,useRef:Ky,useState:function(){return Um(gd)},useDebugValue:Km,useDeferredValue:function(l){var u=Ys();return nw(u,vr.memoizedState,l)},useTransition:function(){var l=Um(gd)[0],u=Ys().memoizedState;return[l,u]},useMutableSource:_y,useSyncExternalStore:Vy,useId:rw,unstable_isNewReconciler:!1},QR={readContext:Ks,useCallback:ew,useContext:Ks,useEffect:Gm,useImperativeHandle:Jy,useInsertionEffect:qy,useLayoutEffect:Xy,useMemo:tw,useReducer:Wm,useRef:Ky,useState:function(){return Wm(gd)},useDebugValue:Km,useDeferredValue:function(l){var u=Ys();return vr===null?u.memoizedState=l:nw(u,vr.memoizedState,l)},useTransition:function(){var l=Wm(gd)[0],u=Ys().memoizedState;return[l,u]},useMutableSource:_y,useSyncExternalStore:Vy,useId:rw,unstable_isNewReconciler:!1};function va(l,u){if(l&&l.defaultProps){u=X({},u),l=l.defaultProps;for(var m in l)u[m]===void 0&&(u[m]=l[m]);return u}return u}function Ym(l,u,m,w){u=l.memoizedState,m=m(w,u),m=m==null?u:X({},u,m),l.memoizedState=m,l.lanes===0&&(l.updateQueue.baseState=m)}var Vf={isMounted:function(l){return(l=l._reactInternals)?Be(l)===l:!1},enqueueSetState:function(l,u,m){l=l._reactInternals;var w=qr(),j=pi(l),R=wo(w,j);R.payload=u,m!=null&&(R.callback=m),u=ui(l,R,j),u!==null&&(ba(u,l,j,w),Tf(u,l,j))},enqueueReplaceState:function(l,u,m){l=l._reactInternals;var w=qr(),j=pi(l),R=wo(w,j);R.tag=1,R.payload=u,m!=null&&(R.callback=m),u=ui(l,R,j),u!==null&&(ba(u,l,j,w),Tf(u,l,j))},enqueueForceUpdate:function(l,u){l=l._reactInternals;var m=qr(),w=pi(l),j=wo(m,w);j.tag=2,u!=null&&(j.callback=u),u=ui(l,j,w),u!==null&&(ba(u,l,w,m),Tf(u,l,w))}};function iw(l,u,m,w,j,R,_){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(w,R,_):u.prototype&&u.prototype.isPureReactComponent?!rd(m,w)||!rd(j,R):!0}function lw(l,u,m){var w=!1,j=ii,R=u.contextType;return typeof R=="object"&&R!==null?R=Ks(R):(j=us(u)?al:Fr.current,w=u.contextTypes,R=(w=w!=null)?Ac(l,j):ii),u=new u(m,R),l.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Vf,l.stateNode=u,u._reactInternals=l,w&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=j,l.__reactInternalMemoizedMaskedChildContext=R),u}function cw(l,u,m,w){l=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(m,w),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(m,w),u.state!==l&&Vf.enqueueReplaceState(u,u.state,null)}function qm(l,u,m,w){var j=l.stateNode;j.props=m,j.state=l.memoizedState,j.refs={},Om(l);var R=u.contextType;typeof R=="object"&&R!==null?j.context=Ks(R):(R=us(u)?al:Fr.current,j.context=Ac(l,R)),j.state=l.memoizedState,R=u.getDerivedStateFromProps,typeof R=="function"&&(Ym(l,u,R,m),j.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(u=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),u!==j.state&&Vf.enqueueReplaceState(j,j.state,null),$f(l,m,j,w),j.state=l.memoizedState),typeof j.componentDidMount=="function"&&(l.flags|=4194308)}function Dc(l,u){try{var m="",w=u;do m+=J(w),w=w.return;while(w);var j=m}catch(R){j=`
39
+ Error generating stack: `+R.message+`
40
+ `+R.stack}return{value:l,source:u,stack:j,digest:null}}function Xm(l,u,m){return{value:l,source:null,stack:m??null,digest:u??null}}function Qm(l,u){try{console.error(u.value)}catch(m){setTimeout(function(){throw m})}}var JR=typeof WeakMap=="function"?WeakMap:Map;function uw(l,u,m){m=wo(-1,m),m.tag=3,m.payload={element:null};var w=u.value;return m.callback=function(){Kf||(Kf=!0,h2=w),Qm(l,u)},m}function dw(l,u,m){m=wo(-1,m),m.tag=3;var w=l.type.getDerivedStateFromError;if(typeof w=="function"){var j=u.value;m.payload=function(){return w(j)},m.callback=function(){Qm(l,u)}}var R=l.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(m.callback=function(){Qm(l,u),typeof w!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})}),m}function fw(l,u,m){var w=l.pingCache;if(w===null){w=l.pingCache=new JR;var j=new Set;w.set(u,j)}else j=w.get(u),j===void 0&&(j=new Set,w.set(u,j));j.has(m)||(j.add(m),l=hP.bind(null,l,u,m),u.then(l,l))}function hw(l){do{var u;if((u=l.tag===13)&&(u=l.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return l;l=l.return}while(l!==null);return null}function pw(l,u,m,w,j){return(l.mode&1)===0?(l===u?l.flags|=65536:(l.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(u=wo(-1,1),u.tag=2,ui(m,u,1))),m.lanes|=1),l):(l.flags|=65536,l.lanes=j,l)}var eP=N.ReactCurrentOwner,ds=!1;function Yr(l,u,m,w){u.child=l===null?$y(u,null,m,w):Pc(u,l.child,m,w)}function mw(l,u,m,w,j){m=m.render;var R=u.ref;return Tc(u,j),w=zm(l,u,m,w,R,j),m=Bm(),l!==null&&!ds?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~j,bo(l,u,j)):(Yn&&m&&jm(u),u.flags|=1,Yr(l,u,w,j),u.child)}function gw(l,u,m,w,j){if(l===null){var R=m.type;return typeof R=="function"&&!b2(R)&&R.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(u.tag=15,u.type=R,vw(l,u,R,w,j)):(l=e1(m.type,null,w,u,u.mode,j),l.ref=u.ref,l.return=u,u.child=l)}if(R=l.child,(l.lanes&j)===0){var _=R.memoizedProps;if(m=m.compare,m=m!==null?m:rd,m(_,w)&&l.ref===u.ref)return bo(l,u,j)}return u.flags|=1,l=gi(R,w),l.ref=u.ref,l.return=u,u.child=l}function vw(l,u,m,w,j){if(l!==null){var R=l.memoizedProps;if(rd(R,w)&&l.ref===u.ref)if(ds=!1,u.pendingProps=w=R,(l.lanes&j)!==0)(l.flags&131072)!==0&&(ds=!0);else return u.lanes=l.lanes,bo(l,u,j)}return Jm(l,u,m,w,j)}function yw(l,u,m){var w=u.pendingProps,j=w.children,R=l!==null?l.memoizedState:null;if(w.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null,transitions:null},Un(Hc,As),As|=m;else{if((m&1073741824)===0)return l=R!==null?R.baseLanes|m:m,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:l,cachePool:null,transitions:null},u.updateQueue=null,Un(Hc,As),As|=l,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=R!==null?R.baseLanes:m,Un(Hc,As),As|=w}else R!==null?(w=R.baseLanes|m,u.memoizedState=null):w=m,Un(Hc,As),As|=w;return Yr(l,u,j,m),u.child}function ww(l,u){var m=u.ref;(l===null&&m!==null||l!==null&&l.ref!==m)&&(u.flags|=512,u.flags|=2097152)}function Jm(l,u,m,w,j){var R=us(m)?al:Fr.current;return R=Ac(u,R),Tc(u,j),m=zm(l,u,m,w,R,j),w=Bm(),l!==null&&!ds?(u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~j,bo(l,u,j)):(Yn&&w&&jm(u),u.flags|=1,Yr(l,u,m,j),u.child)}function bw(l,u,m,w,j){if(us(m)){var R=!0;Cf(u)}else R=!1;if(Tc(u,j),u.stateNode===null)zf(l,u),lw(u,m,w),qm(u,m,w,j),w=!0;else if(l===null){var _=u.stateNode,le=u.memoizedProps;_.props=le;var we=_.context,De=m.contextType;typeof De=="object"&&De!==null?De=Ks(De):(De=us(m)?al:Fr.current,De=Ac(u,De));var nt=m.getDerivedStateFromProps,at=typeof nt=="function"||typeof _.getSnapshotBeforeUpdate=="function";at||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(le!==w||we!==De)&&cw(u,_,w,De),ci=!1;var Je=u.memoizedState;_.state=Je,$f(u,w,_,j),we=u.memoizedState,le!==w||Je!==we||cs.current||ci?(typeof nt=="function"&&(Ym(u,m,nt,w),we=u.memoizedState),(le=ci||iw(u,m,le,w,Je,we,De))?(at||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(u.flags|=4194308)):(typeof _.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=w,u.memoizedState=we),_.props=w,_.state=we,_.context=De,w=le):(typeof _.componentDidMount=="function"&&(u.flags|=4194308),w=!1)}else{_=u.stateNode,Oy(l,u),le=u.memoizedProps,De=u.type===u.elementType?le:va(u.type,le),_.props=De,at=u.pendingProps,Je=_.context,we=m.contextType,typeof we=="object"&&we!==null?we=Ks(we):(we=us(m)?al:Fr.current,we=Ac(u,we));var St=m.getDerivedStateFromProps;(nt=typeof St=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(le!==at||Je!==we)&&cw(u,_,w,we),ci=!1,Je=u.memoizedState,_.state=Je,$f(u,w,_,j);var Mt=u.memoizedState;le!==at||Je!==Mt||cs.current||ci?(typeof St=="function"&&(Ym(u,m,St,w),Mt=u.memoizedState),(De=ci||iw(u,m,De,w,Je,Mt,we)||!1)?(nt||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(w,Mt,we),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(w,Mt,we)),typeof _.componentDidUpdate=="function"&&(u.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof _.componentDidUpdate!="function"||le===l.memoizedProps&&Je===l.memoizedState||(u.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||le===l.memoizedProps&&Je===l.memoizedState||(u.flags|=1024),u.memoizedProps=w,u.memoizedState=Mt),_.props=w,_.state=Mt,_.context=we,w=De):(typeof _.componentDidUpdate!="function"||le===l.memoizedProps&&Je===l.memoizedState||(u.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||le===l.memoizedProps&&Je===l.memoizedState||(u.flags|=1024),w=!1)}return e2(l,u,m,w,R,j)}function e2(l,u,m,w,j,R){ww(l,u);var _=(u.flags&128)!==0;if(!w&&!_)return j&&Cy(u,m,!1),bo(l,u,R);w=u.stateNode,eP.current=u;var le=_&&typeof m.getDerivedStateFromError!="function"?null:w.render();return u.flags|=1,l!==null&&_?(u.child=Pc(u,l.child,null,R),u.child=Pc(u,null,le,R)):Yr(l,u,le,R),u.memoizedState=w.state,j&&Cy(u,m,!0),u.child}function xw(l){var u=l.stateNode;u.pendingContext?Sy(l,u.pendingContext,u.pendingContext!==u.context):u.context&&Sy(l,u.context,!1),Hm(l,u.containerInfo)}function kw(l,u,m,w,j){return Rc(),Rm(j),u.flags|=256,Yr(l,u,m,w),u.child}var t2={dehydrated:null,treeContext:null,retryLane:0};function n2(l){return{baseLanes:l,cachePool:null,transitions:null}}function Sw(l,u,m){var w=u.pendingProps,j=qn.current,R=!1,_=(u.flags&128)!==0,le;if((le=_)||(le=l!==null&&l.memoizedState===null?!1:(j&2)!==0),le?(R=!0,u.flags&=-129):(l===null||l.memoizedState!==null)&&(j|=1),Un(qn,j&1),l===null)return Mm(u),l=u.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((u.mode&1)===0?u.lanes=1:l.data==="$!"?u.lanes=8:u.lanes=1073741824,null):(_=w.children,l=w.fallback,R?(w=u.mode,R=u.child,_={mode:"hidden",children:_},(w&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=_):R=t1(_,w,0,null),l=ml(l,w,m,null),R.return=u,l.return=u,R.sibling=l,u.child=R,u.child.memoizedState=n2(m),u.memoizedState=t2,l):r2(u,_));if(j=l.memoizedState,j!==null&&(le=j.dehydrated,le!==null))return tP(l,u,_,w,le,j,m);if(R){R=w.fallback,_=u.mode,j=l.child,le=j.sibling;var we={mode:"hidden",children:w.children};return(_&1)===0&&u.child!==j?(w=u.child,w.childLanes=0,w.pendingProps=we,u.deletions=null):(w=gi(j,we),w.subtreeFlags=j.subtreeFlags&14680064),le!==null?R=gi(le,R):(R=ml(R,_,m,null),R.flags|=2),R.return=u,w.return=u,w.sibling=R,u.child=w,w=R,R=u.child,_=l.child.memoizedState,_=_===null?n2(m):{baseLanes:_.baseLanes|m,cachePool:null,transitions:_.transitions},R.memoizedState=_,R.childLanes=l.childLanes&~m,u.memoizedState=t2,w}return R=l.child,l=R.sibling,w=gi(R,{mode:"visible",children:w.children}),(u.mode&1)===0&&(w.lanes=m),w.return=u,w.sibling=null,l!==null&&(m=u.deletions,m===null?(u.deletions=[l],u.flags|=16):m.push(l)),u.child=w,u.memoizedState=null,w}function r2(l,u){return u=t1({mode:"visible",children:u},l.mode,0,null),u.return=l,l.child=u}function Zf(l,u,m,w){return w!==null&&Rm(w),Pc(u,l.child,null,m),l=r2(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function tP(l,u,m,w,j,R,_){if(m)return u.flags&256?(u.flags&=-257,w=Xm(Error(n(422))),Zf(l,u,_,w)):u.memoizedState!==null?(u.child=l.child,u.flags|=128,null):(R=w.fallback,j=u.mode,w=t1({mode:"visible",children:w.children},j,0,null),R=ml(R,j,_,null),R.flags|=2,w.return=u,R.return=u,w.sibling=R,u.child=w,(u.mode&1)!==0&&Pc(u,l.child,null,_),u.child.memoizedState=n2(_),u.memoizedState=t2,R);if((u.mode&1)===0)return Zf(l,u,_,null);if(j.data==="$!"){if(w=j.nextSibling&&j.nextSibling.dataset,w)var le=w.dgst;return w=le,R=Error(n(419)),w=Xm(R,w,void 0),Zf(l,u,_,w)}if(le=(_&l.childLanes)!==0,ds||le){if(w=Cr,w!==null){switch(_&-_){case 4:j=2;break;case 16:j=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:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(w.suspendedLanes|_))!==0?0:j,j!==0&&j!==R.retryLane&&(R.retryLane=j,yo(l,j),ba(w,l,j,-1))}return w2(),w=Xm(Error(n(421))),Zf(l,u,_,w)}return j.data==="$?"?(u.flags|=128,u.child=l.child,u=pP.bind(null,l),j._reactRetry=u,null):(l=R.treeContext,js=ai(j.nextSibling),Cs=u,Yn=!0,ga=null,l!==null&&(Ws[Gs++]=go,Ws[Gs++]=vo,Ws[Gs++]=ol,go=l.id,vo=l.overflow,ol=u),u=r2(u,w.children),u.flags|=4096,u)}function Ew(l,u,m){l.lanes|=u;var w=l.alternate;w!==null&&(w.lanes|=u),$m(l.return,u,m)}function s2(l,u,m,w,j){var R=l.memoizedState;R===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:w,tail:m,tailMode:j}:(R.isBackwards=u,R.rendering=null,R.renderingStartTime=0,R.last=w,R.tail=m,R.tailMode=j)}function Cw(l,u,m){var w=u.pendingProps,j=w.revealOrder,R=w.tail;if(Yr(l,u,w.children,m),w=qn.current,(w&2)!==0)w=w&1|2,u.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&Ew(l,m,u);else if(l.tag===19)Ew(l,m,u);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===u)break e;for(;l.sibling===null;){if(l.return===null||l.return===u)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}w&=1}if(Un(qn,w),(u.mode&1)===0)u.memoizedState=null;else switch(j){case"forwards":for(m=u.child,j=null;m!==null;)l=m.alternate,l!==null&&Df(l)===null&&(j=m),m=m.sibling;m=j,m===null?(j=u.child,u.child=null):(j=m.sibling,m.sibling=null),s2(u,!1,j,m,R);break;case"backwards":for(m=null,j=u.child,u.child=null;j!==null;){if(l=j.alternate,l!==null&&Df(l)===null){u.child=j;break}l=j.sibling,j.sibling=m,m=j,j=l}s2(u,!0,m,null,R);break;case"together":s2(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function zf(l,u){(u.mode&1)===0&&l!==null&&(l.alternate=null,u.alternate=null,u.flags|=2)}function bo(l,u,m){if(l!==null&&(u.dependencies=l.dependencies),dl|=u.lanes,(m&u.childLanes)===0)return null;if(l!==null&&u.child!==l.child)throw Error(n(153));if(u.child!==null){for(l=u.child,m=gi(l,l.pendingProps),u.child=m,m.return=u;l.sibling!==null;)l=l.sibling,m=m.sibling=gi(l,l.pendingProps),m.return=u;m.sibling=null}return u.child}function nP(l,u,m){switch(u.tag){case 3:xw(u),Rc();break;case 5:Fy(u);break;case 1:us(u.type)&&Cf(u);break;case 4:Hm(u,u.stateNode.containerInfo);break;case 10:var w=u.type._context,j=u.memoizedProps.value;Un(Pf,w._currentValue),w._currentValue=j;break;case 13:if(w=u.memoizedState,w!==null)return w.dehydrated!==null?(Un(qn,qn.current&1),u.flags|=128,null):(m&u.child.childLanes)!==0?Sw(l,u,m):(Un(qn,qn.current&1),l=bo(l,u,m),l!==null?l.sibling:null);Un(qn,qn.current&1);break;case 19:if(w=(m&u.childLanes)!==0,(l.flags&128)!==0){if(w)return Cw(l,u,m);u.flags|=128}if(j=u.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),Un(qn,qn.current),w)break;return null;case 22:case 23:return u.lanes=0,yw(l,u,m)}return bo(l,u,m)}var jw,a2,Aw,Nw;jw=function(l,u){for(var m=u.child;m!==null;){if(m.tag===5||m.tag===6)l.appendChild(m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===u)break;for(;m.sibling===null;){if(m.return===null||m.return===u)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},a2=function(){},Aw=function(l,u,m,w){var j=l.memoizedProps;if(j!==w){l=u.stateNode,cl(Fa.current);var R=null;switch(m){case"input":j=G(l,j),w=G(l,w),R=[];break;case"select":j=X({},j,{value:void 0}),w=X({},w,{value:void 0}),R=[];break;case"textarea":j=ue(l,j),w=ue(l,w),R=[];break;default:typeof j.onClick!="function"&&typeof w.onClick=="function"&&(l.onclick=kf)}yn(m,w);var _;m=null;for(De in j)if(!w.hasOwnProperty(De)&&j.hasOwnProperty(De)&&j[De]!=null)if(De==="style"){var le=j[De];for(_ in le)le.hasOwnProperty(_)&&(m||(m={}),m[_]="")}else De!=="dangerouslySetInnerHTML"&&De!=="children"&&De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&De!=="autoFocus"&&(a.hasOwnProperty(De)?R||(R=[]):(R=R||[]).push(De,null));for(De in w){var we=w[De];if(le=j!=null?j[De]:void 0,w.hasOwnProperty(De)&&we!==le&&(we!=null||le!=null))if(De==="style")if(le){for(_ in le)!le.hasOwnProperty(_)||we&&we.hasOwnProperty(_)||(m||(m={}),m[_]="");for(_ in we)we.hasOwnProperty(_)&&le[_]!==we[_]&&(m||(m={}),m[_]=we[_])}else m||(R||(R=[]),R.push(De,m)),m=we;else De==="dangerouslySetInnerHTML"?(we=we?we.__html:void 0,le=le?le.__html:void 0,we!=null&&le!==we&&(R=R||[]).push(De,we)):De==="children"?typeof we!="string"&&typeof we!="number"||(R=R||[]).push(De,""+we):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(a.hasOwnProperty(De)?(we!=null&&De==="onScroll"&&Wn("scroll",l),R||le===we||(R=[])):(R=R||[]).push(De,we))}m&&(R=R||[]).push("style",m);var De=R;(u.updateQueue=De)&&(u.flags|=4)}},Nw=function(l,u,m,w){m!==w&&(u.flags|=4)};function yd(l,u){if(!Yn)switch(l.tailMode){case"hidden":u=l.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?l.tail=null:m.sibling=null;break;case"collapsed":m=l.tail;for(var w=null;m!==null;)m.alternate!==null&&(w=m),m=m.sibling;w===null?u||l.tail===null?l.tail=null:l.tail.sibling=null:w.sibling=null}}function Vr(l){var u=l.alternate!==null&&l.alternate.child===l.child,m=0,w=0;if(u)for(var j=l.child;j!==null;)m|=j.lanes|j.childLanes,w|=j.subtreeFlags&14680064,w|=j.flags&14680064,j.return=l,j=j.sibling;else for(j=l.child;j!==null;)m|=j.lanes|j.childLanes,w|=j.subtreeFlags,w|=j.flags,j.return=l,j=j.sibling;return l.subtreeFlags|=w,l.childLanes=m,u}function rP(l,u,m){var w=u.pendingProps;switch(Am(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vr(u),null;case 1:return us(u.type)&&Ef(),Vr(u),null;case 3:return w=u.stateNode,$c(),Gn(cs),Gn(Fr),_m(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(l===null||l.child===null)&&(Mf(u)?u.flags|=4:l===null||l.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,ga!==null&&(g2(ga),ga=null))),a2(l,u),Vr(u),null;case 5:Im(u);var j=cl(hd.current);if(m=u.type,l!==null&&u.stateNode!=null)Aw(l,u,m,w,j),l.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!w){if(u.stateNode===null)throw Error(n(166));return Vr(u),null}if(l=cl(Fa.current),Mf(u)){w=u.stateNode,m=u.type;var R=u.memoizedProps;switch(w[Ia]=u,w[ld]=R,l=(u.mode&1)!==0,m){case"dialog":Wn("cancel",w),Wn("close",w);break;case"iframe":case"object":case"embed":Wn("load",w);break;case"video":case"audio":for(j=0;j<ad.length;j++)Wn(ad[j],w);break;case"source":Wn("error",w);break;case"img":case"image":case"link":Wn("error",w),Wn("load",w);break;case"details":Wn("toggle",w);break;case"input":Pe(w,R),Wn("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!R.multiple},Wn("invalid",w);break;case"textarea":ke(w,R),Wn("invalid",w)}yn(m,R),j=null;for(var _ in R)if(R.hasOwnProperty(_)){var le=R[_];_==="children"?typeof le=="string"?w.textContent!==le&&(R.suppressHydrationWarning!==!0&&xf(w.textContent,le,l),j=["children",le]):typeof le=="number"&&w.textContent!==""+le&&(R.suppressHydrationWarning!==!0&&xf(w.textContent,le,l),j=["children",""+le]):a.hasOwnProperty(_)&&le!=null&&_==="onScroll"&&Wn("scroll",w)}switch(m){case"input":ge(w),tt(w,R,!0);break;case"textarea":ge(w),Ve(w);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(w.onclick=kf)}w=j,u.updateQueue=w,w!==null&&(u.flags|=4)}else{_=j.nodeType===9?j:j.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=Xe(m)),l==="http://www.w3.org/1999/xhtml"?m==="script"?(l=_.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof w.is=="string"?l=_.createElement(m,{is:w.is}):(l=_.createElement(m),m==="select"&&(_=l,w.multiple?_.multiple=!0:w.size&&(_.size=w.size))):l=_.createElementNS(l,m),l[Ia]=u,l[ld]=w,jw(l,u,!1,!1),u.stateNode=l;e:{switch(_=Oe(m,w),m){case"dialog":Wn("cancel",l),Wn("close",l),j=w;break;case"iframe":case"object":case"embed":Wn("load",l),j=w;break;case"video":case"audio":for(j=0;j<ad.length;j++)Wn(ad[j],l);j=w;break;case"source":Wn("error",l),j=w;break;case"img":case"image":case"link":Wn("error",l),Wn("load",l),j=w;break;case"details":Wn("toggle",l),j=w;break;case"input":Pe(l,w),j=G(l,w),Wn("invalid",l);break;case"option":j=w;break;case"select":l._wrapperState={wasMultiple:!!w.multiple},j=X({},w,{value:void 0}),Wn("invalid",l);break;case"textarea":ke(l,w),j=ue(l,w),Wn("invalid",l);break;default:j=w}yn(m,j),le=j;for(R in le)if(le.hasOwnProperty(R)){var we=le[R];R==="style"?yt(l,we):R==="dangerouslySetInnerHTML"?(we=we?we.__html:void 0,we!=null&&st(l,we)):R==="children"?typeof we=="string"?(m!=="textarea"||we!=="")&&Ye(l,we):typeof we=="number"&&Ye(l,""+we):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(a.hasOwnProperty(R)?we!=null&&R==="onScroll"&&Wn("scroll",l):we!=null&&C(l,R,we,_))}switch(m){case"input":ge(l),tt(l,w,!1);break;case"textarea":ge(l),Ve(l);break;case"option":w.value!=null&&l.setAttribute("value",""+W(w.value));break;case"select":l.multiple=!!w.multiple,R=w.value,R!=null?Ae(l,!!w.multiple,R,!1):w.defaultValue!=null&&Ae(l,!!w.multiple,w.defaultValue,!0);break;default:typeof j.onClick=="function"&&(l.onclick=kf)}switch(m){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(u.flags|=4)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Vr(u),null;case 6:if(l&&u.stateNode!=null)Nw(l,u,l.memoizedProps,w);else{if(typeof w!="string"&&u.stateNode===null)throw Error(n(166));if(m=cl(hd.current),cl(Fa.current),Mf(u)){if(w=u.stateNode,m=u.memoizedProps,w[Ia]=u,(R=w.nodeValue!==m)&&(l=Cs,l!==null))switch(l.tag){case 3:xf(w.nodeValue,m,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&xf(w.nodeValue,m,(l.mode&1)!==0)}R&&(u.flags|=4)}else w=(m.nodeType===9?m:m.ownerDocument).createTextNode(w),w[Ia]=u,u.stateNode=w}return Vr(u),null;case 13:if(Gn(qn),w=u.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(Yn&&js!==null&&(u.mode&1)!==0&&(u.flags&128)===0)Py(),Rc(),u.flags|=98560,R=!1;else if(R=Mf(u),w!==null&&w.dehydrated!==null){if(l===null){if(!R)throw Error(n(318));if(R=u.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(n(317));R[Ia]=u}else Rc(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Vr(u),R=!1}else ga!==null&&(g2(ga),ga=null),R=!0;if(!R)return u.flags&65536?u:null}return(u.flags&128)!==0?(u.lanes=m,u):(w=w!==null,w!==(l!==null&&l.memoizedState!==null)&&w&&(u.child.flags|=8192,(u.mode&1)!==0&&(l===null||(qn.current&1)!==0?yr===0&&(yr=3):w2())),u.updateQueue!==null&&(u.flags|=4),Vr(u),null);case 4:return $c(),a2(l,u),l===null&&od(u.stateNode.containerInfo),Vr(u),null;case 10:return Tm(u.type._context),Vr(u),null;case 17:return us(u.type)&&Ef(),Vr(u),null;case 19:if(Gn(qn),R=u.memoizedState,R===null)return Vr(u),null;if(w=(u.flags&128)!==0,_=R.rendering,_===null)if(w)yd(R,!1);else{if(yr!==0||l!==null&&(l.flags&128)!==0)for(l=u.child;l!==null;){if(_=Df(l),_!==null){for(u.flags|=128,yd(R,!1),w=_.updateQueue,w!==null&&(u.updateQueue=w,u.flags|=4),u.subtreeFlags=0,w=m,m=u.child;m!==null;)R=m,l=w,R.flags&=14680066,_=R.alternate,_===null?(R.childLanes=0,R.lanes=l,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=_.childLanes,R.lanes=_.lanes,R.child=_.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=_.memoizedProps,R.memoizedState=_.memoizedState,R.updateQueue=_.updateQueue,R.type=_.type,l=_.dependencies,R.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),m=m.sibling;return Un(qn,qn.current&1|2),u.child}l=l.sibling}R.tail!==null&&et()>Ic&&(u.flags|=128,w=!0,yd(R,!1),u.lanes=4194304)}else{if(!w)if(l=Df(_),l!==null){if(u.flags|=128,w=!0,m=l.updateQueue,m!==null&&(u.updateQueue=m,u.flags|=4),yd(R,!0),R.tail===null&&R.tailMode==="hidden"&&!_.alternate&&!Yn)return Vr(u),null}else 2*et()-R.renderingStartTime>Ic&&m!==1073741824&&(u.flags|=128,w=!0,yd(R,!1),u.lanes=4194304);R.isBackwards?(_.sibling=u.child,u.child=_):(m=R.last,m!==null?m.sibling=_:u.child=_,R.last=_)}return R.tail!==null?(u=R.tail,R.rendering=u,R.tail=u.sibling,R.renderingStartTime=et(),u.sibling=null,m=qn.current,Un(qn,w?m&1|2:m&1),u):(Vr(u),null);case 22:case 23:return y2(),w=u.memoizedState!==null,l!==null&&l.memoizedState!==null!==w&&(u.flags|=8192),w&&(u.mode&1)!==0?(As&1073741824)!==0&&(Vr(u),u.subtreeFlags&6&&(u.flags|=8192)):Vr(u),null;case 24:return null;case 25:return null}throw Error(n(156,u.tag))}function sP(l,u){switch(Am(u),u.tag){case 1:return us(u.type)&&Ef(),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return $c(),Gn(cs),Gn(Fr),_m(),l=u.flags,(l&65536)!==0&&(l&128)===0?(u.flags=l&-65537|128,u):null;case 5:return Im(u),null;case 13:if(Gn(qn),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(n(340));Rc()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return Gn(qn),null;case 4:return $c(),null;case 10:return Tm(u.type._context),null;case 22:case 23:return y2(),null;case 24:return null;default:return null}}var Bf=!1,Zr=!1,aP=typeof WeakSet=="function"?WeakSet:Set,At=null;function Oc(l,u){var m=l.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(w){rr(l,u,w)}else m.current=null}function o2(l,u,m){try{m()}catch(w){rr(l,u,w)}}var Mw=!1;function oP(l,u){if(ym=gc,l=iy(),um(l)){if("selectionStart"in l)var m={start:l.selectionStart,end:l.selectionEnd};else e:{m=(m=l.ownerDocument)&&m.defaultView||window;var w=m.getSelection&&m.getSelection();if(w&&w.rangeCount!==0){m=w.anchorNode;var j=w.anchorOffset,R=w.focusNode;w=w.focusOffset;try{m.nodeType,R.nodeType}catch{m=null;break e}var _=0,le=-1,we=-1,De=0,nt=0,at=l,Je=null;t:for(;;){for(var St;at!==m||j!==0&&at.nodeType!==3||(le=_+j),at!==R||w!==0&&at.nodeType!==3||(we=_+w),at.nodeType===3&&(_+=at.nodeValue.length),(St=at.firstChild)!==null;)Je=at,at=St;for(;;){if(at===l)break t;if(Je===m&&++De===j&&(le=_),Je===R&&++nt===w&&(we=_),(St=at.nextSibling)!==null)break;at=Je,Je=at.parentNode}at=St}m=le===-1||we===-1?null:{start:le,end:we}}else m=null}m=m||{start:0,end:0}}else m=null;for(wm={focusedElem:l,selectionRange:m},gc=!1,At=u;At!==null;)if(u=At,l=u.child,(u.subtreeFlags&1028)!==0&&l!==null)l.return=u,At=l;else for(;At!==null;){u=At;try{var Mt=u.alternate;if((u.flags&1024)!==0)switch(u.tag){case 0:case 11:case 15:break;case 1:if(Mt!==null){var Rt=Mt.memoizedProps,ir=Mt.memoizedState,Ne=u.stateNode,xe=Ne.getSnapshotBeforeUpdate(u.elementType===u.type?Rt:va(u.type,Rt),ir);Ne.__reactInternalSnapshotBeforeUpdate=xe}break;case 3:var Le=u.stateNode.containerInfo;Le.nodeType===1?Le.textContent="":Le.nodeType===9&&Le.documentElement&&Le.removeChild(Le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ct){rr(u,u.return,ct)}if(l=u.sibling,l!==null){l.return=u.return,At=l;break}At=u.return}return Mt=Mw,Mw=!1,Mt}function wd(l,u,m){var w=u.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var j=w=w.next;do{if((j.tag&l)===l){var R=j.destroy;j.destroy=void 0,R!==void 0&&o2(u,m,R)}j=j.next}while(j!==w)}}function Uf(l,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var m=u=u.next;do{if((m.tag&l)===l){var w=m.create;m.destroy=w()}m=m.next}while(m!==u)}}function i2(l){var u=l.ref;if(u!==null){var m=l.stateNode;switch(l.tag){case 5:l=m;break;default:l=m}typeof u=="function"?u(l):u.current=l}}function Rw(l){var u=l.alternate;u!==null&&(l.alternate=null,Rw(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&(delete u[Ia],delete u[ld],delete u[Sm],delete u[ZR],delete u[zR])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Pw(l){return l.tag===5||l.tag===3||l.tag===4}function Lw(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Pw(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function l2(l,u,m){var w=l.tag;if(w===5||w===6)l=l.stateNode,u?m.nodeType===8?m.parentNode.insertBefore(l,u):m.insertBefore(l,u):(m.nodeType===8?(u=m.parentNode,u.insertBefore(l,m)):(u=m,u.appendChild(l)),m=m._reactRootContainer,m!=null||u.onclick!==null||(u.onclick=kf));else if(w!==4&&(l=l.child,l!==null))for(l2(l,u,m),l=l.sibling;l!==null;)l2(l,u,m),l=l.sibling}function c2(l,u,m){var w=l.tag;if(w===5||w===6)l=l.stateNode,u?m.insertBefore(l,u):m.appendChild(l);else if(w!==4&&(l=l.child,l!==null))for(c2(l,u,m),l=l.sibling;l!==null;)c2(l,u,m),l=l.sibling}var Rr=null,ya=!1;function di(l,u,m){for(m=m.child;m!==null;)Tw(l,u,m),m=m.sibling}function Tw(l,u,m){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(lt,m)}catch{}switch(m.tag){case 5:Zr||Oc(m,u);case 6:var w=Rr,j=ya;Rr=null,di(l,u,m),Rr=w,ya=j,Rr!==null&&(ya?(l=Rr,m=m.stateNode,l.nodeType===8?l.parentNode.removeChild(m):l.removeChild(m)):Rr.removeChild(m.stateNode));break;case 18:Rr!==null&&(ya?(l=Rr,m=m.stateNode,l.nodeType===8?km(l.parentNode,m):l.nodeType===1&&km(l,m),ho(l)):km(Rr,m.stateNode));break;case 4:w=Rr,j=ya,Rr=m.stateNode.containerInfo,ya=!0,di(l,u,m),Rr=w,ya=j;break;case 0:case 11:case 14:case 15:if(!Zr&&(w=m.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){j=w=w.next;do{var R=j,_=R.destroy;R=R.tag,_!==void 0&&((R&2)!==0||(R&4)!==0)&&o2(m,u,_),j=j.next}while(j!==w)}di(l,u,m);break;case 1:if(!Zr&&(Oc(m,u),w=m.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=m.memoizedProps,w.state=m.memoizedState,w.componentWillUnmount()}catch(le){rr(m,u,le)}di(l,u,m);break;case 21:di(l,u,m);break;case 22:m.mode&1?(Zr=(w=Zr)||m.memoizedState!==null,di(l,u,m),Zr=w):di(l,u,m);break;default:di(l,u,m)}}function $w(l){var u=l.updateQueue;if(u!==null){l.updateQueue=null;var m=l.stateNode;m===null&&(m=l.stateNode=new aP),u.forEach(function(w){var j=mP.bind(null,l,w);m.has(w)||(m.add(w),w.then(j,j))})}}function wa(l,u){var m=u.deletions;if(m!==null)for(var w=0;w<m.length;w++){var j=m[w];try{var R=l,_=u,le=_;e:for(;le!==null;){switch(le.tag){case 5:Rr=le.stateNode,ya=!1;break e;case 3:Rr=le.stateNode.containerInfo,ya=!0;break e;case 4:Rr=le.stateNode.containerInfo,ya=!0;break e}le=le.return}if(Rr===null)throw Error(n(160));Tw(R,_,j),Rr=null,ya=!1;var we=j.alternate;we!==null&&(we.return=null),j.return=null}catch(De){rr(j,u,De)}}if(u.subtreeFlags&12854)for(u=u.child;u!==null;)Dw(u,l),u=u.sibling}function Dw(l,u){var m=l.alternate,w=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(wa(u,l),Va(l),w&4){try{wd(3,l,l.return),Uf(3,l)}catch(Rt){rr(l,l.return,Rt)}try{wd(5,l,l.return)}catch(Rt){rr(l,l.return,Rt)}}break;case 1:wa(u,l),Va(l),w&512&&m!==null&&Oc(m,m.return);break;case 5:if(wa(u,l),Va(l),w&512&&m!==null&&Oc(m,m.return),l.flags&32){var j=l.stateNode;try{Ye(j,"")}catch(Rt){rr(l,l.return,Rt)}}if(w&4&&(j=l.stateNode,j!=null)){var R=l.memoizedProps,_=m!==null?m.memoizedProps:R,le=l.type,we=l.updateQueue;if(l.updateQueue=null,we!==null)try{le==="input"&&R.type==="radio"&&R.name!=null&&Ze(j,R),Oe(le,_);var De=Oe(le,R);for(_=0;_<we.length;_+=2){var nt=we[_],at=we[_+1];nt==="style"?yt(j,at):nt==="dangerouslySetInnerHTML"?st(j,at):nt==="children"?Ye(j,at):C(j,nt,at,De)}switch(le){case"input":He(j,R);break;case"textarea":qe(j,R);break;case"select":var Je=j._wrapperState.wasMultiple;j._wrapperState.wasMultiple=!!R.multiple;var St=R.value;St!=null?Ae(j,!!R.multiple,St,!1):Je!==!!R.multiple&&(R.defaultValue!=null?Ae(j,!!R.multiple,R.defaultValue,!0):Ae(j,!!R.multiple,R.multiple?[]:"",!1))}j[ld]=R}catch(Rt){rr(l,l.return,Rt)}}break;case 6:if(wa(u,l),Va(l),w&4){if(l.stateNode===null)throw Error(n(162));j=l.stateNode,R=l.memoizedProps;try{j.nodeValue=R}catch(Rt){rr(l,l.return,Rt)}}break;case 3:if(wa(u,l),Va(l),w&4&&m!==null&&m.memoizedState.isDehydrated)try{ho(u.containerInfo)}catch(Rt){rr(l,l.return,Rt)}break;case 4:wa(u,l),Va(l);break;case 13:wa(u,l),Va(l),j=l.child,j.flags&8192&&(R=j.memoizedState!==null,j.stateNode.isHidden=R,!R||j.alternate!==null&&j.alternate.memoizedState!==null||(f2=et())),w&4&&$w(l);break;case 22:if(nt=m!==null&&m.memoizedState!==null,l.mode&1?(Zr=(De=Zr)||nt,wa(u,l),Zr=De):wa(u,l),Va(l),w&8192){if(De=l.memoizedState!==null,(l.stateNode.isHidden=De)&&!nt&&(l.mode&1)!==0)for(At=l,nt=l.child;nt!==null;){for(at=At=nt;At!==null;){switch(Je=At,St=Je.child,Je.tag){case 0:case 11:case 14:case 15:wd(4,Je,Je.return);break;case 1:Oc(Je,Je.return);var Mt=Je.stateNode;if(typeof Mt.componentWillUnmount=="function"){w=Je,m=Je.return;try{u=w,Mt.props=u.memoizedProps,Mt.state=u.memoizedState,Mt.componentWillUnmount()}catch(Rt){rr(w,m,Rt)}}break;case 5:Oc(Je,Je.return);break;case 22:if(Je.memoizedState!==null){Iw(at);continue}}St!==null?(St.return=Je,At=St):Iw(at)}nt=nt.sibling}e:for(nt=null,at=l;;){if(at.tag===5){if(nt===null){nt=at;try{j=at.stateNode,De?(R=j.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(le=at.stateNode,we=at.memoizedProps.style,_=we!=null&&we.hasOwnProperty("display")?we.display:null,le.style.display=Fe("display",_))}catch(Rt){rr(l,l.return,Rt)}}}else if(at.tag===6){if(nt===null)try{at.stateNode.nodeValue=De?"":at.memoizedProps}catch(Rt){rr(l,l.return,Rt)}}else if((at.tag!==22&&at.tag!==23||at.memoizedState===null||at===l)&&at.child!==null){at.child.return=at,at=at.child;continue}if(at===l)break e;for(;at.sibling===null;){if(at.return===null||at.return===l)break e;nt===at&&(nt=null),at=at.return}nt===at&&(nt=null),at.sibling.return=at.return,at=at.sibling}}break;case 19:wa(u,l),Va(l),w&4&&$w(l);break;case 21:break;default:wa(u,l),Va(l)}}function Va(l){var u=l.flags;if(u&2){try{e:{for(var m=l.return;m!==null;){if(Pw(m)){var w=m;break e}m=m.return}throw Error(n(160))}switch(w.tag){case 5:var j=w.stateNode;w.flags&32&&(Ye(j,""),w.flags&=-33);var R=Lw(l);c2(l,R,j);break;case 3:case 4:var _=w.stateNode.containerInfo,le=Lw(l);l2(l,le,_);break;default:throw Error(n(161))}}catch(we){rr(l,l.return,we)}l.flags&=-3}u&4096&&(l.flags&=-4097)}function iP(l,u,m){At=l,Ow(l)}function Ow(l,u,m){for(var w=(l.mode&1)!==0;At!==null;){var j=At,R=j.child;if(j.tag===22&&w){var _=j.memoizedState!==null||Bf;if(!_){var le=j.alternate,we=le!==null&&le.memoizedState!==null||Zr;le=Bf;var De=Zr;if(Bf=_,(Zr=we)&&!De)for(At=j;At!==null;)_=At,we=_.child,_.tag===22&&_.memoizedState!==null?Fw(j):we!==null?(we.return=_,At=we):Fw(j);for(;R!==null;)At=R,Ow(R),R=R.sibling;At=j,Bf=le,Zr=De}Hw(l)}else(j.subtreeFlags&8772)!==0&&R!==null?(R.return=j,At=R):Hw(l)}}function Hw(l){for(;At!==null;){var u=At;if((u.flags&8772)!==0){var m=u.alternate;try{if((u.flags&8772)!==0)switch(u.tag){case 0:case 11:case 15:Zr||Uf(5,u);break;case 1:var w=u.stateNode;if(u.flags&4&&!Zr)if(m===null)w.componentDidMount();else{var j=u.elementType===u.type?m.memoizedProps:va(u.type,m.memoizedProps);w.componentDidUpdate(j,m.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var R=u.updateQueue;R!==null&&Iy(u,R,w);break;case 3:var _=u.updateQueue;if(_!==null){if(m=null,u.child!==null)switch(u.child.tag){case 5:m=u.child.stateNode;break;case 1:m=u.child.stateNode}Iy(u,_,m)}break;case 5:var le=u.stateNode;if(m===null&&u.flags&4){m=le;var we=u.memoizedProps;switch(u.type){case"button":case"input":case"select":case"textarea":we.autoFocus&&m.focus();break;case"img":we.src&&(m.src=we.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(u.memoizedState===null){var De=u.alternate;if(De!==null){var nt=De.memoizedState;if(nt!==null){var at=nt.dehydrated;at!==null&&ho(at)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Zr||u.flags&512&&i2(u)}catch(Je){rr(u,u.return,Je)}}if(u===l){At=null;break}if(m=u.sibling,m!==null){m.return=u.return,At=m;break}At=u.return}}function Iw(l){for(;At!==null;){var u=At;if(u===l){At=null;break}var m=u.sibling;if(m!==null){m.return=u.return,At=m;break}At=u.return}}function Fw(l){for(;At!==null;){var u=At;try{switch(u.tag){case 0:case 11:case 15:var m=u.return;try{Uf(4,u)}catch(we){rr(u,m,we)}break;case 1:var w=u.stateNode;if(typeof w.componentDidMount=="function"){var j=u.return;try{w.componentDidMount()}catch(we){rr(u,j,we)}}var R=u.return;try{i2(u)}catch(we){rr(u,R,we)}break;case 5:var _=u.return;try{i2(u)}catch(we){rr(u,_,we)}}}catch(we){rr(u,u.return,we)}if(u===l){At=null;break}var le=u.sibling;if(le!==null){le.return=u.return,At=le;break}At=u.return}}var lP=Math.ceil,Wf=N.ReactCurrentDispatcher,u2=N.ReactCurrentOwner,qs=N.ReactCurrentBatchConfig,kn=0,Cr=null,cr=null,Pr=0,As=0,Hc=oi(0),yr=0,bd=null,dl=0,Gf=0,d2=0,xd=null,fs=null,f2=0,Ic=1/0,xo=null,Kf=!1,h2=null,fi=null,Yf=!1,hi=null,qf=0,kd=0,p2=null,Xf=-1,Qf=0;function qr(){return(kn&6)!==0?et():Xf!==-1?Xf:Xf=et()}function pi(l){return(l.mode&1)===0?1:(kn&2)!==0&&Pr!==0?Pr&-Pr:UR.transition!==null?(Qf===0&&(Qf=rn()),Qf):(l=xn,l!==0||(l=window.event,l=l===void 0?16:Qu(l.type)),l)}function ba(l,u,m,w){if(50<kd)throw kd=0,p2=null,Error(n(185));or(l,m,w),((kn&2)===0||l!==Cr)&&(l===Cr&&((kn&2)===0&&(Gf|=m),yr===4&&mi(l,Pr)),hs(l,w),m===1&&kn===0&&(u.mode&1)===0&&(Ic=et()+500,jf&&li()))}function hs(l,u){var m=l.callbackNode;On(l,u);var w=Zn(l,l===Cr?Pr:0);if(w===0)m!==null&&gt(m),l.callbackNode=null,l.callbackPriority=0;else if(u=w&-w,l.callbackPriority!==u){if(m!=null&&gt(m),u===1)l.tag===0?BR(Vw.bind(null,l)):jy(Vw.bind(null,l)),_R(function(){(kn&6)===0&&li()}),m=null;else{switch(Qo(w)){case 1:m=Sn;break;case 4:m=U;break;case 16:m=ce;break;case 536870912:m=ze;break;default:m=ce}m=Yw(m,_w.bind(null,l))}l.callbackPriority=u,l.callbackNode=m}}function _w(l,u){if(Xf=-1,Qf=0,(kn&6)!==0)throw Error(n(327));var m=l.callbackNode;if(Fc()&&l.callbackNode!==m)return null;var w=Zn(l,l===Cr?Pr:0);if(w===0)return null;if((w&30)!==0||(w&l.expiredLanes)!==0||u)u=Jf(l,w);else{u=w;var j=kn;kn|=2;var R=zw();(Cr!==l||Pr!==u)&&(xo=null,Ic=et()+500,hl(l,u));do try{dP();break}catch(le){Zw(l,le)}while(!0);Lm(),Wf.current=R,kn=j,cr!==null?u=0:(Cr=null,Pr=0,u=yr)}if(u!==0){if(u===2&&(j=Ot(l),j!==0&&(w=j,u=m2(l,j))),u===1)throw m=bd,hl(l,0),mi(l,w),hs(l,et()),m;if(u===6)mi(l,w);else{if(j=l.current.alternate,(w&30)===0&&!cP(j)&&(u=Jf(l,w),u===2&&(R=Ot(l),R!==0&&(w=R,u=m2(l,R))),u===1))throw m=bd,hl(l,0),mi(l,w),hs(l,et()),m;switch(l.finishedWork=j,l.finishedLanes=w,u){case 0:case 1:throw Error(n(345));case 2:pl(l,fs,xo);break;case 3:if(mi(l,w),(w&130023424)===w&&(u=f2+500-et(),10<u)){if(Zn(l,0)!==0)break;if(j=l.suspendedLanes,(j&w)!==w){qr(),l.pingedLanes|=l.suspendedLanes&j;break}l.timeoutHandle=xm(pl.bind(null,l,fs,xo),u);break}pl(l,fs,xo);break;case 4:if(mi(l,w),(w&4194240)===w)break;for(u=l.eventTimes,j=-1;0<w;){var _=31-It(w);R=1<<_,_=u[_],_>j&&(j=_),w&=~R}if(w=j,w=et()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*lP(w/1960))-w,10<w){l.timeoutHandle=xm(pl.bind(null,l,fs,xo),w);break}pl(l,fs,xo);break;case 5:pl(l,fs,xo);break;default:throw Error(n(329))}}}return hs(l,et()),l.callbackNode===m?_w.bind(null,l):null}function m2(l,u){var m=xd;return l.current.memoizedState.isDehydrated&&(hl(l,u).flags|=256),l=Jf(l,u),l!==2&&(u=fs,fs=m,u!==null&&g2(u)),l}function g2(l){fs===null?fs=l:fs.push.apply(fs,l)}function cP(l){for(var u=l;;){if(u.flags&16384){var m=u.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var w=0;w<m.length;w++){var j=m[w],R=j.getSnapshot;j=j.value;try{if(!ma(R(),j))return!1}catch{return!1}}}if(m=u.child,u.subtreeFlags&16384&&m!==null)m.return=u,u=m;else{if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function mi(l,u){for(u&=~d2,u&=~Gf,l.suspendedLanes|=u,l.pingedLanes&=~u,l=l.expirationTimes;0<u;){var m=31-It(u),w=1<<m;l[m]=-1,u&=~w}}function Vw(l){if((kn&6)!==0)throw Error(n(327));Fc();var u=Zn(l,0);if((u&1)===0)return hs(l,et()),null;var m=Jf(l,u);if(l.tag!==0&&m===2){var w=Ot(l);w!==0&&(u=w,m=m2(l,w))}if(m===1)throw m=bd,hl(l,0),mi(l,u),hs(l,et()),m;if(m===6)throw Error(n(345));return l.finishedWork=l.current.alternate,l.finishedLanes=u,pl(l,fs,xo),hs(l,et()),null}function v2(l,u){var m=kn;kn|=1;try{return l(u)}finally{kn=m,kn===0&&(Ic=et()+500,jf&&li())}}function fl(l){hi!==null&&hi.tag===0&&(kn&6)===0&&Fc();var u=kn;kn|=1;var m=qs.transition,w=xn;try{if(qs.transition=null,xn=1,l)return l()}finally{xn=w,qs.transition=m,kn=u,(kn&6)===0&&li()}}function y2(){As=Hc.current,Gn(Hc)}function hl(l,u){l.finishedWork=null,l.finishedLanes=0;var m=l.timeoutHandle;if(m!==-1&&(l.timeoutHandle=-1,FR(m)),cr!==null)for(m=cr.return;m!==null;){var w=m;switch(Am(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&Ef();break;case 3:$c(),Gn(cs),Gn(Fr),_m();break;case 5:Im(w);break;case 4:$c();break;case 13:Gn(qn);break;case 19:Gn(qn);break;case 10:Tm(w.type._context);break;case 22:case 23:y2()}m=m.return}if(Cr=l,cr=l=gi(l.current,null),Pr=As=u,yr=0,bd=null,d2=Gf=dl=0,fs=xd=null,ll!==null){for(u=0;u<ll.length;u++)if(m=ll[u],w=m.interleaved,w!==null){m.interleaved=null;var j=w.next,R=m.pending;if(R!==null){var _=R.next;R.next=j,w.next=_}m.pending=w}ll=null}return l}function Zw(l,u){do{var m=cr;try{if(Lm(),Of.current=_f,Hf){for(var w=Xn.memoizedState;w!==null;){var j=w.queue;j!==null&&(j.pending=null),w=w.next}Hf=!1}if(ul=0,Er=vr=Xn=null,pd=!1,md=0,u2.current=null,m===null||m.return===null){yr=1,bd=u,cr=null;break}e:{var R=l,_=m.return,le=m,we=u;if(u=Pr,le.flags|=32768,we!==null&&typeof we=="object"&&typeof we.then=="function"){var De=we,nt=le,at=nt.tag;if((nt.mode&1)===0&&(at===0||at===11||at===15)){var Je=nt.alternate;Je?(nt.updateQueue=Je.updateQueue,nt.memoizedState=Je.memoizedState,nt.lanes=Je.lanes):(nt.updateQueue=null,nt.memoizedState=null)}var St=hw(_);if(St!==null){St.flags&=-257,pw(St,_,le,R,u),St.mode&1&&fw(R,De,u),u=St,we=De;var Mt=u.updateQueue;if(Mt===null){var Rt=new Set;Rt.add(we),u.updateQueue=Rt}else Mt.add(we);break e}else{if((u&1)===0){fw(R,De,u),w2();break e}we=Error(n(426))}}else if(Yn&&le.mode&1){var ir=hw(_);if(ir!==null){(ir.flags&65536)===0&&(ir.flags|=256),pw(ir,_,le,R,u),Rm(Dc(we,le));break e}}R=we=Dc(we,le),yr!==4&&(yr=2),xd===null?xd=[R]:xd.push(R),R=_;do{switch(R.tag){case 3:R.flags|=65536,u&=-u,R.lanes|=u;var Ne=uw(R,we,u);Hy(R,Ne);break e;case 1:le=we;var xe=R.type,Le=R.stateNode;if((R.flags&128)===0&&(typeof xe.getDerivedStateFromError=="function"||Le!==null&&typeof Le.componentDidCatch=="function"&&(fi===null||!fi.has(Le)))){R.flags|=65536,u&=-u,R.lanes|=u;var ct=dw(R,le,u);Hy(R,ct);break e}}R=R.return}while(R!==null)}Uw(m)}catch(Lt){u=Lt,cr===m&&m!==null&&(cr=m=m.return);continue}break}while(!0)}function zw(){var l=Wf.current;return Wf.current=_f,l===null?_f:l}function w2(){(yr===0||yr===3||yr===2)&&(yr=4),Cr===null||(dl&268435455)===0&&(Gf&268435455)===0||mi(Cr,Pr)}function Jf(l,u){var m=kn;kn|=2;var w=zw();(Cr!==l||Pr!==u)&&(xo=null,hl(l,u));do try{uP();break}catch(j){Zw(l,j)}while(!0);if(Lm(),kn=m,Wf.current=w,cr!==null)throw Error(n(261));return Cr=null,Pr=0,yr}function uP(){for(;cr!==null;)Bw(cr)}function dP(){for(;cr!==null&&!dt();)Bw(cr)}function Bw(l){var u=Kw(l.alternate,l,As);l.memoizedProps=l.pendingProps,u===null?Uw(l):cr=u,u2.current=null}function Uw(l){var u=l;do{var m=u.alternate;if(l=u.return,(u.flags&32768)===0){if(m=rP(m,u,As),m!==null){cr=m;return}}else{if(m=sP(m,u),m!==null){m.flags&=32767,cr=m;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{yr=6,cr=null;return}}if(u=u.sibling,u!==null){cr=u;return}cr=u=l}while(u!==null);yr===0&&(yr=5)}function pl(l,u,m){var w=xn,j=qs.transition;try{qs.transition=null,xn=1,fP(l,u,m,w)}finally{qs.transition=j,xn=w}return null}function fP(l,u,m,w){do Fc();while(hi!==null);if((kn&6)!==0)throw Error(n(327));m=l.finishedWork;var j=l.finishedLanes;if(m===null)return null;if(l.finishedWork=null,l.finishedLanes=0,m===l.current)throw Error(n(177));l.callbackNode=null,l.callbackPriority=0;var R=m.lanes|m.childLanes;if(Ir(l,R),l===Cr&&(cr=Cr=null,Pr=0),(m.subtreeFlags&2064)===0&&(m.flags&2064)===0||Yf||(Yf=!0,Yw(ce,function(){return Fc(),null})),R=(m.flags&15990)!==0,(m.subtreeFlags&15990)!==0||R){R=qs.transition,qs.transition=null;var _=xn;xn=1;var le=kn;kn|=4,u2.current=null,oP(l,m),Dw(m,l),LR(wm),gc=!!ym,wm=ym=null,l.current=m,iP(m),jt(),kn=le,xn=_,qs.transition=R}else l.current=m;if(Yf&&(Yf=!1,hi=l,qf=j),R=l.pendingLanes,R===0&&(fi=null),_t(m.stateNode),hs(l,et()),u!==null)for(w=l.onRecoverableError,m=0;m<u.length;m++)j=u[m],w(j.value,{componentStack:j.stack,digest:j.digest});if(Kf)throw Kf=!1,l=h2,h2=null,l;return(qf&1)!==0&&l.tag!==0&&Fc(),R=l.pendingLanes,(R&1)!==0?l===p2?kd++:(kd=0,p2=l):kd=0,li(),null}function Fc(){if(hi!==null){var l=Qo(qf),u=qs.transition,m=xn;try{if(qs.transition=null,xn=16>l?16:l,hi===null)var w=!1;else{if(l=hi,hi=null,qf=0,(kn&6)!==0)throw Error(n(331));var j=kn;for(kn|=4,At=l.current;At!==null;){var R=At,_=R.child;if((At.flags&16)!==0){var le=R.deletions;if(le!==null){for(var we=0;we<le.length;we++){var De=le[we];for(At=De;At!==null;){var nt=At;switch(nt.tag){case 0:case 11:case 15:wd(8,nt,R)}var at=nt.child;if(at!==null)at.return=nt,At=at;else for(;At!==null;){nt=At;var Je=nt.sibling,St=nt.return;if(Rw(nt),nt===De){At=null;break}if(Je!==null){Je.return=St,At=Je;break}At=St}}}var Mt=R.alternate;if(Mt!==null){var Rt=Mt.child;if(Rt!==null){Mt.child=null;do{var ir=Rt.sibling;Rt.sibling=null,Rt=ir}while(Rt!==null)}}At=R}}if((R.subtreeFlags&2064)!==0&&_!==null)_.return=R,At=_;else e:for(;At!==null;){if(R=At,(R.flags&2048)!==0)switch(R.tag){case 0:case 11:case 15:wd(9,R,R.return)}var Ne=R.sibling;if(Ne!==null){Ne.return=R.return,At=Ne;break e}At=R.return}}var xe=l.current;for(At=xe;At!==null;){_=At;var Le=_.child;if((_.subtreeFlags&2064)!==0&&Le!==null)Le.return=_,At=Le;else e:for(_=xe;At!==null;){if(le=At,(le.flags&2048)!==0)try{switch(le.tag){case 0:case 11:case 15:Uf(9,le)}}catch(Lt){rr(le,le.return,Lt)}if(le===_){At=null;break e}var ct=le.sibling;if(ct!==null){ct.return=le.return,At=ct;break e}At=le.return}}if(kn=j,li(),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(lt,l)}catch{}w=!0}return w}finally{xn=m,qs.transition=u}}return!1}function Ww(l,u,m){u=Dc(m,u),u=uw(l,u,1),l=ui(l,u,1),u=qr(),l!==null&&(or(l,1,u),hs(l,u))}function rr(l,u,m){if(l.tag===3)Ww(l,l,m);else for(;u!==null;){if(u.tag===3){Ww(u,l,m);break}else if(u.tag===1){var w=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(fi===null||!fi.has(w))){l=Dc(m,l),l=dw(u,l,1),u=ui(u,l,1),l=qr(),u!==null&&(or(u,1,l),hs(u,l));break}}u=u.return}}function hP(l,u,m){var w=l.pingCache;w!==null&&w.delete(u),u=qr(),l.pingedLanes|=l.suspendedLanes&m,Cr===l&&(Pr&m)===m&&(yr===4||yr===3&&(Pr&130023424)===Pr&&500>et()-f2?hl(l,0):d2|=m),hs(l,u)}function Gw(l,u){u===0&&((l.mode&1)===0?u=1:(u=An,An<<=1,(An&130023424)===0&&(An=4194304)));var m=qr();l=yo(l,u),l!==null&&(or(l,u,m),hs(l,m))}function pP(l){var u=l.memoizedState,m=0;u!==null&&(m=u.retryLane),Gw(l,m)}function mP(l,u){var m=0;switch(l.tag){case 13:var w=l.stateNode,j=l.memoizedState;j!==null&&(m=j.retryLane);break;case 19:w=l.stateNode;break;default:throw Error(n(314))}w!==null&&w.delete(u),Gw(l,m)}var Kw;Kw=function(l,u,m){if(l!==null)if(l.memoizedProps!==u.pendingProps||cs.current)ds=!0;else{if((l.lanes&m)===0&&(u.flags&128)===0)return ds=!1,nP(l,u,m);ds=(l.flags&131072)!==0}else ds=!1,Yn&&(u.flags&1048576)!==0&&Ay(u,Nf,u.index);switch(u.lanes=0,u.tag){case 2:var w=u.type;zf(l,u),l=u.pendingProps;var j=Ac(u,Fr.current);Tc(u,m),j=zm(null,u,w,l,j,m);var R=Bm();return u.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,us(w)?(R=!0,Cf(u)):R=!1,u.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Om(u),j.updater=Vf,u.stateNode=j,j._reactInternals=u,qm(u,w,l,m),u=e2(null,u,w,!0,R,m)):(u.tag=0,Yn&&R&&jm(u),Yr(null,u,j,m),u=u.child),u;case 16:w=u.elementType;e:{switch(zf(l,u),l=u.pendingProps,j=w._init,w=j(w._payload),u.type=w,j=u.tag=vP(w),l=va(w,l),j){case 0:u=Jm(null,u,w,l,m);break e;case 1:u=bw(null,u,w,l,m);break e;case 11:u=mw(null,u,w,l,m);break e;case 14:u=gw(null,u,w,va(w.type,l),m);break e}throw Error(n(306,w,""))}return u;case 0:return w=u.type,j=u.pendingProps,j=u.elementType===w?j:va(w,j),Jm(l,u,w,j,m);case 1:return w=u.type,j=u.pendingProps,j=u.elementType===w?j:va(w,j),bw(l,u,w,j,m);case 3:e:{if(xw(u),l===null)throw Error(n(387));w=u.pendingProps,R=u.memoizedState,j=R.element,Oy(l,u),$f(u,w,null,m);var _=u.memoizedState;if(w=_.element,R.isDehydrated)if(R={element:w,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},u.updateQueue.baseState=R,u.memoizedState=R,u.flags&256){j=Dc(Error(n(423)),u),u=kw(l,u,w,m,j);break e}else if(w!==j){j=Dc(Error(n(424)),u),u=kw(l,u,w,m,j);break e}else for(js=ai(u.stateNode.containerInfo.firstChild),Cs=u,Yn=!0,ga=null,m=$y(u,null,w,m),u.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(Rc(),w===j){u=bo(l,u,m);break e}Yr(l,u,w,m)}u=u.child}return u;case 5:return Fy(u),l===null&&Mm(u),w=u.type,j=u.pendingProps,R=l!==null?l.memoizedProps:null,_=j.children,bm(w,j)?_=null:R!==null&&bm(w,R)&&(u.flags|=32),ww(l,u),Yr(l,u,_,m),u.child;case 6:return l===null&&Mm(u),null;case 13:return Sw(l,u,m);case 4:return Hm(u,u.stateNode.containerInfo),w=u.pendingProps,l===null?u.child=Pc(u,null,w,m):Yr(l,u,w,m),u.child;case 11:return w=u.type,j=u.pendingProps,j=u.elementType===w?j:va(w,j),mw(l,u,w,j,m);case 7:return Yr(l,u,u.pendingProps,m),u.child;case 8:return Yr(l,u,u.pendingProps.children,m),u.child;case 12:return Yr(l,u,u.pendingProps.children,m),u.child;case 10:e:{if(w=u.type._context,j=u.pendingProps,R=u.memoizedProps,_=j.value,Un(Pf,w._currentValue),w._currentValue=_,R!==null)if(ma(R.value,_)){if(R.children===j.children&&!cs.current){u=bo(l,u,m);break e}}else for(R=u.child,R!==null&&(R.return=u);R!==null;){var le=R.dependencies;if(le!==null){_=R.child;for(var we=le.firstContext;we!==null;){if(we.context===w){if(R.tag===1){we=wo(-1,m&-m),we.tag=2;var De=R.updateQueue;if(De!==null){De=De.shared;var nt=De.pending;nt===null?we.next=we:(we.next=nt.next,nt.next=we),De.pending=we}}R.lanes|=m,we=R.alternate,we!==null&&(we.lanes|=m),$m(R.return,m,u),le.lanes|=m;break}we=we.next}}else if(R.tag===10)_=R.type===u.type?null:R.child;else if(R.tag===18){if(_=R.return,_===null)throw Error(n(341));_.lanes|=m,le=_.alternate,le!==null&&(le.lanes|=m),$m(_,m,u),_=R.sibling}else _=R.child;if(_!==null)_.return=R;else for(_=R;_!==null;){if(_===u){_=null;break}if(R=_.sibling,R!==null){R.return=_.return,_=R;break}_=_.return}R=_}Yr(l,u,j.children,m),u=u.child}return u;case 9:return j=u.type,w=u.pendingProps.children,Tc(u,m),j=Ks(j),w=w(j),u.flags|=1,Yr(l,u,w,m),u.child;case 14:return w=u.type,j=va(w,u.pendingProps),j=va(w.type,j),gw(l,u,w,j,m);case 15:return vw(l,u,u.type,u.pendingProps,m);case 17:return w=u.type,j=u.pendingProps,j=u.elementType===w?j:va(w,j),zf(l,u),u.tag=1,us(w)?(l=!0,Cf(u)):l=!1,Tc(u,m),lw(u,w,j),qm(u,w,j,m),e2(null,u,w,!0,l,m);case 19:return Cw(l,u,m);case 22:return yw(l,u,m)}throw Error(n(156,u.tag))};function Yw(l,u){return je(l,u)}function gP(l,u,m,w){this.tag=l,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xs(l,u,m,w){return new gP(l,u,m,w)}function b2(l){return l=l.prototype,!(!l||!l.isReactComponent)}function vP(l){if(typeof l=="function")return b2(l)?1:0;if(l!=null){if(l=l.$$typeof,l===O)return 11;if(l===V)return 14}return 2}function gi(l,u){var m=l.alternate;return m===null?(m=Xs(l.tag,u,l.key,l.mode),m.elementType=l.elementType,m.type=l.type,m.stateNode=l.stateNode,m.alternate=l,l.alternate=m):(m.pendingProps=u,m.type=l.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=l.flags&14680064,m.childLanes=l.childLanes,m.lanes=l.lanes,m.child=l.child,m.memoizedProps=l.memoizedProps,m.memoizedState=l.memoizedState,m.updateQueue=l.updateQueue,u=l.dependencies,m.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},m.sibling=l.sibling,m.index=l.index,m.ref=l.ref,m}function e1(l,u,m,w,j,R){var _=2;if(w=l,typeof l=="function")b2(l)&&(_=1);else if(typeof l=="string")_=5;else e:switch(l){case L:return ml(m.children,j,R,u);case A:_=8,j|=8;break;case P:return l=Xs(12,m,u,j|2),l.elementType=P,l.lanes=R,l;case Q:return l=Xs(13,m,u,j),l.elementType=Q,l.lanes=R,l;case I:return l=Xs(19,m,u,j),l.elementType=I,l.lanes=R,l;case B:return t1(m,j,R,u);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case $:_=10;break e;case H:_=9;break e;case O:_=11;break e;case V:_=14;break e;case ie:_=16,w=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return u=Xs(_,m,u,j),u.elementType=l,u.type=w,u.lanes=R,u}function ml(l,u,m,w){return l=Xs(7,l,w,u),l.lanes=m,l}function t1(l,u,m,w){return l=Xs(22,l,w,u),l.elementType=B,l.lanes=m,l.stateNode={isHidden:!1},l}function x2(l,u,m){return l=Xs(6,l,null,u),l.lanes=m,l}function k2(l,u,m){return u=Xs(4,l.children!==null?l.children:[],l.key,u),u.lanes=m,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}function yP(l,u,m,w,j){this.tag=u,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$n(0),this.expirationTimes=$n(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$n(0),this.identifierPrefix=w,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function S2(l,u,m,w,j,R,_,le,we){return l=new yP(l,u,m,le,we),u===1?(u=1,R===!0&&(u|=8)):u=0,R=Xs(3,null,null,u),l.current=R,R.stateNode=l,R.memoizedState={element:w,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Om(R),l}function wP(l,u,m){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:w==null?null:""+w,children:l,containerInfo:u,implementation:m}}function qw(l){if(!l)return ii;l=l._reactInternals;e:{if(Be(l)!==l||l.tag!==1)throw Error(n(170));var u=l;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(us(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(n(171))}if(l.tag===1){var m=l.type;if(us(m))return Ey(l,m,u)}return u}function Xw(l,u,m,w,j,R,_,le,we){return l=S2(m,w,!0,l,j,R,_,le,we),l.context=qw(null),m=l.current,w=qr(),j=pi(m),R=wo(w,j),R.callback=u??null,ui(m,R,j),l.current.lanes=j,or(l,j,w),hs(l,w),l}function n1(l,u,m,w){var j=u.current,R=qr(),_=pi(j);return m=qw(m),u.context===null?u.context=m:u.pendingContext=m,u=wo(R,_),u.payload={element:l},w=w===void 0?null:w,w!==null&&(u.callback=w),l=ui(j,u,_),l!==null&&(ba(l,j,_,R),Tf(l,j,_)),_}function r1(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 5:return l.child.stateNode;default:return l.child.stateNode}}function Qw(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var m=l.retryLane;l.retryLane=m!==0&&m<u?m:u}}function E2(l,u){Qw(l,u),(l=l.alternate)&&Qw(l,u)}function bP(){return null}var Jw=typeof reportError=="function"?reportError:function(l){console.error(l)};function C2(l){this._internalRoot=l}s1.prototype.render=C2.prototype.render=function(l){var u=this._internalRoot;if(u===null)throw Error(n(409));n1(l,u,null,null)},s1.prototype.unmount=C2.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var u=l.containerInfo;fl(function(){n1(null,l,null,null)}),u[po]=null}};function s1(l){this._internalRoot=l}s1.prototype.unstable_scheduleHydration=function(l){if(l){var u=as();l={blockedOn:null,target:l,priority:u};for(var m=0;m<Tt.length&&u!==0&&u<Tt[m].priority;m++);Tt.splice(m,0,l),m===0&&Jt(l)}};function j2(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function a1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function eb(){}function xP(l,u,m,w,j){if(j){if(typeof w=="function"){var R=w;w=function(){var De=r1(_);R.call(De)}}var _=Xw(u,w,l,0,null,!1,!1,"",eb);return l._reactRootContainer=_,l[po]=_.current,od(l.nodeType===8?l.parentNode:l),fl(),_}for(;j=l.lastChild;)l.removeChild(j);if(typeof w=="function"){var le=w;w=function(){var De=r1(we);le.call(De)}}var we=S2(l,0,!1,null,null,!1,!1,"",eb);return l._reactRootContainer=we,l[po]=we.current,od(l.nodeType===8?l.parentNode:l),fl(function(){n1(u,we,m,w)}),we}function o1(l,u,m,w,j){var R=m._reactRootContainer;if(R){var _=R;if(typeof j=="function"){var le=j;j=function(){var we=r1(_);le.call(we)}}n1(u,_,l,j)}else _=xP(m,u,l,j,w);return r1(_)}Jo=function(l){switch(l.tag){case 3:var u=l.stateNode;if(u.current.memoizedState.isDehydrated){var m=Dt(u.pendingLanes);m!==0&&(zn(u,m|1),hs(u,et()),(kn&6)===0&&(Ic=et()+500,li()))}break;case 13:fl(function(){var w=yo(l,1);if(w!==null){var j=qr();ba(w,l,1,j)}}),E2(l,1)}},zs=function(l){if(l.tag===13){var u=yo(l,134217728);if(u!==null){var m=qr();ba(u,l,134217728,m)}E2(l,134217728)}},Ji=function(l){if(l.tag===13){var u=pi(l),m=yo(l,u);if(m!==null){var w=qr();ba(m,l,u,w)}E2(l,u)}},as=function(){return xn},ha=function(l,u){var m=xn;try{return xn=l,u()}finally{xn=m}},Nt=function(l,u,m){switch(u){case"input":if(He(l,m),u=m.name,m.type==="radio"&&u!=null){for(m=l;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll("input[name="+JSON.stringify(""+u)+'][type="radio"]'),u=0;u<m.length;u++){var w=m[u];if(w!==l&&w.form===l.form){var j=Sf(w);if(!j)throw Error(n(90));re(w),He(w,j)}}}break;case"textarea":qe(l,m);break;case"select":u=m.value,u!=null&&Ae(l,!!m.multiple,u,!1)}},ar=v2,bt=fl;var kP={usingClientEntryPoint:!1,Events:[cd,Cc,Sf,Vn,pn,v2]},Sd={findFiberByHostInstance:sl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},SP={bundleType:Sd.bundleType,version:Sd.version,rendererPackageName:Sd.rendererPackageName,rendererConfig:Sd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:N.ReactCurrentDispatcher,findHostInstanceByFiber:function(l){return l=q(l),l===null?null:l.stateNode},findFiberByHostInstance:Sd.findFiberByHostInstance||bP,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 i1=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!i1.isDisabled&&i1.supportsFiber)try{lt=i1.inject(SP),mt=i1}catch{}}return ps.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kP,ps.createPortal=function(l,u){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!j2(u))throw Error(n(200));return wP(l,u,null,m)},ps.createRoot=function(l,u){if(!j2(l))throw Error(n(299));var m=!1,w="",j=Jw;return u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(w=u.identifierPrefix),u.onRecoverableError!==void 0&&(j=u.onRecoverableError)),u=S2(l,1,!1,null,null,m,!1,w,j),l[po]=u.current,od(l.nodeType===8?l.parentNode:l),new C2(u)},ps.findDOMNode=function(l){if(l==null)return null;if(l.nodeType===1)return l;var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(n(188)):(l=Object.keys(l).join(","),Error(n(268,l)));return l=q(u),l=l===null?null:l.stateNode,l},ps.flushSync=function(l){return fl(l)},ps.hydrate=function(l,u,m){if(!a1(u))throw Error(n(200));return o1(null,l,u,!0,m)},ps.hydrateRoot=function(l,u,m){if(!j2(l))throw Error(n(405));var w=m!=null&&m.hydratedSources||null,j=!1,R="",_=Jw;if(m!=null&&(m.unstable_strictMode===!0&&(j=!0),m.identifierPrefix!==void 0&&(R=m.identifierPrefix),m.onRecoverableError!==void 0&&(_=m.onRecoverableError)),u=Xw(u,null,l,1,m??null,j,!1,R,_),l[po]=u.current,od(l),w)for(l=0;l<w.length;l++)m=w[l],j=m._getVersion,j=j(m._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[m,j]:u.mutableSourceEagerHydrationData.push(m,j);return new s1(u)},ps.render=function(l,u,m){if(!a1(u))throw Error(n(200));return o1(null,l,u,!1,m)},ps.unmountComponentAtNode=function(l){if(!a1(l))throw Error(n(40));return l._reactRootContainer?(fl(function(){o1(null,null,l,!1,function(){l._reactRootContainer=null,l[po]=null})}),!0):!1},ps.unstable_batchedUpdates=v2,ps.unstable_renderSubtreeIntoContainer=function(l,u,m,w){if(!a1(m))throw Error(n(200));if(l==null||l._reactInternals===void 0)throw Error(n(38));return o1(l,u,m,!1,w)},ps.version="18.3.1-next-f1338f8080-20240426",ps}var db;function y5(){if(db)return R2.exports;db=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(),R2.exports=PP(),R2.exports}var fb;function LP(){if(fb)return l1;fb=1;var e=y5();return l1.createRoot=e.createRoot,l1.hydrateRoot=e.hydrateRoot,l1}var TP=LP();/**
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 w5=e=>{throw TypeError(e)},b5=(e,t,n)=>t.has(e)||w5("Cannot "+n),ea=(e,t,n)=>(b5(e,t,"read from private field"),n?n.call(e):t.get(e)),_d=(e,t,n)=>t.has(e)?w5("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Za=(e,t,n,r)=>(b5(e,t,"write to private field"),t.set(e,n),n),Ih=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Fh=/^[\\/]{2}/;function x5(e,t){return t+e.replace(/\\/g,"/")}var hb="popstate";function pb(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function $P(e={}){function t(r,a){var h;let i=(h=a.state)==null?void 0:h.masked,{pathname:c,search:d,hash:f}=i||r.location;return o0("",{pathname:c,search:d,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:ts(a)}return OP(t,n,null,e)}function qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Kn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function DP(){return Math.random().toString(36).substring(2,10)}function mb(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 o0(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?co(t):t,state:n,key:t&&t.key||r||DP(),mask:a}}function ts({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 co(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 OP(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,c=a.history,d="POP",f=null,h=p();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function p(){return(c.state||{idx:null}).idx}function g(){d="POP";let k=p(),S=k==null?null:k-h;h=k,f&&f({action:d,location:x.location,delta:S})}function v(k,S){d="PUSH";let E=pb(k)?k:o0(x.location,k,S);h=p()+1;let C=mb(E,h),N=x.createHref(E.mask||E);try{c.pushState(C,"",N)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;a.location.assign(N)}i&&f&&f({action:d,location:x.location,delta:1})}function y(k,S){d="REPLACE";let E=pb(k)?k:o0(x.location,k,S);h=p();let C=mb(E,h),N=x.createHref(E.mask||E);c.replaceState(C,"",N),i&&f&&f({action:d,location:x.location,delta:0})}function b(k){return k5(a,k)}let x={get action(){return d},get location(){return e(a,c)},listen(k){if(f)throw new Error("A history only accepts one active listener");return a.addEventListener(hb,g),f=k,()=>{a.removeEventListener(hb,g),f=null}},createHref(k){return t(a,k)},createURL:b,encodeLocation(k){let S=b(k);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:v,replace:y,go(k){return c.go(k)}};return x}function k5(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),qt(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:ts(t);return a=a.replace(/ $/,"%20"),!n&&Fh.test(a)&&(a=r+a),new URL(a,r)}var Vd,gb=class{constructor(e){if(_d(this,Vd,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(ea(this,Vd).has(e))return ea(this,Vd).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){ea(this,Vd).set(e,t)}};Vd=new WeakMap;var HP=new Set(["lazy","caseSensitive","path","id","index","children"]);function IP(e){return HP.has(e)}var FP=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function _P(e){return FP.has(e)}function VP(e){return e.index===!0}function i0(e,t,n=[],r={},a=!1){return e.map((i,c)=>{let d=[...n,String(c)],f=typeof i.id=="string"?i.id:d.join("-");if(qt(i.index!==!0||!i.children,"Cannot specify children on an index route"),qt(a||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),VP(i)){let h={...i,id:f};return r[f]=vb(h,t(h)),h}else{let h={...i,id:f,children:void 0};return r[f]=vb(h,t(h)),i.children&&(h.children=i0(i.children,t,d,r,a)),h}})}function vb(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function S5(e,t,n="/"){return xa(e,t,n,!1)}function xa(e,t,n,r,a){let i=typeof t=="string"?co(t):t,c=$s(i.pathname||"/",n);if(c==null)return null;let d=a??I1(e),f=null,h=M5(c);for(let p=0;f==null&&p<d.length;++p)f=XP(d[p],h,r);return f}function E5(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 I1(e){let t=C5(e);return ZP(t),t}function C5(e,t=[],n=[],r="",a=!1){let i=(c,d,f=a,h)=>{let p={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&f)return;qt(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let g=oa([r,p.relativePath]),v=n.concat(p);c.children&&c.children.length>0&&(qt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),C5(c.children,t,v,g,f)),!(c.path==null&&!c.index)&&t.push({path:g,score:YP(g,c.index),routesMeta:v.map((y,b)=>{let[x,k]=N5(y.relativePath,y.caseSensitive,b===v.length-1);return{...y,matcher:x,compiledParams:k}})})};return e.forEach((c,d)=>{var f;if(c.path===""||!((f=c.path)!=null&&f.includes("?")))i(c,d);else for(let h of j5(c.path))i(c,d,!0,h)}),t}function j5(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 c=j5(r.join("/")),d=[];return d.push(...c.map(f=>f===""?i:[i,f].join("/"))),a&&d.push(...c),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function ZP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:qP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var zP=/^:[\w-]+$/,BP=3,UP=2,WP=1,GP=10,KP=-2,yb=e=>e==="*";function YP(e,t){let n=e.split("/"),r=n.length;return n.some(yb)&&(r+=KP),t&&(r+=UP),n.filter(a=>!yb(a)).reduce((a,i)=>a+(zP.test(i)?BP:i===""?WP:GP),r)}function qP(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 XP(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",c=[];for(let d=0;d<r.length;++d){let f=r[d],h=d===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",g={path:f.relativePath,caseSensitive:f.caseSensitive,end:h},v=f.matcher&&f.compiledParams?A5(g,p,f.matcher,f.compiledParams):Hi(g,p),y=f.route;if(!v&&h&&n&&!r[r.length-1].route.index&&(v=Hi({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},p)),!v)return null;Object.assign(a,v.params),c.push({params:a,pathname:oa([i,v.pathname]),pathnameBase:eL(oa([i,v.pathnameBase])),route:y}),v.pathnameBase!=="/"&&(i=oa([i,v.pathnameBase]))}return c}function rs(e,t={}){let n=e;n.endsWith("*")&&n!=="*"&&!n.endsWith("/*")&&(Kn(!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=c=>c==null?"":typeof c=="string"?c:String(c),i=n.split(/\/+/).map((c,d,f)=>{if(d===f.length-1&&c==="*")return a(t["*"]);const p=c.match(/^:([\w-]+)(\??)(.*)/);if(p){const[,g,v,y]=p;let b=t[g];return qt(v==="?"||b!=null,`Missing ":${g}" param`),encodeURIComponent(a(b))+y}return c.replace(/\?$/g,"")}).filter(c=>!!c);return r+i.join("/")}function Hi(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=N5(e.path,e.caseSensitive,e.end);return A5(e,t,n,r)}function A5(e,t,n,r){let a=t.match(n);if(!a)return null;let i=a[0],c=xu(i,1),d=a.slice(1);return{params:r.reduce((h,{paramName:p,isOptional:g},v)=>{if(p==="*"){let b=d[v]||"";c=xu(i.slice(0,i.length-b.length),1)}const y=d[v];return g&&!y?h[p]=void 0:h[p]=(y||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:c,pattern:e}}function N5(e,t=!1,n=!0){Kn(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,(c,d,f,h,p)=>{if(r.push({paramName:d,isOptional:f!=null}),f){let g=p.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function M5(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Kn(!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 $s(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 QP({basename:e,pathname:t}){return t==="/"?e:oa([e,t])}var kv=e=>Ih.test(e);function JP(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?co(e):e,i;return n?(n=Sv(n),n.startsWith("/")||n.startsWith("\\")?i=wb(n.substring(1),"/"):i=wb(n,t)):i=t,{pathname:i,search:tL(r),hash:nL(a)}}function wb(e,t){let n=xu(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function T2(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 R5(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function _h(e){let t=R5(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function N0(e,t,n,r=!1){let a;typeof e=="string"?a=co(e):(a={...e},qt(!a.pathname||!a.pathname.includes("?"),T2("?","pathname","search",a)),qt(!a.pathname||!a.pathname.includes("#"),T2("#","pathname","hash",a)),qt(!a.search||!a.search.includes("#"),T2("#","search","hash",a)));let i=e===""||a.pathname==="",c=i?"/":a.pathname,d;if(c==null)d=n;else{let g=t.length-1;if(!r&&c.startsWith("..")){let v=c.split("/");for(;v[0]==="..";)v.shift(),g-=1;a.pathname=v.join("/")}d=g>=0?t[g]:"/"}let f=JP(a,d),h=c&&c!=="/"&&c.endsWith("/"),p=(i||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||p)&&(f.pathname+="/"),f}var Sv=e=>e.replace(/[\\/]{2,}/g,"/"),oa=e=>Sv(e.join("/"));function xu(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 eL=e=>xu(e).replace(/^\/*/,"/"),tL=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,nL=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,rL=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],M0=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 l0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function R0(e){let t=e.map(n=>n.route.path).filter(Boolean);return oa(t)||"/"}var P5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function L5(e,t){let n=e;if(typeof n!="string"||!Ih.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(P5)try{let i=new URL(window.location.href),c=Fh.test(n)?new URL(x5(n,i.protocol)):new URL(n),d=$s(c.pathname,t);c.origin===i.origin&&d!=null?n=d+c.search+c.hash:a=!0}catch{Kn(!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 sL(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 c=Object.keys(n);for(let d of c)i[d]&&n[d].push(i[d])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let a=su(n.lazy,t.lazy,()=>{});a&&(r.lazy=a)}if(typeof t.lazy=="object"){let a=t.lazy;["middleware","loader","action"].forEach(i=>{let c=a[i],d=n[`lazy.${i}`];if(typeof c=="function"&&d.length>0){let f=su(d,c,()=>{});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 c=i[ji]??i,d=su(n[a],c,(...f)=>bb(f[0]));d&&(a==="loader"&&c.hydrate===!0&&(d.hydrate=!0),d[ji]=c,r[a]=d)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let i=a[ji]??a,c=su(n.middleware,i,(...d)=>bb(d[0]));return c?(c[ji]=i,c):a})),r}function aL(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(a){let i=Object.keys(a);for(let c of i)a[c]&&n[c].push(a[c])}})),n.navigate.length>0){let r=e.navigate[ji]??e.navigate,a=su(n.navigate,r,(...i)=>{let[c,d]=i;return{to:typeof c=="number"||typeof c=="string"?c:c?ts(c):".",...xb(e,d??{})}});a&&(a[ji]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[ji]??e.fetch,a=su(n.fetch,r,(...i)=>{let[c,,d,f]=i;return{href:d??".",fetcherKey:c,...xb(e,f??{})}});a&&(a[ji]=r,e.fetch=a)}return e}function su(e,t,n){return e.length===0?null:async(...r)=>{let a=await T5(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function T5(e,t,n,r){let a=e[r],i;if(a){let c,d=async()=>(c?console.error("You cannot call instrumented handlers more than once"):c=T5(e,t,n,r-1),i=await c,qt(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await a(d,t)}catch(f){console.error("An instrumentation function threw an error:",f)}c||await d(),await c}else try{i={type:"success",value:await n()}}catch(c){i={type:"error",value:c}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function bb(e){let{request:t,context:n,params:r,pattern:a}=e;return{request:oL(t),params:{...r},pattern:a,context:iL(n)}}function xb(e,t){return{currentUrl:ts(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 oL(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function iL(e){if(cL(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var lL=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function cL(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")===lL}var kb=new URL("http://localhost");function Ev(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),kb)}catch{return kb}}function $2(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function uL(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 cu(e,t,n,r){let a=null;try{a=e==null?null:new URL(e,n)}catch{}let i=new URL(t,n),c=a!=null&&!$2(a,n),d=!$2(i,n);if(r==="reject"){if(c||d)throw new Error("External navigation is not allowed")}else if(d&&(a==null||!uL(e,a)||!$2(a,i)))throw new Error("External navigation is not allowed")}var $5=["POST","PUT","PATCH","DELETE"],dL=new Set($5),fL=["GET",...$5],hL=new Set(fL),D5=new Set([301,302,303,307,308]),pL=new Set([307,308]),D2={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},mL={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Cd={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},gL=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),O5="remix-router-transitions",H5=Symbol("ResetLoaderData"),kl,qc,yi,Xc,vL=class{constructor(e){_d(this,kl),_d(this,qc),_d(this,yi),_d(this,Xc),Za(this,kl,e),Za(this,qc,I1(e))}get stableRoutes(){return ea(this,kl)}get activeRoutes(){return ea(this,yi)??ea(this,kl)}get branches(){return ea(this,Xc)??ea(this,qc)}get hasHMRRoutes(){return ea(this,yi)!=null}setRoutes(e){Za(this,kl,e),Za(this,qc,I1(e))}setHmrRoutes(e){Za(this,yi,e),Za(this,Xc,I1(e))}commitHmrRoutes(){ea(this,yi)&&(Za(this,kl,ea(this,yi)),Za(this,qc,ea(this,Xc)),Za(this,yi,void 0),Za(this,Xc,void 0))}};kl=new WeakMap;qc=new WeakMap;yi=new WeakMap;Xc=new WeakMap;function yL(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";qt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||gL,i=a;if(e.instrumentations){let ne=e.instrumentations;i=se=>({...a(se),...sL(ne.map(pe=>pe.route).filter(Boolean),se)})}let c={},d=new vL(i0(e.routes,i,void 0,c)),f=e.basename||"/";f.startsWith("/")||(f=`/${f}`);let h=e.dataStrategy||SL,p={...e.future},g=null,v=new Set,y=null,b=null,x=null,k=null,S=e.hydrationData!=null,E=xa(d.activeRoutes,e.history.location,f,!1,d.branches),C=!1,N=null,M,T;if(E==null&&!e.patchRoutesOnNavigation){let ne=ta(404,{pathname:e.history.location.pathname}),{matches:se,route:pe}=c1(d.activeRoutes);M=!0,T=!M,E=se,N={[pe.id]:ne}}else if(E&&!e.hydrationData&&kt(E,d.activeRoutes,e.history.location.pathname).active&&(E=null),E)if(E.some(ne=>ne.route.lazy))M=!1,T=!M;else if(!E.some(ne=>Cv(ne.route)))M=!0,T=!M;else{let ne=e.hydrationData?e.hydrationData.loaderData:null,se=e.hydrationData?e.hydrationData.errors:null,pe=E;if(se){let ve=E.findIndex(Ee=>se[Ee.route.id]!==void 0);pe=pe.slice(0,ve+1)}T=!1,M=!0,pe.forEach(ve=>{let Ee=I5(ve.route,ne,se);T=T||Ee.renderFallback,M=M&&!Ee.shouldLoad})}else{M=!1,T=!M,E=[];let ne=kt(null,d.activeRoutes,e.history.location.pathname);ne.active&&ne.matches&&(C=!0,E=ne.matches)}let L,A={historyAction:e.history.action,location:e.history.location,matches:E,initialized:M,renderFallback:T,navigation:D2,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||N,fetchers:new Map,blockers:new Map},P="POP",$=null,H=!1,O,Q=!1,I=new Map,V=null,ie=!1,B=!1,F=new Set,te=new Map,X=0,Z=-1,K=new Map,z=new Set,Y=new Map,J=new Map,de=new Set,ae=new Map,W,ye=null;function ee(){if(g=e.history.listen(({action:ne,location:se,delta:pe})=>{if(W){W(),W=void 0;return}Kn(ae.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 ve=$t({currentLocation:A.location,nextLocation:se,historyAction:ne});if(ve&&pe!=null){let Ee=new Promise(We=>{W=We});e.history.go(pe*-1),Ct(ve,{state:"blocked",location:se,proceed(){Ct(ve,{state:"proceeding",proceed:void 0,reset:void 0,location:se}),Ee.then(()=>e.history.go(pe))},reset(){let We=new Map(A.blockers);We.set(ve,Cd),D({blockers:We})}}),$==null||$.resolve(),$=null;return}return He(ne,se)}),n){ZL(t,I);let ne=()=>zL(t,I);t.addEventListener("pagehide",ne),V=()=>t.removeEventListener("pagehide",ne)}return A.initialized||He("POP",A.location,{initialHydration:!0}),L}function ge(){g&&g(),V&&V(),v.clear(),O&&O.abort(),A.fetchers.forEach((ne,se)=>Fe(A.fetchers,se)),A.blockers.forEach((ne,se)=>Nt(se))}function re(ne){if(v.add(ne),y){let{newErrors:se}=y;y=null,ne(A,{deletedFetchers:[],newErrors:se,viewTransitionOpts:void 0,flushSync:!1})}return()=>v.delete(ne)}function D(ne,se={}){ne.matches&&(ne.matches=ne.matches.map(Ee=>{let We=c[Ee.route.id],Ke=Ee.route;return Ke.element!==We.element||Ke.errorElement!==We.errorElement||Ke.hydrateFallbackElement!==We.hydrateFallbackElement?{...Ee,route:We}:Ee})),A={...A,...ne};let pe=[],ve=[];A.fetchers.forEach((Ee,We)=>{Ee.state==="idle"&&(de.has(We)?pe.push(We):ve.push(We))}),de.forEach(Ee=>{!A.fetchers.has(Ee)&&!te.has(Ee)&&pe.push(Ee)}),v.size===0&&(y={newErrors:ne.errors??null}),[...v].forEach(Ee=>Ee(A,{deletedFetchers:pe,newErrors:ne.errors??null,viewTransitionOpts:se.viewTransitionOpts,flushSync:se.flushSync===!0})),pe.forEach(Ee=>Fe(A.fetchers,Ee)),ve.forEach(Ee=>A.fetchers.delete(Ee))}function G(ne,se,{flushSync:pe}={}){var rt,me;let ve=A.actionData!=null&&A.navigation.formMethod!=null&&Br(A.navigation.formMethod)&&A.navigation.state==="loading"&&((rt=ne.state)==null?void 0:rt._isRedirect)!==!0,Ee;se.actionData?Object.keys(se.actionData).length>0?Ee=se.actionData:Ee=null:ve?Ee=A.actionData:Ee=null;let We=se.loaderData?Lb(A.loaderData,se.loaderData,se.matches||[],se.errors):A.loaderData,Ke=A.blockers;Ke.size>0&&(Ke=new Map(Ke),Ke.forEach((q,Te)=>Ke.set(Te,Cd)));let Ue=ie?!1:bt(ne,se.matches||A.matches),Be=H===!0||A.navigation.formMethod!=null&&Br(A.navigation.formMethod)&&((me=ne.state)==null?void 0:me._isRedirect)!==!0;d.commitHmrRoutes(),ie||P==="POP"||(P==="PUSH"?e.history.push(ne,ne.state):P==="REPLACE"&&e.history.replace(ne,ne.state));let ot;if(P==="POP"){let q=I.get(A.location.pathname);q&&q.has(ne.pathname)?ot={currentLocation:A.location,nextLocation:ne}:I.has(ne.pathname)&&(ot={currentLocation:ne,nextLocation:A.location})}else if(Q){let q=I.get(A.location.pathname);q?q.add(ne.pathname):(q=new Set([ne.pathname]),I.set(A.location.pathname,q)),ot={currentLocation:A.location,nextLocation:ne}}D({...se,actionData:Ee,loaderData:We,historyAction:P,location:ne,initialized:!0,renderFallback:!1,navigation:D2,revalidation:"idle",restoreScrollPosition:Ue,preventScrollReset:Be,blockers:Ke},{viewTransitionOpts:ot,flushSync:pe===!0}),P="POP",H=!1,Q=!1,ie=!1,B=!1,$==null||$.resolve(),$=null,ye==null||ye.resolve(),ye=null}async function Pe(ne,se){if($==null||$.resolve(),$=null,typeof ne=="number"){$||($=Ob());let je=$.promise;return e.history.go(ne),je}let pe=Kg(A.location,A.matches,f,ne,se==null?void 0:se.fromRouteId,se==null?void 0:se.relative),{path:ve,submission:Ee,error:We}=Sb(!1,pe,se),Ke;if(se!=null&&se.mask){let je=typeof se.mask=="string"?co(se.mask):{...A.location.mask,...se.mask};if(Ke={pathname:je.pathname??"",search:je.search??"",hash:je.hash??""},Fh.test(Ke.pathname))throw new Error("External navigation is not allowed");Ke.pathname.startsWith("\\")&&(Ke.pathname=Ke.pathname.replace(/^\\+/,"/")),cu(typeof se.mask=="string"?se.mask:ts(se.mask),ts(Ke),e.history.createURL("/"),"reject")}let Ue=A.location,Be=o0(Ue,ve,se&&se.state,void 0,Ke);Be={...Be,...e.history.encodeLocation(Be)},cu(ne==null?e.history.createHref(A.location):typeof ne=="string"?ne:ts(ne),e.history.createHref(Be.mask||Be),e.history.createURL("/"),"reject");let ot=se&&se.replace!=null?se.replace:void 0,rt="PUSH";ot===!0?rt="REPLACE":ot===!1||Ee!=null&&Br(Ee.formMethod)&&Ee.formAction===A.location.pathname+A.location.search&&(rt="REPLACE");let me=se&&"preventScrollReset"in se?se.preventScrollReset===!0:void 0,q=(se&&se.flushSync)===!0,Te=$t({currentLocation:Ue,nextLocation:Be,historyAction:rt});if(Te){Ct(Te,{state:"blocked",location:Be,proceed(){Ct(Te,{state:"proceeding",proceed:void 0,reset:void 0,location:Be}),Pe(ne,se)},reset(){let je=new Map(A.blockers);je.set(Te,Cd),D({blockers:je})}});return}await He(rt,Be,{submission:Ee,pendingError:We,preventScrollReset:me,replace:se&&se.replace,enableViewTransition:se&&se.viewTransition,flushSync:q,callSiteDefaultShouldRevalidate:se&&se.defaultShouldRevalidate})}function Ze(){ye||(ye=Ob()),Ie(),D({revalidation:"loading"});let ne=ye.promise;return A.navigation.state==="submitting"?ne:A.navigation.state==="idle"?(He(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),ne):(He(P||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:Q===!0}),ne)}async function He(ne,se,pe){O&&O.abort(),O=null,P=ne,ie=(pe&&pe.startUninterruptedRevalidation)===!0,ar(A.location,A.matches),H=(pe&&pe.preventScrollReset)===!0,Q=(pe&&pe.enableViewTransition)===!0;let ve=d.activeRoutes,Ee=pe!=null&&pe.initialHydration&&A.matches&&A.matches.length>0&&!C?A.matches:xa(ve,se,f,!1,d.branches),We=(pe&&pe.flushSync)===!0;if(Ee&&A.initialized&&!B&&LL(A.location,se)&&!(pe&&pe.submission&&Br(pe.submission.formMethod))){G(se,{matches:Ee},{flushSync:We});return}let Ke=kt(Ee,ve,se.pathname);if(Ke.active&&Ke.matches&&(Ee=Ke.matches),!Ee){let{error:dt,notFoundMatches:jt,route:et}=Yt(se.pathname);G(se,{matches:jt,loaderData:{},errors:{[et.id]:dt}},{flushSync:We});return}let Ue=pe&&pe.overrideNavigation?{...pe.overrideNavigation,matches:Ee,historyAction:ne}:void 0;O=new AbortController;let Be=Qc(e.history,se,O.signal,pe&&pe.submission),ot=e.getContext?await e.getContext():new gb,rt;if(pe&&pe.pendingError)rt=[ki(Ee).route.id,{type:"error",error:pe.pendingError}];else if(pe&&pe.submission&&Br(pe.submission.formMethod)){let dt=await tt(Be,se,pe.submission,Ee,ne,ot,Ke.active,pe&&pe.initialHydration===!0,{replace:pe.replace,flushSync:We});if(dt.shortCircuited)return;if(dt.pendingActionResult){let[jt,et]=dt.pendingActionResult;if(Ms(et)&&l0(et.error)&&et.error.status===404){O=null,G(se,{matches:dt.matches,loaderData:{},errors:{[jt]:et.error}});return}}Ee=dt.matches||Ee,rt=dt.pendingActionResult,Ue=O2(se,Ee,ne,pe.submission),We=!1,Ke.active=!1,Be=Qc(e.history,Be.url,Be.signal)}let{shortCircuited:me,matches:q,loaderData:Te,errors:je,workingFetchers:gt}=await oe(Be,se,Ee,ne,ot,Ke.active,Ue,pe&&pe.submission,pe&&pe.fetcherSubmission,pe&&pe.replace,pe&&pe.initialHydration===!0,We,rt,pe&&pe.callSiteDefaultShouldRevalidate);me||(O=null,G(se,{matches:q||Ee,...Tb(rt),loaderData:Te,errors:je,...gt?{fetchers:gt}:{}}))}async function tt(ne,se,pe,ve,Ee,We,Ke,Ue,Be={}){Ie();let ot=_L(se,ve,Ee,pe);if(D({navigation:ot},{flushSync:Be.flushSync===!0}),Ke){let q=await sn(ve,se.pathname,ne.signal);if(q.type==="aborted")return{shortCircuited:!0};if(q.type==="error"){if(q.partialMatches.length===0){let{matches:je,route:gt}=c1(d.activeRoutes);return{matches:je,pendingActionResult:[gt.id,{type:"error",error:q.error}]}}let Te=ki(q.partialMatches).route.id;return{matches:q.partialMatches,pendingActionResult:[Te,{type:"error",error:q.error}]}}else if(q.matches)ve=q.matches;else{let{notFoundMatches:Te,error:je,route:gt}=Yt(se.pathname);return{matches:Te,pendingActionResult:[gt.id,{type:"error",error:je}]}}}let rt,me=F1(ve,se);if(!me.route.action&&!me.route.lazy)rt={type:"error",error:ta(405,{method:ne.method,pathname:se.pathname,routeId:me.route.id})};else{let q=uu(i,c,ne,se,ve,me,Ue?[]:r,We),Te=await Xe(ne,se,q,We,null);if(rt=Te[me.route.id],!rt){for(let je of ve)if(Te[je.route.id]){rt=Te[je.route.id];break}}if(ne.signal.aborted)return{shortCircuited:!0}}if(Pl(rt)){let q;return Be&&Be.replace!=null?q=Be.replace:q=Mb(rt.response.headers.get("Location"),new URL(ne.url),f,e.history)===A.location.pathname+A.location.search,await Ve(ne,rt,!0,{submission:pe,replace:q}),{shortCircuited:!0}}if(Ms(rt)){let q=ki(ve,me.route.id);return(Be&&Be.replace)!==!0&&(P="PUSH"),{matches:ve,pendingActionResult:[q.route.id,rt,me.route.id]}}return{matches:ve,pendingActionResult:[me.route.id,rt]}}async function oe(ne,se,pe,ve,Ee,We,Ke,Ue,Be,ot,rt,me,q,Te){let je=Ke||O2(se,pe,ve,Ue),gt=Ue||Be||Db(je),dt=!ie&&!rt;if(We){if(dt){let mn=he(q);D({navigation:je,...mn!==void 0?{actionData:mn}:{}},{flushSync:me})}let Bt=await sn(pe,se.pathname,ne.signal);if(Bt.type==="aborted")return{shortCircuited:!0};if(Bt.type==="error"){if(Bt.partialMatches.length===0){let{matches:on,route:An}=c1(d.activeRoutes);return{matches:on,loaderData:{},errors:{[An.id]:Bt.error}}}let mn=ki(Bt.partialMatches).route.id;return{matches:Bt.partialMatches,loaderData:{},errors:{[mn]:Bt.error}}}else if(Bt.matches)pe=Bt.matches;else{let{error:mn,notFoundMatches:on,route:An}=Yt(se.pathname);return{matches:on,loaderData:{},errors:{[An.id]:mn}}}}let jt=d.activeRoutes,{dsMatches:et,revalidatingFetchers:Pt}=Eb(ne,Ee,i,c,e.history,A,pe,gt,se,rt?[]:r,rt===!0,B,F,de,Y,z,jt,f,e.patchRoutesOnNavigation!=null,d.branches,q,Te);if(Z=++X,!e.dataStrategy&&!et.some(Bt=>Bt.shouldLoad)&&!et.some(Bt=>Bt.route.middleware&&Bt.route.middleware.length>0)&&Pt.length===0){let Bt=new Map(A.fetchers),mn=Oe(Bt);return G(se,{matches:pe,loaderData:{},errors:q&&Ms(q[1])?{[q[0]]:q[1].error}:null,...Tb(q),...mn?{fetchers:Bt}:{}},{flushSync:me}),{shortCircuited:!0}}if(dt){let Bt={};if(!We){Bt.navigation=je;let mn=he(q);mn!==void 0&&(Bt.actionData=mn)}Pt.length>0&&(Bt.fetchers=Ae(Pt)),D(Bt,{flushSync:me})}Pt.forEach(Bt=>{ht(Bt.key),Bt.controller&&te.set(Bt.key,Bt.controller)});let Sn=()=>Pt.forEach(Bt=>ht(Bt.key));O&&O.signal.addEventListener("abort",Sn);let{loaderResults:U,fetcherResults:ce}=await Re(et,Pt,ne,se,Ee);if(ne.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener("abort",Sn),Pt.forEach(Bt=>te.delete(Bt.key));let Ce=u1(U);if(Ce)return await Ve(ne,Ce.result,!0,{replace:ot}),{shortCircuited:!0};if(Ce=u1(ce),Ce)return z.add(Ce.key),await Ve(ne,Ce.result,!0,{replace:ot}),{shortCircuited:!0};let ze=new Map(A.fetchers),{loaderData:lt,errors:mt}=Pb(A,pe,U,q,Pt,ce,ze);rt&&A.errors&&(mt={...A.errors,...mt});let _t=Oe(ze),It=wt(Z,ze),an=_t||It||Pt.length>0;return{matches:pe,loaderData:lt,errors:mt,...an?{workingFetchers:ze}:{}}}function he(ne){if(ne&&!Ms(ne[1]))return{[ne[0]]:ne[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function Ae(ne){let se=new Map(A.fetchers);return ne.forEach(pe=>{let ve=se.get(pe.key),Ee=jd(void 0,ve?ve.data:void 0);se.set(pe.key,Ee)}),se}async function ue(ne,se,pe,ve){ht(ne);let Ee=(ve&&ve.flushSync)===!0,We=d.activeRoutes,Ke=Kg(A.location,A.matches,f,pe,se,ve==null?void 0:ve.relative),Ue=xa(We,Ke,f,!1,d.branches),Be=kt(Ue,We,Ke);if(Be.active&&Be.matches&&(Ue=Be.matches),!Ue){Ye(ne,se,ta(404,{pathname:Ke}),{flushSync:Ee});return}let{path:ot,submission:rt,error:me}=Sb(!0,Ke,ve);if(me){Ye(ne,se,me,{flushSync:Ee});return}let q=e.getContext?await e.getContext():new gb,Te=(ve&&ve.preventScrollReset)===!0;if(rt&&Br(rt.formMethod)){await ke(ne,se,ot,Ue,q,Be.active,Ee,Te,rt,ve&&ve.defaultShouldRevalidate);return}Y.set(ne,{routeId:se,path:ot}),await qe(ne,se,ot,Ue,q,Be.active,Ee,Te,rt)}async function ke(ne,se,pe,ve,Ee,We,Ke,Ue,Be,ot){Ie(),Y.delete(ne);let rt=A.fetchers.get(ne);st(ne,VL(Be,rt),{flushSync:Ke});let me=new AbortController,q=Qc(e.history,pe,me.signal,Be);if(We){let xt=await sn(ve,new URL(q.url).pathname,q.signal,ne);if(xt.type==="aborted")return;if(xt.type==="error"){Ye(ne,se,xt.error,{flushSync:Ke});return}else if(xt.matches)ve=xt.matches;else{Ye(ne,se,ta(404,{pathname:pe}),{flushSync:Ke});return}}let Te=F1(ve,pe);if(!Te.route.action&&!Te.route.lazy){let xt=ta(405,{method:Be.formMethod,pathname:pe,routeId:se});Ye(ne,se,xt,{flushSync:Ke});return}te.set(ne,me);let je=X,gt=uu(i,c,q,pe,ve,Te,r,Ee),dt=await Xe(q,pe,gt,Ee,ne),jt=dt[Te.route.id];if(!jt){for(let xt of gt)if(dt[xt.route.id]){jt=dt[xt.route.id];break}}if(q.signal.aborted){te.get(ne)===me&&te.delete(ne);return}if(de.has(ne)){if(Pl(jt)||Ms(jt)){st(ne,Wa(void 0));return}}else{if(Pl(jt))if(te.delete(ne),Z>je){st(ne,Wa(void 0));return}else return z.add(ne),st(ne,jd(Be)),Ve(q,jt,!1,{fetcherSubmission:Be,preventScrollReset:Ue});if(Ms(jt)){Ye(ne,se,jt.error);return}}let et=A.navigation.location||A.location,Pt=Qc(e.history,et,me.signal),Sn=d.activeRoutes,U=A.navigation.state!=="idle"?xa(Sn,A.navigation.location,f,!1,d.branches):A.matches;qt(U,"Didn't find any matches after fetcher action");let ce=++X;K.set(ne,ce);let{dsMatches:Ce,revalidatingFetchers:ze}=Eb(Pt,Ee,i,c,e.history,A,U,Be,et,r,!1,B,F,de,Y,z,Sn,f,e.patchRoutesOnNavigation!=null,d.branches,[Te.route.id,jt],ot),lt=jd(Be,jt.data),mt=new Map(A.fetchers);mt.set(ne,lt),ze.filter(xt=>xt.key!==ne).forEach(xt=>{let On=xt.key,Ot=mt.get(On),rn=jd(void 0,Ot?Ot.data:void 0);mt.set(On,rn),ht(On),xt.controller&&te.set(On,xt.controller)}),D({fetchers:mt});let _t=()=>ze.forEach(xt=>ht(xt.key));me.signal.addEventListener("abort",_t);let{loaderResults:It,fetcherResults:an}=await Re(Ce,ze,Pt,et,Ee);if(me.signal.aborted)return;me.signal.removeEventListener("abort",_t),K.delete(ne),te.delete(ne),ze.forEach(xt=>te.delete(xt.key));let Bt=A.fetchers.has(ne),mn=xt=>{if(!Bt)return xt;let On=new Map(xt.fetchers);return On.set(ne,Wa(jt.data)),{...xt,fetchers:On}},on=u1(It);if(on)return A=mn(A),Ve(Pt,on.result,!1,{preventScrollReset:Ue});if(on=u1(an),on)return z.add(on.key),A=mn(A),Ve(Pt,on.result,!1,{preventScrollReset:Ue});let An=new Map(A.fetchers);Bt&&An.set(ne,Wa(jt.data));let{loaderData:Dt,errors:Zn}=Pb(A,U,It,void 0,ze,an,An);wt(ce,An),A.navigation.state==="loading"&&ce>Z?(qt(P,"Expected pending action"),O&&O.abort(),G(A.navigation.location,{matches:U,loaderData:Dt,errors:Zn,fetchers:An})):(D({errors:Zn,loaderData:Lb(A.loaderData,Dt,U,Zn),fetchers:An}),B=!1)}async function qe(ne,se,pe,ve,Ee,We,Ke,Ue,Be){let ot=A.fetchers.get(ne);st(ne,jd(Be,ot?ot.data:void 0),{flushSync:Ke});let rt=new AbortController,me=Qc(e.history,pe,rt.signal);if(We){let jt=await sn(ve,new URL(me.url).pathname,me.signal,ne);if(jt.type==="aborted")return;if(jt.type==="error"){Ye(ne,se,jt.error,{flushSync:Ke});return}else if(jt.matches)ve=jt.matches;else{Ye(ne,se,ta(404,{pathname:pe}),{flushSync:Ke});return}}let q=F1(ve,pe);te.set(ne,rt);let Te=X,je=uu(i,c,me,pe,ve,q,r,Ee),gt=await Xe(me,pe,je,Ee,ne),dt=gt[q.route.id];if(!dt){for(let jt of ve)if(gt[jt.route.id]){dt=gt[jt.route.id];break}}if(te.get(ne)===rt&&te.delete(ne),!me.signal.aborted){if(de.has(ne)){st(ne,Wa(void 0));return}if(Pl(dt))if(Z>Te){st(ne,Wa(void 0));return}else{z.add(ne),await Ve(me,dt,!1,{preventScrollReset:Ue});return}if(Ms(dt)){Ye(ne,se,dt.error);return}st(ne,Wa(dt.data))}}async function Ve(ne,se,pe,{submission:ve,fetcherSubmission:Ee,preventScrollReset:We,replace:Ke}={}){pe||($==null||$.resolve(),$=null),se.response.headers.has("X-Remix-Revalidate")&&(B=!0);let Ue=se.response.headers.get("Location");qt(Ue,"Expected a Location header on the redirect Response");let Be=Ue,ot=new URL(ne.url);Ue=Mb(Ue,ot,f,e.history),cu(Be,Ue,ot,"allow-explicit");let rt=o0(A.location,Ue,{_isRedirect:!0});if(n){let dt=!1;if(se.response.headers.has("X-Remix-Reload-Document"))dt=!0;else if(kv(Ue)){const jt=k5(t,Ue,!0);dt=jt.origin!==t.location.origin||$s(jt.pathname,f)==null}if(dt){Ke?t.location.replace(Ue):t.location.assign(Ue);return}}O=null;let me=Ke===!0||se.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:q,formAction:Te,formEncType:je}=A.navigation;!ve&&!Ee&&q&&Te&&je&&(ve=Db(A.navigation));let gt=ve||Ee;if(pL.has(se.response.status)&&gt&&Br(gt.formMethod))await He(me,rt,{submission:{...gt,formAction:Ue},preventScrollReset:We||H,enableViewTransition:pe?Q:void 0});else{let dt=O2(rt,[],me,ve);await He(me,rt,{overrideNavigation:dt,fetcherSubmission:Ee,preventScrollReset:We||H,enableViewTransition:pe?Q:void 0})}}async function Xe(ne,se,pe,ve,Ee){var Ue;let We,Ke={};try{We=await CL(h,ne,se,pe,Ee,ve,!1)}catch(Be){return pe.filter(ot=>ot.shouldLoad).forEach(ot=>{Ke[ot.route.id]={type:"error",error:Be}}),Ke}if(ne.signal.aborted)return Ke;if(!Br(ne.method))for(let Be of pe){if(((Ue=We[Be.route.id])==null?void 0:Ue.type)==="error")break;!We.hasOwnProperty(Be.route.id)&&!A.loaderData.hasOwnProperty(Be.route.id)&&(!A.errors||!A.errors.hasOwnProperty(Be.route.id))&&Be.shouldCallHandler()&&(We[Be.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Be.route.id}`)})}for(let[Be,ot]of Object.entries(We))if(OL(ot)){let rt=ot.result;Ke[Be]={type:"redirect",response:ML(rt,ne,Be,pe,f)}}else Ke[Be]=await NL(ot);return Ke}async function Re(ne,se,pe,ve,Ee){let We=Xe(pe,ve,ne,Ee,null),Ke=Promise.all(se.map(async ot=>{if(ot.matches&&ot.match&&ot.request&&ot.controller){let me=(await Xe(ot.request,ot.path,ot.matches,Ee,ot.key))[ot.match.route.id];return{[ot.key]:me}}else return Promise.resolve({[ot.key]:{type:"error",error:ta(404,{pathname:ot.path})}})})),Ue=await We,Be=(await Ke).reduce((ot,rt)=>Object.assign(ot,rt),{});return{loaderResults:Ue,fetcherResults:Be}}function Ie(){B=!0,Y.forEach((ne,se)=>{te.has(se)&&F.add(se),ht(se)})}function st(ne,se,pe={}){let ve=new Map(A.fetchers);ve.set(ne,se),D({fetchers:ve},{flushSync:(pe&&pe.flushSync)===!0})}function Ye(ne,se,pe,ve={}){let Ee=ki(A.matches,se),We=new Map(A.fetchers);Fe(We,ne),D({errors:{[Ee.route.id]:pe},fetchers:We},{flushSync:(ve&&ve.flushSync)===!0})}function $e(ne){return J.set(ne,(J.get(ne)||0)+1),de.has(ne)&&de.delete(ne),A.fetchers.get(ne)||mL}function Qe(ne,se){ht(ne,se==null?void 0:se.reason),st(ne,Wa(null))}function Fe(ne,se){let pe=A.fetchers.get(se);te.has(se)&&!(pe&&pe.state==="loading"&&K.has(se))&&ht(se),Y.delete(se),K.delete(se),z.delete(se),de.delete(se),F.delete(se),ne.delete(se)}function yt(ne){let se=(J.get(ne)||0)-1;se<=0?(J.delete(ne),de.add(ne)):J.set(ne,se),D({fetchers:new Map(A.fetchers)})}function ht(ne,se){let pe=te.get(ne);pe&&(pe.abort(se),te.delete(ne))}function yn(ne,se){for(let pe of ne){let ve=se.get(pe);qt(ve,`Expected fetcher: ${pe}`);let Ee=Wa(ve.data);se.set(pe,Ee)}}function Oe(ne){let se=[],pe=!1;for(let ve of z){let Ee=ne.get(ve);qt(Ee,`Expected fetcher: ${ve}`),Ee.state==="loading"&&(z.delete(ve),se.push(ve),pe=!0)}return yn(se,ne),pe}function wt(ne,se){let pe=[];for(let[ve,Ee]of K)if(Ee<ne){let We=se.get(ve);qt(We,`Expected fetcher: ${ve}`),We.state==="loading"&&(ht(ve),K.delete(ve),pe.push(ve))}return yn(pe,se),pe.length>0}function pt(ne,se){let pe=A.blockers.get(ne)||Cd;return ae.get(ne)!==se&&ae.set(ne,se),pe}function Nt(ne){A.blockers.delete(ne),ae.delete(ne)}function Ct(ne,se){let pe=A.blockers.get(ne)||Cd;qt(pe.state==="unblocked"&&se.state==="blocked"||pe.state==="blocked"&&se.state==="blocked"||pe.state==="blocked"&&se.state==="proceeding"||pe.state==="blocked"&&se.state==="unblocked"||pe.state==="proceeding"&&se.state==="unblocked",`Invalid blocker state transition: ${pe.state} -> ${se.state}`);let ve=new Map(A.blockers);ve.set(ne,se),D({blockers:ve})}function $t({currentLocation:ne,nextLocation:se,historyAction:pe}){if(ae.size===0)return;ae.size>1&&Kn(!1,"A router only supports one blocker at a time");let ve=Array.from(ae.entries()),[Ee,We]=ve[ve.length-1],Ke=A.blockers.get(Ee);if(!(Ke&&Ke.state==="proceeding")&&We({currentLocation:ne,nextLocation:se,historyAction:pe}))return Ee}function Yt(ne){let se=ta(404,{pathname:ne}),pe=d.activeRoutes,{matches:ve,route:Ee}=c1(pe);return{notFoundMatches:ve,route:Ee,error:se}}function Vn(ne,se,pe){if(b=ne,k=se,x=pe||null,!S&&A.navigation===D2){S=!0;let ve=bt(A.location,A.matches);ve!=null&&D({restoreScrollPosition:ve})}return()=>{b=null,k=null,x=null}}function pn(ne,se){return x&&x(ne,se.map(ve=>E5(ve,A.loaderData)))||ne.key}function ar(ne,se){if(b&&k){let pe=pn(ne,se);b[pe]=k()}}function bt(ne,se){if(b){let pe=pn(ne,se),ve=b[pe];if(typeof ve=="number")return ve}return null}function kt(ne,se,pe){if(e.patchRoutesOnNavigation){let ve=d.branches;if(ne){if(Object.keys(ne[0].params).length>0)return{active:!0,matches:xa(se,pe,f,!0,ve)}}else return{active:!0,matches:xa(se,pe,f,!0,ve)||[]}}return{active:!1,matches:null}}async function sn(ne,se,pe,ve){if(!e.patchRoutesOnNavigation)return{type:"success",matches:ne};let Ee=ne;for(;;){let We=c;try{await e.patchRoutesOnNavigation({signal:pe,path:se,matches:Ee,fetcherKey:ve,patch:(ot,rt)=>{pe.aborted||Cb(ot,rt,d,We,i,!1)}})}catch(ot){return{type:"error",error:ot,partialMatches:Ee}}if(pe.aborted)return{type:"aborted"};let Ke=d.branches,Ue=xa(d.activeRoutes,se,f,!1,Ke),Be=null;if(Ue){if(Object.keys(Ue[0].params).length===0)return{type:"success",matches:Ue};if(Be=xa(d.activeRoutes,se,f,!0,Ke),!(Be&&Ee.length<Be.length&&Ut(Ee,Be.slice(0,Ee.length))))return{type:"success",matches:Ue}}if(Be||(Be=xa(d.activeRoutes,se,f,!0,Ke)),!Be||Ut(Ee,Be))return{type:"success",matches:null};Ee=Be}}function Ut(ne,se){return ne.length===se.length&&ne.every((pe,ve)=>pe.route.id===se[ve].route.id)}function Tn(ne){c={},d.setHmrRoutes(i0(ne,i,void 0,c))}function Vt(ne,se,pe=!1){Cb(ne,se,d,c,i,pe),d.hasHMRRoutes||D({})}return L={get basename(){return f},get future(){return p},get state(){return A},get routes(){return d.stableRoutes},get branches(){return d.branches},get manifest(){return c},get window(){return t},initialize:ee,subscribe:re,enableScrollRestoration:Vn,navigate:Pe,fetch:ue,revalidate:Ze,createHref:ne=>e.history.createHref(ne),createURL:ne=>e.history.createURL(ne),encodeLocation:ne=>e.history.encodeLocation(ne),getFetcher:$e,resetFetcher:Qe,deleteFetcher:yt,dispose:ge,getBlocker:pt,deleteBlocker:Nt,patchRoutes:Vt,_internalFetchControllers:te,_internalSetRoutes:Tn,_internalSetStateDoNotUseOrYouWillBreakYourApp(ne){D(ne)}},e.instrumentations&&(L=aL(L,e.instrumentations.map(ne=>ne.router).filter(Boolean))),L}function wL(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Kg(e,t,n,r,a,i){let c,d;if(a){c=[];for(let h of t)if(c.push(h),h.route.id===a){d=h;break}}else c=t,d=t[t.length-1];let f=N0(r||".",_h(c),$s(e.pathname,n)||e.pathname,i==="path");if(r==null&&(f.search=e.search,f.hash=e.hash),(r==null||r===""||r===".")&&d){let h=Av(f.search);if(d.route.index&&!h)f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&h){let p=new URLSearchParams(f.search),g=p.getAll("index");p.delete("index"),g.filter(y=>y).forEach(y=>p.append("index",y));let v=p.toString();f.search=v?`?${v}`:""}}return n!=="/"&&(f.pathname=QP({basename:n,pathname:f.pathname})),ts(f)}function Sb(e,t,n){if(!n||!wL(n))return{path:t};if(n.formMethod&&!FL(n.formMethod))return{path:t,error:ta(405,{method:n.formMethod})};let r=()=>({path:t,error:ta(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),c=U5(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Br(i))return r();let g=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((v,[y,b])=>`${v}${y}=${b}
50
+ `,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:c,formEncType:n.formEncType,formData:void 0,json:void 0,text:g}}}else if(n.formEncType==="application/json"){if(!Br(i))return r();try{let g=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:c,formEncType:n.formEncType,formData:void 0,json:g,text:void 0}}}catch{return r()}}}qt(typeof FormData=="function","FormData is not available in this environment");let d,f;if(n.formData)d=Xg(n.formData),f=n.formData;else if(n.body instanceof FormData)d=Xg(n.body),f=n.body;else if(n.body instanceof URLSearchParams)d=n.body,f=Rb(d);else if(n.body==null)d=new URLSearchParams,f=new FormData;else try{d=new URLSearchParams(n.body),f=Rb(d)}catch{return r()}let h={formMethod:i,formAction:c,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(Br(h.formMethod))return{path:t,submission:h};let p=co(t);return e&&p.search&&Av(p.search)&&d.append("index",""),p.search=`?${d}`,{path:ts(p),submission:h}}function Eb(e,t,n,r,a,i,c,d,f,h,p,g,v,y,b,x,k,S,E,C,N,M){var ie;let T=N?Ms(N[1])?N[1].error:N[1].data:void 0,L=a.createURL(i.location),A=a.createURL(f),P;if(p&&i.errors){let B=Object.keys(i.errors)[0];P=c.findIndex(F=>F.route.id===B)}else if(N&&Ms(N[1])){let B=N[0];P=c.findIndex(F=>F.route.id===B)-1}let $=N?N[1].statusCode:void 0,H=$&&$>=400,O={currentUrl:L,currentParams:((ie=i.matches[0])==null?void 0:ie.params)||{},nextUrl:A,nextParams:c[0].params,...d,actionResult:T,actionStatus:$},Q=R0(c),I=c.map((B,F)=>{let{route:te}=B,X=null;if(P!=null&&F>P)X=!1;else if(te.lazy)X=!0;else if(!Cv(te))X=!1;else if(p){let{shouldLoad:Y}=I5(te,i.loaderData,i.errors);X=Y}else bL(i.loaderData,i.matches[F],B)&&(X=!0);if(X!==null)return Yg(n,r,e,f,Q,B,h,t,X);let Z=!1;typeof M=="boolean"?Z=M:H?Z=!1:(g||L.pathname+L.search===A.pathname+A.search||L.search!==A.search||xL(i.matches[F],B))&&(Z=!0);let K={...O,defaultShouldRevalidate:Z},z=qd(B,K);return Yg(n,r,e,f,Q,B,h,t,z,K,M)}),V=[];return b.forEach((B,F)=>{if(p||!c.some(de=>de.route.id===B.routeId)||y.has(F))return;let te=i.fetchers.get(F),X=te&&te.state!=="idle"&&te.data===void 0,Z=xa(k,B.path,S??"/",!1,C);if(!Z){if(E&&X)return;V.push({key:F,routeId:B.routeId,path:B.path,matches:null,match:null,request:null,controller:null});return}if(x.has(F))return;let K=F1(Z,B.path),z=new AbortController,Y=Qc(a,B.path,z.signal),J=null;if(v.has(F))v.delete(F),J=uu(n,r,Y,B.path,Z,K,h,t);else if(X)g&&(J=uu(n,r,Y,B.path,Z,K,h,t));else{let de;typeof M=="boolean"?de=M:H?de=!1:de=g;let ae={...O,defaultShouldRevalidate:de};qd(K,ae)&&(J=uu(n,r,Y,B.path,Z,K,h,t,ae))}J&&V.push({key:F,routeId:B.routeId,path:B.path,matches:J,match:K,request:Y,controller:z})}),{dsMatches:I,revalidatingFetchers:V}}function Cv(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function I5(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Cv(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 bL(e,t,n){let r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a}function xL(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function qd(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Cb(e,t,n,r,a,i){let c;if(e){let h=r[e];qt(h,`No route found to patch children into: routeId = ${e}`),h.children||(h.children=[]),c=h.children}else c=n.activeRoutes;let d=[],f=[];if(t.forEach(h=>{let p=c.find(g=>F5(h,g));p?f.push({existingRoute:p,newRoute:h}):d.push(h)}),d.length>0){let h=i0(d,a,[e||"_","patch",String((c==null?void 0:c.length)||"0")],r);c.push(...h)}if(i&&f.length>0)for(let h=0;h<f.length;h++){let{existingRoute:p,newRoute:g}=f[h],v=p,[y]=i0([g],a,[],{},!0);Object.assign(v,{element:y.element?y.element:v.element,errorElement:y.errorElement?y.errorElement:v.errorElement,hydrateFallbackElement:y.hydrateFallbackElement?y.hydrateFallbackElement:v.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function F5(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(c=>F5(r,c))}))??!1:!1}var jb=new WeakMap,_5=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let a=n[t.id];if(qt(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let i=a.lazy[e];if(!i)return;let c=jb.get(a);c||(c={},jb.set(a,c));let d=c[e];if(d)return d;let f=(async()=>{let h=IP(e),g=a[e]!==void 0&&e!=="hasErrorBoundary";if(h)Kn(!h,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),c[e]=Promise.resolve();else if(g)Kn(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let v=await i();v!=null&&(Object.assign(a,{[e]:v}),Object.assign(a,r(a)))}typeof a.lazy=="object"&&(a.lazy[e]=void 0,Object.values(a.lazy).every(v=>v===void 0)&&(a.lazy=void 0))})();return c[e]=f,f},Ab=new WeakMap;function kL(e,t,n,r,a){let i=n[e.id];if(qt(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=Ab.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let g=(async()=>{qt(typeof e.lazy=="function","No lazy route function found");let v=await e.lazy(),y={};for(let b in v){let x=v[b];if(x===void 0)continue;let k=_P(b),E=i[b]!==void 0&&b!=="hasErrorBoundary";k?Kn(!k,"Route property "+b+" is not a supported property to be returned from a lazy route function. This property will be ignored."):E?Kn(!E,`Route "${i.id}" has a static property "${b}" defined but its lazy function is also returning a value for this property. The lazy route property "${b}" will be ignored.`):y[b]=x}Object.assign(i,y),Object.assign(i,{...r(i),lazy:void 0})})();return Ab.set(i,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let c=Object.keys(e.lazy),d=[],f;for(let p of c){if(a&&a.includes(p))continue;let g=_5({key:p,route:e,manifest:n,mapRouteProperties:r});g&&(d.push(g),p===t&&(f=g))}let h=d.length>0?Promise.all(d).then(()=>{}):void 0;return h==null||h.catch(()=>{}),f==null||f.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:f}}async function Nb(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 SL(e){return e.matches.some(t=>t.route.middleware)?V5(e,()=>Nb(e)):Nb(e)}function V5(e,t){return EL(e,t,r=>{if(IL(r))throw r;return r},$L,n);function n(r,a,i){if(i)return Promise.resolve(Object.assign(i.value,{[a]:{type:"error",result:r}}));{let{matches:c}=e,d=Math.min(Math.max(c.findIndex(h=>h.route.id===a),0),Math.max(c.findIndex(h=>h.shouldCallHandler()),0)),f=ki(c,c[d].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function EL(e,t,n,r,a){let{matches:i,...c}=e,d=i.flatMap(h=>h.route.middleware?h.route.middleware.map(p=>[h.route.id,p]):[]);return await Z5(c,d,t,n,r,a)}async function Z5(e,t,n,r,a,i,c=0){let{request:d}=e;if(d.signal.aborted)throw d.signal.reason??new Error(`Request aborted: ${d.method} ${d.url}`);let f=t[c];if(!f)return await n();let[h,p]=f,g,v=async()=>{if(g)throw new Error("You may only call `next()` once per middleware");try{return g={value:await Z5(e,t,n,r,a,i,c+1)},g.value}catch(y){return g={value:await i(y,h,g)},g.value}};try{let y=await p(e,v),b=y!=null?r(y):void 0;return a(b)?b:g?b??g.value:(g={value:await v()},g.value)}catch(y){return await i(y,h,g)}}function z5(e,t,n,r,a){let i=_5({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),c=kL(r.route,Br(n.method)?"action":"loader",t,e,a);return{middleware:i,route:c.lazyRoutePromise,handler:c.lazyHandlerPromise}}function Yg(e,t,n,r,a,i,c,d,f,h=null,p){let g=!1,v=z5(e,t,n,i,c);return{...i,_lazyPromises:v,shouldLoad:f,shouldRevalidateArgs:h,shouldCallHandler(y){return g=!0,h?typeof p=="boolean"?qd(i,{...h,defaultShouldRevalidate:p}):typeof y=="boolean"?qd(i,{...h,defaultShouldRevalidate:y}):qd(i,h):f},resolve(y){let{lazy:b,loader:x,middleware:k}=i.route,S=g||f||y&&!Br(n.method)&&(b||x),E=k&&k.length>0&&!x&&!b;return S&&(Br(n.method)||!E)?jL({request:n,path:r,pattern:a,match:i,lazyHandlerPromise:v==null?void 0:v.handler,lazyRoutePromise:v==null?void 0:v.route,handlerOverride:y,scopedContext:d}):Promise.resolve({type:"data",result:void 0})}}}function uu(e,t,n,r,a,i,c,d,f=null){return a.map(h=>h.route.id!==i.route.id?{...h,shouldLoad:!1,shouldRevalidateArgs:f,shouldCallHandler:()=>!1,_lazyPromises:z5(e,t,n,h,c),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Yg(e,t,n,r,R0(a),h,c,d,!0,f))}async function CL(e,t,n,r,a,i,c){r.some(p=>{var g;return(g=p._lazyPromises)==null?void 0:g.middleware})&&await Promise.all(r.map(p=>{var g;return(g=p._lazyPromises)==null?void 0:g.middleware}));let d={request:t,url:B5(t,n),pattern:R0(r),params:r[0].params,context:i,matches:r},h=await e({...d,fetcherKey:a,runClientMiddleware:p=>{let g=d;return V5(g,()=>p({...g,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(p=>{var g,v;return[(g=p._lazyPromises)==null?void 0:g.handler,(v=p._lazyPromises)==null?void 0:v.route]}))}catch{}return h}async function jL({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:a,lazyRoutePromise:i,handlerOverride:c,scopedContext:d}){let f,h,p=Br(e.method),g=p?"action":"loader",v=y=>{let b,x=new Promise((E,C)=>b=C);h=()=>b(),e.signal.addEventListener("abort",h);let k=E=>typeof y!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${g}" [routeId: ${r.route.id}]`)):y({request:e,url:B5(e,t),pattern:n,params:r.params,context:d},...E!==void 0?[E]:[]),S=(async()=>{try{return{type:"data",result:await(c?c(C=>k(C)):k())}}catch(E){return{type:"error",result:E}}})();return Promise.race([S,x])};try{let y=p?r.route.action:r.route.loader;if(a||i)if(y){let b,[x]=await Promise.all([v(y).catch(k=>{b=k}),a,i]);if(b!==void 0)throw b;f=x}else{await a;let b=p?r.route.action:r.route.loader;if(b)[f]=await Promise.all([v(b),i]);else if(g==="action"){let x=new URL(e.url),k=x.pathname+x.search;throw ta(405,{method:e.method,pathname:k,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(y)f=await v(y);else{let b=new URL(e.url),x=b.pathname+b.search;throw ta(404,{pathname:x})}}catch(y){return{type:"error",result:y}}finally{h&&e.signal.removeEventListener("abort",h)}return f}async function AL(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 NL(e){var r,a,i,c,d;let{result:t,type:n}=e;if(jv(t)){let f;try{f=await AL(t)}catch(h){return{type:"error",error:h}}return n==="error"?{type:"error",error:new M0(t.status,t.statusText,f),statusCode:t.status,headers:t.headers}:{type:"data",data:f,statusCode:t.status,headers:t.headers}}return n==="error"?$b(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:TL(t),statusCode:l0(t)?t.status:void 0,headers:(i=t.init)!=null&&i.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:l0(t)?t.status:void 0}:$b(t)?{type:"data",data:t.data,statusCode:(c=t.init)==null?void 0:c.status,headers:(d=t.init)!=null&&d.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function ML(e,t,n,r,a){let i=e.headers.get("Location");if(qt(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!kv(i)){let c=r.slice(0,r.findIndex(d=>d.route.id===n)+1);i=Kg(new URL(t.url),c,a,i),e.headers.set("Location",i)}return e}var RL=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function qg(e){try{return RL.includes(new URL(e).protocol)}catch{return!1}}function Mb(e,t,n,r){if(kv(e)){let a=e,i=Fh.test(a)?new URL(x5(a,t.protocol)):new URL(a);if(qg(i.toString()))throw new Error("Invalid redirect location");let c=$s(i.pathname,n)!=null;if(i.origin===t.origin&&c)return Sv(i.pathname)+i.search+i.hash}try{let a=r.createURL(e);if(qg(a.toString()))throw new Error("Invalid redirect location")}catch{}return e}function Qc(e,t,n,r){let a=e.createURL(U5(t)).toString(),i={signal:n};if(r&&Br(r.formMethod)){let{formMethod:c,formEncType:d}=r;i.method=c.toUpperCase(),d==="application/json"?(i.headers=new Headers({"Content-Type":d}),i.body=JSON.stringify(r.json)):d==="text/plain"?i.body=r.text:d==="application/x-www-form-urlencoded"&&r.formData?i.body=Xg(r.formData):i.body=r.formData}return new Request(a,i)}function B5(e,t){let n=new URL(e.url),r=typeof t=="string"?co(t):t;if(n.pathname=r.pathname||"/",r.search){let a=new URLSearchParams(r.search),i=a.getAll("index");a.delete("index");for(let c of i.filter(Boolean))a.append("index",c);n.search=a.size?`?${a.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function Xg(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Rb(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function PL(e,t,n,r=!1,a=!1){let i={},c=null,d,f=!1,h={},p=n&&Ms(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let v=g.route.id,y=t[v];if(qt(!Pl(y),"Cannot handle redirect results in processLoaderData"),Ms(y)){let b=y.error;if(p!==void 0&&(b=p,p=void 0),c=c||{},a)c[v]=b;else{let x=ki(e,v);c[x.route.id]==null&&(c[x.route.id]=b)}r||(i[v]=H5),f||(f=!0,d=l0(y.error)?y.error.status:500),y.headers&&(h[v]=y.headers)}else i[v]=y.data,y.statusCode&&y.statusCode!==200&&!f&&(d=y.statusCode),y.headers&&(h[v]=y.headers)}),p!==void 0&&n&&(c={[n[0]]:p},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:c,statusCode:d||200,loaderHeaders:h}}function Pb(e,t,n,r,a,i,c){let{loaderData:d,errors:f}=PL(t,n,r);return a.filter(h=>!h.matches||h.matches.some(p=>p.shouldLoad)).forEach(h=>{let{key:p,match:g,controller:v}=h;if(v&&v.signal.aborted)return;let y=i[p];if(qt(y,"Did not find corresponding fetcher result"),Ms(y)){let b=ki(e.matches,g==null?void 0:g.route.id);f&&f[b.route.id]||(f={...f,[b.route.id]:y.error}),c.delete(p)}else if(Pl(y))qt(!1,"Unhandled fetcher revalidation redirect");else{let b=Wa(y.data);c.set(p,b)}}),{loaderData:d,errors:f}}function Lb(e,t,n,r){let a=Object.entries(t).filter(([,i])=>i!==H5).reduce((i,[c,d])=>(i[c]=d,i),{});for(let i of n){let c=i.route.id;if(!t.hasOwnProperty(c)&&e.hasOwnProperty(c)&&i.route.loader&&(a[c]=e[c]),r&&r.hasOwnProperty(c))break}return a}function Tb(e){return e?Ms(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ki(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 c1(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 ta(e,{pathname:t,routeId:n,method:r,type:a,message:i}={}){let c="Unknown Server Error",d="Unknown @remix-run/router error";return e===400?(c="Bad Request",r&&t&&n?d=`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"&&(d="Unable to encode submission body")):e===403?(c="Forbidden",d=`Route "${n}" does not match URL "${t}"`):e===404?(c="Not Found",d=`No route matches URL "${t}"`):e===405&&(c="Method Not Allowed",r&&t&&n?d=`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&&(d=`Invalid request method "${r.toUpperCase()}"`)),new M0(e||500,c,new Error(d),!0)}function u1(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(Pl(a))return{key:r,result:a}}}function U5(e){let t=typeof e=="string"?co(e):e;return ts({...t,hash:""})}function LL(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function TL(e){var t,n;return new M0(((t=e.init)==null?void 0:t.status)??500,((n=e.init)==null?void 0:n.statusText)??"Internal Server Error",e.data)}function $L(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&DL(n))}function DL(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function OL(e){return jv(e.result)&&D5.has(e.result.status)}function Ms(e){return e.type==="error"}function Pl(e){return(e&&e.type)==="redirect"}function $b(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function jv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function HL(e){return D5.has(e)}function IL(e){return jv(e)&&HL(e.status)&&e.headers.has("Location")}function FL(e){return hL.has(e.toUpperCase())}function Br(e){return dL.has(e.toUpperCase())}function Av(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function F1(e,t){let n=typeof t=="string"?co(t).search:t.search;if(e[e.length-1].route.index&&Av(n||""))return e[e.length-1];let r=R5(e);return r[r.length-1]}function Db(e){let{formMethod:t,formAction:n,formEncType:r,text:a,formData:i,json:c}=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(c!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:c,text:void 0}}}function O2(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 _L(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 jd(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 VL(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 Wa(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 ZL(e,t){try{let n=e.sessionStorage.getItem(O5);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 zL(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(O5,JSON.stringify(n))}catch(r){Kn(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function Ob(){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 ql=s.createContext(null);ql.displayName="DataRouter";var Ou=s.createContext(null);Ou.displayName="DataRouterState";var W5=s.createContext(!1);function G5(){return s.useContext(W5)}var Nv=s.createContext({isTransitioning:!1});Nv.displayName="ViewTransition";var K5=s.createContext(new Map);K5.displayName="Fetchers";var BL=s.createContext(null);BL.displayName="Await";var ss=s.createContext(null);ss.displayName="Navigation";var Vh=s.createContext(null);Vh.displayName="Location";var ca=s.createContext({outlet:null,matches:[],isDataRoute:!1});ca.displayName="Route";var Mv=s.createContext(null);Mv.displayName="RouteError";var Y5="REACT_ROUTER_ERROR",UL="REDIRECT",WL="ROUTE_ERROR_RESPONSE";function GL(e){if(e.startsWith(`${Y5}:${UL}:{`))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 KL(e){if(e.startsWith(`${Y5}:${WL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new M0(t.status,t.statusText,t.data)}catch{}}function YL(e,{relative:t}={}){qt(Xl(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=s.useContext(ss),{hash:a,pathname:i,search:c}=P0(e,{relative:t}),d=i;return n!=="/"&&(d=i==="/"?n:oa([n,i])),r.createHref({pathname:d,search:c,hash:a})}function Xl(){return s.useContext(Vh)!=null}function _n(){return qt(Xl(),"useLocation() may be used only in the context of a <Router> component."),s.useContext(Vh).location}function tn(e){qt(Xl(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=_n();return s.useMemo(()=>Hi(e,M5(t)),[t,e])}var q5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function X5(e){s.useContext(ss).static||s.useLayoutEffect(e)}function Dn(){let{isDataRoute:e}=s.useContext(ca);return e?cT():qL()}function qL(){qt(Xl(),"useNavigate() may be used only in the context of a <Router> component.");let e=s.useContext(ql),{basename:t,navigator:n}=s.useContext(ss),{matches:r}=s.useContext(ca),{pathname:a}=_n(),i=JSON.stringify(_h(r)),c=s.useRef(!1);return X5(()=>{c.current=!0}),s.useCallback((f,h={})=>{if(Kn(c.current,q5),!c.current)return;if(typeof f=="number"){n.go(f);return}let p=N0(f,JSON.parse(i),a,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:oa([t,p.pathname])),cu(typeof f=="string"?f:ts(f),n.createHref(p),Ev(n),"reject"),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,i,a,e])}var Q5=s.createContext(null);function XL(){return s.useContext(Q5)}function QL(e){let t=s.useContext(ca).outlet;return s.useMemo(()=>t&&s.createElement(Q5.Provider,{value:e},t),[t,e])}function Fs(){let{matches:e}=s.useContext(ca),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function P0(e,{relative:t}={}){let{matches:n}=s.useContext(ca),{pathname:r}=_n(),a=JSON.stringify(_h(n));return s.useMemo(()=>N0(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function JL(e,t,n){qt(Xl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=s.useContext(ss),{matches:a}=s.useContext(ca),i=a[a.length-1],c=i?i.params:{},d=i?i.pathname:"/",f=i?i.pathnameBase:"/",h=i&&i.route;{let k=h&&h.path||"";nS(d,!h||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (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=_n(),g;g=p;let v=g.pathname||"/",y=v;if(f!=="/"){let k=f.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let b=n&&n.state.matches.length?n.state.matches.map(k=>Object.assign(k,{route:n.manifest[k.route.id]||k.route})):S5(e,{pathname:y});return Kn(h||b!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Kn(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),sT(b&&b.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:oa([f,r.encodeLocation?r.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:oa([f,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n)}function eT(){let e=tS(),t=l0(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},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=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,c)}var tT=s.createElement(eT,null),J5=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=KL(e.digest);n&&(e=n)}let t=e!==void 0?s.createElement(ca.Provider,{value:this.props.routeContext},s.createElement(Mv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?s.createElement(nT,{error:e},t):t}};J5.contextType=W5;var H2=new WeakMap;function nT({children:e,error:t}){let{basename:n,navigator:r}=s.useContext(ss);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=GL(t.digest);if(a){let i=H2.get(t);if(i)throw i;let c=L5(a.location,n),d=c.absoluteURL||c.to;if(cu(a.location,d,Ev(r),"allow-explicit"),qg(d))throw new Error("Invalid redirect location");if(P5&&!H2.get(t))if(c.isExternal||a.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:a.replace}));throw H2.set(t,f),f}return s.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function rT({routeContext:e,match:t,children:n}){let r=s.useContext(ql);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),s.createElement(ca.Provider,{value:e},n)}function sT(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,i=r==null?void 0:r.errors;if(i!=null){let p=a.findIndex(g=>g.route.id&&(i==null?void 0:i[g.route.id])!==void 0);qt(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 c=!1,d=-1;if(n&&r){c=r.renderFallback;for(let p=0;p<a.length;p++){let g=a[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=p),g.route.id){let{loaderData:v,errors:y}=r,b=g.route.loader&&!v.hasOwnProperty(g.route.id)&&(!y||y[g.route.id]===void 0);if(g.route.lazy||b){n.isStatic&&(c=!0),d>=0?a=a.slice(0,d+1):a=[a[0]];break}}}}let f=n==null?void 0:n.onError,h=r&&f?(p,g)=>{var v,y;f(p,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},pattern:R0(r.matches),errorInfo:g})}:void 0;return a.reduceRight((p,g,v)=>{let y,b=!1,x=null,k=null;r&&(y=i&&g.route.id?i[g.route.id]:void 0,x=g.route.errorElement||tT,c&&(d<0&&v===0?(nS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,k=null):d===v&&(b=!0,k=g.route.hydrateFallbackElement||null)));let S=t.concat(a.slice(0,v+1)),E=()=>{let C;return y?C=x:b?C=k:g.route.Component?C=s.createElement(g.route.Component,null):g.route.element?C=g.route.element:C=p,s.createElement(rT,{match:g,routeContext:{outlet:p,matches:S,isDataRoute:r!=null},children:C})};return r&&(g.route.ErrorBoundary||g.route.errorElement||v===0)?s.createElement(J5,{location:r.location,revalidation:r.revalidation,component:x,error:y,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):E()},null)}function Rv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function aT(e){let t=s.useContext(ql);return qt(t,Rv(e)),t}function Pv(e){let t=s.useContext(Ou);return qt(t,Rv(e)),t}function oT(e){let t=s.useContext(ca);return qt(t,Rv(e)),t}function Lv(e){let t=oT(e),n=t.matches[t.matches.length-1];return qt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function iT(){return Lv("useRouteId")}function lT(){let e=Pv("useNavigation");return s.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function eS(){let{matches:e,loaderData:t}=Pv("useMatches");return s.useMemo(()=>e.map(n=>E5(n,t)),[e,t])}function tS(){var r;let e=s.useContext(Mv),t=Pv("useRouteError"),n=Lv("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function cT(){let{router:e}=aT("useNavigate"),t=Lv("useNavigate"),n=s.useRef(!1);return X5(()=>{n.current=!0}),s.useCallback(async(a,i={})=>{Kn(n.current,q5),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var Hb={};function nS(e,t,n){!t&&!Hb[e]&&(Hb[e]=!0,Kn(!1,n))}var Ib={};function Fb(e,t){!e&&!Ib[t]&&(Ib[t]=!0,console.warn(t))}var uT="useOptimistic",_b=Yl[uT],dT=()=>{};function fT(e){return _b?_b(e):[e,dT]}function hT(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Kn(!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&&Kn(!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&&Kn(!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 pT=["HydrateFallback","hydrateFallbackElement"],mT=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 gT({router:e,flushSync:t,onError:n,useTransitions:r}){r=G5()||r;let[i,c]=s.useState(e.state),[d,f]=fT(i),[h,p]=s.useState(),[g,v]=s.useState({isTransitioning:!1}),[y,b]=s.useState(),[x,k]=s.useState(),[S,E]=s.useState(),C=s.useRef(new Map),N=s.useCallback((A,{deletedFetchers:P,newErrors:$,flushSync:H,viewTransitionOpts:O})=>{$&&n&&Object.values($).forEach(I=>{var V;return n(I,{location:A.location,params:((V=A.matches[0])==null?void 0:V.params)??{},pattern:R0(A.matches)})}),A.fetchers.forEach((I,V)=>{I.data!==void 0&&C.current.set(V,I.data)}),P.forEach(I=>C.current.delete(I)),Fb(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 Q=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(Fb(O==null||Q,"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."),!O||!Q){t&&H?t(()=>c(A)):r===!1?c(A):s.startTransition(()=>{r===!0&&f(I=>Vb(I,A)),c(A)});return}if(t&&H){t(()=>{x&&(y==null||y.resolve(),x.skipTransition()),v({isTransitioning:!0,flushSync:!0,currentLocation:O.currentLocation,nextLocation:O.nextLocation})});let I=e.window.document.startViewTransition(()=>{t(()=>c(A))});I.finished.finally(()=>{t(()=>{b(void 0),k(void 0),p(void 0),v({isTransitioning:!1})})}),t(()=>k(I));return}x?(y==null||y.resolve(),x.skipTransition(),E({state:A,currentLocation:O.currentLocation,nextLocation:O.nextLocation})):(p(A),v({isTransitioning:!0,flushSync:!1,currentLocation:O.currentLocation,nextLocation:O.nextLocation}))},[e.window,t,x,y,r,f,n]);s.useLayoutEffect(()=>e.subscribe(N),[e,N]),s.useEffect(()=>{g.isTransitioning&&!g.flushSync&&b(new mT)},[g]),s.useEffect(()=>{if(y&&h&&e.window){let A=h,P=y.promise,$=e.window.document.startViewTransition(async()=>{r===!1?c(A):s.startTransition(()=>{r===!0&&f(H=>Vb(H,A)),c(A)}),await P});$.finished.finally(()=>{b(void 0),k(void 0),p(void 0),v({isTransitioning:!1})}),k($)}},[h,y,e.window,r,f]),s.useEffect(()=>{y&&h&&d.location.key===h.location.key&&y.resolve()},[y,x,d.location,h]),s.useEffect(()=>{!g.isTransitioning&&S&&(p(S.state),v({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),E(void 0))},[g.isTransitioning,S]);let M=s.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:A=>e.navigate(A),push:(A,P,$)=>e.navigate(A,{state:P,preventScrollReset:$==null?void 0:$.preventScrollReset}),replace:(A,P,$)=>e.navigate(A,{replace:!0,state:P,preventScrollReset:$==null?void 0:$.preventScrollReset})}),[e]),T=e.basename||"/",L=s.useMemo(()=>({router:e,navigator:M,static:!1,basename:T,onError:n}),[e,M,T,n]);return s.createElement(s.Fragment,null,s.createElement(ql.Provider,{value:L},s.createElement(Ou.Provider,{value:d},s.createElement(K5.Provider,{value:C.current},s.createElement(Nv.Provider,{value:g},s.createElement(wT,{basename:T,location:d.location,navigationType:d.historyAction,navigator:M,useTransitions:r},s.createElement(vT,{routes:e.routes,manifest:e.manifest,future:e.future,state:d,isStatic:!1,onError:n})))))),null)}function Vb(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 vT=s.memo(yT);function yT({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:i}){return JL(e,void 0,{manifest:t,state:r,isStatic:a,onError:i})}function no({to:e,replace:t,state:n,relative:r}){qt(Xl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a,navigator:i}=s.useContext(ss);Kn(!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:c}=s.useContext(ca),{pathname:d}=_n(),f=Dn(),h=N0(e,_h(c),d,r==="path");cu(typeof e=="string"?e:ts(e),i.createHref(h),Ev(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 Ql(e){return QL(e.context)}function wT({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,useTransitions:c}){qt(!Xl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=s.useMemo(()=>({basename:d,navigator:a,static:i,useTransitions:c,future:{}}),[d,a,i,c]);typeof n=="string"&&(n=co(n));let{pathname:h="/",search:p="",hash:g="",state:v=null,key:y="default",mask:b}=n,x=s.useMemo(()=>{let k=$s(h,d);return k==null?null:{location:{pathname:k,search:p,hash:g,state:v,key:y,mask:b},navigationType:r}},[d,h,p,g,v,y,r,b]);return Kn(x!=null,`<Router basename="${d}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:s.createElement(ss.Provider,{value:f},s.createElement(Vh.Provider,{children:t,value:x}))}var _1="get",V1="application/x-www-form-urlencoded";function Zh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bT(e){return Zh(e)&&e.tagName.toLowerCase()==="button"}function xT(e){return Zh(e)&&e.tagName.toLowerCase()==="form"}function kT(e){return Zh(e)&&e.tagName.toLowerCase()==="input"}function ST(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ET(e,t){return e.button===0&&(!t||t==="_self")&&!ST(e)}function Qg(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 CT(e,t){let n=Qg(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}var d1=null;function jT(){if(d1===null)try{new FormData(document.createElement("form"),0),d1=!1}catch{d1=!0}return d1}var AT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function I2(e){return e!=null&&!AT.has(e)?(Kn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${V1}"`),null):e}function NT(e,t){let n,r,a,i,c;if(xT(e)){let d=e.getAttribute("action");r=d?$s(d,t):null,n=e.getAttribute("method")||_1,a=I2(e.getAttribute("enctype"))||V1,i=new FormData(e)}else if(bT(e)||kT(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(r=f?$s(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||_1,a=I2(e.getAttribute("formenctype"))||I2(d.getAttribute("enctype"))||V1,i=new FormData(d,e),!jT()){let{name:h,type:p,value:g}=e;if(p==="image"){let v=h?`${h}.`:"";i.append(`${v}x`,"0"),i.append(`${v}y`,"0")}else h&&i.append(h,g)}}else{if(Zh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=_1,r=null,a=V1,c=e}return i&&a==="text/plain"&&(c=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var MT={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},RT=/[&><\u2028\u2029]/g;function Zb(e){return e.replace(RT,t=>MT[t])}function Tv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function rS(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&&$s(a.pathname,t)==="/"?a.pathname=`${xu(t)}/_root.${r}`:a.pathname=`${xu(a.pathname)}.${r}`,a}async function PT(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 LT(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 TT(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let c=await PT(i,n);return c.links?c.links():[]}return[]}));return HT(r.flat(1).filter(LT).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function zb(e,t,n,r,a,i){let c=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,d=(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)=>c(f,h)||d(f,h)):i==="data"?t.filter((f,h)=>{var g;let p=r.routes[f.route.id];if(!p||!p.hasLoader)return!1;if(c(f,h)||d(f,h))return!0;if(f.route.shouldRevalidate){let v=f.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function $T(e,t,{includeHydrateFallback:n}={}){return DT(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 DT(e){return[...new Set(e)]}function OT(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function HT(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(OT(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function $v(){let e=s.useContext(ql);return Tv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function IT(){let e=s.useContext(Ou);return Tv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var zh=s.createContext(void 0);zh.displayName="FrameworkContext";function Bh(){let e=s.useContext(zh);return Tv(e,"You must render this element inside a <HydratedRouter> element"),e}function FT(e,t){let n=s.useContext(zh),[r,a]=s.useState(!1),[i,c]=s.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,v=s.useRef(null);s.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let x=S=>{S.forEach(E=>{c(E.isIntersecting)})},k=new IntersectionObserver(x,{threshold:.5});return v.current&&k.observe(v.current),()=>{k.disconnect()}}},[e]),s.useEffect(()=>{if(r){let x=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(x)}}},[r]);let y=()=>{a(!0)},b=()=>{a(!1),c(!1)};return n?e!=="intent"?[i,v,{}]:[i,v,{onFocus:Ad(d,y),onBlur:Ad(f,b),onMouseEnter:Ad(h,y),onMouseLeave:Ad(p,b),onTouchStart:Ad(g,y)}]:[!1,v,{}]}function Ad(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function _T({page:e,...t}){let n=G5(),{nonce:r}=Bh(),{router:a}=$v(),i=s.useMemo(()=>S5(a.routes,e,a.basename),[a.routes,e,a.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?s.createElement(ZT,{page:e,matches:i,...t}):s.createElement(zT,{page:e,matches:i,...t})):null}function VT(e){let{manifest:t,routeModules:n}=Bh(),[r,a]=s.useState([]);return s.useEffect(()=>{let i=!1;return TT(e,t,n).then(c=>{i||a(c)}),()=>{i=!0}},[e,t,n]),r}function ZT({page:e,matches:t,...n}){let r=_n(),{future:a}=Bh(),{basename:i}=$v(),c=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let d=rS(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&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[i,a.v8_trailingSlashAwareDataRequests,e,r,t]);return s.createElement(s.Fragment,null,c.map(d=>s.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function zT({page:e,matches:t,...n}){let r=_n(),{future:a,manifest:i,routeModules:c}=Bh(),{basename:d}=$v(),{loaderData:f,matches:h}=IT(),p=s.useMemo(()=>zb(e,t,h,i,r,"data"),[e,t,h,i,r]),g=s.useMemo(()=>zb(e,t,h,i,r,"assets"),[e,t,h,i,r]),v=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let x=new Set,k=!1;if(t.forEach(E=>{var N;let C=i.routes[E.route.id];!C||!C.hasLoader||(!p.some(M=>M.route.id===E.route.id)&&E.route.id in f&&((N=c[E.route.id])!=null&&N.shouldRevalidate)||C.hasClientLoader?k=!0:x.add(E.route.id))}),x.size===0)return[];let S=rS(e,d,a.v8_trailingSlashAwareDataRequests,"data");return k&&x.size>0&&S.searchParams.set("_routes",t.filter(E=>x.has(E.route.id)).map(E=>E.route.id).join(",")),[S.pathname+S.search]},[d,a.v8_trailingSlashAwareDataRequests,f,r,i,p,t,e,c]),y=s.useMemo(()=>$T(g,i),[g,i]),b=VT(g);return s.createElement(s.Fragment,null,v.map(x=>s.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),y.map(x=>s.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),b.map(({key:x,link:k})=>s.createElement("link",{key:x,nonce:n.nonce,...k,crossOrigin:k.crossOrigin??n.crossOrigin})))}function BT(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var UT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{UT&&(window.__reactRouterVersion="7.18.3")}catch{}function WT(e,t){return yL({basename:t==null?void 0:t.basename,getContext:t==null?void 0:t.getContext,future:t==null?void 0:t.future,history:$P({window:t==null?void 0:t.window}),hydrationData:GT(),routes:e,mapRouteProperties:hT,hydrationRouteProperties:pT,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 GT(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:KT(e.errors)}),e}function KT(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 M0(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(typeof a.__subType=="string"&&rL.includes(a.__subType)){let i=window[a.__subType];if(typeof i=="function")try{let c=new i(a.message);c.stack="",n[r]=c}catch{}}if(n[r]==null){let i=new Error(a.message);i.stack="",n[r]=i}}else n[r]=a;return n}var Fn=s.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:i,replace:c,mask:d,state:f,target:h,to:p,preventScrollReset:g,viewTransition:v,defaultShouldRevalidate:y,...b},x){let{basename:k,navigator:S,useTransitions:E}=s.useContext(ss),C=typeof p=="string"&&Ih.test(p),N=L5(p,k);p=N.to;let M=YL(p,{relative:a}),T=_n(),L=null;if(d){let V=N0(d,[],T.mask?T.mask.pathname:"/",!0);k!=="/"&&(V.pathname=V.pathname==="/"?k:oa([k,V.pathname])),L=S.createHref(V)}let[A,P,$]=FT(r,b),H=QT(p,{replace:c,mask:d,state:f,target:h,preventScrollReset:g,relative:a,viewTransition:v,defaultShouldRevalidate:y,useTransitions:E});function O(V){t&&t(V),V.defaultPrevented||H(V)}let Q=!(N.isExternal||i),I=s.createElement("a",{...b,...$,href:(Q?L:void 0)||N.absoluteURL||M,onClick:Q?O:t,ref:BT(x,P),target:h,"data-discover":!C&&n==="render"?"true":void 0});return A&&!C?s.createElement(s.Fragment,null,I,s.createElement(_T,{page:M})):I});Fn.displayName="Link";var YT=s.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:c,viewTransition:d,children:f,...h},p){let g=P0(c,{relative:h.relative}),v=_n(),y=s.useContext(Ou),{navigator:b,basename:x}=s.useContext(ss),k=y!=null&&a$(g)&&d===!0,S=b.encodeLocation?b.encodeLocation(g).pathname:g.pathname,E=v.pathname,C=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(E=E.toLowerCase(),C=C?C.toLowerCase():null,S=S.toLowerCase()),C&&x&&(C=$s(C,x)||C);const N=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let M=E===S||!a&&E.startsWith(S)&&E.charAt(N)==="/",T=C!=null&&(C===S||!a&&C.startsWith(S)&&C.charAt(S.length)==="/"),L={isActive:M,isPending:T,isTransitioning:k},A=M?t:void 0,P;typeof r=="function"?P=r(L):P=[r,M?"active":null,T?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let $=typeof i=="function"?i(L):i;return s.createElement(Fn,{...h,"aria-current":A,className:P,ref:p,style:$,to:c,viewTransition:d},typeof f=="function"?f(L):f)});YT.displayName="NavLink";var qT=s.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:c=_1,action:d,onSubmit:f,relative:h,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:v,...y},b)=>{let{useTransitions:x}=s.useContext(ss),k=t$(),S=n$(d,{relative:h}),E=c.toLowerCase()==="get"?"get":"post",C=typeof d=="string"&&Ih.test(d),N=M=>{if(f&&f(M),M.defaultPrevented)return;M.preventDefault();let T=M.nativeEvent.submitter,L=(T==null?void 0:T.getAttribute("formmethod"))||c,A=()=>k(T||M.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:a,state:i,relative:h,preventScrollReset:p,viewTransition:g,defaultShouldRevalidate:v});x&&n!==!1?s.startTransition(()=>A()):A()};return s.createElement("form",{ref:b,method:E,action:S,onSubmit:r?f:N,...y,"data-discover":!C&&e==="render"?"true":void 0})});qT.displayName="Form";function sS({getKey:e,storageKey:t,...n}){let r=s.useContext(zh),{basename:a}=s.useContext(ss),i=_n(),c=eS();r$({getKey:e,storageKey:t});let d=s.useMemo(()=>{if(!r||!e)return null;let h=e8(i,c,a,e);return h!==i.key?h:null},[]);if(!r||r.isSpaMode)return null;let f=((h,p)=>{if(!window.history.state||!window.history.state.key){let g=Math.random().toString(32).slice(2);window.history.replaceState({key:g},"")}try{let v=JSON.parse(sessionStorage.getItem(h)||"{}")[p||window.history.state.key];typeof v=="number"&&window.scrollTo(0,v)}catch(g){console.error(g),sessionStorage.removeItem(h)}}).toString();return n.nonce==null&&(r!=null&&r.nonce)&&(n.nonce=r.nonce),s.createElement("script",{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${f})(${Zb(JSON.stringify(t||Jg))}, ${Zb(JSON.stringify(d))})`}})}sS.displayName="ScrollRestoration";function aS(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Dv(e){let t=s.useContext(ql);return qt(t,aS(e)),t}function XT(e){let t=s.useContext(Ou);return qt(t,aS(e)),t}function QT(e,{target:t,replace:n,mask:r,state:a,preventScrollReset:i,relative:c,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let p=Dn(),g=_n(),v=P0(e,{relative:c});return s.useCallback(y=>{if(ET(y,t)){y.preventDefault();let b=n!==void 0?n:ts(g)===ts(v),x=()=>p(e,{replace:b,mask:r,state:a,preventScrollReset:i,relative:c,viewTransition:d,defaultShouldRevalidate:f});h?s.startTransition(()=>x()):x()}},[g,p,v,n,r,a,t,e,i,c,d,f,h])}function Bi(e){Kn(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(Qg(e)),n=s.useRef(!1),r=_n(),a=s.useMemo(()=>CT(r.search,n.current?null:t.current),[r.search]),i=Dn(),c=s.useCallback((d,f)=>{const h=Qg(typeof d=="function"?d(new URLSearchParams(a)):d);n.current=!0,i("?"+h,f)},[i,a]);return[a,c]}var JT=0,e$=()=>`__${String(++JT)}__`;function t$(){let{router:e}=Dv("useSubmit"),{basename:t}=s.useContext(ss),n=iT(),r=e.fetch,a=e.navigate;return s.useCallback(async(i,c={})=>{let{action:d,method:f,encType:h,formData:p,body:g}=NT(i,t);if(c.navigate===!1){let v=c.fetcherKey||e$();await r(v,n,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||f,formEncType:c.encType||h,flushSync:c.flushSync})}else await a(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,formMethod:c.method||f,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[r,a,t,n])}function n$(e,{relative:t}={}){let{basename:n}=s.useContext(ss),r=s.useContext(ca);qt(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...P0(e||".",{relative:t})},c=_n();if(e==null){i.search=c.search;let d=new URLSearchParams(i.search),f=d.getAll("index");if(f.some(p=>p==="")){d.delete("index"),f.filter(g=>g).forEach(g=>d.append("index",g));let p=d.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:oa([n,i.pathname])),ts(i)}var Jg="react-router-scroll-positions",f1={};function e8(e,t,n,r){let a=null;return r&&(n!=="/"?a=r({...e,pathname:$s(e.pathname,n)||e.pathname},t):a=r(e,t)),a==null&&(a=e.key),a}function r$({getKey:e,storageKey:t}={}){let{router:n}=Dv("useScrollRestoration"),{restoreScrollPosition:r,preventScrollReset:a}=XT("useScrollRestoration"),{basename:i}=s.useContext(ss),c=_n(),d=eS(),f=lT();s.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),s$(s.useCallback(()=>{if(f.state==="idle"){let h=e8(c,d,i,e);f1[h]=window.scrollY}try{sessionStorage.setItem(t||Jg,JSON.stringify(f1))}catch(h){Kn(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${h}).`)}window.history.scrollRestoration="auto"},[f.state,e,i,c,d,t])),typeof document<"u"&&(s.useLayoutEffect(()=>{try{let h=sessionStorage.getItem(t||Jg);h&&(f1=JSON.parse(h))}catch{}},[t]),s.useLayoutEffect(()=>{let h=n==null?void 0:n.enableScrollRestoration(f1,()=>window.scrollY,e?(p,g)=>e8(p,g,i,e):void 0);return()=>h&&h()},[n,i,e]),s.useLayoutEffect(()=>{if(r!==!1){if(typeof r=="number"){window.scrollTo(0,r);return}try{if(c.hash){let h=document.getElementById(decodeURIComponent(c.hash.slice(1)));if(h){h.scrollIntoView();return}}}catch{Kn(!1,`"${c.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[c,r,a]))}function s$(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 a$(e,{relative:t}={}){let n=s.useContext(Nv);qt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Dv("useViewTransitionState"),a=P0(e,{relative:t});if(!n.isTransitioning)return!1;let i=$s(n.currentLocation.pathname,r)||n.currentLocation.pathname,c=$s(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Hi(a.pathname,c)!=null||Hi(a.pathname,i)!=null}var Mr=y5(),o$=Object.defineProperty,Ov=(e,t)=>o$(e,"name",{value:t,configurable:!0});function t8(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ov(t8,"setRef");function oS(...e){return t=>{let n=!1;const r=e.map(a=>{const i=t8(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():t8(e[a],null)}}}}Ov(oS,"composeRefs");function Xt(...e){return s.useCallback(oS(...e),e)}Ov(Xt,"useComposedRefs");var i$=Object.defineProperty,Pa=(e,t)=>i$(e,"name",{value:t,configurable:!0});function Aa(e){const t=s.forwardRef((n,r)=>{let{children:a,...i}=n,c=null,d=!1;const f=[];n8(a)&&typeof h1=="function"&&(a=h1(a._payload)),s.Children.forEach(a,v=>{var y;if(uS(v)){d=!0;const b=v;let x="child"in b.props?b.props.child:b.props.children;n8(x)&&typeof h1=="function"&&(x=h1(x._payload)),c=l$(b,x),f.push((y=c==null?void 0:c.props)==null?void 0:y.children)}else f.push(v)}),c?c=s.cloneElement(c,void 0,f):!d&&s.Children.count(a)===1&&s.isValidElement(a)&&(c=a);const h=c?cS(c):void 0,p=Xt(r,h);if(!c){if(a||a===0)throw new Error(d?d$(e):u$(e));return a}const g=lS(i,c.props??{});return c.type!==s.Fragment&&(g.ref=r?p:h),s.cloneElement(c,g)});return t.displayName=`${e}.Slot`,t}Pa(Aa,"createSlot");var Jl=Aa("Slot"),iS=Symbol.for("radix.slottable");function Hv(e){const t=Pa(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=iS,t}Pa(Hv,"createSlottable");var Uh=Hv("Slottable"),l$=Pa((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 lS(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]=(...d)=>{const f=i(...d);return a(...d),f}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}Pa(lS,"mergeProps");function cS(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)}Pa(cS,"getElementRef");function uS(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===iS}Pa(uS,"isSlottable");var c$=Symbol.for("react.lazy");function n8(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===c$&&"_payload"in e&&dS(e._payload)}Pa(n8,"isLazyComponent");function dS(e){return typeof e=="object"&&e!==null&&"then"in e}Pa(dS,"isPromiseLike");var u$=Pa(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),d$=Pa(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),h1=Yl[" use ".trim().toString()],f$=Object.defineProperty,h$=(e,t)=>f$(e,"name",{value:t,configurable:!0}),p$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],en=p$.reduce((e,t)=>{const n=Aa(`Primitive.${t}`),r=s.forwardRef((a,i)=>{const{asChild:c,...d}=a,f=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(f,{...d,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Iv(e,t){e&&Mr.flushSync(()=>e.dispatchEvent(t))}h$(Iv,"dispatchDiscreteCustomEvent");var m$=Object.defineProperty,g$=(e,t)=>m$(e,"name",{value:t,configurable:!0}),fS=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"}),v$=s.forwardRef(g$(function(t,n){return o.jsx(en.span,{...t,ref:n,style:{...fS,...t.style}})},"VisuallyHidden")),hS=v$,y$=Object.defineProperty,na=(e,t)=>y$(e,"name",{value:t,configurable:!0});function w$(e,t){const n=s.createContext(t);n.displayName=e+"Context";const r=na(i=>{const{children:c,...d}=i,f=s.useMemo(()=>d,Object.values(d));return o.jsx(n.Provider,{value:f,children:c})},"Provider");r.displayName=e+"Provider";function a(i,c={}){const{optional:d=!1}=c,f=s.useContext(n);if(f)return f;if(t!==void 0)return t;if(!d)throw new Error(`\`${i}\` must be used within \`${e}\``)}return na(a,"useContext"),[r,a]}na(w$,"createContext");function bs(e,t=[]){let n=[];function r(i,c){const d=s.createContext(c);d.displayName=i+"Context";const f=n.length;n=[...n,c];const h=na(g=>{var S;const{scope:v,children:y,...b}=g,x=((S=v==null?void 0:v[e])==null?void 0:S[f])||d,k=s.useMemo(()=>b,Object.values(b));return o.jsx(x.Provider,{value:k,children:y})},"Provider");h.displayName=i+"Provider";function p(g,v,y={}){var S;const{optional:b=!1}=y,x=((S=v==null?void 0:v[e])==null?void 0:S[f])||d,k=s.useContext(x);if(k)return k;if(c!==void 0)return c;if(!b)throw new Error(`\`${g}\` must be used within \`${i}\``)}return na(p,"useContext"),[h,p]}na(r,"createContext");const a=na(()=>{const i=n.map(c=>s.createContext(c));return na(function(d){const f=(d==null?void 0:d[e])||i;return s.useMemo(()=>({[`__scope${e}`]:{...d,[e]:f}}),[d,f])},"useScope")},"createScope");return a.scopeName=e,[r,pS(a,...t)]}na(bs,"createContextScope");function pS(...e){const t=e[0];if(e.length===1)return t;const n=na(()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return na(function(i){const c=r.reduce((d,{useScope:f,scopeName:h})=>{const g=f(i)[`__scope${h}`];return{...d,...g}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}na(pS,"composeContextScopes");var b$=Object.defineProperty,Nr=(e,t)=>b$(e,"name",{value:t,configurable:!0});function Wh(e){const t=e+"CollectionProvider",[n,r]=bs(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=Nr(x=>{const{scope:k,children:S}=x,E=s.useRef(null),C=s.useRef(new Map).current;return o.jsx(a,{scope:k,itemMap:C,collectionRef:E,children:S})},"CollectionProvider");c.displayName=t;const d=e+"CollectionSlot",f=Aa(d),h=s.forwardRef((x,k)=>{const{scope:S,children:E}=x,C=i(d,S),N=Xt(k,C.collectionRef);return o.jsx(f,{ref:N,children:E})});h.displayName=d;const p=e+"CollectionItemSlot",g="data-radix-collection-item",v=Aa(p),y=s.forwardRef((x,k)=>{const{scope:S,children:E,...C}=x,N=s.useRef(null),M=Xt(k,N),T=i(p,S);return s.useEffect(()=>(T.itemMap.set(N,{ref:N,...C}),()=>void T.itemMap.delete(N))),o.jsx(v,{[g]:"",ref:M,children:E})});y.displayName=p;function b(x){const k=i(e+"CollectionConsumer",x);return s.useCallback(()=>{const E=k.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(k.itemMap.values()).sort((T,L)=>C.indexOf(T.ref.current)-C.indexOf(L.ref.current))},[k.collectionRef,k.itemMap])}return Nr(b,"useCollection"),[{Provider:c,Slot:h,ItemSlot:y},b,r]}Nr(Wh,"createCollection");var Bb=new WeakMap,ur,Ns,F2=(Ns=class extends Map{constructor(n){super(n);rb(this,ur);A2(this,ur,[...super.keys()]),Bb.set(this,!0)}set(n,r){return Bb.get(this)&&(this.has(n)?zr(this,ur)[zr(this,ur).indexOf(n)]=n:zr(this,ur).push(n)),super.set(n,r),this}insert(n,r,a){const i=this.has(r),c=zr(this,ur).length,d=Fv(n);let f=d>=0?d:c+d;const h=f<0||f>=c?-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);d<0&&f++;const g=[...zr(this,ur)];let v,y=!1;for(let b=f;b<p;b++)if(f===b){let x=g[b];g[b]===r&&(x=g[b+1]),i&&this.delete(r),v=this.get(x),this.set(r,a)}else{!y&&g[b-1]===r&&(y=!0);const x=g[y?b:b-1],k=v;v=this.get(x),this.delete(x),this.set(x,k)}return this}with(n,r,a){const i=new Ns(this);return i.insert(n,r,a),i}before(n){const r=zr(this,ur).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,a){const i=zr(this,ur).indexOf(n);return i===-1?this:this.insert(i,r,a)}after(n){let r=zr(this,ur).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=zr(this,ur).indexOf(n);return i===-1?this:this.insert(i+1,r,a)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return A2(this,ur,[]),super.clear()}delete(n){const r=super.delete(n);return r&&zr(this,ur).splice(zr(this,ur).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Z1(zr(this,ur),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Z1(zr(this,ur),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return zr(this,ur).indexOf(n)}keyAt(n){return Z1(zr(this,ur),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 c of this)Reflect.apply(n,r,[c,i,this])&&a.push(c),i++;return new Ns(a)}map(n,r){const a=[];let i=0;for(const c of this)a.push([c[0],Reflect.apply(n,r,[c,i,this])]),i++;return new Ns(a)}reduce(...n){const[r,a]=n;let i=0,c=a??this.at(0);for(const d of this)i===0&&n.length===1?c=d:c=Reflect.apply(r,this,[c,d,i,this]),i++;return c}reduceRight(...n){const[r,a]=n;let i=a??this.at(-1);for(let c=this.size-1;c>=0;c--){const d=this.at(c);c===this.size-1&&n.length===1?i=d:i=Reflect.apply(r,this,[i,d,c,this])}return i}toSorted(n){const r=[...this.entries()].sort(n);return new Ns(r)}toReversed(){const n=new Ns;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 Ns(r)}slice(n,r){const a=new Ns;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 c=n;c<=i;c++){const d=this.keyAt(c),f=this.get(d);a.set(d,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}},ur=new WeakMap,Nr(Ns,"OrderedDict"),Ns);function Z1(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=mS(e,t);return n===-1?void 0:e[n]}Nr(Z1,"at");function mS(e,t){const n=e.length,r=Fv(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}Nr(mS,"toSafeIndex");function Fv(e){return e!==e||e===0?0:Math.trunc(e)}Nr(Fv,"toSafeInteger");function x$(e){const t=e+"CollectionProvider",[n,r]=bs(t),[a,i]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new F2,setItemMap:Nr(()=>{},"setItemMap")}),c=Nr(({state:C,...N})=>C?o.jsx(f,{...N,state:C}):o.jsx(d,{...N}),"CollectionProvider");c.displayName=t;const d=Nr(C=>{const N=k();return o.jsx(f,{...C,state:N})},"CollectionInit");d.displayName=t+"Init";const f=Nr(C=>{const{scope:N,children:M,state:T}=C,L=s.useRef(null),[A,P]=s.useState(null),$=Xt(L,P),[H,O]=T;return s.useEffect(()=>{if(!A)return;const Q=yS(()=>{});return Q.observe(A,{childList:!0,subtree:!0}),()=>{Q.disconnect()}},[A]),o.jsx(a,{scope:N,itemMap:H,setItemMap:O,collectionRef:$,collectionRefObject:L,collectionElement:A,children:M})},"CollectionProviderImpl");f.displayName=t+"Impl";const h=e+"CollectionSlot",p=Aa(h),g=s.forwardRef((C,N)=>{const{scope:M,children:T}=C,L=i(h,M),A=Xt(N,L.collectionRef);return o.jsx(p,{ref:A,children:T})});g.displayName=h;const v=e+"CollectionItemSlot",y="data-radix-collection-item",b=Aa(v),x=s.forwardRef((C,N)=>{const{scope:M,children:T,...L}=C,A=s.useRef(null),[P,$]=s.useState(null),H=Xt(N,A,$),O=i(v,M),{setItemMap:Q}=O,I=s.useRef(L);gS(I.current,L)||(I.current=L);const V=I.current;return s.useEffect(()=>{const ie=V;return Q(B=>P?B.has(P)?B.set(P,{...ie,element:P}).toSorted(r8):(B.set(P,{...ie,element:P}),B.toSorted(r8)):B),()=>{Q(B=>!P||!B.has(P)?B:(B.delete(P),new F2(B)))}},[P,V,Q]),o.jsx(b,{[y]:"",ref:H,children:T})});x.displayName=v;function k(){return s.useState(new F2)}Nr(k,"useInitCollection");function S(C){const{itemMap:N}=i(e+"CollectionConsumer",C);return N}return Nr(S,"useCollection"),[{Provider:c,Slot:g,ItemSlot:x},{createCollectionScope:r,useCollection:S,useInitCollection:k}]}Nr(x$,"createCollection");function gS(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}Nr(gS,"shallowEqual");function vS(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Nr(vS,"isElementPreceding");function r8(e,t){return!e[1].element||!t[1].element?0:vS(e[1].element,t[1].element)?-1:1}Nr(r8,"sortByDocumentPosition");function yS(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Nr(yS,"getChildListObserver");var k$=Object.defineProperty,Hu=(e,t)=>k$(e,"name",{value:t,configurable:!0}),wS=!!(typeof window<"u"&&window.document&&window.document.createElement);function vt(e,t,{checkForDefaultPrevented:n=!0}={}){return Hu(function(a){if(e==null||e(a),n===!1||!a||!a.defaultPrevented)return t==null?void 0:t(a)},"handleEvent")}Hu(vt,"composeEventHandlers");function S$(e){var t;if(!wS)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Hu(S$,"getOwnerWindow");function s8(e){if(!wS)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Hu(s8,"getOwnerDocument");function bS(e,t=!1){const{activeElement:n}=s8(e);if(!(n!=null&&n.nodeName))return null;if(xS(n)&&n.contentDocument)return bS(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const a=s8(n).getElementById(r);if(a)return a}}return n}Hu(bS,"getActiveElement");function xS(e){return e.tagName==="IFRAME"}Hu(xS,"isFrame");var pr=globalThis!=null&&globalThis.document?s.useLayoutEffect:()=>{},E$=Object.defineProperty,C$=(e,t)=>E$(e,"name",{value:t,configurable:!0}),Ub=Yl[" useEffectEvent ".trim().toString()],Wb=Yl[" useInsertionEffect ".trim().toString()];function kS(e){if(typeof Ub=="function")return Ub(e);const t=s.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Wb=="function"?Wb(()=>{t.current=e}):pr(()=>{t.current=e}),s.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}C$(kS,"useEffectEvent");var j$=Object.defineProperty,L0=(e,t)=>j$(e,"name",{value:t,configurable:!0}),A$=Yl[" useInsertionEffect ".trim().toString()]||pr;function Vo({prop:e,defaultProp:t,onChange:n=L0(()=>{},"onChange"),caller:r}){const[a,i,c]=SS({defaultProp:t,onChange:n}),d=e!==void 0,f=d?e:a,h=s.useCallback(p=>{var g;if(d){const v=ES(p)?p(e):p;v!==e&&((g=c.current)==null||g.call(c,v))}else i(p)},[d,e,i,c]);return[f,h]}L0(Vo,"useControllableState");function SS({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),a=s.useRef(n),i=s.useRef(t);return A$(()=>{i.current=t},[t]),s.useEffect(()=>{var c;a.current!==n&&((c=i.current)==null||c.call(i,n),a.current=n)},[n,a]),[n,r,i]}L0(SS,"useUncontrolledState");function ES(e){return typeof e=="function"}L0(ES,"isFunction");var Gb=Symbol("RADIX:SYNC_STATE");function N$(e,t,n,r){const{prop:a,defaultProp:i,onChange:c,caller:d}=t,f=a!==void 0,h=kS(c),p=[{...n,state:i}];r&&p.push(r);const[g,v]=s.useReducer((k,S)=>{if(S.type===Gb)return{...k,state:S.state};const E=e(k,S);return f&&!Object.is(E.state,k.state)&&h(E.state),E},...p),y=g.state,b=s.useRef(y);s.useEffect(()=>{b.current!==y&&(b.current=y,f||h(y))},[y,b,f]);const x=s.useMemo(()=>a!==void 0?{...g,state:a}:g,[g,a]);return s.useEffect(()=>{f&&!Object.is(a,g.state)&&v({type:Gb,state:a})},[a,g.state,f]),[x,v]}L0(N$,"useControllableStateReducer");var M$=Object.defineProperty,Zo=(e,t)=>M$(e,"name",{value:t,configurable:!0});function CS(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}Zo(CS,"useStateMachine");var Kr=Zo(e=>{const{present:t,children:n}=e,r=jS(t),a=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),i=AS(r.ref,NS(a));return typeof n=="function"||r.isPresent?s.cloneElement(a,{ref:i}):null},"Presence");function jS(e){const[t,n]=s.useState(),r=s.useRef(null),a=s.useRef(e),i=s.useRef("none"),c=s.useRef(void 0),d=e?"mounted":"unmounted",[f,h]=CS(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{f==="mounted"?(i.current=c.current??Jc(r.current),c.current=void 0):i.current="none"},[f]),pr(()=>{const p=r.current,g=a.current;if(g!==e){const y=i.current,b=Jc(p);e?(c.current=b,h("MOUNT")):b==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(g&&y!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),pr(()=>{if(t){let p;const g=t.ownerDocument.defaultView??window,v=Zo(b=>{const k=Jc(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&k&&(h("ANIMATION_END"),!a.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",p=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),y=Zo(b=>{b.target===t&&(i.current=Jc(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{g.clearTimeout(p),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:s.useCallback(p=>{if(p){const g=getComputedStyle(p);r.current=g,c.current=Jc(g)}else r.current=null;n(p)},[])}}Zo(jS,"usePresence");function a8(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Zo(a8,"setRef");function AS(...e){const t=s.useRef(e);return t.current=e,s.useCallback(n=>{const r=t.current;let a=!1;const i=r.map(c=>{const d=a8(c,n);return!a&&typeof d=="function"&&(a=!0),d});if(a)return()=>{for(let c=0;c<i.length;c++){const d=i[c];typeof d=="function"?d():a8(r[c],null)}}},[])}Zo(AS,"useStableComposedRefs");function Jc(e){return(e==null?void 0:e.animationName)||"none"}Zo(Jc,"getAnimationName");function NS(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)}Zo(NS,"getElementRef");var R$=Object.defineProperty,P$=(e,t)=>R$(e,"name",{value:t,configurable:!0}),L$=Yl[" useId ".trim().toString()]||(()=>{}),T$=0;function ia(e){const[t,n]=s.useState(L$());return pr(()=>{e||n(r=>r??String(T$++))},[e]),e||(t?`radix-${t}`:"")}P$(ia,"useId");var $$=Object.defineProperty,MS=(e,t)=>$$(e,"name",{value:t,configurable:!0}),RS=s.createContext(void 0),D$=MS(e=>{const{dir:t,children:n}=e;return o.jsx(RS.Provider,{value:t,children:n})},"DirectionProvider");function T0(e){const t=s.useContext(RS);return e||t||"ltr"}MS(T0,"useDirection");var O$=D$,H$=Object.defineProperty,I$=(e,t)=>H$(e,"name",{value:t,configurable:!0});function fr(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)}),[])}I$(fr,"useCallbackRef");var F$=Object.defineProperty,Ar=(e,t)=>F$(e,"name",{value:t,configurable:!0}),o8="dismissableLayer.update",_$="dismissableLayer.pointerDownOutside",V$="dismissableLayer.focusOutside",Kb,PS=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),$0=s.forwardRef(Ar(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:a=!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:h,...p}=t,g=s.useContext(PS),[v,y]=s.useState(null),b=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=s.useState({}),k=Xt(n,y),S=Array.from(g.layers),[E]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),C=E?S.indexOf(E):-1,N=v?S.indexOf(v):-1,M=g.layersWithOutsidePointerEventsDisabled.size>0,T=N>=C,L=s.useRef(!1),A=TS(O=>{c==null||c(O),f==null||f(O),O.defaultPrevented||h==null||h()},{ownerDocument:b,deferPointerDownOutside:a,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:g.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(O=>{if(!(O instanceof Node))return!1;const Q=[...g.branches].some(I=>I.contains(O));return T&&!Q},[g.branches,T])}),P=$S(O=>{if(a&&L.current)return;const Q=O.target;[...g.branches].some(V=>V.contains(Q))||(d==null||d(O),f==null||f(O),O.defaultPrevented||h==null||h())},b),$=v?N===S.length-1:!1,H=fr(O=>{O.key==="Escape"&&(i==null||i(O),!O.defaultPrevented&&h&&(O.preventDefault(),h()))});return s.useEffect(()=>{if($)return b.addEventListener("keydown",H,{capture:!0}),()=>b.removeEventListener("keydown",H,{capture:!0})},[b,$,H]),s.useEffect(()=>{if(v)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Kb=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),i8(),()=>{r&&(g.layersWithOutsidePointerEventsDisabled.delete(v),g.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=Kb))}},[v,b,r,g]),s.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),i8())},[v,g]),s.useEffect(()=>{const O=Ar(()=>x({}),"handleUpdate");return document.addEventListener(o8,O),()=>document.removeEventListener(o8,O)},[]),o.jsx(en.div,{...p,ref:k,style:{pointerEvents:M?T?"auto":"none":void 0,...t.style},onFocusCapture:vt(t.onFocusCapture,P.onFocusCapture),onBlurCapture:vt(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:vt(t.onPointerDownCapture,A.onPointerDownCapture)})},"DismissableLayer"));function LS(){const e=s.useContext(PS),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Ar(LS,"useDismissableLayerSurface");var Z$=Ar(()=>!0,"IS_TRUE");function TS(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:i,shouldHandlePointerDownOutside:c=Z$}=t,d=fr(e),f=s.useRef(!1),h=s.useRef(!1),p=s.useRef(new Map),g=s.useRef(()=>{});return s.useEffect(()=>{function v(){h.current=!1,a.current=!1,p.current.clear()}Ar(v,"resetOutsideInteraction");function y(){return Array.from(p.current.values()).some(Boolean)}Ar(y,"isOutsideInteractionIntercepted");function b(C){if(!h.current)return;const N=C.target;N instanceof Node&&[...i].some(T=>T.contains(N))||p.current.set(C.type,!0),C.type==="click"&&window.setTimeout(()=>{h.current&&g.current()},0)}Ar(b,"handleInteractionCapture");function x(C){h.current&&p.current.set(C.type,!1)}Ar(x,"handleInteractionBubble");const k=Ar(C=>{if(C.target&&!f.current){let N=function(){n.removeEventListener("click",g.current);const T=y();v(),T||_v(_$,d,M,{discrete:!0})};if(Ar(N,"handleAndDispatchPointerDownOutsideEvent"),!c(C.target)){n.removeEventListener("click",g.current),v(),f.current=!1;return}const M={originalEvent:C};h.current=!0,a.current=r&&C.button===0,p.current.clear(),!r||C.button!==0?N():(n.removeEventListener("click",g.current),g.current=N,n.addEventListener("click",g.current,{once:!0}))}else n.removeEventListener("click",g.current),v();f.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const C of S)n.addEventListener(C,b,!0),n.addEventListener(C,x);const E=window.setTimeout(()=>{n.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(E),n.removeEventListener("pointerdown",k),n.removeEventListener("click",g.current);for(const C of S)n.removeEventListener(C,b,!0),n.removeEventListener(C,x)}},[n,d,r,a,i,c]),{onPointerDownCapture:Ar(()=>f.current=!0,"onPointerDownCapture")}}Ar(TS,"usePointerDownOutside");function $S(e,t=globalThis==null?void 0:globalThis.document){const n=fr(e),r=s.useRef(!1);return s.useEffect(()=>{const a=Ar(i=>{i.target&&!r.current&&_v(V$,n,{originalEvent:i},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:Ar(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Ar(()=>r.current=!1,"onBlurCapture")}}Ar($S,"useFocusOutside");function i8(){const e=new CustomEvent(o8);document.dispatchEvent(e)}Ar(i8,"dispatchUpdate");function _v(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Iv(a,i):a.dispatchEvent(i)}Ar(_v,"handleAndDispatchCustomEvent");var z$=Object.defineProperty,Jr=(e,t)=>z$(e,"name",{value:t,configurable:!0}),_2="focusScope.autoFocusOnMount",V2="focusScope.autoFocusOnUnmount",Yb={bubbles:!1,cancelable:!0},Iu=s.forwardRef(Jr(function(t,n){const{loop:r=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:c,...d}=t,[f,h]=s.useState(null),p=fr(i),g=fr(c),v=s.useRef(null),y=Xt(n,h),b=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(a){let k=function(N){if(b.paused||!f)return;const M=N.target;f.contains(M)?v.current=M:So(v.current,{select:!0})},S=function(N){if(b.paused||!f)return;const M=N.relatedTarget;M!==null&&(f.contains(M)||So(v.current,{select:!0}))},E=function(N){if(document.activeElement===document.body)for(const T of N)T.removedNodes.length>0&&So(f)};Jr(k,"handleFocusIn"),Jr(S,"handleFocusOut"),Jr(E,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",S);const C=new MutationObserver(E);return f&&C.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",S),C.disconnect()}}},[a,f,b.paused]),s.useEffect(()=>{if(f){qb.add(b);const k=document.activeElement;if(!f.contains(k)){const E=new CustomEvent(_2,Yb);f.addEventListener(_2,p),f.dispatchEvent(E),E.defaultPrevented||(DS(_S(Vv(f)),{select:!0}),document.activeElement===k&&So(f))}return()=>{f.removeEventListener(_2,p),setTimeout(()=>{const E=new CustomEvent(V2,Yb);f.addEventListener(V2,g),f.dispatchEvent(E),E.defaultPrevented||So(k??document.body,{select:!0}),f.removeEventListener(V2,g),qb.remove(b)},0)}}},[f,p,g,b]);const x=s.useCallback(k=>{if(!r&&!a||b.paused)return;const S=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,E=document.activeElement;if(S&&E){const C=k.currentTarget,[N,M]=OS(C);N&&M?!k.shiftKey&&E===M?(k.preventDefault(),r&&So(N,{select:!0})):k.shiftKey&&E===N&&(k.preventDefault(),r&&So(M,{select:!0})):E===C&&k.preventDefault()}},[r,a,b.paused]);return o.jsx(en.div,{tabIndex:-1,...d,ref:y,onKeyDown:x})},"FocusScope"));function DS(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(So(r,{select:t}),document.activeElement!==n)return}Jr(DS,"focusFirst");function OS(e){const t=Vv(e),n=l8(t,e),r=l8(t.reverse(),e);return[n,r]}Jr(OS,"getTabbableEdges");function Vv(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Jr(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}Jr(Vv,"getTabbableCandidates");function l8(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):HS(r,{upTo:t})))return r}Jr(l8,"findVisible");function HS(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}Jr(HS,"isHidden");function IS(e){return e instanceof HTMLInputElement&&"select"in e}Jr(IS,"isSelectableInput");function So(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&IS(e)&&t&&e.select()}}Jr(So,"focus");var qb=FS();function FS(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=c8(e,t),e.unshift(t)},remove(t){var n;e=c8(e,t),(n=e[0])==null||n.resume()}}}Jr(FS,"createFocusScopesStack");function c8(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Jr(c8,"arrayRemove");function _S(e){return e.filter(t=>t.tagName!=="A")}Jr(_S,"removeLinks");var B$=Object.defineProperty,U$=(e,t)=>B$(e,"name",{value:t,configurable:!0}),D0=s.forwardRef(U$(function(t,n){var f;const{container:r,...a}=t,[i,c]=s.useState(!1);pr(()=>c(!0),[]);const d=r||i&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return d?Mr.createPortal(o.jsx(en.div,{...a,ref:n}),d):null},"Portal")),W$=Object.defineProperty,Zv=(e,t)=>W$(e,"name",{value:t,configurable:!0}),p1=0,za=null;function G$(e){return Fu(),e.children}Zv(G$,"FocusGuards");function Fu(){s.useEffect(()=>{za||(za={start:u8(),end:u8()});const{start:e,end:t}=za;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),p1++,()=>{p1===1&&(za==null||za.start.remove(),za==null||za.end.remove(),za=null),p1=Math.max(0,p1-1)}},[])}Zv(Fu,"useFocusGuards");function u8(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Zv(u8,"createFocusGuard");var Ga=function(){return Ga=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},Ga.apply(this,arguments)};function VS(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 K$(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 z1="right-scroll-bar-position",B1="width-before-scroll-bar",Y$="with-scroll-bars-hidden",q$="--removed-body-scroll-bar-size";function Z2(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function X$(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 Q$=typeof window<"u"?s.useLayoutEffect:s.useEffect,Xb=new WeakMap;function J$(e,t){var n=X$(null,function(r){return e.forEach(function(a){return Z2(a,r)})});return Q$(function(){var r=Xb.get(n);if(r){var a=new Set(r),i=new Set(e),c=n.current;a.forEach(function(d){i.has(d)||Z2(d,null)}),i.forEach(function(d){a.has(d)||Z2(d,c)})}Xb.set(n,e)},[e]),n}function eD(e){return e}function tD(e,t){t===void 0&&(t=eD);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 c=t(i,r);return n.push(c),function(){n=n.filter(function(d){return d!==c})}},assignSyncMedium:function(i){for(r=!0;n.length;){var c=n;n=[],c.forEach(i)}n={push:function(d){return i(d)},filter:function(){return n}}},assignMedium:function(i){r=!0;var c=[];if(n.length){var d=n;n=[],d.forEach(i),c=n}var f=function(){var p=c;c=[],p.forEach(i)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(p){c.push(p),h()},filter:function(p){return c=c.filter(p),n}}}};return a}function nD(e){e===void 0&&(e={});var t=tD(null);return t.options=Ga({async:!0,ssr:!1},e),t}var ZS=function(e){var t=e.sideCar,n=VS(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,Ga({},n))};ZS.isSideCarExport=!0;function rD(e,t){return e.useMedium(t),ZS}var zS=nD(),z2=function(){},Gh=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:z2,onWheelCapture:z2,onTouchMoveCapture:z2}),a=r[0],i=r[1],c=e.forwardProps,d=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,v=e.sideCar,y=e.noRelative,b=e.noIsolation,x=e.inert,k=e.allowPinchZoom,S=e.as,E=S===void 0?"div":S,C=e.gapMode,N=VS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=v,T=J$([n,t]),L=Ga(Ga({},N),a);return s.createElement(s.Fragment,null,p&&s.createElement(M,{sideCar:zS,removeScrollBar:h,shards:g,noRelative:y,noIsolation:b,inert:x,setCallbacks:i,allowPinchZoom:!!k,lockRef:n,gapMode:C}),c?s.cloneElement(s.Children.only(d),Ga(Ga({},L),{ref:T})):s.createElement(E,Ga({},L,{className:f,ref:T}),d))});Gh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Gh.classNames={fullWidth:B1,zeroRight:z1};var sD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function aD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=sD();return t&&e.setAttribute("nonce",t),e}function oD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var lD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=aD())&&(oD(t,n),iD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cD=function(){var e=lD();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},BS=function(){var e=cD(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},uD={left:0,top:0,right:0,gap:0},B2=function(e){return parseInt(e||"",10)||0},dD=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[B2(n),B2(r),B2(a)]},fD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return uD;var t=dD(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])}},hD=BS(),du="data-scroll-locked",pD=function(e,t,n,r){var a=e.left,i=e.top,c=e.right,d=e.gap;return n===void 0&&(n="margin"),`
53
+ .`.concat(Y$,` {
54
+ overflow: hidden `).concat(r,`;
55
+ padding-right: `).concat(d,"px ").concat(r,`;
56
+ }
57
+ body[`).concat(du,`] {
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(c,`px;
64
+ margin-left:0;
65
+ margin-top:0;
66
+ margin-right: `).concat(d,"px ").concat(r,`;
67
+ `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(r,";")].filter(Boolean).join(""),`
68
+ }
69
+
70
+ .`).concat(z1,` {
71
+ right: `).concat(d,"px ").concat(r,`;
72
+ }
73
+
74
+ .`).concat(B1,` {
75
+ margin-right: `).concat(d,"px ").concat(r,`;
76
+ }
77
+
78
+ .`).concat(z1," .").concat(z1,` {
79
+ right: 0 `).concat(r,`;
80
+ }
81
+
82
+ .`).concat(B1," .").concat(B1,` {
83
+ margin-right: 0 `).concat(r,`;
84
+ }
85
+
86
+ body[`).concat(du,`] {
87
+ `).concat(q$,": ").concat(d,`px;
88
+ }
89
+ `)},Qb=function(){var e=parseInt(document.body.getAttribute(du)||"0",10);return isFinite(e)?e:0},mD=function(){s.useEffect(function(){return document.body.setAttribute(du,(Qb()+1).toString()),function(){var e=Qb()-1;e<=0?document.body.removeAttribute(du):document.body.setAttribute(du,e.toString())}},[])},gD=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;mD();var i=s.useMemo(function(){return fD(a)},[a]);return s.createElement(hD,{styles:pD(i,!t,a,n?"":"!important")})},d8=!1;if(typeof window<"u")try{var m1=Object.defineProperty({},"passive",{get:function(){return d8=!0,!0}});window.addEventListener("test",m1,m1),window.removeEventListener("test",m1,m1)}catch{d8=!1}var _c=d8?{passive:!1}:!1,vD=function(e){return e.tagName==="TEXTAREA"},US=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!vD(e)&&n[t]==="visible")},yD=function(e){return US(e,"overflowY")},wD=function(e){return US(e,"overflowX")},Jb=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=WS(e,r);if(a){var i=GS(e,r),c=i[1],d=i[2];if(c>d)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},bD=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},xD=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},WS=function(e,t){return e==="v"?yD(t):wD(t)},GS=function(e,t){return e==="v"?bD(t):xD(t)},kD=function(e,t){return e==="h"&&t==="rtl"?-1:1},SD=function(e,t,n,r,a){var i=kD(e,window.getComputedStyle(t).direction),c=i*r,d=n.target,f=t.contains(d),h=!1,p=c>0,g=0,v=0;do{if(!d)break;var y=GS(e,d),b=y[0],x=y[1],k=y[2],S=x-k-i*b;(b||S)&&WS(e,d)&&(g+=S,v+=b);var E=d.parentNode;d=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!f&&d!==document.body||f&&(t.contains(d)||t===d));return(p&&Math.abs(g)<1||!p&&Math.abs(v)<1)&&(h=!0),h},g1=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ex=function(e){return[e.deltaX,e.deltaY]},tx=function(e){return e&&"current"in e?e.current:e},ED=function(e,t){return e[0]===t[0]&&e[1]===t[1]},CD=function(e){return`
90
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
91
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
92
+ `)},jD=0,Vc=[];function AD(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),a=s.useState(jD++)[0],i=s.useState(BS)[0],c=s.useRef(e);s.useEffect(function(){c.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var x=K$([e.lockRef.current],(e.shards||[]).map(tx),!0).filter(Boolean);return x.forEach(function(k){return k.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),x.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var d=s.useCallback(function(x,k){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!c.current.allowPinchZoom;var S=g1(x),E=n.current,C="deltaX"in x?x.deltaX:E[0]-S[0],N="deltaY"in x?x.deltaY:E[1]-S[1],M,T=x.target,L=Math.abs(C)>Math.abs(N)?"h":"v";if("touches"in x&&L==="h"&&T.type==="range")return!1;var A=window.getSelection(),P=A&&A.anchorNode,$=P?P===T||P.contains(T):!1;if($)return!1;var H=Jb(L,T);if(!H)return!0;if(H?M=L:(M=L==="v"?"h":"v",H=Jb(L,T)),!H)return!1;if(!r.current&&"changedTouches"in x&&(C||N)&&(r.current=M),!M)return!0;var O=r.current||M;return SD(O,k,x,O==="h"?C:N)},[]),f=s.useCallback(function(x){var k=x;if(!(!Vc.length||Vc[Vc.length-1]!==i)){var S="deltaY"in k?ex(k):g1(k),E=t.current.filter(function(M){return M.name===k.type&&(M.target===k.target||k.target===M.shadowParent)&&ED(M.delta,S)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var C=(c.current.shards||[]).map(tx).filter(Boolean).filter(function(M){return M.contains(k.target)}),N=C.length>0?d(k,C[0]):!c.current.noIsolation;N&&k.cancelable&&k.preventDefault()}}},[]),h=s.useCallback(function(x,k,S,E){var C={name:x,delta:k,target:S,should:E,shadowParent:ND(S)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(N){return N!==C})},1)},[]),p=s.useCallback(function(x){n.current=g1(x),r.current=void 0},[]),g=s.useCallback(function(x){h(x.type,ex(x),x.target,d(x,e.lockRef.current))},[]),v=s.useCallback(function(x){h(x.type,g1(x),x.target,d(x,e.lockRef.current))},[]);s.useEffect(function(){return Vc.push(i),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:v}),document.addEventListener("wheel",f,_c),document.addEventListener("touchmove",f,_c),document.addEventListener("touchstart",p,_c),function(){Vc=Vc.filter(function(x){return x!==i}),document.removeEventListener("wheel",f,_c),document.removeEventListener("touchmove",f,_c),document.removeEventListener("touchstart",p,_c)}},[]);var y=e.removeScrollBar,b=e.inert;return s.createElement(s.Fragment,null,b?s.createElement(i,{styles:CD(a)}):null,y?s.createElement(gD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ND(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const MD=rD(zS,AD);var O0=s.forwardRef(function(e,t){return s.createElement(Gh,Ga({},e,{ref:t,sideCar:MD}))});O0.classNames=Gh.classNames;var RD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Zc=new WeakMap,v1=new WeakMap,y1={},U2=0,KS=function(e){return e&&(e.host||KS(e.parentNode))},PD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=KS(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})},LD=function(e,t,n,r){var a=PD(t,Array.isArray(e)?e:[e]);y1[n]||(y1[n]=new WeakMap);var i=y1[n],c=[],d=new Set,f=new Set(a),h=function(g){!g||d.has(g)||(d.add(g),h(g.parentNode))};a.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(v){if(d.has(v))p(v);else try{var y=v.getAttribute(r),b=y!==null&&y!=="false",x=(Zc.get(v)||0)+1,k=(i.get(v)||0)+1;Zc.set(v,x),i.set(v,k),c.push(v),x===1&&b&&v1.set(v,!0),k===1&&v.setAttribute(n,"true"),b||v.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",v,S)}})};return p(t),d.clear(),U2++,function(){c.forEach(function(g){var v=Zc.get(g)-1,y=i.get(g)-1;Zc.set(g,v),i.set(g,y),v||(v1.has(g)||g.removeAttribute(r),v1.delete(g)),y||g.removeAttribute(n)}),U2--,U2||(Zc=new WeakMap,Zc=new WeakMap,v1=new WeakMap,y1={})}},Kh=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=RD(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),LD(r,a,n,"aria-hidden")):function(){return null}},TD=Object.defineProperty,_s=(e,t)=>TD(e,"name",{value:t,configurable:!0}),zv="Dialog",[YS,qS]=bs(zv),[$D,La]=YS(zv),ec=_s(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:c=!0}=e,d=s.useRef(null),f=s.useRef(null),[h,p]=Vo({prop:r,defaultProp:a??!1,onChange:i,caller:zv}),[g,v]=s.useState(0),[y,b]=s.useState(0);return o.jsx($D,{scope:t,triggerRef:d,contentRef:f,contentId:ia(),titleId:ia(),descriptionId:ia(),titlePresent:g>0,descriptionPresent:y>0,setTitleCount:v,setDescriptionCount:b,open:h,onOpenChange:p,onOpenToggle:s.useCallback(()=>p(x=>!x),[p]),modal:c,children:n})},"Dialog"),DD="DialogTrigger",Bv=s.forwardRef(_s(function(t,n){const{__scopeDialog:r,...a}=t,i=La(DD,r),c=Xt(n,i.triggerRef);return o.jsx(en.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":qh(i.open),...a,ref:c,onClick:vt(t.onClick,i.onOpenToggle)})},"DialogTrigger")),XS="DialogPortal",[OD,QS]=YS(XS,{forceMount:void 0}),tc=_s(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=La(XS,t);return o.jsx(OD,{scope:t,forceMount:n,children:s.Children.map(r,c=>o.jsx(Kr,{present:n||i.open,children:o.jsx(D0,{asChild:!0,container:a,children:c})}))})},"DialogPortal"),f8="DialogOverlay",nc=s.forwardRef(_s(function(t,n){const r=QS(f8,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,c=La(f8,t.__scopeDialog);return c.modal?o.jsx(Kr,{present:a||c.open,children:o.jsx(ID,{...i,ref:n})}):null},"DialogOverlay")),HD=Aa("DialogOverlay.RemoveScroll"),ID=s.forwardRef(_s(function(t,n){const{__scopeDialog:r,...a}=t,i=La(f8,r),c=LS(),d=Xt(n,c);return o.jsx(O0,{as:HD,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(en.div,{"data-state":qh(i.open),...a,ref:d,style:{pointerEvents:"auto",...a.style}})})},"DialogOverlayImpl")),c0="DialogContent",rc=s.forwardRef(_s(function(t,n){const r=QS(c0,t.__scopeDialog),{forceMount:a=r.forceMount,...i}=t,c=La(c0,t.__scopeDialog);return o.jsx(Kr,{present:a||c.open,children:c.modal?o.jsx(FD,{...i,ref:n}):o.jsx(_D,{...i,ref:n})})},"DialogContent")),FD=s.forwardRef(_s(function(t,n){const r=La(c0,t.__scopeDialog),a=s.useRef(null),i=Xt(n,r.contentRef,a);return s.useEffect(()=>{const c=a.current;if(c)return Kh(c)},[]),o.jsx(JS,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:vt(t.onCloseAutoFocus,c=>{var d;c.preventDefault(),(d=r.triggerRef.current)==null||d.focus()}),onPointerDownOutside:vt(t.onPointerDownOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0;(d.button===2||f)&&c.preventDefault()}),onFocusOutside:vt(t.onFocusOutside,c=>c.preventDefault())})},"DialogContentModal")),_D=s.forwardRef(_s(function(t,n){const r=La(c0,t.__scopeDialog),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(JS,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var d,f;(d=t.onCloseAutoFocus)==null||d.call(t,c),c.defaultPrevented||(a.current||(f=r.triggerRef.current)==null||f.focus(),c.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:c=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const d=c.target;((p=r.triggerRef.current)==null?void 0:p.contains(d))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&i.current&&c.preventDefault()}})},"DialogContentNonModal")),JS=s.forwardRef(_s(function(t,n){const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:c,...d}=t,f=La(c0,r);return Fu(),o.jsx(o.Fragment,{children:o.jsx(Iu,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:c,children:o.jsx($0,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionPresent?f.descriptionId:void 0,"aria-labelledby":f.titlePresent?f.titleId:void 0,"data-state":qh(f.open),...d,ref:n,deferPointerDownOutside:!0,onDismiss:()=>f.onOpenChange(!1)})})})},"DialogContentImpl")),VD="DialogTitle",sc=s.forwardRef(_s(function(t,n){const{__scopeDialog:r,...a}=t,i=La(VD,r),{setTitleCount:c}=i;return pr(()=>(c(d=>d+1),()=>c(d=>d-1)),[c]),o.jsx(en.h2,{id:i.titleId,...a,ref:n})},"DialogTitle")),ZD="DialogDescription",Uv=s.forwardRef(_s(function(t,n){const{__scopeDialog:r,...a}=t,i=La(ZD,r),{setDescriptionCount:c}=i;return pr(()=>(c(d=>d+1),()=>c(d=>d-1)),[c]),o.jsx(en.p,{id:i.descriptionId,...a,ref:n})},"DialogDescription")),zD="DialogClose",Yh=s.forwardRef(_s(function(t,n){const{__scopeDialog:r,...a}=t,i=La(zD,r);return o.jsx(en.button,{type:"button",...a,ref:n,onClick:vt(t.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function qh(e){return e?"open":"closed"}_s(qh,"getState");var BD=Object.defineProperty,Go=(e,t)=>BD(e,"name",{value:t,configurable:!0}),UD="AlertDialog",[WD,Yoe]=bs(UD,[qS]),Ko=qS(),GD=Go(e=>{const{__scopeAlertDialog:t,...n}=e,r=Ko(t);return o.jsx(ec,{...r,...n,modal:!0})},"AlertDialog"),KD=s.forwardRef(Go(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ko(r);return o.jsx(Bv,{...i,...a,ref:n})},"AlertDialogTrigger")),YD=Go(e=>{const{__scopeAlertDialog:t,...n}=e,r=Ko(t);return o.jsx(tc,{...r,...n})},"AlertDialogPortal"),qD=s.forwardRef(Go(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ko(r);return o.jsx(nc,{...i,...a,ref:n})},"AlertDialogOverlay")),XD="AlertDialogContent",[QD,JD]=WD(XD),eO=s.forwardRef(Go(function(t,n){const{__scopeAlertDialog:r,children:a,...i}=t,c=Ko(r),d=s.useRef(null),f=Xt(n,d),h=s.useRef(null);return o.jsx(QD,{scope:r,cancelRef:h,children:o.jsx(rc,{role:"alertdialog",...c,...i,ref:f,onOpenAutoFocus:vt(i.onOpenAutoFocus,p=>{var g;p.preventDefault(),(g=h.current)==null||g.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:a})})},"AlertDialogContent")),tO=s.forwardRef(Go(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ko(r);return o.jsx(sc,{...i,...a,ref:n})},"AlertDialogTitle")),nO=s.forwardRef(Go(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ko(r);return o.jsx(Uv,{...i,...a,ref:n})},"AlertDialogDescription")),rO=s.forwardRef(Go(function(t,n){const{__scopeAlertDialog:r,...a}=t,i=Ko(r);return o.jsx(Yh,{...i,...a,ref:n})},"AlertDialogAction")),sO="AlertDialogCancel",aO=s.forwardRef(Go(function(t,n){const{__scopeAlertDialog:r,...a}=t,{cancelRef:i}=JD(sO,r),c=Ko(r),d=Xt(n,i);return o.jsx(Yh,{...c,...a,ref:d})},"AlertDialogCancel")),oO=GD,iO=KD,lO=YD,cO=qD,uO=eO,dO=rO,fO=aO,hO=tO,pO=nO,mO=Object.defineProperty,gO=(e,t)=>mO(e,"name",{value:t,configurable:!0});function eE(e){const[t,n]=s.useState(void 0);return pr(()=>{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 c,d;if("borderBoxSize"in i){const f=i.borderBoxSize,h=Array.isArray(f)?f[0]:f;c=h.inlineSize,d=h.blockSize}else c=e.offsetWidth,d=e.offsetHeight;n({width:c,height:d})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}gO(eE,"useSize");const vO=["top","right","bottom","left"],Ii=Math.min,Lo=Math.max,nh=Math.round,w1=Math.floor,To=e=>({x:e,y:e}),yO={left:"right",right:"left",bottom:"top",top:"bottom"};function tE(e,t,n){return Lo(e,Ii(t,n))}function zo(e,t){return typeof e=="function"?e(t):e}function Fi(e){return e.split("-")[0]}function _u(e){return e.split("-")[1]}function Wv(e){return e==="x"?"y":"x"}function Gv(e){return e==="y"?"height":"width"}function qa(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Kv(e){return Wv(qa(e))}function wO(e,t,n){n===void 0&&(n=!1);const r=_u(e),a=Kv(e),i=Gv(a);let c=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=rh(c)),[c,rh(c)]}function bO(e){const t=rh(e);return[h8(e),t,h8(t)]}function h8(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const nx=["left","right"],rx=["right","left"],xO=["top","bottom"],kO=["bottom","top"];function SO(e,t,n){switch(e){case"top":case"bottom":return n?t?rx:nx:t?nx:rx;case"left":case"right":return t?xO:kO;default:return[]}}function EO(e,t,n,r){const a=_u(e);let i=SO(Fi(e),n==="start",r);return a&&(i=i.map(c=>c+"-"+a),t&&(i=i.concat(i.map(h8)))),i}function rh(e){const t=Fi(e);return yO[t]+e.slice(t.length)}function CO(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 nE(e){return typeof e!="number"?CO(e):{top:e,right:e,bottom:e,left:e}}function sh(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 sx(e,t,n){let{reference:r,floating:a}=e;const i=qa(t),c=Kv(t),d=Gv(c),f=Fi(t),h=i==="y",p=r.x+r.width/2-a.width/2,g=r.y+r.height/2-a.height/2,v=r[d]/2-a[d]/2;let y;switch(f){case"top":y={x:p,y:r.y-a.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:g};break;case"left":y={x:r.x-a.width,y:g};break;default:y={x:r.x,y:r.y}}const b=_u(t);return b&&(y[c]+=v*(b==="end"?1:-1)*(n&&h?-1:1)),y}async function jO(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:c,elements:d,strategy:f}=e,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:v=!1,padding:y=0}=zo(t,e),b=nE(y),k=d[v?g==="floating"?"reference":"floating":g],S=sh(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(d.floating)),boundary:h,rootBoundary:p,strategy:f})),E=g==="floating"?{x:r,y:a,width:c.floating.width,height:c.floating.height}:c.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d.floating)),N=await(i.isElement==null?void 0:i.isElement(C))&&await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1},M=sh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:E,offsetParent:C,strategy:f}):E);return{top:(S.top-M.top+b.top)/N.y,bottom:(M.bottom-S.bottom+b.bottom)/N.y,left:(S.left-M.left+b.left)/N.x,right:(M.right-S.right+b.right)/N.x}}const AO=50,NO=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:c}=n,d=c.detectOverflow?c:{...c,detectOverflow:jO},f=await(c.isRTL==null?void 0:c.isRTL(t));let h=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:g}=sx(h,r,f),v=r,y=0;const b={};for(let x=0;x<i.length;x++){const k=i[x];if(!k)continue;const{name:S,fn:E}=k,{x:C,y:N,data:M,reset:T}=await E({x:p,y:g,initialPlacement:r,placement:v,strategy:a,middlewareData:b,rects:h,platform:d,elements:{reference:e,floating:t}});p=C??p,g=N??g,b[S]={...b[S],...M},T&&y<AO&&(y++,typeof T=="object"&&(T.placement&&(v=T.placement),T.rects&&(h=T.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:p,y:g}=sx(h,v,f)),x=-1)}return{x:p,y:g,placement:v,strategy:a,middlewareData:b}},MO=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:c,elements:d,middlewareData:f}=t,{element:h,padding:p=0}=zo(e,t)||{};if(h==null)return{};const g=nE(p),v={x:n,y:r},y=Kv(a),b=Gv(y),x=await c.getDimensions(h),k=y==="y",S=k?"top":"left",E=k?"bottom":"right",C=k?"clientHeight":"clientWidth",N=i.reference[b]+i.reference[y]-v[y]-i.floating[b],M=v[y]-i.reference[y],T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h));let L=T?T[C]:0;(!L||!await(c.isElement==null?void 0:c.isElement(T)))&&(L=d.floating[C]||i.floating[b]);const A=N/2-M/2,P=L/2-x[b]/2-1,$=Ii(g[S],P),H=Ii(g[E],P),O=L-x[b]-H,Q=L/2-x[b]/2+A,I=tE($,Q,O),V=!f.arrow&&_u(a)!=null&&Q!==I&&i.reference[b]/2-(Q<$?$:H)-x[b]/2<0,ie=V?Q<$?Q-$:Q-O:0;return{[y]:v[y]+ie,data:{[y]:I,centerOffset:Q-I-ie,...V&&{alignmentOffset:ie}},reset:V}}}),RO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:c,initialPlacement:d,platform:f,elements:h}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=!0,...k}=zo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const S=Fi(a),E=qa(d),C=Fi(d)===d,N=await(f.isRTL==null?void 0:f.isRTL(h.floating)),M=v||(C||!x?[rh(d)]:bO(d)),T=b!=="none";!v&&T&&M.push(...EO(d,x,b,N));const L=[d,...M],A=await f.detectOverflow(t,k),P=[];let $=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&P.push(A[S]),g){const I=wO(a,c,N);P.push(A[I[0]],A[I[1]])}if($=[...$,{placement:a,overflows:P}],!P.every(I=>I<=0)){var H,O;const I=(((H=i.flip)==null?void 0:H.index)||0)+1,V=L[I];if(V&&(!(g==="alignment"?E!==qa(V):!1)||$.every(F=>qa(F.placement)===E?F.overflows[0]>0:!0)))return{data:{index:I,overflows:$},reset:{placement:V}};let ie=(O=$.filter(B=>B.overflows[0]<=0).sort((B,F)=>B.overflows[1]-F.overflows[1])[0])==null?void 0:O.placement;if(!ie)switch(y){case"bestFit":{var Q;const B=(Q=$.filter(F=>{if(T){const te=qa(F.placement);return te===E||te==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(te=>te>0).reduce((te,X)=>te+X,0)]).sort((F,te)=>F[1]-te[1])[0])==null?void 0:Q[0];B&&(ie=B);break}case"initialPlacement":ie=d;break}if(a!==ie)return{reset:{placement:ie}}}return{}}}};function ax(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ox(e){return vO.some(t=>e[t]>=0)}const PO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...i}=zo(e,t);switch(a){case"referenceHidden":{const c=await r.detectOverflow(t,{...i,elementContext:"reference"}),d=ax(c,n.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:ox(d)}}}case"escaped":{const c=await r.detectOverflow(t,{...i,altBoundary:!0}),d=ax(c,n.floating);return{data:{escapedOffsets:d,escaped:ox(d)}}}default:return{}}}}},rE=new Set(["left","top"]);async function LO(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),c=Fi(n),d=_u(n),f=qa(n)==="y",h=rE.has(c)?-1:1,p=i&&f?-1:1,g=zo(t,e);let{mainAxis:v,crossAxis:y,alignmentAxis:b}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof b=="number"&&(y=d==="end"?b*-1:b),f?{x:y*p,y:v*h}:{x:v*h,y:y*p}}const TO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:c,middlewareData:d}=t,f=await LO(t,e);return c===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:a+f.x,y:i+f.y,data:{...f,placement:c}}}}},$O=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:c=!0,crossAxis:d=!1,limiter:f={fn:E=>{let{x:C,y:N}=E;return{x:C,y:N}}},...h}=zo(e,t),p={x:n,y:r},g=await i.detectOverflow(t,h),v=qa(a),y=Wv(v);let b=p[y],x=p[v];const k=(E,C)=>tE(C+g[E==="y"?"top":"left"],C,C-g[E==="y"?"bottom":"right"]);c&&(b=k(y,b)),d&&(x=k(v,x));const S=f.fn({...t,[y]:b,[v]:x});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[y]:c,[v]:d}}}}}},DO=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:a,y:i,placement:c,rects:d,middlewareData:f}=t,{offset:h=0,mainAxis:p=!0,crossAxis:g=!0}=zo(e,t),v={x:a,y:i},y=qa(c),b=Wv(y);let x=v[b],k=v[y];const S=zo(h,t),E=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:(n=S.mainAxis)!=null?n:0,crossAxis:(r=S.crossAxis)!=null?r:0};if(p){const M=b==="y"?"height":"width",T=d.reference[b]-d.floating[M]+E.mainAxis,L=d.reference[b]+d.reference[M]-E.mainAxis;x<T?x=T:x>L&&(x=L)}if(g){var C,N;const M=b==="y"?"width":"height",T=rE.has(Fi(c)),L=d.reference[y]-d.floating[M]+(T&&((C=f.offset)==null?void 0:C[y])||0)+(T?0:E.crossAxis),A=d.reference[y]+d.reference[M]+(T?0:((N=f.offset)==null?void 0:N[y])||0)-(T?E.crossAxis:0);k<L?k=L:k>A&&(k=A)}return{[b]:x,[y]:k}}}},OO=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:c=()=>{},...d}=zo(e,t),f=await a.detectOverflow(t,d),h=Fi(n),p=_u(n),g=qa(n)==="y",{width:v,height:y}=r.floating;let b,x;h==="top"||h==="bottom"?(b=h,x=p===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(x=h,b=p==="end"?"top":"bottom");const k=y-f.top-f.bottom,S=v-f.left-f.right,E=Ii(y-f[b],k),C=Ii(v-f[x],S),N=t.middlewareData.shift,M=!N;let T=E,L=C;N!=null&&N.enabled.x&&(L=S),N!=null&&N.enabled.y&&(T=k),M&&!p&&(g?L=v-2*Lo(f.left,f.right):T=y-2*Lo(f.top,f.bottom)),await c({...t,availableWidth:L,availableHeight:T});const A=await a.getDimensions(i.floating);return v!==A.width||y!==A.height?{reset:{rects:!0}}:{}}}};function Xh(){return typeof window<"u"}function Vu(e){return sE(e)?(e.nodeName||"").toLowerCase():"#document"}function gs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yo(e){var t;return(t=(sE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function sE(e){return Xh()?e instanceof Node||e instanceof gs(e).Node:!1}function ro(e){return Xh()?e instanceof Element||e instanceof gs(e).Element:!1}function Ui(e){return Xh()?e instanceof HTMLElement||e instanceof gs(e).HTMLElement:!1}function ix(e){return!Xh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gs(e).ShadowRoot}function Qh(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=so(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function HO(e){return/^(table|td|th)$/.test(Vu(e))}function Jh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const IO=/transform|translate|scale|rotate|perspective|filter/,FO=/paint|layout|strict|content/,gl=e=>!!e&&e!=="none";let W2;function Yv(e){const t=ro(e)?so(e):e;return gl(t.transform)||gl(t.translate)||gl(t.scale)||gl(t.rotate)||gl(t.perspective)||!qv()&&(gl(t.backdropFilter)||gl(t.filter))||IO.test(t.willChange||"")||FO.test(t.contain||"")}function _O(e){let t=Hl(e);for(;Ui(t)&&!u0(t);){if(Yv(t))return t;if(Jh(t))return null;t=Hl(t)}return null}function qv(){return W2==null&&(W2=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),W2}function u0(e){return/^(html|body|#document)$/.test(Vu(e))}function so(e){return gs(e).getComputedStyle(e)}function ep(e){return ro(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hl(e){if(Vu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ix(e)&&e.host||Yo(e);return ix(t)?t.host:t}function aE(e){const t=Hl(e);return u0(t)?(e.ownerDocument||e).body:Ui(t)&&Qh(t)?t:aE(t)}function d0(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=aE(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),c=gs(a);if(i){const d=p8(c);return t.concat(c,c.visualViewport||[],Qh(a)?a:[],d&&n?d0(d):[])}else return t.concat(a,d0(a,[],n))}function p8(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oE(e){const t=so(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Ui(e),i=a?e.offsetWidth:n,c=a?e.offsetHeight:r,d=nh(n)!==i||nh(r)!==c;return d&&(n=i,r=c),{width:n,height:r,$:d}}function Xv(e){return ro(e)?e:e.contextElement}function fu(e){const t=Xv(e);if(!Ui(t))return To(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=oE(t);let c=(i?nh(n.width):n.width)/r,d=(i?nh(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const VO=To(0);function iE(e){const t=gs(e);return!qv()||!t.visualViewport?VO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ZO(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===gs(e)}function Il(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=Xv(e);let c=To(1);t&&(r?ro(r)&&(c=fu(r)):c=fu(e));const d=ZO(i,n,r)?iE(i):To(0);let f=(a.left+d.x)/c.x,h=(a.top+d.y)/c.y,p=a.width/c.x,g=a.height/c.y;if(i&&r){const v=gs(i),y=ro(r)?gs(r):r;let b=v,x=p8(b);for(;x&&y!==b;){const k=fu(x),S=x.getBoundingClientRect(),E=so(x),C=S.left+(x.clientLeft+parseFloat(E.paddingLeft))*k.x,N=S.top+(x.clientTop+parseFloat(E.paddingTop))*k.y;f*=k.x,h*=k.y,p*=k.x,g*=k.y,f+=C,h+=N,b=gs(x),x=p8(b)}}return sh({width:p,height:g,x:f,y:h})}function tp(e,t){const n=ep(e).scrollLeft;return t?t.left+n:Il(Yo(e)).left+n}function lE(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-tp(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function zO(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",c=Yo(r),d=t?Jh(t.floating):!1;if(r===c||d&&i)return n;let f={scrollLeft:0,scrollTop:0},h=To(1);const p=To(0),g=Ui(r);if((g||!i)&&((Vu(r)!=="body"||Qh(c))&&(f=ep(r)),g)){const y=Il(r);h=fu(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const v=c&&!g&&!i?lE(c,f):To(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+p.x+v.x,y:n.y*h.y-f.scrollTop*h.y+p.y+v.y}}function BO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function UO(e){const t=ep(e),n=e.ownerDocument.body,r=Lo(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=Lo(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+tp(e);const c=-t.scrollTop;return so(n).direction==="rtl"&&(i+=Lo(e.clientWidth,n.clientWidth)-r),{width:r,height:a,x:i,y:c}}const WO=25;function GO(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",a=gs(e),i=Yo(e),c=a.visualViewport;let d=i.clientWidth,f=i.clientHeight,h=0,p=0;if(c){const v=!qv()||t==="fixed";r?v||(h=-c.offsetLeft,p=-c.offsetTop):(d=c.width,f=c.height,v&&(h=c.offsetLeft,p=c.offsetTop))}if(tp(i)<=0){const v=i.ownerDocument,y=v.body,b=getComputedStyle(y),x=v.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,k=Math.abs(i.clientWidth-y.clientWidth-x),S=getComputedStyle(i).scrollbarGutter==="stable both-edges"?k/2:k;S<=WO&&(d-=S)}return{width:d,height:f,x:h,y:p}}function KO(e,t){const n=Il(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=fu(e),c=e.clientWidth*i.x,d=e.clientHeight*i.y,f=a*i.x,h=r*i.y;return{width:c,height:d,x:f,y:h}}function lx(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=GO(e,n,t);else if(t==="document")r=UO(Yo(e));else if(ro(t))r=KO(t,n);else{const a=iE(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return sh(r)}function YO(e,t){const n=t.get(e);if(n)return n;let r=d0(e,[],!1).filter(d=>ro(d)&&Vu(d)!=="body"),a=null;const i=so(e).position==="fixed";let c=i?Hl(e):e;for(;ro(c)&&!u0(c);){const d=so(c),f=Yv(c),h=a?a.position:i?"fixed":"";!f&&(h==="fixed"||h==="absolute"&&d.position==="static")?r=r.filter(g=>g!==c):a=d,c=Hl(c)}return t.set(e,r),r}function qO(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const c=[...n==="clippingAncestors"?Jh(t)?[]:YO(t,this._c):[].concat(n),r],d=lx(t,c[0],a);let f=d.top,h=d.right,p=d.bottom,g=d.left;for(let v=1;v<c.length;v++){const y=lx(t,c[v],a);f=Lo(y.top,f),h=Ii(y.right,h),p=Ii(y.bottom,p),g=Lo(y.left,g)}return{width:h-g,height:p-f,x:g,y:f}}function XO(e){const{width:t,height:n}=oE(e);return{width:t,height:n}}function QO(e,t,n){const r=Ui(t),a=Yo(t),i=n==="fixed",c=Il(e,!0,i,t);let d={scrollLeft:0,scrollTop:0};const f=To(0);if((r||!i)&&((Vu(t)!=="body"||Qh(a))&&(d=ep(t)),r)){const v=Il(t,!0,i,t);f.x=v.x+t.clientLeft,f.y=v.y+t.clientTop}!r&&a&&(f.x=tp(a));const h=a&&!r&&!i?lE(a,d):To(0),p=c.left+d.scrollLeft-f.x-h.x,g=c.top+d.scrollTop-f.y-h.y;return{x:p,y:g,width:c.width,height:c.height}}function G2(e){return so(e).position==="static"}function cx(e,t){if(!Ui(e)||so(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Yo(e)===n&&(n=n.ownerDocument.body),n}function cE(e,t){const n=gs(e);if(Jh(e))return n;if(!Ui(e)){let a=Hl(e);for(;a&&!u0(a);){if(ro(a)&&!G2(a))return a;a=Hl(a)}return n}let r=cx(e,t);for(;r&&HO(r)&&G2(r);)r=cx(r,t);return r&&u0(r)&&G2(r)&&!Yv(r)?n:r||_O(e)||n}const JO=async function(e){const t=this.getOffsetParent||cE,n=this.getDimensions,r=await n(e.floating);return{reference:QO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eH(e){return so(e).direction==="rtl"}const tH={convertOffsetParentRelativeRectToViewportRelativeRect:zO,getDocumentElement:Yo,getClippingRect:qO,getOffsetParent:cE,getElementRects:JO,getClientRects:BO,getDimensions:XO,getScale:fu,isElement:ro,isRTL:eH};function uE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nH(e,t,n){let r=null,a;const i=Yo(e);function c(){var p;clearTimeout(a),(p=r)==null||p.disconnect(),r=null}function d(p,g){p===void 0&&(p=!1),g===void 0&&(g=1),c();const v=e.getBoundingClientRect(),{left:y,top:b,width:x,height:k}=v;if(p||t(),!x||!k)return;const S=w1(b),E=w1(i.clientWidth-(y+x)),C=w1(i.clientHeight-(b+k)),N=w1(y),T={rootMargin:-S+"px "+-E+"px "+-C+"px "+-N+"px",threshold:Lo(0,Ii(1,g))||1};let L=!0;function A(P){const $=P[0].intersectionRatio;if(!uE(v,e.getBoundingClientRect()))return d();if($!==g){if(!L)return d();$?d(!1,$):a=setTimeout(()=>{d(!1,1e-7)},1e3)}L=!1}try{r=new IntersectionObserver(A,{...T,root:i.ownerDocument})}catch{r=new IntersectionObserver(A,T)}r.observe(e)}const f=gs(e),h=()=>d(n);return f.addEventListener("resize",h),d(!0),()=>{f.removeEventListener("resize",h),c()}}function dE(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,h=Xv(e),p=a||i?[...h?d0(h):[],...t?d0(t):[]]:[];p.forEach(S=>{a&&S.addEventListener("scroll",n),i&&S.addEventListener("resize",n)});const g=h&&d?nH(h,n,i):null;let v=-1,y=null;c&&(y=new ResizeObserver(S=>{let[E]=S;E&&E.target===h&&y&&t&&(y.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(t)})),n()}),h&&!f&&y.observe(h),t&&y.observe(t));let b,x=f?Il(e):null;f&&k();function k(){const S=Il(e);x&&!uE(x,S)&&n(),x=S,b=requestAnimationFrame(k)}return n(),()=>{var S;p.forEach(E=>{a&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),g==null||g(),(S=y)==null||S.disconnect(),y=null,f&&cancelAnimationFrame(b)}}const fE=TO,hE=$O,pE=RO,rH=OO,sH=PO,m8=MO,aH=DO,mE=(e,t,n)=>{const r=new Map,a=n??{},i={...tH,...a.platform,_c:r};return NO(e,t,{...a,platform:i})};var oH=typeof document<"u",iH=function(){},U1=oH?s.useLayoutEffect:iH;function ah(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(!ah(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)&&!ah(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function gE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ux(e,t){const n=gE(e);return Math.round(t*n)/n}function K2(e){const t=s.useRef(e);return U1(()=>{t.current=e}),t}function lH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:c}={},transform:d=!0,whileElementsMounted:f,open:h}=e,[p,g]=s.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,y]=s.useState(r);ah(v,r)||y(r);const[b,x]=s.useState(null),[k,S]=s.useState(null),E=s.useCallback(F=>{F!==T.current&&(T.current=F,x(F))},[]),C=s.useCallback(F=>{F!==L.current&&(L.current=F,S(F))},[]),N=i||b,M=c||k,T=s.useRef(null),L=s.useRef(null),A=s.useRef(p),P=f!=null,$=K2(f),H=K2(a),O=K2(h),Q=s.useCallback(()=>{if(!T.current||!L.current)return;const F={placement:t,strategy:n,middleware:v};H.current&&(F.platform=H.current),mE(T.current,L.current,F).then(te=>{const X={...te,isPositioned:O.current!==!1};I.current&&!ah(A.current,X)&&(A.current=X,Mr.flushSync(()=>{g(X)}))})},[v,t,n,H,O]);U1(()=>{h===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,g(F=>({...F,isPositioned:!1})))},[h]);const I=s.useRef(!1);U1(()=>(I.current=!0,()=>{I.current=!1}),[]),U1(()=>{if(N&&(T.current=N),M&&(L.current=M),N&&M){if($.current)return $.current(N,M,Q);Q()}},[N,M,Q,$,P]);const V=s.useMemo(()=>({reference:T,floating:L,setReference:E,setFloating:C}),[E,C]),ie=s.useMemo(()=>({reference:N,floating:M}),[N,M]),B=s.useMemo(()=>{const F={position:n,left:0,top:0};if(!ie.floating)return F;const te=ux(ie.floating,p.x),X=ux(ie.floating,p.y);return d?{...F,transform:"translate("+te+"px, "+X+"px)",...gE(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:X}},[n,d,ie.floating,p.x,p.y]);return s.useMemo(()=>({...p,update:Q,refs:V,elements:ie,floatingStyles:B}),[p,Q,V,ie,B])}const cH=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?m8({element:r.current,padding:a}).fn(n):{}:r?m8({element:r,padding:a}).fn(n):{}}}},uH=(e,t)=>{const n=fE(e);return{name:n.name,fn:n.fn,options:[e,t]}},dH=(e,t)=>{const n=hE(e);return{name:n.name,fn:n.fn,options:[e,t]}},fH=(e,t)=>({fn:aH(e).fn,options:[e,t]}),hH=(e,t)=>{const n=pE(e);return{name:n.name,fn:n.fn,options:[e,t]}},pH=(e,t)=>{const n=rH(e);return{name:n.name,fn:n.fn,options:[e,t]}},mH=(e,t)=>{const n=sH(e);return{name:n.name,fn:n.fn,options:[e,t]}},gH=(e,t)=>{const n=cH(e);return{name:n.name,fn:n.fn,options:[e,t]}};var vH=Object.defineProperty,yH=(e,t)=>vH(e,"name",{value:t,configurable:!0}),wH=s.forwardRef(yH(function(t,n){const{children:r,width:a=10,height:i=5,...c}=t;return o.jsx(en.svg,{...c,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")),bH=wH,xH=Object.defineProperty,$o=(e,t)=>xH(e,"name",{value:t,configurable:!0}),vE="Popper",[yE,Wi]=bs(vE),[kH,wE]=yE(vE),SH=$o(e=>{const{__scopePopper:t,children:n}=e,[r,a]=s.useState(null),[i,c]=s.useState(void 0);return o.jsx(kH,{scope:t,anchor:r,onAnchorChange:a,placementState:i,setPlacementState:c,children:n})},"Popper"),EH="PopperAnchor",CH=s.forwardRef($o(function(t,n){const{__scopePopper:r,virtualRef:a,...i}=t,c=wE(EH,r),d=s.useRef(null),f=c.onAnchorChange,h=s.useCallback(x=>{d.current=x,x&&f(x)},[f]),p=Xt(n,h),g=s.useRef(null);s.useEffect(()=>{if(!a)return;const x=g.current;g.current=a.current,x!==g.current&&f(g.current)});const v=c.placementState&&np(c.placementState),y=v==null?void 0:v[0],b=v==null?void 0:v[1];return a?null:o.jsx(en.div,{"data-radix-popper-side":y,"data-radix-popper-align":b,...i,ref:p})},"PopperAnchor")),bE="PopperContent",[jH,AH]=yE(bE),NH=s.forwardRef($o(function(t,n){var ye,ee,ge,re,D,G,Pe;const{__scopePopper:r,side:a="bottom",sideOffset:i=0,align:c="center",alignOffset:d=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:g=0,sticky:v="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:x,...k}=t,S=wE(bE,r),[E,C]=s.useState(null),N=Xt(n,C),[M,T]=s.useState(null),L=eE(M),A=(L==null?void 0:L.width)??0,P=(L==null?void 0:L.height)??0,$=a+(c!=="center"?"-"+c:""),H=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},O=Array.isArray(p)?p:[p],Q=O.length>0,I={padding:H,boundary:O.filter(xE),altBoundary:Q},{refs:V,floatingStyles:ie,placement:B,isPositioned:F,middlewareData:te}=lH({strategy:"fixed",placement:$,whileElementsMounted:$o((...Ze)=>dE(...Ze,{animationFrame:b==="always"}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[uH({mainAxis:i+P,alignmentAxis:d}),h&&dH({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?fH():void 0,...I}),h&&hH({...I}),pH({...I,apply:$o(({elements:Ze,rects:He,availableWidth:tt,availableHeight:oe})=>{const{width:he,height:Ae}=He.reference,ue=Ze.floating.style;ue.setProperty("--radix-popper-available-width",`${tt}px`),ue.setProperty("--radix-popper-available-height",`${oe}px`),ue.setProperty("--radix-popper-anchor-width",`${he}px`),ue.setProperty("--radix-popper-anchor-height",`${Ae}px`)},"apply")}),M&&gH({element:M,padding:f}),LH({arrowWidth:A,arrowHeight:P}),y&&mH({strategy:"referenceHidden",...I,boundary:Q?I.boundary:void 0})]}),X=S.setPlacementState;pr(()=>(X(B),()=>{X(void 0)}),[B,X]);const[Z,K]=np(B),z=fr(x);pr(()=>{F&&(z==null||z())},[F,z]);const Y=(ye=te.arrow)==null?void 0:ye.x,J=(ee=te.arrow)==null?void 0:ee.y,de=((ge=te.arrow)==null?void 0:ge.centerOffset)!==0,[ae,W]=s.useState();return pr(()=>{E&&W(window.getComputedStyle(E).zIndex)},[E]),o.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...ie,transform:F?ie.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(re=te.transformOrigin)==null?void 0:re.x,(D=te.transformOrigin)==null?void 0:D.y].join(" "),...((G=te.hide)==null?void 0:G.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(jH,{scope:r,placedSide:Z,placedAlign:K,onArrowChange:T,arrowX:Y,arrowY:J,shouldHideArrow:de,children:o.jsx(en.div,{"data-side":Z,"data-align":K,...k,ref:N,style:{...k.style,animation:F?(Pe=k.style)==null?void 0:Pe.animation:"none"}})})})},"PopperContent")),MH="PopperArrow",RH={top:"bottom",right:"left",bottom:"top",left:"right"},PH=s.forwardRef($o(function(t,n){const{__scopePopper:r,...a}=t,i=AH(MH,r),c=RH[i.placedSide];return o.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[c]: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(bH,{...a,ref:n,style:{...a.style,display:"block"}})})},"PopperArrow"));function xE(e){return e!==null}$o(xE,"isNotNull");var LH=$o(e=>({name:"transformOrigin",options:e,fn(t){var k,S,E;const{placement:n,rects:r,middlewareData:a}=t,c=((k=a.arrow)==null?void 0:k.centerOffset)!==0,d=c?0:e.arrowWidth,f=c?0:e.arrowHeight,[h,p]=np(n),g={start:"0%",center:"50%",end:"100%"}[p],v=(((S=a.arrow)==null?void 0:S.x)??0)+d/2,y=(((E=a.arrow)==null?void 0:E.y)??0)+f/2;let b="",x="";return h==="bottom"?(b=c?g:`${v}px`,x=`${-f}px`):h==="top"?(b=c?g:`${v}px`,x=`${r.floating.height+f}px`):h==="right"?(b=`${-f}px`,x=c?g:`${y}px`):h==="left"&&(b=`${r.floating.width+f}px`,x=c?g:`${y}px`),{data:{x:b,y:x}}}}),"transformOrigin");function np(e){const[t,n="center"]=e.split("-");return[t,n]}$o(np,"getSideAndAlignFromPlacement");var rp=SH,H0=CH,sp=NH,TH=PH,$H=Object.defineProperty,Qv=(e,t)=>$H(e,"name",{value:t,configurable:!0}),Y2=!1;function kE(){const[e,t]=s.useState(Y2);return s.useEffect(()=>{Y2||(Y2=!0,t(!0))},[]),e}Qv(kE,"useIsHydrated");var SE=Yl[" useSyncExternalStore ".trim().toString()];function EE(){return()=>{}}Qv(EE,"subscribe");function CE(){return SE(EE,()=>!0,()=>!1)}Qv(CE,"useIsHydratedModern");var DH=typeof SE=="function"?CE:kE,OH=Object.defineProperty,ac=(e,t)=>OH(e,"name",{value:t,configurable:!0}),q2="rovingFocusGroup.onEntryFocus",HH={bubbles:!1,cancelable:!0},ap="RovingFocusGroup",[g8,jE,IH]=Wh(ap),[FH,AE]=bs(ap,[IH]),[_H,VH]=FH(ap),ZH=s.forwardRef(ac(function(t,n){return o.jsx(g8.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(g8.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(zH,{...t,ref:n})})})},"RovingFocusGroup")),zH=s.forwardRef(ac(function(t,n){const{__scopeRovingFocusGroup:r,orientation:a,loop:i=!1,dir:c,currentTabStopId:d,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:g=!1,...v}=t,y=s.useRef(null),b=Xt(n,y),x=T0(c),[k,S]=Vo({prop:d,defaultProp:f??null,onChange:h,caller:ap}),[E,C]=s.useState(!1),N=fr(p),M=jE(r),T=s.useRef(!1),[L,A]=s.useState(0);return s.useEffect(()=>{const P=y.current;if(P)return P.addEventListener(q2,N),()=>P.removeEventListener(q2,N)},[N]),o.jsx(_H,{scope:r,orientation:a,dir:x,loop:i,currentTabStopId:k,onItemFocus:s.useCallback(P=>S(P),[S]),onItemShiftTab:s.useCallback(()=>C(!0),[]),onFocusableItemAdd:s.useCallback(()=>A(P=>P+1),[]),onFocusableItemRemove:s.useCallback(()=>A(P=>P-1),[]),children:o.jsx(en.div,{tabIndex:E||L===0?-1:0,"data-orientation":a,...v,ref:b,style:{outline:"none",...t.style},onMouseDown:vt(t.onMouseDown,()=>{T.current=!0}),onFocus:vt(t.onFocus,P=>{const $=!T.current;if(P.target===P.currentTarget&&$&&!E){const H=new CustomEvent(q2,HH);if(P.currentTarget.dispatchEvent(H),!H.defaultPrevented){const O=M().filter(B=>B.focusable),Q=O.find(B=>B.active),I=O.find(B=>B.id===k),ie=[Q,I,...O].filter(Boolean).map(B=>B.ref.current);Jv(ie,g)}}T.current=!1}),onBlur:vt(t.onBlur,()=>C(!1))})})},"RovingFocusGroupImpl")),BH="RovingFocusGroupItem",UH=s.forwardRef(ac(function(t,n){const{__scopeRovingFocusGroup:r,focusable:a=!0,active:i=!1,tabStopId:c,children:d,...f}=t,h=ia(),p=c||h,g=VH(BH,r),v=g.currentTabStopId===p,y=jE(r),{onFocusableItemAdd:b,onFocusableItemRemove:x,currentTabStopId:k}=g,S=DH();return pr(()=>{if(!(!S||!a))return b(),()=>x()},[S,a,b,x]),s.useEffect(()=>{if(!(S||!a))return b(),()=>x()},[S,a,b,x]),o.jsx(g8.ItemSlot,{scope:r,id:p,focusable:a,active:i,children:o.jsx(en.span,{tabIndex:v?0:-1,"data-orientation":g.orientation,...f,ref:n,onMouseDown:vt(t.onMouseDown,E=>{a?g.onItemFocus(p):E.preventDefault()}),onFocus:vt(t.onFocus,()=>g.onItemFocus(p)),onKeyDown:vt(t.onKeyDown,E=>{if(E.key==="Tab"&&E.shiftKey){g.onItemShiftTab();return}if(E.target!==E.currentTarget)return;const C=ME(E,g.orientation,g.dir);if(C!==void 0){if(E.metaKey||E.ctrlKey||E.altKey||E.shiftKey)return;E.preventDefault();let M=y().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")M.reverse();else if(C==="prev"||C==="next"){C==="prev"&&M.reverse();const T=M.indexOf(E.currentTarget);M=g.loop?RE(M,T+1):M.slice(T+1)}setTimeout(()=>Jv(M))}}),children:typeof d=="function"?d({isCurrentTabStop:v,hasTabStop:k!=null}):d})})},"RovingFocusGroupItem")),WH={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function NE(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}ac(NE,"getDirectionAwareKey");function ME(e,t,n){const r=NE(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return WH[r]}ac(ME,"getFocusIntent");function Jv(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}ac(Jv,"focusFirst");function RE(e,t){return e.map((n,r)=>e[(t+r)%e.length])}ac(RE,"wrapArray");var GH=ZH,KH=UH,YH=Object.defineProperty,bn=(e,t)=>YH(e,"name",{value:t,configurable:!0}),v8=["Enter"," "],qH=["ArrowDown","PageUp","Home"],PE=["ArrowUp","PageDown","End"],XH=[...qH,...PE],QH={ltr:[...v8,"ArrowRight"],rtl:[...v8,"ArrowLeft"]},JH={ltr:["ArrowLeft"],rtl:["ArrowRight"]},op="Menu",[f0,eI,tI]=Wh(op),[oc,ip]=bs(op,[tI,Wi,AE]),e6=Wi(),LE=AE(),[nI,ic]=oc(op),[rI,I0]=oc(op),sI=bn(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:i,modal:c=!0}=e,d=e6(t),[f,h]=s.useState(null),p=s.useRef(!1),g=fr(i),v=T0(a);return s.useEffect(()=>{const y=bn(()=>{p.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},"handleKeyDown"),b=bn(()=>p.current=!1,"handlePointer");return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),s.useEffect(()=>{if(!n)return;const y=bn(()=>g(!1),"handleBlur");return window.addEventListener("blur",y),()=>window.removeEventListener("blur",y)},[n,g]),o.jsx(rp,{...d,children:o.jsx(nI,{scope:t,open:n,onOpenChange:g,content:f,onContentChange:h,children:o.jsx(rI,{scope:t,onClose:s.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:p,dir:v,modal:c,children:r})})})},"Menu"),TE=s.forwardRef(bn(function(t,n){const{__scopeMenu:r,...a}=t,i=e6(r);return o.jsx(H0,{...i,...a,ref:n})},"MenuAnchor")),$E="MenuPortal",[aI,DE]=oc($E,{forceMount:void 0}),oI=bn(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,i=ic($E,t);return o.jsx(aI,{scope:t,forceMount:n,children:o.jsx(Kr,{present:n||i.open,children:o.jsx(D0,{asChild:!0,container:a,children:r})})})},"MenuPortal"),Ca="MenuContent",[iI,t6]=oc(Ca),lI=s.forwardRef(bn(function(t,n){const r=DE(Ca,t.__scopeMenu),{forceMount:a=r.forceMount,...i}=t,c=ic(Ca,t.__scopeMenu),d=I0(Ca,t.__scopeMenu);return o.jsx(f0.Provider,{scope:t.__scopeMenu,children:o.jsx(Kr,{present:a||c.open,children:o.jsx(f0.Slot,{scope:t.__scopeMenu,children:d.modal?o.jsx(cI,{...i,ref:n}):o.jsx(uI,{...i,ref:n})})})})},"MenuContent")),cI=s.forwardRef(bn(function(t,n){const r=ic(Ca,t.__scopeMenu),a=s.useRef(null),i=Xt(n,a);return s.useEffect(()=>{const c=a.current;if(c)return Kh(c)},[]),o.jsx(n6,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:vt(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),uI=s.forwardRef(bn(function(t,n){const r=ic(Ca,t.__scopeMenu);return o.jsx(n6,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),dI=Aa("MenuContent.ScrollLock"),n6=s.forwardRef(bn(function(t,n){const{__scopeMenu:r,loop:a=!1,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:g,onFocusOutside:v,onInteractOutside:y,onDismiss:b,disableOutsideScroll:x,...k}=t,S=ic(Ca,r),E=I0(Ca,r),C=e6(r),N=LE(r),M=eI(r),[T,L]=s.useState(null),A=s.useRef(null),P=Xt(n,A,S.onContentChange),$=s.useRef(0),H=s.useRef(""),O=s.useRef(0),Q=s.useRef(null),I=s.useRef("right"),V=s.useRef(0),ie=x?O0:s.Fragment,B=x?{as:dI,allowPinchZoom:!0}:void 0,F=bn(X=>{var W,ye;const Z=H.current+X,K=M().filter(ee=>!ee.disabled),z=document.activeElement,Y=(W=K.find(ee=>ee.ref.current===z))==null?void 0:W.textValue,J=K.map(ee=>ee.textValue),de=zE(J,Z,Y),ae=(ye=K.find(ee=>ee.textValue===de))==null?void 0:ye.ref.current;bn((function ee(ge){H.current=ge,window.clearTimeout($.current),ge!==""&&($.current=window.setTimeout(()=>ee(""),1e3))}),"updateSearch")(Z),ae&&setTimeout(()=>ae.focus())},"handleTypeaheadSearch");s.useEffect(()=>()=>window.clearTimeout($.current),[]),Fu();const te=s.useCallback(X=>{var K,z;return I.current===((K=Q.current)==null?void 0:K.side)&&UE(X,(z=Q.current)==null?void 0:z.area)},[]);return o.jsx(iI,{scope:r,searchRef:H,onItemEnter:s.useCallback(X=>{te(X)&&X.preventDefault()},[te]),onItemLeave:s.useCallback(X=>{var Z;te(X)||((Z=A.current)==null||Z.focus(),L(null))},[te]),onTriggerLeave:s.useCallback(X=>{te(X)&&X.preventDefault()},[te]),pointerGraceTimerRef:O,onPointerGraceIntentChange:s.useCallback(X=>{Q.current=X},[]),children:o.jsx(ie,{...B,children:o.jsx(Iu,{asChild:!0,trapped:i,onMountAutoFocus:vt(c,X=>{var Z;X.preventDefault(),(Z=A.current)==null||Z.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:o.jsx($0,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:g,onFocusOutside:v,onInteractOutside:y,onDismiss:b,children:o.jsx(GH,{asChild:!0,...N,dir:E.dir,orientation:"vertical",loop:a,currentTabStopId:T,onCurrentTabStopIdChange:L,onEntryFocus:vt(h,X=>{E.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(sp,{role:"menu","aria-orientation":"vertical","data-state":s6(S.open),"data-radix-menu-content":"",dir:E.dir,...C,...k,ref:P,style:{outline:"none",...k.style},onKeyDown:vt(k.onKeyDown,X=>{const K=X.target.closest("[data-radix-menu-content]")===X.currentTarget,z=X.ctrlKey||X.altKey||X.metaKey,Y=X.key.length===1;K&&(X.key==="Tab"&&X.preventDefault(),!z&&Y&&F(X.key));const J=A.current;if(X.target!==J||!XH.includes(X.key))return;X.preventDefault();const ae=M().filter(W=>!W.disabled).map(W=>W.ref.current);PE.includes(X.key)&&ae.reverse(),VE(ae)}),onBlur:vt(t.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout($.current),H.current="")}),onPointerMove:vt(t.onPointerMove,ku(X=>{const Z=X.target,K=V.current!==X.clientX;if(X.currentTarget.contains(Z)&&K){const z=X.clientX>V.current?"right":"left";I.current=z,V.current=X.clientX}}))})})})})})})},"MenuContentImpl")),OE=s.forwardRef(bn(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(en.div,{role:"group",...a,ref:n})},"MenuGroup")),fI=s.forwardRef(bn(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(en.div,{...a,ref:n})},"MenuLabel")),y8="MenuItem",dx="menu.itemSelect",r6=s.forwardRef(bn(function(t,n){const{disabled:r=!1,onSelect:a,...i}=t,c=s.useRef(null),d=I0(y8,t.__scopeMenu),f=t6(y8,t.__scopeMenu),h=Xt(n,c),p=s.useRef(!1),g=bn(()=>{const v=c.current;if(!r&&v){const y=new CustomEvent(dx,{bubbles:!0,cancelable:!0});v.addEventListener(dx,b=>a==null?void 0:a(b),{once:!0}),Iv(v,y),y.defaultPrevented?p.current=!1:d.onClose()}},"handleSelect");return o.jsx(HE,{...i,ref:h,disabled:r,onClick:vt(t.onClick,g),onPointerDown:v=>{var y;(y=t.onPointerDown)==null||y.call(t,v),p.current=!0},onPointerUp:vt(t.onPointerUp,v=>{var y;p.current||(y=v.currentTarget)==null||y.click()}),onKeyDown:vt(t.onKeyDown,v=>{r||v.target!==v.currentTarget||f.searchRef.current!==""&&v.key===" "||v8.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})},"MenuItem")),HE=s.forwardRef(bn(function(t,n){const{__scopeMenu:r,disabled:a=!1,textValue:i,...c}=t,d=t6(y8,r),f=LE(r),h=s.useRef(null),p=Xt(n,h),[g,v]=s.useState(!1),[y,b]=s.useState("");return s.useEffect(()=>{const x=h.current;x&&b((x.textContent??"").trim())},[c.children]),o.jsx(f0.ItemSlot,{scope:r,disabled:a,textValue:i??y,children:o.jsx(KH,{asChild:!0,...f,focusable:!a,children:o.jsx(en.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...c,ref:p,onPointerMove:vt(t.onPointerMove,ku(x=>{a?d.onItemLeave(x):(d.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:vt(t.onPointerLeave,ku(x=>d.onItemLeave(x))),onFocus:vt(t.onFocus,()=>v(!0)),onBlur:vt(t.onBlur,()=>v(!1))})})})},"MenuItemImpl")),hI=s.forwardRef(bn(function(t,n){const{checked:r=!1,onCheckedChange:a,...i}=t;return o.jsx(FE,{scope:t.__scopeMenu,checked:r,children:o.jsx(r6,{role:"menuitemcheckbox","aria-checked":h0(r)?"mixed":r,...i,ref:n,"data-state":lp(r),onSelect:vt(i.onSelect,()=>a==null?void 0:a(h0(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),pI="MenuRadioGroup",[mI,gI]=oc(pI,{value:void 0,onValueChange:bn(()=>{},"onValueChange")}),vI=s.forwardRef(bn(function(t,n){const{value:r,onValueChange:a,...i}=t,c=fr(a);return o.jsx(mI,{scope:t.__scopeMenu,value:r,onValueChange:c,children:o.jsx(OE,{...i,ref:n})})},"MenuRadioGroup")),yI="MenuRadioItem",wI=s.forwardRef(bn(function(t,n){const{value:r,...a}=t,i=gI(yI,t.__scopeMenu),c=r===i.value;return o.jsx(FE,{scope:t.__scopeMenu,checked:c,children:o.jsx(r6,{role:"menuitemradio","aria-checked":c,...a,ref:n,"data-state":lp(c),onSelect:vt(a.onSelect,()=>{var d;return(d=i.onValueChange)==null?void 0:d.call(i,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),IE="MenuItemIndicator",[FE,bI]=oc(IE,{checked:!1}),xI=s.forwardRef(bn(function(t,n){const{__scopeMenu:r,forceMount:a,...i}=t,c=bI(IE,r);return o.jsx(Kr,{present:a||h0(c.checked)||c.checked===!0,children:o.jsx(en.span,{...i,ref:n,"data-state":lp(c.checked)})})},"MenuItemIndicator")),kI=s.forwardRef(bn(function(t,n){const{__scopeMenu:r,...a}=t;return o.jsx(en.div,{role:"separator","aria-orientation":"horizontal",...a,ref:n})},"MenuSeparator")),SI="MenuSub",[qoe,_E]=oc(SI),b1="MenuSubTrigger",EI=s.forwardRef(bn(function(t,n){const r=ic(b1,t.__scopeMenu),a=I0(b1,t.__scopeMenu),i=_E(b1,t.__scopeMenu),c=t6(b1,t.__scopeMenu),d=s.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=c,p={__scopeMenu:t.__scopeMenu},g=s.useCallback(()=>{d.current&&window.clearTimeout(d.current),d.current=null},[]);s.useEffect(()=>g,[g]),s.useEffect(()=>{const y=f.current;return()=>{window.clearTimeout(y),h(null)}},[f,h]);const v=Xt(n,i.onTriggerChange);return o.jsx(TE,{asChild:!0,...p,children:o.jsx(HE,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?i.contentId:void 0,"data-state":s6(r.open),...t,ref:v,onClick:y=>{var b;(b=t.onClick)==null||b.call(t,y),!(t.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:vt(t.onPointerMove,ku(y=>{c.onItemEnter(y),!y.defaultPrevented&&!t.disabled&&!r.open&&!d.current&&(c.onPointerGraceIntentChange(null),d.current=window.setTimeout(()=>{r.onOpenChange(!0),g()},100))})),onPointerLeave:vt(t.onPointerLeave,ku(y=>{var x,k;g();const b=(x=r.content)==null?void 0:x.getBoundingClientRect();if(b){const S=(k=r.content)==null?void 0:k.dataset.side,E=S==="right",C=E?-5:5,N=b[E?"left":"right"],M=b[E?"right":"left"];c.onPointerGraceIntentChange({area:[{x:y.clientX+C,y:y.clientY},{x:N,y:b.top},{x:M,y:b.top},{x:M,y:b.bottom},{x:N,y:b.bottom}],side:S}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(y),y.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:vt(t.onKeyDown,y=>{var x;t.disabled||y.target!==y.currentTarget||c.searchRef.current!==""&&y.key===" "||QH[a.dir].includes(y.key)&&(r.onOpenChange(!0),(x=r.content)==null||x.focus(),y.preventDefault())})})})},"MenuSubTrigger")),CI="MenuSubContent",jI=s.forwardRef(bn(function(t,n){const r=DE(Ca,t.__scopeMenu),{forceMount:a=r.forceMount,align:i="start",...c}=t,d=ic(Ca,t.__scopeMenu),f=I0(Ca,t.__scopeMenu),h=_E(CI,t.__scopeMenu),p=s.useRef(null),g=Xt(n,p);return o.jsx(f0.Provider,{scope:t.__scopeMenu,children:o.jsx(Kr,{present:a||d.open,children:o.jsx(f0.Slot,{scope:t.__scopeMenu,children:o.jsx(n6,{id:h.contentId,"aria-labelledby":h.triggerId,...c,ref:g,align:i,side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{var y;f.isUsingKeyboardRef.current&&((y=p.current)==null||y.focus()),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:vt(t.onFocusOutside,v=>{v.target!==h.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:vt(t.onEscapeKeyDown,v=>{f.onClose(),v.preventDefault()}),onKeyDown:vt(t.onKeyDown,v=>{var x;const y=v.currentTarget.contains(v.target),b=JH[f.dir].includes(v.key);y&&b&&(d.onOpenChange(!1),(x=h.trigger)==null||x.focus(),v.preventDefault())})})})})})},"MenuSubContent"));function s6(e){return e?"open":"closed"}bn(s6,"getOpenState");function h0(e){return e==="indeterminate"}bn(h0,"isIndeterminate");function lp(e){return h0(e)?"indeterminate":e?"checked":"unchecked"}bn(lp,"getCheckedState");function VE(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}bn(VE,"focusFirst");function ZE(e,t){return e.map((n,r)=>e[(t+r)%e.length])}bn(ZE,"wrapArray");function zE(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 c=ZE(e,Math.max(i,0));a.length===1&&(c=c.filter(h=>h!==n));const f=c.find(h=>h.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}bn(zE,"getNextMatch");function BE(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,c=t.length-1;i<t.length;c=i++){const d=t[i],f=t[c],h=d.x,p=d.y,g=f.x,v=f.y;p>r!=v>r&&n<(g-h)*(r-p)/(v-p)+h&&(a=!a)}return a}bn(BE,"isPointInPolygon");function UE(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return BE(n,t)}bn(UE,"isPointerInGraceArea");function ku(e){return t=>t.pointerType==="mouse"?e(t):void 0}bn(ku,"whenMouse");var WE=sI,GE=TE,KE=oI,YE=lI,qE=OE,XE=fI,QE=r6,JE=hI,e9=vI,t9=wI,n9=xI,r9=kI,s9=EI,a9=jI,AI=Object.defineProperty,$r=(e,t)=>AI(e,"name",{value:t,configurable:!0}),a6="ContextMenu",[NI,Xoe]=bs(a6,[ip]),xs=ip(),[MI,o9]=NI(a6),RI=$r(e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,open:a,dir:i,modal:c=!0}=e,d=s.useRef(!1),[f,h]=Vo({prop:a,defaultProp:!1,onChange:r,caller:a6}),p=xs(t);return o.jsx(MI,{scope:t,open:f,onOpenChange:h,modal:c,hasInteractedRef:d,children:o.jsx(WE,{...p,dir:i,open:f,onOpenChange:h,modal:c,children:n})})},"ContextMenu"),PI="ContextMenuTrigger",LI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,disabled:a=!1,...i}=t,c=o9(PI,r),d=xs(r),[f,h]=s.useState({x:0,y:0}),p=s.useMemo(()=>({current:{getBoundingClientRect:$r(()=>DOMRect.fromRect({width:0,height:0,...f}),"getBoundingClientRect")}}),[f]),g=s.useRef(0),v=s.useCallback(()=>window.clearTimeout(g.current),[]),y=$r(b=>{c.hasInteractedRef.current=!0,h({x:b.clientX,y:b.clientY}),c.onOpenChange(!0)},"handleOpen");return s.useEffect(()=>v,[v]),s.useEffect(()=>void(a&&v()),[a,v]),o.jsxs(o.Fragment,{children:[o.jsx(GE,{...d,virtualRef:p}),o.jsx(en.span,{"data-state":c.open?"open":"closed","data-disabled":a?"":void 0,...i,ref:n,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:a?t.onContextMenu:vt(t.onContextMenu,b=>{v(),y(b),b.preventDefault()}),onPointerDown:a?t.onPointerDown:vt(t.onPointerDown,Zd(b=>{v(),c.open&&c.onOpenChange(!1),g.current=window.setTimeout(()=>y(b),700)})),onPointerMove:a?t.onPointerMove:vt(t.onPointerMove,Zd(v)),onPointerCancel:a?t.onPointerCancel:vt(t.onPointerCancel,Zd(v)),onPointerUp:a?t.onPointerUp:vt(t.onPointerUp,Zd(v))})]})},"ContextMenuTrigger")),TI=$r(e=>{const{__scopeContextMenu:t,...n}=e,r=xs(t);return o.jsx(KE,{...r,...n})},"ContextMenuPortal"),$I="ContextMenuContent",DI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=o9($I,r),c=xs(r),d=s.useRef(!1);return o.jsx(YE,{...c,...a,ref:n,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:f=>{var h;(h=t.onCloseAutoFocus)==null||h.call(t,f),!f.defaultPrevented&&d.current&&f.preventDefault(),d.current=!1},onInteractOutside:f=>{var h;(h=t.onInteractOutside)==null||h.call(t,f),!f.defaultPrevented&&!i.modal&&(d.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")),OI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(qE,{...i,...a,ref:n})},"ContextMenuGroup")),HI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(XE,{...i,...a,ref:n})},"ContextMenuLabel")),II=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(QE,{...i,...a,ref:n})},"ContextMenuItem")),FI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(JE,{...i,...a,ref:n})},"ContextMenuCheckboxItem")),_I=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(e9,{...i,...a,ref:n})},"ContextMenuRadioGroup")),VI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(t9,{...i,...a,ref:n})},"ContextMenuRadioItem")),ZI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(n9,{...i,...a,ref:n})},"ContextMenuItemIndicator")),zI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(r9,{...i,...a,ref:n})},"ContextMenuSeparator")),BI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(s9,{...i,...a,ref:n})},"ContextMenuSubTrigger")),UI=s.forwardRef($r(function(t,n){const{__scopeContextMenu:r,...a}=t,i=xs(r);return o.jsx(a9,{...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 Zd(e){return t=>t.pointerType!=="mouse"?e(t):void 0}$r(Zd,"whenTouchOrPen");var WI=RI,GI=LI,i9=TI,KI=DI,YI=OI,qI=HI,XI=II,QI=FI,JI=_I,eF=VI,l9=ZI,tF=zI,nF=BI,rF=UI,sF=Object.defineProperty,ks=(e,t)=>sF(e,"name",{value:t,configurable:!0}),o6="DropdownMenu",[aF,Qoe]=bs(o6,[ip]),Ss=ip(),[oF,c9]=aF(o6),iF=ks(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:c,modal:d=!0}=e,f=Ss(t),h=s.useRef(null),[p,g]=Vo({prop:a,defaultProp:i??!1,onChange:c,caller:o6});return o.jsx(oF,{scope:t,triggerId:ia(),triggerRef:h,contentId:ia(),open:p,onOpenChange:g,onOpenToggle:s.useCallback(()=>g(v=>!v),[g]),modal:d,children:o.jsx(WE,{...f,open:p,onOpenChange:g,dir:r,modal:d,children:n})})},"DropdownMenu"),lF="DropdownMenuTrigger",cF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,disabled:a=!1,...i}=t,c=c9(lF,r),d=Ss(r),f=Xt(n,c.triggerRef);return o.jsx(GE,{asChild:!0,...d,children:o.jsx(en.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...i,ref:f,onPointerDown:vt(t.onPointerDown,h=>{!a&&h.button===0&&h.ctrlKey===!1&&(c.onOpenToggle(),c.open||h.preventDefault())}),onKeyDown:vt(t.onKeyDown,h=>{a||(["Enter"," "].includes(h.key)&&c.onOpenToggle(),h.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})},"DropdownMenuTrigger")),uF=ks(e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ss(t);return o.jsx(KE,{...r,...n})},"DropdownMenuPortal"),dF="DropdownMenuContent",fF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=c9(dF,r),c=Ss(r),d=s.useRef(!1);return o.jsx(YE,{id:i.contentId,"aria-labelledby":i.triggerId,...c,...a,ref:n,onCloseAutoFocus:vt(t.onCloseAutoFocus,f=>{var h;d.current||(h=i.triggerRef.current)==null||h.focus(),d.current=!1,f.preventDefault()}),onInteractOutside:vt(t.onInteractOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,g=h.button===2||p;(!i.modal||g)&&(d.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")),hF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(qE,{...i,...a,ref:n})},"DropdownMenuGroup")),pF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(XE,{...i,...a,ref:n})},"DropdownMenuLabel")),mF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(QE,{...i,...a,ref:n})},"DropdownMenuItem")),gF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(JE,{...i,...a,ref:n})},"DropdownMenuCheckboxItem")),vF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(e9,{...i,...a,ref:n})},"DropdownMenuRadioGroup")),yF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(t9,{...i,...a,ref:n})},"DropdownMenuRadioItem")),wF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(n9,{...i,...a,ref:n})},"DropdownMenuItemIndicator")),bF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(r9,{...i,...a,ref:n})},"DropdownMenuSeparator")),xF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(s9,{...i,...a,ref:n})},"DropdownMenuSubTrigger")),kF=s.forwardRef(ks(function(t,n){const{__scopeDropdownMenu:r,...a}=t,i=Ss(r);return o.jsx(a9,{...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")),SF=iF,EF=cF,u9=uF,CF=fF,jF=hF,AF=pF,NF=mF,MF=gF,RF=vF,PF=yF,d9=wF,LF=bF,TF=xF,$F=kF,DF=Object.defineProperty,OF=(e,t)=>DF(e,"name",{value:t,configurable:!0});function f9(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])}OF(f9,"usePrevious");var HF=Object.defineProperty,IF=(e,t)=>HF(e,"name",{value:t,configurable:!0});function oh(e,[t,n]){return Math.min(n,Math.max(t,e))}IF(oh,"clamp");var FF=Object.defineProperty,uo=(e,t)=>FF(e,"name",{value:t,configurable:!0}),i6="Popover",[h9,Joe]=bs(i6,[Wi]),cp=Wi(),[_F,Gi]=h9(i6),VF=uo(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:c=!1}=e,d=cp(t),f=s.useRef(null),[h,p]=s.useState(!1),[g,v]=Vo({prop:r,defaultProp:a??!1,onChange:i,caller:i6});return o.jsx(rp,{...d,children:o.jsx(_F,{scope:t,contentId:ia(),triggerRef:f,open:g,onOpenChange:v,onOpenToggle:s.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:h,onCustomAnchorAdd:s.useCallback(()=>p(!0),[]),onCustomAnchorRemove:s.useCallback(()=>p(!1),[]),modal:c,children:n})})},"Popover"),ZF="PopoverAnchor",zF=s.forwardRef(uo(function(t,n){const{__scopePopover:r,...a}=t,i=Gi(ZF,r),c=cp(r),{onCustomAnchorAdd:d,onCustomAnchorRemove:f}=i;return s.useEffect(()=>(d(),()=>f()),[d,f]),o.jsx(H0,{...c,...a,ref:n})},"PopoverAnchor")),BF="PopoverTrigger",UF=s.forwardRef(uo(function(t,n){const{__scopePopover:r,...a}=t,i=Gi(BF,r),c=cp(r),d=Xt(n,i.triggerRef),f=o.jsx(en.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":l6(i.open),...a,ref:d,onClick:vt(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?f:o.jsx(H0,{asChild:!0,...c,children:f})},"PopoverTrigger")),p9="PopoverPortal",[WF,GF]=h9(p9,{forceMount:void 0}),KF=uo(e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=Gi(p9,t);return o.jsx(WF,{scope:t,forceMount:n,children:o.jsx(Kr,{present:n||i.open,children:o.jsx(D0,{asChild:!0,container:a,children:r})})})},"PopoverPortal"),p0="PopoverContent",YF=s.forwardRef(uo(function(t,n){const r=GF(p0,t.__scopePopover),{forceMount:a=r.forceMount,...i}=t,c=Gi(p0,t.__scopePopover);return o.jsx(Kr,{present:a||c.open,children:c.modal?o.jsx(XF,{...i,ref:n}):o.jsx(QF,{...i,ref:n})})},"PopoverContent")),qF=Aa("PopoverContent.RemoveScroll"),XF=s.forwardRef(uo(function(t,n){const r=Gi(p0,t.__scopePopover),a=s.useRef(null),i=Xt(n,a),c=s.useRef(!1);return s.useEffect(()=>{const d=a.current;if(d)return Kh(d)},[]),o.jsx(O0,{as:qF,allowPinchZoom:!0,children:o.jsx(m9,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vt(t.onCloseAutoFocus,d=>{var f;d.preventDefault(),c.current||(f=r.triggerRef.current)==null||f.focus()}),onPointerDownOutside:vt(t.onPointerDownOutside,d=>{const f=d.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0,p=f.button===2||h;c.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:vt(t.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),QF=s.forwardRef(uo(function(t,n){const r=Gi(p0,t.__scopePopover),a=s.useRef(!1),i=s.useRef(!1);return o.jsx(m9,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var d,f;(d=t.onCloseAutoFocus)==null||d.call(t,c),c.defaultPrevented||(a.current||(f=r.triggerRef.current)==null||f.focus(),c.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:c=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const d=c.target;((p=r.triggerRef.current)==null?void 0:p.contains(d))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&i.current&&c.preventDefault()}})},"PopoverContentNonModal")),m9=s.forwardRef(uo(function(t,n){const{__scopePopover:r,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:g,...v}=t,y=Gi(p0,r),b=cp(r);return Fu(),o.jsx(Iu,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:c,children:o.jsx($0,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:g,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>y.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(sp,{"data-state":l6(y.open),role:"dialog",id:y.contentId,...b,...v,ref:n,style:{...v.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")),JF="PopoverClose",e_=s.forwardRef(uo(function(t,n){const{__scopePopover:r,...a}=t,i=Gi(JF,r);return o.jsx(en.button,{type:"button",...a,ref:n,onClick:vt(t.onClick,()=>i.onOpenChange(!1))})},"PopoverClose"));function l6(e){return e?"open":"closed"}uo(l6,"getState");var t_=VF,n_=zF,r_=UF,s_=KF,a_=YF,o_=e_,i_=Object.defineProperty,hn=(e,t)=>i_(e,"name",{value:t,configurable:!0});function g9(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}hn(g9,"useStateMachine");var v9="ScrollArea",[y9,eie]=bs(v9),[l_,ua]=y9(v9),c_=s.forwardRef(hn(function(t,n){const{__scopeScrollArea:r,type:a="hover",dir:i,scrollHideDelay:c=600,...d}=t,[f,h]=s.useState(null),[p,g]=s.useState(null),[v,y]=s.useState(null),[b,x]=s.useState(null),[k,S]=s.useState(null),[E,C]=s.useState(0),[N,M]=s.useState(0),[T,L]=s.useState(!1),[A,P]=s.useState(!1),$=Xt(n,h),H=T0(i);return o.jsx(l_,{scope:r,type:a,dir:H,scrollHideDelay:c,scrollArea:f,viewport:p,onViewportChange:g,content:v,onContentChange:y,scrollbarX:b,onScrollbarXChange:x,scrollbarXEnabled:T,onScrollbarXEnabledChange:L,scrollbarY:k,onScrollbarYChange:S,scrollbarYEnabled:A,onScrollbarYEnabledChange:P,onCornerWidthChange:C,onCornerHeightChange:M,children:o.jsx(en.div,{dir:H,...d,ref:$,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":N+"px",...t.style}})})},"ScrollArea")),u_="ScrollAreaViewport",d_=s.forwardRef(hn(function(t,n){const{__scopeScrollArea:r,children:a,nonce:i,...c}=t,d=ua(u_,r),f=s.useRef(null),h=Xt(n,f,d.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx(f_,{nonce:i}),o.jsx(en.div,{"data-radix-scroll-area-viewport":"",...c,ref:h,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})},"ScrollAreaViewport")),f_=s.memo(hn(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),qo="ScrollAreaScrollbar",h_=s.forwardRef(hn(function(t,n){const{forceMount:r,...a}=t,i=ua(qo,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=i,f=t.orientation==="horizontal";return s.useEffect(()=>(f?c(!0):d(!0),()=>{f?c(!1):d(!1)}),[f,c,d]),i.type==="hover"?o.jsx(p_,{...a,ref:n,forceMount:r}):i.type==="scroll"?o.jsx(m_,{...a,ref:n,forceMount:r}):i.type==="auto"?o.jsx(w9,{...a,ref:n,forceMount:r}):i.type==="always"?o.jsx(c6,{...a,ref:n,"data-state":"visible"}):null},"ScrollAreaScrollbar")),p_=s.forwardRef(hn(function(t,n){const{forceMount:r,...a}=t,i=ua(qo,t.__scopeScrollArea),[c,d]=s.useState(!1);return s.useEffect(()=>{const f=i.scrollArea;let h=0;if(f){const p=hn(()=>{window.clearTimeout(h),d(!0)},"handlePointerEnter"),g=hn(()=>{h=window.setTimeout(()=>d(!1),i.scrollHideDelay)},"handlePointerLeave");return f.addEventListener("pointerenter",p),f.addEventListener("pointerleave",g),()=>{window.clearTimeout(h),f.removeEventListener("pointerenter",p),f.removeEventListener("pointerleave",g)}}},[i.scrollArea,i.scrollHideDelay]),o.jsx(Kr,{present:r||c,children:o.jsx(w9,{"data-state":c?"visible":"hidden",...a,ref:n})})},"ScrollAreaScrollbarHover")),m_=s.forwardRef(hn(function(t,n){const{forceMount:r,...a}=t,i=ua(qo,t.__scopeScrollArea),c=t.orientation==="horizontal",d=_0(()=>h("SCROLL_END"),100),[f,h]=g9("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(f==="idle"){const p=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(p)}},[f,i.scrollHideDelay,h]),s.useEffect(()=>{const p=i.viewport,g=c?"scrollLeft":"scrollTop";if(p){let v=p[g];const y=hn(()=>{const b=p[g];v!==b&&(h("SCROLL"),d()),v=b},"handleScroll");return p.addEventListener("scroll",y),()=>p.removeEventListener("scroll",y)}},[i.viewport,c,h,d]),o.jsx(Kr,{present:r||f!=="hidden",children:o.jsx(c6,{"data-state":f==="hidden"?"hidden":"visible",...a,ref:n,onPointerEnter:vt(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:vt(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),w9=s.forwardRef(hn(function(t,n){const r=ua(qo,t.__scopeScrollArea),{forceMount:a,...i}=t,[c,d]=s.useState(!1),f=t.orientation==="horizontal",h=_0(()=>{if(r.viewport){const p=r.viewport.offsetWidth<r.viewport.scrollWidth,g=r.viewport.offsetHeight<r.viewport.scrollHeight;d(f?p:g)}},10);return Fl(r.viewport,h),Fl(r.content,h),o.jsx(Kr,{present:a||c,children:o.jsx(c6,{"data-state":c?"visible":"hidden",...i,ref:n})})},"ScrollAreaScrollbarAuto")),c6=s.forwardRef(hn(function(t,n){const{orientation:r="vertical",...a}=t,i=ua(qo,t.__scopeScrollArea),c=s.useRef(null),d=s.useRef(0),[f,h]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=u6(f.viewport,f.content),g={...a,sizes:f,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:hn(y=>c.current=y,"onThumbChange"),onThumbPointerUp:hn(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:hn(y=>d.current=y,"onThumbPointerDown")};function v(y,b){return S9(y,d.current,f,b)}return hn(v,"getScrollPosition"),r==="horizontal"?o.jsx(g_,{...g,ref:n,onThumbPositionChange:()=>{if(i.viewport&&c.current){const y=i.viewport.scrollLeft,b=b8(y,f,i.dir);c.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollLeft=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollLeft=v(y,i.dir))}}):r==="vertical"?o.jsx(v_,{...g,ref:n,onThumbPositionChange:()=>{if(i.viewport&&c.current){const y=i.viewport.scrollTop,b=b8(y,f);c.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollTop=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollTop=v(y))}}):null},"ScrollAreaScrollbarVisible")),g_=s.forwardRef(hn(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,c=ua(qo,t.__scopeScrollArea),[d,f]=s.useState(),h=s.useRef(null),p=Xt(n,h,c.onScrollbarXChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(x9,{"data-orientation":"horizontal",...i,ref:p,sizes:r,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":F0(r)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.x),onDragScroll:g=>t.onDragScroll(g.x),onWheelScroll:(g,v)=>{if(c.viewport){const y=c.viewport.scrollLeft+g.deltaX;t.onWheelScroll(y),f6(y,v)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&d&&a({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:m0(d.paddingLeft),paddingEnd:m0(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),v_=s.forwardRef(hn(function(t,n){const{sizes:r,onSizesChange:a,...i}=t,c=ua(qo,t.__scopeScrollArea),[d,f]=s.useState(),h=s.useRef(null),p=Xt(n,h,c.onScrollbarYChange);return s.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),o.jsx(x9,{"data-orientation":"vertical",...i,ref:p,sizes:r,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":F0(r)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.y),onDragScroll:g=>t.onDragScroll(g.y),onWheelScroll:(g,v)=>{if(c.viewport){const y=c.viewport.scrollTop+g.deltaY;t.onWheelScroll(y),f6(y,v)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&d&&a({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:m0(d.paddingTop),paddingEnd:m0(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[y_,b9]=y9(qo),x9=s.forwardRef(hn(function(t,n){const{__scopeScrollArea:r,sizes:a,hasThumb:i,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:f,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:g,onResize:v,...y}=t,b=ua(qo,r),[x,k]=s.useState(null),S=Xt(n,k),E=s.useRef(null),C=s.useRef(""),N=b.viewport,M=a.content-a.viewport,T=fr(g),L=fr(h),A=_0(v,10);function P($){if(E.current){const H=$.clientX-E.current.left,O=$.clientY-E.current.top;p({x:H,y:O})}}return hn(P,"handleDragScroll"),s.useEffect(()=>{const $=hn(H=>{const O=H.target;(x==null?void 0:x.contains(O))&&T(H,M)},"handleWheel");return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[N,x,M,T]),s.useEffect(L,[a,L]),Fl(x,A),Fl(b.content,A),o.jsx(y_,{scope:r,scrollbar:x,hasThumb:i,onThumbChange:fr(c),onThumbPointerUp:fr(d),onThumbPositionChange:L,onThumbPointerDown:fr(f),children:o.jsx(en.div,{...y,ref:S,style:{position:"absolute",...y.style},onPointerDown:vt(t.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),E.current=x.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),P($))}),onPointerMove:vt(t.onPointerMove,P),onPointerUp:vt(t.onPointerUp,$=>{const H=$.target;H.hasPointerCapture($.pointerId)&&H.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=C.current,b.viewport&&(b.viewport.style.scrollBehavior=""),E.current=null})})})},"ScrollAreaScrollbarImpl")),w8="ScrollAreaThumb",w_=s.forwardRef(hn(function(t,n){const{forceMount:r,...a}=t,i=b9(w8,t.__scopeScrollArea);return o.jsx(Kr,{present:r||i.hasThumb,children:o.jsx(b_,{ref:n,...a})})},"ScrollAreaThumb")),b_=s.forwardRef(hn(function(t,n){const{__scopeScrollArea:r,style:a,...i}=t,c=ua(w8,r),d=b9(w8,r),{onThumbPositionChange:f}=d,h=Xt(n,d.onThumbChange),p=s.useRef(void 0),g=_0(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const v=c.viewport;if(v){const y=hn(()=>{if(g(),!p.current){const b=S_(v,f);p.current=b,f()}},"handleScroll");return f(),v.addEventListener("scroll",y),()=>v.removeEventListener("scroll",y)}},[c.viewport,g,f]),o.jsx(en.div,{"data-state":d.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:vt(t.onPointerDownCapture,v=>{const b=v.target.getBoundingClientRect(),x=v.clientX-b.left,k=v.clientY-b.top;d.onThumbPointerDown({x,y:k})}),onPointerUp:vt(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),k9="ScrollAreaCorner",x_=s.forwardRef(hn(function(t,n){const r=ua(k9,t.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(k_,{...t,ref:n}):null},"ScrollAreaCorner")),k_=s.forwardRef(hn(function(t,n){const{__scopeScrollArea:r,...a}=t,i=ua(k9,r),[c,d]=s.useState(0),[f,h]=s.useState(0),p=!!(c&&f),{onCornerWidthChange:g,onCornerHeightChange:v}=i;return Fl(i.scrollbarX,()=>{var b;const y=((b=i.scrollbarX)==null?void 0:b.offsetHeight)||0;i.onCornerHeightChange(y),h(y)}),Fl(i.scrollbarY,()=>{var b;const y=((b=i.scrollbarY)==null?void 0:b.offsetWidth)||0;i.onCornerWidthChange(y),d(y)}),s.useEffect(()=>()=>{g(0),v(0)},[g,v]),p?o.jsx(en.div,{...a,ref:n,style:{width:c,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 m0(e){return e?parseInt(e,10):0}hn(m0,"toInt");function u6(e,t){const n=e/t;return isNaN(n)?0:n}hn(u6,"getThumbRatio");function F0(e){const t=u6(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}hn(F0,"getThumbSize");function S9(e,t,n,r="ltr"){const a=F0(n),i=a/2,c=t||i,d=a-c,f=n.scrollbar.paddingStart+c,h=n.scrollbar.size-n.scrollbar.paddingEnd-d,p=n.content-n.viewport,g=r==="ltr"?[0,p]:[p*-1,0];return d6([f,h],g)(e)}hn(S9,"getScrollPositionFromPointer");function b8(e,t,n="ltr"){const r=F0(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,c=t.content-t.viewport,d=i-r,f=n==="ltr"?[0,c]:[c*-1,0],h=oh(e,f);return d6([0,c],[0,d])(h)}hn(b8,"getThumbOffsetFromScroll");function d6(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])}}hn(d6,"linearScale");function f6(e,t){return e>0&&e<t}hn(f6,"isScrollingWithinScrollbarBounds");var S_=hn((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return hn((function a(){const i={left:e.scrollLeft,top:e.scrollTop},c=n.left!==i.left,d=n.top!==i.top;(c||d)&&t(),n=i,r=window.requestAnimationFrame(a)}),"loop")(),()=>window.cancelAnimationFrame(r)},"addUnlinkedScrollListener");function _0(e,t){const n=fr(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])}hn(_0,"useDebounceCallback");function Fl(e,t){const n=fr(t);pr(()=>{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])}hn(Fl,"useResizeObserver");var E9=c_,C9=d_,x8=h_,k8=w_,E_=x_,C_=Object.defineProperty,Mn=(e,t)=>C_(e,"name",{value:t,configurable:!0}),j_=[" ","Enter","ArrowUp","ArrowDown"],A_=[" ","Enter"],Su="Select",[up,h6,N_]=Wh(Su),[lc,tie]=bs(Su,[N_,Wi]),p6=Wi(),[M_,Ki]=lc(Su),[R_,P_]=lc(Su);function j9(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:c,defaultValue:d,onValueChange:f,dir:h,name:p,autoComplete:g,disabled:v,required:y,form:b,internal_do_not_use_render:x}=e,k=p6(t),[S,E]=s.useState(null),[C,N]=s.useState(null),[M,T]=s.useState(!1),L=T0(h),[A,P]=Vo({prop:r,defaultProp:a??!1,onChange:i,caller:Su}),[$,H]=Vo({prop:c,defaultProp:d,onChange:f,caller:Su}),O=s.useRef(null),Q=s.useRef($);s.useEffect(()=>{const K=b?S==null?void 0:S.ownerDocument.getElementById(b):S==null?void 0:S.form;if(K instanceof HTMLFormElement){const z=Mn(()=>H(Q.current),"reset");return K.addEventListener("reset",z),()=>K.removeEventListener("reset",z)}},[b,S,H]);const I=S?!!b||!!S.closest("form"):!0,[V,ie]=s.useState(new Set),B=ia(),F=Array.from(V).map(K=>K.props.value).join(";"),te=s.useCallback(K=>{ie(z=>new Set(z).add(K))},[]),X=s.useCallback(K=>{ie(z=>{const Y=new Set(z);return Y.delete(K),Y})},[]),Z={required:y,trigger:S,onTriggerChange:E,valueNode:C,onValueNodeChange:N,valueNodeHasChildren:M,onValueNodeHasChildrenChange:T,contentId:B,value:$,onValueChange:H,open:A,onOpenChange:P,dir:L,triggerPointerDownPosRef:O,disabled:v,name:p,autoComplete:g,form:b,nativeOptions:V,nativeSelectKey:F,isFormControl:I};return o.jsx(rp,{...k,children:o.jsx(M_,{scope:t,...Z,children:o.jsx(up.Provider,{scope:t,children:o.jsx(R_,{scope:t,onNativeOptionAdd:te,onNativeOptionRemove:X,children:M9(x)?x(Z):n})})})})}Mn(j9,"SelectProvider");var L_=Mn(e=>{const{__scopeSelect:t,children:n,...r}=e;return o.jsx(j9,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:a})=>o.jsxs(o.Fragment,{children:[n,a?o.jsx(cV,{__scopeSelect:t}):null]})})},"Select"),T_="SelectTrigger",$_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,disabled:a=!1,...i}=t,c=p6(r),d=Ki(T_,r),f=d.disabled||a,h=Xt(n,d.onTriggerChange),p=h6(r),g=s.useRef("touch"),[v,y,b]=m6(k=>{const S=p().filter(N=>!N.disabled),E=S.find(N=>N.value===d.value),C=g6(S,k,E);C!==void 0&&d.onValueChange(C.value)}),x=Mn(k=>{f||(d.onOpenChange(!0),b()),k&&(d.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})},"handleOpen");return o.jsx(H0,{asChild:!0,...c,children:o.jsx(en.button,{type:"button",role:"combobox","aria-controls":d.open?d.contentId:void 0,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":V0(d.value)?"":void 0,...i,ref:h,onClick:vt(i.onClick,k=>{k.currentTarget.focus(),g.current!=="mouse"&&x(k)}),onPointerDown:vt(i.onPointerDown,k=>{g.current=k.pointerType;const S=k.target;S.hasPointerCapture(k.pointerId)&&S.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(x(k),k.preventDefault())}),onKeyDown:vt(i.onKeyDown,k=>{const S=v.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&y(k.key),!(S&&k.key===" ")&&j_.includes(k.key)&&(x(),k.preventDefault())})})})},"SelectTrigger")),D_="SelectValue",O_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,className:a,style:i,children:c,placeholder:d="",...f}=t,h=Ki(D_,r),{onValueNodeHasChildrenChange:p}=h,g=c!==void 0,v=Xt(n,h.onValueNodeChange);pr(()=>{p(g)},[p,g]);const y=V0(h.value);return o.jsx(en.span,{...f,asChild:y?!1:f.asChild,ref:v,style:{pointerEvents:"none"},children:o.jsx(s.Fragment,{children:y?d:c},y?"placeholder":"value")})},"SelectValue")),H_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,children:a,...i}=t;return o.jsx(en.span,{"aria-hidden":!0,...i,ref:n,children:a||"▼"})},"SelectIcon")),I_="SelectPortal",[F_,__]=lc(I_,{forceMount:void 0}),V_=Mn(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return o.jsx(F_,{scope:e.__scopeSelect,forceMount:n,children:o.jsx(D0,{asChild:!0,...r})})},"SelectPortal"),_l="SelectContent",Z_=s.forwardRef(Mn(function(t,n){const r=__(_l,t.__scopeSelect),{forceMount:a=r.forceMount,...i}=t,c=Ki(_l,t.__scopeSelect),[d,f]=s.useState();return pr(()=>{f(new DocumentFragment)},[]),o.jsx(Kr,{present:a||c.open,children:({present:h})=>h?o.jsx(U_,{...i,ref:n}):o.jsx(z_,{...i,fragment:d})})},"SelectContent")),z_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,children:a,fragment:i}=t;return i?Mr.createPortal(o.jsx(A9,{scope:r,children:o.jsx(up.Slot,{scope:r,children:o.jsx("div",{ref:n,children:a})})}),i):null},"SelectContentFragment")),ka=10,[A9,dp]=lc(_l),B_=Aa("SelectContent.RemoveScroll"),U_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r}=t,{position:a="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:d,side:f,sideOffset:h,align:p,alignOffset:g,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:k,avoidCollisions:S,...E}=t,C=Ki(_l,r),[N,M]=s.useState(null),[T,L]=s.useState(null),A=Xt(n,M),[P,$]=s.useState(null),[H,O]=s.useState(null),Q=h6(r),[I,V]=s.useState(!1),ie=s.useRef(!1);s.useEffect(()=>{if(N)return Kh(N)},[N]),Fu();const B=s.useCallback(W=>{const[ye,...ee]=Q().map(D=>D.ref.current),[ge]=ee.slice(-1),re=document.activeElement;for(const D of W)if(D===re||(D==null||D.scrollIntoView({block:"nearest"}),D===ye&&T&&(T.scrollTop=0),D===ge&&T&&(T.scrollTop=T.scrollHeight),D==null||D.focus(),document.activeElement!==re))return},[Q,T]),F=s.useCallback(()=>B([P,N]),[B,P,N]);s.useEffect(()=>{I&&F()},[I,F]);const{onOpenChange:te,triggerPointerDownPosRef:X}=C;s.useEffect(()=>{if(N){let W={x:0,y:0};const ye=Mn(ge=>{var re,D;W={x:Math.abs(Math.round(ge.pageX)-(((re=X.current)==null?void 0:re.x)??0)),y:Math.abs(Math.round(ge.pageY)-(((D=X.current)==null?void 0:D.y)??0))}},"handlePointerMove"),ee=Mn(ge=>{W.x<=10&&W.y<=10?ge.preventDefault():ge.composedPath().includes(N)||te(!1),document.removeEventListener("pointermove",ye),X.current=null},"handlePointerUp");return X.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ee,{capture:!0})}}},[N,te,X]),s.useEffect(()=>{const W=Mn(()=>te(!1),"close");return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[te]);const[Z,K]=m6(W=>{const ye=Q().filter(re=>!re.disabled),ee=ye.find(re=>re.ref.current===document.activeElement),ge=g6(ye,W,ee);ge&&setTimeout(()=>{var re;return(re=ge.ref.current)==null?void 0:re.focus()})}),z=s.useCallback((W,ye,ee)=>{const ge=!ie.current&&!ee;(C.value!==void 0&&C.value===ye||ge)&&($(W),ge&&(ie.current=!0))},[C.value]),Y=s.useCallback(()=>N==null?void 0:N.focus(),[N]),J=s.useCallback((W,ye,ee)=>{const ge=!ie.current&&!ee;(C.value!==void 0&&C.value===ye||ge)&&O(W)},[C.value]),de=a==="popper"?fx:W_,ae=de===fx?{side:f,sideOffset:h,align:p,alignOffset:g,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:k,avoidCollisions:S}:{};return o.jsx(A9,{scope:r,content:N,viewport:T,onViewportChange:L,itemRefCallback:z,selectedItem:P,onItemLeave:Y,itemTextRefCallback:J,focusSelectedItem:F,selectedItemText:H,position:a,isPositioned:I,searchRef:Z,children:o.jsx(O0,{as:B_,allowPinchZoom:!0,children:o.jsx(Iu,{asChild:!0,trapped:C.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:vt(i,W=>{var ye;(ye=C.trigger)==null||ye.focus({preventScroll:!0}),W.preventDefault()}),children:o.jsx($0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:o.jsx(de,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:W=>W.preventDefault(),...E,...ae,onPlaced:()=>V(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:vt(E.onKeyDown,W=>{const ye=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!ye&&W.key.length===1&&K(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let ge=Q().filter(re=>!re.disabled).map(re=>re.ref.current);if(["ArrowUp","End"].includes(W.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const re=W.target,D=ge.indexOf(re);ge=ge.slice(D+1)}setTimeout(()=>B(ge)),W.preventDefault()}})})})})})})},"SelectContentImpl")),W_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,onPlaced:a,...i}=t,c=Ki(_l,r),d=dp(_l,r),[f,h]=s.useState(null),[p,g]=s.useState(null),v=Xt(n,g),y=h6(r),b=s.useRef(!1),x=s.useRef(!0),{viewport:k,selectedItem:S,selectedItemText:E,focusSelectedItem:C}=d,N=s.useCallback(()=>{if(c.trigger&&c.valueNode&&f&&p&&k&&S&&E){const A=c.trigger.getBoundingClientRect(),P=p.getBoundingClientRect(),$=c.valueNode.getBoundingClientRect(),H=E.getBoundingClientRect();if(c.dir!=="rtl"){const re=H.left-P.left,D=$.left-re,G=A.left-D,Pe=A.width+G,Ze=Math.max(Pe,P.width),He=window.innerWidth-ka,tt=oh(D,[ka,Math.max(ka,He-Ze)]);f.style.minWidth=Pe+"px",f.style.left=tt+"px"}else{const re=P.right-H.right,D=window.innerWidth-$.right-re,G=window.innerWidth-A.right-D,Pe=A.width+G,Ze=Math.max(Pe,P.width),He=window.innerWidth-ka,tt=oh(D,[ka,Math.max(ka,He-Ze)]);f.style.minWidth=Pe+"px",f.style.right=tt+"px"}const O=y(),Q=window.innerHeight-ka*2,I=k.scrollHeight,V=window.getComputedStyle(p),ie=parseInt(V.borderTopWidth,10),B=parseInt(V.paddingTop,10),F=parseInt(V.borderBottomWidth,10),te=parseInt(V.paddingBottom,10),X=ie+B+I+te+F,Z=Math.min(S.offsetHeight*5,X),K=window.getComputedStyle(k),z=parseInt(K.paddingTop,10),Y=parseInt(K.paddingBottom,10),J=A.top+A.height/2-ka,de=Q-J,ae=S.offsetHeight/2,W=S.offsetTop+ae,ye=ie+B+W,ee=X-ye;if(ye<=J){const re=O.length>0&&S===O[O.length-1].ref.current;f.style.bottom="0px";const D=p.clientHeight-k.offsetTop-k.offsetHeight,G=Math.max(de,ae+(re?Y:0)+D+F),Pe=ye+G;f.style.height=Pe+"px"}else{const re=O.length>0&&S===O[0].ref.current;f.style.top="0px";const G=Math.max(J,ie+k.offsetTop+(re?z:0)+ae)+ee;f.style.height=G+"px",k.scrollTop=ye-J+k.offsetTop}f.style.margin=`${ka}px 0`,f.style.minHeight=Z+"px",f.style.maxHeight=Q+"px",a==null||a(),requestAnimationFrame(()=>b.current=!0)}},[y,c.trigger,c.valueNode,f,p,k,S,E,c.dir,a]);pr(()=>N(),[N]);const[M,T]=s.useState();pr(()=>{p&&T(window.getComputedStyle(p).zIndex)},[p]);const L=s.useCallback(A=>{A&&x.current===!0&&(N(),C==null||C(),x.current=!1)},[N,C]);return o.jsx(G_,{scope:r,contentWrapper:f,shouldExpandOnScrollRef:b,onScrollButtonChange:L,children:o.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:o.jsx(en.div,{...i,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),fx=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,align:a="start",collisionPadding:i=ka,...c}=t,d=p6(r);return o.jsx(sp,{...d,...c,ref:n,align:a,collisionPadding:i,style:{boxSizing:"border-box",...c.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")),[G_,K_]=lc(_l,{}),hx="SelectViewport",Y_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,nonce:a,...i}=t,c=dp(hx,r),d=K_(hx,r),f=Xt(n,c.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(up.Slot,{scope:r,children:o.jsx(en.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:vt(i.onScroll,p=>{const g=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:y}=d;if(y!=null&&y.current&&v){const b=Math.abs(h.current-g.scrollTop);if(b>0){const x=window.innerHeight-ka*2,k=parseFloat(v.style.minHeight),S=parseFloat(v.style.height),E=Math.max(k,S);if(E<x){const C=E+b,N=Math.min(x,C),M=C-N;v.style.height=N+"px",v.style.bottom==="0px"&&(g.scrollTop=M>0?M:0,v.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})},"SelectViewport")),q_="SelectGroup",[X_,Q_]=lc(q_),J_=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,...a}=t,i=ia();return o.jsx(X_,{scope:r,id:i,children:o.jsx(en.div,{role:"group","aria-labelledby":i,...a,ref:n})})},"SelectGroup")),eV="SelectLabel",tV=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,...a}=t,i=Q_(eV,r);return o.jsx(en.div,{id:i.id,...a,ref:n})},"SelectLabel")),S8="SelectItem",[nV,N9]=lc(S8),rV=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,value:a,disabled:i=!1,textValue:c,...d}=t,f=Ki(S8,r),h=dp(S8,r),p=f.value===a,[g,v]=s.useState(c??""),[y,b]=s.useState(!1),x=fr(N=>{var M;return(M=h.itemRefCallback)==null?void 0:M.call(h,N,a,i)}),k=Xt(n,x),S=ia(),E=s.useRef("touch"),C=Mn(()=>{i||(f.onValueChange(a),f.onOpenChange(!1))},"handleSelect");return o.jsx(nV,{scope:r,value:a,disabled:i,textId:S,isSelected:p,onItemTextChange:s.useCallback(N=>{v(M=>M||((N==null?void 0:N.textContent)??"").trim())},[]),children:o.jsx(up.ItemSlot,{scope:r,value:a,disabled:i,textValue:g,children:o.jsx(en.div,{role:"option","aria-labelledby":S,"data-highlighted":y?"":void 0,"aria-selected":p&&y,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...d,ref:k,onFocus:vt(d.onFocus,()=>b(!0)),onBlur:vt(d.onBlur,()=>b(!1)),onClick:vt(d.onClick,()=>{E.current!=="mouse"&&C()}),onPointerUp:vt(d.onPointerUp,()=>{E.current==="mouse"&&C()}),onPointerDown:vt(d.onPointerDown,N=>{E.current=N.pointerType}),onPointerMove:vt(d.onPointerMove,N=>{var M;E.current=N.pointerType,i?(M=h.onItemLeave)==null||M.call(h):E.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:vt(d.onPointerLeave,N=>{var M;N.currentTarget===document.activeElement&&((M=h.onItemLeave)==null||M.call(h))}),onKeyDown:vt(d.onKeyDown,N=>{var T;i||N.target!==N.currentTarget||((T=h.searchRef)==null?void 0:T.current)!==""&&N.key===" "||(A_.includes(N.key)&&C(),N.key===" "&&N.preventDefault())})})})})},"SelectItem")),x1="SelectItemText",sV=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,className:a,style:i,...c}=t,d=Ki(x1,r),f=dp(x1,r),h=N9(x1,r),p=P_(x1,r),[g,v]=s.useState(null),y=fr(C=>{var N;return(N=f.itemTextRefCallback)==null?void 0:N.call(f,C,h.value,h.disabled)}),b=Xt(n,v,h.onItemTextChange,y),x=g==null?void 0:g.textContent,k=s.useMemo(()=>o.jsx("option",{value:h.value,disabled:h.disabled,children:x},h.value),[h.disabled,h.value,x]),{onNativeOptionAdd:S,onNativeOptionRemove:E}=p;return pr(()=>(S(k),()=>E(k)),[S,E,k]),o.jsxs(o.Fragment,{children:[o.jsx(en.span,{id:h.textId,...c,ref:b}),h.isSelected&&d.valueNode&&!d.valueNodeHasChildren&&!V0(d.value)?Mr.createPortal(c.children,d.valueNode):null]})},"SelectItemText")),aV="SelectItemIndicator",oV=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,...a}=t;return N9(aV,r).isSelected?o.jsx(en.span,{"aria-hidden":!0,...a,ref:n}):null},"SelectItemIndicator")),iV=s.forwardRef(Mn(function(t,n){const{__scopeSelect:r,...a}=t;return o.jsx(en.div,{"aria-hidden":!0,...a,ref:n})},"SelectSeparator")),lV="SelectBubbleInput",cV=s.forwardRef(Mn(function({__scopeSelect:t,...n},r){const a=Ki(lV,t),{value:i,onValueChange:c,required:d,disabled:f,name:h,autoComplete:p,form:g}=a,{nativeOptions:v,nativeSelectKey:y}=a,b=s.useRef(null),x=Xt(r,b),k=i??"",S=f9(k),E=Array.from(v).some(C=>(C.props.value??"")==="");return s.useEffect(()=>{const C=b.current;if(!C)return;const N=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(N,"value").set;if(S!==k&&T){const L=new Event("change",{bubbles:!0});T.call(C,k),C.dispatchEvent(L)}},[S,k]),o.jsxs(en.select,{"aria-hidden":!0,required:d,tabIndex:-1,name:h,autoComplete:p,disabled:f,form:g,onChange:C=>c(C.target.value),...n,style:{...fS,...n.style},ref:x,defaultValue:k,children:[V0(i)&&!E?o.jsx("option",{value:""}):null,Array.from(v)]},y)},"SelectBubbleInput"));function M9(e){return typeof e=="function"}Mn(M9,"isFunction");function V0(e){return e===""||e===void 0}Mn(V0,"shouldShowPlaceholder");function m6(e){const t=fr(e),n=s.useRef(""),r=s.useRef(0),a=s.useCallback(c=>{const d=n.current+c;t(d),Mn((function f(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>f(""),1e3))}),"updateSearch")(d)},[t]),i=s.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}Mn(m6,"useTypeaheadSearch");function g6(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 c=R9(e,Math.max(i,0));a.length===1&&(c=c.filter(h=>h!==n));const f=c.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return f!==n?f:void 0}Mn(g6,"findNextItem");function R9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Mn(R9,"wrapArray");var uV=Object.defineProperty,br=(e,t)=>uV(e,"name",{value:t,configurable:!0}),[v6,nie]=bs("Tooltip",[Wi]),fp=Wi(),dV="TooltipProvider",fV=700,E8="tooltip.open",[hV,y6]=v6(dV),pV=br(e=>{const{__scopeTooltip:t,delayDuration:n=fV,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,c=s.useRef(!0),d=s.useRef(!1),f=s.useRef(0);return s.useEffect(()=>{const h=f.current;return()=>window.clearTimeout(h)},[]),o.jsx(hV,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:s.useCallback(()=>{r<=0||(window.clearTimeout(f.current),c.current=!1)},[r]),onClose:s.useCallback(()=>{r<=0||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.current=!0,r))},[r]),isPointerInTransitRef:d,onPointerInTransitChange:s.useCallback(h=>{d.current=h},[]),disableHoverableContent:a,children:i})},"TooltipProvider"),C8="Tooltip",[mV,Z0]=v6(C8),gV=br(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:i,disableHoverableContent:c,delayDuration:d}=e,f=y6(C8,e.__scopeTooltip),h=fp(t),[p,g]=s.useState(null),[v,y]=s.useState(void 0),b=ia(),x=s.useRef(0),k=c??f.disableHoverableContent,S=d??f.delayDuration,E=s.useRef(!1),[C,N]=Vo({prop:r,defaultProp:a??!1,onChange:br($=>{$?(f.onOpen(),document.dispatchEvent(new CustomEvent(E8))):f.onClose(),i==null||i($)},"onChange"),caller:C8}),M=s.useMemo(()=>C?E.current?"delayed-open":"instant-open":"closed",[C]),T=s.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,N(!0)},[N]),L=s.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),A=s.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,N(!0),x.current=0},S)},[S,N]);s.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]);const P=v??b;return o.jsx(rp,{...h,children:o.jsx(mV,{scope:t,contentId:P,setContentId:y,open:C,stateAttribute:M,trigger:p,onTriggerChange:g,onTriggerEnter:s.useCallback(()=>{f.isOpenDelayedRef.current?A():T()},[f.isOpenDelayedRef,A,T]),onTriggerLeave:s.useCallback(()=>{k?L():(window.clearTimeout(x.current),x.current=0)},[L,k]),onOpen:T,onClose:L,disableHoverableContent:k,children:n})})},"Tooltip"),px="TooltipTrigger",vV=s.forwardRef(br(function(t,n){const{__scopeTooltip:r,...a}=t,i=Z0(px,r),c=y6(px,r),d=fp(r),f=s.useRef(null),h=Xt(n,f,i.onTriggerChange),p=s.useRef(!1),g=s.useRef(!1),v=s.useCallback(()=>p.current=!1,[]);return s.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),o.jsx(H0,{asChild:!0,...d,children:o.jsx(en.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...a,ref:h,onPointerMove:vt(t.onPointerMove,y=>{y.pointerType!=="touch"&&!g.current&&!c.isPointerInTransitRef.current&&(i.onTriggerEnter(),g.current=!0)}),onPointerLeave:vt(t.onPointerLeave,()=>{i.onTriggerLeave(),g.current=!1}),onPointerDown:vt(t.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:vt(t.onFocus,()=>{p.current||i.onOpen()}),onBlur:vt(t.onBlur,i.onClose),onClick:vt(t.onClick,i.onClose)})})},"TooltipTrigger")),P9="TooltipPortal",[yV,wV]=v6(P9,{forceMount:void 0}),bV=br(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,i=Z0(P9,t);return o.jsx(yV,{scope:t,forceMount:n,children:o.jsx(Kr,{present:n||i.open,children:o.jsx(D0,{asChild:!0,container:a,children:r})})})},"TooltipPortal"),g0="TooltipContent",xV=s.forwardRef(br(function(t,n){const r=wV(g0,t.__scopeTooltip),{forceMount:a=r.forceMount,side:i="top",...c}=t,d=Z0(g0,t.__scopeTooltip);return o.jsx(Kr,{present:a||d.open,children:d.disableHoverableContent?o.jsx(L9,{side:i,...c,ref:n}):o.jsx(kV,{side:i,...c,ref:n})})},"TooltipContent")),kV=s.forwardRef(br(function(t,n){const r=Z0(g0,t.__scopeTooltip),a=y6(g0,t.__scopeTooltip),i=s.useRef(null),c=Xt(n,i),[d,f]=s.useState(null),{trigger:h,onClose:p}=r,g=i.current,{onPointerInTransitChange:v}=a,y=s.useCallback(()=>{f(null),v(!1)},[v]),b=s.useCallback((x,k)=>{const S=x.currentTarget,E={x:x.clientX,y:x.clientY},C=T9(E,S.getBoundingClientRect()),N=$9(E,C),M=D9(k.getBoundingClientRect()),T=H9([...N,...M]);f(T),v(!0)},[v]);return s.useEffect(()=>()=>y(),[y]),s.useEffect(()=>{if(h&&g){const x=br(S=>b(S,g),"handleTriggerLeave"),k=br(S=>b(S,h),"handleContentLeave");return h.addEventListener("pointerleave",x),g.addEventListener("pointerleave",k),()=>{h.removeEventListener("pointerleave",x),g.removeEventListener("pointerleave",k)}}},[h,g,b,y]),s.useEffect(()=>{if(d){const x=br(k=>{const S=k.target,E={x:k.clientX,y:k.clientY},C=(h==null?void 0:h.contains(S))||(g==null?void 0:g.contains(S)),N=!O9(E,d);C?y():N&&(y(),p())},"handleTrackPointerGrace");return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[h,g,d,p,y]),o.jsx(L9,{...t,ref:c})},"TooltipContentHoverable")),SV=Hv("TooltipContent"),L9=s.forwardRef(br(function(t,n){const{__scopeTooltip:r,children:a,"aria-label":i,id:c,onEscapeKeyDown:d,onPointerDownOutside:f,...h}=t,p=Z0(g0,r),g=fp(r),{onClose:v}=p;s.useEffect(()=>(document.addEventListener(E8,v),()=>document.removeEventListener(E8,v)),[v]),s.useEffect(()=>{if(p.trigger){const b=br(x=>{x.target instanceof Node&&x.target.contains(p.trigger)&&v()},"handleScroll");return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[p.trigger,v]);const{setContentId:y}=p;return pr(()=>(y(c),()=>{y(void 0)}),[c,y]),o.jsx($0,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:b=>b.preventDefault(),onDismiss:v,children:o.jsxs(sp,{"data-state":p.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:p.contentId,...g,...h,ref:n,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(SV,{children:a}),i?o.jsx(hS,{id:p.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl")),EV=s.forwardRef(br(function(t,n){const{__scopeTooltip:r,...a}=t,i=fp(r);return o.jsx(TH,{...i,...a,ref:n})},"TooltipArrow"));function T9(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")}}br(T9,"getExitSideFromRect");function $9(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}br($9,"getPaddedExitPoints");function D9(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}]}br(D9,"getPointsFromRect");function O9(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,c=t.length-1;i<t.length;c=i++){const d=t[i],f=t[c],h=d.x,p=d.y,g=f.x,v=f.y;p>r!=v>r&&n<(g-h)*(r-p)/(v-p)+h&&(a=!a)}return a}br(O9,"isPointInPolygon");function H9(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),I9(t)}br(H9,"getHull");function I9(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],c=t[t.length-2];if((i.x-c.x)*(a.y-c.y)>=(i.y-c.y)*(a.x-c.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],c=n[n.length-2];if((i.x-c.x)*(a.y-c.y)>=(i.y-c.y)*(a.x-c.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)}br(I9,"getHullPresorted");var CV=pV,jV=gV,AV=vV,NV=bV,MV=xV,RV=EV,X2={exports:{}};/*!
93
+ Copyright (c) 2018 Jed Watson.
94
+ Licensed under the MIT License (MIT), see
95
+ http://jedwatson.github.io/classnames
96
+ */var mx;function PV(){return mx||(mx=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",c=0;c<arguments.length;c++){var d=arguments[c];d&&(i=a(i,r(d)))}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 c="";for(var d in i)t.call(i,d)&&i[d]&&(c=a(c,d));return c}function a(i,c){return c?i?i+" "+c:i+c:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(X2)),X2.exports}var LV=PV();const Ft=v5(LV),Ta={asChild:{type:"boolean"}},Ja={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}},w6={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}},TV=["1","2","3","4"],F9={...Ta,align:{type:"enum",className:"rt-r-align",values:["start","center"],default:"center"},size:{type:"enum",className:"rt-r-size",values:TV,default:"3",responsive:!0},width:Ja.width,minWidth:Ja.minWidth,maxWidth:{...Ja.maxWidth,default:"600px"},...w6},_9=["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"],Yi={color:{type:"enum",values:_9,default:void 0}},b6={color:{type:"enum",values:_9,default:""}},cc={highContrast:{type:"boolean",className:"rt-high-contrast",default:void 0}},$V=["normal","start","end","both"],V9={trim:{type:"enum",className:"rt-r-lt",values:$V,responsive:!0}},DV=["left","center","right"],Z9={align:{type:"enum",className:"rt-r-ta",values:DV,responsive:!0}},OV=["wrap","nowrap","pretty","balance"],z9={wrap:{type:"enum",className:"rt-r-tw",values:OV,responsive:!0}},B9={truncate:{type:"boolean",className:"rt-truncate"}},HV=["light","regular","medium","bold"],U9={weight:{type:"enum",className:"rt-r-weight",values:HV,responsive:!0}},IV=["h1","h2","h3","h4","h5","h6"],FV=["1","2","3","4","5","6","7","8","9"],_V={as:{type:"enum",values:IV,default:"h1"},...Ta,size:{type:"enum",className:"rt-r-size",values:FV,default:"6",responsive:!0},...U9,...Z9,...V9,...B9,...z9,...Yi,...cc},VV=["initial","xs","sm","md","lg","xl"],x6=new Set(VV);function W9(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Xd(e){return typeof e=="object"&&e!==null&&Object.keys(e).some(t=>x6.has(t))}function wi({className:e,customProperties:t,...n}){const r=ih({allowArbitraryValues:!0,className:e,...n}),a=ZV({customProperties:t,...n});return[r,a]}function ih({allowArbitraryValues:e,value:t,className:n,propValues:r,parseValue:a=i=>i}){const i=[];if(t){if(typeof t=="string"&&r.includes(t))return gx(n,t,a);if(Xd(t)){const c=t;for(const d in c){if(!W9(c,d)||!x6.has(d))continue;const f=c[d];if(f!==void 0){if(r.includes(f)){const h=gx(n,f,a),p=d==="initial"?h:`${d}:${h}`;i.push(p)}else if(e){const h=d==="initial"?n:`${d}:${n}`;i.push(h)}}}return i.join(" ")}if(e)return n}}function gx(e,t,n){const r=e?"-":"",a=n(t),i=a==null?void 0:a.startsWith("-"),c=i?"-":"",d=i?a==null?void 0:a.substring(1):a;return`${c}${e}${r}${d}`}function ZV({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]))),Xd(t)){const i=t;for(const c in i){if(!W9(i,c)||!x6.has(c))continue;const d=i[c];if(!n.includes(d))for(const f of e)a={[c==="initial"?f:`${f}-${c}`]:d,...a}}}for(const i in a){const c=a[i];c!==void 0&&(a[i]=r(c))}return a}}function lh(...e){let t={};for(const n of e)n&&(t={...t,...n});return Object.keys(t).length?t:void 0}function zV(...e){return Object.assign({},...e)}function gr(e,...t){let n,r;const a={...e},i=zV(...t);for(const c in i){let d=a[c];const f=i[c];if(f.default!==void 0&&d===void 0&&(d=f.default),f.type==="enum"&&![f.default,...f.values].includes(d)&&!Xd(d)&&(d=f.default),a[c]=d,"className"in f&&f.className){delete a[c];const h="responsive"in f;if(!d||Xd(d)&&!h)continue;if(Xd(d)&&(f.default!==void 0&&d.initial===void 0&&(d.initial=f.default),f.type==="enum"&&([f.default,...f.values].includes(d.initial)||(d.initial=f.default))),f.type==="enum"){const p=ih({allowArbitraryValues:!1,value:d,className:f.className,propValues:f.values,parseValue:f.parseValue});n=Ft(n,p);continue}if(f.type==="string"||f.type==="enum | string"){const p=f.type==="string"?[]:f.values,[g,v]=wi({className:f.className,customProperties:f.customProperties,propValues:p,parseValue:f.parseValue,value:d});r=lh(r,v),n=Ft(n,g);continue}if(f.type==="boolean"&&d){n=Ft(n,f.className);continue}}}return a.className=Ft(n,e.className),a.style=lh(r,e.style),a}const vl=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],fo={m:{type:"enum | string",values:vl,responsive:!0,className:"rt-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:vl,responsive:!0,className:"rt-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:vl,responsive:!0,className:"rt-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:vl,responsive:!0,className:"rt-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:vl,responsive:!0,className:"rt-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:vl,responsive:!0,className:"rt-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:vl,responsive:!0,className:"rt-r-ml",customProperties:["--ml"]}},k6=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="h1",color:c,...d}=gr(e,_V,fo);return s.createElement(Jl,{"data-accent-color":c,...d,ref:t,className:Ft("rt-Heading",r)},a?n:s.createElement(i,null,n))});k6.displayName="Heading";const BV=["span","div","label","p"],UV=["1","2","3","4","5","6","7","8","9"],WV={as:{type:"enum",values:BV,default:"span"},...Ta,size:{type:"enum",className:"rt-r-size",values:UV,responsive:!0},...U9,...Z9,...V9,...B9,...z9,...Yi,...cc},Vl=s.forwardRef((e,t)=>{const{children:n,className:r,asChild:a,as:i="span",color:c,...d}=gr(e,WV,fo);return s.createElement(Jl,{"data-accent-color":c,...d,ref:t,className:Ft("rt-Text",r)},a?n:s.createElement(i,null,n))});Vl.displayName="Text";function GV(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 KV=["none","small","medium","large","full"],hp={radius:{type:"enum",values:KV,default:void 0}},Rs={hasBackground:{default:!0},appearance:{default:"inherit"},accentColor:{default:"indigo"},grayColor:{default:"auto"},panelBackground:{default:"translucent"},radius:{default:"medium"},scaling:{default:"100%"}},zc=()=>{},ch=s.createContext(void 0);function S6(){const e=s.useContext(ch);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const $a=s.forwardRef((e,t)=>s.useContext(ch)===void 0?s.createElement(CV,{delayDuration:200},s.createElement(O$,{dir:"ltr"},s.createElement(G9,{...e,ref:t}))):s.createElement(E6,{...e,ref:t}));$a.displayName="Theme";const G9=s.forwardRef((e,t)=>{const{appearance:n=Rs.appearance.default,accentColor:r=Rs.accentColor.default,grayColor:a=Rs.grayColor.default,panelBackground:i=Rs.panelBackground.default,radius:c=Rs.radius.default,scaling:d=Rs.scaling.default,hasBackground:f=Rs.hasBackground.default,...h}=e,[p,g]=s.useState(n);s.useEffect(()=>g(n),[n]);const[v,y]=s.useState(r);s.useEffect(()=>y(r),[r]);const[b,x]=s.useState(a);s.useEffect(()=>x(a),[a]);const[k,S]=s.useState(i);s.useEffect(()=>S(i),[i]);const[E,C]=s.useState(c);s.useEffect(()=>C(c),[c]);const[N,M]=s.useState(d);return s.useEffect(()=>M(d),[d]),s.createElement(E6,{...h,ref:t,isRoot:!0,hasBackground:f,appearance:p,accentColor:v,grayColor:b,panelBackground:k,radius:E,scaling:N,onAppearanceChange:g,onAccentColorChange:y,onGrayColorChange:x,onPanelBackgroundChange:S,onRadiusChange:C,onScalingChange:M})});G9.displayName="ThemeRoot";const E6=s.forwardRef((e,t)=>{const n=s.useContext(ch),{asChild:r,isRoot:a,hasBackground:i,appearance:c=(n==null?void 0:n.appearance)??Rs.appearance.default,accentColor:d=(n==null?void 0:n.accentColor)??Rs.accentColor.default,grayColor:f=(n==null?void 0:n.resolvedGrayColor)??Rs.grayColor.default,panelBackground:h=(n==null?void 0:n.panelBackground)??Rs.panelBackground.default,radius:p=(n==null?void 0:n.radius)??Rs.radius.default,scaling:g=(n==null?void 0:n.scaling)??Rs.scaling.default,onAppearanceChange:v=zc,onAccentColorChange:y=zc,onGrayColorChange:b=zc,onPanelBackgroundChange:x=zc,onRadiusChange:k=zc,onScalingChange:S=zc,...E}=e,C=r?Jl:"div",N=f==="auto"?GV(d):f,M=e.appearance==="light"||e.appearance==="dark",T=i===void 0?a||M:i;return s.createElement(ch.Provider,{value:s.useMemo(()=>({appearance:c,accentColor:d,grayColor:f,resolvedGrayColor:N,panelBackground:h,radius:p,scaling:g,onAppearanceChange:v,onAccentColorChange:y,onGrayColorChange:b,onPanelBackgroundChange:x,onRadiusChange:k,onScalingChange:S}),[c,d,f,N,h,p,g,v,y,b,x,k,S])},s.createElement(C,{"data-is-root-theme":a?"true":"false","data-accent-color":d,"data-gray-color":N,"data-has-background":T?"true":"false","data-panel-background":h,"data-radius":p,"data-scaling":g,ref:t,...E,className:Ft("radix-themes",{light:c==="light",dark:c==="dark"},E.className)}))});E6.displayName="ThemeImpl";const Xo=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},z0=e=>s.createElement(oO,{...e});z0.displayName="AlertDialog.Root";const K9=s.forwardRef(({children:e,...t},n)=>s.createElement(iO,{...t,ref:n,asChild:!0},Xo(e)));K9.displayName="AlertDialog.Trigger";const B0=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=F9,{className:i}=gr({align:e},{align:r}),{className:c,forceMount:d,container:f,...h}=gr(t,a);return s.createElement(lO,{container:f,forceMount:d},s.createElement($a,{asChild:!0},s.createElement(cO,{className:"rt-BaseDialogOverlay rt-AlertDialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-AlertDialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${i}`},s.createElement(uO,{...h,ref:n,className:Ft("rt-BaseDialogContent","rt-AlertDialogContent",c)}))))))});B0.displayName="AlertDialog.Content";const U0=s.forwardRef((e,t)=>s.createElement(hO,{asChild:!0},s.createElement(k6,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));U0.displayName="AlertDialog.Title";const W0=s.forwardRef((e,t)=>s.createElement(pO,{asChild:!0},s.createElement(Vl,{as:"p",size:"3",...e,asChild:!1,ref:t})));W0.displayName="AlertDialog.Description";const G0=s.forwardRef(({children:e,...t},n)=>s.createElement(dO,{...t,ref:n,asChild:!0},Xo(e)));G0.displayName="AlertDialog.Action";const K0=s.forwardRef(({children:e,...t},n)=>s.createElement(fO,{...t,ref:n,asChild:!0},Xo(e)));K0.displayName="AlertDialog.Cancel";function YV(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 qV=["1","2","3"],XV=["solid","soft","surface","outline"],QV={...Ta,size:{type:"enum",className:"rt-r-size",values:qV,default:"1",responsive:!0},variant:{type:"enum",className:"rt-variant",values:XV,default:"soft"},...b6,...cc,...hp},Y9=s.forwardRef((e,t)=>{const{asChild:n,className:r,color:a,radius:i,...c}=gr(e,QV,fo),d=n?Jl:"span";return s.createElement(d,{"data-accent-color":a,"data-radius":i,...c,ref:t,className:Ft("rt-reset","rt-Badge",r)})});Y9.displayName="Badge";const q9=Jl,JV=["div","span"],eZ=["none","inline","inline-block","block","contents"],tZ={as:{type:"enum",values:JV,default:"div"},...Ta,display:{type:"enum",className:"rt-r-display",values:eZ,responsive:!0}},yl=["0","1","2","3","4","5","6","7","8","9"],nZ={p:{type:"enum | string",className:"rt-r-p",customProperties:["--p"],values:yl,responsive:!0},px:{type:"enum | string",className:"rt-r-px",customProperties:["--pl","--pr"],values:yl,responsive:!0},py:{type:"enum | string",className:"rt-r-py",customProperties:["--pt","--pb"],values:yl,responsive:!0},pt:{type:"enum | string",className:"rt-r-pt",customProperties:["--pt"],values:yl,responsive:!0},pr:{type:"enum | string",className:"rt-r-pr",customProperties:["--pr"],values:yl,responsive:!0},pb:{type:"enum | string",className:"rt-r-pb",customProperties:["--pb"],values:yl,responsive:!0},pl:{type:"enum | string",className:"rt-r-pl",customProperties:["--pl"],values:yl,responsive:!0}},Q2=["visible","hidden","clip","scroll","auto"],rZ=["static","relative","absolute","fixed","sticky"],Nd=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],sZ=["0","1"],aZ=["0","1"],oZ=["start","center","end","baseline","stretch"],iZ=["start","center","end","baseline","stretch"],X9={...nZ,...Ja,...w6,position:{type:"enum",className:"rt-r-position",values:rZ,responsive:!0},inset:{type:"enum | string",className:"rt-r-inset",customProperties:["--inset"],values:Nd,responsive:!0},top:{type:"enum | string",className:"rt-r-top",customProperties:["--top"],values:Nd,responsive:!0},right:{type:"enum | string",className:"rt-r-right",customProperties:["--right"],values:Nd,responsive:!0},bottom:{type:"enum | string",className:"rt-r-bottom",customProperties:["--bottom"],values:Nd,responsive:!0},left:{type:"enum | string",className:"rt-r-left",customProperties:["--left"],values:Nd,responsive:!0},overflow:{type:"enum",className:"rt-r-overflow",values:Q2,responsive:!0},overflowX:{type:"enum",className:"rt-r-ox",values:Q2,responsive:!0},overflowY:{type:"enum",className:"rt-r-oy",values:Q2,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:sZ,responsive:!0},flexGrow:{type:"enum | string",className:"rt-r-fg",customProperties:["--flex-grow"],values:aZ,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:oZ,responsive:!0},justifySelf:{type:"enum",className:"rt-r-js",values:iZ,responsive:!0}},Qd=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=gr(e,tZ,X9,fo);return s.createElement(r?q9:a,{...i,ref:t,className:Ft("rt-Box",n)})});Qd.displayName="Box";const lZ=["1","2","3","4"],cZ=["classic","solid","soft","surface","outline","ghost"],vx={...Ta,size:{type:"enum",className:"rt-r-size",values:lZ,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:cZ,default:"solid"},...b6,...cc,...hp,loading:{type:"boolean",className:"rt-loading",default:!1}},J2=["0","1","2","3","4","5","6","7","8","9"],uZ={gap:{type:"enum | string",className:"rt-r-gap",customProperties:["--gap"],values:J2,responsive:!0},gapX:{type:"enum | string",className:"rt-r-cg",customProperties:["--column-gap"],values:J2,responsive:!0},gapY:{type:"enum | string",className:"rt-r-rg",customProperties:["--row-gap"],values:J2,responsive:!0}},dZ=["div","span"],fZ=["none","inline-flex","flex"],hZ=["row","column","row-reverse","column-reverse"],pZ=["start","center","end","baseline","stretch"],mZ=["start","center","end","between"],gZ=["nowrap","wrap","wrap-reverse"],vZ={as:{type:"enum",values:dZ,default:"div"},...Ta,display:{type:"enum",className:"rt-r-display",values:fZ,responsive:!0},direction:{type:"enum",className:"rt-r-fd",values:hZ,responsive:!0},align:{type:"enum",className:"rt-r-ai",values:pZ,responsive:!0},justify:{type:"enum",className:"rt-r-jc",values:mZ,parseValue:yZ,responsive:!0},wrap:{type:"enum",className:"rt-r-fw",values:gZ,responsive:!0},...uZ};function yZ(e){return e==="between"?"space-between":e}const vs=s.forwardRef((e,t)=>{const{className:n,asChild:r,as:a="div",...i}=gr(e,vZ,X9,fo);return s.createElement(r?q9:a,{...i,ref:t,className:Ft("rt-Flex",n)})});vs.displayName="Flex";const wZ=["1","2","3"],bZ={size:{type:"enum",className:"rt-r-size",values:wZ,default:"2",responsive:!0},loading:{type:"boolean",default:!0}},wr=s.forwardRef((e,t)=>{const{className:n,children:r,loading:a,...i}=gr(e,bZ,fo);if(!a)return r;const c=s.createElement("span",{...i,ref:t,className:Ft("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?c:s.createElement(vs,{asChild:!0,position:"relative",align:"center",justify:"center"},s.createElement("span",null,s.createElement("span",{"aria-hidden":!0,style:{display:"contents",visibility:"hidden"},inert:void 0},r),s.createElement(vs,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,c))))});wr.displayName="Spinner";const xZ=hS;function Q9(e,t){if(e!==void 0)return typeof e=="string"?t(e):Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r)]))}function kZ(e){return e==="3"?"3":"2"}function SZ(e){switch(e){case"1":return"1";case"2":case"3":return"2";case"4":return"3"}}const J9=s.forwardRef((e,t)=>{const{size:n=vx.size.default}=e,{className:r,children:a,asChild:i,color:c,radius:d,disabled:f=e.loading,...h}=gr(e,vx,fo),p=i?Jl:"button";return s.createElement(p,{"data-disabled":f||void 0,"data-accent-color":c,"data-radius":d,...h,ref:t,className:Ft("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(xZ,null,a),s.createElement(vs,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},s.createElement("span",null,s.createElement(wr,{size:Q9(n,SZ)})))):a)});J9.displayName="BaseButton";const ra=s.forwardRef(({className:e,...t},n)=>s.createElement(J9,{...t,ref:n,className:Ft("rt-Button",e)}));ra.displayName="Button";const EZ=["1","2","3"],CZ=["soft","surface","outline"],yx={...Ta,size:{type:"enum",className:"rt-r-size",values:EZ,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:CZ,default:"soft"},...b6,...cc},e7=s.createContext({}),j8=s.forwardRef((e,t)=>{const{size:n=yx.size.default}=e,{asChild:r,children:a,className:i,color:c,...d}=gr(e,yx,fo),f=r?Jl:"div";return s.createElement(f,{"data-accent-color":c,...d,className:Ft("rt-CalloutRoot",i),ref:t},s.createElement(e7.Provider,{value:s.useMemo(()=>({size:n}),[n])},a))});j8.displayName="Callout.Root";const jZ=s.forwardRef(({className:e,...t},n)=>s.createElement("div",{...t,className:Ft("rt-CalloutIcon",e),ref:n}));jZ.displayName="Callout.Icon";const A8=s.forwardRef(({className:e,...t},n)=>{const{size:r}=s.useContext(e7);return s.createElement(Vl,{as:"p",size:Q9(r,kZ),...t,asChild:!1,ref:n,className:Ft("rt-CalloutText",e)})});A8.displayName="Callout.Text";const AZ=Ln.forwardRef((e,t)=>Ln.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},Ln.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"})));AZ.displayName="ThickDividerHorizontalIcon";const Zu=Ln.forwardRef((e,t)=>Ln.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},Ln.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"})));Zu.displayName="ThickCheckIcon";const t7=Ln.forwardRef((e,t)=>Ln.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},Ln.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"})));t7.displayName="ChevronDownIcon";const C6=Ln.forwardRef((e,t)=>Ln.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},Ln.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"})));C6.displayName="ThickChevronRightIcon";const NZ=["1","2","3"],Md={...Ta,size:{values:NZ,default:"1"},...hp,scrollbars:{default:"both"}};function MZ(e){const{m:t,mx:n,my:r,mt:a,mr:i,mb:c,ml:d,...f}=e;return{m:t,mx:n,my:r,mt:a,mr:i,mb:c,ml:d,rest:f}}const wl=fo.m.values;function RZ(e){const[t,n]=wi({className:"rt-r-m",customProperties:["--margin"],propValues:wl,value:e.m}),[r,a]=wi({className:"rt-r-mx",customProperties:["--margin-left","--margin-right"],propValues:wl,value:e.mx}),[i,c]=wi({className:"rt-r-my",customProperties:["--margin-top","--margin-bottom"],propValues:wl,value:e.my}),[d,f]=wi({className:"rt-r-mt",customProperties:["--margin-top"],propValues:wl,value:e.mt}),[h,p]=wi({className:"rt-r-mr",customProperties:["--margin-right"],propValues:wl,value:e.mr}),[g,v]=wi({className:"rt-r-mb",customProperties:["--margin-bottom"],propValues:wl,value:e.mb}),[y,b]=wi({className:"rt-r-ml",customProperties:["--margin-left"],propValues:wl,value:e.ml});return[Ft(t,r,i,d,h,g,y),lh(n,a,c,f,p,v,b)]}const Y0=s.forwardRef((e,t)=>{const{rest:n,...r}=MZ(e),[a,i]=RZ(r),{asChild:c,children:d,className:f,style:h,type:p,scrollHideDelay:g=p!=="scroll"?0:void 0,dir:v,size:y=Md.size.default,radius:b=Md.radius.default,scrollbars:x=Md.scrollbars.default,...k}=n;return s.createElement(E9,{type:p,scrollHideDelay:g,className:Ft("rt-ScrollAreaRoot",a,f),style:lh(i,h),asChild:c},YV({asChild:c,children:d},S=>s.createElement(s.Fragment,null,s.createElement(C9,{...k,ref:t,className:"rt-ScrollAreaViewport"},S),s.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),x!=="vertical"?s.createElement(x8,{"data-radius":b,orientation:"horizontal",className:Ft("rt-ScrollAreaScrollbar",ih({className:"rt-r-size",value:y,propValues:Md.size.values}))},s.createElement(k8,{className:"rt-ScrollAreaThumb"})):null,x!=="horizontal"?s.createElement(x8,{"data-radius":b,orientation:"vertical",className:Ft("rt-ScrollAreaScrollbar",ih({className:"rt-r-size",value:y,propValues:Md.size.values}))},s.createElement(k8,{className:"rt-ScrollAreaThumb"})):null,x==="both"?s.createElement(E_,{className:"rt-ScrollAreaCorner"}):null)))});Y0.displayName="ScrollArea";const PZ=["1","2"],LZ=["solid","soft"],Xa={size:{type:"enum",className:"rt-r-size",values:PZ,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:LZ,default:"solid"},...Yi,...cc},n7={...Ta,...Yi},r7={...Yi},s7={...Yi},pp=e=>s.createElement(WI,{...e});pp.displayName="ContextMenu.Root";const mp=s.forwardRef(({children:e,...t},n)=>s.createElement(GI,{...t,ref:n,asChild:!0},Xo(e)));mp.displayName="ContextMenu.Trigger";const a7=s.createContext({}),gp=s.forwardRef((e,t)=>{const n=S6(),{size:r=Xa.size.default,variant:a=Xa.variant.default,highContrast:i=Xa.highContrast.default}=e,{className:c,children:d,color:f,container:h,forceMount:p,...g}=gr(e,Xa),v=f||n.accentColor;return s.createElement(i9,{container:h,forceMount:p},s.createElement($a,{asChild:!0},s.createElement(KI,{"data-accent-color":v,alignOffset:-Number(r)*4,collisionPadding:10,...g,asChild:!1,ref:t,className:Ft("rt-PopperContent","rt-BaseMenuContent","rt-ContextMenuContent",c)},s.createElement(Y0,{type:"auto"},s.createElement("div",{className:Ft("rt-BaseMenuViewport","rt-ContextMenuViewport")},s.createElement(a7.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:v,highContrast:i}),[r,a,v,i])},d))))))});gp.displayName="ContextMenu.Content";const TZ=s.forwardRef(({className:e,...t},n)=>s.createElement(qI,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuLabel","rt-ContextMenuLabel",e)}));TZ.displayName="ContextMenu.Label";const Si=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=n7.color.default,shortcut:i,...c}=e;return s.createElement(XI,{"data-accent-color":a,...c,ref:t,className:Ft("rt-reset","rt-BaseMenuItem","rt-ContextMenuItem",n)},s.createElement(Uh,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},i))});Si.displayName="ContextMenu.Item";const $Z=s.forwardRef(({className:e,...t},n)=>s.createElement(YI,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuGroup","rt-ContextMenuGroup",e)}));$Z.displayName="ContextMenu.Group";const DZ=s.forwardRef(({className:e,...t},n)=>s.createElement(JI,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuRadioGroup","rt-ContextMenuRadioGroup",e)}));DZ.displayName="ContextMenu.RadioGroup";const OZ=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=s7.color.default,...i}=e;return s.createElement(eF,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Ft("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-ContextMenuItem","rt-ContextMenuRadioItem",r)},s.createElement(Uh,null,n),s.createElement(l9,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(Zu,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})))});OZ.displayName="ContextMenu.RadioItem";const HZ=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=r7.color.default,...c}=e;return s.createElement(QI,{...c,asChild:!1,ref:t,"data-accent-color":i,className:Ft("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-ContextMenuItem","rt-ContextMenuCheckboxItem",r)},s.createElement(Uh,null,n),s.createElement(l9,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},s.createElement(Zu,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},a))});HZ.displayName="ContextMenu.CheckboxItem";const IZ=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(nF,{...a,asChild:!1,ref:t,className:Ft("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-ContextMenuItem","rt-ContextMenuSubTrigger",n)},r,s.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},s.createElement(C6,{className:"rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon"})))});IZ.displayName="ContextMenu.SubTrigger";const FZ=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(a7),{className:c,children:d,container:f,forceMount:h,...p}=gr({size:n,variant:r,color:a,highContrast:i,...e},Xa);return s.createElement(i9,{container:f,forceMount:h},s.createElement($a,{asChild:!0},s.createElement(rF,{"data-accent-color":a,alignOffset:-Number(n)*4,sideOffset:1,collisionPadding:10,...p,asChild:!1,ref:t,className:Ft("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-ContextMenuContent","rt-ContextMenuSubContent",c)},s.createElement(Y0,{type:"auto"},s.createElement("div",{className:Ft("rt-BaseMenuViewport","rt-ContextMenuViewport")},d)))))});FZ.displayName="ContextMenu.SubContent";const j6=s.forwardRef(({className:e,...t},n)=>s.createElement(tF,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuSeparator","rt-ContextMenuSeparator",e)}));j6.displayName="ContextMenu.Separator";const A6=e=>s.createElement(ec,{...e,modal:!0});A6.displayName="Dialog.Root";const _Z=s.forwardRef(({children:e,...t},n)=>s.createElement(Bv,{...t,ref:n,asChild:!0},Xo(e)));_Z.displayName="Dialog.Trigger";const N6=s.forwardRef(({align:e,...t},n)=>{const{align:r,...a}=F9,{className:i}=gr({align:e},{align:r}),{className:c,forceMount:d,container:f,...h}=gr(t,a);return s.createElement(tc,{container:f,forceMount:d},s.createElement($a,{asChild:!0},s.createElement(nc,{className:"rt-BaseDialogOverlay rt-DialogOverlay"},s.createElement("div",{className:"rt-BaseDialogScroll rt-DialogScroll"},s.createElement("div",{className:`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${i}`},s.createElement(rc,{...h,ref:n,className:Ft("rt-BaseDialogContent","rt-DialogContent",c)}))))))});N6.displayName="Dialog.Content";const M6=s.forwardRef((e,t)=>s.createElement(sc,{asChild:!0},s.createElement(k6,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));M6.displayName="Dialog.Title";const VZ=s.forwardRef((e,t)=>s.createElement(Uv,{asChild:!0},s.createElement(Vl,{as:"p",size:"3",...e,asChild:!1,ref:t})));VZ.displayName="Dialog.Description";const ZZ=s.forwardRef(({children:e,...t},n)=>s.createElement(Yh,{...t,ref:n,asChild:!0},Xo(e)));ZZ.displayName="Dialog.Close";const Ds=e=>s.createElement(SF,{...e});Ds.displayName="DropdownMenu.Root";const Os=s.forwardRef(({children:e,...t},n)=>s.createElement(EF,{...t,ref:n,asChild:!0},Xo(e)));Os.displayName="DropdownMenu.Trigger";const o7=s.createContext({}),Hs=s.forwardRef((e,t)=>{const n=S6(),{size:r=Xa.size.default,variant:a=Xa.variant.default,highContrast:i=Xa.highContrast.default}=e,{className:c,children:d,color:f,container:h,forceMount:p,...g}=gr(e,Xa),v=f||n.accentColor;return s.createElement(u9,{container:h,forceMount:p},s.createElement($a,{asChild:!0},s.createElement(CF,{"data-accent-color":v,align:"start",sideOffset:4,collisionPadding:10,...g,asChild:!1,ref:t,className:Ft("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",c)},s.createElement(Y0,{type:"auto"},s.createElement("div",{className:Ft("rt-BaseMenuViewport","rt-DropdownMenuViewport")},s.createElement(o7.Provider,{value:s.useMemo(()=>({size:r,variant:a,color:v,highContrast:i}),[r,a,v,i])},d))))))});Hs.displayName="DropdownMenu.Content";const zZ=s.forwardRef(({className:e,...t},n)=>s.createElement(AF,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuLabel","rt-DropdownMenuLabel",e)}));zZ.displayName="DropdownMenu.Label";const In=s.forwardRef((e,t)=>{const{className:n,children:r,color:a=n7.color.default,shortcut:i,...c}=e;return s.createElement(NF,{"data-accent-color":a,...c,ref:t,className:Ft("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",n)},s.createElement(Uh,null,r),i&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});In.displayName="DropdownMenu.Item";const BZ=s.forwardRef(({className:e,...t},n)=>s.createElement(jF,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuGroup","rt-DropdownMenuGroup",e)}));BZ.displayName="DropdownMenu.Group";const uh=s.forwardRef(({className:e,...t},n)=>s.createElement(RF,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e)}));uh.displayName="DropdownMenu.RadioGroup";const au=s.forwardRef((e,t)=>{const{children:n,className:r,color:a=s7.color.default,...i}=e;return s.createElement(PF,{...i,asChild:!1,ref:t,"data-accent-color":a,className:Ft("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",r)},n,s.createElement(d9,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(Zu,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});au.displayName="DropdownMenu.RadioItem";const UZ=s.forwardRef((e,t)=>{const{children:n,className:r,shortcut:a,color:i=r7.color.default,...c}=e;return s.createElement(MF,{...c,asChild:!1,ref:t,"data-accent-color":i,className:Ft("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",r)},n,s.createElement(d9,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},s.createElement(Zu,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),a&&s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},a))});UZ.displayName="DropdownMenu.CheckboxItem";const WZ=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(TF,{...a,asChild:!1,ref:t,className:Ft("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",n)},r,s.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s.createElement(C6,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});WZ.displayName="DropdownMenu.SubTrigger";const GZ=s.forwardRef((e,t)=>{const{size:n,variant:r,color:a,highContrast:i}=s.useContext(o7),{className:c,children:d,container:f,forceMount:h,...p}=gr({size:n,variant:r,color:a,highContrast:i,...e},Xa);return s.createElement(u9,{container:f,forceMount:h},s.createElement($a,{asChild:!0},s.createElement($F,{"data-accent-color":a,alignOffset:-Number(n)*4,sideOffset:1,collisionPadding:10,...p,asChild:!1,ref:t,className:Ft("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",c)},s.createElement(Y0,{type:"auto"},s.createElement("div",{className:Ft("rt-BaseMenuViewport","rt-DropdownMenuViewport")},d)))))});GZ.displayName="DropdownMenu.SubContent";const Eu=s.forwardRef(({className:e,...t},n)=>s.createElement(LF,{...t,asChild:!1,ref:n,className:Ft("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e)}));Eu.displayName="DropdownMenu.Separator";const KZ=["1","2","3","4"],YZ={...Ta,size:{type:"enum",className:"rt-r-size",values:KZ,default:"2",responsive:!0},width:Ja.width,minWidth:Ja.minWidth,maxWidth:{...Ja.maxWidth,default:"480px"},...w6},Cu=e=>s.createElement(t_,{...e});Cu.displayName="Popover.Root";const ju=s.forwardRef(({children:e,...t},n)=>s.createElement(r_,{...t,ref:n,asChild:!0},Xo(e)));ju.displayName="Popover.Trigger";const Au=s.forwardRef((e,t)=>{const{className:n,forceMount:r,container:a,...i}=gr(e,YZ);return s.createElement(s_,{container:a,forceMount:r},s.createElement($a,{asChild:!0},s.createElement(a_,{align:"start",sideOffset:8,collisionPadding:10,...i,ref:t,className:Ft("rt-PopperContent","rt-PopoverContent",n)})))});Au.displayName="Popover.Content";const qZ=s.forwardRef(({children:e,...t},n)=>s.createElement(o_,{...t,ref:n,asChild:!0},Xo(e)));qZ.displayName="Popover.Close";const XZ=s.forwardRef(({children:e,...t},n)=>s.createElement(n_,{...t,ref:n}));XZ.displayName="Popover.Anchor";const QZ=["1","2","3"],R6={size:{type:"enum",className:"rt-r-size",values:QZ,default:"2",responsive:!0}},JZ=["classic","surface","soft","ghost"],ez={variant:{type:"enum",className:"rt-variant",values:JZ,default:"surface"},...Yi,...hp,placeholder:{type:"string"}},tz=["solid","soft"],nz={variant:{type:"enum",className:"rt-variant",values:tz,default:"solid"},...Yi,...cc},P6=s.createContext({}),i7=e=>{const{children:t,size:n=R6.size.default,...r}=e;return s.createElement(L_,{...r},s.createElement(P6.Provider,{value:s.useMemo(()=>({size:n}),[n])},t))};i7.displayName="Select.Root";const l7=s.forwardRef((e,t)=>{const n=s.useContext(P6),{children:r,className:a,color:i,radius:c,placeholder:d,...f}=gr({size:n==null?void 0:n.size,...e},{size:R6.size},ez,fo);return s.createElement($_,{asChild:!0},s.createElement("button",{"data-accent-color":i,"data-radius":c,...f,ref:t,className:Ft("rt-reset","rt-SelectTrigger",a)},s.createElement("span",{className:"rt-SelectTriggerInner"},s.createElement(O_,{placeholder:d},r)),s.createElement(H_,{asChild:!0},s.createElement(t7,{className:"rt-SelectIcon"}))))});l7.displayName="Select.Trigger";const c7=s.forwardRef((e,t)=>{const n=s.useContext(P6),{className:r,children:a,color:i,container:c,...d}=gr({size:n==null?void 0:n.size,...e},{size:R6.size},nz),f=S6(),h=i||f.accentColor;return s.createElement(V_,{container:c},s.createElement($a,{asChild:!0},s.createElement(Z_,{"data-accent-color":h,sideOffset:4,...d,asChild:!1,ref:t,className:Ft({"rt-PopperContent":d.position==="popper"},"rt-SelectContent",r)},s.createElement(E9,{type:"auto",className:"rt-ScrollAreaRoot"},s.createElement(Y_,{asChild:!0,className:"rt-SelectViewport"},s.createElement(C9,{className:"rt-ScrollAreaViewport",style:{overflowY:void 0}},a)),s.createElement(x8,{className:"rt-ScrollAreaScrollbar rt-r-size-1",orientation:"vertical"},s.createElement(k8,{className:"rt-ScrollAreaThumb"}))))))});c7.displayName="Select.Content";const u7=s.forwardRef((e,t)=>{const{className:n,children:r,...a}=e;return s.createElement(rV,{...a,asChild:!1,ref:t,className:Ft("rt-SelectItem",n)},s.createElement(oV,{className:"rt-SelectItemIndicator"},s.createElement(Zu,{className:"rt-SelectItemIndicatorIcon"})),s.createElement(sV,null,r))});u7.displayName="Select.Item";const rz=s.forwardRef(({className:e,...t},n)=>s.createElement(J_,{...t,asChild:!1,ref:n,className:Ft("rt-SelectGroup",e)}));rz.displayName="Select.Group";const sz=s.forwardRef(({className:e,...t},n)=>s.createElement(tV,{...t,asChild:!1,ref:n,className:Ft("rt-SelectLabel",e)}));sz.displayName="Select.Label";const az=s.forwardRef(({className:e,...t},n)=>s.createElement(iV,{...t,asChild:!1,ref:n,className:Ft("rt-SelectSeparator",e)}));az.displayName="Select.Separator";const oz={content:{type:"ReactNode",required:!0},width:Ja.width,minWidth:Ja.minWidth,maxWidth:{...Ja.maxWidth,default:"360px"}},L6=s.forwardRef((e,t)=>{const{children:n,className:r,open:a,defaultOpen:i,onOpenChange:c,delayDuration:d,disableHoverableContent:f,content:h,container:p,forceMount:g,...v}=gr(e,oz),y={open:a,defaultOpen:i,onOpenChange:c,delayDuration:d,disableHoverableContent:f};return s.createElement(jV,{...y},s.createElement(AV,{asChild:!0},n),s.createElement(NV,{container:p,forceMount:g},s.createElement($a,{asChild:!0},s.createElement(MV,{sideOffset:4,collisionPadding:10,...v,asChild:!1,ref:t,className:Ft("rt-TooltipContent",r)},s.createElement(Vl,{as:"p",className:"rt-TooltipText",size:"1"},h),s.createElement(RV,{className:"rt-TooltipArrow"})))))});L6.displayName="Tooltip";const Wr={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"};function d7(e,t){try{const n=localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}}const N8="scenri:pref-changed";function f7(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}try{window.dispatchEvent(new CustomEvent(N8,{detail:{key:e,value:t}}))}catch{}}function M8(e,t){try{const n=localStorage.getItem(e);return n===null?null:(localStorage.setItem(t,n),localStorage.removeItem(e),n)}catch{return null}}function Na(e,t){const[n,r]=s.useState(()=>d7(e,t)),a=s.useRef(n);return s.useEffect(()=>{Object.is(a.current,n)||(a.current=n,f7(e,n))},[e,n]),s.useEffect(()=>{const i=c=>{const d=c.detail;(d==null?void 0:d.key)===e&&r(f=>Object.is(f,d.value)?f:d.value)};return window.addEventListener(N8,i),()=>window.removeEventListener(N8,i)},[e]),[n,r]}function iz(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 eg(e,t){const[n,r]=Na(e,t),[a,i]=s.useState(null);return[a??n,d=>{i(null),r(d)},i]}const lz=()=>d7(Wr.lastBrand,null),cz=e=>f7(Wr.lastBrand,e),R8="sc-theme",uz="bt-theme",dz=()=>window.matchMedia("(prefers-color-scheme: light)").matches,h7=s.createContext({choice:"system",mode:"dark",setChoice:()=>{},toggle:()=>{}}),fz=()=>s.useContext(h7);function hz(){const e=localStorage.getItem(R8)??M8(uz,R8);return e==="light"||e==="dark"||e==="system"?e:"system"}function pz({children:e}){const[t,n]=s.useState(hz),[r,a]=s.useState(()=>dz()?"light":"dark");s.useEffect(()=>{const d=window.matchMedia("(prefers-color-scheme: light)"),f=()=>a(d.matches?"light":"dark");return d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[]);const i=t==="system"?r:t;s.useEffect(()=>{document.documentElement.dataset.theme=i,localStorage.setItem(R8,t)},[i,t]);const c=s.useMemo(()=>({choice:t,mode:i,setChoice:n,toggle:()=>n(i==="dark"?"light":"dark")}),[t,i]);return o.jsx(h7.Provider,{value:c,children:o.jsx($a,{appearance:i,accentColor:"gray",grayColor:"gray",radius:"large",scaling:"100%",children:e})})}const mz=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"}))]]),gz=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"}))]]),vz=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"}))]]),yz=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"}))]]),wz=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"}))]]),bz=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"}))]]),xz=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"}))]]),kz=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"}))]]),Sz=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"}))]]),Ez=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"}))]]),Cz=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"}))]]),jz=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"}))]]),Az=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"}))]]),Nz=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,28H72A20,20,0,0,0,52,48V224a12,12,0,0,0,18.36,10.18l57.63-36,57.65,36A12,12,0,0,0,204,224V48A20,20,0,0,0,184,28Zm-4,174.35-45.65-28.53a12,12,0,0,0-12.72,0L76,202.35V52H180Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M192,48V224l-64-40L64,224V48a8,8,0,0,1,8-8H184A8,8,0,0,1,192,48Z",opacity:"0.2"}),s.createElement("path",{d:"M184,32H72A16,16,0,0,0,56,48V224a8,8,0,0,0,12.24,6.78L128,193.43l59.77,37.35A8,8,0,0,0,200,224V48A16,16,0,0,0,184,32Zm0,177.57-51.77-32.35a8,8,0,0,0-8.48,0L72,209.57V48H184Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,32H72A16,16,0,0,0,56,48V224a8,8,0,0,0,12.24,6.78L128,193.43l59.77,37.35A8,8,0,0,0,200,224V48A16,16,0,0,0,184,32Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,34H72A14,14,0,0,0,58,48V224a6,6,0,0,0,9.18,5.09l60.81-38,60.83,38A6,6,0,0,0,198,224V48A14,14,0,0,0,184,34Zm2,179.17-54.83-34.26a6,6,0,0,0-6.36,0L70,213.17V48a2,2,0,0,1,2-2H184a2,2,0,0,1,2,2Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,32H72A16,16,0,0,0,56,48V224a8,8,0,0,0,12.24,6.78L128,193.43l59.77,37.35A8,8,0,0,0,200,224V48A16,16,0,0,0,184,32Zm0,177.57-51.77-32.35a8,8,0,0,0-8.48,0L72,209.57V48H184Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M184,36H72A12,12,0,0,0,60,48V224a4,4,0,0,0,6.12,3.39L128,188.72l61.89,38.67A4,4,0,0,0,192,228a4.06,4.06,0,0,0,1.94-.5A4,4,0,0,0,196,224V48A12,12,0,0,0,184,36Zm4,180.78-57.89-36.17a4,4,0,0,0-4.24,0L68,216.78V48a4,4,0,0,1,4-4H184a4,4,0,0,1,4,4Z"}))]]),Mz=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"}))]]),Rz=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"}))]]),Pz=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"}))]]),Lz=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"}))]]),Tz=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"}))]]),$z=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"}))]]),Dz=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"}))]]),Oz=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"}))]]),Hz=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"}))]]),Iz=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"}))]]),Fz=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"}))]]),_z=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"}))]]),Vz=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"}))]]),Zz=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"}))]]),zz=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"}))]]),Bz=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"}))]]),Uz=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"}))]]),Wz=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"}))]]),Gz=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"}))]]),Kz=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"}))]]),Yz=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"}))]]),qz=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"}))]]),Xz=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"}))]]),Qz=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"}))]]),Jz=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"}))]]),eB=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"}))]]),tB=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"}))]]),nB=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"}))]]),rB=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"}))]]),sB=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"}))]]),aB=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"}))]]),oB=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"}))]]),iB=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"}))]]),lB=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"}))]]),cB=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"}))]]),uB=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"}))]]),dB=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"}))]]),fB=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"}))]]),hB=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"}))]]),pB=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"}))]]),mB=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"}))]]),gB=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"}))]]),vB=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"}))]]),yB=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"}))]]),wB=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"}))]]),bB=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"}))]]),xB=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"}))]]),kB=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"}))]]),SB=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"}))]]),EB=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"}))]]),CB=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"}))]]),jB=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"}))]]),AB=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"}))]]),NB=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"}))]]),MB=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"}))]]),RB=s.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),Et=s.forwardRef((e,t)=>{const{alt:n,color:r,size:a,weight:i,mirrored:c,children:d,weights:f,...h}=e,{color:p="currentColor",size:g,weight:v="regular",mirrored:y=!1,...b}=s.useContext(RB);return s.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:a??g,height:a??g,fill:r??p,viewBox:"0 0 256 256",transform:c||y?"scale(-1, 1)":void 0,...b,...h},!!n&&s.createElement("title",null,n),d,f.get(i??v))});Et.displayName="IconBase";const p7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:mz}));p7.displayName="ApertureIcon";const m7=p7,g7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:gz}));g7.displayName="ArchiveIcon";const v7=g7,y7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:vz}));y7.displayName="ArrowCircleUpIcon";const w7=y7,b7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:yz}));b7.displayName="ArrowClockwiseIcon";const x7=b7,k7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:wz}));k7.displayName="ArrowCounterClockwiseIcon";const dh=k7,S7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:bz}));S7.displayName="ArrowLeftIcon";const T6=S7,E7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:xz}));E7.displayName="ArrowLineUpIcon";const PB=E7,C7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:kz}));C7.displayName="ArrowRightIcon";const Ka=C7,j7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Sz}));j7.displayName="ArrowSquareOutIcon";const vp=j7,A7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Ez}));A7.displayName="ArrowUpIcon";const N7=A7,M7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Cz}));M7.displayName="ArrowsClockwiseIcon";const P8=M7,R7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:jz}));R7.displayName="ArrowsDownUpIcon";const LB=R7,P7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Az}));P7.displayName="BellIcon";const tg=P7,L7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Nz}));L7.displayName="BookmarkSimpleIcon";const yp=L7,T7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Mz}));T7.displayName="CaretDownIcon";const _i=T7,$7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Rz}));$7.displayName="CaretLeftIcon";const Da=$7,D7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Pz}));D7.displayName="CaretRightIcon";const qi=D7,O7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Lz}));O7.displayName="CaretUpIcon";const TB=O7,H7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Tz}));H7.displayName="ChartBarIcon";const $B=H7,I7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:$z}));I7.displayName="CheckIcon";const nr=I7,F7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Dz}));F7.displayName="CircleIcon";const DB=F7,_7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Oz}));_7.displayName="CopyIcon";const L8=_7,V7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Hz}));V7.displayName="CopySimpleIcon";const wx=V7,Z7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Iz}));Z7.displayName="DotsThreeIcon";const $6=Z7,z7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Fz}));z7.displayName="DownloadSimpleIcon";const OB=z7,B7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:_z}));B7.displayName="FilmSlateIcon";const wp=B7,U7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Vz}));U7.displayName="FolderSimpleIcon";const W7=U7,G7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Zz}));G7.displayName="FrameCornersIcon";const HB=G7,K7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:zz}));K7.displayName="GearSixIcon";const IB=K7,Y7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Bz}));Y7.displayName="GiftIcon";const FB=Y7,q7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Uz}));q7.displayName="GithubLogoIcon";const _B=q7,X7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Wz}));X7.displayName="GraduationCapIcon";const VB=X7,Q7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Gz}));Q7.displayName="HandWavingIcon";const ZB=Q7,J7=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Kz}));J7.displayName="HouseIcon";const zB=J7,eC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Yz}));eC.displayName="IdentificationBadgeIcon";const bp=eC,tC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:qz}));tC.displayName="ImageSquareIcon";const Vs=tC,nC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Xz}));nC.displayName="InfinityIcon";const BB=nC,rC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Qz}));rC.displayName="InfoIcon";const xp=rC,sC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:Jz}));sC.displayName="KeyIcon";const aC=sC,oC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:eB}));oC.displayName="KeyboardIcon";const UB=oC,iC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:tB}));iC.displayName="LightningIcon";const v0=iC,lC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:nB}));lC.displayName="MagnifyingGlassIcon";const Nu=lC,cC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:rB}));cC.displayName="MegaphoneIcon";const WB=cC,uC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:sB}));uC.displayName="MinusIcon";const GB=uC,dC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:aB}));dC.displayName="MountainsIcon";const KB=dC,fC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:oB}));fC.displayName="PackageIcon";const kp=fC,hC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:iB}));hC.displayName="PaletteIcon";const YB=hC,pC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:lB}));pC.displayName="PaperclipIcon";const qB=pC,mC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:cB}));mC.displayName="PencilSimpleIcon";const q0=mC,gC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:uB}));gC.displayName="PlusIcon";const kr=gC,vC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:dB}));vC.displayName="PlusCircleIcon";const XB=vC,yC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:fB}));yC.displayName="PowerIcon";const QB=yC,wC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:hB}));wC.displayName="QuestionIcon";const JB=wC,bC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:pB}));bC.displayName="SidebarSimpleIcon";const eU=bC,xC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:mB}));xC.displayName="SlidersHorizontalIcon";const D6=xC,kC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:gB}));kC.displayName="StackIcon";const tU=kC,SC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:vB}));SC.displayName="StarIcon";const O6=SC,EC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:yB}));EC.displayName="StorefrontIcon";const CC=EC,jC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:wB}));jC.displayName="SunHorizonIcon";const AC=jC,NC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:bB}));NC.displayName="TrashIcon";const Sp=NC,MC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:xB}));MC.displayName="TrashSimpleIcon";const Ep=MC,RC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:kB}));RC.displayName="UploadSimpleIcon";const H6=RC,PC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:SB}));PC.displayName="UserIcon";const nU=PC,LC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:EB}));LC.displayName="UserCircleIcon";const rU=LC,TC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:CB}));TC.displayName="UserPlusIcon";const sU=TC,$C=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:jB}));$C.displayName="WarningIcon";const Cp=$C,DC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:AB}));DC.displayName="WarningCircleIcon";const uc=DC,OC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:NB}));OC.displayName="XIcon";const Cn=OC,HC=s.forwardRef((e,t)=>s.createElement(Et,{ref:t,...e,weights:MB}));HC.displayName="XCircleIcon";const aU=HC,IC=s.createContext({push:()=>{}}),Sr=()=>s.useContext(IC),oU=3,iU=140,Jd=e=>{var t;return!!(e.action||(t=e.actions)!=null&&t.length)},lU=e=>{var t;return((t=e.actions)!=null&&t.length?e.actions:e.action?[e.action]:[]).slice(0,2)};function ng(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=Jd(e)?9e3:4e3,r=Jd(e)?14e3:8e3;return Math.min(n+Math.max(0,t-40)*45,r)}function cU(e,t,n){const r=n>1?` (${n} times)`:"";return`${e}${r}${t?` ${t}`:""}`}const uU=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function dU({kind:e}){if(e==="info")return null;const t=e==="success"?nr:e==="warning"?Cp:uc;return o.jsx(t,{className:"sc-toast-ic",size:16,weight:"regular","aria-hidden":"true"})}function fU({children:e}){const[t,n]=s.useState([]),r=s.useRef(1),a=s.useRef([]),i=s.useRef(new Map),c=s.useRef(null),d=s.useRef(null),f=s.useRef(null),h=s.useRef(new Map),p=s.useCallback(E=>{a.current=E,n(E)},[]),g=s.useCallback(E=>{const C=E.kind==="error"?d.current:c.current;if(!C)return;const N=cU(E.title,E.detail,E.count);C.textContent=N,window.setTimeout(()=>{C.textContent===N&&(C.textContent="")},1e3)},[]),v=s.useCallback(E=>{const C=i.current.get(E);(C==null?void 0:C.handle)!=null&&window.clearTimeout(C.handle),i.current.delete(E),p(a.current.map(N=>N.id===E&&!N.leaving?{...N,leaving:!0}:N)),window.setTimeout(()=>p(a.current.filter(N=>N.id!==E)),iU+40)},[p]),y=s.useCallback((E,C)=>{if(!Number.isFinite(C))return;const N=i.current.get(E)??{remaining:C,since:0,handle:null};N.handle!=null&&window.clearTimeout(N.handle),N.remaining=C,N.since=Date.now(),N.handle=window.setTimeout(()=>v(E),C),i.current.set(E,N)},[v]),b=s.useCallback(E=>{const C=i.current.get(E);!C||C.handle==null||(window.clearTimeout(C.handle),C.handle=null,C.remaining=Math.max(0,C.remaining-(Date.now()-C.since)))},[]),x=s.useCallback(E=>{const C=i.current.get(E);!C||C.handle!=null||y(E,C.remaining)},[y]);s.useEffect(()=>{const E=()=>{const C=[...i.current.keys()];document.hidden?C.forEach(b):C.forEach(x)};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},[b,x]),s.useLayoutEffect(()=>{const E=f.current;if(!E)return;const C=new Map,N=!uU();for(const M of E.querySelectorAll("[data-toast-id]")){const T=Number(M.dataset.toastId),L=M.getBoundingClientRect().top;C.set(T,L);const A=h.current.get(T);if(!N||A===void 0||M.hasAttribute("data-leaving"))continue;const P=A-L;P&&(M.style.transition="none",M.style.transform=`translateY(${P}px)`,M.getBoundingClientRect(),M.style.transition="transform 160ms cubic-bezier(.2, .7, .3, 1)",M.style.transform="")}h.current=C},[t]);const k=s.useCallback(E=>{const C=a.current.filter(A=>!A.leaving),N=Jd(E)?void 0:C.find(A=>A.kind===E.kind&&A.title===E.title&&A.detail===E.detail&&!Jd(A));if(N){const A={...N,count:N.count+1};p(a.current.map($=>$.id===N.id?A:$));const P=i.current.get(N.id);P&&P.handle==null?P.remaining=ng(A):y(N.id,ng(A)),A.quiet||g(A);return}const M={...E,id:r.current++,count:1},T=[...a.current,M],L=A=>!A.leaving;for(;T.filter(L).length>oU;){let A=T.findIndex(H=>L(H)&&H.kind!=="error"&&!Jd(H));A===-1&&(A=T.findIndex(H=>L(H)&&H.kind!=="error")),A===-1&&(A=T.findIndex(L));const P=T.splice(A,1)[0],$=i.current.get(P.id);($==null?void 0:$.handle)!=null&&window.clearTimeout($.handle),i.current.delete(P.id)}p(T),y(M.id,ng(M)),M.quiet||g(M)},[g,y,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(IC.Provider,{value:S,children:[e,Mr.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:c,className:"sc-vh",role:"status","aria-live":"polite"}),o.jsx("div",{ref:d,className:"sc-vh","aria-live":"assertive","aria-atomic":"true"}),o.jsx("section",{className:"sc-toasts","aria-label":"Alerts",ref:f,onPointerDown:bx,onMouseDown:bx,children:t.map(E=>{const C=lU(E);return o.jsx("div",{className:"sc-toast-wrap","data-toast-id":E.id,"data-leaving":E.leaving||void 0,children:o.jsxs("article",{className:"sc-toast","data-kind":E.kind,onPointerEnter:()=>b(E.id),onPointerLeave:()=>x(E.id),onFocus:()=>b(E.id),onBlur:N=>{N.currentTarget.contains(N.relatedTarget)||x(E.id)},children:[o.jsx(dU,{kind:E.kind}),o.jsxs("div",{className:"sc-toast-body",children:[o.jsxs("div",{className:"sc-toast-top",children:[o.jsxs("div",{className:"sc-toast-txt",children:[o.jsxs("b",{children:[E.title,E.count>1?o.jsxs("span",{className:"sc-toast-n",children:["×",E.count]}):null]}),E.detail?o.jsx("small",{children:E.detail.slice(0,160)}):null]}),o.jsx("button",{type:"button",className:"sc-toast-x",onClick:()=>v(E.id),"aria-label":"Dismiss",children:o.jsx(Cn,{size:14,weight:"regular"})})]}),C.length?o.jsx("div",{className:"sc-toast-acts",children:C.map(N=>o.jsx("button",{type:"button",className:"sc-toast-act",onClick:()=>{N.onClick(),v(E.id)},children:N.label},N.label))}):null]})]})},E.id)})})]}),document.body)]})}function bx(e){e.stopPropagation(),e.type==="mousedown"&&e.target instanceof Element&&e.target.closest("button")&&e.preventDefault()}async function Ge(e,t,n,r,a){const i=await fetch(t,{method:e,signal:r,keepalive:a==null?void 0:a.keepalive,headers:n!==void 0?{"content-type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!i.ok){let c=`HTTP ${i.status}`;try{const d=await i.json();c=d.error??c,d.details&&(c+=`: ${d.details.join("; ")}`)}catch{}throw Object.assign(new Error(c),{status:i.status,method:e,url:t})}return i.json()}const hU=(e,t,n)=>Ge("DELETE",`/api/brands/${e}/${t}/${n}`),pU=(e,t)=>hU(e,"products",t);async function FC(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 mU=e=>`/api/brands/${e}/export`;async function gU(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 y0(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 vU(e,t){try{return fetch(`/api/brands/${e}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({brand:t,keepAssets:!0}),keepalive:!0}).then(n=>n.ok?n.json():null).catch(()=>null)}catch{return Promise.resolve(null)}}const Dr=e=>`/api/images/${e}`,Or=e=>e!=null&&e.startsWith("asset:")?Dr(e.slice(6)):null,_C={tile:640,small:320,micro:160},nn=(e,t)=>`${Dr(e)}/thumb?w=${_C[t]}`,jp=(e,t)=>e!=null&&e.startsWith("asset:")?nn(e.slice(6),t):null,yU=/^\/api\/images\/([a-f0-9]{32})(?:\/thumb\?w=\d+)?$/,wU=/^(\/api\/(?:presenter-avatars|presenter-thumbnails|scene-thumbnails|demo-product-thumbnails|showcase-previews)\/[a-z0-9-]+\.jpg)(?:\?v=(\d+))?(?:[?&]w=\d+)?$/;function tr(e,t){if(!e)return e;const n=yU.exec(e);if(n)return t==="full"?Dr(n[1]):nn(n[1],t);const r=wU.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=${_C[t]}`}function xx(e){return e.every(t=>t.kind==="root")}let VC=new Map;function bU(e){const t=new Map;for(const n of e)for(const r of n.legacyNames??[])r!==n.name&&t.set(r,n.name);VC=t}function xU(e){var r;const t=e.promptHead??"",n=(r=/^\[([^\]]+)\]/.exec(t))==null?void 0:r[1];if(n)return VC.get(n)??n;if(t.startsWith("Remove all overlaid marketing text")||t.startsWith("Remove ALL text"))return"Text lift"}function lr(e){const t=xU(e);return t||(e.promptHead??"").trim().split(/\s+/).slice(0,6).join(" ")||(e.kind==="edit"?"Edit":"Generation")}const ZC=[{id:"newest",label:"Newest first"},{id:"oldest",label:"Oldest first"},{id:"cost",label:"Highest cost"},{id:"keepers",label:"Keepers first"}];function kU(e){return ZC.some(t=>t.id===e)}const zC=[{id:"all",label:"All"},{id:"keepers",label:"Keepers"},{id:"archived",label:"Archived"}];function SU(e){return zC.some(t=>t.id===e)}function EU(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 T8(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 ou=(e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id),Me={brands:()=>Ge("GET","/api/brands"),createBrand:e=>Ge("POST","/api/brands",{brand:e}),brandFromUrl:e=>Ge("POST","/api/brands/from-url",{url:e}),updateBrand:(e,t)=>Ge("PUT",`/api/brands/${e}`,{brand:t,keepAssets:!0}),deleteBrand:e=>Ge("DELETE",`/api/brands/${e}`),guide:()=>Ge("GET","/api/guide"),guideIntent:e=>Ge("POST","/api/guide",e,void 0,{keepalive:!0}),refreshBrandFromUrl:(e,t)=>Ge("POST",`/api/brands/${e}/refresh-from-url`,t?{url:t}:{}),updateLogo:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/logos/${t}`,n),deleteLogo:(e,t)=>Ge("DELETE",`/api/brands/${e}/logos/${t}`),projects:e=>Ge("GET",`/api/projects?brandId=${encodeURIComponent(e)}`),createProject:(e,t)=>Ge("POST","/api/projects",{brandId:e,name:t}),tree:e=>Ge("GET",`/api/projects/${e}/tree`),activity:e=>Ge("GET",`/api/brands/${e}/activity`),workspace:e=>Ge("GET",`/api/brands/${e}/workspace`),feed:(e,t,n)=>Ge("GET",`/api/brands/${e}/feed${EU(t)}`,void 0,n),node:e=>Ge("GET",`/api/nodes/${e}`),lineage:e=>Ge("GET",`/api/nodes/${e}/lineage`),usage:e=>Ge("GET",`/api/brands/${e}/usage`),sets:e=>Ge("GET",`/api/brands/${e}/sets`),createSet:(e,t)=>Ge("POST",`/api/brands/${e}/sets`,{name:t}),renameSet:(e,t)=>Ge("PATCH",`/api/sets/${e}`,{name:t}),deleteSet:e=>Ge("DELETE",`/api/sets/${e}`),addToSet:(e,t)=>Ge("POST",`/api/sets/${e}/nodes`,{nodeIds:t}),removeFromSet:(e,t)=>Ge("DELETE",`/api/sets/${e}/nodes/${t}`),engines:()=>Ge("GET","/api/engines"),codexStatus:(e={})=>Ge("GET",`/api/engines/codex/status${e.force?"?force=1":""}`),repairCodexEnv:e=>Ge("POST","/api/engines/codex/repair-env",{keys:e}),restoreCodexEnv:()=>Ge("POST","/api/engines/codex/restore-env"),installCodex:()=>Ge("POST","/api/engines/codex/install"),loginCodex:()=>Ge("POST","/api/engines/codex/login"),setCap:(e,t)=>Ge("PUT","/api/caps",{engineId:e,capUsd:t}),addNode:e=>Ge("POST","/api/nodes",e),cancelNode:e=>Ge("POST",`/api/nodes/${e}/cancel`),retryNode:e=>Ge("POST",`/api/nodes/${e}/retry`),scenes:()=>Ge("GET","/api/scenes"),presenters:()=>Ge("GET","/api/presenters"),presenterFrames:e=>Ge("GET",`/api/presenter-previews/${e}`),demoProducts:()=>Ge("GET","/api/demo-products"),demoProductFrames:e=>Ge("GET",`/api/demo-product-previews/${e}`),showcase:()=>Ge("GET","/api/showcase"),previewBrief:(e,t,n,r)=>Ge("POST","/api/brief/preview",{brief:e,engineId:t,brandId:n,...r?{parentId:r}:{}}),keep:(e,t)=>Ge("POST",`/api/nodes/${e}/keep`,{kept:t}),archiveNode:(e,t)=>Ge("POST",`/api/nodes/${e}/archive`,{archived:t}),deleteNode:e=>Ge("DELETE",`/api/nodes/${e}`),deleteNodesBatch:e=>Ge("POST","/api/nodes/delete-batch",{nodeIds:e}),settings:()=>Ge("GET","/api/settings"),saveSettings:e=>Ge("PUT","/api/settings",e),costs:()=>Ge("GET","/api/costs/summary"),home:()=>Ge("GET","/api/home"),reveal:()=>Ge("POST","/api/system/reveal"),version:()=>Ge("GET","/api/version"),updateStatus:()=>Ge("GET","/api/update/status"),updateCheck:()=>Ge("POST","/api/update/check"),updateApply:()=>Ge("POST","/api/update/apply"),updateRestart:()=>Ge("POST","/api/update/restart"),desktop:()=>Ge("GET","/api/desktop"),desktopInstall:()=>Ge("POST","/api/desktop/install"),quit:()=>Ge("POST","/api/system/quit"),releaseNotes:()=>Ge("GET","/api/release/notes"),releaseSeen:e=>Ge("POST","/api/release/seen",{version:e}),sceneFrames:e=>Ge("GET",`/api/scene-previews/${e}`),deleteData:e=>Ge("DELETE",`/api/data?scope=${e}`),libraryProduct:(e,t)=>Ge("GET",`/api/brands/${e}/products-library/${encodeURIComponent(t)}`),productsLibrary:e=>Ge("GET",`/api/brands/${e}/products-library`),catalogImport:(e,t,n)=>Ge("POST",`/api/brands/${e}/catalog/import`,n?{url:t,urls:n}:{url:t}),catalogScan:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/scan`,t?{url:t}:{}),catalogDetails:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/details`,{urls:t}),catalogScanState:(e,t,n)=>Ge("GET",`/api/brands/${e}/catalog/scans/${t}`,void 0,n),cancelCatalogScan:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/scans/${t}/cancel`),catalogJob:(e,t)=>Ge("GET",`/api/brands/${e}/catalog/jobs/${t}`),catalogJobs:e=>Ge("GET",`/api/brands/${e}/catalog/jobs`),cancelCatalogJob:(e,t)=>Ge("POST",`/api/brands/${e}/catalog/jobs/${t}/cancel`),deleteCatalogProduct:(e,t)=>Ge("DELETE",`/api/brands/${e}/catalog/products/${t}`),updateProduct:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/products/${t}`,n),updateCatalogProduct:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/catalog/products/${t}`,n),productSize:(e,t)=>Ge("GET",`/api/brands/${e}/products/${t}/size`),setProductSize:(e,t,n)=>Ge("PUT",`/api/brands/${e}/products/${t}/size`,{size:n}),setProductShots:(e,t,n)=>Ge("PUT",`/api/brands/${e}/products/${t}/shots`,{files:n}),assetBuildCapabilities:()=>Ge("GET","/api/asset-builds/capabilities"),startAssetBuild:(e,t)=>Ge("POST",`/api/brands/${e}/asset-builds`,t),assetBuild:(e,t)=>Ge("GET",`/api/brands/${e}/asset-builds/${t}`),assetBuilds:e=>Ge("GET",`/api/brands/${e}/asset-builds`),cancelAssetBuild:(e,t)=>Ge("POST",`/api/brands/${e}/asset-builds/${t}/cancel`),deleteAssetBuild:(e,t)=>Ge("DELETE",`/api/brands/${e}/asset-builds/${t}`),createProduct:(e,t)=>Ge("POST",`/api/brands/${e}/products`,t),createPresenterDraft:(e,t)=>Ge("POST",`/api/brands/${e}/presenter-drafts`,t),presenterDrafts:e=>Ge("GET",`/api/brands/${e}/presenter-drafts`),presenterDraft:(e,t)=>Ge("GET",`/api/brands/${e}/presenter-drafts/${t}`),updatePresenterDraft:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/presenter-drafts/${t}`,n),generateDraftView:(e,t,n,r={})=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/generate`,r),approveDraftView:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/approve`),redoDraftView:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/redo`),revertDraftView:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/revert`),stopDraft:(e,t)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/stop`),restoreDraftView:(e,t,n,r)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/restore`,{hash:r}),placeDraftPhoto:(e,t,n,r)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/views/${n}/use-photo`,{hash:r}),savePresenterDraft:(e,t)=>Ge("POST",`/api/brands/${e}/presenter-drafts/${t}/save`),deletePresenterDraft:(e,t)=>Ge("DELETE",`/api/brands/${e}/presenter-drafts/${t}`),createPresenter:(e,t)=>Ge("POST",`/api/brands/${e}/presenters`,t),updatePresenter:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/presenters/${t}`,n),deletePresenter:(e,t)=>Ge("DELETE",`/api/brands/${e}/presenters/${t}`),duplicatePresenter:(e,t,n)=>Ge("POST",`/api/brands/${e}/presenters/${t}/duplicate`,{name:n}),editPresenter:(e,t)=>Ge("POST",`/api/brands/${e}/presenters/${t}/edit`),revertPresenter:(e,t)=>Ge("POST",`/api/brands/${e}/presenters/${t}/revert`),createScene:(e,t)=>Ge("POST",`/api/brands/${e}/scenes`,t),updateScene:(e,t,n)=>Ge("PATCH",`/api/brands/${e}/scenes/${t}`,n),deleteScene:(e,t)=>Ge("DELETE",`/api/brands/${e}/scenes/${t}`),sceneExamples:(e,t)=>Ge("GET",`/api/brands/${e}/scenes/${t}/examples`),drawSceneExamples:(e,t,n)=>Ge("POST",`/api/brands/${e}/scenes/${t}/examples`,n),stopSceneExamples:(e,t)=>Ge("POST",`/api/brands/${e}/scenes/${t}/examples/stop`),removeSceneExample:(e,t,n)=>Ge("DELETE",`/api/brands/${e}/scenes/${t}/examples/${n}`),generateScenePreview:(e,t)=>Ge("POST",`/api/brands/${e}/scenes/${t}/preview`),rereadScene:(e,t,n)=>Ge("POST",`/api/brands/${e}/scenes/${t}/reread`,{correction:n}),startSceneStudioJob:(e,t)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs`,t),sceneStudioJob:(e,t)=>Ge("GET",`/api/brands/${e}/scene-studio/jobs/${t}`),cancelSceneStudioJob:(e,t)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs/${t}/cancel`),labelSceneStudioJob:(e,t,n)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs/${t}/label`,{label:n}),attachSceneStudioJob:(e,t,n)=>Ge("POST",`/api/brands/${e}/scene-studio/jobs/${t}/attach`,{sceneId:n})},$8="scenri:guide-heading",CU=["first-shot","refine","product","presenter","scene","reuse"],jU=e=>CU.includes(e);function AU(){try{const e=typeof window>"u"?null:window.sessionStorage.getItem($8);if(!e)return null;if(e.startsWith("{")){const t=JSON.parse(e);return typeof t.brandId=="string"&&jU(t.task)?{brandId:t.brandId,task:t.task}:null}return{brandId:e,task:"first-shot"}}catch{return null}}function BC(e){try{e?window.sessionStorage.setItem($8,JSON.stringify(e)):window.sessionStorage.removeItem($8)}catch{}}const NU={loaded:!1,heading:null,eligible:!1,welcome:null,hidden:!0,done:{},lessons:{},progress:{},dismissed:[],active:null,activeNodes:[],activeDraftId:null,counts:null};let Ma={...NU,heading:AU()},kx=null,rg=null,Sx=!1;const D8=new Set;function $l(e){Ma=e;for(const t of D8)t()}function UC(e){const t=e;return{...t,lessons:t.lessons??{},progress:t.progress??{},loaded:!0,heading:Ma.heading}}function fh(){return rg??(rg=Me.guide().then(e=>$l(UC(e))).catch(()=>{Ma.loaded||$l({...Ma,loaded:!0})}).finally(()=>{rg=null})),rg}function MU(){return!Sx&&typeof document<"u"&&(Sx=!0,document.addEventListener("visibilitychange",()=>{!document.hidden&&Ma.loaded&&fh()})),kx??(kx=fh()),kx}function sg(){return fh()}function RU(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 Sl(e){const t=Ma;return $l(RU(Ma,e)),Me.guideIntent(e).then(n=>$l(UC(n))).catch(()=>{$l(t),fh()})}function PU(e){return D8.add(e),()=>D8.delete(e)}const WC=e=>`scenri:guide-via-bar:${e}`,O8=(e,t)=>t==="first-shot"||t==="reuse"?WC(e):`scenri:guide-via:${e}:${t}`;function GC(e,t){const n={brandId:e,task:t};BC(n),$l({...Ma,heading:n})}function H8(){BC(null),Ma.heading&&$l({...Ma,heading:null})}function W1(){return Ma}function I6(){return s.useSyncExternalStore(PU,W1)}const it={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",legacy:"/b/*",notFound:"*"},ao=e=>rs(it.brand,{brandSlug:e.slug}),hu=e=>rs(it.products,{brandSlug:e.slug}),sa=(e,t)=>rs(it.product,{brandSlug:e.slug,productId:t}),Mu=e=>rs(it.scenes,{brandSlug:e.slug}),Hr=(e,t)=>rs(it.scene,{brandSlug:e.slug,sceneId:t}),Li=(e,t)=>rs(it.sceneStudio,{brandSlug:e.slug,convoId:t??void 0}),F6=(e,t,n)=>rs(it.sceneEdit,{brandSlug:e.slug,sceneId:t,convoId:n??void 0}),Vi=e=>rs(it.presenters,{brandSlug:e.slug}),la=(e,t)=>rs(it.presenter,{brandSlug:e.slug,presenterId:t}),Ti=(e,t)=>rs(it.presenterStudio,{brandSlug:e.slug,draftId:t??void 0}),_6=(e,t)=>rs(it.presenterEdit,{brandSlug:e.slug,presenterId:t}),hr=e=>rs(it.hub,{brandSlug:e.slug}),zd=(e,t)=>rs(it.set,{brandSlug:e.slug,setSlug:t.slug}),Ap=(e,t,n)=>t?rs(it.setShot,{brandSlug:e.slug,setSlug:t.slug,shotId:n}):rs(it.hubShot,{brandSlug:e.slug,shotId:n});function LU(e,t=""){const[,,n,...r]=e.split("/");if(!n)return it.root;const a=`/${n}${TU(r)}`;return t?a+t:a}function TU(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 ag="Scenri",Ex=" - ",Cx=40,$U=[["whatsnew","What's new"],["setup","Providers"],["settings","Settings"]],DU=[[it.setup,"Set up",!1],[it.hubShot,"Shot",!1],[it.setShot,"Shot",!1],[it.hub,"Create",!1],[it.set,"Create",!0],[it.kit,"Brand kit",!1],[it.product,"Products",!0],[it.products,"Products",!1],[it.scene,"Scenes",!0],[it.scenes,"Scenes",!1],[it.presenter,"Presenters",!0],[it.presenters,"Presenters",!1],[it.brand,"Home",!1]];function OU(e){if(!e)return null;const t=e.replace(/[\u0000-\u001F\u007F-\u009F]/g," ").replace(/\s+/g," ").trim();return t?t.length>Cx?`${t.slice(0,Cx-1).trimEnd()}…`:t:null}function HU(e,t="",n=null){const r=new URLSearchParams(t);for(const[a,i]of $U)if(r.has(a))return i+Ex+ag;for(const[a,i,c]of DU)if(Hi(a,e))return((c?OU(n):null)??i)+Ex+ag;return ag}const KC=s.createContext(null);function IU(){const{pathname:e,search:t}=_n(),[n,r]=s.useState(null);return s.useEffect(()=>{document.title=HU(e,t,n)},[e,t,n]),r}function dc(e){const t=s.useContext(KC);s.useEffect(()=>{if(t)return t(e??null),()=>t(null)},[t,e])}const FU={scenes:[],collections:[],verticals:[],loaded:!1,error:!1};function _U(){const[e,t]=s.useState(FU),[n,r]=s.useState(0);s.useEffect(()=>{let i=!0;return Me.scenes().then(c=>{bU(c.scenes),i&&t({scenes:c.scenes,collections:c.collections,verticals:c.verticals,loaded:!0,error:!1})}).catch(()=>{i&&t(c=>({...c,loaded:!0,error:!0}))}),()=>{i=!1}},[n]);const a=s.useCallback(()=>{t(i=>({...i,loaded:!1,error:!1})),r(i=>i+1)},[]);return{...e,refetch:a}}const VU={presenters:[],categories:[],styles:[],loaded:!1,error:!1};function ZU(){const[e,t]=s.useState(VU),[n,r]=s.useState(0);s.useEffect(()=>{let i=!0;return Me.presenters().then(c=>{i&&t({presenters:c.presenters,categories:c.categories,styles:c.styles,loaded:!0,error:!1})}).catch(()=>{i&&t(c=>({...c,loaded:!0,error:!0}))}),()=>{i=!1}},[n]);const a=s.useCallback(()=>{t(i=>({...i,loaded:!1,error:!1})),r(i=>i+1)},[]);return{...e,refetch:a}}const zU={demoProducts:[],categories:[],loaded:!1,error:!1};function BU(){const[e,t]=s.useState(zU),[n,r]=s.useState(0);s.useEffect(()=>{let i=!0;return Me.demoProducts().then(c=>{i&&t({demoProducts:c.demoProducts,categories:c.categories,loaded:!0,error:!1})}).catch(()=>{i&&t(c=>({...c,loaded:!0,error:!0}))}),()=>{i=!1}},[n]);const a=s.useCallback(()=>{t(i=>({...i,loaded:!1,error:!1})),r(i=>i+1)},[]);return{...e,refetch:a}}const UU={showcase:[],categories:[],loaded:!1,error:!1};function WU(){const[e,t]=s.useState(UU),[n,r]=s.useState(0);s.useEffect(()=>{let i=!0;return Me.showcase().then(c=>{i&&t({showcase:c.showcase,categories:c.categories,loaded:!0,error:!1})}).catch(()=>{i&&t(c=>({...c,loaded:!0,error:!0}))}),()=>{i=!1}},[n]);const a=s.useCallback(()=>{t(i=>({...i,loaded:!1,error:!1})),r(i=>i+1)},[]);return{...e,refetch:a}}function X0(){const{open:e}=ws("settings");return s.useCallback((t="brand")=>e(t),[e])}function GU(){const{open:e}=ws("welcome");return s.useCallback(()=>e("1"),[e])}const I8={current:null};function YC(){const{open:e}=ws("learn");return s.useCallback((t="lessons")=>e(t),[e])}const jx="codex-cli";function fc(){const{open:e}=ws("setup");return s.useCallback((t=jx)=>{e(typeof t=="string"?t:jx)},[e])}function KU(e){var t;e.preventDefault(),(t=e.currentTarget)==null||t.focus({preventScroll:!0})}function qC({failure:e,density:t,onRetry:n,dismiss:r}){const a=X0(),i=fc(),{remedy:c}=e,d=t==="tile",f=()=>{c&&(c.opens==="setup"?i("codex-cli"):a(c.opens))},h=n&&e.retryable,p=y=>d?`sc-s${y?" sc-s-primary":""}`:`sc-btn ${y?"sc-btn-primary":"sc-btn-ghost"}`,g=!d&&!!e.fix,v=!d&&!!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:"alert",children:[o.jsx("span",{className:"sc-fail-ic","aria-hidden":!0,children:o.jsx(uc,{size:d?15:21,weight:"fill"})}),o.jsxs("div",{className:"sc-fail-txt",children:[o.jsx("b",{children:e.title}),g&&o.jsx("small",{children:e.fix})]}),(c||h||r)&&o.jsxs("div",{className:"sc-fail-acts",children:[c&&o.jsx("button",{type:"button",className:p(!0),onClick:f,children:c.label}),h&&o.jsxs("button",{type:"button",className:p(!c),onClick:n,children:[o.jsx(dh,{size:d?12:14})," Try again"]}),r&&o.jsx("button",{type:"button",className:"sc-fail-alt",onClick:r.onClick,children:r.label})]}),v&&o.jsxs("details",{className:"sc-fail-raw",children:[o.jsx("summary",{children:"Details"}),o.jsx("pre",{children:e.raw})]})]})}function V6({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(uc,{size:16,weight:"fill"}):o.jsx(xp,{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 XC(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 ns=XC(()=>localStorage),Q0=XC(()=>sessionStorage),QC=720*60*60*1e3;function JC(e){return e?e.phase==="ready"?e.blockReason!=="dev"&&e.blockReason!=="unsupervised"&&e.blockReason!=="launcher-too-old":e.canApply:!1}function YU(e){return!!(e!=null&&e.available)&&e.blockReason!=="dev"}function qU(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:JC(e)}}const XU=1800*1e3,Ax=300*1e3,og=e=>new Promise(t=>setTimeout(t,e)),ej="scenri:update-dismissed",QU=()=>Q0.get(ej),JU=e=>Q0.set(ej,e),tj=s.createContext(null);function Np(){const e=s.useContext(tj);if(!e)throw new Error("useUpdateCenter must be used inside UpdateCenterProvider");return e}function eW({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState(!1),[i,c]=s.useState(QU),d=s.useRef(void 0);s.useEffect(()=>{let L=!0;const A=async()=>{if(L){if(!document.hidden)try{const $=await Me.updateStatus();L&&n($)}catch{}L&&(d.current=window.setTimeout(A,XU))}};A();const P=()=>{document.hidden||!L||(window.clearTimeout(d.current),A())};return document.addEventListener("visibilitychange",P),window.addEventListener("focus",P),()=>{L=!1,window.clearTimeout(d.current),document.removeEventListener("visibilitychange",P),window.removeEventListener("focus",P)}},[]);const[f,h]=s.useState(null),p=s.useCallback(async()=>{a(!0);try{n(await Me.updateCheck()),h(null)}catch(L){h(String((L==null?void 0:L.message)??L))}finally{a(!1)}},[]),g=s.useCallback(()=>{const L=t==null?void 0:t.latest;L&&(JU(L),c(L))},[t]),v=(t==null?void 0:t.latest)!=null&&t.latest===i,[y,b]=s.useState("idle"),[x,k]=s.useState(null),S=s.useCallback(async L=>{b("restarting");try{await Me.updateRestart()}catch(P){if(typeof P.status=="number"){b("idle"),k(String((P==null?void 0:P.message)??P));return}}const A=Date.now()+3e4;for(;Date.now()<A;){await og(800);try{if((await Me.version()).version!==L){location.reload();return}}catch{}}b("idle"),k("The restart did not complete. Check the terminal Scenri runs in.")},[]),E=s.useCallback(async()=>{if(y!=="idle")return null;try{await Me.quit()}catch(L){if(typeof L.status=="number")return String((L==null?void 0:L.message)??L)}return window.close(),setTimeout(()=>{window.closed||location.replace("about:blank")},300),null},[y]),C=s.useCallback(async()=>{if(y!=="idle")return;k(null);const L=t==null?void 0:t.current;try{if((t==null?void 0:t.phase)!=="ready"){b("applying"),await Me.updateApply();const A=Date.now()+Ax;let P=!1;for(;Date.now()<A;){await og(1500);const $=await Me.updateStatus();if(n($),$.phase==="ready"){P=!0;break}if($.phase==="error"){k($.error??"The update could not be staged."),b("idle");return}}if(!P){k("Couldn't download the update. Try again."),b("idle");return}}await S(L)}catch(A){k(String((A==null?void 0:A.message)??A)),b("idle")}},[y,t,S]),N=s.useRef(!1);s.useEffect(()=>{if((t==null?void 0:t.phase)!=="staging"||y!=="idle"||N.current)return;N.current=!0;let L=!0;const A=Date.now()+Ax;return(async()=>{for(;L&&Date.now()<A;){if(await og(1500),!L)return;try{const $=await Me.updateStatus();if(!L||(n($),$.phase!=="staging"))return}catch{}}})().finally(()=>{N.current=!1}),()=>{L=!1}},[t==null?void 0:t.phase,y]);const{pathname:M}=_n(),T=M===it.setup;return o.jsxs(tj.Provider,{value:{status:t,checking:r,checkNow:p,checkError:f,dismissed:v,dismiss:g,apply:C,quit:E,busy:y,applyError:x},children:[e,y!=="restarting"&&YU(t)&&!v&&!T&&o.jsx(rW,{}),y==="restarting"&&o.jsx(tW,{version:(t==null?void 0:t.stagedVersion)??(t==null?void 0:t.latest)??null})]})}function tW({version:e}){return o.jsxs(nW,{children:[o.jsx(w7,{size:22}),o.jsx("b",{children:e?`Updating to Scenri ${e}`:"Updating Scenri"}),o.jsx("small",{children:"Restarting. This page reconnects by itself."})]})}function nW({children:e,className:t}){return Mr.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 rW(){const{status:e,dismiss:t,apply:n,busy:r,applyError:a}=Np(),i=X0();if(!e)return null;const c=qU(e),d=c.kind==="downloading"?"Downloading update…":c.kind==="ready"?`Scenri ${c.version} is ready`:c.kind==="stage-error"?"Couldn't download the update":"A new update is available",f=r==="applying"?"Updating…":c.kind==="stage-error"?"Try again":"Update",h=c.kind!=="announce"||c.oneClick;return o.jsxs("div",{className:"sc-upd-float",role:"status",children:[o.jsx(FB,{className:"sc-upd-float-dot",size:16,weight:"fill","aria-hidden":"true"}),o.jsxs("span",{className:"sc-upd-float-txt",children:[d,a&&c.kind!=="downloading"&&o.jsx("small",{children:a})]}),o.jsx("button",{type:"button",className:"sc-upd-float-later",onClick:t,children:c.kind==="ready"?"Later":"Not now"}),c.kind!=="downloading"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:r!=="idle",onClick:()=>h?void n():i("about"),children:f})]})}function sW(e,t){return!e||t.updatedAt>=e.updatedAt}function aW(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0||e[n]===t||!sW(e[n],t))return e;const r=e.slice();return r[n]=t,r}function oW(e,t,n){if(!e)return t;const r=new Map(e.map(c=>[c.id,c]));let a=e.length===t.length;const i=t.map((c,d)=>{const f=r.get(c.id),h=f&&n.has(c.id)&&!(c.updatedAt>f.updatedAt)?f:c;return h!==e[d]&&(a=!1),h});return a?e:i}const Z6=(e,t)=>`scenri:new-${e}-${t}`,iW=e=>Q0.get(e),lW=(e,t)=>Q0.set(e,t);function Bd(e){Q0.del(e),ns.del(e)}function ig(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 Nx=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function nj(e,t){const n=Z6(e,t),r=iW(n);if(!r)return null;let a;try{a=JSON.parse(r)}catch{return Bd(n),null}if(typeof a!="object"||a===null)return Bd(n),null;const i=a;if(i.v!==1||i.brandId!==e||i.kind!==t)return Bd(n),null;const c=Date.now()-Date.parse(i.updatedAt??"");return!Number.isFinite(c)||c>QC?(Bd(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:Nx(i.facets),imageHashes:Nx(i.imageHashes),importUrl:typeof i.importUrl=="string"?i.importUrl:"",pending:typeof i.pending=="string"?i.pending:null}}function lg(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};lW(Z6(e,t),JSON.stringify(r))}function eu(e,t){Bd(Z6(e,t))}function cW(e,t,n){const r=nj(e,t);(r==null?void 0:r.pending)===n&&eu(e,t)}function uW(e,t){if(!e)return!1;if(e.pending===null)return!0;const n=t??"unknown";return n==="failed"||n==="cancelled"||n==="unknown"}const Mp=[{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"}],J0=e=>Mp.filter(e).map(t=>t.id),rj=J0(()=>!0),dW=J0(e=>e.tier==="core"),fW=J0(e=>e.tier==="supplementary"),Zl=Object.fromEntries(Mp.map(e=>[e.id,e.strip])),vn=Object.fromEntries(Mp.map(e=>[e.id,e.name])),Dl=e=>vn[e],sj=Object.fromEntries(Mp.map(e=>[e.id,e.from])),F8=new Set(J0(e=>e.gate===!0)),Co=e=>F8.has(e)?void 0:"auto",e0=4,Mx=25*1024*1024,Do=e=>J0(t=>{var n;return t.tier==="core"||!!e.extras||((n=e.views[t.id])==null?void 0:n.status)!=="empty"});function z6(e){return Do(e).find(t=>e.views[t].status!=="approved")??null}const hW=e=>z6(e)===null,Oo=e=>e.views.portrait.status==="approved"||!!e.views.portrait.prior,zl=e=>e.stage!=="idle"||!!e.activeView;function aj(e){if(zl(e))return null;const t=z6(e);if(!t)return null;const n=e.views[t];return n.status!=="empty"&&n.status!=="stale"||n.error?null:sj[t].every(r=>e.views[r].status==="approved")?t:null}function oj(e,t){return t??(zl(e)?e.activeView:null)??z6(e)??"portrait"}function ij(e,t){return Do(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:Zl[n],state:a,hash:r.hash,photo:r.origin==="photo",drawing:e.activeView===n,approved:r.status==="approved",error:!!r.error}})}const pW={woman:"a woman",man:"a man",androgynous:"an androgynous person"},mW={woman:"her",man:"his",androgynous:"their"},hh=/\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,gW=/^(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 vW(e){const t=e.trim().split(/[^\p{L}\p{N}']+/u).filter(Boolean);return t.some(n=>hh.test(n))?t.every(n=>gW.test(n)||hh.test(n)):!1}const B6=/\b(\d0s|\d{2}\s*(years|yo)|teen|twenties|thirties|forties|fifties|sixties|seventies|elderly|young|old(er)?|middle-aged|adult)\b/i,yW=120,wW=18;function bW(e){const t=e.match(/\d+/g);return t!=null&&t.length?t.every(n=>{const r=Number(n);return r>=wW&&r<=yW}):!1}const xW=/\b(hair|bald|shaved|buzz|blonde?|brunette|redhead|ginger|greying|silver|auburn|platinum)\b/i,kW=/\b(skin|complexion|fair|pale|light|olive|tan|tanned|brown|deep|dark|ebony|black|white|freckled|golden)\b/i,SW=/\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,EW=/\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,CW=/\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,Js=e=>SW.test(e)||B6.test(e)||xW.test(e)||kW.test(e)||EW.test(e)||CW.test(e);function jW(e,t){const n=t.trim();if(!n)return"";const r=[],a=e.steer&&!hh.test(n)?pW[e.steer]:"";if(a&&r.push(a),e.age&&!B6.test(n)){const c=e.steer?mW[e.steer]:"their",d=e.age==="60+"?`in ${c} 60s or older`:`in ${c} ${e.age}`;r.push(a?d:`someone ${d}`)}const i=[];return i.length&&r.push(`with ${i.join(" and ")}`),r.length?`${r.join(" ")}, ${n}`:n}function AW(e,t){var r;const n=((r=e.analysis)==null?void 0:r.suitableCategories)??[];return!n.length||t.length?null:n}function lj(e){return rj.some(t=>{const n=e.views[t];return!!n.hash&&n.origin!=="photo"&&n.status!=="empty"})}function NW(e,t,n=!0){if(zl(e))return"Still drawing";const r=!n&&e.source==="photos"?["portrait"]:Do(e);for(const a of r){const i=e.views[a];if(i.status==="candidate")return`Decide on the ${Dl(a)} first`;if(i.status==="stale")return`Redo the ${Dl(a)} first`;if(i.status!=="approved")return`Use the ${Dl(a)} first`}return t.trim()?null:"Give them a name"}const cj=/\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 uj(e,t,n){if(!e.trim())return{blocked:"Say what should change."};if(!Oo(n))return n.views.portrait.status!=="candidate"?{blocked:"Nothing to adjust yet."}:{view:"portrait",scope:"identity"};if(t==="portrait"||cj.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 ${Dl(t)} yet.`}:{view:t,scope:"view"}}function Rx(e,t){return Oo(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 MW(e,t,n){const r=e.trim(),a=uj(r||"this",t,n);if("blocked"in a)return r?{chip:null,hint:a.blocked,tone:"alert"}:{chip:null,hint:Rx(t,n)};const i=Oo(n)?a.scope==="identity"?"Changing the person":`Refining the ${vn[a.view]}`:"Adjusting the face";return{chip:{view:a.view,label:i},hint:Rx(t,n)}}const Px=e=>e.charAt(0).toUpperCase()+e.slice(1);function RW(e,t){var g,v,y,b;if(e.source!=="photos"||e.stage==="analyzing")return null;const n=(g=e.readError)==null?void 0:g.trim();if(n)return{text:`The photos could not be read: ${/[.!?]$/.test(n)?n:`${n}.`} Their face is drawn from them anyway.`,tone:"warn"};const r=(y=(v=e.analysis)==null?void 0:v.conflict)==null?void 0:y.trim();if(r)return{text:`These photos may show more than one person: ${r}`,tone:"warn"};const a=((b=e.analysis)==null?void 0:b.photos)??[];if(a.length&&a.every(x=>x.usable===!1))return null;const i=Do(e),c=i.filter(x=>e.views[x].origin==="photo"),d=i.filter(x=>e.views[x].origin!=="photo"),f=x=>x.length<=2?x.map(Dl).join(" and "):`${x.slice(0,-1).map(Dl).join(", ")} and ${Dl(x[x.length-1])}`,h=c.length?`${Px(f(c))} from your ${c.length===1?"photo":"photos"}.`:"";if(!d.length)return{text:h};if(!t)return{text:[h||"The face is kept from your photo as it is.","The other views need an engine that can draw."].filter(Boolean).join(" ")};const p=d.length>=3&&c.length?"The rest are drawn from them.":`${Px(f(d))} ${d.length===1?"is":"are"} drawn from them.`;return{text:[h,p].filter(Boolean).join(" ")}}const dj=e=>{var t;return(e.activeView?(t=e.views[e.activeView])==null?void 0:t.startedAt:void 0)??e.updatedAt};function fj(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 ${vn[t]}`}function U6(e,t){return hj(t).some(n=>!!e.views[n].hash)}function hj(e){const t=new Set;for(let n=!0;n;){n=!1;for(const r of rj)r===e||t.has(r)||sj[r].some(a=>a===e||t.has(a))&&(t.add(r),n=!0)}return[...t]}function PW(e,t){const n=e.views[t].hash;return n?hj(t).some(r=>{const a=e.views[r];return!!a.hash&&!(a.conditionedOn??[]).includes(n)}):!1}function pj(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 LW=["hero","close","hands","angle","bold"],Bl={hero:"Hero",close:"Close-up",hands:"Hands",angle:"Another angle",bold:"A bold one"},Lx={hero:"hero",close:"close-up",hands:"hands",angle:"other angle",bold:"bold one"},mj=(e,t)=>!!e&&e.status==="running"&&e.roles.includes(t)&&!e.done.includes(t)&&!e.failed.some(n=>n.role===t);function gj(e=[],t){const n=[];for(const r of LW){const a=e.find(c=>c.role===r);if(mj(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(c=>c.role===r);i&&n.push({role:r,state:"failed",error:i.error})}return n}function TW(e,t=[],n){return e.filter(r=>!t.some(a=>a.role===r)&&!mj(n,r))}function $W(e=[]){return e.filter(t=>t.earlier).map(t=>t.role)}function W6(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 Lx?Lx[e.step]:null;return`${n?`Drawing the ${n}`:"Drawing examples"}${t}`}return e.done===1?"One example drawn":`${e.done??0} examples drawn`}const vj=50;function No(e){return Date.parse(e.includes("T")?e:`${e.replace(" ","T")}Z`)}function Ai(e){return e.startedAt||e.createdAt}function Ul(e,t=Date.now()){const n=No(e);return Number.isNaN(n)?0:Math.max(0,Math.round((t-n)/1e3))}function G6(e,t=Date.now()){const n=Ul(e,t);return n<20?"generating":n<60?"still generating":"taking longer than usual"}function Wl(e,t=Date.now()){const n=Ul(e,t),r=d=>String(d).padStart(2,"0"),a=Math.floor(n/3600),i=Math.floor(n%3600/60),c=n%60;return a>0?`${a}:${r(i)}:${r(c)}`:`${i}:${r(c)}`}function yj(e,t=Date.now()){const n=Ul(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 wj(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 bj=e=>e.setNames.length>0?`${e.setNames.join(", ")} · `:"";function _8(e,t,n=Date.now(),r=1){const a=bj(e),i=r>1?`${r} shots`:"ready",c=e.status==="running"?`${a}${G6(Ai(e),n)}`:e.status==="error"?`${a}${e.error??"failed"}`: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 · ${lr(e)}`:lr(e),subtitle:c,thumb:e.images[0]??null,percent:null,startedAt:e.status==="running"?Ai(e):e.createdAt,href:Ap(t,null,e.id)}}function DW(e,t,n=Date.now()){var f,h;const r=[...e].sort((p,g)=>(p.batchIndex??0)-(g.batchIndex??0)),a=r[0];if(r.length===1)return _8(a,t,n);const i=r.filter(p=>p.status==="done"&&p.images.length>0),c=r.some(p=>p.status==="running")?"running":i.length?"done":r.some(p=>p.status==="error")?"error":"cancelled",d=_8({...a,status:c,images:((f=i[0])==null?void 0:f.images)??[],error:c==="error"?((h=r.find(p=>p.status==="error"))==null?void 0:h.error)??null:a.error},t,n,r.length);return c==="done"&&i.length<r.length?{...d,subtitle:`${bj(a)}${i.length} of ${r.length} shots`}:d}function OW(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"}function HW(e,t){const n=OW(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:wj(e),startedAt:e.createdAt,href:hu(t)}}function IW(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"?la(t,e.assetId):Hr(t,e.assetId):null}}function FW(e){if(e.kind==="examples")return W6(e);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.attachTo?"On its scene now":"The picture is drawn";const t=e.step&&e.step in vn?vn[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 _W(e,t){const n=e.status==="failed"?"error":e.status,r=e.kind==="examples"?e.sceneId?Hr(t,e.sceneId):null:e.kind==="scene"?e.conversation?e.sceneId?F6(t,e.sceneId,e.conversation):Li(t,e.conversation):e.attachTo?Hr(t,e.attachTo):null:e.presenterId?_6(t,e.presenterId):e.draftId?Ti(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:FW(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 Tx=e=>e.startsWith("scene:")||e.startsWith("presenter:")||e.startsWith("examples:");function $x(e,t){return e?e.split("?")[0].replace(/\/$/,"")===t.replace(/\/$/,""):!1}function VW(e,t=12){const n=e.filter(a=>a.state==="running"),r=e.filter(a=>a.state!=="running").sort((a,i)=>No(i.startedAt)-No(a.startedAt)).slice(0,t);return n.sort((a,i)=>No(a.startedAt)-No(i.startedAt)),[...n,...r]}function ZW(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 zW(e,t,n=vj){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)=>No(i.at)-No(a.at)).slice(0,n)}function BW(e,t){const n=e.filter(a=>!a.watched);if(!t)return n.length;const r=No(t);return n.filter(a=>No(a.at)>r).length}const xj=e=>`scenri:notifications-${e}`,kj=e=>`scenri:notifications-seen-${e}`,Sj=e=>ns.get(e),Ej=(e,t)=>ns.set(e,t);function Dx(e){const t=Sj(xj(e));if(!t)return[];try{const n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}}const Ox=(e,t)=>Ej(xj(e),JSON.stringify(t.slice(0,vj))),Hx=e=>Sj(kj(e)),UW=(e,t)=>Ej(kj(e),t);function cg(e,t){return e===t?!0:e.length!==t.length?!1:JSON.stringify(e)===JSON.stringify(t)}const WW=1500,GW=5e3,Cj=s.createContext(null);function Oa(){const e=s.useContext(Cj);if(!e)throw new Error("useTaskCenter must be used inside TaskCenterProvider");return e}function KW({brand:e,onActivity:t,children:n}){const r=Dn(),{push:a}=Sr(),{refreshBrands:i}=jn(),c=e.id,[d,f]=s.useState([]),[h,p]=s.useState([]),[g,v]=s.useState([]),y=s.useRef(e);y.current=e;const b=s.useRef([]);b.current=h;const[x,k]=s.useState(()=>Dx(c)),[S,E]=s.useState(()=>Hx(c)),[C,N]=s.useState(!1),M=s.useRef(null),T=s.useRef(new Set),L=s.useRef(0),A=s.useRef(new Set),P=s.useRef(i);P.current=i;const $=s.useRef(null),H=s.useRef(C);H.current=C;const O=s.useRef(r);O.current=r;const{pathname:Q}=_n(),I=s.useRef(!1);I.current=/\/(create|sets)(\/|$)/.test(Q);const V=s.useRef(a);V.current=a;const ie=s.useRef(t);ie.current=t,s.useEffect(()=>{M.current=null,T.current=new Set,L.current=0,A.current=new Set,f([]),p([]),v([]),k(Dx(c)),E(Hx(c))},[c]);const B=s.useCallback(async()=>{var re,D;let K,z,Y;try{const[{nodes:G,jobs:Pe,studio:Ze=[]},{builds:He}]=await Promise.all([Me.activity(c),Me.assetBuilds(c)]);z=He,Y=Ze,(re=ie.current)==null||re.call(ie,c,G);const tt=new Map,oe=[];for(const Ae of G)Ae.batchId?tt.set(Ae.batchId,[...tt.get(Ae.batchId)??[],Ae]):oe.push(Ae);const he=Date.now();K=[...oe.map(Ae=>_8(Ae,y.current,he)),...[...tt.values()].map(Ae=>DW(Ae,y.current,he)),...Pe.map(Ae=>HW(Ae,y.current)),...He.map(Ae=>IW(Ae,y.current)),...Ze.map(Ae=>_W(Ae,y.current))]}catch{return}const J=z.filter(G=>G.finished&&G.assetId&&!A.current.has(G.id)),de=new Set(z.map(G=>G.id)),ae=b.current.some(G=>!G.finished&&!de.has(G.id)),W=Y.filter(G=>G.kind==="scene"&&G.status==="done"&&!!G.attachTo&&!A.current.has(G.id));for(const G of W)A.current.add(G.id);const ye=Y.filter(G=>G.kind==="examples"&&(G.done??0)>0).map(G=>`${G.id}:${G.done}`).filter(G=>!A.current.has(G));for(const G of ye)A.current.add(G);if(J.length||ae||W.length||ye.length){for(const G of J)A.current.add(G.id),cW(c,G.kind,G.id);await P.current()}p(G=>cg(G,z)?G:z),v(G=>cg(G,Y)?G:Y);const ee=ZW(M.current,K);M.current=new Map(K.map(G=>[G.id,G])),L.current=K.filter(G=>G.state==="running").length;const ge=VW(K);if(f(G=>cg(G,ge)?G:ge),ee.length!==0&&(k(G=>{const Pe=window.location.pathname,Ze=ee.map(tt=>Tx(tt.id)&&$x(tt.href,Pe)?{...tt,watched:!0}:I.current&&tt.state!=="error"?{...tt,watched:!0}:tt),He=zW(G,Ze);return Ox(c,He),He}),!H.current))for(const G of ee){if(T.current.has(G.id)||(T.current.add(G.id),G.state==="cancelled"))continue;if(Tx(G.id)){if($x(G.href,window.location.pathname))continue;const He=G.href,tt=He?[{label:"Open",onClick:()=>O.current(He)}]:void 0;if(G.state==="error"){V.current({kind:"error",title:`${G.title} did not finish`,detail:G.subtitle,actions:tt});continue}V.current({kind:"success",title:G.id.startsWith("examples:")?`${G.title} examples are ready`:`${G.title} is drawn`,detail:G.kind==="presenter"?G.subtitle:void 0,actions:tt});continue}if(G.state!=="error"&&I.current&&G.kind!=="presenter"&&G.kind!=="scene")continue;const Pe=G.href,Ze=Pe?{label:"View",onClick:()=>O.current(Pe)}:void 0;if(G.state==="error"){const He=I.current&&(G.kind==="generation"||G.kind==="edit");V.current({kind:"error",title:`${G.title} failed`,detail:G.subtitle,action:Ze,quiet:He});continue}if(G.kind==="presenter"||G.kind==="scene"){const He=G.id.startsWith("build:")?((D=z.find(tt=>`build:${tt.id}`===G.id))==null?void 0:D.assetId)??null:null;V.current({kind:"success",title:`${G.title} is ready`,detail:G.subtitle,actions:Pe?[{label:G.kind==="presenter"?"View presenter":"View scene",onClick:()=>O.current(Pe)},{label:"Use in a shot",onClick:()=>O.current(`${hr(y.current)}?${G.kind==="presenter"?"presenter":"scene"}=${He}&compose=1`)}]:void 0});continue}if(G.kind==="catalog"&&G.state==="partial"){V.current({kind:"warning",title:"Some products did not import",detail:G.subtitle,action:Ze});continue}V.current({kind:"success",title:G.kind==="catalog"?"Import finished":"Generation finished",detail:G.kind==="catalog"?G.title:void 0,action:Ze})}},[c]);s.useEffect(()=>{let K=null,z=!0;const Y=async()=>{if(!z||(document.hidden||await B(),!z))return;const de=!document.hidden&&L.current>0;K=setTimeout(Y,de?WW:GW)},J=()=>{K&&clearTimeout(K),K=null,document.hidden||Y()};return $.current=J,Y(),document.addEventListener("visibilitychange",J),window.addEventListener("focus",J),()=>{z=!1,$.current=null,K&&clearTimeout(K),document.removeEventListener("visibilitychange",J),window.removeEventListener("focus",J)}},[B]);const F=s.useCallback(()=>{var K;return(K=$.current)==null?void 0:K.call($)},[]),te=s.useCallback(()=>{const K=new Date().toISOString();E(K),UW(c,K)},[c]),X=s.useCallback(()=>{k([]),Ox(c,[]),te()},[c,te]),Z=s.useMemo(()=>({tasks:d,running:d.filter(K=>K.state==="running").length,builds:h,studio:g,feed:x,unread:BW(x,S),markSeen:te,clearFeed:X,panelOpen:C,setPanelOpen:N,poke:F}),[d,h,g,x,S,te,X,C,F]);return o.jsx(Cj.Provider,{value:Z,children:n})}const jj=["primary","mark","wordmark","monochrome","alternate"],K6=["light","dark","any"],k1={primary:"Primary logo",mark:"Mark",wordmark:"Wordmark",monochrome:"Monochrome",alternate:"Alternate"},YW=/^[a-f0-9]{32}$/,qW=e=>{const t=String(e??"");if(!t.startsWith("asset:"))return null;const n=t.slice(6);return YW.test(n)?n:null},XW=e=>jj.includes(e)?e:"primary",QW=e=>K6.includes(e)?e:"any";function ef(e){return(Array.isArray(e==null?void 0:e.logos)?e.logos:[]).filter(n=>n&&String(n.file??"").trim()).map(n=>{const r=qW(n.file),a=String(n.clearSpace??"").trim();return{hash:r,file:String(n.file),role:XW(n.role),background:QW(n.background),...a?{clearSpace:a}:{},attachable:r!==null}})}function tf(e){return ef(e).filter(t=>t.attachable)}function Rp(e){return e.find(t=>t.role==="primary")??e[0]??null}function JW(e){return Rp(ef(e))}function eG(e){const t=ef(e);return t.find(n=>n.role==="mark")??Rp(t)}function tG(e){const t=ef(e).filter(a=>a.hash),n=t.find(a=>a.role==="mark");if(n)return{mark:n,square:!0};const r=Rp(t);return!r||r.role==="wordmark"?null:{mark:r,square:!1}}const nG=1.6,rG=(e,t)=>t>0&&e/t<=nG;function sG(e,t){const n=(i,c)=>Math.min(c-1,Math.max(0,Math.round(i*(c-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 aG=e=>e.length>0&&e.every(t=>t>=200);function Pp(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 Y6(e){const{brand:t}=Qt(),{pathname:n}=_n(),r=!!tn(it.brand),a=!!tn({path:it.hub,end:!1}),i=!!tn({path:it.set,end:!1}),c=a||i,d=!!tn({path:it.products,end:!1}),f=!!tn({path:it.scenes,end:!1}),h=!!tn({path:it.presenters,end:!1}),p=g=>g?"fill":"regular";return[{key:"home",label:"Home",icon:o.jsx(zB,{size:e,weight:p(r)}),active:r,to:ao(t)},{key:"create",label:"Create",icon:o.jsx(XB,{size:e,weight:p(c)}),active:c,to:c?`${n}?compose=1`:`${hr(t)}?compose=1`},{key:"products",label:"Products",icon:o.jsx(kp,{size:e,weight:p(d)}),active:d,to:hu(t)},{key:"presenters",label:"Presenters",icon:o.jsx(bp,{size:e,weight:p(h)}),active:h,to:Vi(t)},{key:"scenes",label:"Scenes",icon:o.jsx(wp,{size:e,weight:p(f)}),active:f,to:Mu(t)}]}const Ea=e=>{var t,n;return((n=(t=e.json)==null?void 0:t.meta)==null?void 0:n.name)??e.slug};function oG(e){return([...e.trim()].find(n=>new RegExp("\\p{L}|\\p{N}","u").test(n))??"?").toUpperCase()}function iG(e){const t=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!t)return"#ffffff";const[n,r,a]=[0,2,4].map(c=>Number.parseInt(t[1].slice(c,c+2),16)/255),i=c=>c<=.03928?c/12.92:((c+.055)/1.055)**2.4;return .2126*i(n)+.7152*i(r)+.0722*i(a)>.42?"#0a0a0a":"#ffffff"}const Ix=new Map;function lG(e,t){const n=e.naturalWidth,r=e.naturalHeight,a=t||rG(n,r);let i=!1;try{const c=document.createElement("canvas");c.width=n,c.height=r;const d=c.getContext("2d",{willReadFrequently:!0});d&&(d.drawImage(e,0,0),i=aG(sG(n,r).map(([f,h])=>d.getImageData(f,h,1,1).data[3])))}catch{}return{fits:a,bleed:i}}function Aj({brand:e,size:t=20,round:n=!1}){var h,p,g;const[,r]=s.useReducer(v=>v+1,0),a=tG(e.json),i=a?jp(a.mark.file,"micro"):null,c=i?Ix.get(i):void 0,d=i&&(c!=null&&c.fits)?i:null,f=((g=(p=(h=e.json)==null?void 0:h.palette)==null?void 0:p.primary)==null?void 0:g.hex)??"#6b6b6b";return o.jsxs("span",{className:"sc-brand-av","data-logo":d?"":void 0,"data-bleed":d&&(c!=null&&c.bleed)?"":void 0,"data-round":n||void 0,style:{width:t,height:t,fontSize:Math.round(t*.5),...d?{}:{background:f,color:iG(f)}},"aria-hidden":!0,children:[d?o.jsx("img",{src:d,alt:""}):oG(Ea(e)),i&&!c&&o.jsx("img",{src:i,alt:"",hidden:!0,onLoad:v=>{Ix.set(i,lG(v.currentTarget,!!(a!=null&&a.square))),r()}})]})}function cG(){const e=Y6(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(Fn,{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 uG({value:e,size:t,stroke:n=1.5}){const r=(t-n)/2,a=2*Math.PI*r,i=Math.max(0,Math.min(1,e));return o.jsxs("svg",{className:"sc-ring",width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:[o.jsx("circle",{className:"sc-ring-track",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n}),i>0&&o.jsx("circle",{className:"sc-ring-arc",cx:t/2,cy:t/2,r,fill:"none",strokeWidth:n,strokeLinecap:"round",strokeDasharray:a,strokeDashoffset:a*(1-i),transform:`rotate(-90 ${t/2} ${t/2})`})]})}function dG({mode:e,lead:t,running:n,unread:r,animate:a}){const i=fG(a);if(e==="busy"&&t){const c=t.percent===null?0:t.percent/100;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(uG,{value:c,size:32}),t.thumb?o.jsx("img",{src:nn(t.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):o.jsx(tg,{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(tg,{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(tg,{size:18})})}function fG(e){return s.useRef(e).current}const Nj="the engine",hG=[{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=>`${Ba(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=>`${Ba(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=>`${Ba(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=>`${Ba(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=>`${Ba(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=>`${Ba(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=>`${Ba(e)} has no model for this shot.`,fix:"Pick another engine in Settings.",remedy:{label:"Choose engine",opens:"engines"},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=>`${Ba(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=>`${Ba(e)} had a problem on its end.`,fix:"Nothing wrong with your brief. Try again shortly.",retryable:!0},{re:/produced no images|returned no image|no images returned|finished but produced no/i,kind:"empty",title:e=>`${Ba(e)} finished without making a picture.`,fix:"Run it again. This usually clears on a second try.",retryable:!0}];function Ba(e){return e===Nj?"The engine":e}function nf(e,t){const n=(e??"").trim(),r=(t??"").replace(/\s*\(BYOK\)\s*$/i,"").trim()||Nj;if(!n)return{kind:"unknown",title:"This shot did not finish.",raw:"",retryable:!0};for(const a of hG){if(!a.re.test(n))continue;const i=a.title(r)||pG(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 Mj(){return{kind:"cancelled",title:"You stopped this shot.",fix:"The prompt is kept. Run it again whenever.",raw:"",retryable:!0}}function wn(e,t,n){const r=e instanceof Error?e.message:typeof e=="string"?e:String((e==null?void 0:e.message)??e),a=nf(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 pG(e){const t=e.trim();if(!t)return t;const n=t[0].toUpperCase()+t.slice(1);return/[.!?]$/.test(n)?n:`${n}.`}function Fx({onClose:e,onSeen:t,onOpenDetail:n}){const{tasks:r,feed:a,unread:i,clearFeed:c}=Oa(),d=r.filter(S=>S.state==="running"),{brand:f}=Qt(),{push:h}=Sr(),p=vG(1e3),g=s.useRef(null),v=s.useRef(null),y=s.useRef(!1);s.useEffect(()=>{var S;!y.current||a.length>0||(y.current=!1,(S=g.current)==null||S.focus({preventScroll:!0}))},[a.length]);const b=()=>{y.current=!0,c()},x=S=>{var E;S.detail===0&&((E=v.current)==null||E.focus({preventScroll:!0})),t()},k=S=>{if(S.startsWith("node:")){Me.cancelNode(S.slice(5)).catch(E=>h(wn(E,"Could not cancel this shot")));return}if(S.startsWith("build:")){Me.cancelAssetBuild(f.id,S.slice(6)).catch(E=>h(wn(E,"Could not stop this build")));return}if(S.startsWith("scene:")){Me.cancelSceneStudioJob(f.id,S.slice(6)).catch(E=>h(wn(E,"Could not stop this scene")));return}if(S.startsWith("presenter:")){const E=S.split(":")[1]??"";Me.stopDraft(f.id,E).catch(C=>h(wn(C,"Could not stop this presenter")));return}S.startsWith("catalog:")&&Me.cancelCatalogJob(f.id,S.slice(8)).catch(E=>h(wn(E,"Could not stop this import")))};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-menu-head",children:"Activity"}),o.jsxs("div",{className:"sc-notif-scroll",children:[d.length>0&&o.jsxs("section",{"aria-label":"In progress",children:[o.jsx("h3",{className:"sc-notif-label",children:"In progress"}),d.map(S=>o.jsx(mG,{task:S,now:p,onNavigate:e,onCancel:k,onOpenDetail:n},S.id))]}),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:x,children:"Mark all read"}),o.jsx("button",{ref:v,type:"button",className:"sc-notif-clear",onClick:b,children:"Clear all"})]})]}),a.length===0?o.jsx("p",{ref:g,tabIndex:-1,className:"sc-notif-empty",children:"You have no notifications yet."}):a.map(S=>o.jsx(gG,{item:S,now:p,onNavigate:e,onSeen:t},S.id))]})]})]})}function Rj({task:e}){return e.thumb?o.jsx("img",{src:nn(e.thumb,"micro"),alt:"",loading:"lazy",decoding:"async"}):e.state==="running"?o.jsx("span",{className:"sc-shimmer"}):e.state==="error"?o.jsx(uc,{size:17,weight:"fill"}):e.state==="cancelled"?o.jsx(aU,{size:17,color:"var(--sc-fg3)"}):e.kind==="catalog"?o.jsx(CC,{size:17}):e.kind==="presenter"?o.jsx(bp,{size:17}):e.kind==="scene"?o.jsx(wp,{size:17}):o.jsx(Vs,{size:17})}function mG({task:e,now:t,onNavigate:n,onCancel:r,onOpenDetail:a}){const i=e.state==="running",c=e.id.startsWith("node:")||e.id.startsWith("build:")||e.id.startsWith("catalog:"),d=i&&Ul(e.startedAt,t)>=60,f=i&&e.id.startsWith("catalog:")?e.id.slice(8):null,h=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-notif-thumb",children:o.jsx(Rj,{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?Wl(e.startedAt,t):yj(e.startedAt,t)})]});return o.jsxs("div",{className:"sc-notif-row-wrap",children:[f?o.jsx("button",{type:"button",className:"sc-notif-row","data-state":e.state,"data-running":i||void 0,onClick:()=>a(f),children:h}):e.href?o.jsx(Fn,{className:"sc-notif-row","data-state":e.state,"data-running":i||void 0,to:e.href,onClick:n,children:h}):o.jsx("button",{type:"button",className:"sc-notif-row","data-state":e.state,"data-running":i||void 0,disabled:!0,children:h}),i&&c&&o.jsx("button",{type:"button",className:"sc-notif-row-cancel","data-urgent":d||void 0,onClick:p=>{p.stopPropagation(),r(e.id)},children:"Cancel"})]})}function gG({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(Rj,{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:yj(e.at,t)})]});return e.href?o.jsx(Fn,{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 vG(e){const[t,n]=s.useState(()=>Date.now());return s.useEffect(()=>{const r=setInterval(()=>n(Date.now()),e);return()=>clearInterval(r)},[e]),t}function zu(e){const t=s.useRef(null),n=s.useRef(null),r=s.useRef(0),a=d=>{d.pointerType==="mouse"&&d.button!==0||(n.current={y:d.clientY,t:d.timeStamp},r.current=0,t.current&&(t.current.style.transition="none"),d.currentTarget.setPointerCapture(d.pointerId))},i=d=>{!n.current||!t.current||(r.current=Math.max(0,d.clientY-n.current.y),t.current.style.transform=`translateY(${r.current}px)`)},c=d=>{const f=n.current;if(n.current=null,!f||!t.current)return;t.current.style.transition="";const h=r.current/Math.max(1,d.timeStamp-f.t);if(r.current>96||h>.45){e();return}t.current.style.transform=""};return{sheet:t,grip:{onPointerDown:a,onPointerMove:i,onPointerUp:c,onPointerCancel:c}}}function Pj({label:e,onClose:t,children:n}){const{sheet:r,grip:a}=zu(t);return s.useEffect(()=>{const i=c=>{c.key==="Escape"&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]),Mr.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 Lj(e,t){const{pathname:n}=_n(),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 yG=new Set(["Shift","Control","Alt","AltGraph","Meta","CapsLock","Fn","FnLock","Hyper","Super","OS"]);let ph=null;function _x(e){ph!==e&&(ph=e,document.documentElement.dataset.input=e)}function wG(){const e=n=>{n.isComposing||n.key==="Unidentified"||yG.has(n.key)||_x("keyboard")},t=()=>_x("pointer");return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",t,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",t,!0)}}function bG(){return ph}function Lp(e){return ph!=="pointer"&&e.matches(":focus-visible")}function xr({label:e,open:t,children:n}){return o.jsx(L6,{content:e,className:"sc-tip",maxWidth:"220px",...t?{open:!0}:{},children:Tj(n)})}function Tj(e){const t=e.props.onFocus;return s.cloneElement(e,{onFocus:n=>{t==null||t(n),bG()==="pointer"&&n.preventDefault()}})}function Zs({open:e=!0,className:t,maxWidth:n,described:r,children:a,onDismiss:i,onOpenAutoFocus:c,onCloseAutoFocus:d,onPaste:f,tone:h}){const{sheet:p,grip:g}=zu(i);s.useEffect(()=>{e&&window.dispatchEvent(new CustomEvent("scenri:modal-open"))},[e]);const v=c??KU,y=d;return o.jsx(ec,{open:e,onOpenChange:b=>!b&&i(),children:o.jsxs(tc,{children:[o.jsx(nc,{className:"sc-newdlg-scrim","data-tone":h}),o.jsx(rc,{className:"sc-newdlg-layer",...r?{}:{"aria-describedby":void 0},onOpenAutoFocus:v,onCloseAutoFocus:y,onPaste:f,onPointerDown:b=>{b.target===b.currentTarget&&i()},children:o.jsxs("div",{ref:p,className:["sc-newdlg",t].filter(Boolean).join(" "),style:n?{"--sc-newdlg-max":n}:void 0,children:[o.jsx("div",{className:"sc-shotsheet-grip",...g,children:o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0})}),a]})})]})})}function ys({className:e,children:t}){return o.jsx(sc,{className:e,children:t})}const Is=s.forwardRef(function({children:t,...n},r){return o.jsx(Yh,{asChild:!0,ref:r,...n,children:t})});function Bu({className:e,children:t}){return o.jsx(Uv,{className:e,children:t})}const Vx=300,xG={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 V8({brandId:e,jobId:t,onDismiss:n}){const[r,a]=s.useState(null),[i,c]=s.useState(!1);s.useEffect(()=>{let g=!1,v;const y=async()=>{try{const b=await Me.catalogJob(e,t);if(g)return;a(b),b.finishedAt||(v=setTimeout(y,Vx))}catch{g||(v=setTimeout(y,Vx*3))}};return y(),()=>{g=!0,v&&clearTimeout(v)}},[e,t]);const d=!!r&&!r.finishedAt,f=r?wj(r):0,h=(r==null?void 0:r.errors)??[],p=async()=>{c(!0);try{await Me.cancelCatalogJob(e,t)}catch{c(!1)}};return o.jsxs(Zs,{open:!0,className:"sc-imp",maxWidth:"440px",described:!0,onDismiss:n,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Importing products"}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})]}),o.jsx(Bu,{className:"sc-imp-sub",children:o.jsxs("span",{role:"status",children:[r?xG[r.stage]??"Working":"Getting the details",r!=null&&r.message?` · ${r.message}`:""]})}),d&&o.jsx("span",{className:"sc-imp-meter",role:"progressbar","aria-label":"Import progress","aria-valuenow":f,"aria-valuemin":0,"aria-valuemax":100,children:o.jsx("div",{style:{width:`${f}%`}})}),o.jsxs("ul",{className:"sc-imp-lines",children:[o.jsxs("li",{children:[o.jsx("span",{children:"Found on the site"}),o.jsx("b",{children:((r==null?void 0:r.discovered)??0).toLocaleString()})]}),o.jsxs("li",{children:[o.jsx("span",{children:"Read"}),o.jsx("b",{children:((r==null?void 0:r.fetched)??0).toLocaleString()})]}),o.jsxs("li",{children:[o.jsx("span",{children:"Saved"}),o.jsx("b",{children:((r==null?void 0:r.upserted)??0).toLocaleString()})]}),o.jsxs("li",{children:[o.jsx("span",{children:"Pictures"}),o.jsxs("b",{children:[((r==null?void 0:r.imagesDone)??0).toLocaleString(),r!=null&&r.imagesTotal?` of ${r.imagesTotal.toLocaleString()}`:""]})]})]}),h.length>0&&o.jsxs("details",{className:"sc-imp-errs",children:[o.jsx("summary",{children:h.length===1?"1 thing went wrong":`${h.length} things went wrong`}),o.jsx("ul",{children:h.slice(0,8).map((g,v)=>o.jsx("li",{children:g.message},v))})]}),o.jsxs("div",{className:"sc-imp-foot",children:[d?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:d?"Leave it running":"Close"})]})]})}const da="(max-width: 767px)";function sr(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 Zx=new Map;function kG(e){let t=Zx.get(e);if(!t){const n=window.matchMedia(e);t={mq:n,subscribe:r=>(n.addEventListener("change",r),()=>n.removeEventListener("change",r))},Zx.set(e,t)}return t}function SG(){const e=kG("(hover: none)");return s.useSyncExternalStore(e.subscribe,()=>e.mq.matches,()=>!1)}function EG(){const{tasks:e,running:t,unread:n,panelOpen:r,setPanelOpen:a,markSeen:i}=Oa(),{brand:c}=Qt(),d=sr(da),f=CG(),[h,p]=s.useState(null);s.useEffect(()=>p(null),[c.id]),Lj(r,()=>a(!1));const g=e.find(k=>k.state==="running")??null,v=t>0?"busy":n>0?"new":"quiet",y="Activity"+(n?`, ${n} unread`:"")+(t?`, ${t} task${t===1?"":"s"} running`:""),b=v==="busy"&&g?`Rendering, ${Wl(g.startedAt,Date.now())}`:"Activity",x=o.jsx(dG,{mode:v,lead:g,running:t,unread:n,animate:f});return d?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"sc-act-btn sc-notif-btn","data-mode":v,"data-on":r||void 0,"aria-label":y,"aria-expanded":r,onClick:()=>a(!r),children:x}),r?o.jsx(Pj,{label:"Activity",onClose:()=>a(!1),children:o.jsx(Fx,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})}):null,h?o.jsx(V8,{brandId:c.id,jobId:h,onDismiss:()=>p(null)}):null]}):o.jsxs(o.Fragment,{children:[o.jsxs(Cu,{open:r,onOpenChange:a,children:[o.jsx(xr,{label:b,children:o.jsx(ju,{children:o.jsx("button",{type:"button",className:"sc-act-btn sc-notif-btn","data-mode":v,"aria-label":y,children:x})})}),o.jsx(Au,{align:"end",sideOffset:20,className:"sc-notif-pop","aria-label":"Activity",children:o.jsx(Fx,{onClose:()=>a(!1),onSeen:i,onOpenDetail:p})})]}),h?o.jsx(V8,{brandId:c.id,jobId:h,onDismiss:()=>p(null)}):null]})}function CG(){const[e,t]=s.useState(!1),n=s.useRef(!1);return s.useEffect(()=>{n.current||(n.current=!0,t(!0))},[]),e}function jG(){const e=Y6(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(Fn,{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 Z8=s.createContext(null);function $j({label:e,className:t,offset:n=22,trigger:r,children:a}){const i=sr(da),[c,d]=s.useState(!1),f=s.useRef(null),h=()=>d(!1),p=s.useCallback(()=>{var g;return(g=f.current)==null?void 0:g.focus({preventScroll:!0})},[]);return Lj(c,h),i?o.jsxs(o.Fragment,{children:[s.cloneElement(r,{ref:f,onClick:()=>d(!c),"aria-haspopup":"dialog","aria-expanded":c,"data-on":c||void 0}),c&&o.jsx(Pj,{label:e,onClose:h,children:o.jsxs("div",{className:"sc-menu-sheet",children:[o.jsx("div",{className:"sc-menu-head",children:e}),o.jsx(Z8.Provider,{value:{close:h,focusTrigger:p},children:a})]})})]}):o.jsxs(Ds,{open:c,onOpenChange:d,modal:!1,children:[o.jsx(Os,{children:s.cloneElement(r,{ref:f})}),o.jsxs(Hs,{align:"end",sideOffset:n,className:`sc-menu ${t??""}`,onPointerDownOutside:g=>{var v;(v=f.current)!=null&&v.contains(g.target)&&g.preventDefault()},onCloseAutoFocus:g=>{g.preventDefault();const v=document.activeElement;(!v||v===document.body)&&p()},children:[o.jsx("div",{className:"sc-menu-head",children:e}),o.jsx(Z8.Provider,{value:{close:null,focusTrigger:p},children:a})]})]})}function pu({className:e="sc-menu-item",to:t,onSelect:n,disabled:r,children:a,...i}){const c=s.useContext(Z8),d=c==null?void 0:c.close,f=n?()=>{c==null||c.focusTrigger(),setTimeout(()=>{c==null||c.focusTrigger(),n()},0)}:void 0;if(d){const h=()=>{d(),f==null||f()};return t?o.jsx(Fn,{className:e,to:t,onClick:d,...i,children:a}):o.jsx("button",{type:"button",className:e,onClick:h,disabled:r,...i,children:a})}return t?o.jsx(In,{asChild:!0,className:e,...i,children:o.jsx(Fn,{to:t,children:a})}):o.jsx(In,{className:e,onSelect:f,disabled:r,...i,children:a})}function Dj(e,t){return[...e].sort((n,r)=>t(n).localeCompare(t(r),void 0,{sensitivity:"base"})||n.slug.localeCompare(r.slug))}function AG(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 Dj(a,n)}function mr({label:e,title:t,body:n,busy:r,onConfirm:a,fullWidth:i,open:c,onOpenChange:d,tone:f="red"}){const h=s.useRef(!1);s.useEffect(()=>{h.current=!1},[c]);const p=()=>{h.current||(h.current=!0,a())},g=s.useRef(null),v=c!==void 0;return o.jsxs(z0,{open:c,onOpenChange:y=>{y&&(h.current=!1),d==null||d(y)},children:[c===void 0&&o.jsx(K9,{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(B0,{maxWidth:"420px",onOpenAutoFocus:()=>{v&&(g.current=document.activeElement)},onCloseAutoFocus:y=>{var b;!v||!((b=g.current)!=null&&b.isConnected)||(y.preventDefault(),g.current.focus())},children:[o.jsx(U0,{children:t}),o.jsx(W0,{size:"2",children:n}),o.jsxs(vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(K0,{children:o.jsx(ra,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(G0,{children:o.jsx(ra,{color:"red",onClick:p,disabled:r,children:e})})]})]})]})}function NG(){const{brand:e}=Qt(),t=X0(),n=Dn(),r=Np(),{push:a}=Sr(),[i,c]=s.useState(!1),d=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($j,{label:"Brands",className:"sc-menu-brand",trigger:o.jsx("button",{type:"button",className:"sc-org-btn","aria-label":`${Ea(e)}, brand and settings`,children:o.jsx(Aj,{brand:e,size:32,round:!0})}),children:[o.jsx(RG,{}),o.jsx("div",{className:"sc-menu-rule"}),o.jsxs(pu,{onSelect:()=>n("/setup"),children:[o.jsx(kr,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Set up a brand"})]}),o.jsxs(pu,{onSelect:()=>t(),children:[o.jsx(IB,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Settings"})]}),o.jsxs(pu,{"data-quit":"",onSelect:()=>c(!0),children:[o.jsx(QB,{size:16,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Shut down Scenri"})]})]}),o.jsx(mr,{open:i,onOpenChange:c,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 d()})]})}const MG=7;function RG(){const{brands:e}=jn(),{brand:t}=Qt(),n=Dn(),[r,a]=s.useState(""),i=v=>Ea(v).trim().toLowerCase(),c=new Map;for(const v of e)c.set(i(v),(c.get(i(v))??0)+1);const d=e.length>=MG,f=r.trim(),h=d&&f?AG(e,f,Ea):[],p=v=>{const y=v.id===t.id,b=(c.get(i(v))??0)>1;return o.jsxs(pu,{"data-current":y||void 0,"data-two-line":b||void 0,onSelect:y?void 0:()=>n(ao(v)),children:[o.jsx(Aj,{brand:v,size:20,round:!0}),o.jsxs("span",{className:"sc-menu-brand-lb",children:[o.jsx("span",{dir:"auto",children:Ea(v)}),b&&o.jsxs("span",{className:"sc-menu-brand-sub",children:["/",v.slug]})]}),y&&o.jsxs(o.Fragment,{children:[o.jsx(nr,{size:14,className:"sc-menu-check","aria-hidden":"true"}),o.jsx("span",{className:"sc-vh",children:", current brand"})]})]},v.id)},g=Dj(e.filter(v=>v.id!==t.id),Ea);return d?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"sc-menu-find",children:[o.jsx(Nu,{size:16,"aria-hidden":"true"}),o.jsx("input",{type:"search",value:r,placeholder:"Find a brand","aria-label":"Find a brand",onChange:v=>a(v.target.value),onKeyDown:v=>{const y=h.find(b=>b.id!==t.id);v.key!=="Enter"||!y||(v.preventDefault(),n(ao(y)))}})]}),o.jsx("div",{className:"sc-menu-brands",children:f?h.length>0?h.map(p):o.jsx("p",{className:"sc-menu-none",children:"No brand by that name."}):o.jsxs(o.Fragment,{children:[p(t),g.map(p)]})})]}):o.jsxs(o.Fragment,{children:[p(t),g.map(p)]})}function PG(){const e=sr("(min-width: 1024px)"),t=YC(),[n]=Bi();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 Bo(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 q6(e){const t=Or(e.avatar);if(t)return{src:t};const n=a=>{var i;return Array.isArray(a)?Or((i=a[0])==null?void 0:i.file):null},r=Or(e.preview)??n(e.shots)??n(e.sourceRefs);return r?{src:r,crop:"top"}:{src:null}}const LG=["hero","close","hands","angle","bold"],z8=e=>Array.isArray(e)?e.map(t=>Or(t==null?void 0:t.file)).filter(t=>!!t):[],X6=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 w0(e){return e.length<2?[...e]:e.slice().reverse()}function Oj(e){const t=e.filter(n=>n.origin!=="catalog");return t.length===e.length?w0(e):[...w0(t),...e.filter(n=>n.origin==="catalog")]}function rf(e){return w0(X6(e).filter(t=>!t.supersededBy).map(Hj))}function TG(e,t){const n=X6(e).find(r=>r.id===t);return n?Hj(n):void 0}function Q6(e,t){var i;const n=X6(e),r=new Set([t]);let a=t;for(;;){const c=(i=n.find(d=>d.id===a))==null?void 0:i.supersededBy;if(typeof c!="string"||!c||r.has(c)||!n.some(d=>d.id===c))return a;r.add(c),a=c}}function Hj(e){var a;const t=z8(e.shots),n=z8(e.sourceRefs),r=Or(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:Or(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 hc(e){var n;const t=((n=e==null?void 0:e.json)==null?void 0:n.scenes)??[];return w0(t.map($G))}function mh(e,t){return hc(e).find(n=>n.id===t)}function $G(e){const t=z8(e.refs);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:Or(e.preview)??t[0]??null,previewColor:null,custom:!0,refs:t,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(n=>(n==null?void 0:n.id)&&(n==null?void 0:n.label)&&(n==null?void 0:n.camera)).map(n=>({id:String(n.id),label:String(n.label),camera:String(n.camera)})):void 0,examples:Array.isArray(e.examples)?e.examples.filter(n=>LG.includes(n==null?void 0:n.role)&&Or(n==null?void 0:n.file)).map(n=>({role:n.role,url:Or(n.file),hash:String(n.file).slice(6),earlier:n.from!==e.preview,with:n.presenter?"presenter":"product",...n.setup?{setup:String(n.setup)}:{}})):void 0}}function gh(e,t){const n=new Set(e.map(r=>r.id));return[...e,...t.filter(r=>!n.has(r.id))]}function DG(e,t){return t.map(n=>n.t==="character"&&n.id?{...n,id:Q6(e,n.id)}:n)}function Ij(){const{brand:e,products:t}=Qt(),{scenes:n,presenters:r,demoProducts:a,showcase:i}=jn();return s.useMemo(()=>{const c={presenters:rf(e),scenes:hc(e)},d=new Set,f=b=>!b||d.has(b)?null:(d.add(b),b),h=(b,x)=>{for(const k of b){const S=f(x(k));if(S)return tr(S,"tile")}return null},p=b=>h(i.filter(x=>{var k;return(((k=x.brief)==null?void 0:k.tokens)??[]).some(S=>(S==null?void 0:S.t)===b)}),x=>x.previewUrl),g=h([...t].reverse(),b=>{var x,k;return Or((k=(x=b==null?void 0:b.shots)==null?void 0:x[0])==null?void 0:k.file)}),v=h(c.presenters,b=>b.previewUrl??Bo(b).src),y=h(c.scenes,b=>b.previewUrl);return{product:{url:g??p("product")??h(a,b=>b.previewUrl)??null,count:t.length,own:!!g},presenter:{url:v??p("character")??h(r,b=>b.previewUrl??Bo(b).src)??null,count:c.presenters.length,own:!!v},scene:{url:y??h(n,b=>b.previewUrl)??p("template")??null,count:c.scenes.length,own:!!y}}},[e,t,n,r,a,i])}const OG=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:kp},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:bp},{kind:"scene",label:"Scene",line:"Where it takes place",noun:"scene",icon:wp}],zx=(e,t)=>e===0?"None yet":`${e} ${t}${e===1?"":"s"}`;function HG({suggest:e,onPick:t}){const n=s.useRef(null),{close:r}=ws("new"),a=Ij(),i=()=>{var c,d;(d=(c=n.current)==null?void 0:c.querySelector(e?`[data-kind="${e}"]`:"[data-kind]"))==null||d.focus()};return s.useEffect(i,[e]),o.jsxs(Zs,{className:"sc-newpick",maxWidth:"620px",onDismiss:r,onOpenAutoFocus:c=>{c.preventDefault(),i()},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Add to this brand"}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})]}),o.jsx("p",{className:"sc-newdlg-sub",children:"The three things every shot is made from."}),o.jsx("div",{className:"sc-newdlg-body",children:o.jsx("div",{className:"sc-pickgrid",ref:n,children:OG.map(({kind:c,label:d,line:f,noun:h,icon:p})=>{const{url:g,count:v,own:y}=a[c];return o.jsxs("button",{type:"button",className:"sc-pick","data-kind":c,onClick:()=>t(c),"aria-label":`${d}. ${f}. ${zx(v,h)}.`,children:[o.jsxs("span",{className:"sc-pick-media",children:[g?o.jsx("img",{src:g,alt:"",loading:"lazy"}):o.jsx("span",{className:"sc-pick-blank",children:o.jsx(p,{size:22})}),y&&o.jsx("span",{className:"sc-pick-mine",children:"Yours"})]}),o.jsxs("span",{className:"sc-pick-cap",children:[o.jsx("b",{children:d}),o.jsx("small",{children:f})]}),o.jsx("span",{className:"sc-pick-count",children:zx(v,h)})]},c)})})})]})}function IG({id:e,previewUrl:t,pending:n,title:r,primary:a,secondary:i,useLabel:c,variant:d,onOpen:f,onUse:h,href:p,selected:g,onToggle:v,bookmarked:y,onBookmark:b,menuItems:x,fresh:k,size:S="grid"}){const[E,C]=s.useState(!1),[N,M]=s.useState(!1),T=s.useRef(null),L=SG(),A=d==="use"&&!!f&&!!h,P=x??[];s.useEffect(()=>{if(!N)return;const V=ie=>{var B;(B=T.current)!=null&&B.contains(ie.target)||M(!1)};return document.addEventListener("pointerdown",V),()=>document.removeEventListener("pointerdown",V)},[N]);const $=t&&!E?o.jsx("img",{src:tr(t,"tile"),alt:"",loading:"lazy",onError:()=>C(!0)}):n?o.jsx("span",{className:"sc-shimmer"}):o.jsx("span",{className:"sc-lookcard-blank",children:o.jsx(Vs,{size:20})}),H=o.jsxs("span",{className:"sc-lookcard-cap",title:r,children:[o.jsx("b",{dir:"auto",children:a}),i&&o.jsx("span",{children:i})]});if(d==="select")return o.jsxs("button",{type:"button",className:"sc-lookcard","data-fb-id":e,"data-variant":"select","data-size":S,"data-on":g||void 0,"data-just-added":k||void 0,"aria-pressed":!!g,"aria-label":r,onClick:()=>v==null?void 0:v(e),children:[o.jsxs("span",{className:"sc-lookcard-media",children:[$,o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0}),o.jsx("span",{className:"sc-lookcard-tick","aria-hidden":!0,children:o.jsx(nr,{size:11,weight:"bold"})})]}),H]});const O=()=>{if(A&&L){if(!N){M(!0);return}M(!1)}f?f(e):h==null||h(e)},Q=()=>{M(!1),h==null||h(e)},I=o.jsxs("div",{ref:T,className:"sc-lookcard","data-fb":"catalog-card","data-fb-id":e,"data-variant":d,"data-size":S,"data-armed":N||void 0,"data-just-added":k||void 0,children:[o.jsxs("div",{className:"sc-lookcard-media",children:[p?o.jsxs(Fn,{className:"sc-lookcard-open",to:p,"aria-label":r,onClick:V=>{if(A&&L){if(!N){V.preventDefault(),M(!0);return}M(!1)}},children:[$,o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0})]}):o.jsxs("button",{type:"button",className:"sc-lookcard-open",onClick:O,"aria-label":r,children:[$,o.jsx("span",{className:"sc-lookcard-veil","aria-hidden":!0})]}),A&&o.jsx("button",{type:"button",className:"sc-lookcard-use",onClick:Q,children:c}),b&&o.jsx("button",{type:"button",className:"sc-cardpuck sc-lookcard-bookmark","data-on":y||void 0,"aria-pressed":!!y,"aria-label":y?`Remove bookmark from ${a}`:`Bookmark ${a}`,onClick:V=>{V.stopPropagation(),b(e)},children:o.jsx(yp,{size:13,weight:y?"fill":"regular"})}),P.length>0&&o.jsxs(Ds,{children:[o.jsx(Os,{children:o.jsx("button",{type:"button",className:"sc-cardpuck sc-lookcard-more","aria-label":`More for ${a}`,onClick:V=>V.stopPropagation(),onContextMenu:V=>V.stopPropagation(),children:o.jsx($6,{size:16,weight:"bold"})})}),o.jsxs(Hs,{align:"end",sideOffset:6,children:[f&&o.jsx(In,{onSelect:()=>f(e),children:"Open"}),p&&o.jsx(In,{onSelect:()=>window.open(p,"_blank"),children:"Open in new tab"}),A&&o.jsx(In,{onSelect:()=>h==null?void 0:h(e),children:c}),b&&o.jsx(In,{onSelect:()=>b(e),children:y?"Remove bookmark":"Bookmark"}),P.map(V=>o.jsxs("span",{style:{display:"contents"},children:[V.separated&&o.jsx(Eu,{}),o.jsx(In,{color:V.danger?"red":void 0,onSelect:V.onSelect,children:V.label})]},V.key))]})]})]}),H]});return!f&&!h&&!p&&P.length===0||L?I:o.jsxs(pp,{children:[o.jsx(mp,{children:I}),o.jsxs(gp,{children:[f&&o.jsx(Si,{onSelect:()=>f(e),children:"Open"}),p&&o.jsx(Si,{onSelect:()=>window.open(p,"_blank"),children:"Open in new tab"}),A&&o.jsx(Si,{onSelect:()=>h==null?void 0:h(e),children:c}),b&&o.jsx(Si,{onSelect:()=>b(e),children:y?"Remove bookmark":"Bookmark"}),P.map(V=>o.jsxs("span",{style:{display:"contents"},children:[V.separated&&o.jsx(j6,{}),o.jsx(Si,{color:V.danger?"red":void 0,onSelect:V.onSelect,children:V.label})]},V.key))]})]})}function Tp({size:e="grid",count:t=4}){return o.jsx(o.Fragment,{children:Array.from({length:t},(n,r)=>o.jsx("div",{className:"sc-lookcard","data-variant":"skeleton","data-size":e,"aria-hidden":!0},r))})}const Uu=s.memo(IG),FG=/^(p|product|products|item|items|dp|sku)$/i;function _G(e){let t="";try{const r=new URL(e).pathname.split("/").filter(Boolean);t=[...r].reverse().find(a=>!FG.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 VG(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 ug=24,ZG=12;function Fj({brandId:e,scan:t,busy:n,error:r,onImport:a,onImportAll:i,onDismiss:c}){const d=s.useMemo(()=>t.candidateUrls.length?t.candidateUrls:(t.cards??[]).map(z=>z.url).filter(Boolean),[t.candidateUrls,t.cards]),[f,h]=s.useState(""),[p,g]=s.useState(()=>new Set(d)),[v,y]=s.useState(ug),[b,x]=s.useState(()=>{const z=new Map;for(const Y of t.cards??[])Y.url&&z.set(Y.url,{externalKey:Y.externalKey,title:Y.title,url:Y.url,images:Y.image?[{url:Y.image}]:[]});for(const Y of t.candidates)Y.url&&z.set(Y.url,Y);return z}),k=s.useRef(new Set),S=s.useRef(b),E=s.useRef(!0),[C,N]=s.useState(0);s.useEffect(()=>(E.current=!0,()=>{E.current=!1}),[]);const[M,T]=s.useState(null),L=s.useRef(null),A=s.useMemo(()=>d.map(z=>({url:z,name:_G(z)})),[d]),P=s.useMemo(()=>A.filter(z=>VG(z.name,f)),[A,f]),$=s.useMemo(()=>P.slice(0,v),[P,v]);s.useEffect(()=>y(ug),[f]);const H=s.useRef([]),O=s.useRef(0),Q=s.useRef(()=>{}),I=2,V=120,ie=s.useCallback(()=>{for(;O.current<I&&H.current.length;){const z=H.current.splice(Math.max(0,H.current.length-ZG));if(!z.length)return;O.current++,N(O.current),Me.catalogDetails(e,z).then(({products:Y})=>{if(!E.current)return;const J=new Map(S.current);for(const de of Y)de.url&&J.set(de.url,de);for(let de=0;de<Y.length&&de<z.length;de++)J.has(z[de])||J.set(z[de],Y[de]);S.current=J,x(J)}).catch(()=>{for(const Y of z)k.current.delete(Y)}).finally(()=>{O.current=Math.max(0,O.current-1),E.current&&(N(O.current),Q.current())})}},[e]);Q.current=ie,s.useEffect(()=>{const z=L.current;if(!z)return;const Y=new IntersectionObserver(J=>{let de=!1;for(const ae of J){if(!ae.isIntersecting)continue;const W=ae.target.dataset.fbId;if(Y.unobserve(ae.target),!(!W||S.current.has(W)||k.current.has(W))){for(k.current.add(W),H.current.push(W);H.current.length>V;){const ye=H.current.shift();ye&&k.current.delete(ye)}de=!0}}de&&Q.current()},{root:z,rootMargin:"250% 0px"});for(const J of z.querySelectorAll("[data-fb-id]"))Y.observe(J);return()=>Y.disconnect()},[v,f]),s.useEffect(()=>{if(!M||v>=P.length)return;const z=M.closest(".sc-wizpick-grid"),Y=new IntersectionObserver(J=>{J.some(de=>de.isIntersecting)&&y(de=>de+ug)},{root:z,rootMargin:"0px 0px 300% 0px"});return Y.observe(M),()=>Y.disconnect()},[M,v,P.length]);const B=s.useCallback(z=>{g(Y=>{const J=new Set(Y);return J.delete(z)||J.add(z),J})},[]),F=P.length>0&&P.every(z=>p.has(z.url)),te=p.size===d.length,X=()=>{g(z=>{const Y=new Set(z);for(const J of P)F?Y.delete(J.url):Y.add(J.url);return Y})},Z=p.size,K=Z===1?"1 product":`${Z.toLocaleString()} products`;return o.jsxs(Zs,{open:!0,className:"sc-wizpick",maxWidth:"760px",described:!0,onDismiss:c,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Products on your site"}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})]}),o.jsx(Bu,{className:"sc-wizpick-sub",children:`${d.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(Nu,{size:13}),o.jsx("input",{type:"search",value:f,onChange:z=>h(z.target.value),placeholder:`Search ${d.length.toLocaleString()} products`,"aria-label":"Search products"})]}),o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:X,disabled:!P.length,children:F?"Select none":f?`Select these ${P.length.toLocaleString()}`:"Select all"}),o.jsxs("span",{className:"sc-wizpick-count",children:[Z.toLocaleString()," selected"]})]}),o.jsxs("div",{className:"sc-wizpick-grid",ref:L,children:[$.map(z=>{var J,de;const Y=b.get(z.url);return o.jsx(Uu,{id:z.url,previewUrl:((de=(J=Y==null?void 0:Y.images)==null?void 0:J[0])==null?void 0:de.url)??null,pending:!Y,title:(Y==null?void 0:Y.title)??z.name,primary:(Y==null?void 0:Y.title)??z.name,secondary:(Y==null?void 0:Y.price)!=null?`${Y.currency??""} ${Y.price}`.trim():(Y==null?void 0:Y.category)??"",useLabel:"Import",variant:"select",selected:p.has(z.url),onToggle:B,size:"grid"},z.url)}),v<P.length&&o.jsx("div",{className:"sc-wizpick-end",ref:T,"aria-hidden":!0}),!P.length&&o.jsxs("p",{className:"sc-wizpick-empty",children:["Nothing here matches “",f,"”."]})]}),o.jsxs("div",{className:"sc-wizpick-foot",children:[o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:c,children:"Not now"}),r?o.jsx("span",{className:"sc-wizpick-error",role:"alert",children:r}):C>0&&o.jsx("span",{className:"sc-wizpick-loading",children:"Loading products"}),o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!Z||n||b.size===0&&C>0,onClick:()=>te?i():a([...p]),children:n?"Importing":`Import ${K}`})]})]})}const dg=700,zG=45e3,BG=3e3;function _j(e,t){const[n,r]=s.useState(null),[a,i]=s.useState(!1),[c,d]=s.useState(!1),[f,h]=s.useState(null),[p,g]=s.useState(0),v=s.useRef(!0);s.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]),s.useEffect(()=>{if(!e)return;let x=!1,k,S=null;i(!0),d(!1),r(null),h(null);const E=(N,M)=>{r(N),h(M),i(!1),d(!0)};return(async()=>{try{const{scanId:N}=await Me.catalogScan(e,t);if(S=N,x||!v.current){Me.cancelCatalogScan(e,N).catch(()=>{});return}const M=Date.now()+zG,T=async()=>{if(!(x||!v.current)){if(Date.now()>M){E(null,{kind:"timeout"});return}try{const L=await Me.catalogScanState(e,N,AbortSignal.timeout(BG));if(x||!v.current)return;if(L.status==="running"){k=setTimeout(T,dg);return}L.result?E(L.result,null):E(null,{kind:"error",reason:L.error??"The look for a shop did not finish."})}catch(L){if(x||!v.current)return;if((L==null?void 0:L.status)===404){E(null,{kind:"error",reason:"The look for a shop was interrupted."});return}k=setTimeout(T,dg)}}};k=setTimeout(T,dg)}catch{x||E(null,{kind:"error",reason:"The look for a shop could not start."})}})(),()=>{x=!0,k&&clearTimeout(k),S&&Me.cancelCatalogScan(e,S).catch(()=>{})}},[e,t,p]);const y=s.useCallback(()=>g(x=>x+1),[]);return{scan:n,scanning:a,settled:c,outcome:a?{kind:"scanning"}:f||(n?{kind:"result",scan:n}:{kind:"idle"}),retry:y}}const b0=[{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:"detail-fabric",label:"Detail / fabric"}]},{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:"label",label:"Label"}]},{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:"clasp-detail",label:"Clasp detail"}]},{key:"accessories",label:"Accessories",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"detail",label:"Detail"}]},{key:"beverage",label:"Beverage",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"label",label:"Label"}]},{key:"food",label:"Food",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"packaging-label",label:"Packaging label"}]},{key:"other",label:"Other",angles:[{key:"three-quarter",label:"Three-quarter"},{key:"front",label:"Front"},{key:"side",label:"Side"}]}],J6=new Map(b0.map(e=>[e.key,e]));J6.get("other");function Ru(e){var t;return e?((t=J6.get(e))==null?void 0:t.label)??e:null}function UG(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(c=>n.includes(c)))return a}function e4(e){return e.category&&J6.has(e.category)?e.category:UG(e.productType,e.tags)??null}function WG({title:e,sub:t,error:n,footnote:r,primaryLabel:a,ready:i,blocked:c,busy:d,width:f="440px",onBack:h,onPrimary:p,onPasteFiles:g,children:v}){const{close:y}=ws("new");return o.jsxs(Zs,{maxWidth:f,onDismiss:y,onPaste:b=>{var k;if(!g)return;const x=Array.from(((k=b.clipboardData)==null?void 0:k.files)??[]).filter(S=>S.type.startsWith("image/"));x.length&&(b.preventDefault(),g(x))},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(Da,{size:15})}),o.jsx(ys,{className:"sc-newdlg-title",children:e}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})]}),t&&o.jsx("p",{className:"sc-newdlg-sub",children:t}),o.jsx("div",{className:"sc-newdlg-body",children:v}),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||d||void 0,title:c,onClick:()=>{i&&!d&&p()},children:[d?o.jsx(wr,{size:"1"}):null,a]}),r&&o.jsx("p",{className:"sc-dlg-foot",children:r})]})]})}function Vj({onFiles:e,onReject:t,disabled:n}){const r=s.useRef(0),[a,i]=s.useState(!1),c=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(),c();const h=Array.from(f.dataTransfer.files).filter(p=>p.type.startsWith("image/"));h.length?e(h):t==null||t()}}}}function Bx({label:e,hint:t,busy:n,disabled:r,multiple:a=!0,accept:i="image/*",onFiles:c,onReject:d,children:f}){const h=s.useRef(null),{dropProps:p}=Vj({onFiles:c,onReject:d,disabled:r||n});return o.jsxs("button",{type:"button",className:"sc-dropzone",disabled:r||n,onClick:()=>{var g;return(g=h.current)==null?void 0:g.click()},...p,children:[o.jsx("input",{ref:h,type:"file",accept:i,multiple:a,hidden:!0,onChange:g=>{const v=Array.from(g.target.files??[]);g.target.value="",v.length&&c(v)}}),n?o.jsx(wr,{}):f,o.jsx("span",{className:"sc-dropzone-label",children:e}),t&&o.jsx("small",{children:t})]})}function Zj({hashes:e,max:t,label:n,hint:r,busy:a,onAdd:i,onRemove:c,onReject:d}){if(e.length===0)return o.jsx("div",{className:"sc-assetwell",children:o.jsx(Bx,{label:n,hint:r,busy:a,onFiles:i,onReject:d,children:o.jsx(kr,{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:nn(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:()=>c(h),children:o.jsx(Cn,{size:11,weight:"bold"})})]},h)),f>0&&o.jsx(Bx,{label:`${f} more`,busy:a,onFiles:i,onReject:d,children:o.jsx(kr,{size:15})})]})}let Ud=null;const zj=(e,t)=>`${e}:${t}`;function GG(e,t,n){Ud={key:zj(e,t),fields:n}}function KG(e,t){if(!Ud||Ud.key!==zj(e,t))return null;const{fields:n}=Ud;return Ud=null,n}const Ux={name:"",instruction:"",facets:[],imageHashes:[],importUrl:""};function YG(e,t,n){const r=n.restore??!1,[a,i]=s.useState(Ux),[c,d]=s.useState(!1),[f,h]=s.useState(null),p=s.useRef(null),g=s.useRef(null),v=s.useRef(n.pendingState);v.current=n.pendingState;const y=s.useRef(n.exists);y.current=n.exists;const b=s.useRef(n.onDiscarded);b.current=n.onDiscarded;const x=s.useRef(a);x.current=a,s.useEffect(()=>{var P;if(r){const $=KG(e,t);if($){i($);return}}const L=nj(e,t),A=L!=null&&L.pending?v.current(L.pending):null;if(L!=null&&L.pending&&A==="unknown"&&((P=y.current)!=null&&P.call(y,L.name))){eu(e,t);return}if(L&&!L.pending){eu(e,t);return}L&&uW(L,A)&&(g.current=L.pending,i({name:L.name,instruction:L.instruction,facets:L.facets,imageHashes:L.imageHashes,importUrl:L.importUrl}))},[e,t,r]);const k=s.useCallback(L=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{g.current&&ig(L)?lg(e,t,{...L,pending:g.current}):eu(e,t)},400)},[e,t]),S=s.useCallback(L=>{i(A=>{const P={...A,...typeof L=="function"?L(A):L};return k(P),P})},[k]),E=s.useCallback(()=>{var A;p.current&&clearTimeout(p.current);const L=x.current;if(g.current&&ig(L)){lg(e,t,{...L,pending:g.current});return}eu(e,t),ig(L)&&(GG(e,t,L),(A=b.current)==null||A.call(b))},[e,t]);s.useEffect(()=>(window.addEventListener("beforeunload",E),()=>{window.removeEventListener("beforeunload",E),E()}),[E]);const C=s.useCallback(async L=>{d(!0),h(null);try{const A=n.max-x.current.imageHashes.length,P=[];for(const $ of L.slice(0,A))P.push(await y0($));S($=>({imageHashes:[...new Set([...$.imageHashes,...P])].slice(0,n.max)}))}catch(A){h(String(A.message??A))}finally{d(!1)}},[n.max,S]),N=s.useCallback(L=>S(A=>({imageHashes:A.imageHashes.filter(P=>P!==L)})),[S]),M=s.useCallback(L=>S(A=>({facets:A.facets.includes(L)?A.facets.filter(P=>P!==L):[...A.facets,L]})),[S]),T=s.useCallback(L=>{if(p.current&&clearTimeout(p.current),!L){eu(e,t),g.current=null,i(Ux);return}g.current=L,i(A=>(lg(e,t,{...A,pending:L}),A))},[e,t]);return{fields:a,set:S,uploading:c,err:f,setErr:h,addFiles:C,removeHash:N,toggleFacet:M,submitted:T}}const Wx=6,qG=3;function XG({onBack:e,onStarted:t,restore:n,onDiscarded:r}){var A,P;const{brand:a}=Qt(),{applyBrand:i}=jn(),[c,d]=s.useState(!1),[f,h]=s.useState(!1),[p,g]=s.useState(!1),v=YG(a.id,"product",{max:Wx,pendingState:()=>"unknown",restore:n,onDiscarded:r}),y=v.fields.imageHashes.length>0,b=y?void 0:"Add at least one photo",x=async()=>{d(!0),v.setErr(null);try{const{productId:$,...H}=await Me.createProduct(a.id,{name:v.fields.name.trim(),imageHashes:v.fields.imageHashes,category:v.fields.facets[0]});i(H);const O=v.fields.name.trim()||"Product";v.submitted(null),t({kind:"product",id:$,name:O})}catch($){v.setErr(String($.message??$))}finally{d(!1)}},[k,S]=s.useState(null),{scan:E,scanning:C,settled:N}=_j(k?a.id:null,k??void 0),M=async $=>{const H=k??v.fields.importUrl.trim()??"";h(!0),v.setErr(null);try{await Me.catalogImport(a.id,H,$),v.set({importUrl:""}),S(null),t({kind:"product",id:"",name:H})}catch(O){v.setErr(String(O.message??O))}finally{h(!1)}},T=()=>{var H,O;const $=v.fields.importUrl.trim()||(((O=(H=a.json)==null?void 0:H.meta)==null?void 0:O.website)??"");$&&(v.setErr(null),S($))};s.useEffect(()=>{!k||!N||E&&E.verdict==="found"&&E.candidates.length||M()},[E,N,k]);const L=$=>{$.key==="Enter"&&($.preventDefault(),y&&!c&&x())};return o.jsxs(WG,{title:"New product",error:v.err,footnote:"Added to this brand. No preview.",primaryLabel:"Add product",ready:y,blocked:b,busy:c,onBack:e,onPrimary:()=>void x(),onPasteFiles:$=>void v.addFiles($),children:[o.jsxs("div",{className:"sc-assetform",children:[o.jsx(Zj,{hashes:v.fields.imageHashes,max:Wx,label:"Add packshots",hint:`Straight, well-lit packshots. The first ${qG} are the ones a shot attaches.`,busy:v.uploading,onAdd:$=>void v.addFiles($),onRemove:v.removeHash,onReject:()=>v.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:v.fields.name,onChange:$=>v.set({name:$.target.value}),onKeyDown:L})]})}),o.jsxs("fieldset",{className:"sc-assetform-facets",children:[o.jsx("legend",{children:"Category"}),o.jsx("div",{className:"sc-assetform-facets-chips",children:b0.map($=>o.jsx("button",{type:"button",className:"sc-chip","data-on":v.fields.facets[0]===$.key||void 0,"aria-pressed":v.fields.facets[0]===$.key,onClick:()=>v.set({facets:v.fields.facets[0]===$.key?[]:[$.key]}),children:$.label},$.key))})]})]}),o.jsx("div",{className:"sc-newdlg-secondary",children:p?o.jsxs(o.Fragment,{children:[o.jsx("label",{className:"sc-newdlg-seclabel",htmlFor:"sc-import-url",children:"Your store's address"}),o.jsxs("div",{className:"sc-newdlg-secrow",children:[o.jsx("input",{id:"sc-import-url",className:"sc-in",type:"url",placeholder:((P=(A=a.json)==null?void 0:A.meta)==null?void 0:P.website)??"https://yourstore.com",value:v.fields.importUrl,onChange:$=>v.set({importUrl:$.target.value}),onKeyDown:$=>{$.key==="Enter"&&T()}}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:f||C,onClick:T,children:C?"Looking…":f?"Starting…":"Import"})]})]}):o.jsx("button",{type:"button",className:"sc-newdlg-secmore",onClick:()=>g(!0),children:"Import a catalog from a store URL"})}),E&&E.verdict==="found"&&E.candidates.length>0&&o.jsx(Fj,{brandId:a.id,scan:E,busy:f,onImport:$=>void M($),onImportAll:()=>void M(),onDismiss:()=>S(null)})]})}const fg="1",QG={product:"Product",presenter:"Presenter",scene:"Scene"},JG=["product","presenter","scene"],eK=e=>!!e&&JG.includes(e),Bj=s.createContext(null);function Uj(){const e=s.useContext(Bj);if(!e)throw new Error("useCreateAsset must be used inside AssetCreateHost");return e}function Xi(){return Uj().open}function t4(){const{announce:e,caps:t}=Uj();return{announce:e,caps:t}}function tK({children:e}){const{brand:t}=Qt(),n=Dn(),r=_n(),{push:a}=Sr(),{refreshBrands:i}=jn(),{builds:c,poke:d}=Oa(),f=ws("new"),h=f.value,p=!!tn({path:it.products,end:!1}),g=!!tn({path:it.presenters,end:!1}),v=!!tn({path:it.scenes,end:!1}),y=p?"product":g?"presenter":v?"scene":null,b=!!tn({path:it.presenterStudio}),x=!!tn({path:it.presenterEdit}),k=!!tn({path:it.sceneStudio}),S=!!tn({path:it.sceneEdit}),[E,C]=s.useState(null),[N,M]=s.useState(!1),[T,L]=s.useState(!1),A=s.useRef(null),P=s.useRef(null),$=f.open,H=f.set,O=f.close,Q=s.useCallback((z,Y)=>{if(A.current=z==="choose"||!(Y!=null&&Y.onCreated)?null:{kind:z,fn:Y.onCreated},z==="presenter"){n(Ti(t));return}if(z==="scene"){n(Li(t),{state:{from:r.pathname+r.search}});return}P.current=document.activeElement instanceof HTMLElement?document.activeElement:null,M(z==="choose"),L(!1),$(z==="choose"?fg:z)},[$,n,t,r.pathname,r.search]);s.useEffect(()=>{h==="presenter"&&n(Ti(t),{replace:!0}),h==="scene"&&n(Li(t),{replace:!0})},[h,n,t]);const I=s.useCallback(()=>{A.current=null,M(!1),O()},[O]),V=s.useCallback(z=>{a({kind:"success",title:`${QG[z]} discarded`,detail:"Nothing was saved.",action:{label:"Undo",onClick:()=>{L(!0),M(!1),$(z)}}})},[$,a]);s.useEffect(()=>{h===null&&L(!1)},[h]),s.useEffect(()=>{if(h!==null)return;const z=P.current;P.current=null,z!=null&&z.isConnected&&z.focus()},[h]);const ie=h!==null||b||x||k||S;s.useEffect(()=>{if(!ie)return;let z=!0,Y=null;const J=de=>Me.assetBuildCapabilities().then(ae=>z&&C(ae)).catch(()=>{z&&de&&(Y=setTimeout(()=>J(!1),600))});return J(!0),()=>{z=!1,Y&&clearTimeout(Y)}},[ie]);const B=s.useCallback(z=>{const Y=c.find(J=>J.id===z);return Y?Y.stage==="failed"?"failed":Y.stage==="cancelled"?"cancelled":Y.stage==="done"?"done":"running":"unknown"},[c]),F=s.useCallback(z=>{var de;const Y=A.current;if(A.current=null,d(),z.kind==="product"){if(!z.id){a({kind:"info",title:"Importing your catalog",detail:z.name});return}(Y==null?void 0:Y.kind)==="product"&&Y.fn(z),a({kind:"success",title:`${z.name} added`,actions:[{label:"Add details",onClick:()=>n(sa(t,z.id))},{label:"Use in a shot",onClick:()=>n(`${hr(t)}?product=${z.id}&compose=1`)}]});return}if(z.kind==="presenter"){(Y==null?void 0:Y.kind)==="presenter"&&Y.fn(z),a({kind:"success",title:`${z.name} added`,actions:[{label:"Use in a shot",onClick:()=>n(`${hr(t)}?presenter=${z.id}&compose=1`)}]});return}i(),(Y==null?void 0:Y.kind)==="scene"&&Y.fn(z);const J=(de=z.verticals)!=null&&de.length?`Filed under ${z.verticals.join(" and ")}.`:void 0;a({kind:"success",title:z.how==="updated"?`${z.name} changed`:`${z.name} saved`,detail:J,actions:[{label:"Open",onClick:()=>n(Hr(t,z.id))},{label:"Use in a shot",onClick:()=>n(`${hr(t)}?scene=${z.id}&compose=1`)}]})},[t,n,d,a,i]),te=s.useCallback(z=>{F(z),I()},[I,F]),X=s.useMemo(()=>({open:Q,announce:F,caps:E}),[Q,F,E]),Z=eK(h)?h:null,K={onBack:N?()=>H(fg):void 0,onStarted:te,caps:E,pendingState:B,restore:T,onDiscarded:()=>Z&&V(Z)};return o.jsxs(Bj.Provider,{value:X,children:[e,h===fg&&o.jsx(HG,{suggest:y,onPick:z=>{if(z==="presenter"){n(Ti(t),{replace:!0});return}if(z==="scene"){n(Li(t),{replace:!0});return}M(!0),H(z)}}),Z==="product"&&o.jsx(XG,{...K},"product")]})}const nK=[{kind:"product",label:"Product",line:"What you are photographing",noun:"product",icon:kp},{kind:"presenter",label:"Presenter",line:"Who appears in the shot",noun:"presenter",icon:bp},{kind:"scene",label:"Scene",line:"The place and its light",noun:"scene",icon:wp}];function rK(){var c;const e=Xi(),t=Ij(),{showcase:n}=jn(),r=((c=n.find(d=>d.previewUrl))==null?void 0:c.previewUrl)??null,a=Y6(16).find(d=>d.key==="create"),i=a?`${a.to}&attach=all`:"";return o.jsxs("div",{className:"sc-new",children:[o.jsxs(Fn,{className:"sc-new-go",to:i,"aria-label":"New shot","data-attach-opener":"",children:[o.jsx(kr,{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($j,{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(_i,{size:12,weight:"bold",className:"sc-new-caret","aria-hidden":"true"})}),children:[o.jsxs(pu,{className:"sc-menu-item sc-start-row","data-lead":"",to:i,children:[o.jsx("span",{className:"sc-start-pic",children:r?o.jsx("img",{src:tr(r,"tile"),alt:"",loading:"lazy",decoding:"async"}):o.jsx("span",{className:"sc-start-glyph",children:o.jsx(m7,{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"}),nK.map(d=>{const{url:f,count:h}=t[d.kind];return o.jsxs(pu,{className:"sc-menu-item sc-start-row",onSelect:()=>e(d.kind),children:[o.jsx("span",{className:"sc-start-pic",children:f?o.jsx("img",{src:f,alt:"",loading:"lazy",decoding:"async"}):o.jsx("span",{className:"sc-start-glyph",children:o.jsx(d.icon,{size:22})})}),o.jsxs("span",{className:"sc-start-txt",children:[o.jsx("b",{children:d.label}),o.jsx("small",{children:d.line})]}),o.jsxs("span",{className:"sc-start-n",children:[h===0?"None yet":h,o.jsx("span",{className:"sc-vh",children:` ${d.noun}${h===1?"":"s"} so far`})]})]},d.kind)})]})]})}const sK=24,aK=8;function oK(){const e=sr(da),{pathname:t}=_n();s.useEffect(()=>{const n=document.querySelector(".sc-shell");if(!n||(delete n.dataset.condensed,e))return;let r=0;const a=i=>{const c=i.target;!(c!=null&&c.dataset)||!("pageScroll"in c.dataset)||r||(r=requestAnimationFrame(()=>{r=0;const d=n.dataset.condensed!==void 0,f=c.scrollTop;(d?f<=aK:f>sK)&&(d?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 Wj=["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"],iK=["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 lK(e){return o.jsx("svg",{viewBox:"0 0 263.79 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:[...Wj,...iK].map(t=>o.jsx("path",{d:t},t))})}function cK(e){return o.jsx("svg",{viewBox:"0 0 64 64",fill:"currentColor","aria-hidden":"true",focusable:"false",...e,children:Wj.map(t=>o.jsx("path",{d:t},t))})}const n4='[data-guide="library.new"]',Wu=(e,t)=>({id:"go",voice:"ask",point:`[data-guide="nav.${e}"]`,side:"bottom",soft:!0,...t}),uK='[data-guide="compose"] .sc-attachpanel',dK='[data-guide="compose"] .sc-attachpanel .sc-ap-body',vh='[data-guide="compose"] .sc-promptcard',fK='[data-guide="compose.add"]',Gj='[data-guide="compose"] .sc-brief-line',yh='[data-guide="compose.send"]',Kj='[data-guide="compose.engine"]',mu=".sc-pstudio",B8=`${mu} .sc-convo-card`,hK=".sc-newdlg-layer",gu=".sc-ovl",fn={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."}},$i=e=>`.sc-feed .sc-cell[data-fb-node="${e}"]`,r4=e=>e.status==="done"&&e.images>0,s4=e=>e.status==="error"||e.status==="cancelled"||e.status==="done"&&e.images===0,U8=e=>e.products+e.presenters+(e.scene?1:0)+e.others,Gx={product:"Products",presenter:"Presenters",scene:"Scenes"};function Yj(e){if(!e.here)return e.heading?Wu("create",fn.go):null;const t=e.composer,n=e.nodes.find(r4);if(n)return{id:"result",voice:"note",point:$i(n.id),side:"bottom",...fn.result,done:!0};const r=e.nodes.find(d=>d.status==="running");if(r)return{id:"waiting",voice:"note",point:$i(r.id),side:"bottom",...fn.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||U8(t)>0||t.words,i=e.nodes.find(s4);if(i&&!a)return{id:"failed",voice:"note",point:$i(i.id),side:"bottom",...fn.failed};if(t.engine!=="ready")return{id:"engine",voice:"ask",point:Kj,side:"top",...fn.engine};if(!e.begun&&U8(t)===0&&!t.words)return{id:"intro",voice:"ask",live:[],start:!0,...fn.intro};const c=Xj(t);return c?W8(c,t.pickerOpen):{id:"make",voice:"ask",point:yh,live:[Gj,yh],side:"top",...fn.make}}function qj(e){if(!e.here)return e.heading?Wu("create",fn.go):null;const t=e.composer,n=e.nodes.find(r4);if(n)return{id:"again",voice:"note",point:$i(n.id),side:"bottom",...fn.reuseResult,done:!0};const r=e.nodes.find(c=>c.status==="running");if(r)return{id:"waiting",voice:"note",point:$i(r.id),side:"bottom",...fn.waiting};if(t!=null&&t.busy)return{id:"sending",voice:"quiet"};if(!t||t.refining)return null;const a=t.pickerOpen||U8(t)>0||t.words,i=e.nodes.find(s4);return i&&!a?{id:"failed",voice:"note",point:$i(i.id),side:"bottom",...fn.failed}:t.engine!=="ready"?{id:"engine",voice:"ask",point:Kj,side:"top",...fn.engine}:t.products===0?W8("product",t.pickerOpen,fn.reuseProduct):t.scene?{id:"make",voice:"ask",point:yh,live:[Gj,yh],side:"top",...fn.make}:W8("scene",t.pickerOpen,fn.reuseScene)}function Xj(e){return e.products===0?"product":e.presenters===0?"presenter":e.scene?null:"scene"}function W8(e,t,n){const r=n??fn[e];return t?{id:e,voice:"ask",point:uK,live:[dK],lit:[vh],beside:!0,side:"right",...r}:{id:e,voice:"ask",point:fK,side:"top",...r}}const Qj=`${gu} .sc-promptcard`,pK=`${gu} .sc-stage-img`,Kx=`${gu} .sc-trail`,Yx=".sc-feed";function mK(e){if(e.heading)return Wu("create",fn.refineGo);if(!e.here)return null;if(!e.open&&!e.armed)return{id:"choose",voice:"ask",point:Yx,live:[Yx],beside:!0,side:"left",...fn.refineChoose};const t=e.nodes.find(r4);if(t)return e.open?{id:"refined",voice:"note",shell:gu,point:Kx,side:"top",...fn.refineResult,done:!0}:{id:"refined",voice:"note",point:$i(t.id),side:"bottom",...fn.refineResult,done:!0};if(e.nodes.some(r=>r.status==="running"))return{id:"refining",voice:"quiet"};const n=e.nodes.find(s4);return n&&!e.asking?e.open?{id:"refine-failed",voice:"note",shell:gu,point:Kx,side:"top",...fn.refineFailed}:{id:"refine-failed",voice:"note",point:$i(n.id),side:"bottom",...fn.refineFailed}:e.open?{id:"ask",voice:"ask",shell:gu,point:Qj,also:[pK],beside:!0,side:"left",...fn.refineAsk}:{id:"ask",voice:"ask",point:vh,live:[vh],beside:!0,side:"top",...fn.refineAsk}}function Jj(e){if(e.heading)return Wu("presenters",fn.presenterGo);const t=e.studio;if(t){const n=`${mu} [data-turn="q:${t.open}"]`,r=(a,i,c=[],d)=>({id:a,voice:"ask",shell:mu,point:`${n} .sc-convo-ask`,live:[n],also:c,...d?{lit:d}:{},beside:!0,side:"left",...i});switch(t.open){case"source":return r("start",fn.presenterStart,[B8]);case"noengine":return r("engine",fn.presenterEngine);case"identity":case"revision":return r("face",fn.presenterFace,[".sc-pstudio-well",B8],[`${mu} [data-turn]:has(+ [data-turn="q:${t.open}"])`]);case"save":case"blind":return r("save",fn.presenterSave);default:return{id:"studio",voice:"quiet"}}}return e.onPage?{id:"new",voice:"ask",point:n4,side:"bottom",...fn.presenterNew}:null}function gK(e,t){return{id:e,voice:"ask",shell:hK,point:".sc-newdlg",beside:!0,side:"left",...t}}function eA(e){return{id:"new",voice:"ask",point:n4,side:"bottom",...e}}function vK(e){var n,r;if(e.heading)return Wu("scenes",fn.sceneGo);const t=e.studio;if(t){const a=`${mu} [data-turn="q:${t.open}"]`,i=(c,d)=>({id:c,voice:"ask",shell:mu,point:`${a} .sc-convo-ask`,live:[a],also:[B8],beside:!0,side:"left",...d});return t.open==="source"?i("start",fn.sceneStart):(n=t.open)!=null&&n.startsWith("agree-")?i("words",fn.sceneWords):(r=t.open)!=null&&r.startsWith("decide-")?{id:"use",voice:"quiet"}:{id:"studio",voice:"quiet"}}return e.onPage?eA(fn.sceneNew):null}function yK(e){return e.heading?Wu("products",fn.productGo):e.dialogOpen?gK("product",fn.productMake):e.onPage?eA(fn.productNew):null}function tA(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 wK(e,t,n){return e?tA(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 bK(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 xK={"first-shot":"shot",reuse:"shot",refine:"refine",product:"product",presenter:"presenter",scene:"scene"};function S1(e,t){return!(!t.eligible||t.hidden||t.active&&(t.active.task===e||t.active.task==="first-shot")||t.done[xK[e]]||t.dismissed.includes(e)||e==="refine"&&!t.done.shot)}function kK(e){return e.onMainPage&&e.eligible&&e.welcome===null&&e.ready&&e.visible&&!e.blocked&&!e.busy}const iu={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 SK(e){const t=e.filter(a=>a.previewUrl),n=(a,i)=>{var c,d;return(d=(((c=a.brief)==null?void 0:c.tokens)??[]).find(f=>(f==null?void 0:f.t)===i))==null?void 0:d.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 c of a){const d=n(c,"template");d&&!i.has(d)&&i.set(d,c)}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 EK(e,t,n,r){const a=new Map(e.map(c=>[c.id,c]));let i=!1;for(const c of t){if(c.kind!==r||c.createdAt<n)continue;const d={id:c.id,kind:c.kind,status:c.status,images:Array.isArray(c.images)?c.images.length:0,createdAt:c.createdAt},f=a.get(c.id);f&&f.status===d.status&&f.images===d.images||(a.set(c.id,d),i=!0)}return i?[...a.values()].sort((c,d)=>c.createdAt<d.createdAt?1:c.createdAt>d.createdAt?-1:0):e}const nA="(min-width: 1024px)",CK="https://github.com/tonygorb/scenri";function rA({placement:e}){var x,k;const t=tn(it.hub),n=tn(it.set),r=!!t||!!n,a=Vp(),i=Np(),c=!!((x=i.status)!=null&&x.available),d=c&&!i.dismissed||a.unread,f=X0(),h=fc(),p=YC(),g=GU(),{engines:v}=jn(),y=!v.some(S=>S.available),b=o.jsxs(Ds,{children:[o.jsx(xr,{label:"Help",children:o.jsx(Os,{children:o.jsxs("button",{type:"button",className:"sc-icon-btn sc-help-btn","aria-label":"Help",children:[o.jsx(JB,{size:16}),d&&o.jsx("span",{className:"sc-upd-dot","aria-hidden":"true"})]})})}),o.jsxs(Hs,{align:"end",side:e==="float"?"top":"bottom",sideOffset:8,className:"sc-menu sc-help-menu",children:[c&&o.jsxs(In,{className:"sc-menu-item","data-update":"",onSelect:()=>f("about"),children:[o.jsx(w7,{size:18,className:"sc-menu-ic"}),o.jsxs("span",{className:"sc-menu-lb",children:["Update available · ",(k=i.status)==null?void 0:k.latest]})]}),o.jsxs(o.Fragment,{children:[o.jsxs(In,{className:"sc-menu-item",onSelect:()=>{I8.current="help",p()},children:[o.jsx(VB,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Learn"})]}),o.jsxs(In,{className:"sc-menu-item",onSelect:()=>g(),children:[o.jsx(ZB,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:iu.again})]})]}),r&&o.jsxs(In,{className:"sc-menu-item",onSelect:()=>window.dispatchEvent(new Event("scenri:shortcuts")),children:[o.jsx(UB,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Keyboard shortcuts"})]}),o.jsxs(In,{className:"sc-menu-item",onSelect:()=>a.open(),children:[o.jsx(WB,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"What's new"}),a.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"})]})]}),y&&o.jsxs(In,{className:"sc-menu-item",onSelect:()=>h(),children:[o.jsx(v0,{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(In,{className:"sc-menu-item",onSelect:()=>f("about"),children:[o.jsx(xp,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"About Scenri"})]}),o.jsx(In,{className:"sc-menu-item",asChild:!0,children:o.jsxs("a",{href:CK,target:"_blank",rel:"noopener noreferrer",children:[o.jsx(_B,{size:18,className:"sc-menu-ic"}),o.jsx("span",{className:"sc-menu-lb",children:"Scenri on GitHub"})]})})]})]});return e==="float"?o.jsx("div",{className:"sc-help-float",children:b}):b}function jK(){return sr(nA)?o.jsx(rA,{placement:"float"}):null}function AK(){return sr(nA)?null:o.jsx(rA,{placement:"bar"})}function NK(){const{brand:e}=Qt();return oK(),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(Fn,{className:"sc-wordmark","aria-label":"Scenri home",to:ao(e),children:o.jsx(lK,{"aria-hidden":"true"})})}),o.jsx(jG,{}),o.jsxs("div",{className:"sc-topbar-end",children:[o.jsx(AK,{}),o.jsx(PG,{}),o.jsx(EG,{}),o.jsx(rK,{}),o.jsx(NG,{})]})]})}const MK=60;function RK(){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>MK?`${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 sA=s.createContext(null);function aA(){return s.useContext(sA)}function PK({brand:e,children:t}){const n=e.id,[r,a]=s.useState({products:[],loaded:!1}),i=s.useRef(null),{tasks:c}=Oa(),d=c.filter(y=>y.kind==="catalog").map(y=>`${y.id}:${y.state}`).join("|"),f=c.some(y=>y.kind==="catalog"&&y.state==="running"),h=s.useRef(0),p=s.useRef(n);p.current=n;const g=s.useCallback(async()=>{const y=++h.current;try{const b=await Me.productsLibrary(n);if(y!==h.current||p.current!==n)return;const x=JSON.stringify(b.products);if(i.current===x)return;i.current=x,a({products:b.products,loaded:!0})}catch{if(y!==h.current||p.current!==n)return;a(b=>({products:b.products,loaded:!0}))}},[n]);s.useEffect(()=>{i.current=null,a({products:[],loaded:!1})},[n]),s.useEffect(()=>{g()},[g,e.updatedAt,d]),s.useEffect(()=>{if(!f)return;const y=setInterval(()=>void g(),2e3);return()=>clearInterval(y)},[f,g]);const v=s.useMemo(()=>({products:r.products,productsLoaded:r.loaded,importing:f,refreshProducts:g}),[r.products,r.loaded,f,g]);return o.jsx(sA.Provider,{value:v,children:t})}function LK(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 aa({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 TK={npx:"run with npx",global:"installed with npm",managed:"managed install",dev:"running from source",unknown:"local studio"};function $K(e){switch(e){case"npx":return"npx scenri update";case"global":case"managed":return"scenri update";default:return"npx scenri@latest"}}function DK({version:e}){var $;const t=Np(),n=Vp(),r=t.status,[a,i]=s.useState(null),[c,d]=s.useState(!1),[f,h]=s.useState(null),[p,g]=s.useState(null),[v,y]=s.useState(!1),[b,x]=s.useState(!1);s.useEffect(()=>{Me.desktop().then(h).catch(()=>{})},[]),s.useEffect(()=>{Me.settings().then(H=>i(!!H.updateCheck)).catch(()=>{})},[]);const k=async()=>{if(a===null)return;const H=!a;i(H);try{await Me.saveSettings({updateCheck:H})}catch{i(!H)}},S=s.useRef(null);s.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const E=$K(e==null?void 0:e.installKind),C=s.useRef(null);s.useEffect(()=>()=>{C.current&&clearTimeout(C.current)},[]);const N=async()=>{if(!v){y(!0),g(null);try{await Me.desktopInstall(),x(!0),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>x(!1),1600),h(await Me.desktop())}catch(H){g(String((H==null?void 0:H.message)??H))}finally{y(!1)}}},M=LK(f,p),T=async()=>{try{await navigator.clipboard.writeText(E),d(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>d(!1),1600)}catch{}},L=t.checking?o.jsx("span",{className:"sc-tag",children:"checking…"}):r!=null&&r.available?o.jsxs("span",{className:"sc-tag sc-tag-gold",children:[r.latest," available"]}):t.checkError||r!=null&&r.error?o.jsx("span",{className:"sc-tag",children:"couldn't check for updates"}):r!=null&&r.checkedAt?o.jsx("span",{className:"sc-tag",children:"up to date"}):null;let A,P;return r!=null&&r.available?(e==null?void 0:e.installKind)==="dev"?(A="Running from source. Pull and rebuild when you're ready; nothing here touches your checkout.",P=null):JC(r)?r.phase==="ready"?(A=t.applyError??`${r.stagedVersion} is downloaded and verified. Restarting finishes it.`,P="restart"):r.phase==="staging"?(A="Downloading in the background. Nothing interrupts your work.",P="downloading"):r.phase==="error"?(A=t.applyError??r.error??"Couldn't download the update. Try again.",P="update"):(A=`You are on ${r.current}.`,P="update"):(A=o.jsxs(o.Fragment,{children:["Run ",o.jsx("code",{children:E})," in a terminal, then start Scenri again. Your library is not part of the app and stays put."]}),P="copy"):(A=r&&!r.enabled?"Automatic checks are off. Checking here still works.":"New versions announce themselves here.",P="check"),o.jsxs(aa,{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}`:""," · ",TK[(e==null?void 0:e.installKind)??"unknown"]]})]})}),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:[A,(r==null?void 0:r.available)&&r.phase!=="ready"&&r.notesUrl&&o.jsxs(o.Fragment,{children:[" ",o.jsxs("a",{href:r.notesUrl,target:"_blank",rel:"noreferrer",children:["See what's in ",r.latest]})]})]})]}),L,P==="check"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:t.checking,onClick:()=>void t.checkNow(),children:"Check for updates"}),(P==="update"||P==="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…":(r==null?void 0:r.phase)==="error"?"Try again":"Update"}),P==="downloading"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:!0,children:"Downloading…"}),P==="copy"&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void T(),children:c?"Copied":"Copy command"})]}),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:(($=n.entry)==null?void 0:$.title)??`What changed in ${n.version?`v${n.version}`:"this version"}.`})]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>n.open(),children:"Show"})]}),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:a===null,onClick:()=>void k(),children:a===null?"…":a?"Turn off":"Turn on"})]}),o.jsxs("div",{className:"sc-set-row","data-desktop":"",children:[o.jsxs("span",{className:"txt",children:[o.jsx("b",{children:"Desktop shortcut"}),o.jsx("small",{"data-prose":"",children:M.body})]}),M.action&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:v,onClick:()=>void N(),children:b?"Added":v?"Adding…":M.action==="add"?"Add to desktop":M.action==="recreate"?"Recreate":"Try again"})]}),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 G8({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 qx=()=>o.jsx("span",{className:"sc-setpop-tick","aria-hidden":!0,children:o.jsx(nr,{size:12,weight:"bold"})});function Mo({label:e,value:t,ids:n,unavailable:r=[],onChange:a,className:i,children:c}){const d=s.useRef(null),f=n.filter(p=>!r.includes(p)),h=p=>{var b,x;const g=p.key==="ArrowDown"||p.key==="ArrowRight"?1:p.key==="ArrowUp"||p.key==="ArrowLeft"?-1:p.key==="Home"?"first":p.key==="End"?"last":null;if(g===null||!f.length)return;p.preventDefault();const v=f.indexOf(t),y=g==="first"?f[0]:g==="last"?f[f.length-1]:g===1?f[v<0||v===f.length-1?0:v+1]:f[v<=0?f.length-1:v-1];a(y),(x=(b=d.current)==null?void 0:b.querySelector(`[data-id="${y}"]`))==null||x.focus()};return o.jsx("div",{className:i,role:"radiogroup","aria-label":e,ref:d,tabIndex:-1,onKeyDown:h,children:c})}const Ro=s.forwardRef(function({id:t,on:n,unavailable:r,label:a,onPick:i,className:c,children:d,...f},h){return o.jsx("button",{...f,ref:h,type:"button",role:"radio","data-id":t,className:c,"aria-checked":n,"aria-label":a,"aria-disabled":r||void 0,"data-on":n||void 0,tabIndex:n?0:-1,onClick:p=>{var g;(g=f.onClick)==null||g.call(f,p),r||i()},children:d})}),OK=({children:e})=>o.jsx("p",{className:"sc-setpop-foot",children:e}),Xx=[{id:"light",label:"Light"},{id:"dark",label:"Dark"},{id:"system",label:"System"}];function HK(){const{choice:e,setChoice:t}=fz();return o.jsx(aa,{title:"Appearance",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(Mo,{label:"Theme",className:"sc-seg",value:e,ids:Xx.map(n=>n.id),onChange:n=>t(n),children:Xx.map(n=>o.jsx(Ro,{id:n.id,className:"sc-seg-o",on:e===n.id,label:n.label,onPick:()=>t(n.id),children:n.label},n.id))})]})})}function IK({value:e,onChange:t,placeholder:n,label:r,suggestions:a,max:i=24,maxLength:c=200}){const[d,f]=s.useState(""),h=e.length>=i,p=v=>{const y=v.trim().slice(0,c);f(""),!(!y||h)&&(e.some(b=>b.toLowerCase()===y.toLowerCase())||t([...e,y]))},g=!h&&a&&a.length>0?o.jsx("div",{className:"sc-chips-sugg",children:a.map(v=>o.jsx("button",{type:"button",className:"sc-chip",onClick:()=>p(v),"aria-label":`Never show ${v}`,children:v},v))}):null;return o.jsxs(o.Fragment,{children:[e.length===0&&g,o.jsxs("div",{className:"sc-chips",children:[e.map((v,y)=>o.jsxs("span",{className:"sc-chips-item",children:[o.jsx("span",{dir:"auto",children:v}),o.jsx("button",{type:"button",onClick:()=>t(e.filter((b,x)=>x!==y)),"aria-label":`Remove ${v}`,children:o.jsx(Cn,{size:10,weight:"bold"})})]},v)),o.jsx("input",{className:"sc-chips-in",value:d,"aria-label":r,placeholder:h?void 0:e.length?"Add another…":n??"Add one…",disabled:h,dir:"auto",onChange:v=>{const y=v.target.value;if(y.includes(",")){const b=y.split(",");for(const x of b.slice(0,-1))p(x);f(b[b.length-1]);return}f(y.slice(0,c))},onKeyDown:v=>{v.key==="Enter"?(v.preventDefault(),p(d)):v.key==="Backspace"&&!d&&e.length&&t(e.slice(0,-1))},onBlur:()=>p(d)})]}),e.length>0&&g]})}const FK=["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"],Qx=e=>e.trim().toLowerCase();function _K(e){const t=new Set((e??[]).map(Qx));return FK.filter(n=>!t.has(Qx(n)))}function VK({doc:e}){var a;const t=((a=e.json)==null?void 0:a.rules)??{},n=t.never??[],r=i=>{const c={...t};i.length?c.never=i:delete c.never,e.patch({rules:c})};return o.jsx("div",{className:"sc-nv",children:o.jsx(IK,{label:"Things this brand never shows",value:n,placeholder:"Or type your own",suggestions:_K(n),max:24,onChange:r})})}function ZK({brand:e,doc:t}){const{push:n}=Sr(),[r,a]=s.useState(!1),i=t.json??{},c=i.meta??{},d=c.name??e.slug,f=ef(i),h=Rp(f)??void 0,p=f.filter(x=>x!==h),g=x=>{const k={...c};for(const[S,E]of Object.entries(x)){const C=E.trim();C?k[S]=C:delete k[S]}k.name||(k.name=c.name),t.patch({meta:k})},v=async(x,k)=>{a(!0);try{await t.flush(),t.applyRow(await k())}catch(S){n(wn(S,x))}finally{a(!1)}},y=x=>void v("Could not upload that mark",async()=>{const k=await FC(e.id,x[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:b}=Vj({onFiles:y,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",...b,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(zK,{mark:h,name:d,busy:r,onUpload:y}),(h==null?void 0:h.attachable)&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:r,onClick:()=>void v("Could not remove that mark",()=>Me.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:x=>void v("Could not update that mark",()=>Me.updateLogo(e.id,h.hash??"",{background:x.target.value})),"aria-label":"Sits on",children:K6.map(x=>o.jsx("option",{value:x,children:x==="any"?"Any background":`On ${x}`},x))})]}),o.jsx(Jx,{label:"Name",value:c.name??"",placeholder:e.slug,maxLength:120,onCommit:x=>g({name:x})}),o.jsx(Jx,{label:"Tagline",value:c.tagline??"",placeholder:"Add a tagline",maxLength:200,onCommit:x=>g({tagline:x})}),p.map(x=>o.jsx(BK,{mark:x,busy:r,onRole:k=>void v("Could not retag that mark",()=>Me.updateLogo(e.id,x.hash??"",{role:k})),onBackground:k=>void v("Could not update that mark",()=>Me.updateLogo(e.id,x.hash??"",{background:k})),onRemove:()=>void v("Could not remove that mark",()=>Me.deleteLogo(e.id,x.hash??""))},x.hash??x.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(kr,{size:12}),"Add",o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:r,onChange:x=>{const k=Array.from(x.target.files??[]);x.target.value="",k.length&&y(k)}})]})]})]})}function Jx({label:e,value:t,placeholder:n,maxLength:r,onCommit:a}){const[i,c]=s.useState(t);return s.useEffect(()=>c(t),[t]),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:d=>c(d.target.value),onBlur:()=>{const d=i.trim();d!==t&&a(d),c(d)},onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),d.currentTarget.blur()),d.key==="Escape"&&(c(t),d.currentTarget.blur())}})]})}function zK({mark:e,name:t,busy:n,onUpload:r}){const[a,i]=s.useState(null);if(e){const c=e.hash?Dr(e.hash):e.file;return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-well","data-bg":e.background,children:o.jsx("img",{src:c,alt:`${t} logo`,onLoad:d=>{const f=d.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(H6,{size:16}),o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:n,onChange:c=>{const d=Array.from(c.target.files??[]);c.target.value="",d.length&&r(d)}})]})}function BK({mark:e,busy:t,onRole:n,onBackground:r,onRemove:a}){const i=e.hash?Dr(e.hash):e.file;return o.jsxs("div",{className:"sc-set-row",children:[o.jsx("span",{className:"txt",children:o.jsx("b",{children:k1[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:k1[e.role]})}),o.jsx("select",{className:"sc-in",value:e.role,disabled:t||!e.attachable,onChange:c=>n(c.target.value),"aria-label":"Mark role",children:jj.map(c=>o.jsx("option",{value:c,children:k1[c]},c))}),o.jsx("select",{className:"sc-in",value:e.background,disabled:t||!e.attachable,onChange:c=>r(c.target.value),"aria-label":"Sits on",children:K6.map(c=>o.jsx("option",{value:c,children:c==="any"?"Any background":`On ${c}`},c))}),e.attachable&&o.jsx("button",{type:"button",disabled:t,onClick:a,"aria-label":`Remove ${k1[e.role]}`,children:o.jsx(Ep,{size:13})})]})]})}const e3={primary:"Primary",secondary:"Secondary",accent:"Accent",neutral:"Neutral"},UK=(e,t)=>t<=1?e3[e]:`${e3[e]} ${t}`;function WK(e){return/^(Primary|Secondary|Accent|Neutral)( [2-9]\d*)?$/.test(String(e??"").trim())}const GK=/^#[0-9A-F]{6}$/;function Jn(e){const t=String(e??"").trim(),n=(t.startsWith("#")?t.slice(1):t).toUpperCase();if(/^[0-9A-F]{3}$/.test(n)){const[a,i,c]=n;return`#${a}${a}${i}${i}${c}${c}`}const r=`#${n}`;return GK.test(r)?r:null}const KK=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;function YK(e){const t=String(e??"").trim();return KK.test(t)?Jn(t):null}function Ls(e){const t=[],n={primary:0,secondary:0,accent:0,neutral:0},r=(a,i)=>{const c=Jn(String((a==null?void 0:a.hex)??""));if(!c)return;n[i]+=1;const d=String((a==null?void 0:a.name)??"").trim();t.push({hex:c,name:d||UK(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 a4(e,t){const n={},r=[],a=[],i=p=>{const g=p.name.trim();return g&&!WK(g)?{hex:p.hex,name:g}:{hex:p.hex}};for(const p of e){const g=Jn(p.hex);if(!g)continue;const v=i({...p,hex:g});p.slot==="neutral"?a.push(v):r.push(v)}const[c,d,...f]=r;c&&(n.primary=c),d&&(n.secondary=d),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 t3=e=>e.slot!=="neutral";function $p(e){var c;const t=(c=e[e.length-1])==null?void 0:c.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(d=>d.toString(16).padStart(2,"0")).join("").toUpperCase()}`}function oA(e,t){const n=Jn(t);if(!n)return{palette:e,added:!1,swatch:null};const r=Ls(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"}],c=a4(i,e),d=Ls(c).find(f=>f.hex===n)??null;return{palette:c,added:!0,swatch:d}}function qK(e,t){const n=Jn(t);if(!n)return{palette:e,removed:!1};const r=Ls(e),a=r.filter(i=>i.hex!==n);return a.length===r.length?{palette:e,removed:!1}:{palette:a4(a,e),removed:!0}}function Dp(){return(Dp=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 iA(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 t0(e){var t=s.useRef(e),n=s.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var x0=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},n0=function(e){return"touches"in e},K8=function(e){return e&&e.ownerDocument.defaultView||self},n3=function(e,t,n){var r=e.getBoundingClientRect(),a=n0(t)?(function(i,c){for(var d=0;d<i.length;d++)if(i[d].identifier===c)return i[d];return i[0]})(t.touches,n):t;return{left:x0((a.pageX-(r.left+K8(e).pageXOffset))/r.width),top:x0((a.pageY-(r.top+K8(e).pageYOffset))/r.height)}},r3=function(e){!n0(e)&&e.preventDefault()},lA=Ln.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,a=iA(e,["onMove","onKey","onEnd"]),i=s.useRef(null),c=t0(t),d=t0(n),f=t0(r),h=s.useRef(null),p=s.useRef(!1),g=s.useMemo(function(){var k=function(C){r3(C),(n0(C)?C.touches.length>0:C.buttons>0)&&i.current?c(n3(i.current,C,h.current)):(E(!1),f())},S=function(){E(!1),f()};function E(C){var N=p.current,M=K8(i.current),T=C?M.addEventListener:M.removeEventListener;T(N?"touchmove":"mousemove",k),T(N?"touchend":"mouseup",S)}return[function(C){var N=C.nativeEvent,M=i.current;if(M&&(r3(N),!(function(L,A){return A&&!n0(L)})(N,p.current)&&M)){if(n0(N)){p.current=!0;var T=N.changedTouches||[];T.length&&(h.current=T[0].identifier)}M.focus(),c(n3(M,N,h.current)),E(!0)}},function(C){var N=C.which||C.keyCode;N<37||N>40||(C.preventDefault(),d({left:N===39?.05:N===37?-.05:0,top:N===40?.05:N===38?-.05:0}))},function(C){var N=C.which||C.keyCode;N>=37&&N<=40&&f()},E]},[d,c,f]),v=g[0],y=g[1],b=g[2],x=g[3];return s.useEffect(function(){return x},[x]),Ln.createElement("div",Dp({},a,{onTouchStart:v,onMouseDown:v,className:"react-colorful__interactive",ref:i,onKeyDown:y,onKeyUp:b,tabIndex:0,role:"slider"}))}),o4=function(e){return e.filter(Boolean).join(" ")},cA=function(e){var t=e.color,n=e.left,r=e.top,a=r===void 0?.5:r,i=o4(["react-colorful__pointer",e.className]);return Ln.createElement("div",{className:i,style:{top:100*a+"%",left:100*n+"%"}},Ln.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Lr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},XK=function(e){return nY(Y8(e))},Y8=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?Lr(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?Lr(parseInt(e.substring(6,8),16)/255,2):1}},QK=function(e){return tY(eY(e))},JK=function(e){var t=e.s,n=e.v,r=e.a,a=(200-t)*n/100;return{h:Lr(e.h),s:Lr(a>0&&a<200?t*n/100/(a<=100?a:200-a)*100:0),l:Lr(a/2),a:Lr(r,2)}},q8=function(e){var t=JK(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},eY=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),c=r*(1-n),d=r*(1-(t-i)*n),f=r*(1-(1-t+i)*n),h=i%6;return{r:Lr(255*[r,d,c,c,f,r][h]),g:Lr(255*[f,r,r,d,c,c][h]),b:Lr(255*[c,c,f,r,r,d][h]),a:Lr(a,2)}},E1=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},tY=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,i=a<1?E1(Lr(255*a)):"";return"#"+E1(t)+E1(n)+E1(r)+i},nY=function(e){var t=e.r,n=e.g,r=e.b,a=e.a,i=Math.max(t,n,r),c=i-Math.min(t,n,r),d=c?i===t?(n-r)/c:i===n?2+(r-t)/c:4+(t-n)/c:0;return{h:Lr(60*(d<0?d+6:d)),s:Lr(i?c/i*100:0),v:Lr(i/255*100),a}},rY=Ln.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,a=o4(["react-colorful__hue",e.className]);return Ln.createElement("div",{className:a},Ln.createElement(lA,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:x0(t+360*i.left,0,360)})},onEnd:r,"aria-label":"Hue","aria-valuenow":Lr(t),"aria-valuemax":"360","aria-valuemin":"0"},Ln.createElement(cA,{className:"react-colorful__hue-pointer",left:t/360,color:q8({h:t,s:100,v:100,a:1})})))}),sY=Ln.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,a={backgroundColor:q8({h:t.h,s:100,v:100,a:1})};return Ln.createElement("div",{className:"react-colorful__saturation",style:a},Ln.createElement(lA,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:x0(t.s+100*i.left,0,100),v:x0(t.v-100*i.top,0,100)})},onEnd:r,"aria-label":"Color","aria-valuetext":"Saturation "+Lr(t.s)+"%, Brightness "+Lr(t.v)+"%"},Ln.createElement(cA,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q8(t)})))}),uA=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},aY=function(e,t){return e.toLowerCase()===t.toLowerCase()||uA(Y8(e),Y8(t))};function oY(e,t,n,r){var a=t0(n),i=t0(r),c=s.useState(function(){return e.toHsva(t)}),d=c[0],f=c[1],h=s.useRef({color:t,hsva:d}),p=s.useRef(!1);s.useEffect(function(){if(!e.equal(t,h.current.color)){var y=e.toHsva(t);h.current={hsva:y,color:t},f(y),p.current=!1}},[t,e]),s.useEffect(function(){var y;uA(d,h.current.hsva)||e.equal(y=e.fromHsva(d),h.current.color)||(h.current={hsva:d,color:y},a(y),p.current=!0)},[d,e,a]);var g=s.useCallback(function(y){f(function(b){return Object.assign({},b,y)})},[]),v=s.useCallback(function(){p.current&&(p.current=!1,i(h.current.color))},[i]);return[d,g,v]}var iY=typeof window<"u"?s.useLayoutEffect:s.useEffect,lY=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},s3=new WeakMap,cY=function(e){iY(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(!s3.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 c=lY();c&&i.setAttribute("nonce",c),s3.set(r,i),a.appendChild(i)}}},[])},uY=function(e){var t=e.className,n=e.colorModel,r=e.color,a=r===void 0?n.defaultColor:r,i=e.onChange,c=e.onChangeEnd,d=iA(e,["className","colorModel","color","onChange","onChangeEnd"]),f=s.useRef(null);cY(f);var h=oY(n,a,i,c),p=h[0],g=h[1],v=h[2],y=o4(["react-colorful",t]);return Ln.createElement("div",Dp({},d,{ref:f,className:y}),Ln.createElement(sY,{hsva:p,onChange:g,onChangeEnd:v}),Ln.createElement(rY,{hue:p.h,onChange:g,onChangeEnd:v,className:"react-colorful__last-control"}))},dY={defaultColor:"000",toHsva:XK,fromHsva:function(e){return QK({h:e.h,s:e.s,v:e.v,a:1})},equal:aY},fY=function(e){return Ln.createElement(uY,Dp({},e,{colorModel:dY}))};function Pu({value:e,onChange:t,label:n,presets:r,className:a,triggerStyle:i,triggerProps:c,tip:d,commitMode:f="live",align:h="start",children:p}){const g=Jn(e)??"#000000",[v,y]=s.useState(g),[b,x]=s.useState(!1);s.useEffect(()=>{b||y(g)},[g,b]);const k=M=>{const T=Jn(M);T&&(y(T),f==="live"&&t(T))},S=M=>{const T=Jn(M);T&&(y(T),t(T),f==="close"&&x(!1))},E=M=>{if(x(M),M||f!=="close")return;const T=Jn(v);T&&T!==g&&t(T)},C=[...new Set((r??[]).map(M=>Jn(M)).filter(M=>!!M))],N=o.jsx(ju,{children:o.jsx("button",{type:"button",className:a??"sc-cp-trigger",style:{background:g,...i},"aria-label":n,...c,children:p})});return o.jsxs(Cu,{open:b,onOpenChange:E,children:[d?o.jsx(xr,{label:n,children:N}):N,o.jsxs(Au,{className:"sc-cp",align:h,sideOffset:6,width:"232px",children:[o.jsx(fY,{color:v,onChange:k}),o.jsxs("div",{className:"sc-cp-foot",children:[o.jsx("span",{className:"sc-cp-preview",style:{background:v},"aria-hidden":!0}),o.jsx("input",{className:"sc-cp-hex",value:v,spellCheck:!1,maxLength:7,"aria-label":"Hex value",onChange:M=>{y(M.target.value);const T=Jn(M.target.value);T&&f==="live"&&t(T)},onBlur:()=>y(Jn(v)??g),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),f==="close"?S(v):x(!1))}})]}),C.length>0&&o.jsx("div",{className:"sc-cp-presets",children:C.map(M=>o.jsx("button",{type:"button",style:{background:M},"data-on":M===v||void 0,title:M,"aria-label":M,onClick:()=>f==="close"?S(M):k(M)},M))})]})]})}function hY({doc:e,suggestions:t}){var y;const n=(y=e.json)==null?void 0:y.palette,[r,a]=s.useState(()=>Ls(n)),i=JSON.stringify(n??{});s.useEffect(()=>{a(Ls(n))},[i]);const c=(b,x=0)=>{a(b),e.patch({palette:a4(b,n)},{debounce:x})},d=(b,x,k=0)=>c(r.map((S,E)=>E===b?{...S,...x}:S),k),f=()=>c([...r,{hex:$p(r),name:"",slot:r.length?"accent":"primary"}]),h=(t??[]).filter(b=>{const x=Jn(b.hex);return x&&!r.some(k=>k.hex===x)}),p=(b,x)=>o.jsx(pY,{swatch:b,presets:r.map(k=>k.hex),onHex:k=>d(x,{hex:k},300),onRemove:()=>c(r.filter((k,S)=>S!==x))},`${b.slot}-${x}`),g=r.map((b,x)=>[b,x]),v=g.filter(([b])=>!t3(b));return o.jsxs("div",{className:"sc-pal",children:[r.length===0&&o.jsx("p",{className:"sc-pal-empty",children:"No colours yet. Add one and it becomes a chip you can drop into any shot."}),g.filter(([b])=>t3(b)).map(([b,x])=>p(b,x)),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"sc-pal-group",children:"Neutrals"}),v.map(([b,x])=>p(b,x))]}),o.jsxs("div",{className:"sc-pal-foot",children:[o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:f,children:[o.jsx(kr,{size:12}),"Add colour"]}),h.length>0&&o.jsxs("span",{className:"sc-pal-sugg",children:[o.jsx("small",{children:"From the website"}),h.map(b=>{const x=Jn(b.hex);return o.jsx("button",{type:"button",className:"sc-pal-sugg-chip",style:{background:x},title:`Add ${x}`,"aria-label":`Add ${x}`,onClick:()=>c([...r,{hex:x,name:"",slot:"accent"}])},x)})]})]})]})}function pY({swatch:e,presets:t,onHex:n,onRemove:r}){const[a,i]=s.useState(e.hex);s.useEffect(()=>i(e.hex),[e.hex]);const c=()=>{const d=Jn(a);d&&n(d),i(d??e.hex)};return o.jsxs("div",{className:"sc-pal-row",children:[o.jsx(Pu,{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:d=>i(d.target.value),onBlur:c,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),d.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(Ep,{size:13})})]})}function mY(){const{brand:e}=Qt(),{applyBrand:t}=jn(),{push:n}=Sr(),[r,a]=s.useState({}),[i,c]=s.useState("idle"),d=s.useRef(r);d.current=r;const f=s.useRef(e);f.current=e;const h=s.useRef(null),p=s.useRef(!1),g=s.useRef(!1),v=s.useCallback(()=>({...f.current.json??{},...d.current}),[]),y=s.useCallback(async()=>{if(!Object.keys(d.current).length)return;if(p.current){g.current=!0;return}p.current=!0,c("saving");const E=d.current;try{const C=await Me.updateBrand(f.current.id,v());t(C),a(N=>{const M={...N};for(const T of Object.keys(E))N[T]===E[T]&&delete M[T];return M}),c(g.current?"pending":"idle")}catch(C){c("error"),n({...wn(C,"Could not save the brand"),action:{label:"Retry",onClick:()=>void y()}})}finally{p.current=!1,g.current&&(g.current=!1,y())}},[t,v,n]),b=s.useCallback((E,C)=>{h.current&&(clearTimeout(h.current),h.current=null);const N={...d.current,...E};d.current=N,a(N),c("pending");const M=(C==null?void 0:C.debounce)??0;M>0?h.current=setTimeout(()=>void y(),M):y()},[y]),x=s.useCallback(async()=>{h.current&&(clearTimeout(h.current),h.current=null),await y()},[y]),k=s.useCallback(E=>{a({}),d.current={},t(E),c("idle")},[t]),S=e.id;return s.useEffect(()=>{a({}),d.current={},c("idle")},[S]),s.useEffect(()=>{const E=()=>{Object.keys(d.current).length&&vU(f.current.id,v()).then(C=>{C&&t(C)})};return window.addEventListener("beforeunload",E),()=>{window.removeEventListener("beforeunload",E),h.current&&clearTimeout(h.current),E()}},[v,t]),{json:v(),state:i,patch:b,flush:x,applyRow:k}}function gY(e){return e==="saving"?"Saving…":e==="pending"?"Unsaved changes":e==="error"?"Not saved":"Saved"}function vY({onSaveState:e}){var y,b;const{brand:t}=Qt(),{push:n}=Sr(),r=mY();s.useEffect(()=>e(r.state),[r.state,e]);const[a,i]=s.useState(!1),[c,d]=s.useState([]),f=((b=(y=r.json)==null?void 0:y.meta)==null?void 0:b.website)??"",[h,p]=s.useState(f);s.useEffect(()=>p(f),[f]);const g=()=>{var E;const x=h.trim(),k=x&&!/^https?:\/\//i.test(x)?`https://${x}`:x;p(k);const S={...((E=r.json)==null?void 0:E.meta)??{}};k?S.website=k:delete S.website,r.patch({meta:S})},v=async()=>{var x,k,S;i(!0);try{await r.flush();const E=await Me.refreshBrandFromUrl(t.id);r.applyRow(E),d(((x=E.suggestions)==null?void 0:x.palette)??[]),n({kind:(k=E.warnings)!=null&&k.length?"warning":"success",title:"Read the website again",detail:(S=E.warnings)!=null&&S.length?E.warnings.join(" "):"Your edits were kept."})}catch(E){n(wn(E,"Could not read that website"))}finally{i(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(aa,{title:"Identity",sub:"The name and the mark.",children:o.jsx(ZK,{brand:t,doc:r})}),o.jsx(aa,{title:"Palette",sub:"Favoured on a shot that asks for the kit.",children:o.jsx("div",{className:"sc-set-block",children:o.jsx(hY,{doc:r,suggestions:c})})}),o.jsx(aa,{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(VK,{doc:r})})}),o.jsxs(aa,{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:x=>p(x.target.value),onBlur:g,onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),x.currentTarget.blur())}}),o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:!f||a,onClick:()=>void v(),children:[a?o.jsx(wr,{size:"1"}):o.jsx(x7,{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:mU(t.id),download:!0,onClick:()=>void r.flush(),children:"Export"})]})]})]})}const Di=e=>e.replace(/\s*\(BYOK\)\s*$/i,""),k0="codex-cli";function yY(e,t){var n;return e.some(r=>r.id===t)?t:((n=e[0])==null?void 0:n.id)??k0}const wY=e=>e.toFixed(3).replace(/0+$/,"").replace(/\.$/,"");function bY(e){return e.free?e.localOnly?"Runs on your ChatGPT plan":"No cost per image":`$${wY(e.perGeneration)} / image`}function xY(e,t){if(t)return e.available?"Manage":"Connect";if(e.available)return e.id===k0?"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 kY({engines:e,onSaved:t}){const n=e.filter(c=>!c.free),[r,a]=s.useState({});s.useEffect(()=>{a(Object.fromEntries(n.map(c=>[c.id,c.cap===null?"":String(c.cap)])))},[e]);const i=async c=>{const d=(r[c]??"").trim(),f=d===""?null:Number(d);f!==null&&(Number.isNaN(f)||f<0)||(await Me.setCap(c,f),t())};return n.length?o.jsx(aa,{title:"Monthly caps",sub:"Your own API budget. Generation stops before a cap is crossed, so a runaway loop cannot spend your month.",children:n.map(c=>{const d=c.generationsLeft,f=c.generationsTotal,h=f&&f>0?Math.min(100,Math.round((f-(d??0))/f*100)):0,p=`$${c.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:Di(c.displayName)}),o.jsx("small",{children:d===null?p:`${p} · ${d} 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:r[c.id]??"",onChange:g=>a(v=>({...v,[c.id]:g.target.value})),onBlur:()=>void i(c.id),"aria-label":`${Di(c.displayName)} monthly cap in dollars`})]})]}),f!==null&&o.jsx("div",{className:"sc-meter",children:o.jsx("i",{style:{width:`${h}%`}})})]},c.id)})}):o.jsx(aa,{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 SY({onDone:e}){const{brand:t,resetShots:n}=Qt(),{refresh:r}=jn(),a=Dn(),[i,c]=s.useState(!1),d=s.useCallback(async f=>{c(!0);try{await Me.deleteData(f),e(),f==="shots"&&n(),f==="all"&&window.location.replace("/")}finally{c(!1)}},[e,n]);return o.jsxs(aa,{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 ",Ea(t),", its sets and every shot. Other brands stay."]})]}),o.jsx(mr,{label:"Delete brand",title:`Delete ${Ea(t)}?`,body:"The kit, its sets and every shot go with it. Exports you already downloaded stay yours.",busy:i,onConfirm:()=>{c(!0),Me.deleteBrand(t.id).then(()=>r()).then(()=>a("/",{replace:!0})).finally(()=>c(!1))}})]}),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:"Keeps brands, cast and scenes. Removes every set and every generated shot."})]}),o.jsx(mr,{label:"Delete shots",title:"Delete every generated shot?",body:"Brands, cast and scenes stay. Every set and every generated shot goes.",busy:i,onConfirm:()=>void d("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(mr,{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:i,onConfirm:()=>void d("all")})]})]})}function dA(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 EY(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 CY(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 jY=[{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"}],fA=e=>jY.find(t=>t.engineId===e),hA={"codex-cli":{Mark:dA,size:16,plate:"#FFFFFF",ink:"#000000"},openrouter:{Mark:EY,size:18,plate:"#FFFFFF",ink:"#7624F4"},replicate:{Mark:CY,size:15,plate:"#E42022",ink:"#FFFFFF"}},pA=e=>{const t=hA[e];return t?{plate:t.plate,ink:t.ink}:void 0},AY={demo:DB};function mA({engineId:e,scale:t=1}){const n=hA[e];if(n){const a=Math.round(n.size*t);return o.jsx(n.Mark,{width:a,height:a})}const r=AY[e]??v0;return o.jsx(r,{size:Math.round(15*t)})}const NY=e=>[...e].sort((t,n)=>+(n.id===k0)-+(t.id===k0));function MY({engines:e}){const t=fc(),r=e.filter(a=>a.available).length===0;return o.jsx(aa,{children:NY(e).map(a=>{const i=fA(a.id),c=Di(a.displayName),d=xY(a,!!i),f=a.available?"Connected":null,h=!f&&a.reason&&(!d||a.code==="unverified"),p=pA(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(mA,{engineId:a.id})}),o.jsxs("span",{className:"sc-eng-name",children:[o.jsx("b",{children:c}),o.jsx("small",{children:bY(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}),d&&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":`${d} ${c}`,children:d})]},a.id)})})}const RY=e=>e>1e9?`${(e/1e9).toFixed(1)} GB`:e>1e6?`${Math.round(e/1e6)} MB`:`${Math.round(e/1e3)} KB`,hg=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function PY(e){return e===0?0:e<3?1:e<6?2:e<12?3:4}function a3(e,t){const n=t*7,r=new Date,a=new Date(r);a.setDate(r.getDate()-(n-1)-r.getDay());const i=[],c=[];let d=-1,f=0;for(let h=0;h<n;h++){const p=new Date(a);p.setDate(a.getDate()+h);const g=p.toISOString().slice(0,10),v=e.get(g)??0;if(f+=v,i.push({key:g,level:PY(v),title:v?`${v} run${v===1?"":"s"} on ${p.getDate()} ${hg[p.getMonth()]}`:`nothing on ${p.getDate()} ${hg[p.getMonth()]}`}),p.getDay()===0){const y=p.getMonth()!==d&&p.getDate()<=7;y&&(d=p.getMonth()),c.push({key:g,label:y?hg[p.getMonth()]:""})}}return{cells:i,months:c,sum:f}}function LY({info:e}){return o.jsxs(aa,{title:"Library",sub:"Plain files on this machine. Open them yourself, back them up like anything else.",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} · ${RY(e.bytes)} across ${e.images} images`:"…"})]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>void Me.reveal(),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"})]})]})}function o3({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 TY({brandId:e}){const[t,n]=s.useState(null);s.useEffect(()=>{let d=!0;return n(null),Me.usage(e).then(f=>d&&n(f.days)).catch(()=>d&&n([])),()=>{d=!1}},[e]);const{year:r,quarter:a,total:i,byKind:c}=s.useMemo(()=>{const d=new Map,f={generation:0,edit:0};for(const g of t??[])d.set(g.day,(d.get(g.day)??0)+g.generations+g.edits),f.generation+=g.generations,f.edit+=g.edits;const h=a3(d,53),p=a3(d,13);return{year:h,quarter:p,total:h.sum,byKind:f}},[t]);return o.jsx(aa,{sub:t===null?"Counting your runs…":i?`${i.toLocaleString()} runs in the last year: ${c.generation.toLocaleString()} generations, ${c.edit.toLocaleString()} edits.`:"Nothing made yet this year. The first shot lands here.",children:o.jsxs("div",{className:"sc-heat",children:[o.jsx(o3,{weeks:53,months:r.months,cells:r.cells}),o.jsx(o3,{weeks:13,months:a.months,cells:a.cells})]})})}const $Y={brand:"brand",usage:"usage",engines:"engines",budget:"engines",general:"general",appearance:"general",library:"general",about:"about",danger:"danger"},C1=[{id:"brand",label:"Brand kit",Icon:YB,scope:"brand",sub:e=>`What every shot for ${e} can draw on.`},{id:"usage",label:"Usage",Icon:$B,scope:"brand",sub:e=>`What ${e} has made, one square per day.`},{id:"engines",label:"Providers",Icon:v0,scope:"studio",sub:()=>"Where your images are made, and what each may spend. Pick one in the composer."},{id:"general",label:"General",Icon:D6,scope:"studio",sub:()=>"How Scenri looks, and where your library lives."},{id:"about",label:"About",Icon:xp,scope:"studio",sub:()=>"This copy of Scenri and how it stays current."},{id:"danger",label:"Danger zone",Icon:Ep,scope:"apart",sub:()=>"These do not come back. Export from Library first if you are not certain."}],DY=e=>$Y[e]??"brand";function OY({engines:e,brandId:t,onSaved:n}){const r=ws("settings"),a=r.value!==null,[i,c]=s.useState(null);s.useEffect(()=>{if(!a||i)return;let g=!0;return Me.version().then(v=>g&&c(v)).catch(()=>{}),()=>{g=!1}},[a,i]);const[d,f]=s.useState(null);s.useEffect(()=>{if(!a)return;let g=!0;return Me.home().then(v=>g&&f(v)).catch(()=>{}),()=>{g=!1}},[a]);const[h,p]=s.useState("idle");return o.jsx(Zs,{open:a,className:"sc-set",maxWidth:"880px",onDismiss:r.close,children:o.jsx(HY,{value:r.value,onPick:r.set,saved:o.jsx(IY,{state:h}),page:g=>o.jsx(FY,{page:g,engines:e,brandId:t,onSaved:n,onKitState:p,version:i,home:d})})})}function HY({value:e,onPick:t,saved:n,page:r}){const a=sr(da),{brand:i}=Qt(),c=DY(e),[d,f]=s.useState(()=>c==="brand"),h=s.useRef(new Map),p=s.useRef(!1);s.useEffect(()=>{var b;!a||!d||!p.current||(p.current=!1,(b=h.current.get(c))==null||b.focus({preventScroll:!0}))},[a,d,c]);const g=b=>{t(b),f(!1)},v=C1.find(b=>b.id===c);if(a&&!d)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(Da,{size:15})}),o.jsx(ys,{className:"sc-newdlg-title",children:v.label}),c==="brand"&&n,o.jsx(i3,{})]}),o.jsx("div",{className:"sc-newdlg-body sc-set-body",children:o.jsx("div",{className:"sc-set-scroll",children:r(c)})})]},`page-${c}`);const y=b=>o.jsx("li",{children:o.jsxs("button",{type:"button",className:"sc-set-item","data-danger":b.scope==="apart"?"":void 0,"aria-current":!a&&c===b.id?"page":void 0,ref:x=>{x?h.current.set(b.id,x):h.current.delete(b.id)},onClick:()=>g(b.id),children:[o.jsx(b.Icon,{size:16,className:"sc-set-item-ic"}),o.jsx("span",{className:"sc-set-item-lb",children:b.label}),a&&o.jsx(qi,{size:14,className:"sc-set-item-go"})]})},b.id);return o.jsxs("div",{className:"sc-set-level",children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Settings"}),o.jsx(i3,{})]}),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:C1.filter(b=>b.scope==="brand").map(y)}),o.jsx("p",{className:"sc-set-group",children:"Studio"}),o.jsx("ul",{children:C1.filter(b=>b.scope==="studio").map(y)}),o.jsx("ul",{className:"sc-set-apart",children:C1.filter(b=>b.scope==="apart").map(y)})]}),!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:v.label}),o.jsx("p",{children:v.sub(Ea(i))})]}),c==="brand"&&n]}),r(c)]},c)]})]},"index")}function IY({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(nr,{size:12,weight:"bold"}),gY(e)]})}function FY({page:e,engines:t,brandId:n,onSaved:r,onKitState:a,version:i,home:c}){switch(e){case"brand":return o.jsx(vY,{onSaveState:a});case"usage":return o.jsx(TY,{brandId:n});case"engines":return o.jsxs(o.Fragment,{children:[o.jsx(MY,{engines:t}),o.jsx(kY,{engines:t,onSaved:r})]});case"general":return o.jsxs(o.Fragment,{children:[o.jsx(HK,{}),o.jsx(LY,{info:c})]});case"about":return o.jsx(DK,{version:i});case"danger":return o.jsx(SY,{onDone:r})}}function i3(){return o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})}const _Y=["January","February","March","April","May","June","July","August","September","October","November","December"];function VY(e){const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return e;const n=_Y[Number(t[2])-1];return n?`${Number(t[3])} ${n} ${t[1]}`:e}function ZY(){const e=ws("whatsnew"),{status:t,version:n,entry:r,changelogUrl:a,releasesUrl:i,markSeen:c}=Vp(),d=e.value!==null,f=()=>{c(),e.close()},h=s.useRef(d);s.useEffect(()=>{h.current&&!d&&c(),h.current=d},[d,c]);const p=t==="ready"&&!r&&!a,g=r!==null&&r.sections.length>1,v=t==="loading"?"Reading the release notes.":t==="failed"?"Scenri could not read its release notes. If you are running a development server, it may predate this feature; restart it and try again.":p?"You are running a development build. What changed in a version appears here once that version is published.":r?"Maintenance only. Nothing here changes how Scenri works for you.":"This version went out without a written summary.",y=r?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-vh",children:"Version "}),o.jsx("span",{className:"sc-wn-ver",children:r.version}),o.jsx("span",{"aria-hidden":"true",children:" · "}),VY(r.date)]}):t==="failed"?"Release notes unavailable":t==="loading"?"Loading":p?"Development build":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-vh",children:"Version "}),o.jsx("span",{className:"sc-wn-ver",children:n})]});return o.jsxs(Zs,{open:d,className:"sc-wn",maxWidth:"420px",described:!0,onDismiss:f,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"What's new"}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})]}),o.jsx(Bu,{className:"sc-wn-sub",children:y}),o.jsxs("div",{className:"sc-newdlg-body",children:[(r==null?void 0:r.title)&&o.jsx("p",{className:"sc-wn-lede sc-accent",children:r.title}),r&&r.sections.length>0?r.sections.map(b=>o.jsxs("section",{className:"sc-wn-sec",children:[g&&o.jsx("h3",{className:"sc-wn-head",children:b.heading}),o.jsx("p",{className:"sc-wn-txt",children:b.body})]},b.heading)):o.jsx("p",{className:"sc-wn-txt",children:v})]}),o.jsxs("div",{className:"sc-newdlg-foot sc-wn-foot",children:[i&&o.jsxs("a",{className:"sc-wn-link",href:i,target:"_blank",rel:"noreferrer",children:["All releases",o.jsx(vp,{size:13})]}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",children:"Got it"})})]})]})}function zY(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 gA(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 BY(e){return`Scenri will start Codex without ${gA(e)}. Nothing on your computer changes, and you can undo this here later.`}function UY(e){return`Scenri is starting Codex without ${gA(e)} on this computer.`}const WY=2e3,GY=5*6e4;function KY({engines:e,onSaved:t}){const n=ws("setup"),r=n.close,a=n.value,i=a?fA(a):void 0,d=!!i||a==="codex-cli",f=e.find(h=>h.id===a);return o.jsx(Zs,{open:d,className:"sc-setup",maxWidth:"520px",onDismiss:r,onOpenAutoFocus:i?h=>{var p;h.preventDefault(),(p=h.target.querySelector(".sc-setup-key input"))==null||p.focus()}:void 0,children:i?o.jsx(YY,{provider:i,name:f?Di(f.displayName):i.engineId,connected:!!(f!=null&&f.available),onSaved:t,onDone:r}):o.jsx(qY,{engines:e,onSaved:t,onDone:r})})}function vA({title:e}){return o.jsxs("div",{className:"sc-newdlg-head sc-setup-head",children:[o.jsx(ys,{className:"sc-newdlg-title sc-setup-title",children:e}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})]})}function YY({provider:e,name:t,connected:n,onSaved:r,onDone:a}){const[i,c]=s.useState(""),[d,f]=s.useState(!1),[h,p]=s.useState(null),[g,v]=s.useState(!1),y=async()=>{const x=i.trim();if(x){f(!0),p(null);try{await Me.saveSettings({[e.settingKey]:x}),c(""),r(),a()}catch(k){p(k.message)}finally{f(!1)}}},b=async()=>{f(!0),p(null);try{await Me.saveSettings({[e.settingKey]:""});const x=await Me.settings();if(r(),x[e.settingKey]){v(!0);return}a()}catch(x){p(x.message)}finally{f(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(vA,{title:n?`${t} key`:`Connect ${t}`}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(yA,{engineId:e.engineId,name:t,state:n?"Connected":"Not connected",ready:n}),o.jsx("p",{className:"sc-setup-lead",children: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.`})]}),o.jsxs("form",{className:"sc-setup-key",onSubmit:x=>{x.preventDefault(),y()},children:[o.jsx("input",{className:"sc-in",type:"password",placeholder:e.hint,value:i,onChange:x=>c(x.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:d||!i.trim(),children:[d?o.jsx(wr,{size:"1"}):o.jsx(aC,{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(vp,{size:13})]})]})]}),n&&o.jsx("div",{className:"sc-setup-cut",children:o.jsx(mr,{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:d,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."]}),h&&o.jsx("div",{className:"sc-setup-problem",children:o.jsxs("p",{"data-detail":"",children:[o.jsx(Cp,{size:15})," ",h]})})]})]})}function qY({engines:e,onSaved:t,onDone:n}){const r=fc(),[a,i]=s.useState("checking"),[c,d]=s.useState(null),[f,h]=s.useState(!1),[p,g]=s.useState("mac"),[v,y]=s.useState(null),[b,x]=s.useState([]),[k,S]=s.useState([]),E=s.useRef(null),C=s.useCallback(()=>{E.current!==null&&(window.clearInterval(E.current),E.current=null)},[]),N=s.useCallback(async(ie=!1)=>{const{state:B,reason:F,platform:te,conflictKeys:X,ignoredKeys:Z}=await Me.codexStatus({force:ie});return te&&g(te),y(F??null),x(X??[]),S(Z??[]),i(B),B},[]);s.useEffect(()=>(d(null),i("checking"),N().catch(()=>i("unverified")),C),[N,C]);const M=s.useCallback(()=>{d(null),i("checking"),N(!0).catch(()=>i("unverified"))},[N]),T=async()=>{d(null),i("repairing");try{const{state:ie,conflictKeys:B,ignoredKeys:F,reason:te}=await Me.repairCodexEnv(b);x(B??[]),S(F??[]),y(te??null),i(ie)}catch(ie){d({detail:ie.message}),i("env-conflict")}},L=async()=>{d(null),i("checking");try{const{state:ie,conflictKeys:B,ignoredKeys:F}=await Me.restoreCodexEnv();x(B??[]),S(F??[]),i(ie)}catch{N().catch(()=>i("unverified"))}};s.useEffect(()=>{a==="ready"&&t()},[a,t]);const A=async()=>{d(null),i("installing");try{const ie=await Me.installCodex();if(ie.ok||ie.state!=="not-installed"){i(ie.state);return}d({detail:ie.detail,command:ie.fallbackCommand,docsUrl:ie.docsUrl}),i(ie.state)}catch(ie){d({detail:ie.message,command:"npm install -g @openai/codex"}),i("not-installed")}},P=async()=>{d(null),i("signing-in");const ie=Date.now();C(),E.current=window.setInterval(()=>{if(Date.now()-ie>GY){C(),i("not-authenticated"),d({detail:"Sign-in did not finish. Try again, or use the command below.",command:"codex login"});return}Me.codexStatus().then(({state:B})=>{B==="ready"&&(C(),i("ready"))}).catch(()=>{})},WY);try{const B=await Me.loginCodex();if(C(),B.ok||B.state==="ready"){i(B.state);return}d({detail:B.detail,command:B.fallbackCommand}),i(B.state)}catch(B){C(),d({detail:B.message,command:"codex login --device-auth"}),i("not-authenticated")}},$=s.useRef(null);s.useEffect(()=>()=>{$.current&&window.clearTimeout($.current)},[]);const H=ie=>{var B;(B=navigator.clipboard)==null||B.writeText(ie).then(()=>{h(!0),$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>h(!1),1600)})},O=e.filter(ie=>ie.available&&ie.id!=="codex-cli"&&!ie.localOnly),Q=a==="checking"||a==="installing"||a==="signing-in"||a==="repairing",I=a==="not-installed"||a==="installing"?{step:0,label:"Install Codex CLI",verb:a==="installing"?"Installing":"Install",busy:a==="installing",run:A}:a==="not-authenticated"||a==="signing-in"?{step:1,label:"Sign in with ChatGPT",verb:a==="signing-in"?"Waiting for your browser":"Sign in",busy:a==="signing-in",run:P}:a==="env-conflict"||a==="repairing"?{step:2,label:"Ignore that key",verb:a==="repairing"?"Ignoring":"Ignore that key",busy:a==="repairing",run:T}:null,V=a==="not-installed"||a==="installing"||a==="not-authenticated"||a==="signing-in";return o.jsxs(o.Fragment,{children:[o.jsx(vA,{title:"Set up image generation"}),o.jsxs("div",{className:"sc-setup-body",children:[o.jsxs("div",{className:"sc-setup-intro",children:[o.jsx(yA,{engineId:"codex-cli",name:"Codex CLI",state:XY[a],ready:a==="ready",busy:Q}),o.jsx("p",{className:"sc-setup-lead",children:QY[a](v)}),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(JY,{phase:a,act:I}),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:BY(b)}),a==="ready"&&k.length>0&&o.jsxs("p",{className:"sc-setup-note",children:[UY(k)," ",o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:L,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(nr,{size:14}):o.jsx(L8,{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"&&O.length>0&&o.jsxs("p",{className:"sc-setup-note",children:[O.map(ie=>Di(ie.displayName)).join(", ")," is already connected, so you can generate now."]}),c&&o.jsxs("div",{className:"sc-setup-problem",children:[o.jsxs("p",{"data-detail":"",children:[o.jsx(Cp,{size:15})," ",c.detail??"That did not work."]}),c.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:c.command}),o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>H(c.command),children:[f?o.jsx(nr,{size:14}):o.jsx(L8,{size:14}),f?"Copied":"Copy"]})]})]}),c.docsUrl&&o.jsxs("a",{className:"sc-setup-alt",href:c.docsUrl,target:"_blank",rel:"noreferrer",children:["Installation help ",o.jsx(vp,{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:M,children:[o.jsx(P8,{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:M,children:[o.jsx(P8,{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(aC,{size:15})," Add a provider key"]}),o.jsx("button",{type:"button",className:"sc-setup-alt",onClick:()=>void N(),children:"Back to Codex setup"})]}),V&&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 XY={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"},QY={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 yA({engineId:e,name:t,state:n,ready:r,busy:a}){const i=pA(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(mA,{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(wr,{size:"1"}):r?o.jsx("span",{className:"d"}):null,n]})]})]})}function JY({phase:e,act:t}){const{installed:n,signedIn:r,connected:a}=zY(e),i=[n,r,a],c=["Install Codex CLI","Sign in with ChatGPT","Connect to Scenri"];return o.jsx("ol",{className:"sc-learn-steps sc-setup-steps",children:c.map((d,f)=>{const h=(t==null?void 0:t.step)===f,p=i[f]?"done":h?"active":"todo",g=o.jsx("span",{className:"sc-learn-n","aria-hidden":"true",children:i[f]?o.jsx(nr,{size:14,weight:"bold"}):f+1}),v=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:v,onClick:t.run,children:[g,o.jsx("span",{className:"sc-learn-step-name",children:d}),o.jsxs("span",{className:"sc-learn-go","aria-hidden":"true",children:[v?o.jsx(wr,{size:"1"}):null,t.verb,v?null:o.jsx(Ka,{size:12,weight:"bold"})]})]}):o.jsxs("div",{className:"sc-learn-step","data-state":p,children:[g,o.jsx("span",{className:"sc-learn-step-name",children:d}),i[f]&&o.jsx("span",{className:"sc-vh",children:", done"})]})},d)})})}function eq(){const{brands:e}=jn(),t=wA(e);return t?o.jsx(no,{to:ao(t),replace:!0}):o.jsx(no,{to:"/setup",replace:!0})}function wA(e){const t=lz();return e.find(n=>n.id===t)??e[0]??null}const tq=48;function nq(e,t,n=tq){let r=null;for(const a of t){if(a.kind==="root")continue;const i=(r??e).findIndex(h=>h.id===a.id),c=a.status==="done"&&a.images.length>0&&!a.archived;if(i>=0){if((r??e)[i]===a)continue;r??(r=[...e]),c?r[i]=a:r.splice(i,1);continue}if(!c)continue;const d=r??e;if(d.length>=n&&ou(d[d.length-1],a)<0)continue;r??(r=[...e]);let f=0;for(;f<r.length&&ou(r[f],a)<=0;)f++;r.splice(f,0,a),r.length>n&&(r.length=n)}return r??e}const rq={composer:null,overlay:null,studio:null,showing:!1};let Ra=rq;const X8=new Set;function Op(e){Ra=e;for(const t of X8)t()}const i4=(e,t)=>e===t||JSON.stringify(e)===JSON.stringify(t);function l3(e){i4(Ra.composer,e)||Op({...Ra,composer:e})}function c3(e){i4(Ra.overlay,e)||Op({...Ra,overlay:e})}function wh(e){i4(Ra.studio,e)||Op({...Ra,studio:e})}function u3(e){Ra.showing!==e&&Op({...Ra,showing:e})}function bA(e){return X8.add(e),()=>X8.delete(e)}function sq(){return Ra}function xA(){return s.useSyncExternalStore(bA,sq)}function aq(){return s.useSyncExternalStore(bA,()=>Ra.showing)}function kA(e){return e.milestones.map(t=>t.label)}const Ei=[{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"}],Q8={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 oq(e){return Ei.find(t=>t.id===e)??null}function iq(e,t,n,r){var a,i,c;return((i=(a=t.progress)==null?void 0:a[e])==null?void 0:i.brandId)===n&&r>0?"active":(c=t.lessons)!=null&&c[e]?"done":"new"}function lq(e,t){return e.find(n=>t(n)!=="done")??null}const l4=Object.fromEntries(Ei.map(e=>[e.id,Object.fromEntries(e.milestones.flatMap((t,n)=>t.moments.map(r=>[r,n])))]));function SA(e,t){let n=0;for(const r of t){const a=l4[e][r];a!==void 0&&a>n&&(n=a)}return n}function cq(e,t){return SA(e,t)>0}function uq(e,t){var a;const n=l4[e][t],r=((a=Ei.find(i=>i.id===e))==null?void 0:a.milestones.length)??0;return n===void 0||!r?null:{at:n+1,of:r}}const pg=e=>e.status==="done"&&e.images>0;function d3(e,t,n){const r=SA(e,t);return n?Math.max(dq(e,n),r):r}function dq(e,t){const n=t.moment?l4[e][t.moment]:void 0;if(n!==void 0)return n;switch(e){case"first-shot":return t.nodes.some(pg)?5:t.nodes.length>0?4:0;case"reuse":return t.nodes.some(pg)?4:t.nodes.length>0?3:0;case"presenter":return t.draft?3:0;case"refine":return t.nodes.some(pg)||t.nodes.some(r=>r.status==="running")?3:0;default:return 0}}const J8={"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 fq({open:e,pictures:t,note:n,onTake:r,onDecline:a}){return o.jsxs(Zs,{open:e,className:"sc-welcome",maxWidth:"440px",described:!0,tone:"guide",onDismiss:a,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsxs(ys,{className:"sc-newdlg-title",children:["Welcome to ",o.jsx("span",{className:"sc-accent",children:"Scenri"})]}),o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":iu.notNow,children:o.jsx(Cn,{size:16})})})]}),o.jsx(Bu,{className:"sc-welcome-lede",children:iu.lede}),t.length>0&&o.jsx("div",{className:"sc-welcome-pics","aria-hidden":"true",children:t.map((i,c)=>o.jsx("img",{src:i,alt:"",style:{animationDelay:`${120+c*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:iu.notNow}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:r,children:iu.take})]})]})}const f3=e=>e.t!=="format",jo=()=>[{t:"text",v:""}],ja=e=>e.t==="product"?`p:${e.id}`:e.t==="template"?`t:${e.id}`:e.t==="ref"?`r:${e.imageHash}`:Hp(e);function hq(e,t){const n=new Set,r=c=>{const d=ja(c);return d?n.has(d)?!1:(n.add(d),!0):!0},a=e.filter(f3).filter(r),i=t.filter(f3).filter(r);return{own:a,carried:i}}function c4(e){const{own:t,carried:n}=hq(e.tokens??[],e.inherited??[]),r=[...t,...n],a=r.length?r:jo(),i=a.some(c=>c.t==="template");return e.templateId&&!i?[{t:"template",id:e.templateId},...a]:a}const jl="sc-token",sf=`.${jl}`,Hp=e=>e.t==="template"?`t:${e.id}${e.setup?`|${e.setup}`:""}`: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}`:"",Qr=e=>{const t=e.slice(0,1),n=e.slice(2);if(t==="t"){const[r,a]=n.split("|");return r?{t:"template",id:r,...a?{setup:a}:{}}: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},Ho="\uFEFF",Qi=//g,Ol=e=>!!e&&e.nodeType===Node.TEXT_NODE&&e.textContent===Ho,EA=e=>{var t;return e.length-(((t=e.match(Qi))==null?void 0:t.length)??0)};function Eo(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)?xh(e,n.startContainer,n.startOffset):null}function Sa(e,t){if(!e)return;let n=0;for(const r of Array.from(e.childNodes)){const a=Lu(r);if(r.nodeType===Node.TEXT_NODE){if(t<=n+a){eo(e,r,bh(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,bh(i,0));return}break}n+=a}Al(e)}function bh(e,t){const n=e.textContent??"";if(n===Ho)return 1;let r=0,a=0;for(;a<n.length&&r<t;)n[a]!==Ho&&(r+=1),a+=1;return a}function Al(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 pq(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 Lu=e=>e.nodeType===Node.TEXT_NODE?EA(e.textContent??""):1;function xh(e,t,n){if(t===e){let a=0;for(let i=0;i<n&&i<e.childNodes.length;i++)a+=Lu(e.childNodes[i]);return a}let r=0;for(const a of Array.from(e.childNodes)){if(a===t)return r+EA((a.textContent??"").slice(0,n));if(a.contains(t))return r+1;r+=Lu(a)}return r}function Ya(e){var n,r;if(!e)return;const t=Eo(e);e.normalize();for(const a of Array.from(e.childNodes)){if(a.nodeType!==Node.TEXT_NODE)continue;const i=a.textContent??"",c=i.replace(Qi,""),d=c.length?c:i.length?Ho:"";d!==i&&(a.textContent=d),d||a.remove()}for(const a of Array.from(e.childNodes))Ol(a)&&!Ts(a.previousSibling)&&!Ts(a.nextSibling)&&a.remove();for(const a of Array.from(e.childNodes))Ts(a)&&(((n=a.previousSibling)==null?void 0:n.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(Ho),a),((r=a.nextSibling)==null?void 0:r.nodeType)!==Node.TEXT_NODE&&e.insertBefore(document.createTextNode(Ho),a.nextSibling));Wd(e)||t!==null&&Sa(e,t)}function mq(e){var n,r,a;if(!e)return!0;const t=e.childNodes;for(let i=0;i<t.length;i++){const c=t[i];if(Ts(c)){if(((n=c.previousSibling)==null?void 0:n.nodeType)!==Node.TEXT_NODE||((r=c.nextSibling)==null?void 0:r.nodeType)!==Node.TEXT_NODE)return!1;continue}if(c.nodeType!==Node.TEXT_NODE)continue;const d=c.textContent??"";if(!d||((a=t[i+1])==null?void 0:a.nodeType)===Node.TEXT_NODE||d.includes(Ho)&&(d!==Ho||!Ts(c.previousSibling)&&!Ts(c.nextSibling)))return!1}return!0}function gq(e){return e.querySelector(sf)?!1:!(e.textContent??"").replace(/[​ ]/g,"").trim()}function Wd(e){if(!e)return!1;const t=gq(e);return t&&e.firstChild&&e.replaceChildren(),e.toggleAttribute("data-empty",t),t}const Ts=e=>!!e&&e.nodeType===Node.ELEMENT_NODE&&e.classList.contains(jl);function u4(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 h3(e){var a;if(!e)return jo();const t=[];let n="";const r=()=>{n&&(t.push({t:"text",v:n}),n="")};for(const i of Array.from(e.childNodes)){if(i.nodeType===Node.TEXT_NODE){n+=(i.textContent??"").replace(Qi,"");continue}const c=i,d=(a=c.dataset)==null?void 0:a.tok;if(d){const f=Qr(d);if(f){r(),t.push(f);continue}}if(c.tagName==="BR"){n+=`
97
+ `;continue}n+=c.textContent??""}return r(),t.some(i=>i.t==="text")||t.push({t:"text",v:""}),t}function p3(e,t,n){if(e){e.textContent="";for(const r of vq(t)){if(r.t==="text"){r.v&&e.appendChild(document.createTextNode(r.v));continue}e.appendChild(n(r))}Ya(e)}}function vq(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 yq(e,t){var d,f;const n=u4(e);if(!n||!e)return!1;const{text:r,at:a}=n,i=Ol(r);if(t==="right"){if(!Ts(r.nextSibling)||!i&&a!==r.length)return!1;const h=(d=r.nextSibling)==null?void 0:d.nextSibling;return(h==null?void 0:h.nodeType)!==Node.TEXT_NODE?!1:(eo(e,h,Ol(h)?1:0),!0)}if(!Ts(r.previousSibling)||!i&&a!==0)return!1;const c=(f=r.previousSibling)==null?void 0:f.previousSibling;return(c==null?void 0:c.nodeType)!==Node.TEXT_NODE?!1:(eo(e,c,Ol(c)?1:c.length),!0)}function m3(e,t){const n=u4(e);if(!n)return null;const{text:r,at:a}=n,i=Ol(r);return t==="Backspace"?Ts(r.previousSibling)&&(i||a===0)?r.previousSibling:null:Ts(r.nextSibling)&&(i||a===r.length)?r.nextSibling:null}function g3(e,t){const n=u4(e);return!n||!Ol(n.text)?!1:t==="Backspace"?!n.text.previousSibling:!n.text.nextSibling}function mg(e,t){for(const n of Array.from(e.querySelectorAll(sf))){const r=Qr(n.dataset.tok??"");if(r&&ja(r)===t)return n}return null}function CA(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 jA(){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 Ll(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,Ol(a)?1:n==="after"?0:a.length)}const kh=9;function AA(e){if(!e.firstChild)return[];const t=document.createRange();return t.selectNodeContents(e),Array.from(t.getClientRects()).filter(n=>n.height>0)}function NA(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 v3(e,t,n){if(!e)return!1;const r=AA(e),a=NA(r,n);if(!a)return!1;const i=a.top+a.height/2;for(const d of Array.from(e.querySelectorAll(sf))){const f=d.getBoundingClientRect();if(!(f.bottom<a.top||f.top>a.bottom)&&!(t<f.left-kh||t>f.right+kh))return Ll(e,d,t<f.left+f.width/2?"before":"after"),!0}if(n>=a.top&&n<=a.bottom)return!1;const c=MA(t,i);return!c||!e.contains(c.node)||c.node.nodeType!==Node.TEXT_NODE?!1:(eo(e,c.node,c.offset),!0)}function wq(e,t,n){if(!e)return null;const r=NA(AA(e),n);if(!r)return null;const a=r.top+r.height/2;for(const c of Array.from(e.querySelectorAll(sf))){const d=c.getBoundingClientRect();if(!(d.bottom<r.top||d.top>r.bottom)&&!(t<d.left-kh||t>d.right+kh))return{beside:c,side:t<d.left+d.width/2?"before":"after"}}const i=MA(t,a);return!i||!e.contains(i.node)?null:{node:i.node,offset:i.offset}}function MA(e,t){var i,c;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=(c=n.caretPositionFromPoint)==null?void 0:c.call(n,e,t);return a?{node:a.offsetNode,offset:a.offset}:null}function bq(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){Sa(e,n.fallbackUnits);const c=window.getSelection();c&&c.rangeCount>0&&e.contains(c.getRangeAt(0).startContainer)&&(a=c.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 c=i,d=c.textContent??"";let f=d.slice(0,a.startOffset);const h=d.slice(a.startOffset);n.eatQuery&&(f=Eq(c,f)),c.textContent=f,e.insertBefore(t,c.nextSibling),h&&e.insertBefore(document.createTextNode(h),t.nextSibling)}else{const c=i===e?a.startOffset:e.childNodes.length;e.insertBefore(t,e.childNodes[c]??null)}Ya(e),Sa(e,Uo(e,t)+1)}const xq=["$","/","@","#"],kq=e=>xq.includes(e),Sh=e=>e===" "||e===`
98
+ `||e===" "||e===Ho;function Sq(e){const t=CA(e);for(let n=t.length-1;n>=0;n--){const r=t[n];if(Sh(r))return null;if(kq(r))return n===0||Sh(t[n-1])?{sigil:r,query:t.slice(n+1)}:null}return null}function Eq(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 c=i.textContent??"",d=n(c);if(d>=0){i.textContent=c.slice(0,d);for(const f of a)f.remove();return""}a.push(i)}return t}function gg(e,t){if(!e||!t)return;e.normalize();const n=Uo(e,t);t.remove(),Ya(e),Sa(e,n)}function Uo(e,t){let n=0;for(const r of Array.from(e.childNodes)){if(r===t)break;n+=Lu(r)}return n}const vu=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function Cq(e){let t="",n="",r=!1;const a=i=>{var f;if(i.nodeType===Node.TEXT_NODE){const h=(i.textContent??"").replace(Qi,"");if(!h)return;t+=h,n+=vu(h),r=!1;return}const c=i,d=(f=c.dataset)==null?void 0:f.tok;if(d){const h=Ao(c);t+=(r?" ":"")+h,r=!0,n+=`<span data-sc-tok="${vu(d)}">${vu(h)}</span>`;return}i.childNodes.forEach(a)};return e.cloneContents().childNodes.forEach(a),{text:t,html:`<span data-sc-brief="1">${n}</span>`}}function jq(e,t){const n=[],r=[];for(const a of e){if(a.t==="text"){const c=a.v.trim();if(!c)continue;n.push(c),r.push(vu(c));continue}const i=t(a);n.push(i),r.push(`<span data-sc-tok="${vu(Hp(a))}">${vu(i)}</span>`)}return{text:n.join(" "),html:`<span data-sc-brief="1">${r.join(" ")}</span>`}}function Ao(e){var t;return(((t=e.querySelector(".sc-token-label"))==null?void 0:t.textContent)??"").trim()}function Aq(e){if(!e.includes("data-sc-brief")&&!e.includes("data-bt-brief"))return null;const n=new DOMParser().parseFromString(e,"text/html").querySelector("[data-sc-brief], [data-bt-brief]");if(!n)return null;const r=[],a=i=>{var h,p;if(i.nodeType===Node.TEXT_NODE){const g=(i.textContent??"").replace(Qi,"");g&&r.push(g);return}const c=i,d=((h=c.dataset)==null?void 0:h.scTok)??((p=c.dataset)==null?void 0:p.btTok);if(d===void 0){i.childNodes.forEach(a);return}const f=Qr(d);r.push(f??c.textContent??"")};return n.childNodes.forEach(a),r.length?r:null}function RA(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 c=0;c<i.v.length;c++)(i.v[c]===" "||i.v[c]===`
99
+ `)&&t.add(n+c+1);n+=i.v.length}t.add(n);const r=[...t].sort((i,c)=>i-c),a=af(e);return r.filter((i,c)=>c===r.length-1||!/^[ \n]*$/.test(a.slice(i,r[c+1])))}const af=e=>e.map(t=>t.t==="text"?t.v:"").join(""),d4=(e,t,n)=>{const r=n<=t?e.slice(n,t):e.slice(t+1,n);return/^[ \n]*$/.test(r)};function Nq(e,t){const n=af(e);return RA(e).filter(r=>!d4(n,t,r))}function Mq(e,t){return e.find(n=>n>=t)??(e.length?e[e.length-1]:null)}function Rq(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 PA(e,t,n){if(!e||!t.parentNode)return!1;const r=Uo(e,t);if(d4(af(Ip(e)),r,n))return!1;let a=null,i=0;for(const c of Array.from(e.childNodes)){const d=Lu(c);if(n<=i+d){if(c.nodeType===Node.TEXT_NODE){const f=n-i;f<=0?a=c:f>=d?a=c.nextSibling:a=c.splitText(bh(c,f))}else a=n===i?c:c.nextSibling;break}i+=d}return a===t?!1:(t.remove(),e.insertBefore(t,a),Ya(e),!0)}function y3(e,t,n){if(!e)return!1;const r=Uo(e,t),a=Nq(Ip(e),r),i=n===-1?[...a].reverse().find(c=>c<r):a.find(c=>c>r+1);return i===void 0?!1:PA(e,t,i)}function Pq(e,t){if(!e)return t;const n=af(Ip(e));let r=t;for(;r>0&&(n[r-1]===" "||n[r-1]===`
100
+ `);)r-=1;return r}function w3(e,t,n,r){if(!e)return null;const a=wq(e,n,r);if(!a)return null;const i=Ip(e),c=Uo(e,t),d=RA(i),f="beside"in a?Uo(e,a.beside)+(a.side==="before"?0:1):a.node.nodeType===Node.TEXT_NODE||a.node===e?xh(e,a.node,a.offset):null;if(f===null)return null;const h="beside"in a&&a.side==="after"?Mq(d,f):Rq(d,f);return h===null?null:{units:h,noop:d4(af(i),c,h)}}function ev(e,t){const n=Ao(t)||"the chip",r=Lq(t);if(r)return`Moved ${n} before ${r}.`;const a=Tq(t);return a?`Moved ${n} after ${a}.`:Uo(e,t)===0?`Moved ${n} to the start of the brief.`:`Moved ${n} to the end of the brief.`}const LA=3;function Lq(e){for(let t=e.nextSibling;t;t=t.nextSibling){if(Ts(t))return Ao(t)||null;const n=(t.textContent??"").replace(Qi,"").trim();if(n)return`"${n.split(/\s+/).slice(0,LA).join(" ")}"`}return null}function Tq(e){for(let t=e.previousSibling;t;t=t.previousSibling){if(Ts(t))return Ao(t)||null;const n=(t.textContent??"").replace(Qi,"").trim();if(n)return`"${n.split(/\s+/).slice(-LA).join(" ")}"`}return null}function Ip(e){const t=[];let n="";for(const r of Array.from(e.childNodes)){if(r.nodeType===Node.TEXT_NODE){n+=(r.textContent??"").replace(Qi,"");continue}n&&(t.push({t:"text",v:n}),n=""),t.push({t:"ref",imageHash:""})}return n&&t.push({t:"text",v:n}),t}function tv(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 Rd=e=>(e==null?void 0:e.querySelector('[data-kind="template"]'))??null,bi=e=>{var t;return((t=e==null?void 0:e.closest)==null?void 0:t.call(e,sf))??null};function vg(e,t,n={}){var a;if(!e)return!1;let r=!1;for(let i=0;i<32;i++){const c=Dq(e,!!n.commit);if(!c)break;const d={t:"color",hex:c.hex,name:(a=n.nameFor)==null?void 0:a.call(n,c.hex)};Iq(e,c.node,c.start,c.end,t(d)),r=!0}return r&&Ya(e),r}function $q(e,t){var i;e.dataset.kind="color",e.dataset.tok=Hp(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 Dq(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=Hq(a.textContent??"",t,(d,f)=>Oq(a,f,d)),c=i[i.length-1];if(c)return{node:a,...c}}return null}function Oq(e,t,n){if(n>0)return Sh(t[n-1]);const r=e.previousSibling;if(!r||Ts(r))return!0;if(r.nodeType===Node.TEXT_NODE){const a=r.textContent??"";return!a.length||Sh(a[a.length-1]??"")}return!0}function Hq(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 c=e.slice(a,i),d=YK(c);if(!d)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:d})}return r}function Iq(e,t,n,r,a){const i=t.textContent??"",c=i.slice(0,n),d=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=d.length?d:" ",p.insertBefore(a,t),c&&p.insertBefore(document.createTextNode(c),a),h!=null)){if(h<=n){const g=a.previousSibling;(g==null?void 0:g.nodeType)===Node.TEXT_NODE&&eo(e,g,Math.min(h,(g.textContent??"").length));return}if(h<=r||!d.length){eo(e,t,t.length);return}eo(e,t,Math.min(h-r,t.length))}}function yu(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),c=a-i;if(c<.02)return;let d;return a===t?d=((n-r)/c+(n<r?6:0))*60%360:a===n?d=((r-t)/c+2)*60:d=((t-n)/c+4)*60,`hsl(${Math.round(d)} 55% 55%)`}function Fq(){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 Pd="data-sc-coach-inert",_q=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Vq(e=document.body){let t=new Set;const n=a=>{a.hasAttribute("inert")&&!a.hasAttribute(Pd)||(a.setAttribute(Pd,""),a.setAttribute("inert",""))},r=a=>{a.hasAttribute(Pd)&&(a.removeAttribute(Pd),a.removeAttribute("inert"))};return{set(a){const i=new Set(a.filter(h=>h.isConnected&&e.contains(h)&&h!==e)),c=new Set;for(const h of i)for(let p=h.parentElement;p&&p!==e;p=p.parentElement)c.add(p);const d=new Set,f=h=>{for(const p of Array.from(h.children))i.has(p)||_q.has(p.tagName)||(c.has(p)?f(p):d.add(p))};f(e);for(const h of t)d.has(h)||r(h);for(const h of d)t.has(h)||n(h);t=new Set([...d].filter(h=>h.hasAttribute(Pd)))},release(){for(const a of t)r(a);t=new Set}}}const G1=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),Io=e=>e.right-e.left,Qa=e=>e.bottom-e.top;function TA(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 Ld(e,t){return{left:e.left-t,top:e.top-t,right:e.right+t,bottom:e.bottom+t}}function b3(e,t=0,n=4,r=14,a=0,i=0,c=0){if(e>=4)return e+n;const d=i===0||a===0||a<=i+16;return t>=4&&d&&c<=1?t+n:r}function $A(e,t){return e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom}function x3(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 Io(n)>0&&Qa(n)>0?n:null}function k3(e,t){let{top:n,bottom:r}=e;const a=(e.top+e.bottom)/2;for(const i of t)$A(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 Zq=e=>e==="top"||e==="bottom";function zq(e,t,n){return t?Zq(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 S3=e=>e==="top"?"bottom":e==="bottom"?"top":e==="left"?"right":"left",ms=e=>Math.round(e*2)/2;function Bq(e,t,n){const r=ms(t),a=ms(n),i=e.map(d=>{const f=Math.max(0,ms(Io(d))),h=Math.max(0,ms(Qa(d))),p=ms(Math.max(0,Math.min(d.radius,f/2,h/2)));return`<rect x='${ms(d.left)}' y='${ms(d.top)}' width='${f}' height='${h}' rx='${p}' fill='black'/>`}).join(""),c=`<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(c)}")`}function Uq(e,t,n,r){const a=ms(t),i=ms(n),c=e.map(p=>{const g=Math.max(0,ms(Io(p))),v=Math.max(0,ms(Qa(p))),y=ms(Math.max(0,Math.min(p.radius,g/2,v/2)));return{x:ms(p.left),y:ms(p.top),ww:g,hh:v,k:y}}),d=c.map(p=>`<rect x='${p.x}' y='${p.y}' width='${p.ww}' height='${p.hh}' rx='${p.k}' fill='black'/>`),f=c.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'/>${d.join("")}</mask></defs><g mask='url(#o)'>${f.join("")}</g></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(h)}")`}function Wq(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=>Io(a)>0&&Qa(a)>0)}const E3=0,Gq=10,yg=14,Td=4,wg="data-guide-stage",Kq="rgba(255,255,255,0.05)",nv="[data-guide-shape]",C3=[],Yq="[data-radix-popper-content-wrapper], .sc-setpop, .sc-morepop, .sc-shotsheet, .sc-note-pop",j3='input, textarea, [contenteditable]:not([contenteditable="false"])',qq=17,j1=12,Xq=20,Qq=450,Jq=768,A3=90,eX=8,N3=12,tX=2e3,nX=".sc-topbar, .sc-tabbar, .sc-filterbar, .sc-canvas-dock, .sc-help-float, .sc-pstudio-head, .sc-newdlg-head",rX=120,sX="[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",bg=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 aX(e){const{id:t,voice:n,target:r,live:a,side:i,container:c,onShown:d}=e,f=e.lit??C3,h=e.also??C3,p=n==="ask",g=!r,v=!!(e.title||e.body),y=s.useId(),b=s.useId(),x=s.useRef(null),k=s.useRef(null),S=s.useRef(null),E=s.useRef(null),C=s.useRef(null),N=s.useRef(null),M=s.useRef(null),T=s.useRef(null),L=s.useRef(null),A=s.useRef(null),[P,$]=s.useState("moving"),[H]=s.useState(dX),[O,Q]=s.useState(()=>bg(e)),I=s.useRef(e);I.current=e;const V=s.useRef(!1),ie=s.useRef(null),B=s.useRef([]),F=P==="shown"&&O.id===t?bg(e):O,te=xg(a),X=xg(h),Z=xg(f);s.useEffect(()=>{if(p)return A.current=Vq(c),()=>{var z;(z=A.current)==null||z.release(),A.current=null;for(const Y of B.current)Y.removeAttribute(wg);B.current=[]}},[p,c]),s.useLayoutEffect(()=>{var yn,Oe,wt;const z=x.current,Y=k.current,J=S.current,de=E.current,ae=C.current,W=N.current;if(p&&(!J||!de||!ae||!W)||v&&(!z||!Y))return;let ye=!0,ee=0,ge=0,re=!1,D=!1,G="",Pe=0,Ze=0,He=0,tt=null,oe=null,he=null;const Ae=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ue=a[0]??r??c;let ke="",qe=r?A1(r):null;$("moving");const Ve=()=>{var pt;return(pt=A.current)==null?void 0:pt.set([...z?[z]:[],...J?[J]:[],...de?[de]:[],...ae?[ae]:[],...W?[W]:[],...a,...h,...[...document.querySelectorAll(sX)].filter(Nt=>![...a,...h].some(Ct=>Nt.contains(Ct)))])},Xe=()=>{var pt,Nt;(pt=A.current)==null||pt.release(),D=!1,$("away"),(Nt=r??a[0])!=null&&Nt.isConnected&&st()};if(p&&A.current&&V.current){Ve(),D=!0;const pt=a.find(Ct=>Ct.matches(j3)),Nt=document.activeElement;pt&&!a.some(Ct=>Ct.contains(Nt))&&M3(pt)}const Re=async()=>{const pt=++ee;if(r&&!r.isConnected||a.some(ne=>!ne.isConnected))return Xe(),I.current.onLost();const Nt=window.innerWidth,Ct=window.innerHeight,$t=window.visualViewport,Yt=[{left:0,top:0,right:Nt,bottom:Ct},...$t?[{left:$t.offsetLeft,top:$t.offsetTop,right:$t.offsetLeft+$t.width,bottom:$t.offsetTop+$t.height}]:[]],Vn=ne=>{const se=ne===r?qe:A1(ne);return se?[...Yt,G1(se.getBoundingClientRect())]:Yt},pn=oX(ue,c),ar=pn.filter(ne=>Io(ne)>Nt/3),bt=r?x3(G1(r.getBoundingClientRect()),Vn(r)):null,kt=bt&&k3(bt,ar);if(r&&!kt)return!re&&He<N3&&(He++,qe=A1(r),kg(r,qe,Ae).then(()=>ye&&Ye())),Xe();const sn=[],Ut=[];for(const ne of[...r?[r]:[],...a,...h,...f,...R3()]){const se=P3(ne);Ut.includes(se)||Ut.push(se)}const Tn=new Set([...r?[r]:[],...a,...f,...R3()].map(P3));let Vt=null;for(const ne of Ut){const se=x3(G1(ne.getBoundingClientRect()),Vn(ne)),pe=se&&k3(se,ar);if(!pe)continue;const ve=K1(ne);sn.push(ve>=4||ne.matches("img, video, canvas")?{...Ld(pe,E3),radius:ve+E3}:{...Ld(pe,Gq),radius:yg}),Tn.has(ne)&&(Vt=Vt?TA(Vt,pe):pe)}if(!g&&!kt&&!Vt)return Xe();if(D&&(a.some(ne=>ne.closest("[inert]"))||z!=null&&z.closest("[inert]"))&&(D=!1),p&&J&&de&&ae&&W){if(!sn.length&&kt){const pe=r,ve=L3(pe);sn.push({...Ld(kt,Td),radius:b3(K1(pe),ve.radius,Td,yg,Qa(kt),ve.height,ve.count)})}for(const pe of B.current)Ut.includes(pe)||pe.removeAttribute(wg);for(const pe of Ut)pe.setAttribute(wg,"");B.current=Ut;const se=`${sn.map(pe=>[pe.left,pe.top,pe.right,pe.bottom,pe.radius].map(Math.round).join(",")).join("|")}@${Nt}x${Ct}`;if(se!==ke&&(ke=se,uX(J,de,W,sn,H)),r&&kt){const pe=mX(r),ve=L3(r),Ee=pe??Ld(kt,Td);Object.assign(ae.style,{left:`${Ee.left}px`,top:`${Ee.top}px`,width:`${Io(Ee)}px`,height:`${Qa(Ee)}px`,borderRadius:`${pe?pX:b3(K1(r),ve.radius,Td,yg,Qa(kt),ve.height,ve.count)}px`}),ae.hidden=!1}else ae.hidden=!0}if(z&&document.documentElement.style.setProperty("--sc-coach-h",`${Math.round(z.offsetHeight)}px`),z&&g&&(z.style.right="",z.style.left=`${Math.round((Nt-z.offsetWidth)/2)}px`,z.style.top=`${Math.round((Ct-z.offsetHeight)/2)}px`,z.dataset.side="centre",Y&&(Y.hidden=!0)),z&&Y&&r&&kt){z.style.right="";const ne={top:j1+iX(pn,Ct),bottom:j1+lX(pn,Ct),left:j1,right:j1},se=Nt>=Jq;oe!==se&&(oe!==null&&r&&(qe=A1(r),kg(r,qe,Ae)),tt=null,oe=se);const pe=i==="left"||i==="right"?"top":i,ve=!se&&Io(kt)>Nt*.6,Ee=se?i:ve?`${pe}-start`:pe,We=(jt,et)=>mE(cX(jt,r),z,{strategy:"fixed",placement:tt??Ee,middleware:[fE(qq),pE({padding:ne,fallbackPlacements:et}),hE({padding:ne}),m8({element:Y,padding:Xq})]}),Ke=!se&&Vt?{...kt,top:Vt.top,bottom:Vt.bottom}:kt,Ue=(jt,et)=>$A({left:jt,top:et,right:jt+z.offsetWidth,bottom:et+z.offsetHeight},Ld(Ke,Td)),rt=se&&(i==="left"||i==="right")?[S3(i),"top","bottom"]:se?void 0:ve?["bottom-start","top-start"]:["bottom","top"],me=!p&&Qa(kt)>Ct*.6,q=se&&(e.beside||a.length>1),Te=me?{...kt,top:kt.bottom-1}:q?zq(kt,Vt,i):Ke;let je=await We(Te,me?["top"]:rt);if(!ye||pt!==ee||!me&&Ue(je.x,je.y)&&(je=await We(Ke,void 0),!ye||pt!==ee))return;if(!me&&Ue(je.x,je.y))return $("stowed");tt=je.placement;const gt=je.placement.split("-")[0];z.style.left=`${Math.round(je.x)}px`,z.style.top=`${Math.round(je.y)}px`,z.dataset.side=gt;const dt=je.middlewareData.arrow;Y.dataset.edge=S3(gt),Y.style.left=(dt==null?void 0:dt.x)!=null?`${dt.x}px`:"",Y.style.top=(dt==null?void 0:dt.y)!=null?`${dt.y}px`:"",Y.hidden=!dt||Math.abs(dt.centerOffset)>1}if(p&&!D&&(Ve(),D=!0),!re){if(gX([...r?[r]:[],...a])&&++Ze<N3){window.setTimeout(Ye,A3);return}const ne=[...r?[r]:[],...a,...h,...f].map(se=>{const pe=se.getBoundingClientRect();return[pe.left,pe.top,pe.right,pe.bottom].map(Math.round).join(",")}).join("|");if(ne!==G&&(G=ne,Pe=0),++Pe<2&&Pe<eX){window.setTimeout(Ye,A3);return}}$("shown"),re||(re=!0,$e(),st())};let Ie=0;const st=()=>{const pt=r??a[0];if(!pt)return;cancelAnimationFrame(Ie);let Nt=pt.getBoundingClientRect();const Ct=performance.now()+tX,$t=()=>{if(!ye)return;const Yt=pt.getBoundingClientRect();(Yt.top!==Nt.top||Yt.left!==Nt.left||Yt.height!==Nt.height)&&(Nt=Yt,Ye()),performance.now()<Ct&&(Ie=requestAnimationFrame($t))};Ie=requestAnimationFrame($t)},Ye=()=>{cancelAnimationFrame(ge),ge=requestAnimationFrame(()=>void Re())},$e=()=>{V.current=!0;let pt=!1;if(p&&z){const Nt=Yt=>!!Yt&&a.some(Vn=>Vn.contains(Yt)),Ct=document.activeElement,$t=a.find(Yt=>Yt.matches(j3))??null;L.current&&Nt(Ct)?L.current=null:L.current?(((L.current==="back"?M.current:null)??T.current??z).focus({preventScroll:!0}),L.current=null):$t&&!Nt(Ct)?M3($t):(!Ct||Ct===document.body||Ct.closest("[inert]"))&&(z.focus({preventScroll:!0}),pt=!0)}d(t,pt)},Qe=V.current&&!Ae&&v&&ie.current!==t?rX:0;ie.current=t,fX(Qe).then(()=>{if(ye)return Mr.flushSync(()=>Q(bg(I.current))),r?kg(r,qe,Ae):void 0}).then(()=>{ye&&(he=dE(ue,z??J??ue,Ye))});const Fe=new ResizeObserver(Ye);for(const pt of a)Fe.observe(pt);r&&Fe.observe(r),z&&Fe.observe(z);for(const pt of[...r?[r]:[],...a]){const Nt=(yn=pt==null?void 0:pt.closest)==null?void 0:yn.call(pt,nv);Nt&&Fe.observe(Nt)}(Oe=window.visualViewport)==null||Oe.addEventListener("resize",Ye),(wt=window.visualViewport)==null||wt.addEventListener("scroll",Ye);let yt=0;const ht=p?new MutationObserver(()=>{D&&(cancelAnimationFrame(yt),yt=requestAnimationFrame(Ve))}):null;return ht==null||ht.observe(c,{childList:!0,subtree:!0}),()=>{var pt,Nt;ye=!1,document.documentElement.style.removeProperty("--sc-coach-h"),cancelAnimationFrame(ge),cancelAnimationFrame(Ie),cancelAnimationFrame(yt),ht==null||ht.disconnect(),he==null||he(),Fe.disconnect(),(pt=window.visualViewport)==null||pt.removeEventListener("resize",Ye),(Nt=window.visualViewport)==null||Nt.removeEventListener("scroll",Ye)}},[t,p,v,r,te,X,Z,i,c,d,H]),s.useEffect(()=>{if(!v||!r||!hX(r))return;const z=(r.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);if(!z.includes(b))return r.setAttribute("aria-describedby",[...z,b].join(" ")),()=>{const Y=(r.getAttribute("aria-describedby")??"").split(/\s+/).filter(J=>J&&J!==b);Y.length?r.setAttribute("aria-describedby",Y.join(" ")):r.removeAttribute("aria-describedby")}},[v,r,b]);const{onEscape:K}=e;return s.useEffect(()=>{if(!p)return;const z=ye=>!!ye&&a.some(ee=>ee.contains(ye)),Y=ye=>{var G;const ee=x.current,ge=ye.target instanceof Node?ye.target:null,re=z(ge),D=document.activeElement;if(ye.key==="Escape"){if(ye.defaultPrevented||D!=null&&D.closest('[role="dialog"]:not(.sc-coach):not(.sc-attachpanel)')||re&&(D!=null&&D.closest('input, textarea, select, [contenteditable="true"], [role="menu"], [role="listbox"]')))return;ye.preventDefault(),ye.stopPropagation(),K(t);return}re||(!ge||ge===document.body||ge===document.documentElement||ee!=null&&ee.contains(ge)||(G=E.current)!=null&&G.contains(ge))&&ye.stopPropagation()};let J=0,de=!1;const ae=ye=>{de=ye.target instanceof Node&&z(ye.target)},W=ye=>{ye.relatedTarget||de||!x.current||(cancelAnimationFrame(J),J=requestAnimationFrame(()=>{var ge;if(!document.hasFocus())return;const ee=document.activeElement;(!ee||ee===document.body||ee.closest("[inert]"))&&((ge=x.current)==null||ge.focus({preventScroll:!0}))}))};return window.addEventListener("keydown",Y,!0),window.addEventListener("pointerdown",ae,!0),document.addEventListener("focusout",W,!0),()=>{cancelAnimationFrame(J),window.removeEventListener("keydown",Y,!0),window.removeEventListener("pointerdown",ae,!0),document.removeEventListener("focusout",W,!0)}},[t,p,te,K]),Mr.createPortal(o.jsxs(o.Fragment,{children:[p&&o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:S,className:"sc-coach-veil","data-veil":H?"mask":"panels","data-soft":e.soft||void 0,"data-state":P,"aria-hidden":"true",children:$3.map(z=>o.jsx("div",{className:"sc-coach-panel"},z))}),o.jsx("div",{ref:E,className:"sc-coach-catch","data-guide":"catch","data-state":P,"aria-hidden":"true",onMouseDown:z=>z.preventDefault(),children:$3.map(z=>o.jsx("div",{className:"sc-coach-catch-part"},z))}),o.jsx("div",{ref:N,className:"sc-coach-rim","data-state":P,"aria-hidden":"true"}),o.jsx("div",{ref:C,className:"sc-coach-ring","data-state":P,"aria-hidden":"true",hidden:!0})]}),v&&o.jsxs("div",{ref:x,className:"sc-coach","data-guide":"card","data-voice":p?"coach":"card","data-beside":e.beside||void 0,...p?{role:"dialog","aria-labelledby":F.title?y:void 0}:{role:"note"},"aria-describedby":b,tabIndex:-1,"data-state":P,children:[o.jsx("div",{ref:k,className:"sc-coach-arrow","aria-hidden":"true",hidden:!0}),o.jsxs("div",{className:"sc-coach-head",children:[F.title?o.jsx("h2",{id:y,className:"sc-coach-title",children:F.title}):o.jsx("p",{id:b,className:"sc-coach-body","data-lead":"",children:F.body}),F.count&&o.jsxs("p",{className:"sc-coach-count",children:[o.jsx("span",{className:"sc-vh",children:"Step "}),F.count]}),o.jsx(xr,{label:e.closeLabel,children:o.jsx("button",{type:"button",className:"sc-coach-x","aria-label":e.closeLabel,onClick:()=>e.onClose(t),children:o.jsx(Cn,{size:16})})})]}),F.title&&F.body&&o.jsx("p",{id:b,className:"sc-coach-body",children:F.body}),(F.canBack||F.action)&&o.jsxs("div",{className:"sc-coach-foot",children:[F.canBack&&o.jsx("button",{ref:M,type:"button",className:"sc-coach-back",onClick:()=>{L.current="back",e.onBack(t)},children:"Back"}),F.action&&o.jsx("button",{ref:T,type:"button",className:"sc-btn sc-btn-primary sc-coach-next",onClick:()=>{L.current="action",e.onAction(t)},children:F.action.label})]})]})]}),c)}function M3(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}Al(e)}function R3(){return[...document.querySelectorAll(Yq)].filter(e=>e.getClientRects().length>0)}function xg(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 oX(e,t){const n=[];for(const r of document.querySelectorAll(nX))t.contains(r)&&(r.contains(e)||e.contains(r)||r.getClientRects().length===0||n.push(G1(r.getBoundingClientRect())));return n}function iX(e,t){return Math.max(0,...e.filter(n=>n.top<=0&&n.bottom<t/3).map(n=>n.bottom))}function lX(e,t){return Math.max(0,...e.filter(n=>n.bottom>=t&&n.top>t*2/3).map(n=>t-n.top))}function cX(e,t){const n={x:e.left,y:e.top,left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:Io(e),height:Qa(e)};return{getBoundingClientRect:()=>n,contextElement:t}}function uX(e,t,n,r,a){const i=window.innerWidth,c=window.innerHeight,d=r.reduce((h,p)=>h?TA(h,p):p,null),f=d?Wq(d,i,c):[];if(a){const h=Bq(r,i,c),p=e.style;p.maskImage=h,p.webkitMaskImage=h,n.style.backgroundImage=Uq(r,i,c,Kq)}else T3(e,f);T3(t,f)}function K1(e){return Number.parseFloat(getComputedStyle(e).borderTopLeftRadius)||0}function P3(e){return e.closest(nv)??e.querySelector(nv)??e}function L3(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,K1(a)),n=Math.max(n,a.getBoundingClientRect().height));return{radius:t,height:n,count:r}}function T3(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:`${Io(a)}px`,height:`${Qa(a)}px`})})}const $3=[0,1,2,3];function dX(){return typeof CSS>"u"?!1:CSS.supports("mask-image",'url("x.svg")')||CSS.supports("-webkit-mask-image",'url("x.svg")')}function A1(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 kg(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 d=r.height>a.height*.8?r.top-a.top-16:(r.top+r.bottom)/2-(a.top+a.bottom)/2;return t.scrollBy({top:d,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,Qq)})}function fX(e){return e>0?new Promise(t=>window.setTimeout(t,e)):Promise.resolve()}function hX(e){return e.matches('button, a[href], input, select, textarea, [tabindex], [contenteditable="true"]')}const pX=10;function mX(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 gX(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 Qn=e=>e.kind==="question"?`q:${e.question.id}`:`${e.kind}:${e.id}`,of=320,f4=180,vX=28,yX=700;function Fp(e){const t=e.split(/(\s+)/).filter(a=>a.length>0),n=t.filter(a=>!/^\s+$/.test(a)).length,r=Math.min(vX,Math.floor(yX/Math.max(1,n)));return{words:t,step:r,total:of+f4+r*n+160}}function Sg(e,t){return e.every(n=>!!t[n.id])}function wX(e,t,n={}){const r=e.trim().toLowerCase();if(!r||r.split(/\s+/).length>6)return null;for(const i of t){const c=i.label.toLowerCase();if(r===c||r===i.id.toLowerCase())return i.id}for(const i of t){const c=n[i.id];if(c!=null&&c.test(r))return i.id}return null}function bX(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const xX=/^(hi|hello|hey|heya|hiya|yo|hola|shalom|sup|good (morning|afternoon|evening)|thanks|thank you|thx|cheers)\b/i,kX=/^(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,SX=/^(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,EX=/^(start over|start again|restart|reset|cancel|stop|quit|exit|go back|back|undo|never ?mind|forget it|close)\b/i,CX=/^(skip|next|continue|go|go on|proceed|generate|draw|render|build|show me|show|try|do it|let'?s go|begin|start)\b/i,D3=/^(help|help me|how does this work|what do i do|what should i (write|say|type)|instructions|\?+)[\s!.,?]*$/i,jX=/\b(presenters?|avatars?|characters?|Scenri|create|creating|generate|generating|images?|pictures?|shoot|campaign|brand|product)\b/i,AX=/^(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,NX=/^[b-df-hj-np-tv-xz]{3,}$/i,MX=/(.)\1{3,}/,RX=/\b(like|as|resembling|resembles|similar to|looks? like|looking like)\s+([A-Z][a-z]+)(?:\s+[A-Z][a-z]+)*\b/,PX=/^(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 Po(e,t){const n=e.trim();if(!n)return null;const r=RX.exec(n);if(r&&!PX.test(r[2]))return"likeness";if(t(n))return null;if(!new RegExp("\\p{L}","u").test(n))return D3.test(n)?"help":"nonsense";const a=n.split(/\s+/).filter(Boolean),i=a.length;if(D3.test(n))return"help";if(xX.test(n)&&i<=4)return"greeting";if(kX.test(n))return"ack";const c=d=>d.replace(/[^a-z]/gi,"");return i<=8&&a.some(d=>AX.test(c(d))||NX.test(c(d))||MX.test(c(d)||d))?"nonsense":SX.test(n)||/\?\s*$/.test(n)?"question":EX.test(n)&&i<=4?"nav":jX.test(n)&&i<=10?"intent":CX.test(n)&&i<=4?"go":i===1&&/^[A-Z][a-z]+$/.test(n)?null:i<=2?"vague":null}const LX=e=>`aside-said-${e}`,O3=e=>e.startsWith("aside-said-")?e.slice(11):null,Wo=(e,t=!1,n=!1)=>[...n?[]:[{kind:"you",id:LX(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}],Eh=e=>(e.kind==="you"||e.kind==="scenri")&&e.id.startsWith("aside-");function DA(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question.id;if(!Eh(n))return null}return null}const Ch=()=>new Date().toISOString();function TX({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 $X({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 c=h=>{const p=n.current;if(!p)return;const g=p.firstElementChild,v=Number.parseFloat(getComputedStyle(p).columnGap)||0,y=g?g.offsetWidth+v:e,b=!window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.scrollBy({left:h*y,behavior:b?"smooth":"auto"})},d=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":d,children:[f&&o.jsx(H3,{dir:-1,live:r.back,onGo:c}),o.jsx("div",{className:"sc-convo-plates",ref:n,children:t}),f&&o.jsx(H3,{dir:1,live:r.on,onGo:c})]})}function H3({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(Da,{size:14,weight:"bold"}):o.jsx(qi,{size:14,weight:"bold"})})}const DX=106;function I3({options:e,picked:t,onPick:n}){return o.jsx($X,{step:DX,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 OA=6e4,OX=60*OA,Eg=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),HX=e=>e.toLocaleDateString([],{day:"numeric",month:"short"});function IX(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 FX(e,t=Date.now()){const n=Math.max(0,t-e);if(n<45e3)return"just now";if(n<OX)return`${Math.max(1,Math.round(n/OA))} min ago`;const r=new Date(e),a=IX(r,new Date(t));return a===0?Eg(r):a===1?`Yesterday ${Eg(r)}`:`${HX(r)} ${Eg(r)}`}const _X=e=>new Date(e).toLocaleString([],{dateStyle:"medium",timeStyle:"short"});function VX({text:e,tone:t,at:n,now:r,reveal:a,eyebrow:i=!0,delay:c=0,leave:d,turnId:f,dim:h,thumb:p,label:g,view:v,current:y,restore:b,onRestore:x,retry:k,onRetry:S,onShow:E}){const[C]=s.useState(c),N=p4(d,C),{playing:M,thinking:T}=VA(a,e,C,N==="true");return o.jsxs("div",{className:"sc-convo-turn","data-guide-shape":"","data-who":"scenri","data-arrive":M||void 0,"data-leave":N,"data-turn":f,"data-dim":h||void 0,style:M?{...HA(C),"--sc-convo-after":`${Fp(e).total}ms`}:void 0,children:[i&&o.jsx(h4,{thinking:T,at:n,now:r}),o.jsxs("p",{className:"sc-convo-say","data-tone":t,"data-reveal":M||void 0,children:[T&&o.jsx(FA,{}),o.jsx(_A,{text:e,playing:M})]}),p&&o.jsxs("span",{className:"sc-convo-shot","data-reveal":M||void 0,"data-current":y||void 0,children:[v&&E?o.jsx("button",{type:"button",className:"sc-convo-shot-pick","aria-label":g?`Show ${g} on the stage`:"Show this on the stage",onClick:()=>E(v),children:o.jsx(F3,{thumb:p,label:g,current:y})}):o.jsx(F3,{thumb:p,label:g,current:y}),b&&x?o.jsx("button",{type:"button",className:"sc-convo-shot-do sc-convo-restore",onClick:()=>x(b.view,b.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"}):y&&o.jsx("span",{className:"sc-convo-shot-do",children:"Active"})]})]})}const HA=e=>({"--sc-convo-start":`${e}ms`,"--sc-convo-think":`${of}ms`});function h4({thinking:e,at:t,now:n}){return o.jsxs("span",{className:"sc-convo-who","data-thinking":e||void 0,children:[o.jsx(cK,{className:"sc-convo-mark"}),"Scenri",t?o.jsx(IA,{at:t,now:n}):null]})}function IA({at:e,now:t}){return o.jsx("time",{className:"sc-convo-time",dateTime:new Date(e).toISOString(),title:_X(e),children:FX(e,t)})}function ZX({what:e="Thinking"}){return o.jsxs("div",{className:"sc-convo-turn","data-who":"scenri","data-working":"true",children:[o.jsx(h4,{thinking:!0}),o.jsx("p",{className:"sc-convo-say",role:"status",children:o.jsxs("span",{className:"sc-convo-work",children:[e,o.jsx(zX,{})]})})]})}function zX(){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 FA(){return o.jsxs("span",{className:"sc-convo-dots","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]})}function _A({text:e,playing:t}){if(!t)return o.jsx(o.Fragment,{children:e});const{words:n,step:r}=Fp(e);let a=0,i=0;return o.jsx(o.Fragment,{children:n.map(c=>{const d=i;if(i+=c.length,/^\s+$/.test(c))return c;const f=a++;return o.jsx("span",{className:"sc-convo-w",style:{"--sc-convo-word-delay":`${f*r}ms`},children:c},`${d}:${c}`)})})}function VA(e,t,n=0,r=!1){const[a,i]=s.useState(!!e),[c,d]=s.useState(!!e),f=s.useRef(!!e);return s.useEffect(()=>{e&&!f.current&&(i(!0),d(!0)),f.current=!!e},[e]),s.useEffect(()=>{if(!a)return;const h=setTimeout(()=>{d(!1),i(!1)},n+Fp(t).total),p=setTimeout(()=>d(!1),n+of);return()=>{clearTimeout(h),clearTimeout(p)}},[a,t,n]),{playing:a&&!r,thinking:a&&c&&!r}}function p4(e,t,n=of+f4){const r=s.useRef(performance.now());if(e)return performance.now()-r.current<t+n?"early":"true"}function F3({thumb:e,label:t,current:n}){return o.jsx("img",{src:nn(e,"micro"),srcSet:`${nn(e,"micro")} 160w, ${nn(e,"small")} 320w, ${nn(e,"tile")} 640w`,sizes:"(max-width: 767px) 248px, 128px",alt:n&&t?`${t}, active`:t??""})}const BX=300,UX=e=>typeof e=="string"?e:null,WX=e=>Array.isArray(e)?e:[],GX=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{};function KX({question:e,reveal:t,busy:n,eyebrow:r=!0,delay:a=0,leave:i,spent:c,turnId:d,dim:f,at:h,now:p,onAnswer:g,onPick:v,onStarter:y,onDescribe:b,onAttachFiles:x,onCancel:k}){var W,ye,ee,ge,re;const[S]=s.useState(a),E=p4(i,S),{playing:C,thinking:N}=VA(t,e.prompt,S,E==="true"),M="given"in e?e.given:void 0,[T,L]=s.useState(()=>GX(M)),[A,P]=s.useState(null),[$,H]=s.useState(()=>new Set(WX(M))),O=!!c||!!n,Q=s.useRef(!1);s.useEffect(()=>{Q.current&&!O&&P(null),Q.current=O},[O]);const I=(D,G)=>{A||(P(D),v==null||v(e.id,{picked:D,picks:T}),g(G))},V=A??UX(M),ie=s.useRef(null),B=s.useRef(null),F=s.useRef(()=>{});F.current=()=>{e.kind==="pick"&&e.more&&!e.loading&&g({kind:"pick",action:{type:"more"}})};const te=e.kind==="pick"?e.items.length:0,X=e.kind==="pick"&&!!e.more;s.useEffect(()=>{const D=B.current,G=ie.current;if(!D||!G||!X||typeof IntersectionObserver>"u")return;const Pe=new IntersectionObserver(Ze=>Ze.some(He=>He.isIntersecting)&&F.current(),{root:G,rootMargin:"0px 0px 240px 0px"});return Pe.observe(D),()=>Pe.disconnect()},[te,X]);const Z=te>0;s.useLayoutEffect(()=>{const D=ie.current;if(!D||!Z||typeof ResizeObserver>"u")return;const G=()=>{const Ze=D.querySelector(".sc-convo-plate");Ze&&D.style.setProperty("--sc-pick-row",`${Ze.getBoundingClientRect().height}px`)};G();const Pe=new ResizeObserver(G);return Pe.observe(D),()=>Pe.disconnect()},[Z]);const K=e.kind==="pick"?(W=e.search)==null?void 0:W.value:void 0;s.useEffect(()=>{ie.current&&(ie.current.scrollTop=0)},[K]);const z=Fp(e.prompt),Y=`sc-convo-q-${e.id}`,J=s.useRef(null),de=e.reopened&&k&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost sc-convo-cancel",onClick:k,children:"Cancel"}),ae="attach"in e&&e.attach&&x&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-chip sc-convo-choice sc-convo-pass",onClick:()=>{var D;return(D=J.current)==null?void 0:D.click()},children:[o.jsx(qB,{size:14,weight:"bold"}),e.attach]}),o.jsx("input",{ref:J,type:"file",accept:"image/*",hidden:!0,"aria-label":e.attach,onChange:D=>{const G=Array.from(D.target.files??[]).filter(Pe=>Pe.type.startsWith("image/"));D.target.value="",G.length&&x(G)}})]});return o.jsxs("div",{className:"sc-convo-turn","data-who":"scenri","data-arrive":C||void 0,"data-leave":E,"data-turn":d,"data-dim":f||void 0,"data-reopened":e.reopened||void 0,style:C?{...HA(S),"--sc-convo-after":`${z.total}ms`}:void 0,children:[!e.reopened&&r&&o.jsx(h4,{thinking:N,at:h,now:p}),!e.reopened&&o.jsxs("p",{className:"sc-convo-say",id:Y,"data-tone":e.tone,"data-reveal":C||void 0,children:[N&&o.jsx(FA,{}),o.jsx(_A,{text:e.prompt,playing:C})]}),e.reopened&&o.jsx("span",{id:Y,hidden:!0,children:e.prompt}),!e.reopened&&e.hint&&o.jsx("p",{className:"sc-convo-hint","data-reveal":C||void 0,children:e.hint}),o.jsxs("fieldset",{className:"sc-convo-q","aria-labelledby":Y,hidden:e.kind==="text"&&!((ye=e.starters)!=null&&ye.length)&&!e.cost&&!e.note?!0:void 0,tabIndex:-1,"data-kind":e.kind,"data-reveal":C||void 0,"data-picked":!!A||void 0,disabled:n||void 0,children:[e.starters&&e.starters.length>0&&o.jsx("div",{className:"sc-convo-starters",children:e.starters.map(D=>o.jsx(xr,{label:D.text,children:o.jsx("button",{type:"button",className:"sc-convo-starter",onClick:()=>y==null?void 0:y(D.text),children:D.label})},D.text))}),e.kind==="choice"&&((ee=e.options)==null?void 0:ee.some(D=>D.card))&&o.jsx(I3,{options:e.options,picked:V,onPick:D=>I(D,{kind:"choice",id:D})}),e.kind==="choice"&&e.options&&!e.groups&&!e.options.some(D=>D.card)&&o.jsx("div",{className:"sc-convo-choices sc-convo-ask","data-guide-shape":"",children:e.options.map(D=>o.jsx("button",{type:"button",className:"sc-chip sc-convo-choice","aria-pressed":e.multi?$.has(D.id):void 0,"data-on":(e.multi?$.has(D.id):V===D.id)||void 0,onClick:()=>e.multi?H(G=>{const Pe=new Set(G);return Pe.delete(D.id)||Pe.add(D.id),Pe}):I(D.id,{kind:"choice",id:D.id}),children:D.label},D.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":A==="skip"||!A&&e.skipped||void 0,onClick:()=>I("skip",{kind:"skip"}),children:e.skip}),e.describe&&b&&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:b,children:e.describe}),ae,!e.multi&&de]}),e.kind==="choice"&&!e.groups&&!e.multi&&!e.describe&&!e.attach&&de&&o.jsx("div",{className:"sc-convo-ways sc-convo-ask","data-guide-shape":"",children:de}),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":A==="submit"||void 0,onClick:()=>I("submit",{kind:"choices",picks:Object.fromEntries([...$].map(D=>[D,"on"]))}),children:e.submit??"Continue"}),e.skip&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-on":A==="skip"||!A&&e.skipped||void 0,onClick:()=>I("skip",{kind:"skip"}),children:e.skip}),de]}),e.kind==="choice"&&e.groups&&o.jsxs("div",{className:"sc-convo-groups",children:[e.groups.map(D=>o.jsxs("div",{className:"sc-convo-group",children:[o.jsx("span",{className:"sc-convo-group-lb",id:`sc-convo-g-${e.id}-${D.id}`,children:D.label}),o.jsx(Mo,{label:D.label,value:T[D.id]??"",ids:D.options.map(G=>G.id),onChange:G=>L(Pe=>({...Pe,[D.id]:G})),className:"sc-convo-choices",children:D.options.map(G=>o.jsx(Ro,{id:G.id,on:T[D.id]===G.id,label:G.label,className:"sc-chip sc-convo-choice",onPick:()=>L(Pe=>({...Pe,[D.id]:G.id})),children:G.label},G.id))})]},D.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":!Sg(e.groups,T)||void 0,title:Sg(e.groups,T)?void 0:"Pick one in each row, or skip.","data-on":A==="submit"||void 0,onClick:()=>{Sg(e.groups??[],T)&&I("submit",{kind:"choices",picks:T})},children:e.submit??"Continue"}),e.skip&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-on":A==="skip"||!A&&e.skipped||void 0,onClick:()=>I("skip",{kind:"skip"}),children:e.skip}),de]})]}),e.kind==="swatches"&&o.jsxs("div",{className:"sc-convo-look",children:[e.row.options.some(D=>D.card)?e.layout==="grid"?o.jsx(TX,{options:e.row.options,picked:V,onPick:D=>I(D,{kind:"swatches",picks:{[e.row.id]:D}})}):o.jsx(I3,{options:e.row.options,picked:V,onPick:D=>I(D,{kind:"swatches",picks:{[e.row.id]:D}})}):o.jsx("div",{className:"sc-convo-swatches",children:e.row.options.map(D=>o.jsx(xr,{label:D.label,children:o.jsx("button",{type:"button",className:D.color?"sc-convo-swatch":"sc-chip sc-convo-choice",style:D.color?{"--sc-swatch":D.color}:void 0,"aria-label":D.label,"aria-pressed":V===D.id,"data-on":V===D.id||void 0,onClick:()=>I(D.id,{kind:"swatches",picks:{[e.row.id]:D.id}}),children:D.color?null:D.label})},D.id))}),(e.skip||e.describe||de)&&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":A==="skip"||!A&&e.skipped,"data-on":A==="skip"||!A&&e.skipped||void 0,onClick:()=>I("skip",{kind:"skip"}),children:e.skip}),e.describe&&b&&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:b,children:e.describe}),de]})]}),e.kind==="photos"&&o.jsxs("div",{className:"sc-convo-photos-q",children:[o.jsx(Zj,{hashes:e.hashes,max:e.max,label:((ge=e.drop)==null?void 0:ge.label)??"Add a photo of their face",hint:((re=e.drop)==null?void 0:re.hint)??"Drop it here, or choose a file",busy:e.busy,onAdd:D=>g({kind:"photos",action:{type:"add",files:D}}),onRemove:D=>g({kind:"photos",action:{type:"remove",hash:D}}),onReject:()=>g({kind:"photos",action:{type:"reject"}})}),e.instead&&o.jsx("button",{type:"button",className:"sc-convo-other","data-on":A==="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:()=>I("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:D=>g({kind:"photos",action:{type:"attest",checked:D.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":!!Cg(e)||void 0,title:Cg(e)??void 0,"data-on":A==="submit"||void 0,onClick:()=>{Cg(e)||I("submit",{kind:"photos",action:{type:"submit"}})},children:e.submit}),e.back&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-on":A==="back"||void 0,onClick:()=>I("back",{kind:"photos",action:{type:"back"}}),children:e.back}),de]})]}),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:D=>g({kind:"pick",action:{type:"query",text:D.target.value}}),onKeyDown:D=>{var G;D.key!=="Escape"||!((G=e.search)!=null&&G.value)||(D.preventDefault(),g({kind:"pick",action:{type:"query",text:""}}))}}),o.jsxs("fieldset",{ref:ie,className:"sc-convo-pick-scroll","aria-labelledby":Y,"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},(D,G)=>o.jsx("span",{className:"sc-convo-plate sc-convo-pick-wait",children:o.jsx("span",{className:"sc-convo-plate-in"})},G))}),e.items.length>0&&o.jsx("div",{className:"sc-convo-grid sc-convo-pick-grid",children:e.items.map(D=>o.jsx("button",{type:"button",className:"sc-convo-plate","aria-label":D.alt,"aria-pressed":V===D.id,"data-on":V===D.id||void 0,onClick:()=>I(D.id,{kind:"pick",action:{type:"pick",id:D.id}}),children:o.jsx("span",{className:"sc-convo-plate-in",style:{backgroundImage:`url("${nn(D.hash,"small")}")`}})},D.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:B,className:"sc-convo-pick-end","aria-hidden":!0})]}),o.jsx("p",{className:"sc-vh",role:"status",children:e.loading?"":e.status??""}),(e.back||de)&&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":A==="back"||void 0,onClick:()=>I("back",{kind:"pick",action:{type:"back"}}),children:e.back}),de]})]}),e.kind==="confirm"&&e.quote&&o.jsx(YX,{text:e.quote,label:e.quoteLabel}),e.kind==="confirm"&&o.jsxs("div",{className:"sc-convo-decide sc-convo-ask","data-guide-shape":"",children:[e.options.map((D,G)=>o.jsx("button",{type:"button",className:`sc-btn ${G===0&&!e.quiet?"sc-btn-primary":"sc-btn-ghost"}`,"data-on":A===D.id||void 0,onClick:()=>I(D.id,{kind:"confirm",id:D.id}),children:D.label},D.id)),e.describe&&b&&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:b,children:e.describe}),ae,de]}),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 YX({text:e,label:t="The brief"}){const[n,r]=s.useState(!1);return s.useEffect(()=>{if(!n)return;const a=setTimeout(()=>r(!1),1600);return()=>clearTimeout(a)},[n]),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":n||void 0,onClick:()=>{var a;(a=navigator.clipboard)==null||a.writeText(e).then(()=>r(!0),()=>{})},children:[n?o.jsx(nr,{size:13,weight:"bold"}):o.jsx(L8,{size:13,weight:"bold"}),n?"Copied":"Copy"]})]}),o.jsx("p",{className:"sc-convo-brief-text",children:e})]})}function Cg(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 qX({text:e,photos:t,at:n,now:r,editable:a,editing:i,arrive:c,leave:d,delay:f=0,turnId:h,dim:p,onEdit:g,onSave:v,onCancel:y}){const[b]=s.useState(!!c),[x]=s.useState(f),k=p4(d,b?x:0,b?240:0);return o.jsxs("div",{className:"sc-convo-turn","data-guide-shape":"","data-who":"you","data-arrive":b||void 0,"data-leave":k,"data-turn":h,"data-dim":p||void 0,style:b?{"--sc-convo-start":`${x}ms`}:void 0,children:[n?o.jsx(IA,{at:n,now:r}):null,i&&v&&y?o.jsx(XX,{text:e,onSave:v,onCancel:y}):o.jsxs("div",{className:"sc-convo-bubble",children:[a&&g&&o.jsx(xr,{label:"Change this answer",children:o.jsx("button",{type:"button",className:"sc-convo-edit","aria-label":"Change this answer",onClick:g,children:o.jsx(q0,{size:13})})}),o.jsx("p",{children:e}),t&&t.length>0&&o.jsx("div",{className:"sc-convo-photos",children:t.map((S,E)=>o.jsx("img",{src:nn(S,"micro"),alt:`Yours, ${E+1} of ${t.length}`},S))})]})]})}function XX({text:e,onSave:t,onCancel:n}){const[r,a]=s.useState(e),i=s.useRef(null);s.useEffect(()=>{const d=i.current;d&&(d.focus(),d.setSelectionRange(d.value.length,d.value.length))},[]);const c=()=>{const d=r.trim();d&&t(d)};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(`
101
+ `).length)),value:r,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),n()),d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),c())}}),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:c,children:"Save"})]})]})}const QX=180,_3=3e3,ZA=460,JX="cubic-bezier(0.22, 1, 0.36, 1)",eQ=220,tQ=450,nQ=48;function rQ({turns:e,busy:t,working:n,memoryKey:r,resumed:a,onAnswer:i,onEdit:c,onSaveEdit:d,onCancelEdit:f,onStarter:h,onDescribe:p,onAttachFiles:g,onRestore:v,onRetry:y,onShow:b}){var Ae;const x=s.useRef(null),k=s.useRef(!0),S=s.useRef(!!a),E=s.useRef(performance.now());S.current&&performance.now()-E.current>_3&&(S.current=!1),s.useEffect(()=>{if(!S.current)return;const ue=()=>{S.current=!1},ke=window.setTimeout(ue,_3);return window.addEventListener("pointerdown",ue,{capture:!0}),window.addEventListener("keydown",ue,{capture:!0}),()=>{window.clearTimeout(ke),window.removeEventListener("pointerdown",ue,{capture:!0}),window.removeEventListener("keydown",ue,{capture:!0})}},[]);const C=bX(),N=s.useRef(e),M=s.useRef(null),T=s.useRef(null),L=s.useRef(null),A=s.useRef(null),P=s.useRef(null),$=s.useRef([]),[,H]=s.useState(0),O=s.useRef(new Map),Q=s.useRef(0),I=performance.now(),V=s.useRef(!1),ie=oQ(e);if(ie!==M.current){M.current=ie,V.current=!0;const ue=A.current&&I<A.current.until?A.current:null,ke=ue?V3(N.current,ue):N.current,qe=new Set(e.map(Qn)),Ve=z3(e),Xe=z3(ke),Re=Ie=>Ie.startsWith("you:")&&Ve.has(N1(Ie))||Ie.startsWith("q:")&&Xe.has(Ie)&&qe.has(N1(Ie));if($.current=ke.map(Qn).filter(Ie=>!qe.has(Ie)&&!Re(Ie)),Ve.size&&!Xe.size){const Ie=N1([...Ve][0]),st=ke.find(Ye=>Qn(Ye)===Ie);L.current=(st==null?void 0:st.kind)==="you"?{key:Ie,text:st.text}:null}if(Xe.size>0&&Ve.size===0){const Ie=L.current;L.current=null;const st=Ie?e.find(Qe=>Qn(Qe)===Ie.key):void 0,Ye=!!Ie&&((st==null?void 0:st.kind)!=="you"||st.text!==Ie.text),$e=e[e.length-1];T.current=Ye&&($e==null?void 0:$e.kind)==="question"?Qn($e):null}if(!C&&$.current.length){const Ie=$.current.some($e=>!(ue!=null&&ue.gone.has($e))),st=ue!=null&&ue.look&&$.current.includes(`q:${ue.look.qid}`)?ue.look:null,Ye=P.current??st;A.current={from:ke,gone:new Set($.current),look:Ye,until:Ie?I+(P.current?BX:QX):(ue==null?void 0:ue.until)??I}}else A.current=null;P.current=null,N.current=e}const B=A.current&&I<A.current.until?A.current:null;B||(A.current=null),s.useEffect(()=>{if(!B)return;const ue=window.setTimeout(()=>H(ke=>ke+1),Math.max(0,B.until-performance.now()));return()=>window.clearTimeout(ue)},[B]);const F=(ue,ke)=>{P.current={qid:ue,look:ke}},te=B?V3(e,B):e,X=s.useRef(null);if(X.current===null){const ue=r?cQ(r):null;X.current=ue??new Set(a||e.length>2?e.map(Qn):[])}const Z=s.useRef(null);Z.current===null&&(Z.current=(r?iQ(r):null)??new Map);const[K,z]=s.useState(()=>Date.now()),Y=Math.max(0,...Z.current.values()),J=K-Y<36e5;s.useEffect(()=>{if(!J)return;const ue=window.setInterval(()=>z(Date.now()),3e4);return()=>window.clearInterval(ue)},[J]),T.current&&(X.current.delete(T.current),T.current=null);const de=new Set;for(const ue of te){const ke=Qn(ue);ue.kind==="question"&&ue.question.reopened||X.current.has(ke)||de.add(ke)}if(a&&S.current&&de.size){for(const ue of de)X.current.add(ue);de.clear()}const ae=[];let W=Number.POSITIVE_INFINITY;{const ue=new Set(te.map(Qn));for(const ke of[...O.current.keys()])ue.has(ke)||O.current.delete(ke);for(const ke of te){const qe=Qn(ke);if(!de.has(qe)){ae.push(ke);continue}let Ve=O.current.get(qe);if(Ve===void 0){const Xe=ke.kind==="you"||ke.kind==="scenri"&&!!ke.quiet;Ve=Math.max(I,Xe?0:Q.current,(B==null?void 0:B.until)??0),O.current.set(qe,Ve),Q.current=Math.max(Q.current,Ve+(Xe?eQ:of+f4))}Ve<=I?ae.push(ke):W=Math.min(W,Ve-I)}}s.useEffect(()=>{if(W===Number.POSITIVE_INFINITY)return;const ue=window.setTimeout(()=>H(ke=>ke+1),W);return()=>window.clearTimeout(ue)},[W]),s.useEffect(()=>{const ue=X.current;if(ue){for(const ke of $.current)ue.delete(ke);for(const ke of ae){if(ke.kind==="question"&&ke.question.reopened)continue;const qe=Qn(ke);B!=null&&B.gone.has(qe)||ue.add(qe)}r&&uQ(r,ue),r&&Z.current&&lQ(r,Z.current)}});const ye=s.useRef(null),ee=s.useCallback(()=>{const ue=x.current;if(!ue)return null;const ke=ye.current;return ke!=null&&ke.isConnected&&ke.scrollHeight>ke.clientHeight?ke:(ye.current=rv(ue),ye.current)},[]);s.useEffect(()=>{const ue=()=>{const ke=ee();ke&&(k.current=ke.scrollHeight-ke.scrollTop-ke.clientHeight<24)};return document.addEventListener("scroll",ue,{passive:!0,capture:!0}),()=>document.removeEventListener("scroll",ue,{capture:!0})},[ee]);const ge=(()=>{const ue=e.find(qe=>qe.kind==="question"&&qe.question.reopened);if(ue)return Qn(ue);const ke=e.find(qe=>qe.kind==="you"&&qe.editing);return ke?Qn(ke):null})();s.useLayoutEffect(()=>{var qe;if(!k.current||ge)return;const ue=document.activeElement;if(ue instanceof HTMLInputElement&&ue.type==="search"&&((qe=x.current)!=null&&qe.contains(ue)))return;const ke=ee();ke&&(ke.scrollTop=ke.scrollHeight)});const re=s.useRef(null);s.useLayoutEffect(()=>{var Re,Ie,st,Ye;if(ge===re.current)return;const ue=re.current;re.current=ge;const ke=x.current;if(!ke)return;const qe=document.activeElement;if(!(!qe||qe===document.body||ke.contains(qe)))return;if(ge){if(k.current=!1,ge.startsWith("you:"))return;(Ie=(Re=$d(ke,ge))==null?void 0:Re.querySelector(".sc-convo-q"))==null||Ie.focus({preventScroll:!0});return}if(!ue)return;const Xe=ue.startsWith("q:")?N1(ue):ue;(Ye=(st=$d(ke,Xe))==null?void 0:st.querySelector(".sc-convo-edit"))==null||Ye.focus({preventScroll:!0})}),s.useEffect(()=>{if(!ge)return;const ue=window.setTimeout(()=>{const ke=$d(x.current,ge),qe=x.current&&rv(x.current);if(!ke||!qe)return;const Ve=ke.getBoundingClientRect(),Xe=qe.getBoundingClientRect();Ve.bottom-Xe.bottom>nQ&&Z3(ke,C)},ZA);return()=>window.clearTimeout(ue)},[ge,C]);const D=e.length&&e[e.length-1].kind==="question"?Qn(e[e.length-1]):null,G=s.useRef(D);s.useLayoutEffect(()=>{var Re,Ie;const ue=x.current;if(ge||!ue||D===G.current)return;const ke=document.activeElement,qe=(Re=ke==null?void 0:ke.closest(".sc-convo-turn"))==null?void 0:Re.getAttribute("data-turn"),Ve=!ke||ke===document.body||ke!==ue&&ke.contains(ue)||!!qe&&qe.startsWith("q:")&&qe!==D;if(!D||!Ve){G.current=D;return}const Xe=(Ie=$d(ue,D))==null?void 0:Ie.querySelector(".sc-convo-q:not([hidden])");Xe&&(G.current=D,Xe.focus({preventScroll:!0}))});const Pe=s.useRef(D),Ze=s.useRef(null);s.useEffect(()=>{if(D===Pe.current)return;if(!D){ge&&(Ze.current=Pe.current),Pe.current=null;return}const ue=$d(x.current,D);if(!ue)return;Pe.current=D;const ke=Ze.current!==null,qe=Ze.current===D;if(Ze.current=null,k.current||ke&&qe)return;const Ve=()=>{aQ(ue,x.current)||Z3(ue,C)};if(!ke){Ve();return}const Xe=window.setTimeout(Ve,tQ);return()=>window.clearTimeout(Xe)},[D,ge,C]);const He=s.useRef(new Map);s.useLayoutEffect(()=>{const ue=x.current;if(!ue)return;const ke=new Map,qe=V.current;V.current=!1;for(const Ve of ue.querySelectorAll(".sc-convo-turn")){const Xe=Ve.dataset.turn??"",Re=Ve.offsetTop;ke.set(Xe,Re);const Ie=He.current.get(Xe);!qe||C||Ie===void 0||Math.abs(Ie-Re)<1||sQ(Ve,Ie-Re)}He.current=ke});const tt=new Set;if(ge){tt.add(ge);const ue=ge.slice(ge.indexOf(":")+1);tt.add(`scenri:asked-${ue}`);const ke=ae.findIndex(qe=>Qn(qe)===ge);if(ke>=0){for(let qe=ke+1;qe<ae.length&&Eh(ae[qe]);qe++)tt.add(Qn(ae[qe]));for(let qe=ke-1;qe>=0&&Eh(ae[qe]);qe--)tt.add(Qn(ae[qe]))}}for(const ue of ae){const ke=Qn(ue);Z.current.has(ke)||Z.current.set(ke,Date.now())}let oe=!1;const he=[];for(const ue of ae){const ke=Qn(ue),qe=!!ge&&!tt.has(ke),Ve=Z.current.get(ke),Xe=!!(B!=null&&B.gone.has(ke)),Re=Xe&&ue.kind==="question"&&((Ae=B==null?void 0:B.look)==null?void 0:Ae.qid)===ue.question.id,Ie=ue.kind==="scenri"&&!!ue.quiet,st=!C&&!Xe&&de.has(ke)&&!Ie,Ye=0,$e=oe;Xe||(oe=ue.kind==="scenri"||ue.kind==="question"&&!ue.question.reopened),ue.kind==="you"?he.push(o.jsx(qX,{text:ue.text,photos:ue.photos,editable:ue.editable,editing:ue.editing,arrive:st,leave:Xe,delay:Ye,turnId:ke,dim:qe,at:Ve,now:K,onEdit:ue.editable&&c?()=>c(ue.id):void 0,onSave:d?Qe=>d(ue.id,Qe):void 0,onCancel:f},ke)):ue.kind==="scenri"?he.push(o.jsx(VX,{text:ue.text,tone:ue.tone,reveal:st,leave:Xe,eyebrow:!$e,delay:Ye,turnId:ke,dim:qe,at:Ve,now:K,thumb:ue.thumb,label:ue.label,current:ue.current,restore:ue.restore,onRestore:v,retry:ue.retry,onRetry:y,onShow:b},ke)):he.push(o.jsx(KX,{question:ue.question,reveal:st,leave:Xe&&!Re,spent:Xe,delay:Ye,turnId:ke,dim:qe,busy:t||qe,eyebrow:!$e,at:Ve,now:K,onAnswer:Qe=>i(ue.question.id,Qe),onPick:F,onStarter:h,onDescribe:p,onAttachFiles:g,onCancel:f},ke))}return o.jsx("div",{ref:x,className:"sc-convo-log",role:"log","aria-live":"polite","aria-relevant":"additions","data-changing":ge?"true":void 0,children:o.jsxs("div",{className:"sc-convo-turns",children:[he,n&&o.jsx(ZX,{what:n===!0?void 0:n})]})})}function V3(e,t){const n=[],r=new Set(e.map(Qn));let a=0;for(const i of t.from){const c=Qn(i);if(t.gone.has(c)){r.has(c)||n.push(i);continue}for(;a<e.length&&Qn(e[a])!==c;)n.push(e[a++]);a<e.length&&n.push(e[a++])}for(;a<e.length;)n.push(e[a++]);return n}function sQ(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:ZA,easing:JX,fill:"both"});r.id="slide",r.onfinish=()=>{e.style.transform="",r.cancel()}}function aQ(e,t){if(!t)return!1;const n=rv(t),r=e.getBoundingClientRect(),a=n.getBoundingClientRect();return r.top>=a.top&&r.top<=a.bottom-24}function Z3(e,t){var n;(n=e==null?void 0:e.scrollIntoView)==null||n.call(e,{block:"nearest",behavior:t?"auto":"smooth"})}function $d(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 oQ(e){const t=[];for(const n of e){const r=Qn(n);if(n.kind==="question"){const d=n.question,f="options"in d&&Array.isArray(d.options)?d.options.map(h=>h.id).join(","):"";t.push(`${r}~${d.reopened?1:0}~${d.prompt}~${d.hint??""}~${f}`);continue}const a="photos"in n&&Array.isArray(n.photos)?n.photos.length:0,i="thumb"in n?n.thumb??"":"",c="editing"in n&&n.editing?1:0;t.push(`${r}~${n.text??""}~${i}~${a}~${c}`)}return t.join("")}function z3(e){const t=new Set;for(const n of e)n.kind==="question"&&n.question.reopened&&t.add(Qn(n));return t}function N1(e){return e.startsWith("you:")?`q:${e.slice(4)}`:e.startsWith("q:")?`you:${e.slice(2)}`:""}function rv(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}const m4=e=>`scenri:convo-said:${e}`;function Ni(e){try{sessionStorage.removeItem(m4(e)),sessionStorage.removeItem(g4(e))}catch{}}const g4=e=>`scenri:convo-at:${e}`;function iQ(e){try{const t=sessionStorage.getItem(g4(e));return t?new Map(Object.entries(JSON.parse(t))):null}catch{return null}}function lQ(e,t){try{sessionStorage.setItem(g4(e),JSON.stringify(Object.fromEntries(t)))}catch{}}function cQ(e){try{const t=sessionStorage.getItem(m4(e));return t?new Set(JSON.parse(t)):null}catch{return null}}function uQ(e,t){try{sessionStorage.setItem(m4(e),JSON.stringify([...t]))}catch{}}function B3(e){return`${["No","One","Two","Three","Four","Five"][e]??String(e)} picture${e===1?"":"s"}`}function U3(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 Se={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=>`Tap one above, or describe the ${e} in your own words`,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?",agreeBlind:"Here is the place, in full. Nothing here can draw yet, so it is saved as words.",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.`,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.`,lost:"That work is gone: the server restarted while it ran. Try it again.",offline:"Lost touch with Scenri. Still trying.",retry:"Try again",version:e=>`Version ${e}`,saved:"Saved.",savedQuiet:"Saved. Nothing is drawn until you ask.",showInUse:(e,t)=>`Show it in use? ${B3(t.length)} with a Scenri demo ${e} in the place: ${U3(t.map(n=>n.toLowerCase()))}.`,staleSet:e=>`${B3(e)} here show${e===1?"s":""} the place as it was before. Draw ${e===1?"it":"them"} again?`,drawThem:"Draw them",drawThemAgain:"Draw them again",inUse:e=>`Saved. Now it is shown in use, with a Scenri demo ${e}. Shots are told the words, never handed these pictures.`,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]+$/,"")}.`,more:e=>`Add ${["no","one","two","three"][e.length]??e.length} more? ${U3(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:"Tap 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.",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."},dQ="part of the place itself, never a separate object that competes with the subject, and leaving the subject a clear place to stand",zA={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 v4(e,t){const n=e?zA[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 fQ(e){return Object.keys(zA).flatMap(t=>v4(t,e)??[])}const hQ=["water","stone","colour","citrus","volcanic","dark","plaster","linen"],lf=["world","surface","light","signature"],Qs=(e,t)=>`scene-${e}-${t}`,Zi={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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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:Qs("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"]}]}},pQ=new Set([...Zi.world.options.map(e=>e.card),...Zi.light.options.filter(e=>e.card).map(e=>e.card),...hQ.flatMap(e=>["surface","light","signature"].flatMap(t=>(v4(e,t)??[]).map(n=>n.card)))]);function mQ(e,t){return e==="world"?Zi.world.options:v4(t,e)??Zi[e].options}function gQ(e,t){const n=mQ(e,t),r=n.every(a=>!!a.card&&pQ.has(a.card));return{id:e,label:Zi[e].prompt,options:n.map(a=>({id:a.id,label:a.label,...r?{card:a.card}:{}}))}}const vQ={world:"place",surface:"surface",light:"light",signature:"idea"},W3=e=>vQ[e],to=(e,t)=>{if(!t)return;const n=Zi[e].options.find(r=>r.id===t);return n||e==="world"?n:fQ(e).find(r=>r.id===t)},yQ="one signature idea that makes this place unforgettable, invented for it and never generic";function wQ(e){const t=` ${e.toLowerCase().replace(/[^a-z0-9]+/g," ")} `,n={};for(const r of lf){let a=null;for(const i of Zi[r].options)for(const c of i.cues??[]){const d=` ${c.replace(/[^a-z0-9]+/g," ")} `;t.includes(d)&&(!a||c.length>a.len)&&(a={id:i.id,len:c.length})}a&&(n[r]=a.id)}return n}const bQ=["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"],sv=["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"],BA=["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"],UA=["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"],WA=["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"],GA=["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"],KA={world:[...bQ,...sv],surface:sv,light:UA,signature:BA,stage:WA,camera:GA},xQ=e=>` ${e.toLowerCase().replace(/[^a-z0-9é]+/g," ").trim()} `,kQ=(e,t)=>e.includes(` ${t.replace(/[^a-z0-9é]+/g," ")} `);function YA(e){const t=xQ(e),n=r=>r.some(a=>kQ(t,a));return{world:n(KA.world),surface:n(sv),light:n(UA),signature:n(BA),stage:n(WA),camera:n(GA)}}const SQ=e=>Object.keys(KA).filter(t=>e[t]);function EQ(e){const t=["world","surface","light"].filter(r=>!e[r]),n=SQ(e).length>=3?t.filter(r=>r==="world"):t.slice(0,2);return e.signature?n:[...n,"signature"]}const Fo="__passed",Gd=e=>{var t;return(t=e.source)==null?void 0:t.door},CQ=e=>{var t;return Gd(e)==="words"?EQ(YA(((t=e.source)==null?void 0:t.text)??"")):[]},_p=[{id:"source",applies:()=>!0},{id:"photos",applies:e=>Gd(e)==="photos"},{id:"shot",applies:e=>Gd(e)==="shot"},{id:"reuse",applies:e=>{var t;return Gd(e)==="shot"&&!!((t=e.shot)!=null&&t.scene)}},...lf.map(e=>({id:e,applies:t=>Gd(t)==="guided"||CQ(t).includes(e)}))],Y1=_p.map(e=>e.id),jh=e=>lf.includes(e),G3=e=>Y1.includes(e),jQ=e=>{var t;return!!e&&(!!e.pick||!!((t=e.words)!=null&&t.trim()))};function y4(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":jQ(t[e])}const AQ=e=>_p.filter(t=>t.applies(e)&&y4(t.id,e)).map(t=>t.id);function qA(e){var t;return((t=_p.find(n=>n.applies(e)&&!y4(n.id,e)))==null?void 0:t.id)??null}const XA=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:lf.some(c=>xi(c,e[c])!==null)},K3=e=>!!e.source&&qA(e)===null&&XA(e),av=(e,t)=>JSON.stringify(e)!==JSON.stringify(t);function w4(e,t){const n={...e},r=[];for(const[a,i]of Object.entries(t))av(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=>Y1.indexOf(i)));for(const i of Y1)Y1.indexOf(i)<=a||i in t||delete n[i]}for(const a of _p)n[a.id]!==void 0&&!a.applies(n)&&delete n[a.id];return n}function NQ(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(jh(e)){const i=(a=n[e])==null?void 0:a.words,c=t.kind==="swatches"?t.picks[e]??Object.values(t.picks)[0]:t.kind==="choice"?t.id:void 0;if(c)return{[e]:{pick:c,...i?{words:i}:{}}};if(t.kind==="skip")return{[e]:{pick:Fo,...i?{words:i}:{}}}}return null}function Y3(e){var t;return(e==null?void 0:e.pick)===Fo?[yQ,(t=e.words)==null?void 0:t.trim()].filter(Boolean).join(", "):xi("signature",e)}function xi(e,t){var a,i;if(!t)return null;const n=t.pick&&t.pick!==Fo?(a=to(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 q3=e=>e?`, ${dQ}`:"";function MQ(e){var c,d,f,h,p,g,v;if(((c=e.source)==null?void 0:c.door)==="words"){const y=(e.source.text??"").trim(),b=xi("world",e.world),x=xi("light",e.light)??(YA(y).light?null:((f=to("world",(d=e.world)==null?void 0:d.pick))==null?void 0:f.light)??null),k=Y3(e.signature),S=[b,xi("surface",e.surface),x,k].filter(Boolean);return S.length?`${y.replace(/[.\s]+$/,"")}, ${S.join(", ")}${q3(k)}.`:y}if(((h=e.source)==null?void 0:h.door)!=="guided")return"";const t=xi("world",e.world),n=xi("light",e.light)??((g=to("world",(p=e.world)==null?void 0:p.pick))==null?void 0:g.light)??null,r=Y3(e.signature),i=`${[t??"a place",xi("surface",e.surface),n,r].filter(Boolean).join(", ").replace(/^./,y=>y.toUpperCase())}${q3(r)}.`;return(v=e.world)!=null&&v.pick?`${i.slice(0,-1)}. ${Se.worldIsAStart}`:i}function RQ(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 PQ={answers:{},revision:0,editing:null,held:null,asides:[]};function LQ(e,t){var n;switch(t.type){case"answer":{const r=w4(e.answers,t.patch);return av(r,e.answers)?{...e,answers:r,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 r=[...new Set(t.hashes)].slice(0,4),a=e.editing==="photos";return{...e,answers:{...e.answers,photos:{hashes:r,done:a}},revision:e.revision+1}}case"edit":return y4(t.id,e.answers)?{...e,editing:t.id,held:e.answers}:e;case"cancel-edit":return!e.held||!av(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 TQ=e=>({answers:e.answers,revision:e.revision,asides:e.asides}),$Q=/^[a-f0-9]{32}$/,X3=/^[\w.:-]{1,80}$/;function DQ(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,400)}:{}});const a=t.answers.photos;a&&Array.isArray(a.hashes)&&(n.photos={hashes:a.hashes.filter(d=>typeof d=="string").slice(0,4),done:!!a.done});const i=t.answers.shot;if(i&&typeof i.id=="string"&&X3.test(i.id)&&typeof i.hash=="string"&&$Q.test(i.hash)){const d=i.scene,f=d&&typeof d.id=="string"&&X3.test(d.id)&&typeof d.name=="string"?{id:d.id,name:d.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 d of lf){const f=t.answers[d];if(!f||typeof f!="object")continue;const h=typeof f.pick=="string"&&(f.pick===Fo||to(d,f.pick))?f.pick:void 0,p=typeof f.words=="string"?f.words.slice(0,200):void 0;(h||p)&&(n[d]={...h?{pick:h}:{},...p?{words:p}:{}})}const c=Array.isArray(t.asides)?t.asides.filter(d=>d&&typeof d.said=="string"&&typeof d.reply=="string"&&typeof d.at=="string").map(d=>({said:d.said,reply:d.reply,at:d.at,q:typeof d.q=="string"?d.q:null})):[];return{answers:w4({},n),revision:Number(t.revision)||0,editing:null,held:null,asides:c}}const QA=4,JA=800,b4=60,eN={place:"",pictures:[],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 OQ(e){return{...eN,place:e.place,pictures:e.pictures,readRev:0,versions:[{reading:e.reading,hash:e.hash,coverage:[],how:"read"}],current:0,name:e.name,named:!0}}const Tr=e=>e.versions[e.current]??null,Q3=e=>e.versions.some(t=>!!t.hash);function HQ(e,t){return!t||e.job||e.inputsRev===0||e.readRev!==null&&e.readRev===e.inputsRev||e.readTried===e.inputsRev?null:e.inputsRev}const tN=e=>e.readRev!==null&&e.readRev!==e.inputsRev;function IQ(e,t){var n,r,a;switch(t.type){case"inputs":{const i=t.place.slice(0,JA),c=[...new Set(t.pictures)].slice(0,QA);return i===e.place&&c.join()===e.pictures.join()?e:{...e,place:i,pictures:c,inputsRev:e.inputsRev+1}}case"name":return{...e,name:t.text.slice(0,b4),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"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 J3({...e,job:i},i.pending)}case"finished":{if(!e.job||e.job.id!==t.job.id)return e;const i=e.job,c=t.job,d={...e,job:null};if(i.kind==="make"&&i.inputsRev!==e.inputsRev)return d;const f=c.reading??(i.kind==="again"?((n=Tr(e))==null?void 0:n.reading)??null:null),h=c.status==="failed"?c.error??Se.failed:null;if(c.status==="cancelled"){if(!f)return{...d,error:i.kind==="make"?Se.stoppedRead:Se.stopped};if(i.kind==="again"&&!c.hash)return{...d,error:Se.stoppedDraw}}const p=c.status==="cancelled"&&i.kind==="change"&&!c.hash;if(!f||i.kind==="again"&&!c.hash)return{...d,error:h};const g=i.kind==="make"?"read":i.kind==="change"?"change":e.versions.some(S=>S.hash)?"again":"draw",v={reading:f,hash:c.hash,ask:i.kind==="change"?i.ask:void 0,coverage:(r=c.coverage)!=null&&r.length?c.coverage:i.kind==="again"?((a=Tr(e))==null?void 0:a.coverage)??[]:[],how:g},y=Tr(e),b=i.kind==="make"&&!c.hash&&y&&!y.hash&&y.how==="read",x=b?e.versions.map((S,E)=>E===e.current?v:S):[...e.versions,v],k={...d,versions:x,current:b?e.current:x.length-1,readRev:i.kind==="make"?i.inputsRev:e.readRev,error:p?Se.stoppedChange:h};return J3(k,f)}case"lost":return!e.job||e.job.id!==t.id?e:{...e,job:null,error:t.error};case"put-back":return e.job||!e.versions[t.index]?e:{...e,current:t.index};case"forget-record":return e.job||!e.versions.length?e:{...e,versions:[],current:-1,error:null};case"edit-words":{const i=Tr(e);if(e.job||!i||!t.reading.prompt.trim()||JSON.stringify(t.reading)===JSON.stringify(i.reading))return e;const c=[...e.versions,{reading:t.reading,hash:i.hash,coverage:i.coverage,how:"edit"}];return{...e,versions:c,current:c.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}}}function J3(e,t){return e.named||!(t!=null&&t.name)?e:{...e,name:t.name.slice(0,b4)}}function FQ(e){var n;const t=e.job?e.job.phase==="drawing"?e.job.pending:null:((n=Tr(e))==null?void 0:n.reading)??null;return t?!e.job&&tN(e)?{can:!1,why:Se.stillReading,words:t}:e.name.trim()?{can:!0,why:null,words:t}:{can:!1,why:Se.nameIt,words:t}:{can:!1,why:e.job?Se.stillReading:null,words:null}}const jg=e=>e.job?e.job.phase==="changing"?Se.changing:e.job.phase==="drawing"?Se.drawing:e.pictures.length?Se.readingPhotos:Se.reading:void 0;function _Q(e){var r;const t=new Map;e.versions.forEach((a,i)=>{a.hash&&t.set(a.hash,i)});const n=((r=Tr(e))==null?void 0:r.hash)??null;return[...t.entries()].sort((a,i)=>a[1]-i[1]).map(([a],i)=>({n:i+1,hash:a,current:a===n}))}const VQ=(e,t)=>e.versions.slice(0,t+1).filter(n=>!!n.hash).length,ZQ=(e,t)=>e.versions.map(n=>n.hash).lastIndexOf(t);function zQ(e){const t=[{label:Se.placeLabel,text:e.prompt}];return e.lighting&&t.push({label:Se.lightLabel,text:e.lighting}),e.camera&&t.push({label:Se.cameraLabel,text:e.camera}),e.figure&&t.push({label:Se.figureLabel,text:e.figureTreatment?`${ek(e.figure)}, ${ek(e.figureTreatment)}.`:e.figure}),t}const ek=e=>e.replace(/[.\s]+$/,""),BQ=/\b(presenters?|models?|influencers?|celebrit(y|ies)|actors?|actress(es)?)\b/i,UQ=/\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,WQ=/\b(add|put|place|include|show|feature|with|holding|wearing|sitting|standing)\b/i,GQ=/\b(no|without|remove|removing|empty|nobody|none|take out|get rid of|less)\b/i,KQ=/^\s*(undo|go back|revert|back to|previous|the (first|last|previous|old|earlier) (one|version))\b/i,YQ=/^\s*(hi|hello|hey|thanks|thank you|ok|okay|cool|nice|great|good|wow|yes|no)\b[\s!.]*$/i,qQ=/^(?: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,nN=e=>{var t,n;return((n=(t=qQ.exec(e.trim()))==null?void 0:t[1])==null?void 0:n.trim())||null};function XQ(e){const t=e.trim(),n=nN(t);return n?{kind:"rename",name:n}:KQ.test(t)?{kind:"navigate",say:Se.usePutBack}:YQ.test(t)||/\?\s*$/.test(t)&&!/\b(make|can you|could you|try)\b/i.test(t)?{kind:"chatter",say:Se.sayAChange}:(BQ.test(t)||UQ.test(t))&&WQ.test(t)&&!GQ.test(t)?{kind:"refuse",say:Se.notInAScene}:{kind:"change"}}const QQ=(e,t)=>{var n;return!!((n=Tr(e))!=null&&n.ask)&&Tr(e).ask.trim().toLowerCase()===t.trim().toLowerCase()},rN=e=>!e.saved&&(e.versions.length>0||!!e.job||!!e.error),JQ=(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),sN=1;function eJ(e){return JSON.stringify({v:sN,...e})}function tJ(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||t.v!==sN)return null;const n=d=>Array.isArray(d)?d.filter(f=>typeof f=="string"):[],r=d=>!!d&&typeof d.prompt=="string"&&typeof d.name=="string",a=Array.isArray(t.versions)?t.versions.filter(d=>d&&r(d.reading)).map(d=>({reading:d.reading,hash:typeof d.hash=="string"?d.hash:null,ask:typeof d.ask=="string"?d.ask:void 0,coverage:n(d.coverage),how:["read","draw","again","change","edit"].includes(d.how)?d.how:d.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,c=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,JA):"",pictures:n(t.pictures).slice(0,QA),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:c,name:typeof t.name=="string"?t.name.slice(0,b4):"",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 nJ(e){if(!e||e.loading)return"";const t=e.items.length;return t?Se.shotCount(t,e.more):e.error?Se.shotsFailed:e.query.trim()?Se.shotNotFound(e.query.trim()):Se.shotNone}function tk(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 rJ(e){return zQ(e).map(t=>t.label===Se.placeLabel?t.text:`${t.label}: ${t.text.replace(/[.\s]+$/,"")}.`).join(" ")}const sJ=new Set([Se.stopped,Se.stoppedRead,Se.stoppedDraw,Se.stoppedChange,Se.lost]),nk=e=>sJ.has(e)?e:Se.failedFirst(e.replace(/[.\s]+$/,""));function rk(e,t,n,r,a){var b,x,k,S,E,C,N,M,T,L,A,P,$,H;const i=t.answers,c=n?{reopened:!0}:{};if(e==="source")return{id:e,kind:"choice",prompt:Se.source,options:[{id:"photos",label:Se.addPictures},{id:"guided",label:Se.guideMe}],given:((b=i.source)==null?void 0:b.door)==="words"?void 0:((x=i.source)==null?void 0:x.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,...c};if(e==="photos")return{id:e,kind:"photos",prompt:Se.photos,hashes:((E=i.photos)==null?void 0:E.hashes)??[],max:4,busy:r>0,submit:Se.readThem,back:Se.guideInstead,drop:Se.photosDrop,...c,...a&&a.any!==!1&&!((C=i.photos)!=null&&C.hashes.length)&&r===0&&!n?{instead:Se.fromShot,...a.any===null?{insteadWaiting:!0}:{}}:{}};if(e==="shot"){const O=(a==null?void 0:a.query.trim())??"";return{id:e,kind:"pick",prompt:Se.shot,items:(a==null?void 0:a.items)??[],given:(N=i.shot)==null?void 0:N.id,search:{label:Se.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?Se.shotsFailed:O?Se.shotNotFound(O):Se.shotNone,status:nJ(a),back:n?void 0:Se.backToPictures,...c}}if(e==="reuse"){const O=((T=(M=i.shot)==null?void 0:M.scene)==null?void 0:T.name)??"";return{id:e,kind:"choice",prompt:Se.madeIn(O),options:[{id:"use",label:Se.takeScene(O)},{id:"read",label:Se.readNew}],given:i.reuse,...c}}const d=i[e],f=e==="light"?(A=to("world",(L=i.world)==null?void 0:L.pick))==null?void 0:A.light:void 0,h=e==="surface"&&!!to("world",(P=i.world)==null?void 0:P.pick),p=(d==null?void 0:d.pick)===Fo||d==null?void 0:d.pick,g=(d==null?void 0:d.pick)===Fo,v=d==null?void 0:d.words,y=(($=i.source)==null?void 0:$.door)==="words";return{id:e,kind:"swatches",prompt:aN(e,i),row:gQ(e,(H=i.world)==null?void 0:H.pick),layout:e==="world"?"grid":void 0,hint:e==="world"&&!y?Se.worldHint:void 0,skip:f?Se.keepWorldLight:h?Se.keepWorldSurface:e==="signature"&&!y?Se.suggestOne:y?Se.leaveToReading:Se.skip,describe:Se.describeInstead,given:p,skipped:g,note:v,...c}}function aN(e,t){var r,a,i;const n=e==="light"?(a=to("world",(r=t.world)==null?void 0:r.pick))==null?void 0:a.light:void 0;if(n)return Se.worldLightPrompt(n);if(((i=t.source)==null?void 0:i.door)==="words"){if(e==="world")return Se.followWorld;if(e==="light")return Se.followLight}return Zi[e].prompt}function aJ(e,t){var n,r;return e==="source"?Se.source:e==="photos"?Se.photos:e==="shot"?Se.shot:e==="reuse"?Se.madeIn(((r=(n=t.shot)==null?void 0:n.scene)==null?void 0:r.name)??""):aN(e,t)}function oJ(e,t){var f,h,p,g,v,y,b,x,k,S,E;if(e==="source")return((f=t.source)==null?void 0:f.door)==="words"?{text:t.source.text??""}:((h=t.source)==null?void 0:h.door)==="shot"?{text:Se.fromShotAnswer}:{text:((p=t.source)==null?void 0:p.door)==="photos"?Se.addPictures:Se.guideMe};if(e==="shot")return{text:Se.shotAnswer,photos:t.shot?[t.shot.hash]:[]};if(e==="reuse")return{text:Se.readNew};if(e==="photos"){const C=((g=t.photos)==null?void 0:g.hashes.length)??0;return{text:`${C} ${C===1?"picture":"pictures"}`,photos:(v=t.photos)==null?void 0:v.hashes}}const n=t[e],r=e==="light"&&(n==null?void 0:n.pick)===Fo&&((b=to("world",(y=t.world)==null?void 0:y.pick))==null?void 0:b.light),a=e==="surface"&&(n==null?void 0:n.pick)===Fo&&!!to("world",(x=t.world)==null?void 0:x.pick),i=r?Se.keepWorldLight:a?Se.keepWorldSurface:((k=t.source)==null?void 0:k.door)==="words"?Se.leaveToReading:e==="signature"?Se.suggestOne:Se.skip,c=(n==null?void 0:n.pick)===Fo?i:(S=to(e,n==null?void 0:n.pick))==null?void 0:S.label,d=(E=n==null?void 0:n.words)==null?void 0:E.trim();return{text:c&&d?`${c}, ${d}`:d??c??""}}const sk=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,iJ=e=>{const t=Tr(e);return t?`${t.hash?"decide":"agree"}-${e.current}`:null};function lJ(e){var v,y,b,x;const{setup:t,studio:n,edit:r}=e,a=t.answers,i=[],c=new Set,d=k=>{for(const S of t.asides.filter(E=>E.q===k&&!c.has(E)).sort(sk))c.add(S),i.push(...Wo(S))};r?i.push({kind:"scenri",id:"edit-open",text:Se.editOpen(r.name)}):i.push({kind:"you",id:"intent",text:Se.intent});const f=r?null:qA(a);if(!r)for(const k of AQ(a)){if(i.push({kind:"scenri",id:`asked-${k}`,text:aJ(k,a),quiet:!0}),d(k),t.editing===k){i.push({kind:"question",question:rk(k,t,!0,e.uploading,e.shots)});continue}const S=oJ(k,a);i.push({kind:"you",id:k,text:S.text,photos:S.photos,editable:!n.job&&!n.saved})}const h=n.versions.findIndex(k=>!!k.hash);n.versions.forEach((k,S)=>{if(k.how==="read"&&S>0&&i.push({kind:"scenri",id:`reread-${S}`,text:Se.readAgain}),k.how==="change"&&i.push({kind:"you",id:`ask-${S}`,text:k.ask??""}),k.hash&&(k.how==="draw"&&i.push({kind:"you",id:`draw-${S}`,text:Se.draw}),k.how==="again"&&i.push({kind:"you",id:`again-${S}`,text:Se.tryAgain}),S===h&&!r&&ak(i,e),i.push({kind:"scenri",id:`pic-${S}`,text:k.how==="change"?Se.changed:k.how==="again"?Se.again:Se.here,thumb:k.hash,label:Se.version(VQ(n,S)),view:"scene",current:S===n.current,restore:S===n.current||n.saved?void 0:{view:"scene",hash:k.hash}})),S===n.current)for(const[E,C]of k.coverage.entries())i.push({kind:"scenri",id:`cover-${S}-${E}`,text:C});d(`agree-${S}`),d(`decide-${S}`)});const p=n.job;(p==null?void 0:p.kind)==="again"&&i.push({kind:"you",id:`pending-${p.id}`,text:h<0?Se.draw:Se.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&&ak(i,e),n.saved&&cJ(i,e);let g=null;if(f)g=rk(f,t,!1,e.uploading,e.shots);else if(p){if(p.kind==="again"&&h<0&&!n.named&&!e.editingName){const k=((y=p.pending??((v=Tr(n))==null?void 0:v.reading))==null?void 0:y.name)??n.name;g={id:"name",kind:"text",prompt:Se.name,starters:k?[{label:k,text:k}]:void 0}}}else if(n.saved)g=uJ(e);else{const k=Tr(n);if(e.stale&&!r)n.error&&(g={id:"retry",kind:"confirm",tone:"alert",prompt:nk(n.error),options:[{id:"retry",label:Se.retry}]});else if(!k&&n.error)g={id:"retry",kind:"confirm",tone:"alert",prompt:nk(n.error),options:[{id:"retry",label:Se.retry}]};else if(k){n.error&&i.push({kind:"scenri",id:`error-${n.versions.length}`,text:n.error,tone:"alert"});const S=rJ(k.reading);if(k.hash)g={id:`decide-${n.current}`,kind:"confirm",prompt:(r?Se.decideEdit:Se.decide)(n.name.trim()||k.reading.name),quote:S,quoteLabel:Se.readingHead,options:[{id:"use",label:r?Se.saveChanges:Se.use},...e.canDraw?[{id:"again",label:Se.tryAgain}]:[]],describe:Se.changeSomething};else{const E=!r&&((b=a.source)==null?void 0:b.door)==="photos",C=!r&&((x=a.source)==null?void 0:x.door)==="shot",N=C?[{id:"another-shot",label:Se.anotherShot}]:[];g={id:`agree-${n.current}`,kind:"confirm",prompt:e.canDraw?k.how==="change"?Se.agreeChanged:E?Se.agreePhotos:C?Se.agreeShot:Se.agree:Se.agreeBlind,quote:S,quoteLabel:Se.readingHead,options:[...e.canDraw?[{id:"draw",label:Se.draw}]:[{id:"use",label:r?Se.saveChanges:Se.saveWords}],...N]}}}}for(const k of t.asides.filter(S=>!c.has(S)).sort(sk))i.push(...Wo(k));return e.note&&i.push({kind:"scenri",id:`note-${e.note.length}-${e.note.slice(0,12)}`,text:e.note}),g&&i.push({kind:"question",question:g}),i}function cJ(e,t){const{studio:n,edit:r,set:a,canDraw:i}=t;if(e.push({kind:"you",id:"use",text:r?Se.saveChanges:i?Se.use:Se.saveWords}),!a)return;const c=a.tiles.length>0||a.running;e.push({kind:"scenri",id:"saved",text:c?Se.inUse(a.who):a.read&&a.noSubject&&i?Se.noLibrary:a.read&&i&&a.first.length?Se.savedQuiet:Se.saved}),(n.setDrawn||n.setDeclined)&&e.push({kind:"you",id:"set-start",text:n.setDrawn?a.stale?Se.drawThemAgain:Se.drawThem:Se.notNow});const d=n.moreAsked?Se.addThem:n.moreDeclined?Se.notNow:null;let f=!1;const h=()=>{!d||f||(f=!0,e.push({kind:"you",id:"more",text:d}))};for(const p of a.tiles)p.role!=="hero"&&p.role!=="close"&&h(),p.state==="shown"&&p.hash?e.push({kind:"scenri",id:`ex-${p.role}-${p.hash}`,text:Se.exampleHere[p.role],thumb:p.hash,label:Bl[p.role],view:p.role,...a.running||n.job?{}:{retry:p.role}}):p.state==="failed"&&e.push({kind:"scenri",id:`ex-failed-${p.role}`,text:Se.exampleFailed(Bl[p.role],p.error??Se.failed),tone:"alert"});h()}function uJ(e){var c;const{set:t,studio:n}=e,r=n.name.trim()||((c=Tr(n))==null?void 0:c.reading.name)||"The scene";if(!t||t.running||!t.read)return null;if(e.canDraw&&t.first.length&&!n.setDrawn&&!n.setDeclined)return{id:"set-start",kind:"confirm",prompt:t.stale?Se.staleSet(t.first.length):Se.showInUse(t.who,t.first.map(d=>Bl[d])),options:[{id:"draw-set",label:t.stale?Se.drawThemAgain:Se.drawThem},{id:"not-now",label:Se.notNow}]};const a=t.tiles.some(d=>d.role==="hero"&&d.state==="shown");if(e.canDraw&&a&&t.missing.length&&!n.moreDeclined&&!n.moreAsked)return{id:"set-more",kind:"confirm",prompt:Se.more(t.missing.map(d=>Bl[d])),options:[{id:"more",label:Se.addThem},{id:"not-now",label:Se.notNow}]};const i=t.tiles.filter(d=>d.state==="failed");return{id:"set-done",kind:"confirm",prompt:i.length?Se.readyMissing(r):t.tiles.length?Se.ready(r):Se.readyUndrawn(r),options:[...i.length&&e.canDraw?[{id:"retry-failed",label:Se.tryAgain}]:[],{id:"done",label:t.finish}]}}function ak(e,t){if(!t.studio.named&&!t.editingName)return;e.push({kind:"scenri",id:"asked-name",text:Se.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 dJ(e,t){var c,d,f;const{setup:n,studio:r}=e,a=(h,p=!1)=>({target:{kind:"off",why:h},placeholder:"",label:Se.lineLabel,action:Se.send,working:p,attach:!1});if(r.saved)return a("",!!r.job||!!((c=e.set)!=null&&c.running));const i=n.editing;return i==="source"?ko({kind:"source"},Se.sourcePlaceholder,!0):i&&jh(i)?ko({kind:"row",id:i},Se.rowPlaceholder(W3(i))):i==="photos"?a(Se.photosOff):i==="shot"?a(Se.shotOff):i==="reuse"?a(Se.reuseOff):!t&&!r.job&&n.answers.source&&!XA(n.answers)?ko({kind:"source"},Se.nothingSaidPlaceholder,!0):t?t.id==="source"?ko({kind:"source"},Se.sourcePlaceholder,!0):t.id==="photos"?{...a(Se.photosOff),attach:!0}:t.id==="shot"?a(Se.shotOff):t.id==="reuse"?a(Se.reuseOff):jh(t.id)?ko({kind:"row",id:t.id},Se.rowPlaceholder(W3(t.id))):t.id==="name"?ko({kind:"name"},Se.namePlaceholder):t.id==="retry"?ko({kind:"source"},Se.nothingSaidPlaceholder,!0):t.id.startsWith("agree-")?e.canDraw?ko({kind:"add"},e.edit?Se.addPlaceholder:((d=n.answers.source)==null?void 0:d.door)==="photos"?Se.keepPlaceholder:((f=n.answers.source)==null?void 0:f.door)==="shot"?Se.keepShotPlaceholder:Se.addPlaceholder):a(""):t.id.startsWith("decide-")?{...ko({kind:"change"},Se.changePlaceholder),action:Se.change}:a(""):r.job?a("",!0):a("")}function ko(e,t,n=!1){return{target:e,placeholder:t,label:t,action:Se.send,working:!1,attach:n}}const fJ=/\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,oN=e=>fJ.test(e)||e.trim().split(/\s+/).length>=5&&!/\?\s*$/.test(e);function ok(e,t){switch(e){case"greeting":case"ack":return t==="source"?Se.greet:Se.greetRow;case"question":case"help":return Se.askHelp;case"nav":return Se.startOverIsUp;case"go":return t==="source"?Se.goFirst:Se.greetRow;default:return Se.notAPlace}}function ik(e,t){if(t==="source"){const r=Po(e,oN);return r==="vague"?null:r}const n=Po(e,()=>!1);return n==="vague"||n==="intent"||n==="likeness"?null:n}const iN=2;function hJ(e,t){return JSON.stringify({v:iN,setup:TQ(e),studio:eJ(t)})}function lN(e){if(!e)return null;try{const t=JSON.parse(e);return(t==null?void 0:t.v)!==iN?null:{setup:DQ(t.setup),studio:tJ(typeof t.studio=="string"?t.studio:null)}}catch{return null}}const cN=e=>`scenri:scene-studio:${e}:`;function pJ(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=lN(typeof(n==null?void 0:n.session)=="string"?n.session:null),a=r==null?void 0:r.studio;if(!a||!rN(a))return null;const i=[a.versions[a.current],...[...a.versions].reverse()].find(g=>g==null?void 0:g.hash),c=Tr(a),d=a.place.trim().split(/\s+/).slice(0,5).join(" ");return{convo:e,name:a.name.trim()||(c==null?void 0:c.reading.name)||((h=(f=a.job)==null?void 0:f.pending)==null?void 0:h.name)||d,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 mJ(e,t){const n=new Map(t.filter(i=>i.kind==="scene").map(i=>[i.id.slice(6),i])),r=e.map(i=>{const c=i.jobId?n.get(i.jobId):void 0;return c?i.drawing?{...i,name:i.name||c.name,hash:c.status==="done"&&c.thumb?c.thumb:i.hash,drawing:c.status==="running",failed:c.status==="failed"}:i:{...i,drawing:!1}}),a=new Set(e.map(i=>i.convo));for(const i of t)i.kind!=="scene"||i.status!=="running"||!i.conversation||i.sceneId||a.has(i.conversation)||(a.add(i.conversation),r.push({convo:i.conversation,name:i.name,hash:null,drawing:!0,failed:!1,read:!1,jobId:i.id.slice(6),at:Date.parse(i.startedAt)||0}));return r.filter(i=>i.drawing||i.hash||i.failed||i.read).sort((i,c)=>c.at-i.at)}function gJ(e){return e.drawing?"Drawing":e.failed?"Did not finish":e.hash?"Drawn, not used yet":"Not drawn yet"}function q1(e){const t=cN(e);return ns.keys(t).map(n=>pJ(n.slice(t.length),ns.get(n))).filter(n=>!!n)}function vJ(e,t){const n=`${cN(e)}${t}`;ns.del(n),Ni(n)}function yJ(e,t,n,r){const a=cq(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 uN(){const{brand:e,recent:t,products:n}=Qt(),r=Dn(),a=Xi(),i=!!tn(it.hub),c=!!tn(it.hubShot),d=!!tn(it.products),f=!!tn(it.scenes),h=!!tn(it.presenters),p=!!tn(it.presenterStudio),g=!!tn(it.sceneStudio);return s.useCallback(async v=>{var C,N;const y=t.find(M=>M.kind!=="root"&&M.status==="done"&&M.images.length>0),b=v==="refine"&&!y?"first-shot":v==="reuse"&&n.length===0?"product":v,x=W1().active;(x==null?void 0:x.task)===b&&x.brandId===e.id&&!x.paused||await Sl({start:{task:b,brandId:e.id}});const k=((N=(C=W1().progress)==null?void 0:C[b])==null?void 0:N.reached)??[],S=W1().activeDraftId,E=yJ(b,{onHub:i,onShot:c,onProducts:d,onScenes:f,onPresenters:h,onStudio:p,onSceneStudio:g},k,S);switch(E.kind!=="head"&&H8(),E.kind){case"stay":try{window.localStorage.removeItem(O8(e.id,b)),(b==="first-shot"||b==="reuse")&&window.localStorage.removeItem(WC(e.id))}catch{}return(b==="first-shot"||b==="reuse")&&i?r(hr(e)):void 0;case"head":return GC(e.id,b);case"hub":return r(hr(e));case"products":return r(hu(e));case"scenes":return r(Mu(e));case"presenters":return r(Vi(e));case"studio":return r(Ti(e,S));case"sceneStudio":{const M=q1(e.id).sort((T,L)=>L.at-T.at)[0];return r(Li(e,(M==null?void 0:M.convo)??null))}case"dialog":return a(E.asset)}},[e,t,n,r,a,i,c,d,f,h,p,g])}const wJ=Number(window.localStorage.getItem("scenri:welcome-settle-ms")??900),bJ='[role="dialog"]:not(.sc-coach):not(.sc-attachpanel):not(.sc-swap), [role="alertdialog"], .sc-lightbox',xJ=["settings","setup","new","whatsnew","learn","welcome"],kJ='[data-guide="compose"] .sc-attachpanel';function SJ(){var We,Ke,Ue,Be,ot,rt,me;const e=I6(),t=xA(),n=jn(),{brand:r,recent:a,subscribeActivity:i,products:c,importing:d}=Qt(),{tasks:f,builds:h}=Oa(),{push:p}=Sr(),g=uN(),v=Dn(),[y]=Bi(),b=ws("new"),x=!!tn(it.brand),k=!!tn(it.hub),S=((We=tn(it.hubShot))==null?void 0:We.params.shotId)??null,E=!!tn(it.presenterStudio),C=!!tn(it.sceneStudio),N=!!tn(it.products),M=!!tn(it.scenes),T=!!tn(it.presenters),L=e.active,A=L&&L.brandId===r.id?L.task:null,P=A&&!(L!=null&&L.paused)?A:null,$=P==="first-shot"||P==="reuse"?"generation":P==="refine"?"edit":null,H=e.loaded&&e.eligible&&e.welcome===null,[O,Q]=s.useState(e.activeNodes);s.useEffect(()=>Q(e.activeNodes),[e.activeNodes]),s.useEffect(()=>{if(!(!$||!L))return i(q=>Q(Te=>EK(Te,q,L.since,$)))},[$,L,i]);const I=!!((Ke=t.composer)!=null&&Ke.busy),V=s.useRef(!1),[ie,B]=s.useState(!1);s.useEffect(()=>{V.current&&!I&&$&&(B(!0),sg().finally(()=>B(!1))),V.current=I},[I,$]);const[,F]=s.useState(0),te=s.useRef(0),X=s.useCallback(()=>{cancelAnimationFrame(te.current),te.current=requestAnimationFrame(()=>F(q=>q+1))},[]);s.useEffect(()=>{if(!P&&!H)return;const q=new MutationObserver(X);return q.observe(document.body,{childList:!0,subtree:H}),window.addEventListener("resize",X),()=>{cancelAnimationFrame(te.current),q.disconnect(),window.removeEventListener("resize",X)}},[P,H,X]);const[Z,K]=s.useState(()=>!document.hidden);s.useEffect(()=>{const q=()=>K(!document.hidden);return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[]);const z=!!P||H,Y=xJ.some(q=>y.has(q)),J=z&&(Y||[...document.querySelectorAll(bJ)].some(q=>!q.closest("[data-radix-popper-content-wrapper], .sc-shotsheet"))),de=y.get("new"),ae=P?`scenri:guide-begun:${r.id}:${P}`:null,[W,ye]=s.useState(!1);s.useEffect(()=>{ye(!!ae&&window.localStorage.getItem(ae)==="1")},[ae]);const ee=s.useCallback(()=>{if(ae)try{window.localStorage.setItem(ae,"1")}catch{}ye(!0)},[ae]),ge=e.heading,re=q=>!!q&&(ge==null?void 0:ge.brandId)===r.id&&ge.task===q&&!J,D=q=>q==="first-shot"||q==="reuse"||q==="refine"?k:q==="product"?N:q==="scene"?M:q==="presenter"?T||E:!1,[G,Pe]=s.useState(!1);s.useEffect(()=>{let q=!1;try{q=!!P&&window.localStorage.getItem(O8(r.id,P))==="1"}catch{}Pe(q)},[P,r.id,ge]),s.useEffect(()=>{if(!(!ge||ge.brandId!==r.id)&&D(ge.task)){try{window.localStorage.setItem(O8(r.id,ge.task),"1")}catch{}Pe(!0),(ge.task==="first-shot"||ge.task==="reuse")&&ee(),H8()}},[ge,k,N,M,T,E,r.id,ee]);const Ze=s.useRef(null);s.useEffect(()=>{const q=Ze.current;!q||D(q)||(Ze.current=null,GC(r.id,q))},[k,N,M,T,E,r.id]),s.useEffect(()=>{e.loaded&&!A&&ge&&H8()},[e.loaded,A,ge]);let He=null;if(P==="first-shot"||P==="reuse"){const q=((Ue=t.composer)==null?void 0:Ue.brandId)===r.id?t.composer:null,Te=k&&re(P),je={here:k&&!J,heading:re(P)&&!k,composer:q&&ie?{...q,busy:!0}:q,nodes:O,begun:W||Te||O.length>0};He=P==="reuse"?qj(je):Yj(je)}else if(P==="refine"){const q=((Be=t.composer)==null?void 0:Be.brandId)===r.id?t.composer:null,Te=!!S;He=mK({here:Te||k&&!J,heading:re(P)&&!k&&!Te,open:Te,armed:k&&!!(q!=null&&q.refining),nodes:O,asking:Te?!!bl(Qj):!!bl(vh)})}else P==="presenter"?He=Jj({heading:re(P)&&!T&&!E,onPage:T&&!E&&!J,studio:E?t.studio:null}):P==="scene"?He=vK({heading:re(P)&&!M&&!C,onPage:M&&!C&&!J,studio:C?t.studio:null}):P==="product"&&(He=yK({heading:re(P)&&!N,onPage:N&&!J&&de!=="product",dialogOpen:de==="product"}));const tt=((ot=t.composer)==null?void 0:ot.brandId)===r.id?t.composer:null,oe=P==="first-shot"&&tt?Xj(tt):P==="reuse"&&tt?tt.products===0?"product":tt.scene?null:"scene":null,he=!!((rt=t.composer)!=null&&rt.pickerOpen);s.useEffect(()=>{he&&(P==="first-shot"&&!oe?window.dispatchEvent(new Event("scenri:guide-close-picker")):oe&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:Gx[oe]}})))},[P,he,oe]),s.useEffect(()=>{P==="first-shot"&&!oe&&window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:null}}))},[P,oe]),s.useEffect(()=>{if(P)return document.documentElement.dataset.guideTask=P,()=>{delete document.documentElement.dataset.guideTask}},[P]);const Ae=(He==null?void 0:He.point)===kJ&&window.innerWidth<1024;s.useEffect(()=>{if(Ae)return document.documentElement.dataset.guidePicker="",()=>{delete document.documentElement.dataset.guidePicker}},[Ae]);const ue=(He==null?void 0:He.point)===n4;if(s.useEffect(()=>{if(ue)return document.documentElement.dataset.guideNew="",()=>{delete document.documentElement.dataset.guideNew}},[ue]),P&&He&&He.voice!=="quiet"){const q=uq(P,He.id);q&&(He={...He,...q})}const ke=P&&He&&He.voice!=="quiet"?He.id:null,qe=s.useRef("");s.useEffect(()=>{var Te,je;if(!P||!ke)return;const q=`${P}:${ke}`;qe.current!==q&&(qe.current=q,!((je=(Te=e.progress)==null?void 0:Te[P])!=null&&je.reached.includes(ke))&&Sl({reached:{task:P,moment:ke}}))},[P,ke,e.progress]);const Ve=He,Xe=s.useRef(new Set),Re=s.useCallback(q=>{Xe.current.add(q),Sl({finish:q})},[]),Ie=s.useCallback(q=>{Sl({dismiss:q}),p({kind:"info",title:"Guide closed",detail:"Continue it any time from Learn."})},[p]);s.useEffect(()=>{P==="first-shot"&&S&&O.some(q=>q.id===S&&q.status==="done"&&q.images>0)&&Re("first-shot")},[P,S,O,Re]),s.useEffect(()=>{P==="refine"&&S&&sg()},[P,S]);const st=s.useRef(!1);s.useEffect(()=>{if(P!=="refine"){st.current=!1;return}S?st.current=!0:st.current&&(st.current=!1,Re("refine"))},[P,S,Re]);const Ye=A==="presenter"||A==="scene"||A==="product",$e=h.filter(q=>!q.finished).length;s.useEffect(()=>{Ye&&sg()},[Ye,r,c.length,$e,d]),s.useEffect(()=>{Ye&&e.counts&&bK(e,e.counts)&&Re(L==null?void 0:L.task)},[Ye,e,L,Re]);const Qe=!!((me=t.overlay)!=null&&me.engaged);s.useEffect(()=>{if(!e.loaded||!e.eligible)return;const q={eligible:e.eligible,hidden:e.hidden,done:e.done,dismissed:e.dismissed,active:L},je=!!S&&Qe&&a.some(gt=>gt.id===S&&gt.status==="done")&&S1("refine",q)?"refine":C&&S1("scene",q)?"scene":de==="product"&&S1("product",q)?"product":E&&S1("presenter",q)?"presenter":null;!je||Xe.current.has(je)||(Xe.current.add(je),Sl({start:{task:je,brandId:r.id}}))},[e,L,S,Qe,a,de,E,C,r.id]);const[Fe,yt]=s.useState(""),ht=s.useRef(Ve);ht.current=Ve;const yn=s.useCallback((q,Te)=>{if(yt(""),Te)return;const je=ht.current,gt=je?[je.title,je.body].filter(Boolean).join(". "):"";gt&&requestAnimationFrame(()=>yt(gt))},[]),[Oe,wt]=s.useState(!1),pt=ws("welcome"),Nt=pt.value!==null,Ct=x&&n.showcaseLoaded||k,$t=h.some(q=>!q.finished)||f.some(q=>q.state==="running"&&q.kind!=="catalog"),Yt=kK({onMainPage:x||k,eligible:e.eligible,welcome:e.welcome,ready:Ct&&!document.querySelector('[data-variant="skeleton"]'),visible:Z,blocked:J,busy:$t});s.useEffect(()=>{if(!Yt)return;const q=window.setTimeout(()=>wt(!0),wJ);return()=>window.clearTimeout(q)},[Yt]);const Vn=s.useMemo(()=>SK(n.showcase).map(q=>EJ(q.previewUrl)),[n.showcase]),pn=n.engines.some(q=>q.available),ar=c.length>0,bt=Ve&&(Ve.voice==="ask"||Ve.voice==="note")?Ve:null,kt=bt!=null&&bt.shell?bl(bt.shell):document.body,sn=bt!=null&&bt.point?bl(bt.point):null,Ut=(bt==null?void 0:bt.live)??(bt!=null&&bt.point?[bt.point]:[]),Tn=Ut.map(q=>bl(q)).filter(q=>!!q),Vt=((bt==null?void 0:bt.also)??[]).map(q=>bl(q)).filter(q=>!!q),ne=((bt==null?void 0:bt.lit)??[]).map(q=>bl(q)).filter(q=>!!q),se=!!bt&&!!kt&&(!bt.point||!!sn)&&Tn.length===Ut.length,pe=bt&&!se?bt:null,ve=Oe||se;s.useEffect(()=>u3(ve),[ve]),s.useEffect(()=>()=>u3(!1),[]),s.useEffect(()=>{if(!pe)return;const q=(pe.shell?document.querySelector(pe.shell):null)??document.querySelector(".sc-feed")??document.body,Te=new MutationObserver(X);return Te.observe(q,{childList:!0,subtree:!0}),()=>Te.disconnect()},[pe==null?void 0:pe.id,pe==null?void 0:pe.shell,X]);const Ee=q=>{P&&(q.done?Re(P):Ie(P))};return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:Fe}),bt&&se&&o.jsx(aX,{id:bt.id,voice:bt.voice,target:sn,live:Tn,also:Vt,lit:ne,side:bt.side??"top",beside:bt.beside,soft:bt.soft,container:kt,title:bt.title,body:bt.body,at:bt.at,of:bt.of,canBack:wK(P,bt.id,G||!!(k&&re(P))),action:bt.start?{label:"Start"}:bt.done?{label:"Done"}:null,closeLabel:bt.done?"Close":"Close guide",onBack:()=>{const q=P?tA(P,bt.id):null;if(q){window.dispatchEvent(new CustomEvent("scenri:guide-take-back",{detail:{kind:q}})),window.dispatchEvent(new CustomEvent("scenri:guide-picker",{detail:{tab:Gx[q]}}));return}if(P==="presenter"&&(bt.id==="start"||bt.id==="face"||bt.id==="save"))return v(Vi(r),{replace:!0});if((P==="product"||P==="scene")&&bt.id===P)return b.close();if(P==="refine"&&bt.id==="ask"){if(S)return v(hr(r),{replace:!0});window.dispatchEvent(new Event("scenri:guide-clear-refine"));return}if(G&&P&&(bt.id==="new"||bt.id==="choose"||bt.id==="product"))return window.dispatchEvent(new Event("scenri:guide-close-picker")),Ze.current=P,v(ao(r))},onAction:()=>{if(bt.start)return ee();bt.done&&P&&Re(P)},onClose:()=>Ee(bt),onEscape:()=>Ee(bt),onShown:yn,onLost:X}),o.jsx(fq,{open:Oe||Nt,pictures:Vn,note:iu.note({engineReady:pn,ownsProducts:ar}),onTake:()=>{const q=Oe;wt(!1),Nt&&pt.close(),q?Sl({welcome:"taken"}).then(()=>g("first-shot")):window.setTimeout(()=>void g("first-shot"),0)},onDecline:()=>{const q=Oe;wt(!1),Nt&&pt.close(),q&&Sl({welcome:"declined"})}})]})}function bl(e){for(const t of document.querySelectorAll(e))if(t.getClientRects().length>0)return t;return null}function EJ(e){return`${e}${e.includes("?")?"&":"?"}w=320`}const CJ="lessons";function jJ(){var B;const e=ws("learn"),t=e.value!==null,n=oq(e.value),r=sr(da),a=I6(),i=xA(),{brand:c,recent:d,products:f}=Qt(),h=uN(),[p,g]=s.useState(null);s.useEffect(()=>{t||!p||(g(null),h(p))},[t,p,h]);const v=s.useRef(!1),y=F=>{v.current=!0,g(F),e.close()},b=s.useRef(null);s.useEffect(()=>{t&&(b.current=I8.current,I8.current=null)},[t]);const x=()=>{const F=v.current;if(v.current=!1,F)return;const te=b.current==="help";requestAnimationFrame(()=>{var K;if(document.activeElement!==document.body)return;const X=te?".sc-help-btn":".sc-learn-btn",Z=te?".sc-learn-btn":".sc-help-btn";(K=document.querySelector(X)??document.querySelector(Z))==null||K.focus()})},k=!!tn(it.hub),S=!!tn(it.presenterStudio),E=!!tn(it.presenters),C=F=>{var te;return((te=a.heading)==null?void 0:te.brandId)===c.id&&a.heading.task===F},N=((B=a.active)==null?void 0:B.brandId)===c.id&&!a.active.paused?a.active.task:null,M=d.some(F=>F.kind!=="root"&&F.status==="done"&&F.images.length>0),T=F=>F.needs==="shot"&&!M||F.needs==="product"&&f.length===0?F.needs??null:null,L=F=>{var z,Y,J,de,ae,W;const te=((Y=(z=a.progress)==null?void 0:z[F.id])==null?void 0:Y.reached)??[];if(N!==F.id)return d3(F.id,te,null);const X=((J=i.composer)==null?void 0:J.brandId)===c.id?i.composer:null,Z={here:k,heading:C(F.id),composer:k?X:null,nodes:a.activeNodes,begun:!0},K=F.id==="first-shot"?((de=Yj(Z))==null?void 0:de.id)??null:F.id==="reuse"?((ae=qj(Z))==null?void 0:ae.id)??null:F.id==="presenter"?((W=Jj({heading:C("presenter"),onPage:E&&!S,studio:S?i.studio:null}))==null?void 0:W.id)??null:null;return d3(F.id,te,{moment:K,nodes:a.activeNodes,draft:!!a.activeDraftId})},A=F=>iq(F.id,a,c.id,L(F)),P=lq(Ei,A),$=n??P??Ei[0],H=Ei.filter(F=>A(F)==="done").length;s.useEffect(()=>{if(t)for(const F of Object.values(J8))new Image().src=F.wide},[t]);const O=s.useRef(null),Q=s.useRef(new Map),I=s.useRef(null),V=s.useRef(!1);s.useEffect(()=>{var X;const F=t&&!V.current;if(V.current=t,!t)return;const te=()=>{var Z,K;(Z=O.current)==null||Z.focus({preventScroll:!0}),(K=O.current)==null||K.scrollIntoView({block:"nearest"})};r&&n?(I.current=n.id,te()):r&&I.current?(X=Q.current.get(I.current))==null||X.focus({preventScroll:!0}):F&&te()},[t,r,n]);const ie=(F,te)=>o.jsx(AJ,{lesson:F,state:A(F),at:L(F),blocked:T(F),describe:te,actionRef:O,onBegin:()=>y(F.id)});return o.jsx(Zs,{open:t,className:"sc-learn",maxWidth:"880px",described:!0,onDismiss:e.close,onCloseAutoFocus:x,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(CJ),"aria-label":"All lessons",children:o.jsx(Da,{size:15})}),o.jsx(ys,{className:"sc-newdlg-title",children:n.title}),o.jsx(lk,{})]}),o.jsx("div",{className:"sc-newdlg-body sc-learn-body",children:ie(n,!0)})]},`one-${n.id}`):o.jsxs("div",{className:"sc-learn-level",children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Learn"}),o.jsxs("span",{className:"sc-learn-count",children:[H," of ",Ei.length," done"]}),o.jsx(lk,{})]}),o.jsx(Bu,{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:Ei.map(F=>o.jsx("li",{children:o.jsxs("button",{type:"button",className:"sc-learn-row","data-state":A(F),"aria-current":!r&&$.id===F.id?"true":void 0,ref:te=>{te?Q.current.set(F.id,te):Q.current.delete(F.id)},onClick:()=>e.set(F.id),children:[o.jsx("span",{className:"sc-learn-thumb",children:o.jsx("img",{src:J8[F.id].square,alt:"",decoding:"async"})}),o.jsxs("span",{className:"sc-learn-say",children:[o.jsx("span",{className:"sc-learn-name",children:F.title}),o.jsx(dN,{lesson:F,state:A(F),at:L(F),blocked:T(F)})]}),(P==null?void 0:P.id)===F.id&&o.jsx("span",{className:"sc-learn-next",children:"Next"})]})},F.id))}),!r&&ie($,!1)]})]},"all")})}function AJ({lesson:e,state:t,at:n,blocked:r,describe:a,actionRef:i,onBegin:c}){const d=r?Q8[r].action:t==="active"?"Continue":t==="done"?"Start again":"Start",f=t==="active"?n:0,h=g=>t==="done"?"done":t==="active"?g<n?"done":g===n?"active":"todo":g===0?"active":"todo",p=a?o.jsx(Bu,{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:J8[e.id].wide,alt:"",decoding:"async"})}),o.jsxs("div",{className:"sc-learn-copy",children:[o.jsx("div",{className:"sc-learn-kicker",children:o.jsx(dN,{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:kA(e).map((g,v)=>{const y=h(v),b=o.jsx("span",{className:"sc-learn-n","aria-hidden":"true",children:y==="done"?o.jsx(nr,{size:14,weight:"bold"}):v+1}),x=t==="active"&&v===n?"step":void 0,k=o.jsx("span",{className:"sc-learn-step-name",children:g});return o.jsx("li",{children:v===f?o.jsxs("button",{ref:i,type:"button",className:"sc-learn-step","data-state":y,"data-here":"","aria-current":x,"aria-label":`${d}: ${g}`,onClick:c,children:[b,k,o.jsxs("span",{className:"sc-learn-go","aria-hidden":"true",children:[d," ",o.jsx(Ka,{size:12,weight:"bold"})]})]}):o.jsxs("div",{className:"sc-learn-step","data-state":y,"aria-current":x,children:[b,k,y==="done"&&o.jsx("span",{className:"sc-vh",children:", done"})]})},g)})}),r&&o.jsx("p",{className:"sc-learn-note",children:Q8[r].note})]})]})]})}function dN({lesson:e,state:t,at:n,blocked:r}){const a=kA(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(nr,{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:Q8[r].status}):o.jsxs("span",{className:"sc-learn-status",children:[a," step",a===1?"":"s"]})}function lk(){return o.jsx(Is,{children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx(Cn,{size:16})})})}const fN=s.createContext(null),NJ={products:[],productsLoaded:!1,importing:!1,refreshProducts:async()=>{}};function Qt(){const e=s.useContext(fN),t=aA()??NJ;if(!e)throw new Error("useBrand must be used inside BrandLayout");return s.useMemo(()=>({...e,...t}),[e,t])}const hN=s.createContext(null);function MJ(){const e=s.useContext(hN);if(!e)throw new Error("useAssetsPanel must be used inside BrandLayout");return e}function RJ(){const{brandSlug:e}=Fs(),{pathname:t,search:n}=_n(),r=tn({path:it.brand,end:!1}),{brands:a,engines:i,refresh:c}=jn(),[d,f]=s.useState(null),[h,p]=s.useState(null),[g,v]=s.useState([]),[y,b]=s.useState([]),[x,k]=s.useState({}),[S,E]=s.useState(!1),[C,N]=s.useState(0),M=s.useCallback(()=>N(W=>W+1),[]),T=Dn(),[L,A]=Na(Wr.assetsOpen,window.innerWidth>=1280),P=s.useCallback(()=>A(W=>!W),[]),$=s.useMemo(()=>({open:L,toggle:P,setOpen:A}),[L,P]);RK();const H=s.useRef(null),O=a.find(W=>W.slug===e)??a.find(W=>W.id===e)??a.find(W=>W.id===H.current)??null;O&&(H.current=O.id);const Q=s.useRef(O==null?void 0:O.id);Q.current=O==null?void 0:O.id;const I=s.useCallback(async()=>{if(!O)return;const W=O.id,ye=await Me.workspace(W);Q.current===W&&(f(ye.project),p(ye.root),v(ye.recent),b(ye.sets),k(ye.membership),E(!0))},[O==null?void 0:O.id]),V=s.useRef(new Set),ie=s.useCallback(W=>(V.current.add(W),()=>{V.current.delete(W)}),[]),B=s.useCallback(W=>{if(W.length){v(ye=>nq(ye,W));for(const ye of V.current)ye(W)}},[]),F=s.useCallback((W,ye)=>{!O||W!==O.id||B(ye)},[O==null?void 0:O.id,B]),te=s.useCallback(W=>b(ye=>ye.map(ee=>ee.id===W.id?W:ee)),[]),X=s.useCallback(W=>b(ye=>ye.filter(ee=>ee.id!==W)),[]),Z=s.useCallback(W=>b(ye=>ye.some(ee=>ee.id===W.id)?ye:[W,...ye]),[]),K=s.useCallback((W,ye)=>k(ee=>({...ee,[W]:ye})),[]),z=s.useMemo(()=>O?{brand:O,workspace:d,root:h,recent:g,sets:y,membership:x,loaded:S,refresh:I,applySet:te,dropSet:X,insertSet:Z,applyMembership:K,applyNodes:B,subscribeActivity:ie,shotsEpoch:C,resetShots:M}:null,[O,d,h,g,y,x,S,I,te,X,Z,K,B,ie,C,M]);s.useEffect(()=>{E(!1),v([]),p(null)},[O==null?void 0:O.id]),s.useEffect(()=>{O&&cz(O.id)},[O==null?void 0:O.id]),s.useEffect(()=>{I()},[I]);const Y=s.useCallback(()=>{c(),I()},[c,I]),J=r?t.slice(r.pathnameBase.length):"",de=!!O&&e!==O.slug,ae=O?ao(O)+J+n:"";if(s.useEffect(()=>{de&&T(ae,{replace:!0})},[de,ae,T]),!O){const W=wA(a),ye=!!H.current&&!a.some(re=>re.id===H.current),ee=new URLSearchParams(n);ye&&(ee.delete("settings"),ee.delete("new"));const ge=ee.toString();return o.jsx(no,{to:W?ao(W)+J+(ge?`?${ge}`:""):it.root,replace:!0})}return o.jsxs(fN.Provider,{value:z,children:[o.jsx(OY,{engines:i,brandId:O.id,onSaved:Y}),o.jsx(KY,{engines:i,onSaved:c}),o.jsx(ZY,{}),o.jsx(KW,{brand:O,onActivity:F,children:o.jsxs(PK,{brand:O,children:[o.jsx($J,{}),o.jsx(tK,{children:o.jsxs(hN.Provider,{value:$,children:[o.jsxs("div",{className:"sc-shell",children:[o.jsx(NK,{}),o.jsx(Ql,{}),o.jsx(cG,{})]}),o.jsx(SJ,{}),o.jsx(jJ,{}),o.jsx(jK,{})]})})]})})]})}function PJ(e){return!e.unread||e.spent||e.firstUse||!e.loaded||!e.visible||e.dialogOpen?!1:e.running===0&&e.builds===0}const LJ=Number(window.localStorage.getItem("scenri:whatsnew-settle-ms")??2500)||2500,pN=s.createContext(null);function Vp(){const e=s.useContext(pN);if(!e)throw new Error("useWhatsNew must be used inside WhatsNewProvider");return e}function TJ({children:e}){const[t,n]=s.useState(null),[r,a]=s.useState(null),[i,c]=s.useState(null),[d,f]=s.useState(null),[h,p]=s.useState(null),[g,v]=s.useState("loading"),[y,b]=s.useState(!1),x=ws("whatsnew");s.useEffect(()=>{let T=!0;return Me.releaseNotes().then(L=>{T&&(n(L.version),a(L.entry),c(L.changelogUrl),f(L.releasesUrl??null),p(L.seen),v("ready"))}).catch(()=>{T&&v("failed")}),()=>{T=!1}},[]);const k=x.open,S=s.useCallback(()=>k(t??"latest"),[k,t]),E=s.useCallback(()=>{b(!0),S()},[S]),C=s.useCallback(()=>{!t||h===t||(p(t),Me.releaseSeen(t).catch(()=>{}))},[t,h]),N=t!==null&&h!==t&&r!==null&&r.sections.length>0,M=s.useMemo(()=>({status:g,version:t,entry:r,changelogUrl:i,releasesUrl:d,unread:N,open:S,autoOpenSpent:y,autoOpen:E,markSeen:C}),[g,t,r,i,d,N,S,y,E,C]);return o.jsx(pN.Provider,{value:M,children:e})}function $J(){var k;const e=Vp(),{running:t,builds:n}=Oa(),{loaded:r}=Qt(),[a]=Bi(),[i,c]=s.useState(()=>!document.hidden),d=s.useRef(!1),f=I6(),h=aq(),p=f.eligible&&f.welcome===null,g=p||h||((k=f.active)==null?void 0:k.task)==="first-shot"&&!f.active.paused,v=!f.loaded||g;g&&(d.current=!0);const y=s.useRef(!1),{markSeen:b}=e;s.useEffect(()=>{p?y.current=!0:y.current&&(y.current=!1,b())},[p,b]),s.useEffect(()=>{const S=()=>c(!document.hidden);return document.addEventListener("visibilitychange",S),()=>document.removeEventListener("visibilitychange",S)},[]);const x=a.has("settings")||a.has("setup")||a.has("new")||a.has("whatsnew");return s.useEffect(()=>{if(!PJ({unread:e.unread,spent:d.current||e.autoOpenSpent,loaded:r,visible:i,dialogOpen:x,running:t,builds:n.length,firstUse:v}))return;const E=window.setTimeout(()=>{d.current=!0,e.autoOpen()},LJ);return()=>window.clearTimeout(E)},[e,r,i,x,t,n.length,v]),null}const mN=s.createContext(null);function jn(){const e=s.useContext(mN);if(!e)throw new Error("useAppData must be used inside AppShell");return e}function DJ(){const e=IU(),[t,n]=s.useState(null),[r,a]=s.useState([]),[i,c]=s.useState(null),d=_U(),f=ZU(),h=BU(),p=WU(),g=s.useRef(0),v=s.useRef(new Map),y=s.useRef(0),b=s.useRef(!1),x=s.useCallback(N=>{v.current.set(N.id,++g.current),n(M=>M&&aW(M,N))},[]),k=s.useCallback(async()=>{const N=++g.current;y.current=N;const M=await Me.brands();if(y.current!==N)return;const T=new Set;for(const[L,A]of v.current)A>N&&T.add(L);n(L=>oW(L,M,T))},[]),S=s.useCallback(()=>k().catch(()=>{}),[k]),E=s.useCallback(async()=>{try{await Promise.all([k(),Me.engines().then(a)]),b.current=!0}catch(N){b.current||c(String(N.message??N))}},[k]);s.useEffect(()=>{E(),MU()},[E]);const C=s.useMemo(()=>t===null?null:{brands:t,engines:r,scenes:d.scenes,collections:d.collections,verticals:d.verticals,loaded:d.loaded,error:d.error,refetch:d.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:E,refreshBrands:S,applyBrand:x},[t,r,d.scenes,d.collections,d.verticals,d.loaded,d.error,d.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,E,S,x]);return i?o.jsx(vs,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(V6,{failure:{kind:"unknown",title:"Scenri could not read your library.",fix:"Check that it is still running, then reload.",raw:i,retryable:!0}})}):t===null?o.jsx(vs,{align:"center",justify:"center",height:"100vh",children:o.jsx(wr,{size:"3"})}):o.jsx(mN.Provider,{value:C,children:o.jsx(KC.Provider,{value:e,children:o.jsx(eW,{children:o.jsxs(TJ,{children:[o.jsx(sS,{}),o.jsx(Ql,{})]})})})})}function ws(e){const[t,n]=Bi(),r=t.get(e),a=s.useCallback(d=>{n(f=>{const h=new URLSearchParams(f);return h.set(e,d),h},{replace:!1})},[e,n]),i=s.useCallback(d=>{n(f=>{const h=new URLSearchParams(f);return h.set(e,d),h},{replace:!0})},[e,n]),c=s.useCallback(()=>{n(d=>{const f=new URLSearchParams(d);return f.delete(e),f},{replace:!0})},[e,n]);return{value:r,open:a,set:i,close:c}}function M1(e,t=""){const[n,r]=Bi(),a=n.get(e)??t,i=s.useCallback(c=>{r(d=>{const f=new URLSearchParams(d);return c===null||c===t?f.delete(e):f.set(e,c),f},{replace:!0})},[e,t,r]);return[a,i]}function ck(e,t){const n=uk(t.name),r=dk(t.url);return!n&&!r?null:e.find(a=>{var i,c,d,f;return!!(r&&dk((c=(i=a.json)==null?void 0:i.meta)==null?void 0:c.website)===r||n&&uk(((f=(d=a.json)==null?void 0:d.meta)==null?void 0:f.name)??a.slug)===n)})??null}const uk=e=>String(e??"").trim().replace(/\s+/g," ").toLowerCase()||null,dk=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 OJ(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 HJ(e){return e.logo.status!=="primary"||e.colors.count===0||e.name.source==="hostname"}const Dd=(e,t=!1)=>({key:"products",found:t,label:"Products",value:e});function IJ(e){switch(e.kind){case"idle":return null;case"scanning":return Dd("looking for a shop");case"timeout":return Dd("this site took too long to search");case"error":return Dd("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 Dd(`${n?"about ":""}${t.count.toLocaleString()} found`,!0)}return Dd("we could not load the catalogue")}}}function FJ(e){return e.kind==="timeout"||e.kind==="error"?!0:e.kind==="result"&&(e.scan.verdict==="blocked"||e.scan.verdict==="likely")}function _J(e){var t;return!e||e.verdict!=="found"?!1:e.candidates.length>0||(((t=e.cards)==null?void 0:t.length)??0)>0}function VJ(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 ZJ(){var ae,W,ye,ee,ge,re;const{brands:e,refresh:t}=jn(),n=Dn(),r=e.length>0,[a,i]=s.useState(""),[c,d]=s.useState(""),[f,h]=s.useState(!1),[p,g]=s.useState(!1),[v,y]=s.useState(null),[b,x]=s.useState(null),[k,S]=s.useState(!1),[E,C]=s.useState(!1),[N,M]=s.useState(null),[T,L]=s.useState(null),[A,P]=s.useState(null),[$,H]=s.useState(null),O=s.useRef(!1),Q=s.useRef(null),I=async(D,G)=>{O.current=!0,Q.current=null,x(D),await t(),n(`${ao(D)}${G?`?settings=${G}`:""}`,{replace:!0})};s.useEffect(()=>{const D=()=>{const G=Q.current;!G||O.current||(Q.current=null,fetch(`/api/brands/${G}`,{method:"DELETE",keepalive:!0}).catch(()=>{}))};return window.addEventListener("pagehide",D),()=>{window.removeEventListener("pagehide",D),D()}},[]);const V=async(D=!1)=>{var G,Pe;if(!D){const Ze=ck(e,{url:a.trim()});if(Ze){H(Ze);return}}g(!0),y(null);try{const Ze=await Me.brandFromUrl(a);x(Ze),Q.current=Ze.id,M(Ze.report),L(((G=Ze.report)==null?void 0:G.read)===!1&&((Pe=Ze.warnings)==null?void 0:Pe.slice(0,2).join(" "))||null),g(!1)}catch(Ze){y(String(Ze.message??Ze)),g(!1)}},ie=async(D=!1)=>{if(!D){const G=ck(e,{name:c});if(G){H(G);return}}g(!0),y(null);try{await I(await Me.createBrand({specVersion:"0.1",meta:{name:c.trim()||"Untitled brand"}}))}catch(G){y(String(G.message??G)),g(!1)}},B=()=>n("/",{replace:!0}),{scan:F,scanning:te,outcome:X,retry:Z}=_j((b==null?void 0:b.id)??null),K=IJ(X),z=X.kind==="timeout"||X.kind==="error",Y=async D=>{var G,Pe;if(b){P(null),C(!0);try{await Me.catalogImport(b.id,String(((Pe=(G=b.json)==null?void 0:G.meta)==null?void 0:Pe.website)??a),D)}catch{P("That did not start. Check your connection and try again."),C(!1);return}C(!1),S(!1),await I(b)}},J=b?Ls((ae=b.json)==null?void 0:ae.palette):[],de=b?Or((W=JW(b.json))==null?void 0:W.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:B,style:r?void 0:{visibility:"hidden"},children:[o.jsx(Da,{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:b&&N?o.jsxs(o.Fragment,{children:["Built from ",N.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:[b?o.jsx("div",{style:{textAlign:"center"},children:te?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",disabled:!0,children:[o.jsx(wr,{size:"1"})," Looking for products"]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void I(b),children:"Skip and add the brand only"})})]}):z?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:Z,children:["Look for products again ",o.jsx(Ka,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void I(b),children:"Continue without products"})})]}):_J(F)?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:()=>S(!0),children:["Add brand and products ",o.jsx(Ka,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void I(b),children:"Just the brand"})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sc-wiz-cta",onClick:()=>void I(b),children:["Looks right ",o.jsx(Ka,{size:12})]}),o.jsx("div",{children:o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>void I(b,"brand"),children:N&&HJ(N)?"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:c,onChange:D=>{d(D.target.value),H(null)},onKeyDown:D=>D.key==="Enter"&&c.trim()&&!p&&void ie()}),o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("button",{type:"button",className:"sc-wiz-cta",disabled:!c.trim()||p,onClick:()=>void ie(),children:p?o.jsx(wr,{size:"1"}):o.jsxs(o.Fragment,{children:["Create it ",o.jsx(Ka,{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:D=>{i(D.target.value),H(null)},onKeyDown:D=>D.key==="Enter"&&a.trim()&&!p&&void V()}),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 V(),children:p?o.jsx(wr,{size:"1"}):o.jsxs(o.Fragment,{children:["Build the kit ",o.jsx(Ka,{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"})})]})]}),$&&o.jsxs(j8,{color:"amber",mt:"3",size:"1",children:[o.jsxs(A8,{children:["You already have ",Ea($),". 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(ao($)),children:["Open ",Ea($)," instead"]}),o.jsx("button",{type:"button",className:"sc-wiz-skip",onClick:()=>{H(null),f?ie(!0):V(!0)},children:"Create anyway"})]})]}),v&&o.jsx(j8,{color:"red",mt:"3",size:"1",children:o.jsx(A8,{children:v})})]})]}),o.jsx("div",{className:"sc-wiz-preview",children:o.jsxs("div",{className:"sc-wiz-card",children:[o.jsx("div",{className:"sc-wiz-cap",children:b?"Your kit":p?`Reading ${a||"the site"}`:"Live kit preview"}),o.jsxs("div",{className:"sc-wiz-body",children:[p&&!b&&o.jsxs("div",{className:"sc-scrape-row",children:[o.jsx(wr,{size:"1"})," Reading the site and building the kit"]}),!p&&!b&&o.jsx("p",{style:{color:"var(--sc-fg3)",fontSize:12.5,margin:0},children:"The kit appears here as it is found."}),b&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:J.length?16:0},children:[o.jsx("span",{className:"sc-kit-logo",style:{width:44,height:44,padding:7,borderRadius:12},children:de?o.jsx("img",{src:de,alt:""}):o.jsx(Vs,{size:16,color:"var(--sc-fg3)"})}),o.jsxs("span",{children:[o.jsx("b",{dir:"auto",style:{fontFamily:"var(--sc-font-display)",fontSize:16},children:(ee=(ye=b.json)==null?void 0:ye.meta)==null?void 0:ee.name}),((re=(ge=b.json)==null?void 0:ge.meta)==null?void 0:re.tagline)&&o.jsx("small",{dir:"auto",style:{display:"block",color:"var(--sc-fg3)",fontSize:11.5},children:VJ(String(b.json.meta.tagline),72)})]})]}),J.length>0&&o.jsx("div",{style:{display:"flex",gap:8},children:J.slice(0,5).map(D=>o.jsx("span",{style:{flex:1,height:44,borderRadius:9,border:"1px solid var(--sc-line)",background:D.hex}},D.hex))}),N&&o.jsx("ul",{className:"sc-kit-lines",role:"status",children:[...OJ(N),...K?[K]:[]].map(D=>o.jsxs("li",{"data-found":D.found?"":void 0,children:[D.key==="products"&&te?o.jsx(wr,{size:"1"}):D.found?o.jsx(nr,{size:12,weight:"bold"}):o.jsx(GB,{size:12}),o.jsx("span",{className:"sc-kit-line-label",children:D.label}),o.jsx("span",{className:"sc-kit-line-value",children:D.value})]},D.key))}),T&&o.jsx("p",{className:"sc-kit-note",role:"status",children:T}),!te&&!z&&FJ(X)&&o.jsx("button",{type:"button",className:"sc-wizpick-open",onClick:Z,children:"Try the catalogue again"})]})]})]})}),k&&F&&b&&o.jsx(Fj,{brandId:b.id,scan:F,busy:E,error:A,onImport:D=>void Y(D),onImportAll:()=>void Y(),onDismiss:()=>S(!1)})]})}const tu=e=>{const t=(e??"").trim();return t||null};function zJ(e){const t=e;return{name:e.name,brand:tu(t.brand)??tu(t.vendor),qualifier:tu(t.format)??tu(t.subcategory)??tu(t.variant)}}function BJ(e){return!e.brand||e.name.toLowerCase().startsWith(e.brand.toLowerCase())?e.name:`${e.brand} ${e.name}`}function oo(e,t){const n=zJ(e);if(t==="chip")return n.name;const r=BJ(n);return t==="tooltip"?[r,n.qualifier].filter(Boolean).join(" · "):r}function zi(e,t){return t==="tooltip"?[e.name,tu(e.lighting)].filter(Boolean).join(" · "):e.name}function Ah(e){return[e.name,...e.legacyNames??[],...e.keywords??[],e.description,e.lighting,e.subject].concat(e.collections??[],e.verticals??[]).filter(Boolean).join(" ")}function x4(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 Nh(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 UJ(e,t,n){return[e.title,e.category,n,t.product?x4(t.product):null,t.presenter?Nh(t.presenter):null,t.scene?Ah(t.scene):null].filter(Boolean).join(" ")}function k4(){const{brand:e}=Qt(),t=Dn(),n=hr(e);return s.useCallback(r=>{t(`${n}?presenter=${encodeURIComponent(r)}&compose=1`)},[n,t])}function Zp(){const{brand:e}=Qt(),t=Dn(),n=hr(e);return s.useCallback((r,a)=>{const i=a?`&setup=${encodeURIComponent(a)}`:"";t(`${n}?scene=${encodeURIComponent(r)}${i}&compose=1`)},[n,t])}function ov(e){return{...e.brief,...e.variants?{variants:e.variants}:{},...e.quality?{quality:e.quality}:{},_at:Date.now()}}function WJ(){const{brand:e}=Qt(),t=Dn(),n=hr(e);return s.useCallback(r=>{t(`${n}?showcase=${encodeURIComponent(r)}`)},[n,t])}const X1=e=>`sc-favscenes-${e}`,GJ=e=>`sc-favlooks-${e}`,KJ=e=>`bt-favlooks-${e}`;function io(e){try{const t=localStorage.getItem(X1(e))??M8(GJ(e),X1(e))??M8(KJ(e),X1(e)),n=t?JSON.parse(t):[];return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch{return[]}}function YJ(e,t){try{localStorage.setItem(X1(e),JSON.stringify(t))}catch{}}function gN(e,t){const n=io(e),r=n.includes(t)?n.filter(a=>a!==t):[...n,t];return YJ(e,r),r}const vN=[{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"}],qJ=new Map(vN.map(e=>[e.key,e]));function Ag(e){var t;return e?((t=qJ.get(e))==null?void 0:t.label)??e:null}function XJ(e){const t=new Map(vN.map((n,r)=>[n.key,r]));return[...e].sort((n,r)=>(t.get(n)??99)-(t.get(r)??99)||n.localeCompare(r))}const r0=14,QJ=768,iv=[{px:190,label:"Compact",cells:3},{px:320,label:"Large",cells:2}],yN=320;function wN(e){const t=typeof e=="number"&&Number.isFinite(e)?e:yN;let n=iv[0].px;for(const r of iv)Math.abs(r.px-t)<Math.abs(n-t)&&(n=r.px);return n}const Tu=5;function pc(e){const t=typeof e=="number"?e:Tu;return t===7||t===5?t:t===6?5:Tu}function JJ(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(c=>c===i?c:i)};r();const a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e]),t}function eee(){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 tee(e,t,n){if(e<=0)return{tile:t,cols:1};const r=n?2:Math.max(1,Math.floor((e+r0)/(t+r0)));return{tile:Math.floor((e-r0*(r-1))/r),cols:r}}function zp(e){return pc(e)===5?"large":"compact"}const cf=s.createContext("large");function nee(){return s.useContext(cf)}const ree=[{value:7,label:"Compact",hint:"More cards per row",cells:3},{value:5,label:"Large",hint:"Fewer, larger cards",cells:2}],see=iv.map(e=>({value:e.px,label:e.label,hint:e.label==="Compact"?"More shots per row":"Fewer, larger shots",cells:e.cells}));function Bp({value:e,onChange:t}){return o.jsx(bN,{label:"Grid size",value:pc(e),options:ree,onChange:n=>t(n)})}function aee({value:e,onChange:t}){return o.jsx(bN,{label:"Shot size",value:wN(e),options:see,onChange:t})}function bN({label:e,value:t,options:n,onChange:r}){const a=s.useRef(null);return s.useLayoutEffect(()=>{const i=a.current;if(!i)return;const c=()=>{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`)};c(),i.dataset.inkReady||requestAnimationFrame(()=>{i.dataset.inkReady=""});const d=new ResizeObserver(c);return d.observe(i),()=>d.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 c=t===i.value;return o.jsx("button",{type:"button",role:"radio",className:"sc-density-opt","aria-checked":c,"aria-label":i.label,title:i.hint,"data-on":c||void 0,onClick:()=>{c||r(i.value)},children:o.jsx(oee,{cells:i.cells})},i.value)})]})}function oee({cells:e}){const t=e,n=16,r=1.5,a=1.5,c=(n-r*2-a*(t-1))/t,d=Math.max(.6,c*.22),f=[];for(let h=0;h<t;h++)for(let p=0;p<t;p++)f.push({x:r+p*(c+a),y:r+h*(c+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:c,height:c,rx:d,ry:d,fill:"currentColor"},`${h.x}-${h.y}`))})}function Up(e){return{"--sc-wall-cols":String(pc(e))}}function iee(e,t){let r=null,a=null,i=null,c=null,d=null,f=null,h=null,p={dx:0,dy:0},g={w:0,h:0},v=0;const y=P=>{P.style.position="fixed",P.style.left="0",P.style.top="0",P.style.margin="0",P.style.zIndex="var(--sc-z-popover)",P.style.pointerEvents="none"},b=()=>{const P=$=>{var H,O;window.removeEventListener("click",P,!0),!((O=(H=$.target).closest)!=null&&O.call(H,'[data-role="remove"]'))&&($.stopPropagation(),$.preventDefault())};window.addEventListener("click",P,!0),setTimeout(()=>window.removeEventListener("click",P,!0),250)},x=()=>{if(h!==null){try{e.releasePointerCapture(h)}catch{}h=null}i==null||i.remove(),c==null||c.remove(),i=null,c=null,d=null,a==null||a.removeAttribute("data-drag-src"),a=null,r=null,e.removeAttribute("data-chip-drag"),document.documentElement.style.cursor="",cancelAnimationFrame(v)},k=P=>{!e.isConnected||!e.contains(document.activeElement)||(f!==null?Sa(e,f):Ll(e,P,"after"))},S=()=>{if(!a)return;const P=a;x(),b(),k(P),t.onCancelled()},E=P=>{if(P.button!==0||P.pointerType==="touch")return;const $=P.target;if($.closest('[data-role="remove"]'))return;const H=bi($);H&&(r={chip:H,x:P.clientX,y:P.clientY})},C=P=>{var H,O;if(!r)return;f=Eo(e),a=r.chip,t.onDragStart(),(H=window.getSelection())==null||H.removeAllRanges(),e.setAttribute("data-chip-drag","");const $=a.getBoundingClientRect();p={dx:r.x-$.left,dy:r.y-$.top},r=null;try{e.setPointerCapture(P.pointerId),h=P.pointerId}catch{}document.documentElement.style.cursor="grabbing",i=a.cloneNode(!0),(O=i.querySelector('[data-role="remove"]'))==null||O.remove(),i.className=`${a.className} sc-chip-ghost`,i.removeAttribute("data-drag-src"),i.removeAttribute("title"),y(i),i.style.width=`${$.width}px`,i.style.height=`${$.height}px`,i.style.fontSize=getComputedStyle(a).fontSize,g={w:$.width,h:$.height},document.body.appendChild(i),a.setAttribute("data-drag-src",""),c=document.createElement("div"),c.className="sc-drop-caret",y(c),c.style.display="none",document.body.appendChild(c),N(P)},N=P=>{if(!i||!a)return;const $=Math.min(Math.max(4,P.clientX-p.dx),window.innerWidth-g.w-4),H=Math.min(Math.max(4,P.clientY-p.dy),window.innerHeight-g.h-4);i.style.transform=`translate3d(${$}px, ${H}px, 0)`;const O=w3(e,a,P.clientX,P.clientY);if(d=O,!c)return;const Q=O&&!O.noop?fk(e,O.units):null;if(!Q||!O){c.style.display="none";return}const I=Pq(e,O.units),V=I<O.units?fk(e,I):null,ie=!!V&&Math.abs(V.top+V.height/2-(Q.top+Q.height/2))<Q.height/2,B=V&&ie?(V.left+Q.left)/2:Q.left;c.style.display="",c.style.transform=`translate3d(${B-1.5}px, ${Q.top-2}px, 0)`,c.style.height=`${Q.height+4}px`},M=P=>{if(r){if(Math.hypot(P.clientX-r.x,P.clientY-r.y)<5)return;P.preventDefault(),C(P);return}if(!a)return;P.preventDefault(),cancelAnimationFrame(v);const{clientX:$,clientY:H}=P;v=requestAnimationFrame(()=>N({clientX:$,clientY:H}))},T=P=>{if(r){r=null;return}if(!a)return;const $=a;let H;try{H=w3(e,$,P.clientX,P.clientY)??d}catch{H=d}finally{x()}if(b(),H&&!H.noop&&PA(e,$,H.units)){Ll(e,$,"after"),t.onMoved($,ev(e,$));return}k($),t.onCancelled()},L=P=>{P.key==="Escape"&&a&&(P.stopPropagation(),S())},A=P=>{bi(P.target)&&P.preventDefault()};return e.addEventListener("pointerdown",E),e.addEventListener("dragstart",A),e.addEventListener("lostpointercapture",S),window.addEventListener("pointermove",M),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",S),window.addEventListener("blur",S),window.addEventListener("keydown",L,!0),()=>{x(),e.removeEventListener("pointerdown",E),e.removeEventListener("dragstart",A),e.removeEventListener("lostpointercapture",S),window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",S),window.removeEventListener("blur",S),window.removeEventListener("keydown",L,!0)}}function fk(e,t){let n=0;const r=Array.from(e.childNodes);for(let c=0;c<r.length;c++){const d=r[c],f=Lu(d),h=d.nodeType===Node.TEXT_NODE&&t===n+f&&c<r.length-1;if(t<=n+f&&!h){if(d.nodeType!==Node.TEXT_NODE){const v=d.getBoundingClientRect();return new DOMRect(t===n?v.left:v.right,v.top,0,v.height)}const p=document.createRange();p.setStart(d,bh(d,Math.max(0,Math.min(t-n,f)))),p.collapse(!0);const g=p.getBoundingClientRect();return g.height?g:null}n+=f}const i=(e.lastElementChild??e).getBoundingClientRect();return new DOMRect(i.right,i.top,0,i.height||18)}function lee({kind:e,label:t,thumb:n,onInspect:r,onMove:a,onRemove:i,onClose:c}){const{sheet:d,grip:f}=zu(()=>c("dismiss")),h=e==="mark"?"brand mark":"reference image";return o.jsx(ec,{open:!0,onOpenChange:p=>!p&&c("dismiss"),children:o.jsxs(tc,{children:[o.jsx(nc,{className:"sc-shotsheet-scrim"}),o.jsxs(rc,{ref:d,className:"sc-shotsheet sc-swapsheet","data-kind":e,"aria-describedby":void 0,onOpenAutoFocus:p=>{var g;p.preventDefault(),(g=d.current)==null||g.focus({preventScroll:!0})},onCloseAutoFocus:p=>p.preventDefault(),onEscapeKeyDown:p=>{p.preventDefault(),c("escape")},children:[o.jsxs("div",{className:"sc-shotsheet-grip",...f,children:[o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0}),o.jsxs(sc,{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(T6,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>a(1),children:["Move later ",o.jsx(Ka,{size:13})]})]}),i&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:i,children:[o.jsx(Sp,{size:13}),"Remove ",e==="mark"?"mark":"reference"]})]})]})]})})}const cee=440,uee=460,hk=156,xN=8,Q1=14,Ng=20,dr=12,kN=200,dee=240,SN=204;function fee(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-dr*2),i=e.right+Q1+r+dr<=t.width?e.right+Q1:Math.max(dr,e.left-Q1-r),c=Math.max(dr,Math.min(e.top,t.height-dr-SN));return{left:i,top:c,width:r,maxHeight:Math.max(kN,t.height-c-dr),side:"beside"}}function hee(e,t){const n=(r,a)=>Math.min(Math.max(r,Ng),Math.max(Ng,a-Ng));return t.side==="beside"?{edge:t.left>=e.right?"left":"right",x:0,y:n((e.top+e.bottom)/2-t.top,SN)}:{edge:t.side==="above"?"bottom":"top",x:n((e.left+e.right)/2-t.left,t.width),y:0}}function pee(e,t,n,r){if(e.bottom<0||e.top>t.height)return null;const a=xN,i=Math.min(n.width,t.width-dr*2),c=n.height,d=Math.min(Math.max(e.left+(e.right-e.left)/2-i/2,dr),Math.max(dr,t.width-i-dr)),h=e.top-a-dr>=c?e.top-a-c:Math.min(e.bottom+a,Math.max(dr,t.height-c-dr));return{left:d,top:h}}function S4(e,t,n){if(e.bottom<0||e.top>t.height)return null;const r=Math.min((n==null?void 0:n.width)??cee,t.width-dr*2),a=(n==null?void 0:n.gap)??xN,i=e.top-a-dr,c=t.height-e.bottom-a-dr,d=i>=dee||i>=c?"above":"below",h=Math.max(kN,Math.min(uee,d==="above"?i:c)),p=Math.min(Math.max(e.left,dr),Math.max(dr,t.width-r-dr)),g=d==="above"?Math.max(dr,e.top-a-h):e.bottom+a;return d==="above"?{left:p,top:g,width:r,maxHeight:h,side:d,bottomEdge:e.top-a}:{left:p,top:g,width:r,maxHeight:h,side:d}}function EN(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 mee=["ref","mark","product","presenter","scene","shot"],J1=e=>mee.includes(e),CN={ref:"Reference image",mark:"Brand mark",product:"Product",presenter:"Presenter",scene:"Scene",shot:"Shot"};function gee(e){return e.side==="below"||e.side==="beside"?{top:Math.round(e.top)}:{bottom:Math.round(window.innerHeight-(e.top+e.maxHeight))}}function Gu({anchor:e,kind:t,src:n,label:r,warning:a,note:i,noun:c,side:d="auto",onOpen:f,onHoverIn:h,onHoverOut:p,onClose:g}){const[v,y]=s.useState(null),[b,x]=s.useState(!1);if(s.useEffect(()=>x(!1),[n]),s.useLayoutEffect(()=>{var E,C;const S=()=>{const N=window.visualViewport,M=e.getBoundingClientRect(),T={width:(N==null?void 0:N.width)??window.innerWidth,height:(N==null?void 0:N.height)??window.innerHeight},L=d==="beside"?fee(M,T,{width:hk}):S4(M,T,{width:hk,gap:Q1});if(!L){g();return}y({...L,tail:hee(M,L)})};return S(),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),(E=window.visualViewport)==null||E.addEventListener("resize",S),(C=window.visualViewport)==null||C.addEventListener("scroll",S),()=>{var N,M;window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),(N=window.visualViewport)==null||N.removeEventListener("resize",S),(M=window.visualViewport)==null||M.removeEventListener("scroll",S)}},[e,d,g]),s.useEffect(()=>{const S=E=>{E.key==="Escape"&&g()};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[g]),!v)return null;const k=c??CN[t];return Mr.createPortal(o.jsxs("div",{className:"sc-chip-preview","data-kind":t,"data-side":v.side,"aria-hidden":"true",style:{left:Math.round(v.left),...gee(v),maxWidth:v.width,maxHeight:v.maxHeight},onPointerEnter:h,onPointerLeave:p,children:[o.jsx("span",{className:"sc-chip-preview-tail","data-edge":v.tail.edge,style:v.tail.edge==="left"||v.tail.edge==="right"?{top:Math.round(v.tail.y)}:{left:Math.round(v.tail.x)}}),o.jsxs("button",{type:"button",className:"sc-chip-preview-hit",tabIndex:-1,onClick:f,children:[b?o.jsxs("span",{className:"sc-chip-preview-plate sc-chip-preview-blank",children:[o.jsx(Vs,{size:20}),"Image unavailable"]}):o.jsx("img",{className:"sc-chip-preview-plate",src:n,alt:"",decoding:"async",onError:()=>x(!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 vee=160,yee=120;function Ku(){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),vee)},[a]),c=s.useCallback(()=>{a(),n.current=setTimeout(()=>t(null),yee)},[a]),d=s.useCallback(()=>{a(),t(null)},[a]);return s.useEffect(()=>a,[a]),{shown:e,open:i,keep:a,close:c,closeNow:d}}const Kd="sc-insert-menu";function wee(e){var t;return!!(((t=e.nativeEvent)==null?void 0:t.isComposing)??e.isComposing)||e.keyCode===229}function bee(e){return e==="/"?"Scenes":e==="@"?"Presenters":e==="#"?"Colors":"Products"}function xee(e){return e==="/"?"No matching scenes":e==="#"?"No matching colours":e==="@"?"No matching presenters":"No matching products"}function kee({menuOpen:e,handled:t}){return!e&&!t}function See(e,t){return t||!e?{open:!1}:{open:!0,sigil:e.sigil,query:e.query}}function Eee(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 Cee(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.right-e.left,h:e.bottom-e.top}}function jee(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 Aee(e,t,n){return n?t:e||t}function Nee(e,t){return!t||e==null?!0:e===t?!1:!t.contains(e)}function Mg(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 Mee(e,t,n){return Math.min(n,Math.max(0,e)+Math.max(0,t))}function Ree(e,t,n){return n>0&&t>0&&e!==t}function Pee(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 jN=320,Mh=320,Lee=280,Nl=8,El=12,Tee=8,pk=80,$ee=120,AN=48;function NN(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>AN)}function Dee(e){return{top:e.top,bottom:Math.min(e.bottom,e.top+22),left:e.left,right:e.left+2}}function MN(e,t,n,r){return Math.min(Math.max(e,r),Math.max(r,n.width-t-r))}function lv(e,t,n,r){const a=n?Tee:El,i=n?Math.max(0,e.right-e.left):Math.min(jN,t.width-a*2),c=n?e.left:MN(e.left,i,t,a),d=n?Math.min(Lee,Math.floor(t.height*.4)):Mh,f=Math.min(d,r??d),h=e.top-Nl-a,p=Math.max(0,Math.min(f,h)),g=Math.max(a,e.top-Nl-p);return{left:c,top:g,width:i,maxHeight:p,side:"above",shell:"dock"}}function mk(e,t,n,r){const a=Math.min(jN,n.width-El*2),i=MN(e.left,a,n,El),c=e.top-Nl-El,d=n.height-e.bottom-Nl-El,f=c>=$ee||c>=d?"above":"below",h=Math.min(Mh,r??Mh),p=f==="above"?c:d,g=Math.min(h,r==null?Math.max(pk,p):p);if(f==="above"){const y=Math.max(El,e.top-Nl-Math.min(h,c)),b=Math.min(h,e.top-Nl-y);return r==null&&b<pk?lv(t,n,!1):{left:i,top:y,width:a,maxHeight:b,side:f,shell:"caret"}}const v=e.bottom+Nl;return v+Math.min(g,d)>n.height-El?lv(t,n,!1,r):{left:i,top:v,width:a,maxHeight:Math.min(h,d),side:f,shell:"caret"}}function Oee(e,t,n,r={}){if(r.phone)return lv(t,n,!0,r.height);const a=r.line??t;if(NN(e,n)&&e)return mk(e,t,n,r.height);const i=e&&e.right-e.left>AN?e:a;return mk(Dee(i),t,n,r.height)}function Hee({anchor:e,composer:t,line:n,query:r,options:a,remaining:i=0,total:c=0,sigil:d,onMore:f,onActiveId:h,onClose:p}){const g=sr(da),[v,y]=s.useState(0),[b,x]=s.useState(null),k=s.useRef(null),S=s.useRef(null),E=s.useRef(null),C=s.useRef(null),N=`${d??""}\0${r}`,M=s.useRef({}),T=s.useRef(f);T.current=f;const L=s.useRef(i);L.current=i;const A=s.useRef(0),P=s.useCallback(()=>{var I;Ree(A.current,a.length,L.current)&&(A.current=a.length,(I=T.current)==null||I.call(T))},[a.length]);s.useEffect(()=>{y(0),A.current=0},[r]),s.useEffect(()=>{y(I=>Math.min(I,Math.max(0,a.length-1)))},[a.length]),s.useEffect(()=>{C.current=null,M.current={}},[d]);const $=s.useCallback(I=>{var Y;const V=t==null?void 0:t.getBoundingClientRect();if(!V)return null;const ie=(n==null?void 0:n.getBoundingClientRect())??V,B=window.visualViewport,F={width:(B==null?void 0:B.width)??window.innerWidth,height:(B==null?void 0:B.height)??window.innerHeight},te=!!((Y=k.current)!=null&&Y.contains(document.activeElement)),X=te?null:jA(),Z=X&&NN(X,F)?X:null;Z&&(C.current=Cee(Z,ie));const K=C.current?jee(ie,C.current):null,z=Aee(Z,K,te)??(te?null:(e==null?void 0:e.getBoundingClientRect())??null);return Oee(z,V,F,{phone:g,line:ie,height:I})},[e,t,n,g]);s.useLayoutEffect(()=>{var B,F;M.current.sigil!==d&&(M.current={sigil:d});const I=()=>{const te=L.current>0?void 0:M.current.height,X=$(te);x(Z=>Mg(Z,X)?Z:X)},V=te=>{Nee(te.target,k.current)&&I()};I();const ie=requestAnimationFrame(I);return window.addEventListener("resize",I),window.addEventListener("scroll",V,!0),(B=window.visualViewport)==null||B.addEventListener("resize",I),(F=window.visualViewport)==null||F.addEventListener("scroll",I),()=>{var te,X;cancelAnimationFrame(ie),window.removeEventListener("resize",I),window.removeEventListener("scroll",V,!0),(te=window.visualViewport)==null||te.removeEventListener("resize",I),(X=window.visualViewport)==null||X.removeEventListener("scroll",I)}},[e,t,n,g,d,$]),s.useLayoutEffect(()=>{if(!b||!k.current)return;if(i>0){if(M.current.height==null&&M.current.sigil===(d??""))return;M.current={sigil:d??""};const te=$();te&&!Mg(b,te)&&x(te);return}const I=k.current,V=S.current,ie=V?I.offsetHeight-V.clientHeight:I.offsetHeight,B=Mee(ie,(V==null?void 0:V.scrollHeight)??0,Mh);if(!(B>0)||M.current.height===B&&M.current.sigil===(d??""))return;M.current={sigil:d??"",height:B};const F=$(B);!F||Mg(b,F)||x(F)},[b,N,$,i,a.length,d]),s.useLayoutEffect(()=>{const I=V=>{V.isComposing||V.keyCode===229||(V.key==="ArrowDown"?(V.preventDefault(),v>=a.length-1?P():y(ie=>ie+1)):V.key==="ArrowUp"?(V.preventDefault(),y(ie=>Math.max(0,ie-1))):(V.key==="Enter"||V.key==="Tab")&&a[v]?(V.preventDefault(),a[v].run()):V.key==="Escape"&&(V.preventDefault(),p()))};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[a,v,p,P]),s.useEffect(()=>{const I=S.current,V=I==null?void 0:I.querySelector('[data-active="true"]');I&&V&&Pee(I,V)},[v]),s.useEffect(()=>{const I=E.current,V=S.current;if(!I||!V)return;const ie=new IntersectionObserver(B=>{V.scrollTop<=0||B.some(F=>F.isIntersecting)&&P()},{root:V,rootMargin:"0px 0px 8px 0px"});return ie.observe(I),()=>ie.disconnect()},[b,N,P]);const H=a[v]?`${Kd}-opt-${v}`:null;if(s.useEffect(()=>(h==null||h(H),()=>h==null?void 0:h(null)),[H,h]),s.useEffect(()=>{const I=V=>{V.target.closest(".sc-cmd")||(tv(V),p())};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[p]),!b)return null;const O=`${Kd}-list`,Q=bee(d);return Mr.createPortal(o.jsx("div",{className:"sc-cmd",id:Kd,"data-shell":b.shell,style:{left:b.left,top:b.top,width:b.width,maxHeight:b.maxHeight,height:b.side==="above"&&i>0?b.maxHeight:void 0},ref:k,children:o.jsxs("div",{className:"sc-cmd-list",ref:S,role:"listbox","aria-label":Q,id:O,children:[a.length?a.map((I,V)=>{var B;const ie=V===0||I.group!==((B=a[V-1])==null?void 0:B.group);return o.jsxs("div",{children:[ie&&o.jsx(gk,{name:I.group,total:c}),o.jsxs("button",{type:"button",id:`${Kd}-opt-${V}`,className:"sc-cmd-row",role:"option","aria-selected":V===v,"data-active":V===v,onMouseEnter:()=>y(V),onMouseDown:F=>tv(F),onClick:()=>I.run(),children:[I.thumb?o.jsx("img",{src:I.thumb,alt:"","data-crop":I.crop}):I.swatch?o.jsx("span",{className:"sc-cmd-swatch",style:{background:I.swatch}}):null,o.jsx(Iee,{text:I.label,query:r}),I.hint&&o.jsx("span",{className:"sc-cmd-hint",children:I.hint})]})]},I.key)}):o.jsxs(o.Fragment,{children:[o.jsx(gk,{name:Q,total:c}),o.jsx("div",{className:"sc-cmd-empty",children:xee(d)})]}),i>0&&a.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"sc-cmd-count","aria-live":"polite",children:[a.length," of ",c]}),o.jsx("div",{ref:E,className:"sc-cmd-sentinel","aria-hidden":!0})]})]})}),document.body)}function gk({name:e,total:t}){return o.jsxs("div",{className:"sc-cmd-group",children:[e," ",o.jsx("span",{className:"sc-cmd-n",children:t})]})}function Iee({text:e,query:t}){return o.jsx("span",{className:"sc-cmd-label",children:Eee(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 Fee={fragrance:["Fragrance"],footwear:["Footwear"],apparel:["Apparel"],furniture:["Furniture","Home"],beauty:["Beauty"],electronics:["Electronics"],accessories:["Accessories"],beverage:["Food & drink"],jewelry:["Jewelry"],food:["Food & drink"]},_ee={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 Vee(e,t){if(!t)return!1;const n=Fee[t];return!!n&&n.some(r=>e.verticals.includes(r))}function Zee(e,t){if(!t)return!1;const n=_ee[t];return!!n&&n.some(r=>e.suitableCategories.includes(r))}function vk(e){return e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").replace(/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g,"").toLowerCase()}const zee=4;function lo(e,t){const n=vk(t).trim().split(/\s+/).filter(Boolean);if(!n.length)return!0;const r=vk(e);return n.every(a=>r.includes(a)||a.length>=zee&&a.endsWith("s")&&r.includes(a.slice(0,-1)))}function RN(e){return e<2?"none":"tabs"}function E4(e,t){return{visible:e.slice(0,t),remaining:Math.max(0,e.length-t)}}function PN(e,t){return[...e].sort((n,r)=>Number(t(r))-Number(t(n)))}function LN(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 uf={product:"product",presenter:"presenter",scene:"scene"},Mi=48;function Bee(e){return e?e.t==="product"?"product":e.t==="character"?"presenter":e.t==="template"?"scene":null:null}function nu(e){const t=Bee(e);return t||((e==null?void 0:e.t)==="color"?"color":null)}function Uee(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 Rg(e){return(e==null?void 0:e.t)==="ref"||(e==null?void 0:e.t)==="mark"?e.imageHash:null}const s0=e=>{const t=(e??"").trim();return t||void 0},yk=e=>(e==null?void 0:e.custom)===!0;function Ri(e,t){return e==="product"?[...(t.libraryProducts.length?t.libraryProducts:t.brandProducts).map(r=>{var a,i;return wk(r,"brand",jp((i=(a=r.shots)==null?void 0:a[0])==null?void 0:i.file,"tile"))}),...t.demoProducts.map(r=>wk(r,"catalog",r.previewUrl??null))]:e==="presenter"?[...t.presenters.map(n=>{const r=Bo(n);return{kind:"presenter",id:n.id,label:n.name,full:[n.name,s0(n.descriptor)].filter(Boolean).join(" · "),sub:s0(n.descriptor),search:Nh(n),thumb:tr(r.src,"tile"),crop:r.crop,source:yk(n)?"brand":"catalog",recommended:Zee(n,t.productCategory),token:{t:"character",id:n.id}}}),...t.cast.map(n=>{const r=q6(n);return{kind:"presenter",id:n.id,label:n.name,full:n.name,search:n.name,thumb:tr(r.src,"tile"),crop:r.crop,source:"brand",token:{t:"character",id:n.id}}})]:t.scenes.map(n=>({kind:"scene",id:n.id,label:zi(n,"card"),full:zi(n,"tooltip"),sub:s0(n.lighting),search:Ah(n),thumb:tr(n.previewUrl??null,"tile"),tint:yu(n.previewColor),source:yk(n)?"brand":"catalog",recommended:Vee(n,t.productCategory),token:{t:"template",id:n.id}}))}function wk(e,t,n){return{kind:"product",id:e.id,label:oo(e,"chip"),full:oo(e,"tooltip"),sub:Wee(e),search:x4(e),thumb:n,source:t,token:{t:"product",id:e.id}}}function Wee(e){const t=e;return s0(t.brand)??s0(t.vendor)}function wu(e,t){const n=t.trim();return n?e.filter(r=>lo(r.search,n)):e}function bk(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 Wp(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,c=[...wu(a,n.query)].sort((h,p)=>bk(e,h,n.bookmarked)-bk(e,p,n.bookmarked)).map(h=>n.bookmarked.has(h.id)?{...h,bookmarked:!0}:h),{visible:d,remaining:f}=E4(c,n.shown??Mi);return{current:r,items:d,remaining:f,total:c.length}}const Gee={$:"product","/":"scene","@":"presenter"},TN={Products:8,Presenters:8,Colors:16,Scenes:8},$N={$:"Products","/":"Scenes","@":"Presenters","#":"Colors"};function Od(e){return TN[$N[e??"$"]]}function DN(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 Kee(e,t,n){return Wp(e,t,{currentId:null,query:"",bookmarked:n,shown:t.length}).items.map(DN)}function xk(e,t){const{visible:n,remaining:r}=E4(e,t);return{items:n,remaining:r,total:e.length}}function Yee(e,t,n={query:""}){const r=n.query.trim(),a=n.bookmarked??new Set,i=n.shown??TN[$N[e]];if(e==="#"){const h=(t.colors??[]).map(qee),p=r?h.filter(g=>lo(g.search??g.label,r)):h;return xk(p,i)}const c=Gee[e],d=c==="product"?t.products:c==="presenter"?t.presenters:t.scenes??[],f=r?wu(d,r).map(DN):Kee(c,d,a);return xk(f,i)}function qee(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 Xee="(pointer: coarse)";function Qee(e){return sr(da)?o.jsx(rte,{...e}):o.jsx(nte,{...e,onMove:void 0})}function Jee(){return!sr(Xee)}const ete=e=>`Remove ${uf[e]}`;function tte(e,t,n){const r={slug:t};return e==="product"?sa(r,n):e==="presenter"?la(r,n):Hr(r,n)}function ON({kind:e,currentId:t,candidates:n,brandId:r,brandSlug:a,warning:i,note:c,onPick:d,onRemove:f,onClose:h,onAttachRequest:p,onMove:g,autoFocusSearch:v}){const[y,b]=s.useState(""),[x,k]=s.useState(Mi),S=s.useRef(null),E=s.useRef(null),[C,N]=s.useState(0),M=s.useMemo(()=>e==="scene"?new Set(io(r)):new Set,[e,r]);s.useEffect(()=>{k(Mi),N(0)},[y]);const T=s.useMemo(()=>Wp(e,n,{currentId:t,query:y,bookmarked:M,shown:x}),[e,n,t,y,M,x]);s.useLayoutEffect(()=>{var O;v&&((O=S.current)==null||O.focus({preventScroll:!0}))},[v]),s.useEffect(()=>{N(O=>Math.max(0,Math.min(O,T.items.length-1)))},[T.items.length]);const L=s.useCallback(O=>{var I;const Q=(I=E.current)==null?void 0:I.querySelectorAll("[data-nav]")[O];Q&&(N(O),Q.focus({preventScroll:!0}),Q.scrollIntoView({block:"nearest"}))},[]),A=s.useCallback(()=>{const O=E.current;return O?Math.max(1,getComputedStyle(O).gridTemplateColumns.split(" ").filter(Boolean).length):1},[]),P=O=>{var ie;if(O.key==="Escape"){O.preventDefault(),O.stopPropagation(),h("escape");return}const Q=O.target===S.current;if(Q&&O.key==="ArrowDown"){O.preventDefault(),L(0);return}if(Q&&O.key==="Enter"){O.preventDefault(),T.items[0]&&d(T.items[0]);return}if(Q)return;const I=A(),V=O.key==="ArrowRight"?1:O.key==="ArrowLeft"?-1:O.key==="ArrowDown"?I:O.key==="ArrowUp"?-I:0;if(V){O.preventDefault();const B=C+V;B<0&&V===-I?(ie=S.current)==null||ie.focus():B>=0&&B<T.items.length&&L(B);return}O.key==="Home"?(O.preventDefault(),L(0)):O.key==="End"&&(O.preventDefault(),L(T.items.length-1))},$=uf[e],H=e==="product";return o.jsxs("div",{className:"sc-swap-inner",onKeyDown:P,children:[o.jsx("div",{className:"sc-swap-head",children:o.jsxs("span",{className:"sc-swap-search",children:[o.jsx(Nu,{size:13}),o.jsx("input",{ref:S,type:"text",value:y,onChange:O=>b(O.target.value),placeholder:`Search ${$}s`,"aria-label":`Search ${$}s`,autoComplete:"off",spellCheck:!1})]})}),T.current&&o.jsxs("div",{className:"sc-swap-cur",title:T.current.full,children:[o.jsx(kk,{src:T.current.thumb,tinted:!!T.current.tint,crop:T.current.crop}),o.jsxs("span",{className:"sc-swap-curtext",children:[o.jsx("b",{dir:"auto",children:T.current.label}),T.current.sub&&o.jsx("span",{dir:"auto",children:T.current.sub})]}),o.jsx("a",{className:"sc-swap-open",href:tte(e,a,T.current.id),target:"_blank",rel:"noreferrer",title:`Open this ${$} in a new tab`,"aria-label":`Open ${T.current.label} in a new tab`,children:o.jsx(vp,{size:14})}),o.jsx("span",{className:"sc-swap-tick","aria-hidden":!0,children:o.jsx(nr,{size:11,weight:"bold"})})]}),o.jsxs("div",{className:"sc-swap-body",children:[T.items.length===0&&o.jsx("p",{className:"sc-swap-empty",children:y.trim()?`Nothing matches “${y.trim()}”.`:`No other ${$}s.`}),o.jsx("div",{className:"sc-swap-grid",ref:E,role:"listbox","aria-label":`Choose a ${$}`,children:T.items.map((O,Q)=>o.jsxs("div",{className:"sc-swap-card",role:"option","aria-selected":!1,"data-nav":Q,tabIndex:Q===C?0:-1,title:O.full,style:O.tint?{"--tint":O.tint}:void 0,onFocus:()=>N(Q),onClick:()=>d(O),onKeyDown:I=>{I.key!=="Enter"&&I.key!==" "||(I.preventDefault(),d(O))},children:[o.jsx(kk,{src:O.thumb,tinted:!!O.tint,crop:O.crop}),o.jsxs("b",{dir:"auto",children:[O.bookmarked&&o.jsxs(o.Fragment,{children:[o.jsx(yp,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Bookmarked. "})]}),O.label]}),H&&O.sub&&o.jsx("span",{dir:"auto",children:O.sub})]},O.id))}),T.remaining>0&&o.jsxs("button",{type:"button",className:"sc-swap-more",onClick:()=>k(O=>O+Mi),children:["Show ",Math.min(Mi,T.remaining)," more of ",T.total]})]}),o.jsxs("div",{className:"sc-swap-foot",children:[t&&!T.current&&o.jsxs("p",{className:"sc-swap-warn",children:["This ",$," is no longer available."]}),c&&o.jsx("p",{className:"sc-chip-preview-note",children:c}),i&&o.jsx("p",{className:"sc-swap-warn",children:i}),i&&p&&e==="scene"&&o.jsxs("div",{className:"sc-swap-attach",children:[i.includes("product")&&o.jsx("button",{type:"button",className:"sc-btn",onClick:()=>p("Products"),children:"Attach a product"}),i.includes("person")&&o.jsx("button",{type:"button",className:"sc-btn",onClick:()=>p("Presenters"),children:"Attach a presenter"})]}),g&&o.jsxs("div",{className:"sc-swap-move",children:[o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>g(-1),children:[o.jsx(T6,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>g(1),children:["Move later ",o.jsx(Ka,{size:13})]})]}),f&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:f,children:[o.jsx(Sp,{size:13}),ete(e)]})]})]})}function kk({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(Vs,{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 nte(e){const{anchor:t,kind:n,onClose:r}=e,a=Jee(),[i,c]=s.useState(null),d=s.useRef(null);return s.useLayoutEffect(()=>{var h,p;const f=()=>{const g=window.visualViewport,v=S4(t.getBoundingClientRect(),{width:(g==null?void 0:g.width)??window.innerWidth,height:(g==null?void 0:g.height)??window.innerHeight});if(!v){r("outside");return}c(v)};return f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),(h=window.visualViewport)==null||h.addEventListener("resize",f),(p=window.visualViewport)==null||p.addEventListener("scroll",f),()=>{var g,v;window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),(g=window.visualViewport)==null||g.removeEventListener("resize",f),(v=window.visualViewport)==null||v.removeEventListener("scroll",f)}},[t,r]),s.useEffect(()=>{const f=h=>{var g;const p=h.target;(g=d.current)!=null&&g.contains(p)||t.contains(p)||r("outside")};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r,t]),i?Mr.createPortal(o.jsx("div",{ref:d,className:"sc-swap","data-kind":n,"data-side":i.side,role:"dialog","aria-label":`Change ${uf[n]}`,style:EN(i),children:o.jsx(ON,{...e,autoFocusSearch:a})}),document.body):null}function rte(e){const{kind:t,onClose:n}=e,{sheet:r,grip:a}=zu(()=>n("dismiss"));return o.jsx(ec,{open:!0,onOpenChange:i=>!i&&n("dismiss"),children:o.jsxs(tc,{children:[o.jsx(nc,{className:"sc-shotsheet-scrim"}),o.jsxs(rc,{ref:r,className:"sc-shotsheet sc-swapsheet","data-kind":t,"aria-describedby":void 0,onOpenAutoFocus:i=>{var c;i.preventDefault(),(c=r.current)==null||c.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(sc,{className:"sc-vh",children:["Change ",uf[t]]})]}),o.jsx(ON,{...e,autoFocusSearch:!1})]})]})})}const ste=260;function ate(e){return sr(da)?o.jsx(ite,{...e}):o.jsx(ote,{...e,onMove:void 0})}function Bc(e,t){const n=e?Jn(e):null,r=t?Jn(t):null;return!!n&&n===r}function HN({currentHex:e,currentName:t,palette:n,onPick:r,onRemove:a,onClose:i,onMove:c}){const d=s.useMemo(()=>{const S=new Set,E=[],C=M=>{const T=Jn(M.hex);!T||S.has(T)||(S.add(T),E.push({...M,hex:T}))},N=e?Jn(e):null;N&&!n.some(M=>Bc(M.hex,N))&&C({hex:N,name:t||N,slot:"accent"});for(const M of n)C(M);return E},[n,e,t]),f=s.useRef(null),[h,p]=s.useState(()=>Math.max(0,d.findIndex(S=>Bc(S.hex,e))));s.useEffect(()=>{p(S=>Math.max(0,Math.min(S,Math.max(0,d.length-1))))},[d.length]),s.useLayoutEffect(()=>{var E,C;const S=Math.max(0,d.findIndex(N=>Bc(N.hex,e)));(C=(E=f.current)==null?void 0:E.querySelectorAll("[data-nav]")[S])==null||C.focus({preventScroll:!0})},[]);const g=s.useCallback(S=>{var C;const E=(C=f.current)==null?void 0:C.querySelectorAll("[data-nav]")[S];E&&(p(S),E.focus({preventScroll:!0}))},[]),v=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),i("escape");return}if(S.key==="ArrowDown"||S.key==="ArrowUp"){S.preventDefault();const E=h+(S.key==="ArrowDown"?1:-1);E>=0&&E<d.length&&g(E)}},y=S=>r({t:"color",hex:S.hex,name:S.name||void 0}),b=(S,E)=>{const C=d.find(N=>Bc(N.hex,S));r({t:"color",hex:S,name:(C==null?void 0:C.name)||void 0},{live:!0})},x=e?Jn(e):null,k=!!x&&!n.some(S=>Bc(S.hex,x));return o.jsxs("div",{className:"sc-swap-inner",onKeyDown:v,children:[o.jsx("div",{className:"sc-swap-body",children:d.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:d.map((S,E)=>{const C=Bc(S.hex,e),N=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sc-swap-dot",style:{background:S.hex},"aria-hidden":!0}),o.jsx("b",{dir:"auto",children:S.name}),o.jsx("span",{children:S.hex}),C&&o.jsx("span",{className:"sc-swap-tick","aria-hidden":!0,children:o.jsx(nr,{size:11,weight:"bold"})})]});return k&&C?o.jsx(Pu,{className:"sc-swap-swatch",triggerStyle:{background:"none"},value:S.hex,presets:n.map(M=>M.hex),commitMode:"live",align:"start",label:`Edit ${S.name}`,triggerProps:{role:"option","aria-selected":!0,"data-on":"","data-nav":E,tabIndex:E===h?0:-1,title:`${S.name} ${S.hex}`,onFocus:()=>p(E)},onChange:M=>b(M),children:N},"current-custom"):o.jsx("div",{className:"sc-swap-swatch",role:"option","aria-selected":C,"data-on":C||void 0,"data-nav":E,tabIndex:E===h?0:-1,title:`${S.name} ${S.hex}`,onFocus:()=>p(E),onClick:()=>y(S),onKeyDown:M=>{M.key!=="Enter"&&M.key!==" "||(M.preventDefault(),y(S))},children:N},S.hex)})})}),o.jsxs("div",{className:"sc-swap-foot",children:[o.jsxs(Pu,{className:"sc-swap-swatch sc-swap-custom",triggerStyle:{background:"none"},value:e??$p(n),presets:n.map(S=>S.hex),commitMode:"live",align:"start",label:"Custom colour",onChange:S=>b(S),children:[o.jsx(kr,{size:12}),o.jsx("b",{children:"Custom colour"})]}),c&&o.jsxs("div",{className:"sc-swap-move",children:[o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>c(-1),children:[o.jsx(T6,{size:13})," Move earlier"]}),o.jsxs("button",{type:"button",className:"sc-btn",onClick:()=>c(1),children:["Move later ",o.jsx(Ka,{size:13})]})]}),a&&o.jsxs("button",{type:"button",className:"sc-swap-remove",onClick:a,children:[o.jsx(Sp,{size:13}),"Remove colour"]})]})]})}function ote(e){const{anchor:t,onClose:n}=e,[r,a]=s.useState(null),i=s.useRef(null);return s.useLayoutEffect(()=>{var d,f;const c=()=>{const h=window.visualViewport,p=S4(t.getBoundingClientRect(),{width:(h==null?void 0:h.width)??window.innerWidth,height:(h==null?void 0:h.height)??window.innerHeight},{width:ste});if(!p){n("outside");return}a(p)};return c(),window.addEventListener("resize",c),window.addEventListener("scroll",c,!0),(d=window.visualViewport)==null||d.addEventListener("resize",c),(f=window.visualViewport)==null||f.addEventListener("scroll",c),()=>{var h,p;window.removeEventListener("resize",c),window.removeEventListener("scroll",c,!0),(h=window.visualViewport)==null||h.removeEventListener("resize",c),(p=window.visualViewport)==null||p.removeEventListener("scroll",c)}},[t,n]),s.useEffect(()=>{const c=d=>{var h,p;const f=d.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",c),()=>document.removeEventListener("mousedown",c)},[n,t]),r?Mr.createPortal(o.jsx("div",{ref:i,className:"sc-swap","data-kind":"color","data-side":r.side,role:"dialog","aria-label":"Change colour",style:EN(r),children:o.jsx(HN,{...e})}),document.body):null}function ite(e){const{onClose:t}=e,{sheet:n,grip:r}=zu(()=>t("dismiss"));return o.jsx(ec,{open:!0,onOpenChange:a=>!a&&t("dismiss"),children:o.jsxs(tc,{children:[o.jsx(nc,{className:"sc-shotsheet-scrim"}),o.jsxs(rc,{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(sc,{className:"sc-vh",children:"Change colour"})]}),o.jsx(HN,{...e})]})]})})}function df(e){const{brand:t,products:n}=Qt(),{scenes:r,presenters:a,demoProducts:i}=jn(),c=s.useMemo(()=>gh(hc(t),r),[t,r]),d=s.useMemo(()=>gh(rf(t),a),[t,a]),f=s.useMemo(()=>{var p;return(((p=t==null?void 0:t.json)==null?void 0:p.characters)??[]).filter(g=>(g==null?void 0:g.origin)!=="custom")},[t]),h=s.useMemo(()=>{var p;return w0(((p=t==null?void 0:t.json)==null?void 0:p.products)??[])},[t]);return s.useMemo(()=>({libraryProducts:Oj(n),brandProducts:h,demoProducts:i,presenters:d,cast:f,scenes:c,productCategory:e??null}),[n,h,i,d,f,c,e])}const Hd=new Map,lte=64;function IN(e){let t=Hd.get(e);if(!t)for(t=ute(e).then(n=>n?dte(n.data,4):null).catch(()=>null),Hd.set(e,t);Hd.size>lte;)Hd.delete(Hd.keys().next().value);return t}function cte(e,t){IN(t).then(n=>{const r=yu(n??void 0);!r||!e.isConnected||(e.dataset.tinted="true",e.style.setProperty("--tint",r))})}async function ute(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 c=i.getContext("2d",{willReadFrequently:!0});if(!c)return null;c.drawImage(t,0,0,r,a);try{return c.getImageData(0,0,r,a)}catch{return null}}function dte(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],c=e[a+1],d=e[a+2],{h:f,s:h,l:p}=fte(i,c,d);if(h<.18||p<.12||p>.92)continue;const g=h*(1-Math.abs(p-.5)*1.2),v=n[Math.min(23,Math.floor(f/360*24))];v.score+=g,v.r+=i*g,v.g+=c*g,v.b+=d*g}const r=n.reduce((a,i)=>i.score>a.score?i:a,n[0]);return r.score<=0?null:hte(r.r/r.score,r.g/r.score,r.b/r.score)}function fte(e,t,n){const r=e/255,a=t/255,i=n/255,c=Math.max(r,a,i),d=Math.min(r,a,i),f=(c+d)/2;if(c===d)return{h:0,s:0,l:f};const h=c-d,p=f>.5?h/(2-c-d):h/(c+d);let g;return c===r?g=((a-i)/h+(a<i?6:0))*60:c===a?g=((i-r)/h+2)*60:g=((r-a)/h+4)*60,{h:g,s:p,l:f}}function hte(e,t,n){const r=a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function pte(e){return!e||e.cap==null||e.cap<=0?null:e.cap}function mte(e){const t=new Set;if(!e||e.cap==null||e.cap<=0)return t;const n=new Set(e.attachments.map(r=>Ml(r.role,r.id??r.hash)));for(const r of e.dropped){const a=Ml(r.role,r.id??r.hash);r.reason!=="missing"&&!n.has(a)&&t.add(a)}return t}const Ml=(e,t)=>`${e}:${t}`,Yd=new Set(["product","character","ref","mark","template"]),Rh=12,cv=`Shot is full: ${Rh} identities. Remove one to add another.`,Ur=[{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 $u(e){const t=Ur.find(n=>n.id===e);return t?t.w/t.h:1}function gte(e,t=0){var i,c;const n=Ur.find(d=>d.id===(e==null?void 0:e.format));if(n)return n.id;const r=(c=(i=e==null?void 0:e.rendered)==null?void 0:i.sizes)==null?void 0:c[t];if(!r||!(r[0]>0)||!(r[1]>0))return;const a=Math.log(r[0]/r[1]);return Ur.reduce((d,f)=>Math.abs(Math.log(f.w/f.h)-a)<Math.abs(Math.log(d.w/d.h)-a)?f:d).id}const R1=6,vte=s.forwardRef(function({initialTokens:t,onChange:n,brand:r,templates:a,presenters:i,demoProducts:c,onTemplatePick:d,scenesSitOut:f,placeholder:h,placeholderSm:p,label:g="Brief",flag:v,described:y,describedNote:b,onInspect:x,activeProductCategory:k,onAttachRequest:S,onSubmit:E,onDropFiles:C},N){var gt,dt,jt,et,Pt,Sn;const M=s.useRef(null),T=s.useRef(null),L=s.useId(),[A,P]=s.useState(""),$=s.useCallback(U=>{P(""),requestAnimationFrame(()=>P(U))},[]),H=s.useRef(null),[O,Q]=s.useState(null),[I,V]=s.useState(null),ie=Ku(),{shown:B,closeNow:F}=ie,te=s.useRef(I);s.useEffect(()=>{te.current=I},[I]);const X=s.useRef(v);s.useEffect(()=>{X.current=v},[v]);const[Z,K]=s.useState(""),[z,Y]=s.useState(Od("$")),[J,de]=s.useState(null),ae=s.useRef(!1),W=s.useRef(0),[ye,ee]=s.useState(!1),ge=s.useRef(0),{products:re}=Qt(),D=re.length?re:((gt=r.json)==null?void 0:gt.products)??[],G=((dt=r.json)==null?void 0:dt.characters)??[],Pe=s.useMemo(()=>tf(r.json),[r]),Ze=s.useCallback((U,ce)=>{var An,Dt,Zn;const Ce=document.createElement("span");Ce.className=jl,Ce.contentEditable="false",Ce.dir="ltr",Ce.dataset.kind=U.t,Ce.dataset.tok=Hp(U),Ce.dataset.uid=ce??`u${W.current++}`;let ze="",lt=null,mt,_t=null;const It=LN(U,{products:D,demoProducts:c,cast:G,presenters:i,scenes:a});if((It==null?void 0:It.kind)==="scene"){const xt=It.scene;ze=xt?zi(xt,"chip"):"missing template",lt=(xt==null?void 0:xt.previewUrl)??null;const On=yu(xt==null?void 0:xt.previewColor);On&&(Ce.dataset.tinted="true",Ce.style.setProperty("--tint",On)),!On&&lt&&It.custom&&cte(Ce,lt)}else if((It==null?void 0:It.kind)==="product"){const xt=It.product??It.demo;ze=xt?oo(xt,"chip"):"missing product",lt=It.product?jp((Dt=(An=It.product.shots)==null?void 0:An[0])==null?void 0:Dt.file,"micro"):((Zn=It.demo)==null?void 0:Zn.previewUrl)??null}else if((It==null?void 0:It.kind)==="presenter"){const{character:xt,presenter:On}=It;ze=(xt==null?void 0:xt.name)??(On==null?void 0:On.name)??"missing person";const Ot=xt?q6(xt):On?Bo(On):{src:null};lt=tr(Ot.src,"micro"),mt=Ot.crop}else if(U.t==="color")ze=U.name??U.hex,_t=U.hex;else if(U.t==="ref")ze=U.label??"Image",lt=nn(U.imageHash,"micro");else if(U.t==="mark"){const xt=Pe.find(On=>On.hash===U.imageHash);ze=xt?Pp(r.json,xt):"missing mark",lt=nn(U.imageHash,"micro")}if(ze.startsWith("missing ")&&(Ce.dataset.missing=""),lt){const xt=document.createElement("img");xt.src=lt,xt.alt="",mt&&(xt.dataset.crop=mt),xt.onerror=()=>xt.remove(),Ce.appendChild(xt)}else if(_t){const xt=document.createElement("span");xt.className="sc-token-swatch",xt.style.background=_t,Ce.appendChild(xt)}const an=document.createElement("span");an.className="sc-token-label",an.dir="auto",an.textContent=ze,Ce.appendChild(an);const Bt=(v==null?void 0:v(U))??null;Bt&&(Ce.title=Bt,Ce.dataset.warn="1"),y!=null&&y(U)&&(Ce.dataset.described="1");const mn=nu(U);if(mn){const xt=mn==="color"?"colour":uf[mn];Ce.tabIndex=0,Ce.setAttribute("role","button"),Ce.setAttribute("aria-haspopup","dialog"),Ce.setAttribute("aria-expanded","false"),Ce.setAttribute("aria-label",`${xt}: ${ze}. Change or remove.`)}else Ce.tabIndex=0,Ce.setAttribute("role","button"),Ce.setAttribute("aria-haspopup","dialog"),Ce.setAttribute("aria-expanded","false"),Ce.setAttribute("aria-label",`${U.t==="mark"?"brand mark":"reference image"}: ${ze}. Open, remove or move.`);Ce.setAttribute("aria-keyshortcuts","Alt+ArrowLeft Alt+ArrowRight"),Ce.setAttribute("aria-describedby",L),Ce.setAttribute("draggable","false");const on=document.createElement("button");return on.type="button",on.tabIndex=-1,on.setAttribute("aria-hidden","true"),on.dataset.role="remove",on.appendChild(Fq()),Ce.appendChild(on),Ce},[a,D,G,i,c,Pe,r,v,y,L]),He=s.useCallback(()=>{const U=M.current;U&&n(h3(U))},[n]);s.useEffect(()=>{const U=M.current;U&&(p3(U,t!=null&&t.length?t:jo(),ce=>Ze(ce)),Wd(U))},[]);const tt=s.useCallback((U,ce)=>{var lt;const Ce=M.current,ze=Ce==null?void 0:Ce.querySelector(`[data-uid="${CSS.escape(U)}"]`);if(Ce&&ze&&y3(Ce,ze,ce)){Ll(Ce,ze,"after");const mt=Eo(Ce);mt!==null&&(H.current=mt,((lt=te.current)==null?void 0:lt.uid)===U&&(te.current={...te.current,caret:mt}),V(_t=>_t&&_t.uid===U?{..._t,caret:mt}:_t)),He(),$(ev(Ce,ze))}},[He,$]);s.useEffect(()=>{const U=M.current;if(U)return iee(U,{onDragStart:()=>{Q(null),K(""),F()},onMoved:(ce,Ce)=>{He(),$(Ce)},onCancelled:()=>$("Reorder cancelled.")})},[He,$,F]),s.useEffect(()=>{const U=M.current;if(U)for(const ce of U.querySelectorAll(`.${jl}`)){const Ce=Qr(ce.dataset.tok??"");if(!Ce)continue;const ze=(v==null?void 0:v(Ce))??null;ze?ce.dataset.warn="1":delete ce.dataset.warn,y!=null&&y(Ce)?ce.dataset.described="1":delete ce.dataset.described,ze&&!("open"in ce.dataset)?ce.title=ze:ce.removeAttribute("title")}},[v,y]),s.useEffect(()=>{const U=()=>{const ce=Eo(M.current);ce!==null&&(H.current=ce)};return document.addEventListener("selectionchange",U),()=>document.removeEventListener("selectionchange",U)},[]);const oe=s.useCallback(U=>{const ce=M.current;if(!ce)return;if(U.t==="template"){const mt=Rd(ce);if(mt){mt.replaceWith(Ze(U,mt.dataset.uid)),Ya(ce),He(),Q(null),K("");return}}const Ce=ja(U);if(Ce){const mt=mg(ce,Ce);if(mt){Q(null),K(""),$(`${Ao(mt)||"That"} is already in the brief.`);return}}if(Yd.has(U.t)&&!(U.t==="template"&&Rd(ce))&&Array.from(ce.querySelectorAll(`.${jl}`)).filter(_t=>Yd.has(_t.dataset.kind??"")).length>=Rh){Q(null),K(""),$(cv);return}bq(ce,Ze(U),{eatQuery:!!O,fallbackUnits:H.current});const lt=Eo(ce);lt!==null&&(H.current=lt),He(),Q(null),K("")},[O,Ze,He,$]),he=s.useRef(oe);s.useEffect(()=>{he.current=oe},[oe]);const Ae=s.useCallback((U,ce)=>{const Ce=M.current,ze=Ce==null?void 0:Ce.querySelector(`[data-uid="${CSS.escape(U)}"]`);return!Ce||!ze?!1:(ze.replaceWith(Ze(ce,U)),Ya(Ce),He(),!0)},[Ze,He]),ue=s.useCallback(U=>{const ce=M.current,Ce=ce==null?void 0:ce.querySelector(`[data-uid="${CSS.escape(U)}"]`);if(!ce||!Ce)return null;const ze=Uo(ce,Ce);return gg(ce,Ce),He(),ze},[He]),ke=()=>{var U;return document.documentElement.dataset.guideTask==="first-shot"&&!!((U=M.current)!=null&&U.closest('[data-guide="compose"]'))},qe=(U,ce)=>{var mt;const Ce=[...U.querySelectorAll(".sc-token")];if(!Ce.length)return!1;const[ze]=((mt=ce.getTargetRanges)==null?void 0:mt.call(ce))??[];if(!ze)return!1;const lt=document.createRange();return lt.setStart(ze.startContainer,ze.startOffset),lt.setEnd(ze.endContainer,ze.endOffset),Ce.some(_t=>lt.intersectsNode(_t))},Ve=s.useRef(ue);s.useEffect(()=>{Ve.current=ue},[ue]),s.useEffect(()=>{const U=M.current;if(!U)return;const ce=Ce=>{if(Ce.inputType.startsWith("delete")&&ke()&&qe(U,Ce))return Ce.preventDefault();const ze=Ce.inputType==="deleteContentBackward"?"Backspace":Ce.inputType==="deleteContentForward"?"Delete":null;if(!ze)return;const lt=m3(U,ze);if(!(lt!=null&&lt.dataset.uid)){g3(U,ze)&&Ce.preventDefault();return}Ce.preventDefault();const mt=Ve.current(lt.dataset.uid);mt!=null&&Sa(U,mt)};return U.addEventListener("beforeinput",ce),()=>U.removeEventListener("beforeinput",ce)},[]);const Xe=s.useCallback(U=>{const ce=Qr(U.dataset.tok??"");if(!ce||ce.t!=="ref"&&ce.t!=="mark")return!1;const Ce=M.current,ze=Ce?Eo(Ce):null;return ze!=null&&(H.current=ze),F(),x==null||x({src:Dr(ce.imageHash),kind:ce.t,label:ce.t==="mark"?Ao(U):null}),!0},[x,F]),Re=s.useCallback((U,ce,Ce,ze)=>{const lt=U.dataset.uid;lt&&(F(),U.dataset.open="",U.hasAttribute("aria-haspopup")&&U.setAttribute("aria-expanded","true"),U.removeAttribute("title"),Q(null),K(""),V({uid:lt,kind:ce,anchor:U,caret:Ce,touch:ze}))},[F]),Ie=s.useCallback((U,ce)=>{var _t;const Ce=te.current;if(te.current=null,V(null),!Ce)return;const ze=M.current,lt=ze==null?void 0:ze.querySelector(`[data-uid="${CSS.escape(Ce.uid)}"]`);if(lt){delete lt.dataset.open,lt.hasAttribute("aria-haspopup")&&lt.setAttribute("aria-expanded","false");const It=Qr(lt.dataset.tok??""),an=It?((_t=X.current)==null?void 0:_t.call(X,It))??null:null;an&&(lt.title=an)}const mt=ce!==void 0?ce:Ce.caret;if(Ce.touch){mt!=null&&(H.current=mt);return}ze&&(ze.focus({preventScroll:!0}),mt!=null?Sa(ze,mt):Al(ze))},[]);s.useEffect(()=>{if(!I)return;const U=M.current;U!=null&&U.querySelector(`[data-uid="${CSS.escape(I.uid)}"]`)||Ie("outside")},[I,Ie]),s.useEffect(()=>{var U;B&&((U=M.current)!=null&&U.contains(B.anchor)||F())},[B,F]),s.useEffect(()=>{const U=B==null?void 0:B.anchor;if(!U)return;U.dataset.open="";const ce=U.getAttribute("title");return ce&&U.removeAttribute("title"),()=>{delete U.dataset.open,ce&&U.setAttribute("title",ce)}},[B]),s.useImperativeHandle(N,()=>({insert:U=>he.current(U),setTokens:U=>{const ce=M.current;ce&&(p3(ce,U.length?U:jo(),Ce=>Ze(Ce)),Wd(ce),n(h3(ce)))},removeTemplate:()=>{const U=M.current,ce=U?Rd(U):null;!U||!ce||(gg(U,ce),He())},remove:U=>{const ce=M.current;if(!ce)return;const Ce=mg(ce,ja(U));Ce&&(gg(ce,Ce),He())},openMenu:U=>{K(""),Y(Od("$")),Q({anchor:U})},focus:()=>Al(M.current),restoreCaret:()=>{const U=M.current;if(!U)return;U.focus({preventScroll:!0});const ce=H.current;ce!=null?Sa(U,ce):Al(U)}}));const st=df(k),Ye=s.useCallback(U=>Ri(U,st),[st]),$e=s.useMemo(()=>new Set(io(r.id)),[r.id]),Qe=s.useMemo(()=>{var U;return O?Yee(O.sigil??"$",{products:Ri("product",st),presenters:Ri("presenter",st),scenes:f?[]:Ri("scene",st),colors:Ls((U=r.json)==null?void 0:U.palette)},{query:Z,bookmarked:$e,shown:z}):{items:[],remaining:0,total:0}},[O,st,Z,$e,z,f,(jt=r.json)==null?void 0:jt.palette]),Fe=s.useMemo(()=>Qe.items.map(U=>({...U,run:()=>U.token.t==="template"?d(U.token.id):he.current(U.token)})),[Qe.items,d]),yt=s.useCallback(()=>{Qe.remaining<=0||Y(U=>U+Od(O==null?void 0:O.sigil))},[Qe.remaining,O==null?void 0:O.sigil]),ht=U=>{const ce=M.current,Ce=U.target;if(Ce.closest('[data-role="remove"]')){if(U.preventDefault(),ke())return;const an=bi(Ce);I&&(an==null?void 0:an.dataset.uid)===I.uid&&Ie("remove"),an!=null&&an.dataset.uid&&ue(an.dataset.uid),Q(null);return}const ze=bi(Ce),lt=ze==null?void 0:ze.getBoundingClientRect();if(!(!!ze&&!!lt&&U.clientX-lt.left>R1&&lt.right-U.clientX>R1)){if(pq(ce))return;v3(ce,U.clientX,U.clientY);return}v3(ce,U.clientX,U.clientY);const _t=ze.dataset.uid??null;if(_t&&(I==null?void 0:I.uid)===_t){U.detail!==0&&Ie("outside");return}const It=nu(Qr(ze.dataset.tok??""));if(!It){Xe(ze);return}Re(ze,It,Eo(ce),!1)},yn=U=>{if(U.pointerType!=="mouse")return;const ce=M.current;if(I||O||ce&&"chipDrag"in ce.dataset)return;const Ce=bi(U.target),ze=Ce==null?void 0:Ce.dataset.uid;if(!Ce||!ze||!Oe(Ce)){ie.close();return}if((B==null?void 0:B.uid)===ze){ie.keep();return}ie.open({uid:ze,anchor:Ce})},Oe=U=>{const ce=Qr(U.dataset.tok??"");if(Rg(ce))return!0;const Ce=nu(ce);return!!(Ce&&Ce!=="color"&&J1(Ce)&&U.querySelector("img"))},wt=U=>{const ce=bi(U.target),Ce=ce==null?void 0:ce.dataset.uid;!ce||!Ce||I||O||Oe(ce)&&Lp(ce)&&ie.open({uid:Ce,anchor:ce})},pt=U=>{if(U.pointerType==="mouse")return;const ce=U.target;if(ce.closest('[data-role="remove"]'))return;const Ce=bi(ce);if(!Ce)return;const ze=Ce.getBoundingClientRect();if(U.clientX-ze.left<=R1||ze.right-U.clientX<=R1)return;const lt=Uee(Qr(Ce.dataset.tok??""));if(!lt||Ce.dataset.uid&&(I==null?void 0:I.uid)===Ce.dataset.uid)return;U.preventDefault();const mt=M.current,_t=document.activeElement===mt,It=_t?Eo(mt):H.current;_t&&(mt==null||mt.blur()),Re(Ce,lt,It,!0)},Nt=U=>{const ce=M.current,Ce=bi(U.target);if(Ce&&!I){const ze=()=>{Ll(ce,Ce,"after"),ce==null||ce.focus({preventScroll:!0})};if(U.altKey&&(U.key==="ArrowLeft"||U.key==="ArrowRight")){U.preventDefault(),ce&&y3(ce,Ce,U.key==="ArrowLeft"?-1:1)&&(Ce.focus({preventScroll:!0}),He(),$(ev(ce,Ce)));return}if(U.key==="ArrowLeft"||U.key==="ArrowRight"){U.preventDefault(),Ll(ce,Ce,U.key==="ArrowLeft"?"before":"after"),ce==null||ce.focus({preventScroll:!0});return}if(U.key==="Tab"){U.preventDefault(),Ll(ce,Ce,U.shiftKey?"before":"after"),ce==null||ce.focus({preventScroll:!0});return}if(U.key==="Enter"||U.key===" "){U.preventDefault();const lt=nu(Qr(Ce.dataset.tok??""));lt&&ce?Re(Ce,lt,Uo(ce,Ce)+1,!1):Xe(Ce);return}if(U.key==="Backspace"||U.key==="Delete"){if(U.preventDefault(),ke())return;const lt=Ce.dataset.uid?ue(Ce.dataset.uid):null;ce==null||ce.focus({preventScroll:!0}),lt!=null&&Sa(ce,lt);return}if(U.key==="Escape"){U.preventDefault(),ze();return}}if(U.key==="Escape"&&O){U.preventDefault(),Q(null),K("");return}if(U.key==="Enter"&&!U.shiftKey){const ze=U.defaultPrevented;U.preventDefault(),kee({menuOpen:!!O,handled:ze})&&E();return}if(!(O||I)&&!wee(U)){if(!U.shiftKey&&!U.altKey&&!U.metaKey&&!U.ctrlKey){if(U.key==="ArrowLeft"||U.key==="ArrowRight"){yq(ce,U.key==="ArrowLeft"?"left":"right")&&U.preventDefault();return}if(U.key==="Backspace"||U.key==="Delete"){const ze=m3(ce,U.key);if(ze!=null&&ze.dataset.uid){if(U.preventDefault(),ke())return;const lt=ue(ze.dataset.uid);lt!=null&&Sa(ce,lt);return}if(g3(ce,U.key)){U.preventDefault();return}}}if((U.key==="$"||U.key==="/"||U.key==="@"||U.key==="#")&&!ke()){const ze=M.current,lt=CA(ze),mt=lt.slice(-1);if(lt.length&&!/[\s\u00a0]/.test(mt))return;K(""),Y(Od(U.key)),Q({anchor:{getBoundingClientRect:()=>jA()??(ze==null?void 0:ze.getBoundingClientRect())??new DOMRect},sigil:U.key})}}},Ct=s.useCallback(U=>{var ce,Ce;return(Ce=Ls((ce=r.json)==null?void 0:ce.palette).find(ze=>ze.hex===U))==null?void 0:Ce.name},[(et=r.json)==null?void 0:et.palette]),$t=s.useCallback(()=>{requestAnimationFrame(()=>{const U=T.current;if(!U)return;U.scrollHeight-U.scrollTop-U.clientHeight>1?U.dataset.more="":delete U.dataset.more})},[]);s.useEffect(()=>{const U=T.current;if(!U)return;$t();const ce=new ResizeObserver($t);ce.observe(U);for(const Ce of U.children)ce.observe(Ce);return()=>ce.disconnect()},[$t]);const Yt=U=>{$t();const ce=M.current,Ce=U==null?void 0:U.nativeEvent;if(Ce!=null&&Ce.isComposing)return;mq(ce)||Ya(ce),Wd(ce)&&Al(ce);const ze=ae.current;ae.current=!1;const lt=vg(ce,_t=>Ze(_t),{commit:ze,nameFor:Ct});lt&&(Q(null),K(""));const mt=lt?{open:!1}:See(Sq(ce),ze);mt.open?O&&(mt.query!==Z&&Y(Od(mt.sigil)),K(mt.query)):O&&(Q(null),K("")),He()},Vn=U=>{const ce=window.getSelection();if(!ce||ce.rangeCount===0||ce.isCollapsed)return null;const Ce=ce.getRangeAt(0),{text:ze,html:lt}=Cq(Ce);return ze?(U.clipboardData.setData("text/plain",ze),U.clipboardData.setData("text/html",lt),U.preventDefault(),Ce):null},pn=U=>{Vn(U)},ar=U=>{const ce=Vn(U);ce&&(ce.deleteContents(),Ya(M.current),He())},bt=s.useCallback(U=>U.t==="template"?a.some(ce=>ce.id===U.id):U.t==="product"?D.some(ce=>ce.id===U.id)||c.some(ce=>ce.id===U.id):U.t==="character"?G.some(ce=>ce.id===U.id)||i.some(ce=>ce.id===U.id):U.t==="mark"?Pe.some(ce=>ce.hash===U.imageHash):!0,[a,D,G,i,c,Pe]);s.useEffect(()=>{const U=M.current;if(U)for(const ce of U.querySelectorAll(`.${jl}[data-missing]`)){const Ce=Qr(ce.dataset.tok??"");Ce&&bt(Ce)&&ce.replaceWith(Ze(Ce,ce.dataset.uid))}},[bt,Ze]);const kt=U=>{Array.from(U.dataTransfer.types).includes("Files")&&(U.preventDefault(),ge.current++,ee(!0))},sn=U=>U.preventDefault(),Ut=()=>{ge.current=Math.max(0,ge.current-1),ge.current===0&&ee(!1)},Tn=U=>{U.preventDefault(),ge.current=0,ee(!1),U.dataTransfer.files.length&&(C==null||C(U.dataTransfer.files))},Vt=U=>{U.preventDefault();const ce=U.clipboardData.files;if(ce.length&&Array.from(ce).some(lt=>lt.type.startsWith("image/"))){C==null||C(ce);return}ae.current=!0;const Ce=Aq(U.clipboardData.getData("text/html"));if(Ce&&ne(Ce)){const lt=M.current;vg(lt,mt=>Ze(mt),{commit:!0,nameFor:Ct})&&He();return}const ze=U.clipboardData.getData("text/plain");ze&&document.execCommand("insertText",!1,ze)},ne=U=>{const ce=M.current,Ce=window.getSelection();if(!ce||!Ce||Ce.rangeCount===0||!ce.contains(Ce.getRangeAt(0).startContainer))return!1;const ze=Ce.getRangeAt(0);ze.deleteContents();let lt=!1,mt=Array.from(ce.querySelectorAll(`.${jl}`)).filter(Dt=>Yd.has(Dt.dataset.kind??"")).length,_t=!1;const It=new Set,an=[];for(const Dt of U){if(typeof Dt=="string"){an.push(Dt);continue}if(!bt(Dt)){an.push(bte(Dt,a,D));continue}if(Dt.t==="template"){if(lt)continue;lt=!0}const Zn=ja(Dt);if(Zn){if(It.has(Zn)||mg(ce,Zn))continue;It.add(Zn)}if(Yd.has(Dt.t)&&!(Dt.t==="template"&&Rd(ce))){if(mt>=Rh){_t=!0;continue}mt+=1}an.push(Dt)}_t&&$(cv);const Bt=lt?Rd(ce):null,mn=document.createDocumentFragment();for(const Dt of an)mn.appendChild(typeof Dt=="string"?document.createTextNode(Dt):Ze(Dt));const on=mn.lastChild;ze.insertNode(mn),Bt&&Bt.remove();const An=on?on.nodeType===Node.TEXT_NODE?xh(ce,on,on.length):xh(ce,ce,Array.from(ce.childNodes).indexOf(on)+1):Eo(ce)??0;return Ya(ce),Sa(ce,An),He(),!0},se=s.useCallback(()=>{requestAnimationFrame(()=>{const U=M.current;U&&document.activeElement===U&&Wd(U)&&Al(U)})},[]),pe=I?Qr(I.anchor.dataset.tok??""):null,ve=Rg(pe),Ee=pe?(v==null?void 0:v(pe))??null:null,We=pe&&(y!=null&&y(pe))?b??null:null,Ke=B?Qr(B.anchor.dataset.tok??""):null,Ue=Rg(Ke),Be=((Pt=B==null?void 0:B.anchor.querySelector("img"))==null?void 0:Pt.getAttribute("src"))??null,ot=Ue?nn(Ue,"tile"):tr(Be,"tile"),rt=nu(Ke),me=Ke&&J1(Ke.t)?Ke.t:rt&&rt!=="color"&&J1(rt)?rt:null,q=Ke?(v==null?void 0:v(Ke))??null:null,Te=Ke&&(y!=null&&y(Ke))?b??null:null,je=ke()?void 0:()=>{if(!I)return;const U=ue(I.uid);Ie("remove",U)};return o.jsxs("div",{className:"sc-brief",ref:T,onScroll:$t,"data-drag-over":ye||void 0,children:[o.jsx("span",{id:L,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:A}),o.jsx("div",{ref:M,className:"sc-brief-line",contentEditable:!0,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-autocomplete":"list","aria-expanded":O?!0:void 0,"aria-controls":O?Kd:void 0,"aria-activedescendant":O?J??void 0:void 0,"aria-label":g,"aria-placeholder":h,tabIndex:0,dir:"auto","data-ph":h,...p?{"data-ph-sm":p}:{},onClick:ht,onPointerDown:pt,onPointerOver:yn,onPointerLeave:U=>U.pointerType==="mouse"&&ie.close(),onFocusCapture:wt,onKeyDown:Nt,onInput:Yt,onCopy:pn,onCut:ar,onPaste:Vt,onDragEnter:kt,onDragOver:sn,onDragLeave:Ut,onDrop:Tn,onFocus:se,onBlur:()=>{const U=M.current;vg(U,ce=>Ze(ce),{commit:!0,nameFor:Ct})&&(Q(null),K("")),He()}}),O&&o.jsx(Hee,{anchor:O.anchor,composer:{getBoundingClientRect:()=>{var U,ce,Ce;return((ce=(U=M.current)==null?void 0:U.closest(".sc-promptcard"))==null?void 0:ce.getBoundingClientRect())??((Ce=M.current)==null?void 0:Ce.getBoundingClientRect())??new DOMRect}},line:{getBoundingClientRect:()=>{var U;return((U=M.current)==null?void 0:U.getBoundingClientRect())??new DOMRect}},query:Z,options:Fe,remaining:Qe.remaining,total:Qe.total,sigil:O.sigil,onMore:yt,onActiveId:de,onClose:()=>{Q(null),K("")}}),B&&ot&&me&&o.jsx(Gu,{anchor:B.anchor,kind:me,src:ot,label:Ao(B.anchor),warning:q,note:Te,onOpen:()=>{const U=B.anchor;if(Ue){Xe(U);return}F(),x==null||x({src:ot,kind:me,label:Ao(U)})},onHoverIn:ie.keep,onHoverOut:ie.close,onClose:F},B.uid),(I==null?void 0:I.kind)==="ref"||(I==null?void 0:I.kind)==="mark"?o.jsx(lee,{kind:I.kind,label:Ao(I.anchor),thumb:ve?nn(ve,"micro"):null,onInspect:()=>Xe(I.anchor),onMove:U=>tt(I.uid,U),onRemove:je,onClose:Ie},I.uid):(I==null?void 0:I.kind)==="color"?o.jsx(ate,{anchor:I.anchor,currentHex:P1(I.anchor),currentName:yte(I.anchor),palette:Ls((Sn=r.json)==null?void 0:Sn.palette),onPick:(U,ce)=>{var ze;const Ce=I.uid;if(ce!=null&&ce.live){const lt=(ze=M.current)==null?void 0:ze.querySelector(`[data-uid="${CSS.escape(Ce)}"]`);lt&&$q(lt,U),He();return}if(wte(U.hex,P1(I.anchor))){Ie("pick");return}Ae(Ce,U),Ie("pick")},onRemove:je,onMove:U=>tt(I.uid,U),onClose:Ie},I.uid):I?o.jsx(Qee,{kind:I.kind,anchor:I.anchor,currentId:P1(I.anchor),candidates:Ye(I.kind),brandId:r.id,brandSlug:r.slug,warning:Ee,note:We,onAttachRequest:S?U=>{Ie("outside"),S(U)}:void 0,onPick:U=>{const ce=I.uid;if(U.id===P1(I.anchor)){Ie("pick");return}U.kind==="scene"?d(U.id):Ae(ce,U.token),Ie("pick")},onRemove:je,onMove:U=>tt(I.uid,U),onClose:Ie},I.uid):null]})});function P1(e){const t=Qr(e.dataset.tok??"");return t?t.t==="color"?t.hex:"id"in t?t.id:null:null}function yte(e){const t=Qr(e.dataset.tok??"");return(t==null?void 0:t.t)==="color"?t.name:void 0}function wte(e,t){const n=e?Jn(e):null,r=t?Jn(t):null;return!!n&&n===r}function bte(e,t,n){var r,a;return e.t==="template"?((r=t.find(i=>i.id===e.id))==null?void 0:r.name)??"template":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 L1(e,t){return t===null?e===null:e===t}function C4({"aria-label":e,activeKey:t,items:n,onSelect:r}){const a=s.useRef(null),i=s.useRef(null),c=n.map(p=>`${p.value??""}:${p.count??""}`).join("|");s.useLayoutEffect(()=>{const p=a.current,g=i.current;if(!p||!g)return;let v=0;const y=()=>{const N=g.querySelector(":scope > button[data-on]");if(!N)return g.style.setProperty("--sc-ink-x","0px"),g.style.setProperty("--sc-ink-w","0px"),null;const M=N.querySelector(".sc-vlabel")??N;return g.style.setProperty("--sc-ink-x",`${N.offsetLeft+M.offsetLeft}px`),g.style.setProperty("--sc-ink-w",`${M.offsetWidth}px`),N},b=()=>{const N=g.scrollWidth-g.clientWidth;if(N<=1){delete p.dataset.overflowLeft,delete p.dataset.overflowRight;return}g.scrollLeft>2?p.dataset.overflowLeft="":delete p.dataset.overflowLeft,g.scrollLeft<N-2?p.dataset.overflowRight="":delete p.dataset.overflowRight},x=N=>{const M=g.scrollWidth-g.clientWidth;if(M<=0)return;const T=[...g.querySelectorAll(":scope > button")],L=T.indexOf(N);if(L<0)return;const A=72,P=g.scrollLeft,$=P+g.clientWidth,H=T[L-1],O=T[L+1],Q=O?O.offsetLeft+Math.min(A,O.offsetWidth):N.offsetLeft+N.offsetWidth+8,I=H?Math.max(0,H.offsetLeft+H.offsetWidth-A):Math.max(0,N.offsetLeft-8);let V=P;if(Q>$)V=Math.min(M,Q-g.clientWidth);else if(I<P)V=I;else return;if(Math.abs(V-P)<1)return;const ie=window.matchMedia("(prefers-reduced-motion: reduce)").matches;g.scrollTo({left:V,behavior:ie?"auto":"smooth"})},k=y();k&&x(k),b(),g.dataset.inkReady||requestAnimationFrame(()=>{g.dataset.inkReady=""});const S=()=>{v||(v=requestAnimationFrame(()=>{v=0,b()}))},E=N=>{if(g.scrollWidth<=g.clientWidth+1||Math.abs(N.deltaX)>Math.abs(N.deltaY)||N.deltaY===0)return;const M=g.scrollWidth-g.clientWidth,T=Math.max(0,Math.min(M,g.scrollLeft+N.deltaY));T!==g.scrollLeft&&(N.preventDefault(),g.scrollLeft=T,b())},C=new ResizeObserver(()=>{y(),b()});return C.observe(g),g.addEventListener("scroll",S,{passive:!0}),g.addEventListener("wheel",E,{passive:!1}),()=>{v&&cancelAnimationFrame(v),C.disconnect(),g.removeEventListener("scroll",S),g.removeEventListener("wheel",E)}},[t,c]);const d=p=>{L1(t,p)||r(p)},f=p=>{var b;if(p.key!=="ArrowLeft"&&p.key!=="ArrowRight"&&p.key!=="Home"&&p.key!=="End"||n.length===0)return;p.preventDefault();const g=Math.max(0,n.findIndex(x=>L1(t,x.value)));let v=g;if(p.key==="ArrowRight"?v=Math.min(n.length-1,g+1):p.key==="ArrowLeft"?v=Math.max(0,g-1):p.key==="Home"?v=0:p.key==="End"&&(v=n.length-1),v===g)return;d(n[v].value);const y=(b=i.current)==null?void 0:b.querySelectorAll(":scope > button")[v];y==null||y.focus()},h=n.findIndex(p=>L1(t,p.value));return o.jsx("div",{ref:a,className:"sc-verticals-shell",children:o.jsxs("div",{ref:i,className:"sc-verticals",role:"tablist","aria-label":e,onKeyDown:f,children:[o.jsx("span",{className:"sc-verticals-ink","aria-hidden":!0}),n.map((p,g)=>{const v=L1(t,p.value);return o.jsxs("button",{type:"button",role:"tab","aria-selected":v,"data-on":v?"":void 0,tabIndex:v||h<0&&g===0?0:-1,onClick:()=>d(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 Yu({value:e,onChange:t,noun:n,total:r,shortcut:a=!0}){const i=s.useRef(null),[c,d]=s.useState(e.trim().length>0),f=s.useCallback(()=>{var p;Mr.flushSync(()=>d(!0)),(p=i.current)==null||p.focus()},[]);s.useEffect(()=>{e.trim().length>0&&d(!0)},[e]),s.useEffect(()=>{if(!a)return;const p=g=>{if(g.key!=="/"||g.metaKey||g.ctrlKey||g.altKey)return;const v=g.target;v!=null&&v.isContentEditable||v&&/^(input|textarea|select)$/i.test(v.tagName)||(g.preventDefault(),f())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[f,a]);const h=p=>{var g;p.key==="Escape"&&(p.stopPropagation(),e?t(""):(d(!1),(g=i.current)==null||g.blur()))};return o.jsxs("div",{className:"sc-libsearch","data-open":c?"":void 0,children:[o.jsx("button",{type:"button",className:"sc-libsearch-toggle","aria-label":`Search ${n}`,"aria-expanded":c,tabIndex:c?-1:0,onClick:f,children:o.jsx(Nu,{size:16})}),o.jsxs("div",{className:"sc-libsearch-field",children:[o.jsx(Nu,{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:c?0:-1,onChange:p=>t(p.target.value),onKeyDown:h,onBlur:()=>{e.trim()||d(!1)}}),o.jsx("button",{type:"button",className:"sc-libsearch-clear","aria-label":"Clear search",hidden:!e,tabIndex:e?0:-1,onMouseDown:p=>p.preventDefault(),onClick:()=>{var p;t(""),(p=i.current)==null||p.focus()},children:o.jsx(Cn,{size:12,weight:"bold"})})]})]})}function FN({why:e,children:t}){return e?o.jsx(L6,{content:e,className:"sc-tip",maxWidth:"220px",children:Tj(t)}):t}const xte=["All","Products","Presenters","Scenes","Colors","Brand","Shots"],Ph=xte.filter(e=>e!=="All"),Sk={Products:"Products",Presenters:"Presenters",Scenes:"Scenes",Colors:"Brand colors",Brand:"Brand marks",Shots:"Shots"},kte={Products:"Product",Presenters:"Presenter",Scenes:"Scene",Colors:"Brand color",Brand:"Brand mark",Shots:"Reference shot"},uv={Products:"products",Presenters:"presenters",Scenes:"scenes",Colors:"brand colors",Brand:"brand marks",Shots:"shots"},Ste={Products:"square",Presenters:"square",Scenes:"square",Colors:"swatch",Brand:"square",Shots:"square"},_N={Products:132,Presenters:132,Scenes:132,Colors:132,Brand:132,Shots:132},dv={Products:96,Presenters:96,Scenes:96,Colors:96,Brand:96,Shots:96},Ek=10;function Ete(e,t,n){const r=(n?dv:_N)[e];return r<=0||t<=0?1:Math.max(1,Math.floor((t+Ek)/(r+Ek)))}const Cte={product:"Products",presenter:"Presenters",scene:"Scenes"};function jte(e){const t=Cte[e.kind];return{key:ja(e.token),group:t,shape:Ste[t],label:e.label,sub:e.kind==="product"?e.sub:void 0,full:e.recommended?`${e.full} · Recommended`:e.full,search:e.search,thumb:tr(e.thumb??null,"small"),crop:e.crop,recommended:e.recommended,bookmarked:e.bookmarked,token:e.token}}function Ate(e){const t=tf(e).map(r=>{const a=r.hash,i=Pp(e,r);return{key:`m:${a}`,group:"Brand",shape:"square",label:i,full:`${i} · the mark itself`,search:i,thumb:nn(a,"micro"),token:{t:"mark",imageHash:a}}}),n=Ls(e==null?void 0:e.palette).map(r=>{const a={t:"color",hex:r.hex,name:r.name};return{key:ja(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 Nte(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:nn(n.images[0],"micro"),token:{t:"ref",imageHash:n.images[0],label:"Shot"}}})}const Ck=(e,t)=>lo(`${e.label} ${e.sub??""} ${e.search}`,t),VN=`
102
+ `;function Mte(e){return e.map(ja).filter(t=>t.length>0).join(VN)}function Rte(e){return new Set(e?e.split(VN):[])}const Pte=new Set(["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"]);function Lte(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),c=r.findIndex(p=>e>=p.start&&e<=p.end),d=r[c]??{start:0,end:a-1},f=(e-d.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<=d.end)return e+i;if(e<h(d))return d.end;const p=r[c+1];return p?p.start+Math.min(f,p.end-p.start):null}case"ArrowUp":{if(e-i>=d.start)return e-i;const p=r[c-1];return p?Math.min(p.end,h(p)+f):"search"}}}function Tte(e,t){const n=t.trim();return e==="All"?n?`Nothing matches “${n}”.`:"Nothing to add yet.":n?`No matching ${uv[e]}.`:e==="Shots"?"No finished shots yet.":`No ${uv[e]} yet.`}function $te(e){return[{value:null,label:"All",count:Ph.reduce((n,r)=>n+e[r],0)},...Ph.map(n=>({value:n,label:n,count:e[n]}))]}const Dte=s.memo(function({card:t,index:n,active:r,ticked:a,why:i,onPick:c,onFocus:d}){const f=g=>{(g.key==="Enter"||g.key===" ")&&g.stopPropagation()},h=i&&!a?i:null,p=o.jsxs("button",{type:"button",className:"sc-ap-card","data-shape":t.shape,"data-group":t.group,"data-nav":n,"data-on":a?"":void 0,tabIndex:r?0:-1,"aria-disabled":h?!0:void 0,"aria-pressed":a,title:h??(a?`${t.label} is in the shot. Press to remove it.`:t.full),onClick:h?void 0:()=>c(n),onFocus:()=>d(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(Ote,{src:t.thumb,crop:t.crop}),o.jsxs("span",{className:"sc-ap-cap",children:[o.jsxs("span",{className:"sc-vh",children:[kte[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(kr,{className:"sc-ap-puck-add",size:11,weight:"bold"}),o.jsx(nr,{className:"sc-ap-puck-on",size:11,weight:"bold"}),o.jsx(Cn,{className:"sc-ap-puck-off",size:11,weight:"bold"})]}),a&&o.jsx("span",{className:"sc-vh",children:" In the shot."})]});return o.jsx(FN,{why:h,children:p})});function Ote({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(Vs,{size:16}):o.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async","data-crop":t,onError:()=>r(!0)})})}function jk({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(H6,{size:22,"aria-hidden":!0})}),o.jsx("span",{className:"sc-ap-cap",children:o.jsx("b",{children:"Upload image"})})]})}const Hte=48,Ite={items:[],total:0,hasMore:!1,loading:!1,settled:!1,error:null,loadMore:()=>{}};function j4(e,t,n=!0){const r=t.trim(),{shotsEpoch:a,subscribeActivity:i}=Qt(),c=`${e}|${r}|${a}`,[d,f]=s.useState({key:"",items:[],next:null,total:0}),[h,p]=s.useState(!1),[g,v]=s.useState(null),y=s.useRef(null),b=s.useCallback(async S=>{var C;(C=y.current)==null||C.abort();const E=new AbortController;y.current=E,p(!0),v(null);try{const N=await Me.feed(e,{lens:"all",sort:"newest",q:r,limit:Hte,cursor:S??void 0},E.signal);if(E.signal.aborted)return;f(M=>{var L;const T=S===null||M.key!==c;return{key:c,items:T?N.items:[...M.items,...N.items],next:N.next,total:((L=N.counts)==null?void 0:L.all)??(T?N.items.length:M.total)}})}catch(N){if(E.signal.aborted)return;v(String(N.message??N))}finally{E.signal.aborted||p(!1)}},[e,r,c]);s.useEffect(()=>{if(!n)return;const S=d.key===""?0:150,E=setTimeout(()=>void b(null),S);return()=>clearTimeout(E)},[b,n]),s.useEffect(()=>()=>{var S;return(S=y.current)==null?void 0:S.abort()},[]),s.useEffect(()=>i(S=>{const E=new Map(S.map(C=>[C.id,C]));f(C=>{if(!C.items.some(M=>E.has(M.id)))return C;const N=C.items.flatMap(M=>{const T=E.get(M.id);return T?T.archived?[]:[{...M,...T}]:[M]});return{...C,items:N,total:Math.max(0,C.total-(C.items.length-N.length))}})}),[i]);const x=d.key===c?d:null,k=s.useCallback(()=>{x!=null&&x.next&&b(x.next)},[x==null?void 0:x.next,b]);return x?{items:x.items.filter(S=>S.status==="done"&&S.images.length>0),total:x.total,hasMore:x.next!==null,loading:h,settled:!0,error:g,loadMore:k}:{...Ite,loading:h,error:g,loadMore:k}}const Pg={Products:"product",Presenters:"presenter",Scenes:"scene"};function Fte({brand:e,tab:t,onTab:n,only:r,activeProductCategory:a,refining:i,full:c,attached:d,phone:f,touch:h,onPick:p,onRemove:g,onUpload:v,onFiles:y,onClose:b}){const x=s.useRef(a).current,k=df(x),S=s.useMemo(()=>new Set(io(e.id)),[e.id]),E=Xi(),{applyBrand:C}=jn(),{push:N}=Sr(),[M,T]=s.useState(!1),[L,A]=s.useState(""),P=s.useDeferredValue(L),[$,H]=s.useState(Mi),[O,Q]=s.useState(0),[I,V]=s.useState(f?347:696),ie=s.useRef(null),B=s.useRef(null);s.useEffect(()=>{H(Mi),Q(0)},[t,P]),s.useLayoutEffect(()=>{const oe=B.current;if(!oe)return;const he=()=>V(oe.clientWidth-2*Vte(oe));he();const Ae=new ResizeObserver(he);return Ae.observe(oe),()=>Ae.disconnect()},[]);const F=s.useMemo(()=>({product:Ri("product",k),presenter:Ri("presenter",k),scene:Ri("scene",k)}),[k]),te=s.useMemo(()=>Ate(e.json),[e.json]),X=j4(e.id,P),Z=s.useMemo(()=>Nte(X.items,X.total),[X.items,X.total]),K=s.useMemo(()=>{const oe={};for(const he of Ph){const Ae=Pg[he];oe[he]=he==="Shots"?X.total:Ae?wu(F[Ae],P).length:te.filter(ue=>ue.group===he&&Ck(ue,P)).length}return oe},[F,te,P,X.total]),z=s.useCallback((oe,he)=>{const Ae=Pg[oe];if(Ae){const ke=Wp(Ae,F[Ae],{currentId:null,query:P,bookmarked:S,shown:he});return{group:oe,items:ke.items.map(jte),total:ke.total,remaining:ke.remaining}}if(oe==="Shots"){const ke=Z.slice(0,he),qe=X.hasMore?Math.max(1,X.total-Z.length):Math.max(0,Z.length-he);return{group:oe,items:ke,total:X.total,remaining:qe}}const ue=te.filter(ke=>ke.group===oe&&Ck(ke,P));return{group:oe,items:ue.slice(0,he),total:ue.length,remaining:Math.max(0,ue.length-he)}},[F,te,P,S,Z,X.hasMore,X.total]),Y=s.useMemo(()=>{if(t==="All"){const oe=[];for(const he of Ph){const Ae=Ete(he,I,f),ue=z(he,f&&oe.length===0?Math.max(1,Ae-1):Ae);ue.items.length>0&&oe.push(ue)}return oe}return[z(t,t==="Shots"?Number.MAX_SAFE_INTEGER:$)]},[t,z,$,I,f]),{flat:J,navGroups:de}=s.useMemo(()=>{const oe=[],he=[];for(const Ae of Y)Ae.items.length&&(he.push({start:oe.length,end:oe.length+Ae.items.length-1}),oe.push(...Ae.items));return{flat:oe,navGroups:he}},[Y]);s.useEffect(()=>{Q(oe=>Math.max(0,Math.min(oe,J.length-1)))},[J.length]);const ae=s.useCallback(oe=>{var Ae;const he=(Ae=B.current)==null?void 0:Ae.querySelector(`[data-nav="${oe}"]`);he&&(Q(oe),he.focus({preventScroll:!0}),he.scrollIntoView({block:"nearest"}))},[]),W=s.useRef(null),ye=s.useRef(()=>{});ye.current=()=>{const oe=Y[0];!oe||t==="All"||oe.remaining<=0||(oe.group==="Shots"?X.loading||X.loadMore():H(he=>he+Mi))},s.useEffect(()=>{const oe=W.current,he=B.current;if(!oe||!he)return;const Ae=new IntersectionObserver(ue=>{ue.some(ke=>ke.isIntersecting)&&ye.current()},{root:he,rootMargin:"0px 0px 240px 0px"});return Ae.observe(oe),()=>Ae.disconnect()},[t,Y]);const ee=s.useCallback(oe=>{var Ae,ue;const he=J[oe];he&&(d.has(he.key)?g(he):p(he),h&&((ue=(Ae=document.activeElement)==null?void 0:Ae.blur)==null||ue.call(Ae)))},[J,d,h,p,g]),ge=oe=>{const he=oe.clipboardData.files;!he.length||!Array.from(he).some(Ae=>Ae.type.startsWith("image/"))||(oe.preventDefault(),y(he))},re=oe=>{var qe,Ve;const he=oe.target,Ae=he instanceof HTMLInputElement&&!!((qe=ie.current)!=null&&qe.contains(he));if(oe.key==="Escape"){if(Ae)return;oe.preventDefault(),oe.stopPropagation(),b();return}if(Ae){oe.key==="ArrowDown"?(oe.preventDefault(),oe.stopPropagation(),ae(0)):oe.key==="Enter"&&(oe.preventDefault(),oe.stopPropagation(),ee(0));return}if(!Pte.has(oe.key)||(oe.stopPropagation(),he.closest('[role="tablist"]')))return;const ue=he.closest("[data-nav]");if(!ue)return;oe.preventDefault();const ke=Lte(O,oe.key,_te(ue.closest(".sc-ap-grid")),de);if(ke==="search"){const Xe=ie.current;(Ve=(Xe==null?void 0:Xe.querySelector(".sc-libsearch[data-open] input"))??(Xe==null?void 0:Xe.querySelector(".sc-libsearch-toggle")))==null||Ve.focus()}else ke!=null&&ae(ke)},D=async oe=>{T(!0);try{const he=await FC(e.id,oe);C(he);const Ae=he.logoHash;Ae&&p({key:`m:${Ae}`,group:"Brand",shape:"square",label:"Logo",full:"Logo",search:"",token:{t:"mark",imageHash:Ae}});const ue=he.logoEdge;ue&&ue<512&&N({kind:"warning",title:"Logo added, but it is small",detail:`Only ${ue}px across. Fine lettering may not survive generation. Export it larger, or as SVG.`})}catch(he){N(wn(he,"Could not upload that logo"))}finally{T(!1)}},G=oe=>E(oe,{onCreated:he=>{if(he.kind===oe){if(he.kind==="product"){const Ae={t:"product",id:he.id};p({key:ja(Ae),group:"Products",shape:"square",label:"Product",full:"",search:"",token:Ae});return}if(he.kind==="presenter"){const Ae={t:"character",id:he.id};p({key:ja(Ae),group:"Presenters",shape:"square",label:"Presenter",full:he.name,search:he.name,token:Ae});return}n("Scenes")}}}),Pe=async oe=>{var ue;const he=oA((ue=e.json)==null?void 0:ue.palette,oe);if(!he.swatch)return;if(he.added)try{const ke=await Me.updateBrand(e.id,{...e.json??{},palette:he.palette});C(ke)}catch(ke){N(wn(ke,"Could not save the brand"));return}const Ae={t:"color",hex:he.swatch.hex,name:he.swatch.name};p({key:ja(Ae),group:"Colors",shape:"swatch",label:he.swatch.name,full:"",search:"",swatch:he.swatch.hex,token:Ae})},Ze=oe=>i&&oe==="Scenes"?"Scenes set up a new shot. Press X on Refining to use one.":c&&oe!=="Colors"?c:null,He=J.length===0;let tt=0;return o.jsxs("div",{className:"sc-ap-inner",onKeyDown:re,onPaste:ge,children:[o.jsxs("div",{className:"sc-ap-head",ref:ie,children:[o.jsx("div",{className:"sc-ap-tabs",children:o.jsx(C4,{"aria-label":"What to add",activeKey:t==="All"?null:t,items:$te(K),onSelect:oe=>n(oe??"All")})}),o.jsxs("div",{className:"sc-ap-actions",children:[o.jsxs("div",{className:"sc-ap-actions-add",children:[o.jsx(Yu,{value:L,onChange:A,noun:t==="All"?"everything":uv[t],total:t==="All"?void 0:K[t],shortcut:!1}),!f&&o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary sc-ap-upload",onClick:v,title:"Add an image from your computer. It joins the shot as a reference.",children:[o.jsx(H6,{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:b,"aria-label":"Close",children:o.jsx(Cn,{size:14})})]})]}),o.jsxs("div",{className:"sc-ap-body",ref:B,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."}),Y.map((oe,he)=>{var Xe,Re,Ie;const Ae=Ze(oe.group),ue=tt;tt+=oe.items.length;const ke=Pg[oe.group],Ve={"--ap-min":`${(f?dv:_N)[oe.group]}px`,"--ap-lines":ke==="product"?2:1};return o.jsxs("section",{className:"sc-ap-group","aria-label":Sk[oe.group],children:[o.jsxs("div",{className:"sc-ap-sec",children:[o.jsxs("span",{className:"sc-ap-sec-title",children:[Sk[oe.group],o.jsx("span",{className:"sc-ap-sec-n",children:oe.total})]}),t==="All"&&oe.total>oe.items.length&&o.jsxs("button",{type:"button",className:"sc-ap-sec-act",onClick:()=>n(oe.group),children:["Show all ",oe.total]}),t==="Products"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>G("product"),children:"Add product"}),t==="Presenters"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>G("presenter"),children:"Create presenter"}),t==="Scenes"&&!r&&o.jsx("button",{type:"button",className:"sc-ap-sec-act sc-ap-add",onClick:()=>G("scene"),children:"Create scene"}),t==="Colors"&&o.jsx(Pu,{className:"sc-ap-sec-act sc-ap-add",triggerStyle:{background:"none"},value:$p(Ls((Xe=e.json)==null?void 0:Xe.palette)),presets:Ls((Re=e.json)==null?void 0:Re.palette).map(st=>st.hex),commitMode:"close",align:"end",label:"Add color",onChange:st=>void Pe(st),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":M||void 0,children:[o.jsx("input",{type:"file",accept:"image/*",className:"sc-vh",disabled:M,onChange:st=>{var $e;const Ye=($e=st.target.files)==null?void 0:$e[0];st.target.value="",Ye&&D(Ye)}}),"Add logo"]})]}),o.jsxs("div",{className:"sc-ap-grid","data-shape":((Ie=oe.items[0])==null?void 0:Ie.shape)??"square",style:Ve,children:[f&&he===0&&!r&&o.jsx(jk,{onClick:v}),oe.items.map((st,Ye)=>o.jsx(Dte,{card:st,index:ue+Ye,active:ue+Ye===O,ticked:d.has(st.key),why:Ae,onPick:ee,onFocus:Q},st.key))]}),t!=="All"&&oe.remaining>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:W,className:"sc-ap-sentinel","aria-hidden":!0}),o.jsxs("p",{className:"sc-ap-foot","aria-live":"polite",children:[oe.items.length," of ",oe.total]})]})]},oe.group)}),t==="Shots"&&X.error&&o.jsxs("p",{className:"sc-ap-empty",children:["Could not load the shots. ",X.error]}),He&&f&&o.jsx("div",{className:"sc-ap-grid",style:{"--ap-min":`${dv.Products}px`},children:o.jsx(jk,{onClick:v})}),He&&!(t==="Shots"&&(!X.settled||X.loading||X.error))&&o.jsx("p",{className:"sc-ap-empty",children:Tte(t,L)})]})]})}function _te(e){return e?Math.max(1,getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length):1}function Vte(e){return Number.parseFloat(getComputedStyle(e).paddingLeft)||0}const Zte="(pointer: coarse)";function zte(e){const t=sr(da),n=sr(Zte),[r,a]=s.useState(e.initialTab??"All");s.useEffect(()=>{a(e.initialTab??"All")},[e.initialTab,e.tabNonce]);const[i]=Bi(),c=i.get("new")!==null;return o.jsx(Bte,{id:e.id,phone:t,touch:n,creating:c,onClose:e.onClose,children:o.jsx(Fte,{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 Bte({id:e,phone:t,touch:n,creating:r,onClose:a,children:i}){const c=s.useRef(null),d=()=>{var p;return a({restore:!n&&!!((p=c.current)!=null&&p.contains(document.activeElement))})},f=s.useRef(d);f.current=d,s.useEffect(()=>{var p,g;n&&((g=(p=document.activeElement)==null?void 0:p.blur)==null||g.call(p))},[n]),s.useLayoutEffect(()=>{var b,x;const p=c.current,g=p==null?void 0:p.parentElement;if(!t||!p||!g)return;const v=()=>{const k=p.closest(".sc-shell")??document.documentElement,S=Number.parseFloat(getComputedStyle(k).getPropertyValue("--sc-topbar-h"))||0,E=g.getBoundingClientRect().top-S-16;p.style.setProperty("--ap-avail",`${Math.max(160,Math.round(E))}px`)};v();const y=new ResizeObserver(v);return y.observe(g),window.addEventListener("resize",v),(b=window.visualViewport)==null||b.addEventListener("resize",v),(x=window.visualViewport)==null||x.addEventListener("scroll",v),()=>{var k,S;y.disconnect(),window.removeEventListener("resize",v),(k=window.visualViewport)==null||k.removeEventListener("resize",v),(S=window.visualViewport)==null||S.removeEventListener("scroll",v)}},[t]),s.useEffect(()=>{const p=g=>{var y;if(g.key!=="Escape"||r)return;const v=document.activeElement;v instanceof HTMLInputElement&&((y=c.current)!=null&&y.contains(v))||(g.preventDefault(),g.stopPropagation(),f.current())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[r]);const h=p=>{var y;const g=document.activeElement,v=p.target;g instanceof HTMLInputElement&&((y=c.current)!=null&&y.contains(g))&&!v.closest("input")&&g.blur(),tv(p)};return s.useEffect(()=>{const p=g=>{if(r)return;const v=g.target;v.closest('[data-guide="catch"], [data-guide="card"], [data-guide="inline"]')||document.querySelector('[data-guide="catch"]')||v.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:c,className:"sc-attachpanel","data-guide-shape":"",role:"dialog",id:e,"aria-label":"Add to shot",onMouseDownCapture:h,children:i})}function Ute({target:e,onOpenImage:t,onClear:n}){var f;const r=Ku(),a=e.images[0],c=(((f=e.brief)==null?void 0:f.tokens)??[]).filter(h=>h.t==="text"&&typeof h.v=="string").map(h=>h.v.trim()).join(" ").trim()||lr(e),d=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: ${c}. Open the image, or remove to make a new shot.`:`Version being refined: ${c}. Open the image.`,onPointerEnter:h=>{h.pointerType==="mouse"&&a&&r.open({anchor:h.currentTarget})},onPointerLeave:h=>h.pointerType==="mouse"&&r.close(),onClick:d,onKeyDown:h=>{h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d())},children:[a?o.jsx("img",{src:nn(a,"micro"),alt:""}):o.jsx("span",{className:"sc-target-thumb sc-shimmer"}),"Refining",n&&o.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),r.closeNow(),n()},"aria-label":"Make a new shot instead",children:o.jsx(Cn,{size:12})})]}),r.shown&&a&&o.jsx(Gu,{anchor:r.shown.anchor,kind:"shot",src:nn(a,"tile"),label:c,noun:"Refining this shot",onOpen:d,onHoverIn:r.keep,onHoverOut:r.close,onClose:r.closeNow})]})}function Du({src:e,kind:t,label:n,noun:r,actions:a,onRestoreFocus:i,onClose:c}){const[d,f]=s.useState(!1),h=r??CN[t],p=s.useRef(null);return o.jsxs(Zs,{className:"sc-lightbox",maxWidth:"min(880px, 92vw)",onOpenAutoFocus:()=>{p.current=document.activeElement},onCloseAutoFocus:g=>{var v;if(g.preventDefault(),i)return i();(v=p.current)!=null&&v.isConnected&&p.current.focus()},onDismiss:c,children:[o.jsx("div",{className:"sc-lightbox-frame","data-kind":t,children:d?o.jsxs("span",{className:"sc-lightbox-blank",children:[o.jsx(Vs,{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 Wte={"codex-cli":{sizing:"advisory"},openrouter:{sizing:"ratio"},replicate:{sizing:"ratio",formats:["square","story","landscape"]},fal:{sizing:"exact"},demo:{sizing:"exact"}},Gte={sizing:"exact"},ZN=e=>Wte[e]??Gte;function Kte(e,t){const n=ZN(e).formats;return!n||n.includes(t)}const A4=e=>ZN(e).sizing,Pi=[{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"}],Lh=[1,2,3,4],zN=e=>Ur.filter(t=>!Kte(e,t.id)).map(t=>t.id),fv=(e,t)=>t.length===0?void 0:`${e} cannot make ${Ur.filter(n=>t.includes(n.id)).map(n=>n.hint).join(" or ")}.`,N4=e=>{var n;e.preventDefault();const t=e.currentTarget??e.target;(n=t==null?void 0:t.querySelector('[role="radiogroup"]'))==null||n.focus()};function Lg({aria:e,width:t,trigger:n,open:r,onOpenChange:a,children:i,onCloseAutoFocus:c,guide:d}){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(Cu,{open:r,onOpenChange:a,children:[o.jsx(ju,{children:o.jsx("button",{type:"button",className:"sc-var","aria-label":e,"data-guide":d,children:n})}),o.jsx(Au,{ref:f,className:"sc-setpop",align:"end",sideOffset:8,width:t,onOpenAutoFocus:N4,onCloseAutoFocus:c,onInteractOutside:h=>{var p;(p=h.target)!=null&&p.closest(".sc-prompt-pills")&&h.preventDefault()},children:i(()=>a(!1))})]})}function Yte({mode:e,engineId:t,engineName:n,formatId:r,onFormat:a,count:i,onCount:c,quality:d,onQuality:f,onCloseAutoFocus:h,guided:p=!1,onSettle:g}){const v=Ur.find(T=>T.id===r)??Ur[0],y=Pi.find(T=>T.id===d)??Pi[1],b=zN(t),x=A4(t),[k,S]=s.useState(null),E=s.useRef(null);E.current=k;const C=T=>{T.preventDefault(),E.current===null&&(h==null||h(T))},N={aspect:"shape",variants:"count",resolution:"quality"},M=T=>({open:k===T,onCloseAutoFocus:C,guide:p?`compose.${N[T]}`:void 0,onOpenChange:L=>{!L&&E.current===T&&(g==null||g(N[T])),S(A=>L?T:A===T?null:A)}});return o.jsxs("div",{className:"sc-prompt-pills","data-guide":p?"compose.settings-row":void 0,children:[o.jsx(Lg,{...M("aspect"),aria:`Aspect ${v.label}, ${v.hint}`,width:"178px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(G8,{w:v.w,h:v.h,slot:15,box:13}),v.label]}),children:T=>o.jsxs(o.Fragment,{children:[o.jsx(Mo,{label:"Aspect ratio",className:"sc-setpop-list",value:r,ids:Ur.map(L=>L.id),unavailable:b,onChange:a,children:Ur.map(L=>o.jsxs(Ro,{id:L.id,className:"sc-setrow",on:L.id===r,unavailable:b.includes(L.id),label:`${L.label}, ${L.hint}`,onPick:()=>{a(L.id),T()},children:[o.jsx(G8,{w:L.w,h:L.h,slot:20,box:17}),o.jsx("span",{className:"sc-setrow-n",children:L.label}),o.jsx("span",{className:"sc-setrow-v",children:L.hint}),o.jsx(qx,{})]},L.id))}),fv(n,b)&&o.jsx(OK,{children:fv(n,b)})]})}),e==="generation"&&o.jsx(Lg,{...M("variants"),aria:`${i} shot${i===1?"":"s"}`,width:"156px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(tU,{size:14}),i]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(Mo,{label:"Shots",className:"sc-seg",value:String(i),ids:Lh.map(String),onChange:L=>c(Number(L)),children:Lh.map(L=>o.jsx(Ro,{id:String(L),className:"sc-seg-o",on:L===i,label:`${L} shot${L===1?"":"s"}`,onPick:()=>{c(L),T()},children:L},L))})})}),e==="generation"&&x!=="ratio"&&o.jsx(Lg,{...M("resolution"),aria:`Resolution ${y.label}, ${y.edge} px`,width:"192px",trigger:o.jsxs(o.Fragment,{children:[o.jsx(HB,{size:14}),y.label]}),children:T=>o.jsx(o.Fragment,{children:o.jsx(Mo,{label:"Resolution",className:"sc-setpop-list",value:d,ids:Pi.map(L=>L.id),onChange:L=>f(L),children:Pi.map(L=>o.jsxs(Ro,{id:L.id,className:"sc-setrow",on:L.id===d,label:`${L.label}, ${L.edge} px, ${L.note}`,onPick:()=>{f(L.id),T()},children:[o.jsx("span",{className:"sc-setrow-n",children:L.label}),o.jsxs("span",{className:"sc-setrow-v",children:[L.edge," px"]}),o.jsx(qx,{})]},L.id))})})})]})}function BN({mode:e,engineId:t,engineName:n,formatId:r,onFormat:a,count:i,onCount:c,quality:d,onQuality:f,engineChoices:h,onEngine:p}){const g=zN(t),v=A4(t);return o.jsxs(o.Fragment,{children:[h&&p&&h.length>1&&o.jsx(T1,{label:"Engine",children:o.jsx(Mo,{label:"Engine",className:"sc-seg",value:t,ids:h.map(y=>y.id),onChange:p,children:h.map(y=>o.jsx(Ro,{id:y.id,className:"sc-seg-o",on:y.id===t,label:y.displayName,onPick:()=>p(y.id),children:y.displayName},y.id))})}),o.jsx(T1,{label:"Aspect ratio",note:fv(n,g),children:o.jsx(Mo,{label:"Aspect ratio",className:"sc-seg",value:r,ids:Ur.map(y=>y.id),unavailable:g,onChange:a,children:Ur.map(y=>o.jsxs(Ro,{id:y.id,className:"sc-seg-o sc-seg-ratio",on:y.id===r,unavailable:g.includes(y.id),label:`${y.label}, ${y.hint}`,onPick:()=>a(y.id),children:[o.jsx(G8,{w:y.w,h:y.h,slot:17,box:14}),y.hint]},y.id))})}),e==="generation"&&o.jsx(T1,{label:"Shots",children:o.jsx(Mo,{label:"Shots",className:"sc-seg",value:String(i),ids:Lh.map(String),onChange:y=>c(Number(y)),children:Lh.map(y=>o.jsx(Ro,{id:String(y),className:"sc-seg-o",on:y===i,label:`${y} shot${y===1?"":"s"}`,onPick:()=>c(y),children:y},y))})}),e==="generation"&&v!=="ratio"&&o.jsx(T1,{label:"Resolution",note:v==="advisory"?"This engine renders at its own size, so this is a request rather than a guarantee.":void 0,children:o.jsx(Mo,{label:"Resolution",className:"sc-seg",value:d,ids:Pi.map(y=>y.id),onChange:y=>f(y),children:Pi.map(y=>o.jsx(Ro,{id:y.id,className:"sc-seg-o",on:y.id===d,label:v==="advisory"?`${y.label}, asks for ${y.edge} px, ${y.note}`:`${y.label}, ${y.edge} px, ${y.note}`,onPick:()=>f(y.id),children:y.label},y.id))})})]})}function T1({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 qte({guide:e,onSettle:t,...n}){const[r,a]=s.useState(!1),i=f=>{!f&&r&&(t==null||t()),a(f)},{sheet:c,grip:d}=zu(()=>i(!1));return o.jsxs(ec,{open:r,onOpenChange:i,children:[o.jsx(Bv,{asChild:!0,children:o.jsx("button",{type:"button",className:"sc-var sc-shotset","aria-label":"Shot settings",title:"Shot settings","data-guide":e,children:o.jsx(D6,{size:16})})}),o.jsxs(tc,{children:[o.jsx(nc,{className:"sc-shotsheet-scrim"}),o.jsxs(rc,{ref:c,className:"sc-shotsheet","aria-describedby":void 0,onOpenAutoFocus:N4,onCloseAutoFocus:f=>f.preventDefault(),children:[o.jsxs("div",{className:"sc-shotsheet-grip",...d,children:[o.jsx("span",{className:"sc-shotsheet-bar","aria-hidden":!0}),o.jsx(sc,{className:"sc-vh",children:"Shot settings"})]}),o.jsx(BN,{...n})]})]})]})}const lu=e=>`scenri:draft-${e}`,Xte=e=>ns.get(e),Qte=(e,t)=>ns.set(e,t),eh=e=>ns.del(e);function Ak(e,t){return e.some(n=>n.t==="text"?!!n.v.trim():n.t!=="template")||Object.values(t).some(n=>!!n.trim())}function Jte(e){const t=Xte(lu(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 eh(lu(e)),null;const a=Date.now()-Date.parse(r.updatedAt??"");return!Number.isFinite(a)||a>QC?(eh(lu(e)),null):{v:1,brandId:e,updatedAt:r.updatedAt,tokens:r.tokens,tplFields:r.tplFields,setSlug:r.setSlug??null}}function UN(e,t){const n={v:1,brandId:e,updatedAt:new Date().toISOString(),tokens:t.tokens,tplFields:t.tplFields,setSlug:t.setSlug??null};Qte(lu(e),JSON.stringify(n))}function Nk(e){eh(lu(e))}function Mk(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 ene(e,t){return e>0&&t>0&&Math.abs(Math.log(t))<Math.abs(Math.log(e))-.01?"crop":"extend"}const Tg=2,tne=.15;function nne(e,t){if(ene(e,t)==="crop")return"crop";if(!(e>0&&t>0))return"extend";const n=t>e?t/e:e/t;return(n>Tg?Math.max(Tg,n*(1-tne)):n)>Tg+1e-9?"crop":"extend"}const hv=4,Th=24,a0=24,WN={product:[],presenter:[],scene:null,ref:[],color:[]};function rne(e){const t=[],n=[],r=[],a=[];let i=null;const c=(d,f)=>{d.includes(f)||d.push(f)};for(const d of e)d.t==="product"?c(t,d.id):d.t==="character"?c(n,d.id):d.t==="template"?i=d.id:d.t==="ref"?c(r,d.imageHash):d.t==="color"&&c(a,d.hex.toLowerCase());return{product:t,presenter:n,scene:i,ref:r,color:a}}function sne(e){return`${e.product.join(",")}|${e.presenter.join(",")}|${e.scene??""}|${e.ref.join(",")}|${e.color.join(",")}`}function ane(e,t,n){const r=e.slice(0,n);return{visible:r,more:Math.max(0,e.length-r.length)}}const M4=s.forwardRef(function({projectId:t,brand:n,engines:r,parentId:a,initialBrief:i,suppressDraftRestore:c,startScene:d,startSetup:f,startPresenter:h,startProduct:p,onSeedsSpent:g,openAttachTab:v,onQueued:y,onSending:b,onAttached:x,onCeiling:k,target:S,onClearTarget:E,sourceImage:C,onRestoreBranchId:N,setSlug:M,persistDraft:T=!0,variant:L="dock",guided:A=!1},P){var Ju,rl;const{products:$,productsLoaded:H}=Qt(),{demoProducts:O,demoProductsLoaded:Q,loaded:I}=jn(),V=df(),ie=V.scenes,B=V.presenters,F=X0(),te=fc(),{push:X}=Sr(),Z=r.filter(be=>be.available),[K,z]=Na(Wr.engine,k0);s.useEffect(()=>{const be=yY(Z,K);be!==K&&z(be)},[Z,K,z]);const Y=Z.length===0&&r.some(be=>be.code==="not-installed"||be.code==="not-authenticated"),J=Z.length===0,de=J?Y?{icon:o.jsx(dA,{}),title:"Image generation is not set up yet",detail:"About a minute, using the ChatGPT account you already have.",action:"Set up",onAct:()=>te(),info:!0}:{icon:o.jsx(v0,{size:15}),title:"No image provider connected",detail:"Add a provider key and this prompt is ready to run.",action:"Open settings",onAct:()=>F("engines"),info:!1}:null,[ae,W]=s.useState(jo()),[ye,ee]=s.useState(void 0),[ge,re,D]=eg(Wr.format,"square"),[G,Pe]=s.useState({}),Ze=S&&S.kind!=="root"?S:null,He=Ze?gte(Ze.brief):void 0,tt=Ze?G[Ze.id]??He??ge:ge,oe=be=>{Ze?Pe(ut=>({...ut,[Ze.id]:be})):re(be)},[he,Ae]=s.useState({}),[ue,ke,qe]=eg(Wr.count,2),[Ve,Xe]=s.useState(!1),[Re,Ie]=s.useState(null),[st,Ye]=s.useState(null),[$e,Qe]=s.useState(!1),[Fe,yt]=s.useState("All"),[ht,yn]=s.useState(0),[Oe,wt]=s.useState(null),[pt,Nt,Ct]=eg(Wr.quality,"standard"),[$t,Yt]=s.useState(!1),[Vn,pn]=s.useState(!1),ar=be=>pn(be);sr("(hover: hover) and (min-width: 1024px)");const bt=sr("(max-width: 767px)"),kt=s.useRef(null),sn=s.useRef(null),Ut=s.useRef(null),Tn=s.useId(),Vt=s.useRef({tokens:ae,tplFields:he,branchId:(S==null?void 0:S.id)??null});Vt.current={tokens:ae,tplFields:he,branchId:(S==null?void 0:S.id)??null};const ne=s.useRef(null),se=s.useRef(null),pe=s.useRef(void 0),ve=s.useRef(void 0),Ee=s.useRef(void 0),We=s.useCallback(be=>{if(se.current&&(clearTimeout(se.current),se.current=null),!T)return;const ut=Vt.current;ut.branchId||(Ak(ut.tokens,ut.tplFields)?UN(be,{tokens:ut.tokens,tplFields:ut.tplFields,setSlug:M}):Nk(be))},[M,T]);s.useEffect(()=>{v&&(yt(v),Qe(!0))},[v]),s.useEffect(()=>{if(!i)return;const be=(i.tokens??[]).find(ut=>ut.t==="format");be&&D(be.id),i.variants&&qe(i.variants),i.quality&&Ct(i.quality),ee(c4(i)),Ae(i.templateFields??{})},[i]),s.useEffect(()=>{var ls;const be=ne.current;be&&be!==n.id&&We(be);const ut=!!i||!!c||!T,Ht=be!==n.id;let Wt=null,ln=null;if(!ut&&Ht){const Gt=Jte(n.id);Gt&&Ak(Gt.tokens,Gt.tplFields)&&(Wt=Gt.tokens,ln=Gt.tplFields)}let dn=!1;if(d&&d!==pe.current){pe.current=d,dn=!0;const Gt=Wt??jo(),Hn=Gt.find(pa=>pa.t==="template"),Pn=(Hn==null?void 0:Hn.id)??null,Ha=((ls=ie.find(pa=>pa.id===d))==null?void 0:ls.name)??"this scene",wc=Mk(Pn,d,Ha,null,null);if(wc.changed&&(Wt=[{t:"template",id:d,...f?{setup:f}:{}},...Gt.filter(pa=>pa.t!=="template")],wc.toast)){const pa=wc.toast;X({kind:"info",title:pa.title,action:{label:"Undo",onClick:()=>{var pf,mf;pa.prevSceneId?(pf=kt.current)==null||pf.insert({t:"template",id:pa.prevSceneId}):(mf=kt.current)==null||mf.removeTemplate()}}})}}if(h&&h!==ve.current){ve.current=h,dn=!0;const Gt=Wt??jo();Gt.some(Pn=>Pn.t==="character"&&Pn.id===h)||(Wt=[...Gt,{t:"character",id:h}])}if(p&&p!==Ee.current){Ee.current=p,dn=!0;const Gt=Wt??jo();Gt.some(Pn=>Pn.t==="product"&&Pn.id===p)||(Wt=[...Gt,{t:"product",id:p}])}Wt&&(ee(Wt),Ae(ln??{})),dn&&(g==null||g()),ne.current=n.id},[n.id,d,h,p]),s.useEffect(()=>{var be;ye&&((be=kt.current)==null||be.setTokens(ye),ee(void 0))},[ye]);const Ke=s.useMemo(()=>{var ln;const be=Ur.find(dn=>dn.id===tt)??Ur[0],Ht=(((ln=Pi.find(dn=>dn.id===pt))==null?void 0:ln.edge)??1024)/Math.max(be.w,be.h),Wt=dn=>Math.max(256,Math.round(dn*Ht/8)*8);return{t:"format",id:be.id,w:Wt(be.w),h:Wt(be.h)}},[tt,pt]),Ue=s.useMemo(()=>[Ke,...ae],[Ke,ae]),Be=s.useMemo(()=>({tokens:Ue,templateFields:he,variants:ue,quality:pt,format:tt}),[Ue,he,ue,pt,tt]),ot=ae.some(be=>be.t==="text"?!!be.v.trim():!0),rt=s.useMemo(()=>{const be=ae.find(ut=>ut.t==="template");return be?ie.find(ut=>ut.id===be.id)??null:null},[ae,ie]),me=s.useMemo(()=>{const be=ae.find(ut=>ut.t==="template");return(be==null?void 0:be.id)??null},[ae]),q=s.useCallback(be=>{var dn,ls;const ut=(rt==null?void 0:rt.id)??null,Ht=(S==null?void 0:S.id)??null,Wt=((dn=ie.find(Gt=>Gt.id===be))==null?void 0:dn.name)??"this scene",ln=Mk(ut,be,Wt,Ht,S?lr(S):null);if(ln.changed&&((ls=kt.current)==null||ls.insert({t:"template",id:be}),ln.toast)){const Gt=ln.toast;X({kind:"info",title:Gt.title,action:{label:"Undo",onClick:()=>{var Hn,Pn;Gt.prevSceneId?(Hn=kt.current)==null||Hn.insert({t:"template",id:Gt.prevSceneId}):(Pn=kt.current)==null||Pn.removeTemplate(),Gt.branchWasCleared&&Ht&&(N==null||N(Ht))}}})}},[rt,S,ie,X,N]);s.useImperativeHandle(P,()=>({insertToken:be=>{var ut;return(ut=kt.current)==null?void 0:ut.insert(be)},removeToken:be=>{var ut;return(ut=kt.current)==null?void 0:ut.remove(be)},applyScene:be=>q(be),removeTemplate:()=>{var be;return(be=kt.current)==null?void 0:be.removeTemplate()},openAttach:be=>as(be),showAttach:()=>{ha.current||as("All")},focus:()=>{var be;return(be=kt.current)==null?void 0:be.focus()},submit:()=>{Xu()}}));const Te=s.useMemo(()=>rne(ae),[ae]),je=sne(Te),gt=Mte(ae),dt=s.useMemo(()=>Rte(gt),[gt]),jt=s.useRef(Te);jt.current=Te,s.useEffect(()=>{x==null||x(jt.current)},[je,x]),s.useEffect(()=>{var be;!I||!me||rt||((be=kt.current)==null||be.removeTemplate(),X({kind:"warning",title:"That scene is no longer available",detail:"Removed from the brief."}))},[I,me,rt,X]);const et=s.useRef(null);s.useEffect(()=>(se.current&&clearTimeout(se.current),se.current=setTimeout(()=>We(ne.current??n.id),500),()=>{se.current&&clearTimeout(se.current)}),[ae,he,S==null?void 0:S.id,n.id,We]),s.useEffect(()=>()=>We(ne.current??n.id),[We]),s.useEffect(()=>{const be=()=>We(ne.current??n.id);return window.addEventListener("beforeunload",be),()=>window.removeEventListener("beforeunload",be)},[We,n.id]);const Pt=r.find(be=>be.id===K),Sn=Pt?Di(Pt.displayName):"This engine",U=!!S&&S.kind!=="root"&&S.status==="running",ce=S&&S.kind!=="root"&&S.status==="done"&&S.images.length>0||U,Ce=!!(Pt!=null&&Pt.supportsEdit),lt=!!Ze&&!!He&&He!==tt&&ce&&!rt,mt=lt?nne($u(He),$u(tt)):null,_t=mt==="crop",It=mt==="extend"&&Ce,an=Ur.find(be=>be.id===tt),Bt=an?`${an.label} ${an.hint}`:tt,[mn,on]=s.useState(null),An=()=>{S!=null&&S.images[0]&&on({src:Dr(S.images[0]),kind:"shot",label:lr(S),noun:"Refining this shot"})},Dt=ce&&!rt&&(Ce||_t||It)?"edit":"generation",Zn=Dt==="edit"&&!!S&&L!=="overlay",xt=ce?rt?"A scene starts a new shot.":_t||It||Ce?null:`${(Pt==null?void 0:Pt.displayName)??"This engine"} cannot edit. This makes a new shot.`:null,On=s.useMemo(()=>{const be=Ur.find(dn=>dn.id===tt)??Ur[0],ut=`Aspect ${be.label} ${be.hint}`;if(Dt==="edit")return ut;const Ht=Pi.find(dn=>dn.id===pt),Wt=A4(K),ln=Wt==="ratio"||!Ht?null:Wt==="advisory"?`${Ht.label}, asking for ${Ht.edge} px`:`${Ht.label} ${Ht.edge} px`;return[ut,`${ue} shot${ue===1?"":"s"}`,ln&&`resolution ${ln}`].filter(Boolean).join(", ")},[Dt,tt,ue,pt,K]),Ot=s.useRef(void 0),rn=s.useRef(void 0);s.useEffect(()=>{var Wt;const be=ce?(S==null?void 0:S.id)??null:null,ut=be!==Ot.current&&Ot.current!==void 0;Ot.current=be;const Ht=me!==rn.current;rn.current=me,!(!rt||!ce)&&(ut&&!Ht&&be?(Wt=kt.current)==null||Wt.removeTemplate():E==null||E())},[rt,me,ce,S,E]);const $n=(st==null?void 0:st.warnings.filter(be=>be.includes("built around a product")))??[],or=lt&&!ot,Ir=_t&&ot,zn=!Ve&&(ot||or)&&!Ir&&!!t&&!U&&(_t||!J),xn=J&&!_t?"Image generation is not set up yet":Ve?"Working on the last one":t?U?"Wait for this version to finish, or press X to start a new shot":Ir?"This shape is reached by cropping, and a crop uses no words. Clear the prompt, or keep the current shape.":!ot&&!or?"Write a prompt first":null:"Still opening this brand";s.useEffect(()=>{const be=Dt==="edit"&&!!S;if(_t||!ot&&!be){Ye(null);return}et.current&&clearTimeout(et.current);const ut=Be;return et.current=setTimeout(()=>{Me.previewBrief(Be,K,n.id,be?S.id:void 0).then(Ht=>Ye({...Ht,forBrief:ut})).catch(()=>Ye(null))},280),()=>{et.current&&clearTimeout(et.current)}},[Be,K,n.id,ot,Dt,S,_t]);const Qo=be=>{var ut;oe(be),(ut=kt.current)==null||ut.focus()},Jo=be=>{var ut;Nt(be),(ut=kt.current)==null||ut.focus()},zs=be=>{var ut;ke(be),(ut=kt.current)==null||ut.focus()},Ji=be=>{var ut;be.preventDefault(),(ut=kt.current)==null||ut.focus()},as=be=>{yt(be),yn(ut=>ut+1),Qe(!0)},ha=s.useRef(!1);ha.current=$e;const ei=s.useRef(as);ei.current=as;const Bs=s.useCallback(({restore:be})=>{var ut;ha.current&&(ha.current=!1,Qe(!1),be&&((ut=kt.current)==null||ut.restoreCaret()))},[]),os=s.useRef(q);os.current=q;const Es=s.useRef(ae);Es.current=ae;const fe=s.useCallback(be=>{var Ht;const ut=be.token;ut.t==="template"?os.current(ut.id):(Ht=kt.current)==null||Ht.insert(ut)},[]),_e=s.useCallback(be=>{var Ht,Wt;const ut=be.token;ut.t==="template"?(Ht=kt.current)==null||Ht.removeTemplate():(Wt=kt.current)==null||Wt.remove(ut)},[]),ft=async be=>{var Ht;if(!(be!=null&&be.length))return;const ut=Array.from(be).filter(Wt=>Wt.type.startsWith("image/"));if(!ut.length){X({kind:"warning",title:"Only images can be attached here"});return}Yt(!0),Ie(null);try{for(const Wt of ut.slice(0,4)){const ln=await y0(Wt);(Ht=kt.current)==null||Ht.insert({t:"ref",imageHash:ln,label:one(Wt.name)})}ut.length>4&&X({kind:"warning",title:"Only the first 4 images were attached",detail:`${ut.length-4} more ${ut.length-4===1?"was":"were"} skipped. Attach ${ut.length-4===1?"it":"them"} in another pick.`})}catch(Wt){Ie(String(Wt.message??Wt)),X(wn(Wt,"Could not attach that image"))}finally{Yt(!1),Ut.current&&(Ut.current.value="")}},Tt=st&&st.forBrief===Be?st:null,gn=s.useMemo(()=>ae.filter(be=>Yd.has(be.t)).length,[ae]),Bn=s.useRef(null),un=s.useMemo(()=>gn===0?(Bn.current=null,null):(Tt&&(Bn.current={cap:pte(Tt),described:mte(Tt),preview:Tt}),Bn.current),[Tt,gn]),Rn=(un==null?void 0:un.cap)??null,Jt=(un==null?void 0:un.preview)??null,is=(Pt==null?void 0:Pt.displayName)??"This engine",ti=gn>=Rh?cv:null;s.useEffect(()=>{k==null||k(ti)},[ti,k]);const mc=be=>{const ut=un==null?void 0:un.described;return!ut||ut.size===0?!1:be.t==="product"?ut.has(Ml("product",be.id)):be.t==="character"?ut.has(Ml("character",be.id)):be.t==="template"?ut.has(Ml("scene",be.id)):be.t==="ref"?ut.has(Ml("reference",be.imageHash)):be.t==="mark"?ut.has(Ml("brand",be.imageHash)):!1},el=Rn!=null?`Described in words: ${is} pictures ${Rn} per shot. Drag it earlier to picture it.`:null,ho=rt?$n.length>0?"This scene builds around a product. Attach one.":(Jt==null?void 0:Jt.warnings.some(be=>be.includes("built around a person")))??!1?"This scene builds around a person. Without a presenter, only the set renders.":null:null,ni=be=>{var dn,ls;if(be.t==="template")return ho;if(be.t==="product"&&H&&Q&&!(($.length?$:((dn=n.json)==null?void 0:dn.products)??[]).some(Pn=>Pn.id===be.id)||O.some(Pn=>Pn.id===be.id)))return"This product is no longer in your library. Remove it from the brief.";if(be.t==="mark"&&!tf(n.json).some(Gt=>Gt.hash===be.imageHash))return"This mark is no longer in your brand kit. Remove it from the brief.";if(!Jt)return null;const ut=(Pt==null?void 0:Pt.displayName)??"this engine",Ht=Jt.cap,Wt=Gt=>`${Gt} won't reach ${ut} this time.`,ln=(Gt,Hn)=>{var Pn;return((Pn=Jt.dropped)==null?void 0:Pn.some(Ha=>Ha.role===Gt&&Ha.id===Hn&&Ha.reason==="missing"))??!1};if(be.t==="ref"&&!Jt.attachments.some(Gt=>Gt.hash===be.imageHash))return Ht===0?`This reference won't reach ${ut}. Choose an engine that reads images, or remove it.`:Ht==null?Wt("This reference"):null;if(be.t==="mark"&&!Jt.attachments.some(Gt=>Gt.role==="brand"&&Gt.hash===be.imageHash))return Ht===0?`The brand mark won't reach ${ut}, so the logo can't be drawn from it. Choose an engine that reads images.`:Ht==null?`${Wt("The brand mark")} The logo can't be drawn from it.`:null;if(be.t==="mark"){const Gt=Jt.warnings.find(Hn=>Hn.includes("px across"));if(Gt)return Gt}if(be.t==="product"){const Hn=($.length?$:((ls=n.json)==null?void 0:ls.products)??[]).find(Pn=>Pn.id===be.id)??O.find(Pn=>Pn.id===be.id);if(Hn&&!Jt.attachments.some(Pn=>Pn.role==="product"&&Pn.id===Hn.id))return ln("product",Hn.id)?`${Hn.name} has no usable photo. Re-add one, or remove this.`:null}if(be.t==="character"){const Gt=B.find(Hn=>Hn.id===be.id);if(!Gt&&B.length>0)return"This presenter is no longer in your roster. Remove them from the brief.";if(Gt&&!Jt.attachments.some(Hn=>Hn.role==="character"&&Hn.id===Gt.id))return ln("character",Gt.id)?`${Gt.name} has no usable photo. Re-add one, or remove this.`:null}return null},gc=s.useCallback(ni,[Jt,Pt==null?void 0:Pt.displayName,ho,$,H,n.json,O,Q,B]),sm=s.useCallback(mc,[un]),Xu=async()=>{var ut,Ht,Wt;if(!zn)return;Xe(!0),Ie(null);const be=ae.flatMap(ln=>ln.t==="text"?[ln.v]:[]).join(" ").replace(/\s+/g," ").trim();b==null||b({said:be||"Your shot",count:Dt==="generation"?ue:1});try{if(!t)throw new Error("the workspace is still loading");const ln=await Me.addNode({projectId:t,parentId:Dt==="edit"&&S?S.id:a,kind:Dt,engineId:K,count:ue,brief:Be,...Dt==="edit"&&C?{sourceImage:C}:{},...Dt==="edit"&&mt?{reshape:mt}:{}}),dn=ln.warnings??[];dn.length===1?X({kind:"warning",title:"Sent, with one thing to know",detail:dn[0]}):dn.length>1&&X({kind:"warning",title:`Sent, with ${dn.length} things to know`,detail:dn.join(" ")}),(ut=kt.current)==null||ut.setTokens(jo()),Ae({}),D(null),Pe({}),qe(null),Ct(null),T&&Nk(n.id),y(ln.id,Dt,(Ht=ln.siblings)==null?void 0:Ht.map(ls=>ls.id),(Wt=ln.siblings)!=null&&Wt.length?ln.siblings:[ln])}catch(ln){const dn=String(ln.message??ln);Ie(dn),X(wn(ln,"That did not send",Pt==null?void 0:Pt.displayName)),b==null||b(null)}finally{Xe(!1)}},ri=(Ju=ae.find(be=>be.t==="product"))==null?void 0:Ju.id,tl=ri?$.find(be=>be.id===ri)??(((rl=n.json)==null?void 0:rl.products)??[]).find(be=>be.id===ri)??O.find(be=>be.id===ri)??null:null,vc=tl?e4(tl):null,Qu=A?{brandId:n.id,products:ae.filter(be=>be.t==="product").length,presenters:ae.filter(be=>be.t==="character").length,scene:!!rt,others:ae.filter(be=>be.t==="color"||be.t==="ref"||be.t==="mark").length,words:ae.some(be=>be.t==="text"&&!!be.v.trim()),busy:Ve,pickerOpen:$e,refining:Dt==="edit"&&!!S,engine:J?Y?"setup":"settings":"ready"}:null;s.useEffect(()=>{Qu&&l3(Qu)}),s.useEffect(()=>{if(A)return()=>l3(null)},[A]),s.useEffect(()=>{if(!A||!$e)return;const be=()=>Bs({restore:!0});return window.addEventListener("scenri:guide-close-picker",be),()=>window.removeEventListener("scenri:guide-close-picker",be)},[A,$e,Bs]),s.useEffect(()=>{if(!A)return;const be=ut=>{var dn;const{kind:Ht}=ut.detail,Wt=Ht==="presenter"?"character":Ht==="scene"?"template":"product",ln=[...Es.current].reverse().find(ls=>ls.t===Wt);ln&&((dn=kt.current)==null||dn.remove(ln))};return window.addEventListener("scenri:guide-take-back",be),()=>window.removeEventListener("scenri:guide-take-back",be)},[A]),s.useEffect(()=>{if(!E)return;const be=()=>E();return window.addEventListener("scenri:guide-clear-refine",be),()=>window.removeEventListener("scenri:guide-clear-refine",be)},[E]),s.useEffect(()=>{if(!A)return;const be=ut=>{const{tab:Ht}=ut.detail;wt(Ht??null),Ht&&ei.current(Ht)};return window.addEventListener("scenri:guide-picker",be),()=>{window.removeEventListener("scenri:guide-picker",be),wt(null)}},[A]);const[Us,yc]=s.useState(!1),nl=L==="overlay"&&(Us||ae.some(be=>be.t==="text"&&!!be.v.trim()));return s.useEffect(()=>{L==="overlay"&&c3({engaged:nl})},[L,nl]),s.useEffect(()=>{if(L==="overlay")return()=>c3(null)},[L]),o.jsxs("div",{className:"sc-composer","data-guide":A?"compose":void 0,onPointerDownCapture:L==="overlay"&&!Us?()=>yc(!0):void 0,onKeyDownCapture:L==="overlay"&&!Us?()=>yc(!0):void 0,children:[o.jsx("input",{ref:Ut,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:be=>void ft(be.target.files)}),mn&&o.jsx(Du,{src:mn.src,kind:mn.kind,label:mn.label,noun:mn.noun,onRestoreFocus:()=>{var be;return(be=kt.current)==null?void 0:be.restoreCaret()},onClose:()=>on(null)}),$e&&o.jsx(zte,{brand:n,activeProductCategory:vc,refining:Zn,full:ti,initialTab:Fe,tabNonce:ht,only:Oe,id:Tn,attached:dt,onUpload:()=>{var be;return(be=Ut.current)==null?void 0:be.click()},onFiles:be=>void ft(be),onPick:fe,onRemove:_e,onClose:Bs}),de&&o.jsx("div",{className:"sc-notes","data-guide-shape":A?"":void 0,children:de&&o.jsxs("div",{className:"sc-banner","data-tone":"action",children:[o.jsx("span",{className:"sc-banner-ic",children:de.icon}),o.jsxs("span",{className:"sc-banner-txt",children:[o.jsx("b",{children:de.title}),o.jsxs("small",{children:[de.detail,de.info&&o.jsxs(Cu,{children:[o.jsx(ju,{children:o.jsx("button",{type:"button",className:"sc-note-info","aria-label":"What a ChatGPT account has to do with this",children:o.jsx(xp,{size:13})})}),o.jsxs(Au,{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:()=>F("engines"),children:"Use a provider key instead"})]})]})]})]}),o.jsx("button",{type:"button",className:"sc-banner-act","data-primary":"","data-guide":A?"compose.engine":void 0,onClick:de.onAct,children:de.action})]})}),o.jsxs("div",{className:"sc-promptcard","data-guide-shape":A?"":void 0,children:[ce&&(E||L==="overlay"&&Dt==="edit")&&o.jsxs("div",{className:"sc-target","data-note":xt?"":void 0,children:[o.jsx(Ute,{target:S,onOpenImage:An,onClear:E}),xt&&o.jsx("small",{className:"sc-target-note",children:xt})]}),ce&&!E&&xt&&!(L==="overlay"&&Dt==="edit")&&o.jsx("small",{className:"sc-target-note sc-target-note-alone",children:xt}),lt&&(_t||It)&&o.jsxs("small",{className:"sc-reshape-hint","aria-live":"polite",children:[_t?"Will crop to":"Will extend to"," ",Bt]}),o.jsx(vte,{ref:kt,onChange:W,brand:n,templates:ie,presenters:B,demoProducts:O,onTemplatePick:q,scenesSitOut:Zn,flag:gc,described:sm,describedNote:el,onInspect:be=>on(be),onAttachRequest:be=>as(be),activeProductCategory:vc,placeholder:rt?"Add art direction, or run it as written":Dt==="edit"?"Say what to change about this shot":"What should we shoot? (use $ / @ #)",placeholderSm:rt||Dt==="edit"?void 0:"What should we shoot? ($ / @ #)",label:rt?"Art direction":Dt==="edit"?"What to change":"Shot brief",onSubmit:()=>void Xu(),onDropFiles:be=>void ft(be)}),o.jsxs("div",{className:"sc-prompt-row",children:[o.jsxs("div",{className:"sc-prompt-left",children:[o.jsx("button",{type:"button",ref:sn,className:"sc-icon-btn sc-attach-toggle","data-guide":A?"compose.add":void 0,"aria-expanded":$e,"aria-controls":$e?Tn:void 0,"aria-label":"Add to shot",title:"Add a product, a presenter, a scene, a colour or an image",onClick:()=>$e?Bs({restore:!1}):as("All"),children:$t?o.jsx(wr,{size:"1"}):o.jsx(kr,{size:16})}),Z.length>1&&o.jsxs(i7,{value:K,onValueChange:z,children:[o.jsxs(l7,{variant:"ghost",className:"sc-mini-sel",children:[o.jsx(v0,{size:14}),o.jsx("span",{className:"sc-mini-sel-t",children:Pt?Di(Pt.displayName):"Demo"})]}),o.jsx(c7,{children:Z.map(be=>o.jsx(u7,{value:be.id,children:Di(be.displayName)},be.id))})]})]}),o.jsxs("div",{className:"sc-prompt-right",children:[o.jsx(Yte,{mode:Dt,engineId:K,engineName:Sn,formatId:tt,onFormat:Qo,count:ue,onCount:zs,quality:pt,onQuality:Jo,onCloseAutoFocus:Ji,guided:A}),o.jsxs(Cu,{open:Vn,onOpenChange:ar,children:[o.jsx(ju,{children:o.jsxs("button",{type:"button",className:"sc-var sc-more","aria-label":`Shot settings. ${On}`,"data-guide":A&&!bt?"compose.settings":void 0,children:[o.jsx(D6,{size:14}),"More"]})}),o.jsx(Au,{className:"sc-morepop",align:"end",sideOffset:8,width:"300px",onOpenAutoFocus:N4,onCloseAutoFocus:Ji,children:o.jsx(BN,{mode:Dt,engineId:K,engineName:Sn,formatId:tt,onFormat:Qo,count:ue,onCount:zs,quality:pt,onQuality:Jo})})]}),o.jsx(qte,{guide:A&&bt?"compose.settings":void 0,mode:Dt,engineId:K,engineName:Sn,formatId:tt,onFormat:Qo,count:ue,onCount:zs,quality:pt,onQuality:Jo}),o.jsxs("button",{type:"button",className:"sc-send","data-guide":A?"compose.send":void 0,"aria-disabled":!zn||void 0,onClick:()=>void Xu(),"aria-label":Dt==="edit"?"Refine":"Generate",title:Re??ho??xn??`${Dt==="edit"?"Refine":"Generate"} (enter)`,children:[o.jsx("span",{className:"sc-send-ico",children:Ve?o.jsx(wr,{size:"1"}):o.jsx(N7,{size:17,weight:"bold"})}),o.jsx("span",{className:"sc-send-lb",children:Dt==="edit"?"Refine":"Generate"})]})]})]})]})]})});function one(e){return e.replace(/\.[a-z0-9]{2,5}$/i,"").trim()||"Image"}function R4(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 GN({full:e=!0,children:t}){const[n,r]=s.useState(null);return R4(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 P4(){const{brand:e}=Qt(),{tasks:t}=Oa(),[n,r]=s.useState(null),[a,i]=s.useState(null),[c,d]=s.useState(()=>Date.now()),f=s.useRef({id:"",pct:0}),h=t.find(b=>b.kind==="catalog"&&b.state==="running");if(s.useEffect(()=>{if(!h)return;const b=window.setInterval(()=>d(Date.now()),1e3);return()=>window.clearInterval(b)},[h]),!h&&!a)return null;const p=h!=null&&h.id.startsWith("catalog:")?h.id.slice(8):null,g=h!=null&&n===h.id,v=eG(e.json),y=Or(v==null?void 0:v.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:y?o.jsx("img",{src:y,alt:"",className:(v==null?void 0:v.role)==="mark"?"sc-impbar-badge":void 0}):o.jsx(CC,{size:13,weight:"regular"})}),o.jsx("span",{className:"sc-impbar-count",children:h.subtitle}),o.jsx("span",{className:"sc-impbar-clock",children:Wl(h.startedAt,c)})]}),p&&o.jsxs("button",{type:"button",className:"sc-impbar-stop",disabled:g,"aria-label":"Stop importing",onClick:()=>{r(h.id),Me.cancelCatalogJob(e.id,p).catch(()=>r(null))},children:[o.jsx(Cn,{size:12,weight:"bold"}),g?"Stopping":"Stop"]})]}),a&&o.jsx(V8,{brandId:e.id,jobId:a,onDismiss:()=>i(null)})]})}const ine={presenter:"Presenter",product:"Product",scene:"Scene"};function KN({entry:e,productName:t,productPreviewUrl:n,productId:r,presenterName:a,presenterPreviewUrl:i,presenterId:c,sceneName:d,scenePreviewUrl:f,sceneId:h,onOpen:p,productHref:g,presenterHref:v,sceneHref:y,active:b,hideRecipe:x,decorative:k,size:S="grid"}){const E=[t,a,d].filter(Boolean).join(" · "),C=a?{key:"presenter",name:a,previewUrl:i,linked:!!(v&&c),href:v&&c?v(c):void 0}:null,N=n&&t?{key:"product",name:t,previewUrl:n,linked:!!(g&&r),href:g&&r?g(r):void 0}:null,M=f&&d?{key:"scene",name:d,previewUrl:f,linked:!!(y&&h),href:y&&h?y(h):void 0}:null;return o.jsxs("div",{className:"sc-showcase-tile","data-active":b||void 0,"aria-hidden":k||void 0,...k?{inert:""}:{},children:[o.jsx(Uu,{id:e.id,previewUrl:e.previewUrl,title:e.title,primary:e.title,secondary:x?"":E,useLabel:"Recreate this",variant:"use",onOpen:p,onUse:p,size:S}),(C||N||M)&&o.jsx(cne,{presenter:C,product:N,scene:M})]})}function lne(e){return o.jsx(Tp,{...e})}function cne({presenter:e,product:t,scene:n}){const[r,a]=s.useState(null),i=[t,n].filter(Boolean),c=i.length+(e?1:0)+Math.max(0,i.length-1);let d=0;const f=()=>({"--i":d++});return o.jsxs("div",{className:"sc-showcase-chips",onMouseLeave:()=>a(null),children:[e&&o.jsx(Rk,{credit:e,open:r==="presenter",onEnter:()=>a("presenter"),children:dne(e)}),i.length>0&&o.jsxs("div",{className:"sc-showcase-recipe",style:{"--n":c},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(Rk,{credit:h,open:r===h.key,onEnter:()=>a(h.key),style:f(),children:une({credit:h,step:p===0?1:2})})]},h.key))]})]})}function Rk({credit:e,open:t,onEnter:n,children:r,style:a}){const i=s.useRef(null),c=s.useRef(null),[d,f]=s.useState(null),h=nee(),p=h==="large"?144:88,g=h==="large"?168:112;if(s.useLayoutEffect(()=>{var S,E;if(!t||!e.previewUrl){f(null);return}const y=()=>{const C=i.current;if(!C)return;const N=C.getBoundingClientRect(),M=c.current,T=(M==null?void 0:M.offsetWidth)||p,L=(M==null?void 0:M.offsetHeight)||g,A=window.visualViewport,P=pee(N,{width:(A==null?void 0:A.width)??window.innerWidth,height:(A==null?void 0:A.height)??window.innerHeight},{width:T,height:L});if(!P){f(null);return}f({left:Math.round(P.left),top:Math.round(P.top)})};y();const b=requestAnimationFrame(y),x=i.current,k=x?new ResizeObserver(y):null;return x&&k&&k.observe(x),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),(S=window.visualViewport)==null||S.addEventListener("resize",y),(E=window.visualViewport)==null||E.addEventListener("scroll",y),()=>{var C,N;cancelAnimationFrame(b),k==null||k.disconnect(),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),(C=window.visualViewport)==null||C.removeEventListener("resize",y),(N=window.visualViewport)==null||N.removeEventListener("scroll",y)}},[t,e.previewUrl,e.key,p,g]),!e.previewUrl)return o.jsx("span",{ref:i,className:"sc-credit-tip",onPointerEnter:n,style:a,children:r});const v=ine[e.key];return o.jsxs("span",{ref:i,className:"sc-credit-tip","data-open":t||void 0,onPointerEnter:n,style:a,children:[r,t&&Mr.createPortal(o.jsx("span",{ref:c,className:"sc-credit-tip-pop","data-size":h,style:d?{left:d.left,top:d.top}:{left:-9999,top:0},role:"tooltip","aria-label":`${v}: ${e.name}`,children:o.jsxs("span",{className:"sc-credit-tip-card",children:[o.jsx("img",{src:e.previewUrl,alt:""}),o.jsx("span",{className:"sc-credit-tip-name",children:e.name}),o.jsx("span",{className:"sc-credit-tip-role",children:v})]})}),document.body)]})}function une({credit:e,step:t}){const{name:n,previewUrl:r,linked:a,href:i}=e;return a&&i?o.jsx(Fn,{className:"sc-showcase-chip",to:i,"data-link":!0,"data-step":t,"aria-label":`See ${n}`,onClick:c=>c.stopPropagation(),children:r?o.jsx("img",{src:r,alt:""}):null}):o.jsx("span",{className:"sc-showcase-chip","data-step":t,children:r?o.jsx("img",{src:r,alt:n}):o.jsx("span",{className:"sc-vh",children:n})})}function dne(e){const{name:t,previewUrl:n,linked:r,href:a}=e;return r&&a?o.jsxs(Fn,{className:"sc-showcase-badge",to:a,"data-link":!0,"aria-label":`See ${t}`,onClick:i=>i.stopPropagation(),children:[n?o.jsx("img",{src:n,alt:""}):null,o.jsx("span",{className:"sc-showcase-badge-name",children:t})]}):o.jsxs("span",{className:"sc-showcase-badge","aria-hidden":!0,children:[n?o.jsx("img",{src:n,alt:""}):null,o.jsx("span",{className:"sc-showcase-badge-name",children:t})]})}function pv({presenter:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,onDuplicate:d,onDelete:f,fresh:h,size:p="grid"}){const g=[];return d&&g.push({key:"duplicate",label:"Duplicate presenter",onSelect:()=>d(e.id),separated:!0}),f&&g.push({key:"delete",label:"Delete presenter",onSelect:()=>f(e.id),danger:!0,separated:!d}),o.jsx(Uu,{id:e.id,previewUrl:e.previewUrl,title:e.descriptor||e.name,primary:e.name,secondary:e.descriptor,useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,menuItems:g.length?g:void 0,fresh:h,size:p})}function YN(e){return o.jsx(Tp,{...e})}function S0({scene:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,bookmarked:d,onBookmark:f,size:h="grid"}){return o.jsx(Uu,{id:e.id,previewUrl:e.previewUrl,title:e.description||zi(e,"tooltip"),primary:zi(e,"card"),secondary:e.lighting,useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,bookmarked:d,onBookmark:f,size:h})}function qN(e){return o.jsx(Tp,{...e})}const ru=new Map,fne=50;function hne(e,t){for(ru.delete(e),ru.set(e,t);ru.size>fne;)ru.delete(ru.keys().next().value)}function pne(e){return ru.get(e)}const mne=1e3;function es({className:e="sc-home",children:t}){const n=s.useRef(null),{key:r}=_n(),a=s.useRef(!1);return s.useLayoutEffect(()=>{const i=n.current,c=pne(r);if(!i||!c)return;let d=!1;const f=()=>{d||(d=!0,a.current=!1,p.disconnect(),clearTimeout(g),i.removeEventListener("wheel",f),i.removeEventListener("touchstart",f))},h=()=>{d||(i.scrollTop=c,Math.abs(i.scrollTop-c)<1&&f())};a.current=!0;const p=new ResizeObserver(h),g=setTimeout(f,mne);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 c=()=>{a.current||hne(r,i.scrollTop)};return i.addEventListener("scroll",c,{passive:!0}),()=>i.removeEventListener("scroll",c)},[r]),o.jsx("div",{ref:n,className:e,"data-page-scroll":"",children:t})}function Gp({title:e,filters:t,active:n,summary:r,onClear:a,density:i,search:c,action:d}){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"})]}),c,i,d?o.jsx("span",{className:"sc-filterbar-cta",children:d}):null]})]})}function Kp({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(C4,{"aria-label":t.label,activeKey:t.selected,items:n,onSelect:t.onSelect})}function Oi({shape:e,title:t,body:n,action:r,onRetry:a}){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:a,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:[o.jsx("p",{children:n}),r]})}function Yp({noun:e,q:t,facet:n,onClearSearch:r,onClearAll:a}){const i=t.trim(),c=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(Oi,{shape:"zero",body:c,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 gne=150;function ff(e){const[t,n]=Bi(),r=t.get("q")??"",a=e.join(","),i=s.useMemo(()=>{const E={};for(const C of a.split(",").filter(Boolean))E[C]=t.get(C)||null;return E},[t,a]),c=s.useCallback(E=>{n(C=>{const N=new URLSearchParams(C);for(const[M,T]of Object.entries(E))T===null||T===""?N.delete(M):N.set(M,T);return N},{replace:!0})},[n]),[d,f]=s.useState(r),h=s.useRef(r),p=s.useRef(null),g=s.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]);s.useEffect(()=>{r!==h.current&&(h.current=r,g(),f(r))},[r,g]),s.useEffect(()=>g,[g]);const v=s.useCallback(E=>{f(E),g(),p.current=setTimeout(()=>{p.current=null,h.current=E,c({q:E||null})},gne)},[c,g]),y=s.useCallback((E,C)=>c({[E]:C}),[c]),b=c,x=d.trim().length>0||Object.values(i).some(Boolean),k=s.useCallback(()=>{g(),f(""),h.current="",c({q:null})},[c,g]),S=s.useCallback(()=>{g(),f(""),h.current="";const E={q:null};for(const C of a.split(",").filter(Boolean))E[C]=null;c(E)},[c,g,a]);return{q:d,setQ:v,facets:i,setFacet:y,setFacets:b,active:x,clearSearch:k,clear:S}}const vne=8;function yne(){var tt;const{engines:e,scenes:t,loaded:n,presenters:r,presentersLoaded:a,demoProducts:i,showcase:c,showcaseCategories:d,showcaseLoaded:f,showcaseError:h,refetchShowcase:p}=jn(),{brand:g,workspace:v,root:y,products:b,applyNodes:x}=Qt(),{poke:k}=Oa(),S=Xi(),E=Dn(),{push:C}=Sr(),N=k4(),M=Zp(),T=WJ(),L=sr(da),{q:A,setQ:P,facets:$,setFacet:H,clearSearch:O,clear:Q}=ff(["category"]),I=$.category,V=oe=>H("category",oe),ie=A.trim().length>0,[B,F]=Na(Wr.wallDensity,Tu),te=pc(B),X=oe=>F(oe),Z=Up(te),K=zp(te),z=oe=>{const he=new URLSearchParams(oe??{}).toString();E(`${hr(g)}${he?`?${he}`:""}`)},Y=b.length?b:((tt=g.json)==null?void 0:tt.products)??[],J=oe=>{var ke,qe,Ve;const he=(ke=oe.brief.tokens.find(Xe=>Xe.t==="product"))==null?void 0:ke.id,Ae=(qe=oe.brief.tokens.find(Xe=>Xe.t==="character"))==null?void 0:qe.id,ue=(Ve=oe.brief.tokens.find(Xe=>Xe.t==="template"))==null?void 0:Ve.id;return{product:he?i.find(Xe=>Xe.id===he):void 0,presenter:Ae?r.find(Xe=>Xe.id===Ae):void 0,scene:ue?t.find(Xe=>Xe.id===ue):void 0}},de=s.useMemo(()=>{const oe=new Map;for(const he of c){const{product:Ae,presenter:ue,scene:ke}=J(he);oe.set(he.id,UJ(he,{product:Ae,presenter:ue,scene:ke},Ag(he.category)))}return oe},[c,i,r,t]),ae=s.useMemo(()=>(I?c.filter(he=>he.category===I):c).filter(he=>lo(de.get(he.id)??he.title,A)),[c,I,A,de]),W=s.useMemo(()=>{const oe=XJ(d);return{key:"category",label:"Categories",everyLabel:"All examples",everyCount:c.length,selected:I,onSelect:V,options:oe.map(he=>({value:he,label:Ag(he)??he,count:c.filter(Ae=>Ae.category===he).length}))}},[c,d,I,V]),ye=oe=>{const{product:he,presenter:Ae,scene:ue}=J(oe);return{productName:he?oo(he,"chip"):null,productPreviewUrl:(he==null?void 0:he.previewUrl)??null,productId:(he==null?void 0:he.id)??null,presenterName:(Ae==null?void 0:Ae.name)??null,presenterPreviewUrl:Ae?Bo(Ae).src:null,presenterId:(Ae==null?void 0:Ae.id)??null,sceneName:ue?zi(ue,"chip"):null,scenePreviewUrl:(ue==null?void 0:ue.previewUrl)??null,sceneId:(ue==null?void 0:ue.id)??null}},[ee,ge]=s.useState(null),D=L?T:oe=>{const he=c.find(Ae=>Ae.id===oe);he&&(ge(ov(he)),C({kind:"info",title:`Starting from "${he.title}"`}))},G=()=>{const he=[...io(g.id)].reverse().find(Ae=>t.some(ue=>ue.id===Ae));z(he?{scene:he,attach:"products",compose:"1"}:{attach:"products",compose:"1"})},Pe=s.useMemo(()=>gh(rf(g),r).slice(0,8),[g,r]),Ze=s.useMemo(()=>{const oe=io(g.id);return gh(hc(g),PN(t,he=>oe.includes(he.id))).slice(0,8)},[t,g]),He=s.useMemo(()=>{var Ve,Xe,Re,Ie,st;const oe=new Set,he=Ye=>!Ye||oe.has(Ye)?null:(oe.add(Ye),tr(Ye,"tile")),Ae=Ye=>{for(const $e of Ye){const Qe=c.find(yt=>yt.id===$e&&yt.previewUrl),Fe=he(Qe==null?void 0:Qe.previewUrl);if(Fe)return Fe}return null},ue=Ye=>{for(const $e of Ye){const Qe=t.find(yt=>yt.id===$e&&yt.previewUrl),Fe=he(Qe==null?void 0:Qe.previewUrl);if(Fe)return Fe}return null},ke=Ye=>{for(const $e of c)if(!(!$e.previewUrl||oe.has($e.previewUrl))&&!(Ye&&!$e.brief.tokens.some(Qe=>Qe.t===Ye)))return he($e.previewUrl);return null},qe=Y.find(Ye=>{var $e,Qe;return Or((Qe=($e=Ye==null?void 0:Ye.shots)==null?void 0:$e[0])==null?void 0:Qe.file)});return{compose:he(qe?Or((Xe=(Ve=qe.shots)==null?void 0:Ve[0])==null?void 0:Xe.file):null)??Ae(["aurelia-serum-succulent-dew","verity-pearls-suspended-silk","solstice-aviators-screen-print"])??he((Re=i.find(Ye=>Ye.id==="aurelia-amber-serum"))==null?void 0:Re.previewUrl)??he((Ie=i.find(Ye=>Ye.previewUrl))==null?void 0:Ie.previewUrl)??ke("product"),product:Ae(["voss-rowe-runner-volcanic-ash","birchwood-salt-flat","voss-rowe-dune-slip-face"])??he((st=i.find(Ye=>Ye.id==="voss-rowe-trail-runner"))==null?void 0:st.previewUrl)??ke("product"),presenter:he(Bo(r.find(Ye=>Ye.id==="maren")??r.find(Ye=>Ye.avatarUrl)??r[0]??{}).src)??ke("character"),scene:ue(["furniture-travertine-atrium","wide-establishing-environment","studio-soft-horizon","studio-volcanic-ash-field","furniture-lamplight-hours"])??Ae(["moss-larkin-chair-travertine-atrium","calder-snow-loft","basalt-snells-window"])??ke("template")}},[t,r,Y,i,c]);return o.jsx(cf.Provider,{value:K,children:o.jsxs(es,{children:[o.jsxs("main",{className:"sc-main",id:"main","data-no-dock":L||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:G,children:[o.jsx(XN,{thumbUrl:He.compose,fallback:o.jsx(m7,{size:22,weight:"fill"})}),o.jsx("b",{children:"Create an image"})]}),o.jsx($g,{tone:"product",title:"Add a product",count:Y.length,thumbUrl:He.product,icon:o.jsx(kp,{size:22,weight:"fill"}),onClick:()=>S("product")}),o.jsx($g,{tone:"presenter",title:"Create a presenter",thumbUrl:He.presenter,icon:o.jsx(nU,{size:22,weight:"fill"}),onClick:()=>S("presenter")}),o.jsx($g,{tone:"scene",title:"Create a scene",thumbUrl:He.scene,icon:o.jsx(KB,{size:22,weight:"fill"}),onClick:()=>S("scene")})]}),!f&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":K,style:Z,"aria-hidden":!0,children:o.jsx(lne,{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&&c.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Gp,{filters:o.jsx(Kp,{mode:"tabs",group:W}),search:c.length>=vne&&o.jsx(Yu,{value:A,onChange:P,noun:"examples",total:c.length}),density:o.jsx(Bp,{value:te,onChange:X})}),ae.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":K,style:Z,children:ae.map(oe=>o.jsx(KN,{entry:oe,size:"grid",onOpen:D,productHref:he=>sa(g,he),presenterHref:he=>la(g,he),sceneHref:he=>Hr(g,he),...ye(oe)},oe.id))}),ae.length===0&&(ie?o.jsx(Yp,{noun:"examples",q:A,facet:I?Ag(I):null,onClearSearch:O,onClearAll:Q}):o.jsx("p",{className:"sc-looks-empty",children:"No example carries that category yet."}))]}),!a&&o.jsx("div",{className:"sc-masonry","aria-hidden":!0,children:o.jsx(YN,{size:"grid",count:8})}),a&&Pe.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"sc-sec-head",children:[o.jsx("span",{className:"sc-sec-title",children:"Presenters"}),o.jsx(Fn,{className:"sc-sec-more",to:Vi(g),children:"Browse presenters"})]}),o.jsx("div",{className:"sc-masonry",children:Pe.map(oe=>o.jsx(pv,{presenter:oe,variant:"navigate",size:"grid",onOpen:N},oe.id))})]}),!n&&o.jsx("div",{className:"sc-masonry","aria-hidden":!0,children:o.jsx(qN,{size:"grid",count:8})}),n&&t.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"sc-sec-head",children:[o.jsx("span",{className:"sc-sec-title",children:"Scenes"}),o.jsx(Fn,{className:"sc-sec-more",to:Mu(g),children:"Browse scenes"})]}),o.jsx("div",{className:"sc-masonry",children:Ze.map(oe=>o.jsx(S0,{scene:oe,variant:"navigate",size:"grid",onOpen:M},oe.id))})]})]}),!L&&o.jsxs(GN,{children:[o.jsx(P4,{}),o.jsx(M4,{projectId:(v==null?void 0:v.id)||null,brand:g,engines:e,parentId:y,initialBrief:ee,onQueued:(oe,he,Ae,ue)=>{ue!=null&&ue.length&&x(ue),k(),E(hr(g))}})]})]})})}function $g({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(XN,{thumbUrl:a,fallback:n}),o.jsxs("b",{children:[t,r?o.jsx(Y9,{variant:"soft",radius:"full",size:"1",children:r}):null]})]})}function XN({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 QN({id:e,name:t,hash:n,drawing:r,state:a,href:i,blank:c,onDiscard:d}){return o.jsxs("div",{className:"sc-lookcard","data-variant":"plain","data-size":"grid","data-build":!0,"data-building":r||void 0,children:[o.jsxs(Fn,{className:"sc-lookcard-media",to:i,"aria-label":`Continue ${t}`,children:[n?o.jsx("img",{src:nn(n,"tile"),alt:""}):o.jsx("span",{className:"sc-lookcard-blank",children:c}),r&&o.jsx("span",{className:"sc-shimmer","aria-hidden":!0}),o.jsx("span",{className:"sc-draftmark",children:"Draft"})]}),d&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Discard ${t}`,onClick:()=>d(e),children:o.jsx(Cn,{size:13})}),o.jsxs("span",{className:"sc-lookcard-cap",children:[o.jsx("b",{dir:"auto",children:t}),o.jsx("span",{children:a})]})]})}function JN({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:"status","aria-label":`${G6(e,t)}, ${Wl(e,t)}`,children:Wl(e,t)})}function wne({build:e,onCancel:t,onRetry:n,onDismiss:r}){const a=e.stage==="failed",i=a?nf(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("span",{className:"sc-shimmer"}),o.jsx(JN,{since:e.startedAt})]}),!a&&t&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Stop building ${e.name}`,onClick:()=>t(e.id),children:o.jsx(Cn,{size:13})}),a&&r&&o.jsx("button",{type:"button",className:"sc-cardpuck","aria-label":`Dismiss ${e.name}`,onClick:()=>r(e.id),children:o.jsx(Cn,{size:13})}),a&&n&&o.jsxs("button",{type:"button",className:"sc-lookcard-use",onClick:()=>n(e),children:[o.jsx(x7,{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 L4({label:e}){return o.jsx("div",{className:"sc-starter-rule",children:o.jsx("span",{children:e})})}const Dg=60;function T4(e,t){const[n,r]=s.useState(Dg);s.useEffect(()=>{r(Dg)},[t]);const{visible:a,remaining:i}=E4(e,n),c=s.useCallback(()=>r(d=>d+Dg),[]);return{visible:a,remaining:i,showMore:c}}const bne=24,xne=8,Og="__bookmarked";function kne(){const{scenes:e,collections:t,verticals:n,loaded:r,error:a,refetch:i}=jn(),{brand:c}=Qt(),d=Dn(),[f,h]=s.useState(()=>io(c.id)),p=$e=>h(gN(c.id,$e)),g=Zp(),{builds:v,poke:y,studio:b}=Oa(),x=Xi(),k=s.useMemo(()=>hc(c),[c]),S=v.filter($e=>$e.kind==="scene"&&(!$e.finished||$e.stage==="failed")),E=!!tn({path:it.sceneStudio}),[C,N]=s.useState(()=>q1(c.id)),M=b.filter($e=>$e.kind==="scene").map($e=>`${$e.id}:${$e.status}`).join("|");s.useEffect(()=>{E||N(q1(c.id))},[E,c.id,M]);const T=s.useMemo(()=>mJ(C,b),[C,b]),[L,A]=s.useState(null),P=$e=>{$e.drawing&&$e.jobId&&Me.cancelSceneStudioJob(c.id,$e.jobId).catch(()=>{}),vJ(c.id,$e.convo),N(q1(c.id))},$=$e=>{const Qe=T.find(Fe=>Fe.convo===$e);Qe&&(Qe.hash||Qe.drawing?A(Qe):P(Qe))},{q:H,setQ:O,facets:Q,setFacets:I,clearSearch:V,clear:ie}=ff(["vertical","bookmarked"]),B=Q.vertical,F=Q.bookmarked==="1",te=H.trim().length>0,[X,Z]=Na(Wr.wallDensity,Tu),K=pc(X),z=$e=>Z($e),Y=Up(K),J=zp(K),de=$e=>d(Hr(c,$e)),ae=s.useMemo(()=>F?e.filter($e=>f.includes($e.id)):B?e.filter($e=>$e.verticals.includes(B)):e,[e,B,F,f]),ye=!(k.length>0||S.length>0||T.length>0),ee=e.reduce(($e,Qe)=>$e+(f.includes(Qe.id)?1:0),0),ge=F&&ee===0,re=ge&&ye,D=ge&&!ye,G=te||F&&!re,Pe=s.useMemo(()=>re?e:ae,[re,e,ae]),Ze=s.useMemo(()=>Pe.filter($e=>lo(Ah($e),H)),[Pe,H]),[He,tt]=s.useState(()=>new Set),{visible:oe,remaining:he,showMore:Ae}=T4(Ze,`${B??""}|${F?"bookmarked":""}|${re?"browse":""}|${H}`),ue=$e=>[...k,...e].filter(Qe=>!Qe.verticals.length||Qe.verticals.includes($e)).length,ke=[{value:Og,label:"Bookmarks",count:ee},...n.map($e=>({value:$e,label:$e,count:ue($e)}))],qe=e.length>0?"tabs":"none",Ve={key:"vertical",label:"Vertical",everyLabel:"Every scene",everyCount:e.length+k.length,selected:F?Og:B,onSelect:$e=>I($e===Og?{bookmarked:"1",vertical:null}:{bookmarked:null,vertical:$e}),options:ke},Xe=s.useMemo(()=>k.filter($e=>B?!$e.verticals.length||$e.verticals.includes(B):!0).filter($e=>lo(Ah($e),H)),[k,B,H]),Re=!F&&(T.length>0||S.length>0||Xe.length>0),Ie=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary","data-guide":"library.new",onClick:()=>x("scene"),children:[o.jsx(kr,{size:12})," Create scene"]}),st=($e,Qe=!1)=>o.jsx("div",{className:"sc-masonry","data-wall":Qe||void 0,"data-density":!0,"data-density-size":J,style:Y,children:$e.map(Fe=>o.jsx(S0,{scene:Fe,variant:"use",size:"grid",onOpen:de,href:Hr(c,Fe.id),onUse:g,bookmarked:f.includes(Fe.id),onBookmark:p},Fe.id))}),Ye=o.jsx(Gp,{title:"Scenes",filters:o.jsx(Kp,{mode:qe,group:Ve}),density:o.jsx(Bp,{value:K,onChange:z}),search:e.length>=xne&&o.jsx(Yu,{value:H,onChange:O,noun:"scenes",total:e.length}),action:ye?void 0:Ie});return o.jsxs(cf.Provider,{value:J,children:[o.jsx(es,{children:o.jsxs("main",{className:"sc-looks sc-scenes",id:"main","data-hero":ye||void 0,children:[!ye&&Ye,Re&&o.jsxs("section",{className:"sc-owned",children:[o.jsx("div",{className:"sc-sec-head",children:o.jsx("h2",{className:"sc-sec-title",children:"Your scenes"})}),o.jsxs("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":J,style:Y,children:[T.map($e=>o.jsx(QN,{id:$e.convo,name:$e.name||"Untitled scene",hash:$e.hash,drawing:$e.drawing,state:gJ($e),href:Li(c,$e.convo),blank:o.jsx(AC,{size:44,weight:"thin"}),onDiscard:$},$e.convo)),L&&o.jsx(mr,{label:"Discard",title:`Discard ${L.name||"this unfinished scene"}?`,body:L.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:$e=>{$e||A(null)},onConfirm:()=>{P(L),A(null)}}),S.map($e=>o.jsx(wne,{build:$e,onCancel:Qe=>void Me.cancelAssetBuild(c.id,Qe).then(y),onDismiss:Qe=>void Me.deleteAssetBuild(c.id,Qe).then(y),onRetry:()=>x("scene")},$e.id)),Xe.map($e=>o.jsx(S0,{scene:$e,variant:"use",size:"grid",onOpen:de,href:Hr(c,$e.id),onUse:g},$e.id))]})]}),ye&&r&&!a&&e.length>0&&o.jsx(Oi,{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:Ie}),Re&&r&&!a&&!F&&ae.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri scenes"})}),ye&&r&&!a&&e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(L4,{label:"Or start from one of ours"}),Ye]}),!r&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":J,style:Y,"aria-hidden":!0,children:o.jsx(qN,{size:"grid",count:8})}),r&&a&&o.jsx(Oi,{shape:"error",title:"Couldn't load this library",body:"Something went wrong reaching the catalog.",onRetry:()=>i()}),r&&!a&&!G&&t.map($e=>{const Qe=Pe.filter(ht=>ht.collections.includes($e));if(!Qe.length)return null;const yt=He.has($e)?Qe:Qe.slice(0,bne);return o.jsxs("section",{className:"sc-coll",children:[o.jsx("h2",{children:$e}),st(yt),yt.length<Qe.length&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>tt(ht=>new Set(ht).add($e)),children:["Show all ",Qe.length]})})]},$e)}),r&&!a&&G&&oe.length>0&&st(oe,!0),r&&!a&&D&&o.jsx(Oi,{shape:"zero",body:"Nothing bookmarked yet. Bookmark a scene from its card and it stays here.",action:o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:()=>I({bookmarked:null}),children:"Browse every scene"})}),r&&!a&&e.length>0&&!D&&Ze.length===0&&Xe.length===0&&o.jsx(Yp,{noun:"scenes",q:H,facet:re?null:F?"Bookmarks":B,onClearSearch:V,onClearAll:ie}),G&&he>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:Ae,children:["Show ",Math.min(he,60)," more"]})})]})}),o.jsx(Ql,{})]})}function $4(e,t,n=12){const r=t.filter(Boolean).join(","),[a,i]=s.useState({key:"",items:[]});return s.useEffect(()=>{if(!r)return;const c=new AbortController;return Me.feed(e,{token:r,limit:n},c.signal).then(d=>{c.signal.aborted||i({key:r,items:d.items.filter(f=>f.status==="done"&&f.images.length>0)})}).catch(()=>{}),()=>c.abort()},[e,r,n]),a.key===r?a.items:[]}const mv=[{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"}],eM=4;function Sne(e,t=""){var d,f;const n=[],r=((d=e.refs)==null?void 0:d.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(" · "),c=i?`${i.charAt(0).toUpperCase()}${i.slice(1)}.`:"";return[t.trim(),c].filter(Boolean).join(" ")}function Ene({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(c=>o.jsxs("span",{className:"sc-chipfield-chip",onClick:()=>i==null?void 0:i(),children:[c,a&&o.jsx("button",{type:"button","data-role":"remove","aria-label":`Remove ${c}`,onPointerDown:d=>d.stopPropagation(),onClick:d=>{d.preventDefault(),d.stopPropagation(),a(c)},children:o.jsx(Cn,{size:10,weight:"bold"})})]},c))]}),o.jsx(_i,{size:13,className:"sc-chipfield-caret","aria-hidden":!0})]})}function Cne({value:e,onChange:t,options:n,label:r,placeholder:a="Any",findPlaceholder:i="Find or add",emptyNote:c="Nothing by that name.",max:d=12,maxLength:f=40}){const[h,p]=s.useState(!1),[g,v]=s.useState(""),y=s.useRef(null),b=[...n,...e.filter(M=>!n.some(T=>Uc(T,M)))],x=g.trim(),k=x?b.filter(M=>M.toLowerCase().includes(x.toLowerCase())):b,S=e.length>=d,E=x.length>0&&!b.some(M=>Uc(M,x))&&!S,C=M=>{const T=e.some(L=>Uc(L,M));!T&&S||t(T?e.filter(L=>!Uc(L,M)):[...e,M])},N=()=>{var M;E&&(t([...e,x.slice(0,f)]),v(""),(M=y.current)==null||M.focus())};return s.useEffect(()=>{if(!h)return;const M=setTimeout(()=>{var T;return(T=y.current)==null?void 0:T.focus()},0);return()=>clearTimeout(M)},[h]),o.jsxs(Ds,{open:h,onOpenChange:M=>{p(M),M||v("")},children:[o.jsx(Ene,{items:e,placeholder:a,open:h,onOpen:()=>p(!0),onRemove:M=>t(e.filter(T=>!Uc(T,M))),hit:o.jsx(Os,{children:o.jsx("button",{type:"button",className:"sc-chipfield-hit","aria-label":r})})}),o.jsxs(Hs,{align:"start",sideOffset:6,className:"sc-menu sc-chippick-menu",children:[o.jsx("input",{ref:y,className:"sc-chippick-find",type:"text",value:g,maxLength:f,placeholder:i,"aria-label":i,onChange:M=>v(M.target.value),onKeyDown:M=>{M.stopPropagation(),M.key==="Enter"?(M.preventDefault(),E?N():k.length===1&&C(k[0])):M.key==="Escape"&&p(!1)}}),o.jsxs("div",{className:"sc-chippick-list",children:[k.map(M=>{const T=e.some(L=>Uc(L,M));return o.jsxs(In,{className:"sc-menu-item","data-on":T||void 0,"data-off":!T&&S?"":void 0,onSelect:L=>{L.preventDefault(),C(M)},children:[o.jsx("span",{className:"sc-menu-lb",children:M}),T&&o.jsx(nr,{size:14,className:"sc-menu-check","aria-hidden":"true"})]},M)}),!k.length&&!E&&o.jsx("p",{className:"sc-chippick-none",children:c})]}),E&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-menu-sep"}),o.jsxs(In,{className:"sc-menu-item",onSelect:M=>{M.preventDefault(),N()},children:[o.jsx(kr,{size:16,className:"sc-menu-ic"}),o.jsxs("span",{className:"sc-menu-lb",children:['Add "',x,'"']})]})]}),S&&o.jsx("p",{className:"sc-chippick-none",children:"That is as many as this holds."})]})]})}const Uc=(e,t)=>e.trim().toLowerCase()===t.trim().toLowerCase();function tM({name:e,categories:t,known:n,hint:r,ways:a,wayChoices:i,wayMax:c,busy:d,error:f,onSave:h,onDismiss:p}){const[g,v]=s.useState(e),[y,b]=s.useState(t),[x,k]=s.useState(()=>[...a??[]]),S=g.trim(),E=S.length>0,C=L=>L.map(A=>A.id).join(" "),N=S!==e.trim()||y.join(" ")!==t.join(" ")||!!a&&C(x)!==C(a),M=x.length>=(c??Number.POSITIVE_INFINITY)?[]:(i??[]).filter(L=>!x.some(A=>A.id===L.id)),T=()=>{if(!(!E||d)){if(!N)return p();h({name:S,categories:y,...a?{ways:x}:{}})}};return o.jsxs(Zs,{className:"sc-newdlg sc-pdetails",maxWidth:"min(460px, 94vw)",onDismiss:p,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Details"}),o.jsx(Is,{asChild:!0,children:o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close","aria-label":"Close",children:o.jsx("span",{"aria-hidden":!0,children:"×"})})})]}),o.jsxs("div",{className:"sc-newdlg-body",children:[o.jsxs("label",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Name"}),o.jsx("input",{className:"sc-pdetails-field",value:g,dir:"auto",onChange:L=>v(L.target.value),onKeyDown:L=>L.key==="Enter"&&T()})]}),o.jsxs("div",{className:"sc-pdetails-row",children:[o.jsx("span",{className:"sc-pdetails-lb",children:"Categories"}),o.jsx(Cne,{value:y,onChange:b,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:[x.map(L=>o.jsxs("div",{className:"sc-pdetails-way",children:[o.jsx("span",{className:"sc-pdetails-way-lb",children:L.label}),o.jsx("span",{className:"sc-pdetails-way-sub",children:L.camera}),o.jsx("button",{type:"button",className:"sc-icon-btn","aria-label":`Remove ${L.label}`,onClick:()=>k(x.filter(A=>A.id!==L.id)),children:o.jsx(Cn,{size:13,weight:"bold","aria-hidden":!0})})]},L.id)),M.length>0&&o.jsxs(Ds,{children:[o.jsx(Os,{children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost","aria-label":"Add a way to shoot it",children:[o.jsx(kr,{size:12,weight:"bold","aria-hidden":!0}),o.jsx("span",{children:"Add a way"})]})}),o.jsx(Hs,{children:M.map(L=>o.jsx(In,{onSelect:()=>k([...x,L]),children:L.label},L.id))})]})]}),o.jsxs("span",{className:"sc-pdetails-hint",children:["A way moves the camera and leaves the world alone.",c?` ${c} at most.`:""]})]}),f&&o.jsx("p",{className:"sc-assetform-err",children:f})]}),o.jsxs("div",{className:"sc-newdlg-foot",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:p,children:"Cancel"}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:!E,"data-busy":d||void 0,onClick:T,children:d?"Saving":"Save"})]})]})}function Tl({src:e,crop:t}){const[n,r]=s.useState(!1);return n?o.jsx("span",{className:"sc-lookpage-ref-blank","aria-hidden":!0,children:o.jsx(Vs,{size:20})}):o.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async",...t?{"data-crop":t}:{},onError:()=>r(!0)})}function D4(){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(Vs,{size:20})})})})}function O4({node:e,to:t}){const[n,r]=s.useState(!1);return o.jsx(Fn,{className:"sc-lookcard","aria-label":`Open ${lr(e)}`,to:t,children:n?o.jsx("span",{className:"sc-lookcard-blank",children:o.jsx(Vs,{size:20})}):o.jsx("img",{src:nn(e.images[0],"tile"),alt:"",loading:"lazy",onError:()=>r(!0)})})}function bu({label:e,children:t}){const n=s.useRef(null),r=s.useRef(null),a=s.useRef(!1),i=s.useRef(()=>{});s.useLayoutEffect(()=>{const d=n.current,f=r.current;if(!d||!f)return;let h=0;const p=()=>{const y=f.scrollWidth-f.clientWidth;if(y<=1){delete d.dataset.overflowLeft,delete d.dataset.overflowRight;return}f.scrollLeft>2?d.dataset.overflowLeft="":delete d.dataset.overflowLeft,f.scrollLeft<y-2?d.dataset.overflowRight="":delete d.dataset.overflowRight};i.current=p,p();const g=()=>{h||(h=requestAnimationFrame(()=>{h=0,p()}))},v=new ResizeObserver(()=>p());return v.observe(f),f.addEventListener("scroll",g,{passive:!0}),()=>{h&&cancelAnimationFrame(h),i.current=()=>{},v.disconnect(),f.removeEventListener("scroll",g)}},[]);const c=d=>{const f=r.current;if(!(f!=null&&f.firstElementChild)||a.current)return;const h=f.firstElementChild.getBoundingClientRect().width+16,p=f.scrollWidth/2;d<0&&f.scrollLeft<h&&(f.scrollLeft+=p);const g=f.scrollLeft,v=d*h,y=performance.now();a.current=!0;const b=x=>{const k=Math.min(1,(x-y)/420);f.scrollLeft=g+v*(1-(1-k)**3),i.current(),k<1?requestAnimationFrame(b):(a.current=!1,f.scrollLeft>=p&&(f.scrollLeft-=p),i.current())};requestAnimationFrame(b)};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:()=>c(-1),children:o.jsx(Da,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-slider-arrow next","aria-label":"Next",onClick:()=>c(1),children:o.jsx(qi,{size:13,weight:"bold"})}),o.jsxs("div",{className:"sc-slider-track",ref:r,children:[t,t]})]})]})}function nM(e){const t=s.useRef(null),n=s.useRef(null);s.useLayoutEffect(()=>{const a=t.current,i=n.current;if(!a||!i)return;let c=0;const d=()=>{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=()=>{c||(c=requestAnimationFrame(()=>{c=0,d()}))};d();const h=new ResizeObserver(()=>d());h.observe(i);for(const p of i.children)h.observe(p);return i.addEventListener("scroll",f,{passive:!0}),()=>{c&&cancelAnimationFrame(c),h.disconnect(),i.removeEventListener("scroll",f)}},[e]);const r=s.useCallback(a=>{const i=n.current;if(!(i!=null&&i.firstElementChild))return;const c=i.firstElementChild.getBoundingClientRect().width,d=Number.parseFloat(getComputedStyle(i).columnGap)||0,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;i.scrollBy({left:a*(c+d),behavior:f?"auto":"smooth"})},[]);return{shellRef:t,railRef:n,page:r}}function H4({count:e,label:t,className:n,trackClassName:r,style:a,children:i}){const{shellRef:c,railRef:d,page:f}=nM(e);return o.jsxs("div",{className:n?`sc-rail ${n}`:"sc-rail",ref:c,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(Da,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-rail-arrow next","aria-label":`${t}, later`,onClick:()=>f(1),children:o.jsx(qi,{size:13,weight:"bold"})}),o.jsx("ol",{className:r?`sc-rail-track ${r}`:"sc-rail-track","aria-label":t,ref:d,style:a,children:i})]})}function qp(){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},[])}const jne=1500;function rM(e,t,n){const{refreshBrands:r}=jn(),[a,i]=s.useState(null),[c,d]=s.useState([]),[f,h]=s.useState([]),[p,g]=s.useState(!1),[v,y]=s.useState(0),b=s.useRef(void 0),x=s.useRef(r);x.current=r,s.useEffect(()=>{if(!t)return;let S=!0,E=null;const C=async()=>{var N;try{const M=await Me.sceneExamples(e,t);if(!S)return;const T=M.job?`${M.job.id}:${M.job.done.length}:${M.job.status}`:null;if(T&&b.current!==void 0&&T!==b.current&&await x.current(),!S)return;b.current=T,i(M.job),d(M.first),h(M.more),g(!0),((N=M.job)==null?void 0:N.status)==="running"&&(E=setTimeout(C,jne))}catch{}};return C(),()=>{S=!1,E&&clearTimeout(E)}},[e,t,n,v]);const k=s.useCallback(()=>y(S=>S+1),[]);return{job:a,first:c,more:f,read:p,again:k}}const Ane=["no","one","two","three","four","five"];function Nne({brandId:e,scene:t,onError:n}){const{applyBrand:r}=jn(),a=Zp(),i=qp(),{job:c,first:d,again:f}=rM(e,t.id,t.previewUrl??null),[h,p]=s.useState(!1),[g,v]=s.useState(!1),[y,b]=s.useState(null),x=gj(t.examples,c),k=(c==null?void 0:c.status)==="running",S=$W(t.examples),E=async()=>{if(g||!d.length)return;const $=i();v(!0),n(null);try{await Me.drawSceneExamples(e,t.id,{first:!0}),f()}catch(H){$()&&n(String((H==null?void 0:H.message)??H))}finally{$()&&v(!1)}},C=d.length&&(c==null?void 0:c.status)!=="running"?o.jsx("p",{className:"sc-scenepage-examples-ask",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",disabled:g,onClick:()=>void E(),children:[S.length?"Draw them again":"Draw it in use",`, ${Ane[d.length]??d.length} picture${d.length===1?"":"s"}`]})}):null,N=async $=>{const H=mv.find(Q=>Q.id===$);if(!H||h)return;const O=i();p(!0),n(null);try{const Q=t.setups??[];if(!Q.some(I=>I.id===H.id)){const I=await Me.updateScene(e,t.id,{setups:[...Q,H]});r(I.brand)}a(t.id,H.id)}catch(Q){O()&&n(String((Q==null?void 0:Q.message)??Q))}finally{O()&&p(!1)}},M=t.previewUrl?{src:t.previewUrl,label:"The place"}:null;if(!x.length&&!M)return o.jsx(D4,{});if(!x.length&&M)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-scenepage-place",children:o.jsx("button",{type:"button","aria-label":`${M.label}, open`,onClick:()=>b(M),children:o.jsx(Tl,{src:tr(M.src,"tile")})})}),C,y&&o.jsx(Du,{src:y.src,kind:"scene",label:y.label,noun:t.name,onClose:()=>b(null)})]});const T=y==null?void 0:y.tile,L=T!=null&&T.setup?mv.find($=>$.id===T.setup):void 0,A=!!L&&((t.setups??[]).some($=>$.id===L.id)||(t.setups??[]).length<eM),P=k&&c?W6({status:c.status,step:c.current,done:c.done.length,total:c.roles.length,error:c.error}):S.length>0?`${S.length===1?`The ${Bl[S[0]].toLowerCase()} shows`:"These show"} an earlier picture of this place.`:null;return o.jsxs(o.Fragment,{children:[o.jsxs(H4,{count:x.length+(M?1:0),label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:[M&&o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":"The place, open",onClick:()=>b(M),children:o.jsx(Tl,{src:tr(M.src,"small")})}),o.jsx("span",{className:"sc-refset-lb","aria-hidden":!0,children:"The place"})]}),x.map($=>{const H=Bl[$.role];return o.jsxs("li",{children:[$.state==="drawing"?o.jsxs("span",{className:"sc-refset-tile","data-state":"drawing",role:"img","aria-label":`${H}, drawing`,children:[$.url&&o.jsx(Tl,{src:tr($.url,"small")}),o.jsx("span",{className:"sc-shimmer","aria-hidden":!0})]}):$.state==="failed"?o.jsxs("span",{className:"sc-refset-tile","data-state":"failed",role:"img","aria-label":`${H} did not draw`,title:$.error,children:[o.jsx(uc,{size:20,"aria-hidden":!0}),o.jsx("span",{children:"Did not draw"})]}):o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":`${H}, open`,onClick:()=>b({src:$.url,label:H,tile:$}),children:o.jsx(Tl,{src:tr($.url,"small")})}),o.jsx("span",{className:"sc-refset-lb","aria-hidden":!0,children:H})]},$.role)})]}),P&&o.jsx("p",{className:"sc-scenepage-examples-state","aria-live":"polite",children:P}),C,y&&o.jsx(Du,{src:y.src,kind:"scene",label:y.label,noun:t.name,onClose:()=>b(null),actions:L&&A?o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:h,onClick:()=>void N(L.id),children:"Shoot it this way"}):void 0})]})}function Mne(){var ye,ee,ge,re;const{sceneId:e}=Fs(),{scenes:t,loaded:n,error:r,refetch:a,applyBrand:i,refreshBrands:c}=jn(),{brand:d}=Qt(),f=Dn(),h=Zp(),p=d.id,[g,v]=s.useState([]),[y,b]=s.useState(()=>io(p)),[x,k]=s.useState(null),S=D=>f(Hr(d,D)),E=mh(d,e??""),C=E??t.find(D=>D.id===e);dc(C==null?void 0:C.name);const N=!!E;s.useEffect(()=>{let D=!0;if(v([]),!N)return Me.sceneFrames(e??"").then(G=>{D&&v(G.frames)}).catch(()=>{D&&v([])}),()=>{D=!1}},[e,N]);const M=$4(d.id,[e??""]),T=s.useMemo(()=>{if(!C||N)return[];return t.filter(Pe=>Pe.id!==C.id).sort((Pe,Ze)=>G(Ze)-G(Pe)).slice(0,8);function G(Pe){const Ze=Pe.lighting.split(/[ ,]+/).some(tt=>tt.length>3&&C.lighting.toLowerCase().includes(tt.toLowerCase())),He=Pe.collections.some(tt=>C.collections.includes(tt));return(Ze?2:0)+(He?1:0)}},[t,C,N]),L=s.useMemo(()=>{if(C||!n||r)return[];const D=io(p);return PN(t,G=>D.includes(G.id)).slice(0,6)},[C,n,r,t,p]),[A,P]=s.useState(null),[$,H]=s.useState(!1),[O,Q]=s.useState(!1),[I,V]=s.useState(!1),ie=s.useRef(!1),B=qp(),F=s.useMemo(()=>[...new Set([...t.flatMap(D=>D.verticals),...hc(d).flatMap(D=>D.verticals)])].sort((D,G)=>D.localeCompare(G)),[t,d]),te=async D=>{if(E){Q(!0),P(null);try{const G=await Me.updateScene(d.id,E.id,{name:D.name,verticals:D.categories,...D.ways?{setups:D.ways}:{}});i(G.brand),V(!1)}catch(G){P(String(G.message??G))}finally{Q(!1)}}},X=async()=>{if(!E||ie.current)return;ie.current=!0;const D=B(),G=Mu(d);H(!0);try{const Pe=await Me.deleteScene(d.id,E.id);i(Pe.brand)}catch(Pe){if((Pe==null?void 0:Pe.status)!==404){ie.current=!1,D()&&(P(String(Pe.message??Pe)),H(!1));return}await c()}D()&&f(G,{replace:!0})};if(!n&&!E)return o.jsx(es,{children:o.jsx("main",{className:"sc-lookpage sc-scenepage",id:"main",children:o.jsx("div",{className:"sc-tplrow","aria-hidden":!0})})});if(r&&!E)return o.jsx(es,{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(!C)return o.jsx(es,{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(Fn,{className:"sc-btn sc-btn-primary",to:`${hr(d)}?compose=1`,children:"Start from scratch"}),o.jsx(Fn,{className:"sc-btn sc-btn-ghost",to:Mu(d),children:"Browse all scenes"})]}),L.length>0&&o.jsx(bu,{label:"You might like",children:L.map(D=>o.jsx(S0,{scene:D,variant:"navigate",size:"slider",onOpen:S,href:Hr(d,D.id)},D.id))})]})});const Z=g.length?g.map((D,G)=>({src:D,label:`Example ${G+1}`})):C.previewUrl?[{src:C.previewUrl,label:"The place"}]:[],K=C.subject!=="person"&&Z.length>0?"Shown with a demo product for reference. Yours replaces it.":"",z=!E&&y.includes(C.id),Y=(E==null?void 0:E.setups)??[],J=((E==null?void 0:E.refs)??[]).filter(D=>D!==(E==null?void 0:E.previewUrl)),de=((ee=(ye=E==null?void 0:E.examples)==null?void 0:ye.find(D=>!D.earlier))==null?void 0:ee.with)??((re=(ge=E==null?void 0:E.examples)==null?void 0:ge[0])==null?void 0:re.with),ae=E?E.figure?"The person in it is a stand-in: with a presenter attached, the picture goes with the shot and they take the role.":de?`Shown in use with a Scenri demo ${de}. Shots are told the words, never handed these pictures.`:E.previewUrl?"Shots are told the words, never handed this picture.":"":"",W=E?Sne({refs:J,setups:E.setups},ae):"";return o.jsx(es,{children:o.jsxs("main",{className:"sc-lookpage sc-scenepage",id:"main",children:[o.jsx("h1",{children:C.name}),C.verticals.length>0&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Filed under",children:C.verticals.map(D=>o.jsx("li",{className:"sc-chip","data-static":!0,children:D},D))}),o.jsx("p",{className:"sc-lookpage-lede",children:C.description}),o.jsxs("div",{className:"sc-lookpage-acts",children:[Y.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 h(C.id),children:"Use in a shot"}),o.jsxs(Ds,{children:[o.jsx(Os,{children:o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary sc-splitbtn-more","aria-label":"Use it a way",children:o.jsx(_i,{size:12,weight:"bold","aria-hidden":!0})})}),o.jsx(Hs,{children:Y.map(D=>o.jsx(In,{onSelect:()=>void h(C.id,D.id),children:D.label},D.id))})]})]}):o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>void h(C.id),children:"Use in a shot"}),E?o.jsx(Fn,{className:"sc-btn sc-btn-ghost",to:F6(d,E.id),children:"Edit scene"}):o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost","aria-pressed":z,onClick:()=>b(gN(p,C.id)),children:[o.jsx(yp,{size:13,weight:z?"fill":"regular"}),o.jsx("span",{children:z?"Bookmarked":"Bookmark"})]}),E&&o.jsx(xr,{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:()=>V(!0),children:o.jsx(q0,{size:17})})})]}),A&&o.jsx("p",{className:"sc-assetform-err",children:A}),E?o.jsx(Nne,{brandId:d.id,scene:E,onError:P},E.id):Z.length>1?o.jsx(H4,{count:Z.length,label:"Pictures of this place",className:"sc-refset-rail",trackClassName:"sc-refset",children:Z.map(D=>o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-refset-tile","aria-label":`${D.label}, open`,onClick:()=>k(D),children:o.jsx(Tl,{src:tr(D.src,"small")})}),o.jsx("span",{className:"sc-refset-lb","aria-hidden":!0,children:D.label})]},D.src))}):Z.length===1?o.jsx("div",{className:"sc-scenepage-place",children:o.jsx("button",{type:"button","aria-label":`${Z[0].label}, open`,onClick:()=>k(Z[0]),children:o.jsx(Tl,{src:tr(Z[0].src,"tile")})})}):o.jsx(D4,{}),!E&&K&&o.jsx("p",{className:"sc-lookpage-note",children:K}),E&&o.jsxs("section",{className:"sc-scenepage-told",children:[o.jsxs("dl",{className:"sc-lookpage-told",children:[o.jsxs("div",{children:[o.jsx("dt",{children:Se.lightLabel}),o.jsx("dd",{dir:"auto",children:E.lighting})]}),E.camera&&o.jsxs("div",{children:[o.jsx("dt",{children:Se.cameraLabel}),o.jsx("dd",{dir:"auto",children:E.camera})]}),E.figure&&o.jsxs("div",{children:[o.jsx("dt",{children:Se.figureLabel}),o.jsx("dd",{dir:"auto",children:E.figure})]})]}),o.jsx("p",{className:"sc-lookpage-note",children:"Every shot made here is told this. Anything you write in the shot wins."})]}),J.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:J.map((D,G)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${G+1}, open`,onClick:()=>k({src:D,label:`Source photo ${G+1}`}),children:o.jsx(Tl,{src:tr(D,"micro")})},D))})]}),E&&o.jsxs("div",{className:"sc-prec",children:[W&&o.jsx("p",{className:"sc-prec-note",children:W}),o.jsx(mr,{label:"Delete scene",title:`Delete ${E.name}?`,body:"Shots already made here keep their images. Their recipe will say this scene is gone, and building from one again will miss it.",busy:$,onConfirm:()=>void X()})]}),M.length>0&&o.jsx(bu,{label:`Shots made in ${C.name}`,children:M.map(D=>o.jsx(O4,{node:D,to:Ap(d,null,D.id)},D.id))}),T.length>0&&o.jsx(bu,{label:"Other scenes, similar light",children:T.map(D=>o.jsx(S0,{scene:D,variant:"navigate",size:"slider",onOpen:S,href:Hr(d,D.id)},D.id))}),I&&E&&o.jsx(tM,{name:E.name,categories:E.verticals,known:F,hint:"The verticals this place suits, so it surfaces where you work.",ways:Y,wayChoices:mv,wayMax:eM,busy:O,error:A,onSave:D=>void te(D),onDismiss:()=>V(!1)}),x&&o.jsx(Du,{src:x.src,kind:"scene",label:x.label,noun:C.name,onClose:()=>k(null)})]})})}function Rne({draft:e,href:t,onDiscard:n}){return o.jsx(QN,{id:e.id,name:e.name.trim()||"Untitled presenter",hash:e.hash,drawing:!!e.drawing,state:Pne(e),href:t,blank:o.jsx(rU,{size:44,weight:"thin"}),onDiscard:n})}function Pne(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 Lne({suggested:e,busy:t,error:n,onConfirm:r,onDismiss:a}){const[i,c]=s.useState(e),d=s.useRef(null),f=s.useRef(!1),h=i.trim(),p=h.length>0;s.useEffect(()=>{f.current=!1},[e]),s.useEffect(()=>{t||(f.current=!1)},[t]);const g=()=>{!p||t||f.current||(f.current=!0,r(h))};return o.jsxs(Zs,{className:"sc-newdlg sc-pdetails",maxWidth:"min(420px, 94vw)",onDismiss:a,onOpenAutoFocus:v=>{v.preventDefault();const y=d.current;y&&(y.focus(),y.select())},children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Duplicate presenter"}),o.jsx(Is,{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:d,className:"sc-pdetails-field",value:i,dir:"auto",maxLength:60,onChange:v=>c(v.target.value),onKeyDown:v=>v.key==="Enter"&&g()})]}),n&&o.jsx("p",{className:"sc-assetform-err",children:n})]}),o.jsxs("div",{className:"sc-newdlg-foot",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:a,children:"Cancel"}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:!p||t,"data-busy":t||void 0,onClick:g,children:t?"Duplicating":"Duplicate"})]})]})}const Tne=60;function $ne(e,t,n=Tne){var c;const r=e.trim(),a=(((c=r.match(/^(.*?)(?: copy(?: \d+)?)?$/i))==null?void 0:c[1])??r).trim()||r,i=new Set(t.map(d=>d.trim().toLowerCase()).filter(Boolean));for(let d=1;d<1e4;d++){const f=d===1?" copy":` copy ${d}`,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 Dne=8;function One(){const{presenters:e,presenterCategories:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:c}=jn(),{brand:d}=Qt(),f=Dn(),h=k4(),{push:p}=Sr(),{q:g,setQ:v,facets:y,setFacet:b,clearSearch:x,clear:k}=ff(["category"]),S=y.category,E=Xi(),C=s.useMemo(()=>rf(d),[d]),[N,M]=Na(Wr.wallDensity,Tu),T=pc(N),L=Fe=>M(Fe),A=Up(T),P=zp(T),$=Fe=>f(la(d,Fe)),H=s.useMemo(()=>S?e.filter(Fe=>Fe.suitableCategories.includes(S)):e,[e,S]),O=s.useMemo(()=>H.filter(Fe=>lo(Nh(Fe),g)),[H,g]),{visible:Q,remaining:I,showMore:V}=T4(O,`${S??""}|${g}`),ie=RN(t.length),B=s.useRef(null),F=s.useRef(null),te=o.jsxs("button",{ref:F,type:"button",className:"sc-btn sc-btn-primary","data-guide":"library.new",onClick:()=>E("presenter"),children:[o.jsx(kr,{size:12})," Create presenter"]}),[X,Z]=s.useState([]),K=s.useRef(0),z=s.useCallback(()=>{const Fe=++K.current;return Me.presenterDrafts(d.id).then(yt=>{Fe===K.current&&Z(yt.drafts.filter(ht=>!ht.presenterId))}).catch(()=>{}),()=>{Fe===K.current&&K.current++}},[d.id]),Y=!!tn({path:it.presenterStudio}),{tasks:J}=Oa(),de=J.filter(Fe=>Fe.id.startsWith("presenter:")).map(Fe=>`${Fe.id}:${Fe.state}:${Fe.percent??""}`).join("|");s.useEffect(()=>{if(!Y)return z()},[Y,z,de]);const ae=s.useCallback(Fe=>{const yt=Math.max(0,X.findIndex(ht=>ht.id===Fe));W.current=yt,Z(ht=>ht.filter(yn=>yn.id!==Fe)),Me.deletePresenterDraft(d.id,Fe).finally(()=>z())},[d.id,X,z]),W=s.useRef(null);s.useEffect(()=>{var ht,yn;const Fe=W.current;if(Fe===null)return;W.current=null;const yt=(ht=B.current)==null?void 0:ht.querySelectorAll("[data-build] .sc-cardpuck");(yn=yt!=null&&yt.length?yt[Math.min(Fe,yt.length-1)]:F.current)==null||yn.focus()},[X]);const[ye,ee]=s.useState(null),ge=s.useCallback(Fe=>{const yt=X.find(ht=>ht.id===Fe);yt!=null&&yt.drawn?ee(yt):ae(Fe)},[X,ae]),[re,D]=s.useState(null),[G,Pe]=s.useState(null),[Ze,He]=s.useState(!1),[tt,oe]=s.useState(null),[he,Ae]=s.useState(null),ue=s.useCallback(Fe=>{const yt=C.find(ht=>ht.id===Fe);yt&&(oe(null),D(yt))},[C]),ke=s.useCallback(Fe=>{const yt=C.find(ht=>ht.id===Fe);yt&&Pe(yt)},[C]),qe=s.useRef(null);s.useEffect(()=>{var ht,yn;const Fe=qe.current;if(Fe===null)return;qe.current=null;const yt=(ht=B.current)==null?void 0:ht.querySelectorAll(".sc-lookcard:not([data-build]) .sc-lookcard-more");(yn=yt!=null&&yt.length?yt[Math.min(Fe,yt.length-1)]:F.current)==null||yn.focus()},[e,d]);const Ve=async Fe=>{if(!(!re||Ze)){He(!0),oe(null);try{const yt=await Me.duplicatePresenter(d.id,re.id,Fe);i(yt.brand),D(null),Ae(yt.presenter.id)}catch(yt){const ht=wn(yt,"Could not duplicate this presenter");oe([ht.title,ht.detail].filter(Boolean).join(" "))}finally{He(!1)}}},Xe=async()=>{if(!(!G||Ze)){qe.current=Math.max(0,Re.findIndex(Fe=>Fe.id===G.id)),He(!0);try{const Fe=await Me.deletePresenter(d.id,G.id);i(Fe.brand),Pe(null)}catch(Fe){(Fe==null?void 0:Fe.status)===404?(await c(),Pe(null)):p(wn(Fe,"Could not delete this presenter"))}finally{He(!1)}}};s.useEffect(()=>{var yt,ht;if(!he)return;(ht=(yt=B.current)==null?void 0:yt.querySelector(".sc-lookcard[data-just-added]"))==null||ht.scrollIntoView({block:"nearest"});const Fe=window.setTimeout(()=>Ae(null),1800);return()=>window.clearTimeout(Fe)},[he]);const Re=s.useMemo(()=>C.filter(Fe=>S?!Fe.suitableCategories.length||Fe.suitableCategories.includes(S):!0).filter(Fe=>lo(Nh(Fe),g)),[C,S,g]),Ie=C.length>0||X.length>0,st=Re.length>0||X.length>0,Ye=!Ie,$e={key:"category",label:"Category",everyLabel:"Every presenter",everyCount:e.length+C.length,selected:S,onSelect:Fe=>b("category",Fe),options:t.map(Fe=>({value:Fe,label:Fe,count:[...C,...e].filter(yt=>!yt.suitableCategories.length||yt.suitableCategories.includes(Fe)).length}))},Qe=o.jsx(Gp,{title:"Presenters",filters:o.jsx(Kp,{mode:ie,group:$e}),density:o.jsx(Bp,{value:T,onChange:L}),search:e.length>=Dne&&o.jsx(Yu,{value:g,onChange:v,noun:"presenters",total:e.length}),action:Ye?void 0:te});return o.jsxs(cf.Provider,{value:P,children:[o.jsx(es,{children:o.jsxs("main",{className:"sc-looks sc-presenters",id:"main","data-hero":Ye||void 0,children:[!Ye&&Qe,st&&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:B,className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":P,style:A,children:[X.map(Fe=>o.jsx(Rne,{draft:Fe,href:Ti(d,Fe.id),onDiscard:ge},Fe.id)),ye&&o.jsx(mr,{label:"Discard",title:`Discard ${ye.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:Fe=>{Fe||ee(null)},onConfirm:()=>{ae(ye.id),ee(null)}}),Re.map(Fe=>o.jsx(pv,{presenter:Fe,variant:"use",size:"grid",onOpen:$,href:la(d,Fe.id),onUse:h,onDuplicate:ue,onDelete:ke,fresh:Fe.id===he},Fe.id)),re&&o.jsx(Lne,{suggested:$ne(re.name,C.map(Fe=>Fe.name)),busy:Ze,error:tt,onConfirm:Fe=>void Ve(Fe),onDismiss:()=>{Ze||D(null)}}),G&&o.jsx(mr,{label:"Delete presenter",title:`Delete ${G.name}?`,body:"Shots already made with them keep their images and their recipe. Only future shots lose them.",open:!0,busy:Ze,onOpenChange:Fe=>{!Fe&&!Ze&&Pe(null)},onConfirm:()=>void Xe()})]})]}),Ye&&n&&!r&&e.length>0&&o.jsx(Oi,{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:te}),st&&n&&!r&&Q.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":P,style:A,"aria-hidden":!0,children:o.jsx(YN,{size:"grid",count:8})}),n&&r&&o.jsx(Oi,{shape:"error",title:"Couldn't load the presenter library",body:"Something went wrong reaching the catalog.",onRetry:()=>a()}),Ye&&n&&!r&&e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(L4,{label:"Or cast someone from ours"}),Qe]}),n&&!r&&Q.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":P,style:A,children:Q.map(Fe=>o.jsx(pv,{presenter:Fe,variant:"use",size:"grid",onOpen:$,href:la(d,Fe.id),onUse:h},Fe.id))}),n&&!r&&!O.length&&e.length>0&&o.jsx(Yp,{noun:"presenters",q:g,facet:S,onClearSearch:x,onClearAll:k}),n&&!r&&!e.length&&o.jsx(Oi,{shape:"zero",body:"The presenter library is still being cast. Check back soon."}),I>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:V,children:["Show ",Math.min(I,60)," more"]})})]})}),o.jsx(Ql,{})]})}const Hne={portrait:"Face",identity:"Face",front:"Full body","three-quarter":"Three-quarter",back:"Back",left:"Left",right:"Right","left-profile":"Left","right-profile":"Right"},Ine=["Front","Left","Right","Back"];function Fne(){var Y;const{presenterId:e=""}=Fs(),{presenters:t,presentersLoaded:n,presentersError:r,refetchPresenters:a,applyBrand:i,refreshBrands:c,presenterCategories:d}=jn(),{brand:f}=Qt(),h=Dn(),p=qp(),g=s.useRef(!1),v=k4(),[y,b]=s.useState([]),[x,k]=s.useState(null),[S,E]=s.useState(null),C=TG(f,e),N=C??t.find(J=>J.id===e);dc(N==null?void 0:N.name);const M=!!C;s.useEffect(()=>{let J=!0;if(b([]),!M)return Me.presenterFrames(e).then(de=>{J&&b(de.frames)}).catch(()=>{J&&b([])}),()=>{J=!1}},[e,M]);const T=!!tn({path:it.presenterEdit});s.useEffect(()=>{let J=!0;if(E(null),!(!M||T))return Me.presenterDrafts(f.id).then(de=>{if(!J)return;const ae=de.drafts.find(W=>W.presenterId===e);E((ae==null?void 0:ae.id)??null)}).catch(()=>{}),()=>{J=!1}},[f.id,e,M,T]);const L=((Y=f.json)==null?void 0:Y.characters)??[],A=L.find(J=>J.presenterId===e),P=L.find(J=>J.id===e),$=$4(f.id,[e??"",(A==null?void 0:A.id)??""]),[H,O]=s.useState(null),[Q,I]=s.useState(!1),[V,ie]=s.useState(!1),B=async J=>{if(C){I(!0),O(null);try{const de=await Me.updatePresenter(f.id,C.id,J);i(de.brand),ie(!1)}catch(de){O(String(de.message??de))}finally{I(!1)}}},F=async()=>{if(!C||g.current)return;g.current=!0;const J=p(),de=Vi(f);I(!0);try{const ae=await Me.deletePresenter(f.id,C.id);i(ae.brand)}catch(ae){if((ae==null?void 0:ae.status)!==404){g.current=!1,J()&&(O(String(ae.message??ae)),I(!1));return}await c()}J()&&h(de,{replace:!0})},te=Q6(f,e);if(te!==e)return o.jsx(no,{to:la(f,te),replace:!0});if(!n&&!C)return o.jsx(es,{children:o.jsx("main",{className:"sc-lookpage",id:"main",children:o.jsx("div",{className:"sc-tplrow","aria-hidden":!0})})});if(r&&!C)return o.jsx(es,{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(!N)return o.jsx(es,{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(Fn,{className:"sc-btn sc-btn-primary",to:Vi(f),children:"Browse presenters"})})]})});const X=C?(Array.isArray(P==null?void 0:P.shots)?P.shots:[]).map((J,de)=>({src:Or(J==null?void 0:J.file),label:Hne[(J==null?void 0:J.angle)??""]??`Reference ${de+1}`,angle:typeof(J==null?void 0:J.angle)=="string"?J.angle:void 0})).filter(J=>!!J.src):y.length?y.map((J,de)=>({src:J,label:Ine[de]??`Reference ${de+1}`})):N.previewUrl?[{src:N.previewUrl,label:"Preview"}]:[],Z=_6(f,e),K=Bo(C??N),z=[...new Set([...d,...rf(f).flatMap(J=>J.suitableCategories??[])])].sort((J,de)=>J.localeCompare(de));return o.jsx(es,{children:o.jsxs("main",{className:"sc-lookpage sc-presenterpage",id:"main",children:[K.src&&o.jsx("div",{className:"sc-presenterpage-avatar",children:o.jsx(Hg,{src:tr(K.src,"small"),crop:K.crop})}),o.jsx("h1",{children:N.name}),N.suitableCategories.length>0&&o.jsx("ul",{className:"sc-lookpage-cats","aria-label":"Filed under",children:N.suitableCategories.map(J=>o.jsx("li",{className:"sc-chip","data-static":!0,children:J},J))}),N.descriptor&&o.jsx("p",{className:"sc-lookpage-lede",children:N.descriptor}),o.jsxs("div",{className:"sc-lookpage-acts",children:[o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>v(e),children:"Use in a shot"}),C&&o.jsx(Fn,{className:"sc-btn sc-btn-ghost",to:Z,children:S?"Continue editing":"Edit presenter"}),C&&o.jsx(xr,{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:()=>ie(!0),children:o.jsx(q0,{size:17})})})]}),H&&o.jsx("p",{className:"sc-assetform-err",children:H}),X.length>0?o.jsx(H4,{count:X.length,label:"Reference set",className:"sc-refset-rail",trackClassName:"sc-refset",children:X.map(J=>o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-refset-tile","data-role":J.angle,"aria-label":`${J.label}, open`,onClick:()=>k(J),children:o.jsx(Hg,{src:tr(J.src,"small")})}),o.jsx("span",{className:"sc-refset-lb","aria-hidden":!0,children:J.label})]},J.label))}):o.jsx(D4,{}),C&&C.sourceRefs.length>0&&o.jsxs("section",{className:"sc-presenterpage-sources",children:[o.jsx("p",{className:"sc-presenterpage-sources-lb",children:"From your photos"}),o.jsx("div",{className:"sc-presenterpage-sources-row",children:C.sourceRefs.map((J,de)=>o.jsx("button",{type:"button",className:"sc-presenterpage-source","aria-label":`Source photo ${de+1}, open`,onClick:()=>k({src:J,label:`Source photo ${de+1}`}),children:o.jsx(Hg,{src:tr(J,"micro")})},J))})]}),C&&o.jsxs("div",{className:"sc-prec",children:[o.jsxs("p",{className:"sc-prec-note",children:[N.ageRange?`${N.ageRange} · `:"",C.source==="synthetic"?"Created in Scenri. Not a real person.":C.source==="photos"?"Built from your photographs.":"Saved in Scenri.",C.likeness?` Likeness confirmed ${new Date(C.likeness.attestedAt).toLocaleDateString()}.`:""]}),o.jsx(mr,{label:"Delete presenter",title:`Delete ${C.name}?`,body:"Shots already made with them keep their images and their recipe. Only future shots lose them.",busy:Q,onConfirm:()=>void F()})]}),$.length>0&&o.jsx(bu,{label:`Shots featuring ${N.name}`,children:$.map(J=>o.jsx(O4,{node:J,to:Ap(f,null,J.id)},J.id))}),V&&C&&o.jsx(tM,{name:C.name,categories:N.suitableCategories,known:z,hint:"The verticals they suit, so they surface where you work.",busy:Q,error:H,onSave:J=>void B({name:J.name,suitableCategories:J.categories}),onDismiss:()=>ie(!1)}),x&&o.jsx(Du,{src:x.src,kind:"presenter",label:x.label,noun:N.name,onClose:()=>k(null)})]})})}function Hg({src:e,crop:t}){const[n,r]=s.useState(!1);return n?o.jsx("span",{className:"sc-lookpage-ref-blank","aria-hidden":!0,children:o.jsx(Vs,{size:20})}):o.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async",...t?{"data-crop":t}:{},onError:()=>r(!0)})}function _ne({placeholder:e,label:t,action:n="Send",scope:r,hint:a,value:i,onValue:c,allowEmpty:d,disabled:f,why:h,quiet:p,working:g,error:v,focusKey:y,onStop:b,stopping:x,onAttach:k,onAttachFiles:S,attachLabel:E,colour:C,refs:N,onSend:M}){const T=s.useRef(null),L=s.useRef(null),[A,P]=s.useState(void 0);s.useLayoutEffect(()=>{const Z=T.current;if(!Z)return;Z.style.height="auto";const K=Number.parseFloat(getComputedStyle(Z).maxHeight)||Number.POSITIVE_INFINITY;Z.style.height=`${Math.min(Z.scrollHeight,K)}px`,Z.style.overflowY=Z.scrollHeight>K?"auto":"hidden"},[i]);const[$,H]=s.useState(!1),O=sr(da);s.useEffect(()=>{if(!y||y===A||f||(P(y),O))return;const Z=T.current;if(Z==null||Z.focus({preventScroll:!0}),Z!=null&&Z.value){Z.select(),H(!0);const K=setTimeout(()=>H(!1),700);return()=>clearTimeout(K)}},[y,A,f,O]);const Q=f||g,I=!!(C!=null&&C.hex)||!!(N!=null&&N.some(Z=>!Z.busy)),V=!i.trim()&&!d&&!I,ie=()=>{Q||V||M(i)},B=v?{text:v,tone:"alert"}:{text:(r==null?void 0:r.hint)??a??"",tone:r==null?void 0:r.tone},F=!!b&&(g||!i.trim()&&!I),te=g||F?null:f&&h?h:V&&!f?"Nothing typed yet.":null,X=o.jsxs("button",{type:"button",className:"sc-convo-send","aria-disabled":(F?!!x:g||Q||V)||void 0,"aria-busy":g||F||void 0,"data-stop":F||void 0,onClick:F?x?void 0:b:g?void 0:ie,children:[o.jsx("span",{className:"sc-convo-send-ico",children:g||F?o.jsx("span",{className:"sc-convo-spin","aria-hidden":"true"}):o.jsx(N7,{size:17,weight:"bold"})}),F?x?"Stopping":"Stop":g?"Working":n]});return o.jsxs("div",{className:"sc-convo-composer",children:[o.jsxs("div",{className:"sc-convo-card","data-quiet":p||void 0,"data-flash":$||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:[N==null?void 0:N.map(Z=>o.jsxs("span",{className:"sc-token","data-kind":"image","data-busy":Z.busy||void 0,dir:"ltr",children:[o.jsx("img",{src:Z.src,alt:""}),o.jsx("span",{className:"sc-token-label",children:Z.label}),o.jsx("button",{type:"button",className:"sc-convo-chip-x","aria-label":`Remove ${Z.label}`,onClick:Z.onRemove,children:o.jsx(Cn,{size:11,weight:"bold"})})]},Z.key)),C&&o.jsxs("span",{className:"sc-token","data-kind":"color","data-empty":C.hex?void 0:"",dir:"ltr",children:[o.jsxs(Pu,{className:"sc-convo-chip",triggerStyle:{background:"none"},value:C.hex??C.seed??"#808080",commitMode:"live",align:"start",label:C.hex?`${C.label}. Change the colour.`:"Pick a colour",onChange:C.onPick,children:[o.jsx("span",{className:"sc-token-swatch",style:C.hex?{background:C.hex}:void 0}),o.jsx("span",{className:"sc-token-label",children:C.label})]}),C.hex&&o.jsx("button",{type:"button",className:"sc-convo-chip-x","aria-label":"Remove colour",onClick:C.onClear,children:o.jsx(Cn,{size:11,weight:"bold"})})]}),o.jsx("textarea",{ref:T,className:"sc-in",rows:1,maxLength:400,"aria-label":t,placeholder:C!=null&&C.hex&&!i?"":f&&h?h:e,value:i,disabled:f,onChange:Z=>c(Z.target.value),onKeyDown:Z=>{Z.key!=="Enter"||Z.shiftKey||(Z.preventDefault(),ie())}})]}),o.jsxs("div",{className:"sc-convo-row",children:[(k||S)&&o.jsxs(o.Fragment,{children:[o.jsx(xr,{label:Q&&h?h:E??"Add photos",children:o.jsx("button",{type:"button",className:"sc-convo-attach","aria-label":E??"Add photos","aria-disabled":Q||void 0,onClick:Q?void 0:S?()=>{var Z;return(Z=L.current)==null?void 0:Z.click()}:k,children:o.jsx(kr,{size:16,weight:"bold"})})}),S&&o.jsx("input",{ref:L,type:"file",accept:"image/*",hidden:!0,"aria-label":E??"Add a picture",onChange:Z=>{const K=Array.from(Z.target.files??[]).filter(z=>z.type.startsWith("image/"));Z.target.value="",K.length&&S(K)}})]}),te?o.jsx(xr,{label:te,children:X}):X]})]}),B.text?o.jsx("small",{className:"sc-convo-line",role:B.tone==="alert"?"alert":void 0,"data-tone":B.tone,children:B.text}):null]})}function sM({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 Pk=500,aM=400,oM=760,Wc=e=>Math.min(oM,Math.max(aM,Math.round(e)));function Vne({title:e,headAction:t,stage:n,body:r,bodyProps:a,foot:i,overlay:c,kind:d,resizeLabel:f,onPaste:h,onDropFiles:p,onClose:g}){const v=s.useRef(null),[y,b]=s.useState(null);R4(y,"--sc-pstudio-dock-h"),s.useEffect(()=>{const C=N=>{N.key!=="Escape"||N.defaultPrevented||(N.preventDefault(),g())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[g]);const[x,k]=Na(Wr.pstudioRailW,Pk),S=s.useRef(0),E=s.useRef(0);return Mr.createPortal(o.jsx(Iu,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:C=>{var N;C.preventDefault(),(N=v.current)==null||N.focus({preventScroll:!0})},children:o.jsxs("div",{ref:v,tabIndex:-1,className:"sc-pstudio","data-kind":d,style:{"--sc-pstudio-rail-set":`${Wc(x)}px`},role:"dialog","aria-modal":"true","aria-labelledby":"sc-pstudio-title",onDragOver:C=>{p&&Array.from(C.dataTransfer.types).includes("Files")&&C.preventDefault()},onDrop:C=>{var M;if(!p||C.defaultPrevented)return;const N=Array.from(((M=C.dataTransfer)==null?void 0:M.files)??[]);N.length&&(C.preventDefault(),p(N))},onPaste:C=>{var M;if(!h)return;const N=Array.from(((M=C.clipboardData)==null?void 0:M.files)??[]).filter(T=>T.type.startsWith("image/"));N.length&&(C.preventDefault(),h(N))},children:[o.jsxs("div",{className:"sc-pstudio-grid",children:[o.jsx("div",{className:"sc-pstudio-resize",role:"separator","aria-orientation":"vertical","aria-label":f,"aria-valuemin":aM,"aria-valuemax":oM,"aria-valuenow":Wc(x),tabIndex:0,onPointerDown:C=>{C.button===0&&(C.preventDefault(),C.stopPropagation(),C.currentTarget.setPointerCapture(C.pointerId))},onPointerMove:C=>{if(!C.currentTarget.hasPointerCapture(C.pointerId))return;const N=C.currentTarget.closest(".sc-pstudio");S.current=C.clientX,!E.current&&(E.current=requestAnimationFrame(()=>{E.current=0,N==null||N.style.setProperty("--sc-pstudio-rail-set",`${Wc(window.innerWidth-S.current)}px`)}))},onPointerUp:C=>{C.currentTarget.releasePointerCapture(C.pointerId),E.current&&(cancelAnimationFrame(E.current),E.current=0),k(Wc(window.innerWidth-C.clientX))},onDoubleClick:()=>k(Pk),onKeyDown:C=>{if(C.key==="ArrowLeft")k(N=>Wc(N+16));else if(C.key==="ArrowRight")k(N=>Wc(N-16));else return;C.preventDefault()}}),o.jsx(xr,{label:"Close (esc)",children:o.jsx("button",{type:"button",className:"sc-pstudio-close",onClick:g,"aria-label":"Close",children:o.jsx(Cn,{size:13})})}),o.jsxs("div",{className:"sc-pstudio-head sc-newdlg-head",children:[o.jsx("h2",{id:"sc-pstudio-title",className:"sc-newdlg-title",children:e}),t,o.jsx("button",{type:"button",className:"sc-set-close sc-newdlg-close",onClick:g,"aria-label":"Close",children:o.jsx(Cn,{size:16})})]}),o.jsxs("div",{className:"sc-pstudio-scroll",children:[n,o.jsx("div",{className:"sc-pstudio-body",...a,children:r})]}),o.jsx("div",{className:"sc-pstudio-foot sc-dock",ref:b,children:i})]}),c]})}),document.body)}function Zne({hash:e,alt:t,drawing:n,since:r,items:a,onPick:i,compare:c,doing:d,takes:f,onTake:h,empty:p,glyph:g}){const v=zne(n),[y,b]=s.useState(null),x=f??[],k=Math.max(0,x.findIndex(P=>y?P.hash===y:P.current)),S=x[k];s.useEffect(()=>b(null),[e]);const E=Bne(y&&x.some(P=>P.hash===y)?y:e),[C,N]=s.useState(void 0);s.useEffect(()=>N(void 0),[e]);const M=P=>{const $=x[k+P];$&&b($.hash)},T=s.useRef(null),[L,A]=s.useState(!1);return s.useLayoutEffect(()=>{const P=T.current;A(!(P!=null&&P.complete&&P.naturalWidth))},[E]),o.jsxs("div",{className:"sc-pstudio-stage",children:[o.jsx("div",{className:"sc-pstudio-wrap",children:o.jsxs("div",{className:"sc-pstudio-well","data-drawing":n||void 0,"data-empty":!e||void 0,style:C?{"--sc-well-ar":C}:void 0,children:[e&&E?o.jsx("img",{ref:T,src:Dr(E),srcSet:`${nn(E,"tile")} 640w, ${Dr(E)} 1024w`,sizes:"(max-width: 767px) 92vw, 44vw",alt:t,decoding:"async","data-waiting":L||void 0,onLoad:P=>{const $=P.currentTarget;A(!1),$.naturalWidth&&$.naturalHeight&&N($.naturalWidth/$.naturalHeight)}}):o.jsx("span",{className:"sc-pstudio-well-blank",children:!n&&o.jsx(sM,{glyph:g,lead:p==null?void 0:p.lead,hint:p==null?void 0:p.hint})}),n&&!e&&o.jsx("span",{className:"sc-shimmer","aria-hidden":!0}),n&&e&&o.jsx("span",{className:"sc-pstudio-veil","aria-hidden":!0}),n&&o.jsxs("span",{className:"sc-pstudio-doing",role:"status",children:[o.jsx("span",{className:"sc-pstudio-ring","aria-hidden":!0}),o.jsx("span",{children:d??"Drawing"}),r&&o.jsx("time",{children:Wl(r,v)})]}),x.length>1&&!n&&!(c!=null&&c.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&&M(-1),children:o.jsx(Da,{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 ",x.length]}),o.jsx("button",{type:"button",className:"sc-pstudio-vers-step","aria-label":"The version after","aria-disabled":k===x.length-1||void 0,onClick:()=>k<x.length-1&&M(1),children:o.jsx(qi,{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"})]}),c&&!n&&o.jsx("button",{type:"button",className:"sc-pstudio-compare","aria-pressed":c.on,onClick:c.toggle,children:c.on?"Showing current":"Compare"})]})}),a.length>0&&o.jsx("ol",{className:"sc-pstudio-strip","aria-label":"Views",children:a.map(P=>{const $=P.label+(P.approved?", used":P.state==="stale"?", to be drawn again":"")+(P.photo?", your photo":"")+(P.drawing?", drawing":"")+(P.error?", failed":"");return o.jsxs("li",{children:[o.jsx("button",{type:"button",className:"sc-pstudio-slot","data-state":P.state,"data-view":P.view,"aria-current":P.state==="current"?"step":void 0,"aria-label":$,disabled:!i,onClick:()=>i==null?void 0:i(P.view),children:o.jsxs("span",{className:"sc-pstudio-slot-inner",children:[P.hash?o.jsx("img",{src:nn(P.hash,"micro"),alt:""}):null,P.drawing&&!P.hash?o.jsx("span",{className:"sc-shimmer","aria-hidden":!0}):null,P.drawing&&P.hash?o.jsx("span",{className:"sc-pstudio-slot-work sc-pstudio-ring","aria-hidden":!0}):null,P.approved&&!P.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","aria-hidden":!0,children:o.jsx(nr,{size:11,weight:"bold"})}):null,P.error&&!P.drawing?o.jsx("span",{className:"sc-pstudio-slot-mark","data-tone":"alert","aria-hidden":!0,children:o.jsx(Cp,{size:11,weight:"bold"})}):null]})}),o.jsx("span",{className:"sc-pstudio-slot-lb","data-on":P.state==="current"||void 0,"aria-hidden":!0,children:P.label})]},P.view)})})]})}function zne(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 Bne(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=`${nn(e,"tile")} 640w, ${Dr(e)} 1024w`,i.sizes="(max-width: 767px) 92vw, 44vw",i.src=Dr(e),i.decode?i.decode().then(a,a):(i.onload=a,i.onerror=a);const c=window.setTimeout(a,3e3);return()=>{r=!1,window.clearTimeout(c)}},[e,t]),t}function I4({surface:e,onClose:t}){var p,g,v;const n=sr(da),r=e,a=(p=r.stage)==null?void 0:p.onPick,i=a?y=>a(y):void 0,c=r.turns[r.turns.length-1],d=(c==null?void 0:c.kind)==="question"&&c.question.kind==="confirm"&&!c.question.quiet?c.question:null;s.useEffect(()=>{if(!d||r.busy)return;let y=!1;const b=x=>{if(x.key!=="Enter"||x.shiftKey||x.defaultPrevented||y)return;const k=x.target;k&&(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.tagName==="BUTTON"||k.isContentEditable)||(x.preventDefault(),y=!0,r.onAnswer(d.id,{kind:"confirm",id:d.options[0].id}))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[d,r.busy,r.onAnswer]);const f=r.glyph??o.jsx(sU,{size:32}),h=n?null:r.stage?o.jsx(Zne,{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:f}):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(sM,{glyph:f,lead:(g=r.stageEmpty)==null?void 0:g.lead,hint:(v=r.stageEmpty)==null?void 0:v.hint})})})})});return o.jsx(Vne,{kind:r.kind??"presenter",title:r.title,headAction:r.headAction,resizeLabel:"Resize the conversation",onPaste:r.onPaste,onClose:t,overlay:r.overlay,stage:h,bodyProps:{"data-convo":!0},body:o.jsx(rQ,{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:y=>(r.onStarter??r.onText)(y),onDescribe:r.onDescribe,onAttachFiles:r.onAttachRef}),foot:o.jsxs(o.Fragment,{children:[r.dock,r.composer&&o.jsx(_ne,{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 qu=[{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"}]}}],fa=e=>qu.find(t=>t.id===e),Une=/\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 iM(e){return Une.test(e??"")}function Wne(e,t){var a,i,c;const n=((a=t.words)==null?void 0:a.trim())??"",r=((i=t.where)==null?void 0:i.trim())??"";return n?r&&!iM(n)?`${n} ${r}`:n:r?`${((c=fa(e))==null?void 0:c.label.toLowerCase())??e} ${r}`:""}function Lk(e,t){const n=(t??[]).filter(r=>/\b(left|right)\b/i.test(r.words)&&(e==="front"||!Gne.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 Gne=new Set(["tattoo","prosthetic"]),Xp=["who","age","heritage","skin","hair","length","facial","eyes","build","height"],Gl="either",Kl=e=>{var t,n;return[(e==null?void 0:e.pick)===Gl?"":(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(", ")},lM=e=>{var t;return!!(e!=null&&e.pick||(t=e==null?void 0:e.words)!=null&&t.trim())},Qp=e=>{var t;return((t=e.source)==null?void 0:t.door)==="scratch"},gv=e=>{var t;return Qp(e)&&((t=e.source)==null?void 0:t.via)==="taps"},Jp=e=>{var t;return Qp(e)&&((t=e.source)==null?void 0:t.via)!=="taps"},em=e=>{var t;return((t=e.source)==null?void 0:t.door)==="photos"},Kne=/\b(slim|slender|athletic|average|fuller|curvy|broad|lean|muscular|petite|stocky|heavy|thin|plus.size)\b/i;function F4(e){const t=e.trim(),n=t.split(/\s+/).filter(Boolean).length,r=[];return hh.test(t)||r.push("who"),B6.test(t)||r.push("age"),r.length&&!Kne.test(t)&&n<8&&r.push("build"),r}const Yne=(e,t)=>Xp.every(n=>!mM(`look-${n}`,e,t)||e[`look-${n}`]!==void 0),cM=e=>Jp(e)&&e.describe!==void 0&&F4(e.describe).length>0,qne=e=>Jp(e)&&e.describe!==void 0&&(!cM(e)||e.gaps!==void 0),Xne=(e,t)=>{var n;return em(e)&&!!t.draft&&t.draft.source==="photos"&&t.canGenerate&&t.draft.stage!=="analyzing"&&(e.traits!==void 0||!((n=t.draft.keep)!=null&&n.trim()))},uM=(e,t)=>gv(e)?Yne(e,t):Jp(e)?qne(e):Xne(e,t),Qne=(e,t)=>Qp(e)||em(e)&&!!t.draft,dM=e=>t=>{var n;return!!((n=t.traits)!=null&&n.includes(e))},fM=e=>t=>lM(t[`trait-${e}`]),hM=e=>t=>{var n;return dM(e)(t)&&fM(e)(t)&&!!((n=fa(e))!=null&&n.where)&&!iM(Kl(t[`trait-${e}`]))},$1=(e,t)=>Array.isArray(e)&&e.includes(t),Jne=(e,t)=>{var n;return uM(e,t)&&(((n=e.traits)==null?void 0:n.every(r=>fM(r)(e)&&(!hM(r)(e)||e[`trait-${r}-where`]!==void 0)))??!1)},ere=(e,t)=>JSON.stringify(e)!==JSON.stringify(t),tre=(e,t)=>{var r;if(!em(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)},_o=[{id:"source",applies:()=>!0},{id:"photos",applies:em},{id:"weakphotos",applies:tre},...Xp.map(e=>({id:`look-${e}`,applies:e==="facial"?t=>{var n;return gv(t)&&((n=t["look-who"])==null?void 0:n.pick)!=="woman"}:gv})),{id:"describe",applies:Jp},{id:"gaps",applies:cM,dependsOn:[{on:"describe"}]},{id:"traits",applies:Qne,ready:uM},...qu.flatMap(e=>[{id:`trait-${e.id}`,applies:dM(e.id),dependsOn:[{on:"traits",changed:(t,n)=>$1(t,e.id)!==$1(n,e.id)}]},{id:`trait-${e.id}-where`,applies:hM(e.id),dependsOn:[{on:`trait-${e.id}`,changed:(t,n)=>Kl(t)!==Kl(n)},{on:"traits",changed:(t,n)=>$1(t,e.id)!==$1(n,e.id)}]}]),{id:"keep",applies:Qp,ready:Jne,optional:!0,sticky:!0}],pM=new Map(_o.map(e=>[e.id,e])),nre=_o.map(e=>e.id),E0=e=>{const t=_o.findIndex(n=>n.id===e);return t<0?_o.length:t},rre=e=>pM.get(e);function mM(e,t,n){return rre(e).applies(t,n)}function gM(e,t,n){if(e==="photos")return!!n.draft&&n.draft.source==="photos";const r=t[e];return r===void 0?!1:er(e)||are(e)?lM(r):!0}function vM(e,t){return _o.filter(n=>n.applies(e,t)&&gM(n.id,e,t)).map(n=>n.id)}function tm(e,t){var n;return((n=_o.find(r=>{var a;return!r.optional&&r.applies(e,t)&&(((a=r.ready)==null?void 0:a.call(r,e,t))??!0)&&!gM(r.id,e,t)}))==null?void 0:n.id)??null}function Tk(e,t,n){const r={...e},a=new Set,i=new Set(Object.keys(t));for(const[d,f]of Object.entries(t))ere(e[d],f)&&(f===void 0?delete r[d]:r[d]=f,a.add(d));if(a.size){const d=_o.map(g=>g.id),f=Math.min(...[...a].map(g=>d.indexOf(g))),h=new Set(a),p=g=>(g.dependsOn??[]).some(v=>h.has(v.on));for(const g of _o)d.indexOf(g.id)<=f||i.has(g.id)||r[g.id]===void 0||g.sticky||p(g)||(delete r[g.id],a.add(g.id))}let c=!0;for(;c;){c=!1;for(const d of _o){if(r[d.id]===void 0)continue;(!i.has(d.id)&&(d.dependsOn??[]).some(h=>a.has(h.on)&&(h.changed?h.changed(e[h.on],r[h.on]):!0))||!d.applies(r,n))&&(delete r[d.id],a.add(d.id),c=!0)}}return r}function sre(e){const t={};for(const n of e.traits??[]){const r=e[`trait-${n}`];r&&(t[n]={words:Kl(r)||void 0,where:Kl(e[`trait-${n}-where`])||void 0,refs:r.refs.length?r.refs:void 0})}return t}function yM(e){const t={};for(const n of Xp){const r=e[`look-${n}`];r!==void 0&&(t[n]=r)}return t}const wM=e=>qu.map(t=>t.id).filter(t=>e.includes(t)),er=e=>e.startsWith("look-"),are=e=>e.startsWith("trait-"),Ps=e=>pM.has(e);function Gr(e){if(!e.startsWith("trait-"))return null;const t=e.endsWith("-where"),n=t?e.slice(6,-6):e.slice(6);return fa(n)?{id:n,part:t?"where":"what"}:null}const ore=[{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"}],ire=[{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"}],lre=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"]),cre=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 ure(e){const[t,n,r]=cre(e),a=t/255,i=n/255,c=r/255,d=Math.max(a,i,c),f=Math.min(a,i,c),h=(d+f)/2,p=d-f;if(p===0)return{h:0,s:0,l:h};const g=p/(1-Math.abs(2*h-1));return{h:((d===a?60*((i-c)/p%6):d===i?60*((c-a)/p+2):60*((a-i)/p+4))+360)%360,s:g,l:h}}const dre=e=>{var t;return((t=ore.find(n=>e<n.to))==null?void 0:t.name)??"red"};function fre(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 hre(e){return e<.18?"deep":e<.34?"dark":e>=.88?"pale":e>=.74?"light":""}function bM(e){var d;const{h:t,s:n,l:r}=ure(e);if(n<.09){const f=((d=ire.find(h=>r<h.to))==null?void 0:d.name)??"grey";return{name:f,family:f,h:t,s:n,l:r}}const a=dre(t),i=fre(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 c=hre(r);return c?{name:`${c} ${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 pre(e){const{family:t,h:n,s:r,l:a}=bM(e);return lre.has(t)?!0:n>=16&&n<=60&&a>=.7&&r<.7||r<.09}const _4=[{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"}],xM=[{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"}],V4=[{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"}],kM=[{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"}],mre=[{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"}],Z4=[{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"}],SM=[{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"}],EM=[{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"}],gre={},CM=[{id:"woman",label:"Woman"},{id:"man",label:"Man"},{id:"androgynous",label:"Androgynous"}],jM=["20s","30s","40s","50s","60+"].map(e=>({id:e,label:e})),hf={who:{row:{id:"who",label:"Who",options:CM},prompt:"Who are they?"},age:{row:{id:"age",label:"Age",options:jM},prompt:"Roughly how old?"},heritage:{row:{id:"heritage",label:"Heritage",options:mre},prompt:"Where are they from?"},skin:{row:{id:"skin",label:"Skin",options:V4},prompt:"And their skin?"},eyes:{row:{id:"eyes",label:"Eyes",options:Z4},prompt:"What colour are their eyes?"},facial:{row:{id:"facial",label:"Facial hair",options:SM},prompt:"Any facial hair?"},hair:{row:{id:"hair",label:"Hair",options:_4},prompt:"What colour is their hair?"},length:{row:{id:"length",label:"Length",options:xM},prompt:"And the length?"},build:{row:{id:"build",label:"Build",options:kM},prompt:"And their build?"},height:{row:{id:"height",label:"Height",options:EM},prompt:"And how tall?"}};Xp.map(e=>hf[e]);const $k=new Set(["hair","skin","eyes"]),vre={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"},yre=e=>e==="man"?"man":e==="woman"?"woman":"androgynous",wre=new Set(["length","height","build"]),bre=900;function z4(e,t,n){const r=xre(e,t);if(r.far<bre)return r.id;const a=bM(e).name;return n==="hair"&&!pre(e)?`dyed ${a}`:a}function xre(e,t,n){const r=h=>{const p=h.replace("#","");return(p.length===3?p.split("").map(v=>v+v):[p.slice(0,2),p.slice(2,4),p.slice(4,6)]).map(v=>Number.parseInt(v,16)||0)},[a,i,c]=r(e);let d=t[0],f=Number.POSITIVE_INFINITY;for(const h of t){if(!h.color)continue;const[p,g,v]=r(h.color),y=(a-p)**2+(i-g)**2+(c-v)**2;y<f&&(f=y,d=h)}return{id:d.id,far:f}}const Dk=e=>e==="skin"?V4:e==="eyes"?Z4:_4,th=e=>e.charAt(0).toUpperCase()+e.slice(1);function AM(e){const t=H=>H!=null&&H.pick&&H.pick!==Gl?H.pick:"",n=(H,O,Q)=>{var V;const I=t(H);return I?I.startsWith("#")?z4(I,O,Q):I:((V=H==null?void 0:H.words)==null?void 0:V.trim())??""},r=H=>{var O;return t(H)?((O=H==null?void 0:H.words)==null?void 0:O.trim())??"":""},a=(H,...O)=>[H,...O.filter(Boolean)].join(" "),i=(H,O,Q)=>n(H,O,Q).toLowerCase(),c={androgynous:"androgynous person",man:"man",woman:"woman"},d=i(e.who,[]),f=c[d]??d,p=[n(e.heritage,[]),f].filter(Boolean).join(" "),v=[p?/^(a|an|the)\s/i.test(p)?p:`${/^[aeiou]/i.test(p)?"an":"a"} ${p}`:"a person"],y=i(e.age,[]),b=y==="60+"?"in their 60s or older":/^\d{1,3}$/.test(y)?`aged ${y}`:`in their ${y}`;y&&v.push(a(b,r(e.age)));const x=[],k=i(e.length,xM),S=i(e.hair,_4,"hair"),E=[k,S].filter(Boolean).join(" ");E&&x.push(a(`${E} hair`,r(e.length),r(e.hair)));const C=i(e.facial,SM);C&&x.push(a(C,r(e.facial)));const N=i(e.eyes,Z4);N&&x.push(a(`${N} eyes`,r(e.eyes)));const M=i(e.skin,V4,"skin");M&&x.push(a(`${M} skin`,r(e.skin)));const T=i(e.height,EM),L=i(e.build,kM),A=T?a(gre[T]??T,r(e.height)):"",P=L?a(`${/^[aeiou]/.test(L)?"an":"a"} ${L} build`,r(e.build)):"",$=[A,P&&(A?`with ${P}`:P)].filter(Boolean).join(" ");return $&&x.push($),x.length&&v.push(`with ${x.join(", ")}`),a(v.join(" "),r(e.who))}function kre(e,t){var i,c;const n=t.pick,r=n===Gl?"Either way":n!=null&&n.startsWith("#")?th(z4(n,e.options,e.id)):n?((i=e.options.find(d=>d.id===n))==null?void 0:i.label)??th(n):"",a=((c=t.words)==null?void 0:c.trim())??"";return r?a?`${r}, ${a}`:r:th(a)}function Sre(e){return th(AM(e))}const C0=e=>typeof e=="string"&&e.startsWith("aside:"),Ere=e=>e.slice(6),$h={answers:{},revision:0,editing:null,saying:null,says:0,text:"",colour:null,composing:null,asides:[],unsure:null,extrasDeclined:!1,uploading:0},Cre="That did not read as a description of someone.",NM=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function jre(e){if(!e||e==="name")return null;if(e==="keep")return"keep";const t=Gr(e);return t&&t.part==="what"?`trait-${t.id}`:null}function Ok(e,t){var r;const n=jre(t);return n?{id:n,refs:((r=e.answers[n])==null?void 0:r.refs)??[]}:null}function Ig(e){const t=e.composing;if(!t)return e.answers;const n=e.answers[t.id];if(!n||NM(n.refs,t.refs))return e.answers;if(!Kl(n)&&!t.refs.length){const r={...e.answers};return delete r[t.id],r}return{...e.answers,[t.id]:{...n,refs:t.refs}}}function Are(e,t){var r;if(!er(t)&&!Gr(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 vv(e,t,n,r){return e.filter(a=>!a.q||!Ps(a.q)?!0:!mM(a.q,t,n)||a.edit&&t[a.q]!==void 0?!1:r===void 0||E0(a.q)<=r)}function Nre(e){const t=Object.keys(e).filter(n=>Ps(n));return t.length?Math.min(...t.map(E0)):void 0}function MM(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 Fg(e,t){const n=e.unsure;if(!n)return e;const r=tm(e.answers,t),a=d=>d&&(d===r||Ps(d)&&e.answers[d]!==void 0)?d:null,i=e.asides.map(d=>d.q==="unsure"?{...d,q:a(n.q)}:d),c=MM(i,{said:n.said,reply:Cre,q:a(n.q),at:n.at});return{...e,unsure:null,asides:vv([...i,c],e.answers,t)}}function Mre(e,t){var n,r,a;switch(t.type){case"answer":{const i=Tk(e.answers,t.patch,t.ctx),c=!NM(i,e.answers),d=Fg(e,t.ctx);return{...d,answers:i,revision:c?e.revision+1:e.revision,asides:vv(d.asides,i,t.ctx,Nre(t.patch)),editing:null,saying:null,colour:null,composing:null,text:""}}case"edit":{const i=C0(t.id)||t.id==="name"?void 0:Are(e,t.id);return{...e,answers:Ig(e),composing:C0(t.id)?null:Ok(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),c=i!=null&&i.q&&Ps(i.q)?i.q:null,d=c&&e.answers[c]!==void 0?Tk(e.answers,{[c]:void 0},t.ctx):e.answers,f=vv(e.asides.filter(h=>h.at<=t.at),d,t.ctx,c?E0(c):void 0);return{...e,answers:d,revision:d===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:Ig(e),composing:null,editing:null,saying:null,colour:null,text:""};case"say":{const i=e.saying===t.id?null:t.id;return{...e,answers:Ig(e),composing:Ok(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 c=!!t.aside.q&&Ps(t.aside.q)&&e.answers[t.aside.q]!==void 0?{...t.aside,after:!0}:t.aside;return{...e,asides:[...e.asides,MM(e.asides,c)],text:""}}case"unsure":return{...Fg(e,t.ctx),unsure:t.unsure,text:""};case"settle-unsure":return Fg(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 c=i.hashes.filter(d=>d!==t.hash);return{...e,answers:{...e.answers,photos:{hashes:c,attested:c.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 d=t.id.slice(6);if(!((a=e.answers.traits)!=null&&a.includes(d)))return e}const i=e.answers[t.id]??{refs:[]},c=t.remove?i.refs.filter(d=>d!==t.hash):t.id==="keep"?[...i.refs.filter(d=>d!==t.hash),t.hash].slice(-4):[t.hash];return c.join()===i.refs.join()?e:{...e,answers:{...e.answers,[t.id]:{...i,refs:c}},revision:e.revision+1}}case"extras-declined":return{...e,extrasDeclined:!0};case"start-over":return{...$h,revision:e.revision+1,text:t.text??""};case"restore":return{...$h,answers:t.answers,revision:t.revision,asides:t.asides??[]}}}function yv(e,t){return tm(e.answers,t)===null&&!e.editing&&!e.saying}const RM=5,PM=40;function Rre(e){return JSON.stringify({v:RM,answers:e.answers,revision:e.revision,asides:e.asides.slice(-PM)})}function Pre(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,c=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}:{},...c?{edit:c}:{}}}function Lre(e){var r;if(er(e))return hf[e.slice(5)].row.options;const t=Gr(e),n=t&&fa(t.id);return n?t.part==="where"?((r=n.where)==null?void 0:r.options)??[]:n.options:[]}function Hk(e,t){return t===Gl||/^#[0-9a-f]{6}$/i.test(t)?{pick:t}:Lre(e).some(n=>n.id===t)?{pick:t}:{words:t}}function Tre(e,t){if(e==="keep")return typeof t=="string"?{words:t,refs:[]}:t;if(typeof t=="string"&&(er(e)||Gr(e)))return Hk(e,t);const n=Gr(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}:{...Hk(e,r.words),refs:a}}return t}function Dh(e){if(!e)return null;try{const t=JSON.parse(e);if(t.v!==RM&&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))Ps(a)&&(n[a]=Tre(a,i));const r=(Array.isArray(t.asides)?t.asides:[]).map(Pre).filter(a=>a!==null).slice(-PM);return{answers:n,revision:typeof t.revision=="number"?t.revision:0,asides:r}}catch{return null}}const Nn={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?",nameWhileDrawing:"While it draws: what should we call them?",nameWhileReading:"While I read them: 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?",identity:e=>`Here is ${e==="them"?"the face":e}. Use this person, or change something.`,change:"What should change?",landed:e=>`Here is the ${e}. Use it, or try again.`,extras:"Add back and profile views? They help shots from behind or in profile."},LM=e=>e==="photos"?"the photos":"the face",TM=[{id:"photos",label:"Add photos"},{id:"scratch",label:"Describe someone"}],$re={photos:/\b(photos?|pictures?|pics?|upload|images?|selfies?)\b/,scratch:/\b(scratch|describe|description|invent|make (someone|one|them) up|imagine|new person)\b/},Dre=[{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."}],Ore="I have permission to use this person's likeness.";function Hre(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 Ire=(e,t)=>`${e} is larger than ${Math.round(t/1024/1024)}MB. Choose a smaller copy of it.`,Fre=e=>`${e} could not be read as a photograph. JPEG, PNG, WebP and HEIC all work.`,_re="First portrait appears here",Vre=(e,t)=>!e||e==="portrait"||!t?_re:`The ${t} appears here`;function Zre(e){return e==="agree"?"Ready when you are":e==="photos"?"Add their photos":"Keep describing your presenter"}const $M=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 zre(e){return e===1?"One photo":`${e} photos`}function Bre(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 Ure="That does not read as a description yet. Draw from it anyway, or describe them: age, hair, build, skin, presence.",Wre=e=>e===0?void 0:e===1?"Changing this asks the one after it again.":`Changing this asks the ${e} after it again.`,Gre="Change this answer?",Kre="The face is drawn again from the change, and the views built on it follow. Nothing already saved changes.",Yre="The views drawn from the photos are drawn again with the change. The photos themselves stay as they are.",qre={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"},Xre={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"}},Xr=e=>e.charAt(0).toUpperCase()+e.slice(1);function xl(e,t,n,r="",a,i=!1){const c=t==="look"?Xre[a??""]??null:null,d=(c==null?void 0:c.how)??qre[t],f=i?"":` ${Xr(d)}.`;if(n>=2&&e!=="likeness"){const h=t==="look"||t==="detail"?"Or Skip it and we will choose.":"";return i?h||`${Xr(d)}.`:`${Xr(d)}.${h?` ${h}`:""}`}switch(e){case"likeness":return"Describe them by looks. Scenri does not draw a named person.";case"help":return c?`${Xr(d)}.`: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"?`${Xr(d)}.`:"Describe the person in a sentence: age, hair, build, skin, presence. Or add photos of a real person.";case"question":return c?`This step asks for ${c.thing}: ${d}.`:t==="refine"?`This is where the picture is changed: ${d}.`:t==="name"?`This is where they get a name: ${d}.`:t==="detail"?`This asks what the detail looks like: ${d}.`:`This is where the person is described: ${d}.`;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. ${Xr(d)}.`;case"intent":return c?`${Xr(d)}.`:t==="refine"?`Nothing changes until it is said what: ${d}.`:`That is what we are here for. Who are they? ${Xr(d)}.`;case"nonsense":return c?`That is not ${c.thing}.${f}`:t==="name"?`That is not a name. ${Xr(d)}.`:t==="refine"?`That does not say what should change. ${Xr(d)}.`:t==="detail"?`That does not say what it looks like. ${Xr(d)}.`:`That does not describe anyone. ${Xr(d)}.`;case"greeting":return n?`Still here.${f}`:/^(hi|hello|hey|heya|hiya|yo|hola|shalom|good)\b/i.test(r.trim())?`Hi.${f}`:`${Xr(d)}.`;case"ack":return n?`Still here.${f}`:i?"Go ahead.":`Go ahead: ${d}.`;case"vague":return n?`Still here. ${Xr(d)}.`:`${Xr(d)}.`}}const j0=e=>e.trim().replace(/[.\s]+$/,"");function Ik(e,t){const n=e==="portrait"?"face":vn[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"}]}:{id:"retry",kind:"confirm",tone:"alert",prompt:`The ${n} could not be drawn: ${j0(t)}. Nothing finished was touched.`,options:[{id:"retry",label:"Retry"}]}}function Qre(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 Jre(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 ese=e=>e.charAt(0).toUpperCase()+e.slice(1);function tse({draft:e,canGenerate:t,ui:n,afterCoverage:r,asides:a,openId:i,placed:c}){var ae;const d=[],f=(W,ye,ee)=>d.push({kind:"scenri",id:W,text:ye,tone:ee}),h=W=>d.push({kind:"question",question:W}),p=((ae=e.name)==null?void 0:ae.trim())??"",g=p||"them",v=()=>{p&&(d.push({kind:"scenri",id:"asked-name",text:Nn.name,quiet:!0}),d.push({kind:"you",id:"name",text:p,editable:!0,editing:n.editingName||void 0}))},y=W=>h({id:"name",kind:"text",prompt:W});if(e.stage==="analyzing")return f("reading",`Reading ${LM(e.source)}.`),p?v():y(Nn.nameWhileReading),d;const b=RW(e,t);if(b&&f("coverage",b.text,b.tone),d.push(...r),!t&&e.source==="photos")return p&&v(),p?(h({id:"blind",kind:"confirm",prompt:"No engine here can draw the other views. Save them from the photos as they are?",options:[{id:"save",label:"Save with photos"},{id:"setup",label:"Set up"}]}),d):(y(Nn.name),d);const x=e.views.portrait,k=e.activeView,S=e.asks??[],E=S[S.length-1],C=E?e.views[E.view]:null,N=!!E&&!!C&&(C.status==="generating"&&e.activeView===E.view||C.status==="candidate"&&C.adjustment===E.text||!!C.error),M=W=>W==="portrait"&&!Oo(e)?Nn.identity(g):Nn.change,T=(e.results??[]).filter(W=>W.how!=="restored"),L=e.decisions??[],A=!e.activeView&&e.stage==="idle",P=new Map,$=new Map,H=new Map;for(const W of T){const ye=`${W.view}:${W.hash}`;if(H.set(ye,W),P.has(ye))continue;const ee=($.get(W.view)??0)+1;$.set(W.view,ee),P.set(ye,ee)}const O=W=>P.get(`${W.view}:${W.hash}`)??1,Q=(W,ye)=>{const ee=O(W),ge=e.views[W.view].hash===W.hash,re=($.get(W.view)??0)>1;return{kind:"scenri",id:ye,text:`Here is ${vn[W.view]} ${ee}.`,thumb:W.hash,view:W.view,label:`${Zl[W.view]} ${ee}`,current:re&&ge&&H.get(`${W.view}:${W.hash}`)===W,restore:A&&!ge&&!U6(e,W.view)?{view:W.view,hash:W.hash}:void 0}},I=new Set,V=new Map(S.map(W=>{const ye=T.find(ee=>!I.has(ee)&&ee.how==="drawn"&&ee.view===W.view&&ee.ask===W.text&&ee.at>=W.at);return ye&&I.add(ye),[W,ye]})),ie=new Map;for(const W of L)W.what==="use"&&!ie.has(W.view)&&ie.set(W.view,W);const B=W=>W==="portrait"?`Here is ${g} with the change. Use this, or keep the previous one. Using it redraws the views built on the face.`:`Redrew the ${vn[W]}. Use it, or keep the previous one.`,F=W=>{const ye=W===ie.get(W.view),ee=W.view==="portrait"&&ye,ge=W.what==="again"?"Try again":W.what==="keep"?"Keep previous":ee?"Use this person":W.view==="portrait"?"Use this":"Use it";return[{kind:"scenri",id:`asked-decided-${W.at}`,text:ee?Nn.identity(g):ye?Nn.landed(vn[W.view]):B(W.view),quiet:!0},{kind:"you",id:`decided-${W.at}`,text:ge,editable:!1}]},te=()=>{const W=N?S.slice(0,-1):S,ye=Jre(e),ee=a.filter(D=>!c.has(D)&&(D.q!==i||D.at<=ye));for(const D of ee)c.add(D);const ge=T.find(D=>fW.includes(D.view)),re=[...W.map(D=>{const G=V.get(D);return{at:D.at,turns:[{kind:"scenri",id:`asked-ask-${D.at}`,text:M(D.view),quiet:!0},{kind:"you",id:`ask-${D.at}`,text:D.text,editable:!1},...G?[Q(G,`redrew-${D.at}`)]:[]]}}),...T.filter(D=>!I.has(D)).map(D=>({at:D.at,turns:[Q(D,`result-${D.at}`)]})),...L.map(D=>({at:D.at,turns:F(D)})),...ee.map(D=>({at:D.at,turns:Wo(D)})),...Oo(e)&&(e.extras||n.extrasDeclined)?[{at:ge?ge.at.slice(0,-1):"~",turns:[{kind:"scenri",id:"asked-extras",text:Nn.extras,quiet:!0},{kind:"you",id:"extras",text:e.extras?"Add them":"Not now",editable:!1}]}]:[]];re.sort((D,G)=>D.at<G.at?-1:D.at>G.at?1:0);for(const D of re)d.push(...D.turns)},X=()=>{!N||!E||(d.push({kind:"scenri",id:`asked-ask-${E.at}`,text:M(E.view),quiet:!0}),d.push({kind:"you",id:`ask-${E.at}`,text:E.text,editable:!1}))};if(!Oo(e)){const W=x.status==="generating"||k==="portrait"&&x.status!=="candidate";return W&&!S.length?(f("drawing-face","Drawing their face."),p?v():y(Nn.nameWhileDrawing),d):(v(),te(),W?(X(),f("drawing-face",N?"Adjusting the face. Everything else stays.":"Drawing their face."),p||y(Nn.nameWhileDrawing),d):n.failed?(h({id:"retry",kind:"confirm",tone:"alert",prompt:`That did not go through: ${j0(n.failed??"")}. Nothing finished was touched.`,options:[{id:"retry",label:"Retry"}]}),d):x.error?(X(),h(Ik("portrait",x.error)),d):(x.status==="candidate"&&(X(),h({id:"identity",kind:"confirm",prompt:N?"Adjusted. Use this person, or try again.":Nn.identity(g),hint:Lk("portrait",e.keepItems),options:[{id:"use",label:"Use this person"},{id:"again",label:"Try again"},{id:"change",label:"Change something"}]})),d))}v(),te();const Z=Object.keys(e.views),K=Do(e),z=[...K].reverse().find(W=>F8.has(W)),Y=K.find(W=>!F8.has(W)),J=Z.find(W=>e.views[W].status==="candidate"),de=Z.find(W=>!!e.views[W].error);if(n.failed&&!k)return h({id:"retry",kind:"confirm",tone:"alert",prompt:`That did not go through: ${j0(n.failed??"")}. Nothing finished was touched.`,options:[{id:"retry",label:"Retry"}]}),d;if(k)return X(),f(`drawing-${k}`,N&&(E==null?void 0:E.view)===k?`Redrawing the ${vn[k]}.`:k===z&&!e.views[k].hash?`Drawing the ${vn[k]} from this face.`:k===Y&&!e.views[k].hash&&z?`Building the rest of the set from the ${vn[z]}.`:`Drawing the ${vn[k]}.`),p||y(Nn.nameWhileDrawing),d;if(J){X();const W=e.views[J],ye=!!W.prior,ee=re=>re?P.get(`${J}:${re}`)??0:0,ge=!!W.hash&&!!W.prior&&ee(W.hash)<ee(W.prior);return W.hash&&d.push({kind:"scenri",id:`candidate-${J}-${W.hash}`,text:ge?`Here is ${vn[J]} ${ee(W.hash)} again.`:ye?J==="portrait"?`Here is ${g} with the change.`:`Redrew the ${vn[J]}.`:`Here is the ${vn[J]}.`,thumb:W.hash,label:Zl[J],view:J,current:!0}),h({id:J==="portrait"?"revision":"view-revision",kind:"confirm",prompt:ye?J==="portrait"?`Use this, or keep the previous one.${PW(e,J)?" Using it redraws the views built on the face.":""}`:"Use it, or keep the previous one.":"Use it, or try again.",hint:J==="portrait"||J==="front"?Lk(J,e.keepItems):void 0,options:[{id:"use",label:J==="portrait"?"Use this":"Use it"},...ye?[{id:"keep",label:"Keep previous"}]:[],{id:"again",label:"Try again"}]}),d}return de?(X(),h(Ik(de,e.views[de].error??"")),d):hW(e)?!e.extras&&!n.extrasDeclined?(f("set-ready","The set is ready. Select a view and say what is wrong to redraw it."),h({id:"extras",kind:"confirm",prompt:Nn.extras,options:[{id:"add",label:"Add them"},{id:"save",label:"Not now"}]}),d):p?(h({id:"save",kind:"confirm",prompt:`${ese(g)} is ready.${Qre(e)}`,options:[{id:"save",label:"Save presenter"}]}),d):(y(Nn.name),d):(p||y(Nn.nameWhileDrawing),d)}const nse={who:{label:"Who",options:CM},age:{label:"Age",options:jM},build:{label:"Build",options:["slender","average","athletic","fuller"].map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1)}))}},Oh=e=>e.charAt(0).toUpperCase()+e.slice(1);function rse(e){return!e||e==="skipped"?"Draw as is":Object.values(e).map(t=>Oh(t)).join(", ")}function sse(e){const t=e.map(n=>{var r;return((r=fa(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 ase=e=>wX(e,TM,$re);function nm(e){var a;if(((a=e.source)==null?void 0:a.via)==="taps"){const i=yM(e),c=Kl(i.who);return AM(c&&!Js(c)?{...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 jW({steer:n.who??null,age:n.age??null},r)}function ose(e){return rm(e).map(t=>t.words)}const ise=200,lse=12;function rm(e){var i,c;const t=sre(e),n=(d,f,h)=>({id:d,words:f.slice(0,ise),...h!=null&&h.length?{refs:h.slice(0,4)}:{}}),r=[];for(const d of wM(e.traits??[])){const f=t[d],h=f?Wne(d,f):"";h&&r.push(n(d,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,(c=e.keep)==null?void 0:c.refs)),r.slice(0,lse)}function Fk(e){const t=ose(e);return t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function cse(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 use(e,t,n,r){const a=r.toLowerCase().split(/[^a-z0-9]+/).filter(c=>c.length>2);if(!a.length)return!0;const i=nm({...e,[t]:n}).toLowerCase();return a.every(c=>i.includes(c))}function dse(e){const t=Dh(e.setup??null);return t&&Object.keys(t.answers).length?{answers:t.answers,asides:t.asides}:{answers:fse(e),asides:[]}}function fse(e){const t=Dh(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},..._k(e)}:{source:{door:"scratch",via:"typed"},describe:e.direction??"",gaps:"skipped",traits:[],..._k(e)}}function _k(e){const t=e.keepItems??[];if(!t.length)return{};const n={},r=[];let a;for(const i of t){const c=qu.find(d=>d.id===i.id);if(c){r.push(c.id),n[`trait-${c.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 DM=(e,t)=>({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});function hse(e,t,n){var a,i;if(e==="source")return t.kind==="choice"?{source:{door:t.id,via:"taps"}}:null;if(er(e)){const c=(a=n[e])==null?void 0:a.words,d=c?{words:c}:{};return t.kind==="swatches"?{[e]:{pick:t.picks[e.slice(5)]??Object.values(t.picks)[0],...d}}:t.kind==="skip"?{[e]:{pick:Gl,...d}}: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:qu.map(c=>c.id).filter(c=>t.picks[c])}:t.kind==="skip"?{traits:[]}:null;const r=Gr(e);if(r&&t.kind==="choice"){if(r.part==="where"){const d=(i=n[e])==null?void 0:i.words;return{[e]:{pick:t.id,...d?{words:d}:{}}}}const c=n[`trait-${r.id}`];return{[e]:{pick:t.id,...c!=null&&c.words?{words:c.words}:{},refs:(c==null?void 0:c.refs)??[]}}}return null}function pse(e,t){var r;return`the ${((r=fa(e))==null?void 0:r.label.toLowerCase())??"detail"} in the attached ${t===1?"picture":"pictures"}`}const Vk="A scar, a ring, anything we missed",mse=new Set(["describe","keep"]),gse=new Set(["likeness","help","question","greeting","ack","nav","intent","go","nonsense"]);function Zk(e,t){const n=(t==null?void 0:t.trim())??"";return e?n?`${e}, ${n}`:e:Oh(n)}const vse=/^(?:but|and|though|although|only|just|except(?: that)?|with|without|plus)\s+/i,zk=e=>vse.test(e.trim());function _g(e){return e.trim().replace(/[.\s]+$/,"").replace(/^(?:but|and|though|although|only|just|except(?: that)?)\s+/i,"").trim()}function A0(e,t){if(!e)return!1;if(mse.has(e))return!0;if(!er(e)&&!Gr(e))return!1;const n=t[e];return!!n&&!n.pick&&!!n.words}function D1(e,t,n){const r=t.trim();return r?e==="look-age"&&bW(r)?null:e!=="look-who"&&(er(e)||e.startsWith("trait-"))&&vW(r)?"nonsense":er(e)||e.startsWith("trait-")||e==="keep"?wse(r,n):e==="describe"||e==="source"?Po(r,n):null:"vague"}function Vg(e,t,n){if(e&&er(e))return"look";if(e==="keep"||e!=null&&e.startsWith("trait-"))return"detail";const r=e??t;if(r&&er(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 Bk=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"]),yse=/^[a-z]{1,10}\d+$/i,wse=(e,t)=>{const n=e.trim(),r=n.toLowerCase().replace(/[^a-z ]/g,"");if(Bk.has(r)||Bk.has(r.replace(/^(the|their|its|his|her)\s+/,"")))return"nonsense";const a=n.split(/\s+/).filter(Boolean);if(a.length<=2&&a.some(c=>yse.test(c)))return"nonsense";const i=Po(e,t);return i&&gse.has(i)?i:null};function bse(e,t){return e==="name"?"metadata":t?e==="source"||e==="photos"?"start-over":"redraw":"plain"}function Uk(e,t,n,r){var f,h,p,g,v,y,b,x,k;const a=t.answers,i=r?{reopened:!0,cost:Wre(vM(a,n).filter(S=>S!=="keep"&&E0(S)>E0(e)).length)}:{};switch(e){case"source":return{id:e,kind:"choice",prompt:Nn.source,options:TM,given:(f=a.source)==null?void 0:f.door,...i};case"weakphotos":return{id:e,kind:"confirm",prompt:Nn.weakPhotos,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:Nn.photos,hint:Bre(S.hashes.length,e0),hashes:S.hashes,max:e0,busy:t.uploading>0,attest:{text:Ore,checked:S.attested},submit:"Continue",back:"Describe someone instead"}}case"describe":return{id:e,kind:"text",prompt:Nn.describe,starters:Dre};case"gaps":{const S=F4(a.describe??"");return{id:e,kind:"choice",prompt:$M(S.length),groups:S.map(E=>({id:E,...nse[E]})),submit:"Continue",skip:"Skip, draw as is",given:a.gaps&&a.gaps!=="skipped"?a.gaps:void 0,...i}}case"traits":{const S=((h=a.source)==null?void 0:h.door)==="photos";return{id:e,kind:"choice",prompt:S?Nn.traitsPhotos:Nn.traits,multi:!0,options:qu.map(E=>({id:E.id,label:E.label})),submit:"Continue",skip:S?"Nothing to add":"Nothing else",given:a.traits,...i}}case"keep":return{id:e,kind:"text",prompt:Nn.keep}}if(er(e)){const S=e.slice(5),{row:E,prompt:C}=hf[S],N=yre((p=a["look-who"])==null?void 0:p.pick),M=wre.has(S)?{...E,options:E.options.map(T=>T.card?{...T,card:`${T.card}-${N}`}:T)}:E;return{id:e,kind:"swatches",prompt:C,hint:S==="who"?Nn.lookHint:void 0,row:M,skip:"Skip",describe:S==="who"?"Describe them instead":void 0,saying:t.saying===e,given:((g=a[e])==null?void 0:g.pick)===Gl||(v=a[e])==null?void 0:v.pick,skipped:((y=a[e])==null?void 0:y.pick)===Gl,note:(b=a[e])==null?void 0:b.words,...i}}const c=Gr(e),d=c?fa(c.id):void 0;if(c&&d&&c.part==="where"&&d.where)return{id:e,kind:"choice",prompt:d.where.ask,options:d.where.options.map(S=>({id:S.id,label:S.label})),saying:t.saying===e,given:(x=a[e])==null?void 0:x.pick,note:(k=a[e])==null?void 0:k.words,...i};if(c&&d){const S=a[`trait-${c.id}`];return{id:e,kind:"choice",prompt:d.ask,hint:d.hint,options:d.options.map(E=>({id:E.id,label:E.label,card:E.card})),attach:S!=null&&S.refs.length?"Replace the reference":"Add a reference",saying:t.saying===e,given:S==null?void 0:S.pick,note:S==null?void 0:S.words,...i}}return{id:e,kind:"text",prompt:""}}function Wk(e,t){var a,i,c;switch(e){case"source":return Nn.source;case"photos":return Nn.photos;case"describe":return((a=t.source)==null?void 0:a.via)==="typed"?Nn.source:Nn.describe;case"gaps":return $M(F4(t.describe??"").length);case"traits":return((i=t.source)==null?void 0:i.door)==="photos"?Nn.traitsPhotos:Nn.traits;case"keep":return Nn.keep}if(er(e))return hf[e.slice(5)].prompt;const n=Gr(e),r=n?fa(n.id):void 0;return!n||!r?"":n.part==="where"?((c=r.where)==null?void 0:c.ask)??"":r.ask}function xse(e,t,n){var d,f,h,p,g,v,y;switch(e){case"source":return{text:((d=t.source)==null?void 0:d.door)==="photos"?"Add photos":"Describe someone"};case"photos":{const b=(n==null?void 0:n.sources)??((f=t.photos)==null?void 0:f.hashes)??[];return{text:zre(b.length),photos:b}}case"describe":return{text:(t.describe??"").trim()};case"gaps":return{text:rse(t.gaps)};case"traits":return{text:sse(wM(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(er(e)){const b=e.slice(5);return{text:kre(hf[b].row,t[e]??{})}}const r=Gr(e),a=r?fa(r.id):void 0;if(!r||!a)return{text:""};if(r.part==="where"){const b=t[e]??{},x=b.pick?((v=(g=a.where)==null?void 0:g.options.find(k=>k.id===b.pick))==null?void 0:v.label)??Oh(b.pick):"";return{text:Zk(x,b.words)}}const i=t[`trait-${r.id}`],c=i!=null&&i.pick?((y=a.options.find(b=>b.id===i.pick))==null?void 0:y.label)??Oh(i.pick):"";return{text:Zk(c,i==null?void 0:i.words),photos:i!=null&&i.refs.length?i.refs:void 0}}function kse(e){const t=e.state.asides,n=t.length?DA(Gk(e,[],null)):null;return Gk(e,t,n)}const OM=(e,t)=>e.at<t.at?-1:e.at>t.at?1:0,Hh=(e,t)=>C0(e.editing)&&Ere(e.editing)===t.at;function Gk(e,t,n){const r=new Set,a=Sse(e,t,n,r),i=a.length&&a[a.length-1].kind==="question"?a.pop():null,c=t.filter(f=>!r.has(f)).sort(OM),d=e.state.unsure;for(const f of c)(!d||f.at<d.at)&&a.push(...Wo(f,Hh(e.state,f)));if(i&&a.push(i),d){a.push({kind:"you",id:`unsure-${d.at}`,text:d.said,editable:!1}),a.push({kind:"question",question:{id:"unsure",kind:"confirm",quiet:!0,prompt:Ure,options:[{id:"use",label:"Use it anyway"}]}});for(const f of c)f.at>=d.at&&a.push(...Wo(f,Hh(e.state,f)))}return a}function Sse({state:e,draft:t,canGenerate:n,failed:r,awaiting:a},i,c,d){var M,T,L,A,P;const f=DM(t,n),h=e.answers,p=[{kind:"you",id:"intent",text:"Create a presenter"}],g=[],v=((M=h.source)==null?void 0:M.door)==="photos",y=($,H,O=!1)=>{const Q=i.filter(I=>!d.has(I)&&!!I.q&&I.q!==c&&H.includes(I.q)&&!!I.after===O).sort(OM);for(const I of Q)d.add(I),$.push(...Wo(I,Hh(e,I)))},b=$=>i.find(H=>H.edit&&H.q===$&&!d.has(H)),x=($,H,O=!0)=>{var I;if($.push({kind:"scenri",id:`asked-${H}`,text:Wk(H,h),quiet:!0}),y($,H==="describe"&&((I=h.source)==null?void 0:I.via)==="typed"?["source","describe"]:[H]),!O){const V=b(H);V&&(d.add(V),$.push({kind:"you",id:H,text:V.said}),$.push(...Wo(V,Hh(e,V),!0))),y($,[H],!0);return}const Q=xse(H,h,t);$.push({kind:"you",id:H,text:Q.text,photos:Q.photos,editable:!0,editing:e.editing===H&&A0(H,h)||void 0}),y($,[H],!0)},k=new Set(vM(h,f)),S=nre.filter($=>k.has($)||i.some(H=>H.edit&&H.q===$));for(const $ of S){const H=v&&t&&$!=="source"&&$!=="photos"?g:p;if(e.editing===$&&!A0($,h)){H.push({kind:"scenri",id:`asked-${$}`,text:Wk($,h),quiet:!0}),y(H,[$]),H.push({kind:"question",question:Uk($,e,f,!0)}),y(H,[$],!0);continue}$==="source"&&((T=h.source)==null?void 0:T.via)==="typed"||x(H,$,k.has($))}let E=null;if(((L=h.source)==null?void 0:L.door)==="scratch"&&!n&&!t)E={id:"noengine",kind:"confirm",quiet:!0,prompt:"Describing someone needs image generation, which is not set up yet.",options:[{id:"setup",label:"Set up"},{id:"photos",label:"Add photos instead"}]};else{const $=tm(h,f);$?E=Uk($,e,f,!1):!t&&((A=h.source)==null?void 0:A.door)==="scratch"&&(h.source.via==="taps"?E={id:"agree",kind:"confirm",prompt:Nn.agree,quote:`${Sre(yM(h))}${Fk(h)?`, and always ${Fk(h)}`:""}.`,options:[{id:"draw",label:"Draw the presenter"}]}:r&&(E={id:"retry",kind:"confirm",tone:"alert",prompt:`That did not go through: ${r}. Nothing was drawn.`,options:[{id:"retry",label:"Retry"}]}))}if(a&&(E=null),!t)return E&&p.push({kind:"question",question:E}),p;const C=tse({draft:t,canGenerate:n,ui:{extrasDeclined:e.extrasDeclined,failed:r,editingName:e.editing==="name"},afterCoverage:g,asides:i,openId:c,placed:d}),N=[...p,...C];return E&&((P=N[N.length-1])==null?void 0:P.kind)==="question"&&N.pop(),E&&N.push({kind:"question",question:E}),N}function HM(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="question")return n.question;if(!Eh(n))return null}return null}const Ua={placeholder:"Nothing to type yet",label:"Message",action:"Send"},Kk=(e,t)=>({placeholder:t?vre[e]??"In your words":$k.has(e)?"Tap a swatch above, or say the colour":"Tap one above, or describe it",label:"Describe it",action:"Send",color:$k.has(e)});function Yk(e,t){const n=Gr(e),r=n?fa(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"?"Tap one above, or say where it is":`Tap 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 Ese(e,t,n,r){if(t.editing!==null&&(t.editing==="name"||C0(t.editing)||A0(t.editing,t.answers)))return{...Ua,off:"Finish the change above."};if(t.saying==="keep")return{placeholder:Vk,label:"What should stay the same about them",action:"Send"};if(t.saying&&er(t.saying))return Kk(t.saying.slice(5),!0);if(t.saying)return Yk(t.saying,!0);if(t.editing!==null)return{...Ua,off:"Finish the change above."};if(e){if(er(e.id))return Kk(e.id.slice(5),!1);if(e.id.startsWith("trait-"))return Yk(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:Vk,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:"Tap one above, or say it in your own words",label:"Fill in what is missing",action:"Send"};case"photos":return{...Ua,off:"Add their photos above."};case"noengine":return{...Ua,off:"Set up image generation, or add photos."};case"blind":return{...Ua,off:"Decide above."};case"retry":return{...Ua,off:"Retry above."}}}return n?n.stage==="analyzing"?{...Ua,off:`Reading ${n.source==="photos"?"the photos":"the face"}.`}:zl(n)?Oo(n)?{placeholder:qk(r,n),label:"What should change",action:"Refine",off:""}:{...Ua,off:""}:Oo(n)?{placeholder:qk(r,n),label:"What should change",action:"Refine"}:{...Ua,off:"The face comes first."}:{...Ua,off:"Starting the draft."}}function qk(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: ${vn[e]}`}function Xk(e,t){return e.saying?e.saying:t&&Ps(t.id)&&(t.id==="source"||t.id==="describe")||t&&Ps(t.id)&&(er(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 Cse=/\b(here|in this (view|one|picture|image|frame)|this (view|one|picture|image|frame))\b/i,jse=/\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,Ase=/\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,Nse=/\b(simpler|plainer|plain|neutral|cleaner|tidier)\b/i,Mse=/\b(outfit|clothes|clothing|top|wardrobe|wearing)\b/i;function IM(e,t,n){const r=e.trim();if(!r)return{blocked:"Say what should change."};if(Ase.test(r)&&!(Nse.test(r)&&Mse.test(r)))return{scope:"out-of-scope"};const a=cj.test(r),i=jse.test(r),c=Cse.test(r),d=n.source==="photos";if(t==="portrait")return d?{blocked:"Their photos define who they are. Change a drawn view instead."}:{scope:"identity",view:"portrait"};if(a&&i&&!c)return d?{scope:"view",view:t}:{scope:"ambiguous"};if(a&&!c)return d?{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 ${vn[t]} yet.`}:{scope:"view",view:t}}const FM=e=>`Use Create for wardrobe, products and scenes. Edits here change who ${e} is.`;function Rse(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 d=n.views[t];return t!=="portrait"&&d.origin==="photo"?{chip:null,hint:"Your photo stands as it is. Pick a drawn view to change."}:{chip:null,hint:i}}const c=IM(a,t,n);return"blocked"in c?{chip:null,hint:c.blocked,tone:"alert"}:c.scope==="out-of-scope"?{chip:null,hint:FM(r),tone:"alert"}:c.scope==="ambiguous"?{chip:null,hint:"This reads as the view or the person. Send it and I will ask which."}:c.scope==="identity"?{chip:{view:"portrait",label:"Changing the person"},hint:"Changes the person. The other views are redrawn after you use it."}:{chip:{view:c.view,label:`Refining the ${vn[c.view]}`},hint:"Changes this view only. Hair, skin, age or build change the person."}}const Pse=e=>e.replace(/^asset:/,"");function _M(e,t){if((e.identityEdits??[]).join(`
103
+ `)!==(t.identityEdits??[]).join(`
104
+ `))return!0;const r=t.shots.some(i=>i.angle==="portrait"&&i.file),a=new Map(t.shots.map((i,c)=>[!r&&c===0?"portrait":i.angle??"",Pse(i.file)]));for(const i of Do(e)){const c=e.views[i];if(c.status==="candidate"||c.status==="stale"||c.prior)return!0;const d=a.get(i);if(c.status==="approved"&&c.hash&&c.hash!==d||c.status==="empty"&&d)return!0}return!1}const Lse=e=>dW.filter(t=>e.views[t].status==="empty"&&t!=="portrait"),Tse=e=>e.length<=2?e.map(t=>vn[t]).join(" and "):`${e.slice(0,-1).map(t=>vn[t]).join(", ")} and ${vn[e[e.length-1]]}`,$se={building:!1,buildDeclined:!1,scopeAsk:null,failed:null,conflict:null},Dse="Say what should change: hair, age or build change the person; anything else changes the view on the stage.",Ose="Still here. Select a view and say what is wrong with it, or say what should change about them.";function Hse(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?Ose:Dse}}const Cl={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 Ise(e){const t=e.ui.asides??[],n=t.length?DA(Qk(e,[],null)):null;return Qk(e,t,n)}function Qk({draft:e,base:t,name:n,selected:r,canGenerate:a,ui:i},c,d){var ye;const f=[{kind:"scenri",id:"opening",text:Cl.opening(n)}],h=new Set,p=()=>{for(const ee of c)h.has(ee)||f.push(...Wo(ee));return f},g=(ee,ge,re)=>{re&&f.push({kind:"scenri",id:`asked-${ee}`,text:re}),f.push({kind:"you",id:ee,text:ge,editable:!1})},v=(ee,ge,re)=>f.push({kind:"scenri",id:ee,text:ge,tone:re}),y=ee=>f.push({kind:"question",question:ee});if(!e)return p();const b=Lse(e),x=e.source!=="synthetic"||!!((ye=e.direction)!=null&&ye.trim()),k=Do(e).some(ee=>e.views[ee].status==="candidate");if(b.length&&x&&!k&&!i.building&&!i.buildDeclined&&!zl(e)&&a){const ee=Do(e).filter(ge=>e.views[ge].status==="approved").length;return y({id:"legacy",kind:"confirm",prompt:`${n} has ${ee===1?"one reference":`${ee} references`}. Build the ${Tse(b)} from it?`,options:[{id:"build",label:"Build them"},{id:"not",label:"Not now"}]}),p()}const S=Do(e),E=e.activeView,C=S.find(ee=>e.views[ee].status==="candidate"),N=S.find(ee=>!!e.views[ee].error),M=(t==null?void 0:t.identityEdits)??[];(e.identityEdits??[]).filter(ee=>!M.includes(ee)).forEach((ee,ge)=>{g(`edit-${ge}`,ee,Cl.change),v(`changed-${ge}`,`Changed ${n}. The views built on the face were redrawn.`)});const L=e.asks??[],A=L[L.length-1],P=A?e.views[A.view]:null,$=!!A&&!!P&&(P.status==="generating"&&e.activeView===A.view||P.status==="candidate"&&P.adjustment===A.text||!!P.error),H=new Set((e.identityEdits??[]).map(ee=>ee.toLowerCase())),O=($?L.slice(0,-1):L).filter(ee=>!(ee.view==="portrait"&&H.has(ee.text.replace(/\s+/g," ").toLowerCase()))),Q=[...L,...e.results??[],...e.decisions??[]].map(ee=>ee.at).reduce((ee,ge)=>ge>ee?ge:ee,""),I=c.filter(ee=>!h.has(ee)&&(ee.q!==d||ee.at<=Q));for(const ee of I)h.add(ee);const V=(e.results??[]).filter(ee=>ee.how!=="restored"),ie=!e.activeView&&e.stage==="idle",B=new Map,F=new Map,te=new Map;for(const ee of V){const ge=`${ee.view}:${ee.hash}`;if(te.set(ge,ee),B.has(ge))continue;const re=(F.get(ee.view)??0)+1;F.set(ee.view,re),B.set(ge,re)}const X=ee=>B.get(`${ee.view}:${ee.hash}`)??1,Z=(ee,ge)=>{const re=X(ee),D=e.views[ee.view].hash===ee.hash,G=(F.get(ee.view)??0)>1;return{kind:"scenri",id:ge,text:`Here is ${vn[ee.view]} ${re}.`,thumb:ee.hash,view:ee.view,label:`${Zl[ee.view]} ${re}`,current:G&&D&&te.get(`${ee.view}:${ee.hash}`)===ee,restore:ie&&!D?{view:ee.view,hash:ee.hash}:void 0}},K=new Set,z=new Map(L.map(ee=>{const ge=V.find(re=>!K.has(re)&&re.how==="drawn"&&re.view===ee.view&&re.ask===ee.text&&re.at>=ee.at);return ge&&K.add(ge),[ee,ge]})),Y=(e.decisions??[]).filter(ee=>!(ee.view==="portrait"&&ee.what==="use")),J=ee=>[{kind:"scenri",id:`asked-decided-${ee.at}`,text:ee.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 ${vn[ee.view]}. Use it, or keep the previous one.`},{kind:"you",id:`decided-${ee.at}`,text:ee.what==="again"?"Try again":ee.what==="keep"?"Keep previous":"Use it",editable:!1}],de=[...O.map(ee=>{const ge=z.get(ee);return{at:ee.at,turns:[{kind:"scenri",id:`asked-ask-${ee.at}`,text:Cl.change},{kind:"you",id:`ask-${ee.at}`,text:ee.text,editable:!1},...ge?[Z(ge,`redrew-${ee.at}`)]:[]]}}),...V.filter(ee=>!K.has(ee)).map(ee=>({at:ee.at,turns:[Z(ee,`result-${ee.at}`)]})),...Y.map(ee=>({at:ee.at,turns:J(ee)})),...I.map(ee=>({at:ee.at,turns:Wo(ee)}))];de.sort((ee,ge)=>ee.at<ge.at?-1:ee.at>ge.at?1:0);for(const ee of de)f.push(...ee.turns);if(i.scopeAsk)return g("scope-ask",i.scopeAsk.said),y({id:"scope",kind:"choice",prompt:Cl.scope,options:[{id:"view",label:`This view (the ${vn[r]})`},{id:"identity",label:"The presenter"}]}),p();const ae=()=>{$&&A&&g(`ask-${A.at}`,A.text,Cl.change)};if(E){const ee=e.views[E];return ae(),v(`drawing-${E}`,$&&(A==null?void 0:A.view)===E?E==="portrait"?`Changing ${n}. Everything else stays.`:`Redrawing the ${vn[E]}.`:ee.status==="stale"||S.some(ge=>e.views[ge].status==="stale")?`Redrawing the views built on the face. The ${vn[E]} first.`:`Drawing the ${vn[E]}.`),p()}if(C){ae();const ee=e.views[C];return ee.hash&&f.push({kind:"scenri",id:`candidate-${C}-${ee.hash}`,text:C==="portrait"?`Here is ${n} with the change.`:`Redrew the ${vn[C]}.`,thumb:ee.hash,label:Zl[C],view:C,current:!0}),y({id:C==="portrait"?"revision":"view-revision",kind:"confirm",prompt:C==="portrait"?"Use this, or keep the previous one. Using it redraws the views built on the face.":"Use it, or keep the previous one.",options:[{id:"use",label:C==="portrait"?"Use this":"Use it"},{id:"keep",label:"Keep previous"},{id:"again",label:"Try again"}]}),p()}if(i.failed||N){ae();const ee=!!N&&e.views[N].error==="cancelled";return y({id:"retry",kind:"confirm",...ee?{quiet:!0}:{tone:"alert"},prompt:ee?`Stopped drawing the ${vn[N]}. Nothing finished was touched.`:N?`The ${vn[N]} could not be drawn: ${j0(e.views[N].error??"")}. Nothing finished was touched.`:`That did not go through: ${j0(i.failed??"")}. Nothing finished was touched.`,options:[{id:"retry",label:ee?"Draw it again":"Retry"}]}),p()}if(i.conflict)return y({id:"conflict",kind:"confirm",tone:"alert",prompt:`${n} changed in another tab. Reload to continue.`,options:[{id:"reload",label:"Reload"}]}),p();const W=S.find(ee=>e.views[ee].status==="stale");return W?(v(`drawing-${W}`,`Redrawing the views built on the face. The ${vn[W]} first.`),p()):(t&&_M(e,t)&&y({id:"save",kind:"confirm",prompt:`The set is coherent. ${Cl.saved}`,options:[{id:"save",label:"Save changes"}]}),p())}function Fse(e,t,n){return!(!n||t.id!==n||e&&e.id===t.id&&t.updatedAt<e.updatedAt)}function VM(e,t){const[n,r]=s.useState(null),[a,i]=s.useState(!1),[c,d]=s.useState(null),[f,h]=s.useState(!1),p=s.useRef(!0);s.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]);const g=s.useRef(t);g.current=t;const v=s.useCallback(H=>{p.current&&r(O=>Fse(O,H,g.current)?H:O)},[]);s.useEffect(()=>{r(null),i(!1),d(null),h(!1)},[t]);const y=s.useCallback(async()=>{if(!t)return;const H=t;try{v(await Me.presenterDraft(e,H))}catch(O){if(!p.current||g.current!==H)return;/HTTP 404|not found/i.test(String((O==null?void 0:O.message)??O))?i(!0):d(String((O==null?void 0:O.message)??O))}},[e,t,v]);s.useEffect(()=>{y()},[y]);const b=!!n&&(n.stage!=="idle"||!!n.activeView);s.useEffect(()=>{if(!b)return;const H=setInterval(()=>void y(),1500);return()=>clearInterval(H)},[b,y]);const x=s.useCallback(async H=>{const O=g.current;h(!0),d(null);try{return v(await H()),!0}catch(Q){return!p.current||g.current!==O?!1:(Q==null?void 0:Q.status)===409?(y(),!1):(d(String((Q==null?void 0:Q.message)??Q)),!1)}finally{p.current&&h(!1)}},[v,y]),k=s.useCallback((H,O,Q)=>x(async()=>(await Me.generateDraftView(e,t??"",H,{...O?{adjustment:O}:{},...Q?{decide:Q}:{}})).draft),[x,e,t]),S=s.useCallback(H=>x(()=>Me.approveDraftView(e,t??"",H)),[x,e,t]),E=s.useCallback(H=>x(()=>Me.redoDraftView(e,t??"",H)),[x,e,t]),C=s.useCallback(H=>x(()=>Me.revertDraftView(e,t??"",H)),[x,e,t]),[N,M]=s.useState(!1),T=s.useCallback(async()=>{M(!0);try{return await x(()=>Me.stopDraft(e,t??""))}finally{p.current&&M(!1)}},[x,e,t]),L=s.useCallback((H,O)=>x(()=>Me.restoreDraftView(e,t??"",H,O)),[x,e,t]),A=s.useCallback((H,O)=>x(()=>Me.placeDraftPhoto(e,t??"",H,O)),[x,e,t]),P=s.useCallback(H=>x(()=>Me.updatePresenterDraft(e,t??"",H)),[x,e,t]),$=s.useCallback(()=>d(null),[]);return{draft:n,gone:a,err:c,busy:f,drawing:b,reload:y,generate:k,approve:S,redo:E,revert:C,stop:T,stopping:N,restore:L,placePhoto:A,update:P,clearErr:$}}function _se({presenterId:e,onLeave:t,caps:n}){var He,tt;const{brand:r}=Qt(),{applyBrand:a,refreshBrands:i}=jn(),c=fc(),d=!!(n!=null&&n.canGenerate),[f,h]=s.useState(null),[p,g]=s.useState(null),[v,y]=s.useState($se),[b,x]=s.useState(""),[k,S]=s.useState(null),[E,C]=s.useState(!1),[N,M]=s.useState(null),[T,L]=s.useState(!1),[A,P]=s.useState(!1),$=s.useRef(new Set),H=(((He=r.json)==null?void 0:He.characters)??[]).find(oe=>oe.id===e),O=((tt=H==null?void 0:H.name)==null?void 0:tt.trim())||"them",Q=H?{shots:H.shots??[],identityEdits:H.identityEdits??[]}:null;s.useEffect(()=>{let oe=!0;return h(null),g(null),Me.editPresenter(r.id,e).then(he=>{oe&&h(he.id)}).catch(he=>{oe&&g(String((he==null?void 0:he.message)??he))}),()=>{oe=!1}},[r.id,e]);const I=VM(r.id,f),V=I.draft,ie=V?`presenter-edit:${r.id}:${e}:${V.id}`:void 0,B=!0;s.useEffect(()=>{if(!V||I.busy||!d||I.err)return;const oe=aj(V);if(!oe||V.views[oe].status==="empty"&&!v.building)return;const he=`${oe}:${V.views[oe].attempts}:${V.generations}:${V.views[oe].status}`;$.current.has(he)||($.current.add(he),I.generate(oe,void 0,Co(oe)))},[V,I.busy,I.generate,d,I.err,v.building]);const F=V?oj(V,k):"portrait",te=V?V.views[F]:null,X=!!V&&(V.activeView===F||V.stage==="analyzing"),Z=!!V&&!V.activeView&&V.stage==="idle",K=I.err&&V&&!V.activeView?I.err:null,z=s.useMemo(()=>Ise({draft:V,base:Q,name:O,selected:F,canGenerate:d,ui:{...v,failed:K}}),[V,Q,O,F,d,v,K]),Y=HM(z),J=!!V&&!!Q&&_M(V,Q),de=s.useCallback(oe=>{ie&&Ni(ie),t(oe)},[ie,t]),ae=s.useCallback(async()=>{if(!(!V||T)){L(!0),M(null);try{const oe=await Me.savePresenterDraft(r.id,V.id);de(oe.presenter.id),a(oe.brand)}catch(oe){L(!1);const he=String((oe==null?void 0:oe.message)??oe);/changed elsewhere|HTTP 409/i.test(he)?y(Ae=>({...Ae,conflict:he})):M(he)}}},[V,T,r.id,a,de]),W=s.useCallback(async()=>{P(!0);try{V&&await Me.deletePresenterDraft(r.id,V.id)}catch{}de(e)},[V,r.id,e,de]),ye=s.useCallback(async()=>{P(!0);try{const oe=await Me.revertPresenter(r.id,e);V&&await Me.deletePresenterDraft(r.id,V.id).catch(()=>{}),de(oe.presenter.id),a(oe.brand)}catch(oe){P(!1),M(String((oe==null?void 0:oe.message)??oe))}},[r.id,e,V,a,de]),ee=s.useCallback((oe,he)=>{var Ae;if(M(null),!!V)switch(oe){case"legacy":if(he.kind!=="confirm")return;y(ue=>({...ue,building:he.id==="build",buildDeclined:he.id!=="build"}));return;case"scope":{if(he.kind!=="choice")return;const ue=((Ae=v.scopeAsk)==null?void 0:Ae.said)??"";y(ke=>({...ke,scopeAsk:null})),he.id==="identity"?I.generate("portrait",ue):I.generate(F,ue,Co(F)),S(he.id==="identity"?"portrait":F);return}case"revision":case"view-revision":{if(he.kind!=="confirm")return;const ue=Object.keys(V.views).find(ke=>V.views[ke].status==="candidate")??F;he.id==="use"&&I.approve(ue),he.id==="keep"&&I.revert(ue),he.id==="again"&&I.generate(ue,V.views[ue].adjustment,Co(ue)),C(!1);return}case"retry":{if(I.err){I.clearErr(),$.current=new Set;return}const ue=Object.keys(V.views).find(ke=>!!V.views[ke].error);ue&&I.generate(ue,V.views[ue].adjustment,Co(ue));return}case"conflict":y(ue=>({...ue,conflict:null})),P(!0),i().finally(()=>de(e));return;case"save":ae();return}},[V,v.scopeAsk,I,F,ae,i,de,e]),ge=s.useCallback(oe=>{const he=oe.trim();if(!he||!V)return!1;M(null);const Ae=(Y==null?void 0:Y.id)??null,ue=Ch(),ke=(Re,Ie)=>({...Re,asides:[...Re.asides??[],{said:he,reply:Ie,q:Ae,at:ue}]}),qe=Re=>Re.scopeAsk?{...Re,scopeAsk:null,asides:[...Re.asides??[],{said:Re.scopeAsk.said,reply:Cl.scope,q:"scope",at:Re.scopeAsk.at}]}:Re,Ve=Po(he,Js);if(Ve&&Ve!=="vague")return y(Re=>ke(Re,Hse(Ve,O,(Re.asides??[]).some(Ie=>Ie.q===Ae)))),x(""),!0;if(!d)return M("Image generation is not set up, so nothing can be redrawn yet."),!1;const Xe=IM(he,F,V);return"blocked"in Xe?(M(Xe.blocked),!1):Xe.scope==="out-of-scope"?(y(Re=>ke(qe(Re),FM(O))),x(""),!0):Xe.scope==="ambiguous"?(y(Re=>({...qe(Re),scopeAsk:{said:he,at:ue}})),x(""),!0):(y(Re=>qe(Re)),S(Xe.view),C(!1),I.generate(Xe.view,he,Xe.scope==="view"?Co(Xe.view):void 0),x(""),!0)},[V,d,F,I,Y==null?void 0:Y.id,O]),re=V?Rse(b,F,V,O):null,D=re?{chip:re.chip?{label:re.chip.label,thumb:V!=null&&V.views[re.chip.view].hash?nn(V.views[re.chip.view].hash,"micro"):void 0}:null,hint:re.hint,tone:re.tone}:null,G=E&&(te!=null&&te.prior)?te.prior:te==null?void 0:te.hash,Pe=V?(Y==null?void 0:Y.id)==="legacy"?"Decide above.":(Y==null?void 0:Y.id)==="conflict"?"Reload to continue.":(Y==null?void 0:Y.id)==="scope"?"Pick above.":(Y==null?void 0:Y.id)==="retry"?"Retry above.":V.stage==="analyzing"?"Reading the photos.":V.activeView?"":null:null,Ze=!!V;return{d:V,record:H,name:O,view:F,slot:te,dirty:J,saving:T,leaving:A,openErr:p,canRevert:!!(H!=null&&H.revisionOf),discard:W,revert:ye,keepPrevious:te&&te.status==="approved"&&te.prior&&!X&&!(V!=null&&V.activeView)&&(V==null?void 0:V.stage)==="idle"?()=>void I.revert(F):null,surface:{title:"Edit presenter",memoryKey:ie,resumed:B,turns:z,busy:I.busy||T||A,stage:V?{hash:G,alt:`${Zl[F]}${(te==null?void 0:te.status)==="candidate"?", candidate":""}`,drawing:X,since:dj(V),doing:fj(V),takes:U6(V,F)?[]:pj(V,F),onTake:Z?oe=>void I.restore(F,oe):void 0,items:ij(V,F),onPick:oe=>{S(oe),C(!1)},compare:te&&te.status==="candidate"&&te.prior?{on:E,toggle:()=>C(oe=>!oe)}:void 0}:null,composer:Ze?{placeholder:F==="portrait"?`What should change about ${O}?`:`Change this view: ${vn[F]}`,label:"What should change",action:"Refine",scope:Pe?null:D,hint:null,why:Pe??void 0,error:N,disabled:I.busy||T||A||!!Pe,working:!!(V!=null&&V.activeView),onStop:V!=null&&V.activeView?()=>void I.stop():void 0,stopping:I.stopping,focusKey:`${(Y==null?void 0:Y.id)??"open"}:${(V==null?void 0:V.id)??""}`}:null,text:b,onText:x,onSend:ge,onAnswer:ee,onRestore:(oe,he)=>{S(oe),I.restore(oe,he)}},setupNeeded:d?null:c}}function Vse({onClose:e,...t}){const n=_se(t),r=o.jsxs(o.Fragment,{children:[n.canRevert&&o.jsx(mr,{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(mr,{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 ",vn[n.view],"."]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:n.keepPrevious,children:"Keep previous"})]}):n.openErr?o.jsx("p",{className:"sc-newdlg-err",role:"alert",children:n.openErr}):null;return o.jsx(I4,{surface:{...n.surface,headAction:r,dock:a},onClose:e})}function Zse(){const{presenterId:e=""}=Fs(),{brand:t}=Qt(),n=Dn(),{caps:r}=t4();dc("Edit presenter");const[a]=s.useState(()=>Q6(t,e)),i=s.useCallback(d=>n(la(t,d),{replace:!0}),[n,t]),c=s.useCallback(()=>n(la(t,e),{replace:!0}),[n,t,e]);return a!==e?o.jsx(no,{to:_6(t,a),replace:!0}):o.jsx(Vse,{presenterId:e,onLeave:i,onClose:c,caps:r})}function zse(e,t){return(t.source!=="synthetic"||(t.direction??"")===nm(e.answers))&&Bse(t.keepItems,rm(e.answers))}function Bse(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(c=>(r.refs??[]).includes(c))})}function Use(e,t){return{...t.source==="synthetic"?{direction:nm(e.answers)}:{},keepItems:rm(e.answers)}}const Wse=e=>e.source==="photos"?e.views.front.hash?"front":null:e.views.portrait.hash?"portrait":null;function ZM(e){if(!e.draftId)return!1;const t=e.draft;return t?e.seededFor!==t.id&&(!e.state.answers.source||!yv(e.state,e.ctx)):!0}function Gse(e){const{state:t,draft:n,ctx:r}=e;if(e.busy||e.err)return[];if(n){if(ZM(e))return[{kind:"seed",...dse(n)}];if(!yv(t,r))return[];const i=[];zse(t,n)||i.push({kind:"sync",patch:Use(t,n),redo:Wse(n)});const c=e.canDraw?aj(n):null;return c&&i.push({kind:"draw",view:c,decide:Co(c)}),i}if(e.draftId)return[];if(!e.canDraw||!yv(t,r))return[];const a=t.answers.source;return(a==null?void 0:a.door)==="scratch"&&a.via!=="taps"?[{kind:"start"}]:[]}function Kse(e){for(const t of Gse(e))if(!e.done.has(zM(t,e)))return t;return null}function zM(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)}:${e.redo??""}`;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 Gc=(e,t)=>`scenri:presenter-setup:${e}:${t}`,Kc={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 Yse(e,t){var r,a,i;const n=t==="keep"?"detail":((a=fa(((r=Gr(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 Jk(e,t,n){const r=e.editing&&e.editing!=="name"?e.editing:e.saying??tm(e.answers,t);if(r==="keep"||!r&&n==="agree")return"keep";if(!r)return null;const a=Gr(r);return a&&a.part==="what"?`trait-${a.id}`:null}function qse({draftId:e,convoKey:t,onOpenDraft:n,onLeaveDraft:r,onStarted:a,caps:i}){var ot,rt;const{brand:c}=Qt(),{presenterCategories:d,applyBrand:f}=jn(),h=fc(),p=!!(i!=null&&i.canGenerate),[g,v]=s.useReducer(Mre,{brandId:c.id,convoKey:t},me=>{const q=Dh(Kc.read(Gc(me.brandId,me.convoKey)));return q?{...$h,answers:q.answers,revision:q.revision,asides:q.asides}:$h}),y=s.useRef(g);y.current=g;const b=Rre(g),x=Object.keys(g.answers).length>0||g.asides.length>0,k=s.useRef(t);s.useEffect(()=>{x?Kc.write(Gc(c.id,t),b):Kc.remove(Gc(c.id,t));const me=k.current;k.current=t,me!==t&&e&&t===e&&(Kc.remove(Gc(c.id,me)),Ni(`presenter-create:${c.id}:${me}`))},[c.id,t,e,b,x]);const S=s.useRef(null);s.useEffect(()=>{if(!e||S.current===b)return;const me=setTimeout(()=>{S.current=b,Me.updatePresenterDraft(c.id,e,{setup:b}).catch(()=>{S.current=null})},800);return()=>clearTimeout(me)},[c.id,e,b]);const[E,C]=s.useState(null),[N,M]=s.useState(!1),[T,L]=s.useState(null),[A,P]=s.useState([]),[$,H]=s.useState(!1),[O,Q]=s.useState(null),[I,V]=s.useState(!1),[ie,B]=s.useState(null),[F,te]=s.useState(null),[X,Z]=s.useState(0),[K,z]=s.useState([]),Y=s.useRef(new Map),[J]=s.useState(()=>!!e||!!Dh(Kc.read(Gc(c.id,t))));s.useEffect(()=>()=>{for(const me of Y.current.values())URL.revokeObjectURL(me)},[]);const de=s.useRef(!1),ae=s.useRef(new Set),W=s.useRef(!1),ye=s.useRef(null),ee=s.useRef(!1),ge=VM(c.id,e),re=ge.draft,D=s.useMemo(()=>DM(re,p),[re,p]);s.useEffect(()=>{ae.current=new Set,de.current=!1,P([]),S.current=null,e||(ee.current=!1)},[e]),s.useEffect(()=>{if(de.current||!re)return;const me=AW(re,A);me&&(de.current=!0,P(me))},[re,A]),s.useEffect(()=>{ge.gone&&r()},[ge.gone,r]);const G=s.useCallback(()=>{Kc.remove(Gc(c.id,t)),Ni(`presenter-create:${c.id}:${t}`)},[c.id,t]),Pe=s.useCallback(me=>n(me,!0),[n]),Ze=s.useCallback(async()=>{const me=y.current;if(!p||I)return;const q=me.revision;V(!0),L(null);try{const Te=rm(me.answers),je=await Me.createPresenterDraft(c.id,{source:"synthetic",direction:nm(me.answers),...Te.length?{keepItems:Te}:{}});if(y.current.revision!==q){Me.deletePresenterDraft(c.id,je.id).catch(()=>{});return}Pe(je.id)}catch(Te){L(String((Te==null?void 0:Te.message)??Te))}finally{V(!1)}},[c.id,p,I,Pe]),He=s.useCallback(async()=>{const me=y.current,q=me.answers.photos;if(!(q!=null&&q.hashes.length)||!q.attested||I)return;const Te=me.revision;V(!0),L(null);try{const je=await Me.createPresenterDraft(c.id,{source:"photos",imageHashes:q.hashes,attestation:!0});if(y.current.revision!==Te){Me.deletePresenterDraft(c.id,je.id).catch(()=>{});return}Pe(je.id)}catch(je){L(String((je==null?void 0:je.message)??je))}finally{V(!1)}},[c.id,I,Pe]),tt=s.useCallback(async me=>{L(null);const q=()=>{var dt;return((dt=y.current.answers.photos)==null?void 0:dt.hashes)??[]},Te=me.slice(0,Math.max(0,e0-q().length)),je=[];let gt=0;v({type:"upload-begin"});try{for(const dt of Te){if(dt.size>Mx){je.push(Ire(dt.name,Mx));continue}try{const jt=await y0(dt);q().includes(jt)&&(gt+=1),v({type:"uploaded",hash:jt,max:e0})}catch{je.push(Fre(dt.name))}}}finally{v({type:"upload-end"})}L(Hre({over:me.length-Te.length,same:gt,failed:je,max:e0}))},[]),oe=s.useCallback(me=>{v({type:"answer",patch:me,ctx:D})},[D]),he=s.useCallback(async me=>{const q=me??re;if(!q||$)return;const Te=NW(q,q.name,p);if(Te){Q(Te);return}H(!0),Q(null);try{await Me.updatePresenterDraft(c.id,q.id,{facets:A});const je=await Me.savePresenterDraft(c.id,q.id);f(je.brand),G(),v({type:"start-over"}),a({kind:"presenter",id:je.presenter.id,name:je.presenter.name})}catch(je){H(!1),Q(String((je==null?void 0:je.message)??je))}},[re,$,p,c.id,A,G,a,f]),Ae=s.useCallback(async()=>{var q;if(!re||$)return;const me=(q=re.sources)==null?void 0:q[0];if(!me||re.views.portrait.status==="approved"){he();return}H(!0),Q(null);try{const Te=await Me.placeDraftPhoto(c.id,re.id,"portrait",me);H(!1),await he(Te)}catch(Te){H(!1),Q(String((Te==null?void 0:Te.message)??Te))}},[re,$,c.id,he]),ue=s.useCallback(async()=>{const q=y.current.answers.describe||(re==null?void 0:re.direction)||"";ee.current=!0,G(),v({type:"start-over",text:q}),L(null),B(null),te(null),ae.current=new Set,re&&!lj(re)&&await Me.deletePresenterDraft(c.id,re.id).catch(()=>{}),r()},[re,c.id,G,r]),ke=re?ge.err&&!zl(re)?ge.err:null:T,qe=s.useMemo(()=>kse({state:g,draft:re,canGenerate:p,failed:ke,awaiting:ZM({state:g,draft:re,ctx:D,draftId:e,seededFor:ye.current})}),[g,re,p,ke,e,D]),Ve=HM(qe),Xe=s.useRef(null);Xe.current=(Ve==null?void 0:Ve.id)??null;const Re=re?oj(re,E):"portrait",Ie=re?re.views[Re]:null,st=!!re&&(re.activeView===Re||re.stage==="analyzing"),Ye=!!re&&!re.activeView&&re.stage==="idle",$e={state:g,draft:re,ctx:D,canDraw:p,busy:ge.busy||I||W.current||ee.current||(re?zl(re):!1),err:!!ge.err||!!T,draftId:e,seededFor:ye.current,done:ae.current},Qe=Kse($e),Fe=s.useRef(Qe);Fe.current=Qe;const yt=Qe?zM(Qe,$e):"";s.useEffect(()=>{var q;re&&ye.current!==re.id&&!$e.busy&&!$e.err&&((q=Fe.current)==null?void 0:q.kind)!=="seed"&&(ye.current=re.id);const me=Fe.current;if(!(!me||ae.current.has(yt)))switch(ae.current.add(yt),me.kind){case"seed":ye.current=(re==null?void 0:re.id)??null,v({type:"restore",answers:me.answers,revision:y.current.revision+1,asides:me.asides});return;case"start":Ze();return;case"sync":W.current=!0,(async()=>{await ge.update(me.patch),me.redo&&await ge.redo(me.redo)})().finally(()=>{W.current=!1});return;case"draw":ge.generate(me.view,void 0,me.decide);return}},[yt,re,Ze,ge.update,ge.redo,ge.generate]);const ht=s.useCallback((me,q,Te,je,gt=!1)=>{v({type:"aside",aside:{said:me,reply:q,q:Te,at:Ch(),kind:je,...gt?{edit:!0}:{}}})},[]),yn=s.useCallback((me,q)=>{L(null);const Te=y.current;if(Ps(me)){if(me==="weakphotos"&&q.kind==="confirm"){q.id==="again"&&ue(),q.id==="anyway"&&oe({weakphotos:{pick:"anyway"}});return}const je=hse(me,q,Te.answers);if(je){const gt=Te.text.trim(),dt=je[me],jt=(er(me)||!!Gr(me))&&dt&&typeof dt=="object"&&!dt.words;oe(jt&&gt?{...je,[me]:{...dt,words:_g(gt)}}:je);return}if(me==="photos"&&q.kind==="photos"){const gt=q.action;gt.type==="add"&&tt(gt.files),gt.type==="remove"&&v({type:"remove-photo",hash:gt.hash}),gt.type==="attest"&&v({type:"attest",checked:gt.checked}),gt.type==="reject"&&L("That was not an image. Drop a photo, or choose a file."),gt.type==="submit"&&He(),gt.type==="back"&&oe({source:{door:"scratch",via:"taps"}})}return}switch(me){case"unsure":{if(q.kind!=="confirm"||q.id!=="use"||!Te.unsure)return;const je=Te.unsure.said,gt=Te.unsure.q==="describe"?"describe":"source";v({type:"settle-unsure",ctx:D}),oe(gt==="describe"?{describe:je}:{source:{door:"scratch",via:"typed"},describe:je});return}case"noengine":q.kind==="confirm"&&q.id==="setup"&&h(),q.kind==="confirm"&&q.id==="photos"&&oe({source:{door:"photos",via:"taps"}});return;case"agree":{if(q.kind!=="confirm")return;q.id==="draw"&&Ze();return}case"identity":if(q.kind!=="confirm"||!re)return;q.id==="use"&&(ge.approve("portrait"),C(null)),q.id==="again"&&ge.generate("portrait"),q.id==="change"&&Z(je=>je+1);return;case"revision":case"view-revision":{if(q.kind!=="confirm"||!re)return;const je=me==="revision"?"portrait":Object.keys(re.views).find(gt=>re.views[gt].status==="candidate")??Re;q.id==="use"&&ge.approve(je),q.id==="keep"&&ge.revert(je),q.id==="again"&&ge.generate(je,re.views[je].adjustment,Co(je)),M(!1);return}case"retry":{if(!re){ae.current=new Set,L(null);return}if(ge.err){ge.clearErr(),ae.current=new Set;return}const je=Object.keys(re.views).find(gt=>!!re.views[gt].error);je&&ge.generate(je,re.views[je].adjustment,Co(je));return}case"extras":if(q.kind!=="confirm")return;q.id==="add"&&ge.update({extras:!0}),q.id==="save"&&v({type:"extras-declined"});return;case"blind":if(q.kind!=="confirm")return;q.id==="save"&&Ae(),q.id==="setup"&&h();return;case"save":he();return}},[oe,tt,He,Ze,h,re,ge,Re,he]),Oe=s.useCallback(me=>{var It,an,Bt,mn,on,An,Dt,Zn,xt,On;const q=me.trim(),Te=y.current,je=Xk(Te,Ve),gt=je&&((It=Te.colour)==null?void 0:It.step)===je?Te.colour.hex:null,dt=je&&er(je)?je.slice(5):null,jt=je==="keep"?(((an=Te.answers.keep)==null?void 0:an.refs)??[]).length:je!=null&&je.startsWith("trait-")?(((Bt=Te.answers[je])==null?void 0:Bt.refs)??[]).length:0,et=q||gt||"";if(!et&&!jt)return!1;if(L(null),je==="name"){const Ot=et.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||et;return re&&ge.update({name:Ot.slice(0,60)}),v({type:"text",text:""}),!0}const Pt=(Ot,rn)=>Te.asides.filter($n=>$n.q===Ot&&$n.kind===rn).length,Sn=(Ot,rn=null)=>Vg(Ot,rn,!!(re!=null&&re.views.portrait.hash)),U=(Ot,rn,$n,or)=>{const Ir=$n!==null&&Te.editing===$n;Ir&&oe({[$n]:void 0}),ht(Ot,rn,$n,or,Ir)};if(je&&je!=="keep"&&je.startsWith("trait-")){const Ot=Gr(je);if(!Ot)return!1;const rn=Ot.part==="what"?((mn=Te.answers[je])==null?void 0:mn.refs)??[]:[];if(!q&&rn.length)return oe({[je]:{pick:(on=Te.answers[je])==null?void 0:on.pick,words:pse(Ot.id,rn.length),refs:rn}}),!0;const $n=D1(je,q,Js);if(!q||$n)return U(q,xl($n??"vague",Sn(je),Pt(je,$n??"vague"),q,void 0,!0),je,$n??"vague"),!0;const or=zk(q),Ir=or?_g(q):q;if(Ot.part==="where"){const zn=Te.answers[je];oe({[je]:{pick:or?zn==null?void 0:zn.pick:void 0,words:Ir}})}else{const zn=Te.answers[je];oe({[je]:{pick:or?zn==null?void 0:zn.pick:void 0,words:Ir,refs:(zn==null?void 0:zn.refs)??[]}})}return!0}if(je==="keep"){const Ot=Te.answers.keep,rn=(Ot==null?void 0:Ot.refs)??[],$n=q||(rn.length&&!(Ot!=null&&Ot.words)?"the detail in the attached picture":"");return $n?(oe({keep:{words:[(An=Ot==null?void 0:Ot.words)==null?void 0:An.trim(),$n].filter(Boolean).join(", "),refs:rn}}),!0):!1}if(je&&er(je)&&dt){const Ot=q&&!/^#[0-9a-f]{6}$/i.test(q)?D1(je,q,Js):null;if(Ot)return U(q,xl(Ot,Sn(je),Pt(je,Ot),q,dt,!0),je,Ot),!0;const rn=Te.answers[je],$n=!q||zk(q),or=gt??($n?rn==null?void 0:rn.pick:void 0),Ir={pick:or,words:q?$n?_g(q):q:rn==null?void 0:rn.words};if(q&&!or&&!use(Te.answers,je,Ir,q)){const zn=Te.answers.keep;return oe({keep:{words:[(Dt=zn==null?void 0:zn.words)==null?void 0:Dt.trim(),cse(q)].filter(Boolean).join(", "),refs:(zn==null?void 0:zn.refs)??[]}}),!0}return oe({[je]:Ir}),!0}const ce=(Ve==null?void 0:Ve.id)??null,Ce=ce==="unsure"?((Zn=Te.unsure)==null?void 0:Zn.q)??"source":ce;if(ce==="traits"){const Ot=Po(et,Js);if(Ot)return ht(et,xl(Ot,Sn(null,ce),Pt(ce,Ot),et),ce,Ot),!0;const rn=Te.answers.keep;return oe({traits:[],keep:{words:[(xt=rn==null?void 0:rn.words)==null?void 0:xt.trim(),et].filter(Boolean).join(", "),refs:(rn==null?void 0:rn.refs)??[]}}),!0}if(ce==="gaps"){const Ot=Po(et,Js);if(Ot)return ht(et,xl(Ot,Sn(null,ce),Pt(ce,Ot),et),ce,Ot),!0;const rn=(Te.answers.describe??"").trim().replace(/[.\s]+$/,"");return oe({describe:rn?`${rn}, ${et}`:et}),!0}const ze=Sn(null,Ce),lt=Ce==="source"?ase(et):null,mt=lt?null:Po(et,Js);if(mt&&(ze==="source"||ze==="describe"||mt!=="vague"))return ht(et,xl(mt,ze,Pt(ce,mt),et),ce,mt),!0;if((Ce==="source"||Ce==="describe")&&!lt&&!Js(et))return v({type:"unsure",unsure:{said:et,q:ce,at:Ch()},ctx:D}),!0;if((Ce==="source"||Ce==="describe")&&v({type:"settle-unsure",ctx:D}),Ce==="source")return lt?(oe({source:{door:lt,via:"taps"}}),!0):(oe({source:{door:"scratch",via:"typed"},describe:et}),!0);if(Ce==="describe")return oe({describe:et}),!0;if(re&&!((On=re.name)!=null&&On.trim())&&Ce!=="name"&&/^[A-Z][a-z]+(?:\s[A-Z][a-z]+)?$/.test(et)&&!Js(et))return ge.update({name:et.slice(0,60)}),v({type:"text",text:""}),!0;if(Ce==="name"){const Ot=et.replace(/^(?:(?:her|his|their|the|my)\s+name\s+is|call\s+(?:her|him|them)|name:)\s*/i,"").trim()||et;return re&&ge.update({name:Ot.slice(0,60)}),v({type:"text",text:""}),!0}if(!re)return!1;if(Ce==="identity")return ge.generate("portrait",et),v({type:"text",text:""}),!0;const _t=uj(et,Re,re);return"blocked"in _t?(L(_t.blocked),!1):(C(_t.view),M(!1),ge.generate(_t.view,et,_t.scope==="view"?Co(_t.view):void 0),v({type:"text",text:""}),!0)},[Ve,oe,ht,re,ge,Re]),wt=s.useCallback(me=>{if(me==="name"){v({type:"edit",id:"name"});return}const q=O3(me);if(q){v({type:"edit",id:`aside:${q}`});return}if(!Ps(me))return;const Te=bse(me,re);if(Te==="start-over"){B("start-over");return}if(Te==="redraw"){te(me),B("redraw");return}v({type:"edit",id:me})},[re]),pt=s.useCallback(()=>{B(null),F&&v({type:"edit",id:F}),te(null)},[F]),Nt=s.useCallback((me,q)=>{const Te=y.current.answers;if(me==="keep"||me.startsWith("trait-")&&!me.endsWith("-where")){const je=Te[me];oe({[me]:{pick:me==="keep"||je==null?void 0:je.pick,words:q,refs:(je==null?void 0:je.refs)??[]}});return}if(er(me)||me.startsWith("trait-")){const je=Te[me];oe({[me]:{pick:je==null?void 0:je.pick,words:q}});return}oe({[me]:q})},[oe]),Ct=s.useCallback((me,q)=>{const Te=q.trim();if(!Te)return;if(me==="name"){v({type:"cancel-edit"}),re&&ge.update({name:Te.slice(0,60)});return}const je=O3(me);if(je){const dt=y.current,jt=dt.asides.find(ze=>ze.at===je);if(!jt)return;const et=jt.q&&Ps(jt.q)?jt.q:null,Pt=et?D1(et,Te,Js):Po(Te,Js);if(!Pt&&et){v({type:"drop-aside",at:je}),Nt(et,Te);return}const Sn=Vg(et,jt.q,!!(re!=null&&re.views.portrait.hash)),U=et&&er(et)?et.slice(5):void 0,ce=Pt??"vague",Ce=dt.asides.filter(ze=>ze.q===jt.q&&ze.at<jt.at&&ze.kind===ce).length;v({type:"amend-aside",at:je,said:Te,reply:xl(ce,Sn,Ce,Te,U),kind:ce,ctx:D});return}if(!Ps(me)||!A0(me,y.current.answers))return;const gt=D1(me,Te,Js);if(gt){const dt=y.current,jt=Vg(me,me,!!(re!=null&&re.views.portrait.hash)),et=er(me)?me.slice(5):void 0,Pt=dt.asides.filter(Sn=>Sn.q===me&&Sn.kind===gt).length;oe({[me]:void 0}),ht(Te,xl(gt,jt,Pt,Te,et),me,gt);return}Nt(me,Te)},[re,ge.update,oe,Nt,Oe,Ve,D]),$t=s.useCallback(()=>v({type:"cancel-edit"}),[]),Yt=s.useCallback(()=>{const me=y.current,q=me.editing&&me.editing!=="name"&&!C0(me.editing)?me.editing:null,Te=q&&!A0(q,me.answers)?q:Ve==null?void 0:Ve.id;if(Te==="agree"){v({type:"say",id:"keep"});return}if(!(!Te||!Ps(Te))){if(Te==="look-who"){oe({source:{door:"scratch",via:"words"}});return}v({type:"say",id:Te})}},[Ve==null?void 0:Ve.id,oe]),Vn=s.useCallback(()=>Jk(y.current,D,Xe.current),[D]),pn=s.useCallback(me=>{const q=Vn();if(q){L(null),y.current.saying!==q&&v({type:"say",id:q});for(const Te of me.slice(0,1)){const je=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,gt=URL.createObjectURL(Te);z(dt=>[...dt,{key:je,id:q,url:gt}]),y0(Te).then(dt=>{Y.current.set(dt,gt),v({type:"ref",id:q,hash:dt}),z(jt=>jt.filter(et=>et.key!==je))}).catch(dt=>{L(String((dt==null?void 0:dt.message)??dt)),z(jt=>jt.filter(et=>et.key!==je)),URL.revokeObjectURL(gt)})}}},[Vn]),ar=(me,q,Te)=>{const je=z4(me,q,Te);return je.charAt(0).toUpperCase()+je.slice(1)},bt=me=>Dk(me).flatMap(q=>{const Te=q.color?Jn(q.color):null;return Te?[{hex:Te,name:q.label,slot:"accent"}]:[]}),kt=Jk(g,D,(Ve==null?void 0:Ve.id)??null),sn=(()=>{var Pt,Sn,U;if(!kt)return;const me=((Pt=g.answers[kt])==null?void 0:Pt.refs)??[],q=kt==="keep"?me.slice(((Sn=g.composing)==null?void 0:Sn.id)==="keep"?g.composing.refs.length:me.length):me,Te=K.filter(ce=>ce.id===kt);if(!q.length&&!Te.length)return;const je=kt==="keep"?null:Gr(kt),gt=je&&((U=fa(je.id))==null?void 0:U.label)||"Detail",dt=q.length+Te.length>1;let jt=0;const et=()=>dt?`${gt} ${++jt}`:gt;return[...q.map(ce=>({key:ce,src:Y.current.get(ce)??nn(ce,"micro"),label:et(),onRemove:()=>v({type:"ref",id:kt,hash:ce,remove:!0})})),...Te.map(ce=>({key:ce.key,src:ce.url,label:et(),busy:!0,onRemove:()=>z(Ce=>Ce.filter(ze=>ze.key!==ce.key))}))]})(),Ut=Ese(Ve,g,re,Re),Tn=ge.busy||I||!!Ut.off,Vt=kt,ne=Xk(g,Ve),se=ne==="name"?null:ne,pe=se&&er(se)?se.slice(5):null,ve=Ut.color&&pe?bt(pe):null,Ee=se&&((ot=g.colour)==null?void 0:ot.step)===se?g.colour.hex:null,We=re&&Oo(re)&&!Ut.off&&!(Ve!=null&&Ve.id.match(/^(name|describe)$/))?(()=>{const me=MW(g.text,Re,re),q=me.chip?re.views[me.chip.view].hash:void 0;return{chip:me.chip?{label:me.chip.label,thumb:q?nn(q,"micro"):void 0}:null,hint:me.hint,tone:me.tone}})():null,Ke=re?ij(re,Re):[],Ue=(Ie==null?void 0:Ie.hash)??((re==null?void 0:re.stage)==="analyzing"?re.sources[0]:void 0),Be=N&&(Ie!=null&&Ie.prior)?Ie.prior:Ue;return{d:re,view:Re,slot:Ie,facets:A,setFacets:P,presenterCategories:d,saving:$,saveErr:O,confirming:ie,setConfirming:B,confirmEdit:pt,pendingEdit:F,startOver:ue,begun:Object.keys(g.answers).length>0||!!re,unsaved:!re&&Object.keys(g.answers).length>0,leave:()=>{G(),v({type:"start-over"})},revision:g.revision,open:(Ve==null?void 0:Ve.id)??null,keepPrevious:Ie&&Ie.status==="approved"&&Ie.prior&&!st&&!(re!=null&&re.activeView)&&(re==null?void 0:re.stage)==="idle"?()=>void ge.revert(Re):null,surface:{title:"Create presenter",memoryKey:`presenter-create:${c.id}:${t}`,resumed:J,turns:qe,busy:ge.busy||I,working:(re==null?void 0:re.stage)==="analyzing"?`Reading ${LM(re.source)}`:re!=null&&re.activeView?"Drawing":I||ge.busy,stageEmpty:{lead:Vre(re?Re:void 0,vn[Re]),hint:Zre((Ve==null?void 0:Ve.id)??null)},stage:re?{hash:Be,alt:`${Zl[Re]}${(Ie==null?void 0:Ie.status)==="candidate"?", candidate":""}`,drawing:st,since:dj(re),doing:fj(re),takes:U6(re,Re)?[]:pj(re,Re),onTake:Ye?me=>void ge.restore(Re,me):void 0,items:Ke,onPick:me=>{C(me),M(!1)},compare:Ie&&Ie.status==="candidate"&&Ie.prior?{on:N,toggle:()=>M(me=>!me)}:void 0}:null,composer:{placeholder:Ut.placeholder,label:Ut.label,action:Ut.action,scope:We,hint:null,why:Ut.off??void 0,error:T??O,disabled:Tn,working:!!re&&!!re.activeView&&(Ve==null?void 0:Ve.id)!=="name",onStop:re!=null&&re.activeView?()=>void ge.stop():void 0,stopping:ge.stopping,focusKey:Ve&&!(Ve.id==="agree"&&!g.saying)?`${Ve.id}:${(re==null?void 0:re.id)??"setup"}:${X}:${g.saying??""}:${g.says}`:void 0,onAttach:!Vt&&!re&&(Ve==null?void 0:Ve.id)==="source"?()=>oe({source:{door:"photos",via:"taps"}}):void 0,onAttachFiles:Vt?pn:void 0,attachLabel:Vt?Yse(g,Vt):"Add photos",refs:sn,colour:ve&&pe?{hex:Ee,label:Ee?ar(Ee,Dk(pe),pe):"Pick a colour",seed:(rt=ve[Math.floor(ve.length/2)])==null?void 0:rt.hex,onPick:me=>v({type:"colour",hex:me,step:se}),onClear:()=>v({type:"colour",hex:null,step:se})}:null},text:g.text,onText:me=>v({type:"text",text:me}),onSend:Oe,onAnswer:yn,onRestore:(me,q)=>{C(me),ge.restore(me,q)},onEdit:wt,onSaveEdit:Ct,onCancelEdit:$t,onDescribe:Yt,onAttachRef:pn,onStarter:me=>{(Ve==null?void 0:Ve.id)==="agree"&&v({type:"say",id:"keep"}),v({type:"text",text:me})},onPaste:re?void 0:me=>void tt(me)}}}function Xse({onClose:e,...t}){const n=qse(t),r=n.d;s.useEffect(()=>wh({open:n.open}),[n.open]),s.useEffect(()=>()=>wh(null),[]);const[a,i]=s.useState(!1),c=()=>{if(n.unsaved){i(!0);return}e()},d=n.begun?r?o.jsx(mr,{label:"Start over",tone:"quiet",title:"Start over?",body:`This conversation begins again from the first question. ${lj(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,f=o.jsx(o.Fragment,{children:n.keepPrevious&&n.slot&&o.jsxs("div",{className:"sc-pstudio-offer",children:[o.jsxs("span",{children:["Redrew the ",vn[n.view],"."]}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:n.keepPrevious,children:"Keep previous"})]})}),h=o.jsx(mr,{label:"Change it",title:Gre,body:(r==null?void 0:r.source)==="photos"?Yre:Kre,busy:!1,open:n.confirming==="redraw",onOpenChange:g=>{g||n.setConfirming(null)},onConfirm:n.confirmEdit}),p=o.jsxs(o.Fragment,{children:[h,o.jsx(mr,{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:a,onOpenChange:g=>{g||i(!1)},onConfirm:()=>{i(!1),n.leave(),e()}})]});return o.jsx(I4,{surface:{...n.surface,headAction:d,dock:f,overlay:p},onClose:c})}function Qse(){const{draftId:e=null}=Fs(),{key:t}=_n(),{brand:n}=Qt(),r=Dn(),{announce:a,caps:i}=t4();dc("Create presenter");const c=s.useRef(!1);s.useEffect(()=>(c.current=!0,()=>{c.current=!1}),[]);const d=s.useCallback((p,g=!1)=>r(Ti(n,p),{replace:g}),[r,n]),f=s.useCallback(()=>r(Ti(n),{replace:!0}),[r,n]),h=s.useCallback(()=>r(Vi(n),{replace:!0}),[r,n]);return o.jsx(Xse,{draftId:e,convoKey:e??t,onOpenDraft:d,onLeaveDraft:f,onClose:h,onStarted:p=>{a(p),c.current&&r(p.kind==="presenter"?la(n,p.id):Vi(n),{replace:!0})},caps:i})}const e5=1e3,Jse=3;function eae(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,...n?{previewHash:n}:{}}}function tae(e){var M,T;const{s:t,dispatch:n,brandId:r,sceneId:a,conversation:i,applyBrand:c}=e,[d,f]=s.useState(!1),[h,p]=s.useState(!1),g=s.useRef(t);g.current=t;const v=s.useRef(!1),y=s.useRef(e.onSaved);y.current=e.onSaved;const b=s.useCallback(async(L,A={})=>{if(!(v.current||g.current.job)){v.current=!0;try{const P=g.current,$=Tr(P),H=L==="make"?{kind:L,instruction:P.place,imageHashes:P.pictures,draw:A.draw??!1,...A.shot?{shot:!0}:{}}:L==="again"?{kind:L,reading:$==null?void 0:$.reading,imageHashes:P.pictures}:{kind:L,reading:$==null?void 0:$.reading,ask:A.ask,from:($==null?void 0:$.hash)??void 0,imageHashes:P.pictures,draw:A.draw},O=P.name.trim()||($==null?void 0:$.reading.name)||void 0,{jobId:Q,job:I}=await Me.startSceneStudioJob(r,{...H,conversation:i,...a?{sceneId:a}:{},...O?{label:O}:{}});n({type:"started",id:Q,kind:I.kind,ask:I.kind===L?A.ask:void 0,since:I.phaseAt})}catch(P){n({type:"error",text:String((P==null?void 0:P.message)??P)})}finally{v.current=!1}}},[r,n]),x=t.named?t.name.trim():"",k=((M=t.job)==null?void 0:M.id)??null;s.useEffect(()=>{!k||!x||Me.labelSceneStudioJob(r,k,x).catch(()=>{})},[k,x,r]);const S=((T=t.job)==null?void 0:T.id)??null;s.useEffect(()=>{if(!S)return;let L=!0,A=0,P;const $=async()=>{try{const H=await Me.sceneStudioJob(r,S);if(!L)return;A=0,f(!1),H.status==="running"?(n({type:"progress",job:H}),P=setTimeout($,e5)):n({type:"finished",job:H})}catch(H){if(!L)return;if((H==null?void 0:H.status)===404){n({type:"lost",id:S,error:Se.lost});return}A++,A>=Jse&&f(!0),P=setTimeout($,Math.min(e5*2**Math.min(A,3),8e3))}};return $(),()=>{L=!1,clearTimeout(P)}},[S,r,n]);const E=s.useCallback(()=>{const L=g.current.job;!L||L.stopping||(n({type:"stopping",id:L.id}),Me.cancelSceneStudioJob(r,L.id).catch(()=>{}))},[r,n]),C=s.useCallback(L=>{const A=ZQ(g.current,L);A>=0&&n({type:"put-back",index:A})},[n]),N=s.useCallback(async(L={})=>{var O,Q,I,V,ie;const A=g.current,P=((O=Tr(A))==null?void 0:O.reading.name)||((I=(Q=A.job)==null?void 0:Q.pending)==null?void 0:I.name)||"",$={...A,name:A.name.trim()||P},H=FQ($);if(!(!H.can||!H.words||v.current)){v.current=!0,p(!0);try{const B=((V=A.job)==null?void 0:V.phase)==="drawing"?A.job.id:null,F=B?null:((ie=Tr(A))==null?void 0:ie.hash)??null,te=eae($,H.words,F),X=a&&!L.asNew?await Me.updateScene(r,a,te):await Me.createScene(r,te);c(X.brand);const Z=X.scene;if(B){const K=await Me.attachSceneStudioJob(r,B,Z.id).catch(()=>null);(K==null?void 0:K.state)==="landed"&&c(K.brand)}n({type:"saved",id:Z.id}),y.current({id:Z.id,name:Z.name,verticals:Z.verticals??[]},!!L.asNew)}catch(B){n({type:"error",text:String((B==null?void 0:B.message)??B)})}finally{v.current=!1,p(!1)}}},[r,a,c,n]);return{offline:d,saving:h,start:b,stop:E,putBack:C,use:N}}const nae="scenri:scene-studio:",rae=10080*60*1e3;function sae(e){const t=ns.get(e);if(!t)return null;try{const n=JSON.parse(t);return lN(typeof(n==null?void 0:n.session)=="string"?n.session:null)}catch{return null}}function aae(e,t,n){ns.set(e,JSON.stringify({at:Date.now(),sceneId:n,session:t}))}function oae(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 Zg(e){ns.del(e)}function iae(e=Date.now()){var t;for(const n of ns.keys(nae)){let r=0;try{r=Number((t=JSON.parse(ns.get(n)??"null"))==null?void 0:t.at)||0}catch{}e-r>rae&&ns.del(n)}}function lae(e){var Tn,Vt,ne,se,pe;const{brand:t,applyBrand:n,sceneId:r,seed:a,conversation:i,storageKey:c,caps:d}=e,f=r&&a?{name:a.name}:null,[h]=s.useState(()=>{iae();const ve=sae(c);return ve||Ni(c),ve}),[p,g]=s.useReducer(LQ,null,()=>(h==null?void 0:h.setup)??PQ),[v,y]=s.useReducer(IQ,null,()=>(h==null?void 0:h.studio)??a??eN),[b,x]=s.useState(0),[k,S]=s.useState(""),E=s.useRef(null),[C,N]=s.useState(!1),[M,T]=s.useState(void 0),[L,A]=s.useState(null),P=s.useRef(!1),$=s.useRef(p);$.current=p;const H=s.useRef(v);H.current=v;const[O,Q]=s.useState(null),I=s.useRef(e.onSaved);I.current=e.onSaved;const V=tae({s:v,dispatch:y,brandId:t.id,sceneId:r,conversation:i,applyBrand:n,onSaved:(ve,Ee)=>I.current(ve,r&&!Ee?"updated":"created")});s.useEffect(()=>{P.current||aae(c,hJ(p,v),r??v.saved)},[p,v,c,r]);const ie=v.saved,B=ie?mh(t,ie):void 0,F=rM(t.id,ie,(B==null?void 0:B.previewUrl)??null),te=((Tn=F.job)==null?void 0:Tn.status)==="running",[X,Z]=s.useState(!1);s.useEffect(()=>{te||Z(!1)},[te]);const K=s.useMemo(()=>gj(B==null?void 0:B.examples,F.job),[B==null?void 0:B.examples,F.job]),z=s.useRef(e.onDone);z.current=e.onDone;const Y=s.useMemo(()=>{var Ee,We;if(!ie)return;const ve=(B==null?void 0:B.examples)??[];return{tiles:K,running:te,read:F.read,who:((Ee=ve[0])==null?void 0:Ee.with)??((We=F.job)==null?void 0:We.subject.kind)??((B==null?void 0:B.subject)==="person"||B!=null&&B.figure?"presenter":"product"),noSubject:F.read&&!F.job&&!ve.length&&F.more.length===0,missing:TW(F.more,ve,F.job),first:F.first,stale:F.first.length>0&&ve.length>0,finish:e.finish}},[ie,B,K,te,F.read,F.job,F.first,F.more,e.finish]),J=s.useCallback(ve=>{ie&&(A(null),Me.drawSceneExamples(t.id,ie,ve).then(()=>F.again()).catch(Ee=>A(String((Ee==null?void 0:Ee.message)??Ee))))},[t.id,ie,F.again]),de=s.useCallback(()=>{ie&&(P.current=!0,Zg(c),Ni(c),z.current(ie))},[ie,c]),[ae,W]=s.useState(null);s.useEffect(()=>{f||p.editing||!K3(p.answers)||y({type:"inputs",place:MQ(p.answers),pictures:RQ(p.answers)})},[p.answers,p.editing,f]);const ye=s.useRef(new Set),ee=HQ(v,!f&&K3(p.answers));s.useEffect(()=>{var ve;ee===null||ye.current.has(ee)||(ye.current.add(ee),V.start("make",{draw:!1,shot:((ve=$.current.answers.source)==null?void 0:ve.door)==="shot"}))},[ee,V.start]);const[ge,re]=s.useState(""),D=j4(t.id,ge,!f),G=s.useRef(D);G.current=D;const Pe=s.useRef([]);D.settled&&!D.error&&(Pe.current=D.items);const Ze=D.settled?D.items:Pe.current,He=!D.error&&(!D.settled||D.loading),{recent:tt,loaded:oe}=Qt(),[he,Ae]=s.useState(null);s.useEffect(()=>{!ge.trim()&&D.settled&&!D.error&&Ae(D.items.length>0)},[ge,D.settled,D.error,D.items.length]);const ue=he??(tt.length>0?!0:oe?!1:null),ke=s.useMemo(()=>({any:ue,items:Ze.map(ve=>({id:ve.id,hash:ve.images[0],alt:oae(ve.promptHead)})),query:ge,more:D.settled&&D.hasMore,loading:He,error:D.error}),[ue,Ze,ge,D.settled,D.hasMore,He,D.error]),qe=jn().scenes,Ve=s.useCallback(async ve=>{var Be,ot,rt;const Ee=Pe.current.find(me=>me.id===ve)??D.items.find(me=>me.id===ve);if(!(Ee!=null&&Ee.images[0]))return;const We=$.current.revision;let Ke=tk(Ee.brief);if(!Ke&&Ee.kind==="edit"){const me=await Me.lineage(Ee.id).catch(()=>null);if(Ke=tk((Be=me==null?void 0:me.ancestors.find(q=>q.kind==="generation"))==null?void 0:Be.brief),$.current.revision!==We)return}const Ue=Ke?((ot=mh(t,Ke))==null?void 0:ot.name)??((rt=qe.find(me=>me.id===Ke))==null?void 0:rt.name):void 0;ht({shot:{id:Ee.id,hash:Ee.images[0],...Ke&&Ue?{scene:{id:Ke,name:Ue}}:{}},reuse:void 0})},[t,qe,D.items]),Xe=s.useCallback(()=>{var Ee;const ve=(Ee=$.current.answers.shot)==null?void 0:Ee.scene;ve&&(P.current=!0,Zg(c),Ni(c),z.current(ve.id,{existing:!0}))},[c]),Re=(d==null?void 0:d.canDraw)??!0,Ie=V.offline?Se.offline:L,st={setup:p,studio:v,canDraw:Re,uploading:b,edit:f,editingName:C,note:Ie,stale:tN(v),shots:ke,set:Y},Ye=s.useMemo(()=>lJ(st),[p,v,Re,b,C,Ie,f,ke,Y]),$e=(()=>{const ve=Ye[Ye.length-1];return(ve==null?void 0:ve.kind)==="question"?ve.question:null})(),Qe=dJ(st,$e),Fe=s.useCallback(async ve=>{var Be,ot,rt;const Ee=ve.filter(me=>me.type.startsWith("image/")||/\.(heic|heif)$/i.test(me.name));if(!Ee.length){A(Se.onlyPictures);return}((Be=$.current.answers.source)==null?void 0:Be.door)!=="photos"&&g({type:"answer",patch:{source:{door:"photos"}}});const Ue=4-(((ot=$.current.answers.photos)==null?void 0:ot.hashes)??[]).length;if(Ue<=0){A(Se.fourPictures);return}A(Ee.length>Ue?Se.fourPictures:null),x(me=>me+1);try{for(const me of Ee.slice(0,Ue))try{const q=await y0(me),Te=((rt=$.current.answers.photos)==null?void 0:rt.hashes)??[];g({type:"photos",hashes:[...Te,q]})}catch(q){A(`${me.name} could not be added: ${String((q==null?void 0:q.message)??q)}`)}}finally{x(me=>me-1)}},[]),yt=(ve,Ee,We)=>g({type:"aside",aside:{said:ve,reply:Ee,q:We,at:Ch()}}),ht=s.useCallback(ve=>{const Ee=$.current,We=Ee.held??Ee.answers;Ee.editing&&Q3(H.current)&&JSON.stringify(w4(We,ve))!==JSON.stringify(We)&&y({type:"forget-record"}),g({type:"answer",patch:ve})},[]),yn=s.useRef(K);yn.current=K;const Oe=s.useCallback((ve,Ee)=>{var We,Ke;if(A(null),ve==="photos"&&Ee.kind==="photos"){const Ue=Ee.action,Be=((We=$.current.answers.photos)==null?void 0:We.hashes)??[];Ue.type==="add"?Fe(Ue.files):Ue.type==="instead"?ht({source:{door:"shot"}}):Ue.type==="remove"?g({type:"photos",hashes:Be.filter(ot=>ot!==Ue.hash)}):Ue.type==="reject"?A(Se.onlyPictures):Ue.type==="submit"&&Be.length?ht({photos:{hashes:Be,done:!0}}):Ue.type==="back"&&ht({source:{door:"guided"}});return}if(ve==="shot"&&Ee.kind==="pick"){const Ue=Ee.action;Ue.type==="pick"?Ve(Ue.id):Ue.type==="query"?re(Ue.text):Ue.type==="more"?G.current.loading||G.current.loadMore():Ue.type==="back"&&(re(""),ht({source:{door:"photos"},photos:{hashes:[],done:!1}}));return}if(ve==="reuse"&&Ee.kind==="choice"&&Ee.id==="use"){Xe();return}if(G3(ve)){const Ue=NQ(ve,Ee,$.current.answers);Ue&&ht(Ue);return}if(ve==="retry"){V.start("make",{draw:!1,shot:((Ke=$.current.answers.source)==null?void 0:Ke.door)==="shot"});return}if(Ee.kind==="confirm"){if(ve==="set-start"){Ee.id==="draw-set"?(y({type:"set-drawn"}),J({first:!0})):y({type:"set-declined"});return}if(ve==="set-more"){Ee.id==="more"?(y({type:"ask-more"}),J({more:!0})):y({type:"decline-more"});return}if(ve==="set-done"){Ee.id==="retry-failed"?J({roles:yn.current.filter(Ue=>Ue.state==="failed").map(Ue=>Ue.role)}):de();return}Ee.id==="draw"||Ee.id==="again"?V.start("again"):Ee.id==="use"?V.use():Ee.id==="another-shot"&&$t.current("shot")}},[Fe,ht,V.start,V.use,J,de,Ve,Xe]),wt=ve=>{ve.trim()?!E.current&&Qe.target.kind!=="off"&&(E.current=Qe.target):E.current=null,S(ve)},pt=ve=>{const Ee=Nt(ve);return Ee&&(E.current=null,S("")),Ee};function Nt(ve){var Ee;{const We=ve.trim();if(!We)return!1;A(null);const Ke=E.current??Qe.target;if(Ke.kind==="source"){if(oN(We))return ht({source:{door:"words",text:We.slice(0,400)}}),!0;const Ue=wQ(We),Be=Object.keys(Ue);return Be.length>0?(ht({source:{door:"guided"},...Object.fromEntries(Be.map(ot=>[ot,{pick:Ue[ot]}]))}),!0):(yt(We,ok(ik(We,"source")??"vague","source"),"source"),!0)}if(Ke.kind==="row"&&jh(Ke.id)){const Ue=ik(We,"row");if(Ue)return yt(We,ok(Ue,"row"),Ke.id),!0;const Be=(Ee=$.current.answers[Ke.id])==null?void 0:Ee.pick;return ht({[Ke.id]:{...Be?{pick:Be}:{},words:We.slice(0,200)}}),!0}if(Ke.kind==="name")return y({type:"name",text:nN(We)??We}),!0;if(Ke.kind==="add"||Ke.kind==="change"){if(v.job)return!1;const Ue=XQ(We),Be=iJ(v);return Ue.kind==="rename"?(y({type:"name",text:Ue.name}),yt(We,Se.renamed(Ue.name),Be),!0):Ue.kind!=="change"?(yt(We,Ue.say,Be),Ue.kind!=="refuse"):(Ke.kind==="add"?V.start("change",{ask:We,draw:!1}):QQ(v,We)?V.start("again"):V.start("change",{ask:We}),!0)}return!1}}const Ct=s.useCallback(ve=>{v.job||(ve==="name"?N(!0):G3(ve)&&(ve==="shot"&&re(""),Q3(v)?Q(ve):g({type:"edit",id:ve})))},[v]),$t=s.useRef(Ct);$t.current=Ct;const Yt=s.useCallback((ve,Ee)=>{ve==="name"&&(Ee.trim()&&y({type:"name",text:Ee.trim()}),N(!1))},[]),Vn=s.useCallback(()=>{N(!1),g({type:"cancel-edit"})},[]),pn=Tr(v),ar=te&&F.job?W6({status:F.job.status,step:F.job.current,done:F.job.done.length,total:F.job.roles.length,error:F.job.error}):void 0,bt=v.job?jg(v):V.saving?"Saving":ar,kt=[];let sn=null;if(ie){const ve=te?(Vt=F.job)==null?void 0:Vt.current:null,Ee=((ne=[...K].reverse().find(Ue=>Ue.state==="shown"))==null?void 0:ne.role)??null,We=ae??ve??Ee??"place";kt.push({view:"place",label:"The place",state:We==="place"?"current":"approved",hash:(pn==null?void 0:pn.hash)??void 0,photo:!1,drawing:!1,approved:!0,error:!1});for(const Ue of K)kt.push({view:Ue.role,label:Bl[Ue.role],state:We===Ue.role?"current":Ue.state==="shown"?"approved":"todo",hash:Ue.hash,photo:!1,drawing:Ue.state==="drawing",approved:Ue.state==="shown",error:Ue.state==="failed"});const Ke=kt.find(Ue=>Ue.view===We)??kt[0];sn={hash:Ke.hash,drawing:Ke.drawing}}const Ut=!f&&(!!p.answers.source||v.versions.length>0);return{title:f?Se.editTitle:Se.title,turns:Ye,working:bt,busy:V.saving,resumed:!!h,memoryKey:c,stage:sn?{hash:sn.hash,alt:`${v.name.trim()||(pn==null?void 0:pn.reading.name)||"The scene"}, in use`,drawing:sn.drawing||!!v.job&&v.job.phase==="drawing",doing:ar??jg(v),items:kt,onPick:ve=>W(ve)}:{hash:(pn==null?void 0:pn.hash)??void 0,alt:`Preview of ${v.name.trim()||(pn==null?void 0:pn.reading.name)||"the scene"}`,drawing:!!v.job&&v.job.phase==="drawing",since:((se=v.job)==null?void 0:se.since)??void 0,doing:jg(v),takes:v.job?void 0:_Q(v),onTake:V.putBack,items:[]},composer:{placeholder:Qe.placeholder,label:Qe.label,action:Qe.action,disabled:Qe.target.kind==="off",why:Qe.target.kind==="off"&&Qe.target.why||null,working:Qe.working,onStop:v.job?V.stop:te&&ie?()=>{Z(!0),Me.stopSceneExamples(t.id,ie).then(()=>F.again()).catch(()=>{})}:void 0,stopping:!!((pe=v.job)!=null&&pe.stopping)||X,focusKey:M,onAttachFiles:Qe.attach?ve=>void Fe(ve):void 0,attachLabel:Se.attachLabel},text:k,onText:wt,onSend:pt,onAnswer:Oe,onEdit:Ct,onSaveEdit:Yt,onCancelEdit:Vn,confirmingEdit:O!==null,confirmEdit:()=>{O&&g({type:"edit",id:O}),Q(null)},cancelConfirm:()=>Q(null),onRestore:(ve,Ee)=>V.putBack(Ee),onRetry:ve=>J({roles:[ve]}),onDescribe:()=>T(String(Date.now())),onStarter:ve=>{wt(ve),T(String(Date.now()))},onPaste:($e==null?void 0:$e.id)==="source"||($e==null?void 0:$e.id)==="photos"?ve=>void Fe(ve):void 0,canDraw:Re,begun:Ut,unsaved:v.saved?!1:f?JQ(v,a):Ut,running:!!v.job||te,saved:!!ie,finish:de,keptAsDraft:!f&&rN(v),leave:()=>{V.stop(),P.current=!0,Zg(c),Ni(c)}}}function cae({brand:e,applyBrand:t,sceneId:n,seed:r,conversation:a,storageKey:i,caps:c,onClose:d,onStartOver:f,onSaved:h,onDone:p,finish:g}){const v=lae({brand:e,applyBrand:t,sceneId:n,seed:r,conversation:a,storageKey:i,caps:c,onSaved:h,onDone:p,finish:g}),[y,b]=s.useState(!1),x=v.turns[v.turns.length-1],k=(x==null?void 0:x.kind)==="question"?x.question.id:null;s.useEffect(()=>wh({open:k}),[k]),s.useEffect(()=>()=>wh(null),[]);const S=!!n,E=()=>{if(v.saved){v.finish();return}if(v.running||v.keptAsDraft){d();return}if(v.unsaved){b(!0);return}v.leave(),d()},C=!S&&v.begun&&!v.saved?o.jsx(mr,{label:Se.startOver,tone:"quiet",title:Se.startOverTitle,body:Se.startOverBody,busy:!1,onConfirm:()=>{v.leave(),f()}}):null;return o.jsx(I4,{onClose:E,surface:{kind:"scene",glyph:o.jsx(AC,{size:32}),title:v.title,turns:v.turns,busy:v.busy,working:v.working,memoryKey:v.memoryKey,resumed:v.resumed,stage:v.stage,stageEmpty:{lead:Se.emptyLead,hint:Se.emptyHint},composer:v.composer,text:v.text,onText:v.onText,onSend:v.onSend,onAnswer:v.onAnswer,onEdit:v.onEdit,onSaveEdit:v.onSaveEdit,onCancelEdit:v.onCancelEdit,onRestore:v.onRestore,onRetry:v.onRetry,onDescribe:v.onDescribe,onStarter:v.onStarter,onPaste:v.onPaste,headAction:C,overlay:o.jsxs(o.Fragment,{children:[o.jsx(mr,{label:Se.changeIt,title:Se.changeTitle,body:Se.changeBody,busy:!1,open:v.confirmingEdit,onOpenChange:N=>{N||v.cancelConfirm()},onConfirm:v.confirmEdit}),o.jsx(mr,{label:S?Se.discard:Se.leave,title:S?Se.discardTitle:Se.leaveTitle,body:S?Se.discardBody:Se.leaveBody,busy:!1,open:y,onOpenChange:N=>{N||b(!1)},onConfirm:()=>{b(!1),v.leave(),d()}})]})}})}const t5=e=>{const t=/^asset:([a-f0-9]{32})$/.exec(String(e??""));return t?t[1]:null};function uae(e,t){var c;const r=(((c=e.json)==null?void 0:c.scenes)??[]).find(d=>(d==null?void 0:d.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(d=>t5(d==null?void 0:d.file)).filter(Boolean);return OQ({place:String(r.instruction??""),pictures:i.slice(0,4),reading:a,hash:t5(r.preview)??null,name:a.name})}function dae(){return[...crypto.getRandomValues(new Uint8Array(6))].map(t=>t.toString(16).padStart(2,"0")).join("")}function n5(){const{sceneId:e=null,convoId:t=null}=Fs(),{key:n,state:r}=_n(),{brand:a}=Qt(),{applyBrand:i}=jn(),c=Dn(),{announce:d,caps:f}=t4();dc(e?"Edit scene":"Create scene");const[h]=s.useState(()=>e?uae(a,e):null),p=typeof(r==null?void 0:r.from)=="string"?r.from:null,g=p&&(Hi(it.hub,p.split("?")[0])||Hi(it.set,p.split("?")[0])),v=s.useCallback(()=>c(p??(e?Hr(a,e):Mu(a)),{replace:!0}),[c,p,e,a]),y=s.useMemo(()=>t??dae(),[t,n]);s.useEffect(()=>{t||e&&!h||c(e?F6(a,e,y):Li(a,y),{replace:!0,state:r})},[t,y,e,h,a,c,r]);const b=s.useRef(null);return e&&!h?o.jsx(no,{to:Hr(a,e),replace:!0}):o.jsx(cae,{brand:a,applyBrand:i,sceneId:e,seed:h,conversation:y,storageKey:`scenri:scene-studio:${a.id}:${y}`,caps:f?{canRead:f.canAnalyze,canDraw:f.canGenerate}:null,onClose:v,onStartOver:()=>c(Li(a),{replace:!0,state:r}),onSaved:(x,k)=>{b.current={made:x,how:k}},finish:g?Se.useInAShot:Se.openScene,onDone:(x,k)=>{var S,E;if(!(k!=null&&k.existing)){const C=mh(a,x),N=((S=b.current)==null?void 0:S.made.id)===x?b.current.made:null;d({kind:"scene",id:x,name:(N==null?void 0:N.name)??(C==null?void 0:C.name)??"",verticals:(N==null?void 0:N.verticals)??(C==null?void 0:C.verticals)??[],how:((E=b.current)==null?void 0:E.how)??(e===x?"updated":"created")})}g&&p?c(`${p.split("?")[0]}?scene=${encodeURIComponent(x)}&compose=1`,{replace:!0}):c(Hr(a,x),{replace:!0})}},y)}function BM(){const{brand:e}=Qt(),t=Dn(),n=hr(e);return s.useCallback(r=>{t(`${n}?product=${encodeURIComponent(r)}&compose=1`)},[n,t])}function fae({product:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,size:d="grid"}){var p,g;const f=Ru(e.category),h=f&&e.variant?`${f} · ${e.variant}`:f??e.variant??"";return o.jsx(Uu,{id:e.id,previewUrl:Or((g=(p=e.shots)==null?void 0:p[0])==null?void 0:g.file),title:oo(e,"tooltip"),primary:oo(e,"card"),secondary:h,useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,size:d})}function hae(e){return o.jsx(Tp,{...e})}const UM=s.memo(fae);function pae({product:e,variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,size:d="grid"}){const f=Ru(e.category)??e.category;return o.jsx(Uu,{id:e.id,previewUrl:e.previewUrl,title:`${oo(e,"tooltip")} · ${f}`,primary:oo(e,"card"),secondary:f,useLabel:"Use in a shot",variant:t,onOpen:n,onUse:r,href:a,selected:i,onToggle:c,size:d})}const WM=s.memo(pae),mae=8;function gae(){var de;const{brand:e,products:t,productsLoaded:n}=Qt(),r=((de=aA())==null?void 0:de.importing)??!1,{demoProducts:a}=jn(),i=n&&t.length===0,c=Dn(),d=BM(),f=Xi(),{q:h,setQ:p,facets:g,setFacet:v,clearSearch:y,clear:b}=ff(["category"]),x=g.category,[k,S]=Na(Wr.wallDensity,Tu),E=pc(k),C=s.useCallback(ae=>S(ae),[S]),N=s.useMemo(()=>Up(E),[E]),M=zp(E),T=s.useMemo(()=>{const ae=r?t.filter(W=>{var ye;return(((ye=W.shots)==null?void 0:ye.length)??0)>0}):t;return Oj(ae).map(W=>({product:W,category:e4(W),own:!0}))},[t,r]),L=s.useMemo(()=>a.map(ae=>({product:ae,category:ae.category,own:!1})),[a]),A=s.useMemo(()=>[...T,...L],[T,L]),P=s.useMemo(()=>{const ae=new Map;for(const{category:W}of A)W&&ae.set(W,(ae.get(W)??0)+1);return ae},[A]),$=s.useMemo(()=>b0.filter(ae=>P.has(ae.key)),[P]),H=RN($.length),O=s.useCallback(ae=>c(sa(e,ae)),[c,e]),Q=s.useCallback(ae=>ae.filter(({category:W})=>!x||W===x).filter(({product:W,category:ye})=>lo([x4(W),Ru(ye)].filter(Boolean).join(" "),h)).map(({product:W})=>W),[x,h]),I=s.useMemo(()=>Q(T),[Q,T]),V=s.useMemo(()=>Q(L),[Q,L]),{visible:ie,remaining:B,showMore:F}=T4(I,`${x??""}|${h}`),[te,X]=s.useState(null);s.useEffect(()=>{if(!te||B<=0)return;const ae=te.closest(".sc-home"),W=new IntersectionObserver(ye=>{ye.some(ee=>ee.isIntersecting)&&F()},{root:ae,rootMargin:"200% 0px"});return W.observe(te),()=>W.disconnect()},[te,B,F]);const Z={key:"category",label:"Category",everyLabel:"Every product",everyCount:A.length,selected:x,onSelect:ae=>v("category",ae),options:$.map(ae=>({value:ae.key,label:ae.label,count:P.get(ae.key)??0}))},K=o.jsxs("button",{type:"button",className:"sc-btn sc-btn-primary","data-guide":"library.new",onClick:()=>f("product"),children:[o.jsx(kr,{size:12})," Add product"]}),z=i,Y=t.length>0,J=o.jsx(Gp,{title:"Products",filters:o.jsx(Kp,{mode:H,group:Z}),density:o.jsx(Bp,{value:E,onChange:C}),search:A.length>=mae&&o.jsx(Yu,{value:h,onChange:p,noun:"products",total:A.length}),action:z?void 0:K});return o.jsx(cf.Provider,{value:M,children:o.jsxs(es,{children:[o.jsxs("main",{className:"sc-looks sc-products",id:"main","data-hero":z||void 0,children:[!z&&J,!n&&o.jsx("div",{className:"sc-masonry","data-density":!0,"data-density-size":M,style:N,"aria-hidden":!0,children:o.jsx(hae,{size:"grid",count:8})}),Y&&ie.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":M,style:N,children:ie.map(ae=>o.jsx(UM,{product:ae,variant:"use",size:"grid",onOpen:O,href:sa(e,ae.id),onUse:d},ae.id))}),B>0&&o.jsx("div",{ref:X,"aria-hidden":!0}),B>0&&o.jsx("div",{className:"sc-lib-more",children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost",onClick:F,children:["Show ",Math.min(B,60)," more"]})})]}),z&&o.jsx(Oi,{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:K}),Y&&ie.length>0&&V.length>0&&o.jsx("div",{className:"sc-sec-head sc-owned-divider",children:o.jsx("h2",{className:"sc-sec-title",children:"Scenri products"})}),z&&L.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(L4,{label:"Or borrow one of ours"}),J]}),V.length>0&&o.jsx("div",{className:"sc-masonry","data-wall":!0,"data-density":!0,"data-density-size":M,style:N,children:V.map(ae=>o.jsx(WM,{product:ae,variant:"use",size:"grid",onUse:d,onOpen:O,href:sa(e,ae.id)},ae.id))}),n&&I.length===0&&V.length===0&&o.jsx(Yp,{noun:"products",q:h,facet:x?Ru(x):null,onClearSearch:y,onClearAll:b})]}),o.jsx("div",{className:"sc-impbar-float",children:o.jsx(P4,{})})]})})}function vae({value:e,onChange:t}){const n=Ru(e)??"Other",r=e&&b0.some(a=>a.key===e)?e:"other";return o.jsxs(Ds,{children:[o.jsx(Os,{children:o.jsxs("button",{type:"button",className:"sc-btn sc-btn-ghost sc-catpick","aria-label":`Category: ${n}`,children:[n,o.jsx(_i,{size:11,weight:"bold"})]})}),o.jsx(Hs,{align:"center",sideOffset:8,children:o.jsx(uh,{value:r,children:b0.map(a=>o.jsx(au,{value:a.key,onSelect:()=>t(a.key),children:a.label},a.key))})})]})}function yae({refs:e,cap:t,note:n,addLabel:r,busy:a,onAdd:i,onPromote:c,onRemove:d}){const[f,h]=s.useState(null),p=s.useMemo(()=>e.find(N=>N.file===f)??e[0],[e,f]);s.useEffect(()=>{var N;e.length&&!e.some(M=>M.file===f)&&h(((N=e[0])==null?void 0:N.file)??null)},[e,f]);const g=p?e.findIndex(N=>N.file===p.file):-1,v=!!c&&g>0,y=!!d&&!!p&&e.length>1,b=!!(r&&i&&e.length>0),x=e.length>1||b,{shellRef:k,railRef:S,page:E}=nM(e.length),C=N=>{const M=N==null?void 0:N[0];M&&(i==null||i(M))};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:N=>{N.preventDefault(),N.dataTransfer.dropEffect="copy"},onDrop:N=>{N.preventDefault(),C(N.dataTransfer.files)},children:[o.jsx("input",{type:"file",accept:"image/*",hidden:!0,disabled:a,onChange:N=>{C(N.target.files),N.target.value=""}}),a?o.jsx(wr,{size:"2"}):o.jsx(kr,{size:22,weight:"bold"}),o.jsx("span",{children:"Add a reference"})]}):o.jsx("span",{className:"sc-refstage-blank",children:o.jsx(Vs,{size:22})})}),x&&o.jsxs("div",{className:"sc-refrail-shell",ref:k,children:[o.jsxs("div",{className:"sc-refrail-track",children:[o.jsx("button",{type:"button",className:"sc-refrail-arrow prev","aria-label":"Previous references",onClick:()=>E(-1),children:o.jsx(Da,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-refrail-arrow next","aria-label":"Next references",onClick:()=>E(1),children:o.jsx(qi,{size:13,weight:"bold"})}),o.jsx("div",{className:"sc-refrail",ref:S,children:e.map((N,M)=>o.jsx("button",{type:"button",className:"sc-refrail-item","data-on":(p==null?void 0:p.file)===N.file?"":void 0,"data-spare":M>=t?"":void 0,"aria-label":`Reference ${M+1}`,"aria-pressed":(p==null?void 0:p.file)===N.file,onClick:()=>h(N.file),children:o.jsx("img",{src:N.url,alt:"",loading:"lazy"})},N.file))})]}),b&&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:N=>{C(N.target.files),N.target.value=""}}),a?o.jsx(wr,{size:"1"}):o.jsx(kr,{size:16,weight:"bold"}),o.jsx("span",{className:"sc-vh",children:r})]})]}),(v||y)&&o.jsx("div",{className:"sc-refacts",children:o.jsxs("span",{className:"sc-refacts-pair",children:[v&&o.jsxs("button",{type:"button",className:"sc-refact sc-refact-lead",onClick:()=>c==null?void 0:c(p.file),children:[o.jsx(PB,{size:14,weight:"bold"}),"Use first"]}),y&&o.jsx("button",{type:"button",className:"sc-refact sc-refact-aside",onClick:()=>d==null?void 0:d(p.file),children:"Remove"})]})}),o.jsx("p",{className:"sc-lookpage-note",children:n})]})}function wae({value:e,onChange:t,onBlur:n,label:r,placeholder:a,className:i="sc-lookpage-titleedit"}){const c=s.useRef(null),d=f=>{f&&(f.style.height="auto",f.style.height=`${f.scrollHeight}px`)};return s.useEffect(()=>d(c.current),[e]),o.jsx("textarea",{ref:c,className:i,rows:1,dir:"auto","aria-label":r,placeholder:a,value:e,onChange:f=>{d(f.currentTarget),t(f.target.value)},onBlur:n,onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),f.currentTarget.blur())}})}function bae({size:e,busy:t,error:n,onSave:r,onDismiss:a}){const i=(e==null?void 0:e.by)==="person"?e.text:"",[c,d]=s.useState(i),f=c.trim(),h=()=>{if(!t){if(f===i)return a();r(f)}},p=(e==null?void 0:e.by)==="person"?"Yours. Leave it empty to go back to the size read from its photo.":(e==null?void 0:e.by)==="record"?"From your store's listing. Write another to use yours instead.":e?"Read from its photo, so a shot keeps it at its real size. Correct it if it is off.":"Not read yet. Write it the way a shop lists it.";return o.jsxs(Zs,{className:"sc-newdlg sc-pdetails",maxWidth:"min(460px, 94vw)",onDismiss:a,children:[o.jsxs("div",{className:"sc-newdlg-head",children:[o.jsx(ys,{className:"sc-newdlg-title",children:"Details"}),o.jsx(Is,{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:"Size"}),o.jsx("input",{className:"sc-pdetails-field",value:c,placeholder:e&&e.by!=="person"?e.text:"About 2 cm across, or 30 x 20 cm",onChange:g=>d(g.target.value),onKeyDown:g=>g.key==="Enter"&&h()}),o.jsx("span",{className:"sc-pdetails-hint",children:p})]}),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","data-busy":t||void 0,onClick:h,children:t?"Saving":"Save"})]})]})}const xae=3;function kae(e){const t=e,n=(t.brand??t.vendor??"").trim();return!n||e.name.toLowerCase().startsWith(n.toLowerCase())?null:n}function Sae(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 Eae(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 Cae(){var Xe;const{productId:e=""}=Fs(),{brand:t,products:n,refreshProducts:r}=Qt(),{demoProducts:a,demoProductsLoaded:i,applyBrand:c,refreshBrands:d}=jn(),f=Dn(),h=BM(),{push:p}=Sr(),[g,v]=s.useState(!1),[y,b]=s.useState(!1),[x,k]=s.useState(null),S=s.useRef(null),E=s.useRef({}),C=s.useRef(!1),N=qp(),M=n.find(Re=>Re.id===e),[T,L]=s.useState(null);s.useEffect(()=>{if((M==null?void 0:M.origin)!=="catalog"){L(null);return}let Re=!0;return Me.libraryProduct(t.id,M.id).then(Ie=>{Re&&L(Ie.product)}).catch(()=>{}),()=>{Re=!1}},[t.id,M]);const A=T&&M&&T.id===M.id?{...T,...M,shots:T.shots}:M,P=s.useMemo(()=>A?void 0:a.find(Re=>Re.id===e),[A,a,e]);dc((Xe=A??P)==null?void 0:Xe.name);const[$,H]=s.useState([]);s.useEffect(()=>{if(!P){H([]);return}let Re=!0;return Me.demoProductFrames(P.id).then(Ie=>{Re&&H(Ie.frames)}).catch(()=>{Re&&H([])}),()=>{Re=!1}},[P==null?void 0:P.id]);const[O,Q]=s.useState((A==null?void 0:A.name)??"");s.useEffect(()=>{Q((A==null?void 0:A.name)??"")},[A==null?void 0:A.id]);const I=$4(t.id,[e??""]),[V,ie]=s.useState(null),[B,F]=s.useState(!1),[te,X]=s.useState(!1),[Z,K]=s.useState(null),z=!!(A??P);s.useEffect(()=>{if(ie(null),!z||!e)return;let Re=!0;return Me.productSize(t.id,e).then(Ie=>{Re&&ie(Ie.size)}).catch(()=>{}),()=>{Re=!1}},[t.id,e,z]);const Y=async Re=>{if(!e)return;const Ie=N();X(!0),K(null);try{const st=await Me.setProductSize(t.id,e,Re);Ie()&&(ie(st.size),F(!1))}catch(st){K(String(st.message??st))}finally{X(!1)}},J=((A==null?void 0:A.origin)??"manual")==="manual",de=async(Re,Ie)=>{Ie&&Re&&typeof Re=="object"&&"json"in Re?c(Re):await r()},ae=Re=>{if(!A||C.current)return;E.current={...E.current,...Re},S.current&&clearTimeout(S.current);const Ie=t.id,st=A.id,Ye=J;S.current=setTimeout(()=>{S.current=null;const $e=E.current;E.current={},(Ye?Me.updateProduct(Ie,st,$e):Me.updateCatalogProduct(Ie,st,$e)).then(Fe=>de(Fe,Ye)).catch(Fe=>k(String(Fe.message??Fe)))},500)},W=async Re=>{const Ie=J;v(!0),k(null);try{await de(await Re,Ie)}catch(st){k(String(st.message??st))}finally{v(!1)}},ye=async()=>{if(!A||C.current)return;C.current=!0,S.current&&clearTimeout(S.current),S.current=null,E.current={};const Re=N(),Ie=hu(t),st=A.origin==="catalog"||A.id.startsWith("cat-");b(!0),k(null);try{st?(await Me.deleteCatalogProduct(t.id,A.id),await r()):c(await pU(t.id,A.id))}catch(Ye){if((Ye==null?void 0:Ye.status)!==404){C.current=!1,Re()&&(k(String(Ye.message??Ye)),b(!1));return}await Promise.all([d(),r()])}Re()&&f(Ie,{replace:!0})};if(!A&&!P&&!i)return o.jsx(es,{children:o.jsxs("main",{className:"sc-lookpage sc-productpage",id:"main",children:[o.jsxs("div",{className:"sc-refskeleton","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(!A&&!P)return o.jsx(es,{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(Fn,{className:"sc-btn sc-btn-primary",to:hu(t),children:"Browse products"})})]})});const ee=P?"none":J?"full":"fields",ge=A??P,re=(A==null?void 0:A.id)??P.id,D=A?e4(A):(P==null?void 0:P.category)??null,G=kae(ge),Pe=Re=>{const Ie=Or(Re.file);return Ie?[{file:Re.file,url:Ie,angle:Re.angle}]:[]},Ze=P?$.map(Re=>({file:Re.angle,url:Re.url,angle:Re.angle})):((A==null?void 0:A.shots)??[]).flatMap(Pe),He=Re=>{const Ie=Ze.map(Ye=>Ye.file),st=Ie.indexOf(Re)+1;W(Me.setProductShots(t.id,re,Ie.filter(Ye=>Ye!==Re))).then(()=>p({kind:"success",title:"Reference removed",detail:`Reference ${st} of ${Ie.length}`,action:{label:"Undo",onClick:()=>void W(Me.setProductShots(t.id,re,Ie))}}))},tt=P?"Our reference set. Yours replaces it.":Ze.length===0?J?"No reference yet.":"No reference yet. Images from your store are still arriving.":Ze.length===1?"One angle. A shot has to guess at every side it can't see.":Ze.length===2?"Two angles. A third pins the shape.":"The first three build every shot. Remove any that show a different colour or version.",oe=ee==="none"?null:"Add image",he=A!=null&&A.descriptionHtml?Eae(Sae(A.descriptionHtml),200):"",Ae=(P==null?void 0:P.description)||he||null,ue=V?V.text.charAt(0).toUpperCase()+V.text.slice(1):null,ke=P?[P.subcategory,ue]:[A==null?void 0:A.variant,A==null?void 0:A.material,ue??(A==null?void 0:A.dimensions)],qe=[ee==="none"?Ru(D):null,...ke].filter(Boolean),Ve=P?a.filter(Re=>Re.id!==re).slice(0,8):n.filter(Re=>Re.id!==re).slice(0,8);return o.jsx(es,{children:o.jsxs("main",{className:"sc-lookpage sc-productpage",id:"main",children:[o.jsxs("div",{className:"sc-lookpage-crumb",children:[o.jsx(Fn,{to:hu(t),children:"Products"}),o.jsx("span",{children:"/"}),o.jsx("span",{children:P?"Scenri library":J?"Yours":"From your store"})]}),G&&o.jsx("p",{className:"sc-lookpage-house",children:o.jsx("em",{className:"sc-accent",children:G})}),ee==="full"?o.jsx(wae,{label:"Product name",value:O,onChange:Re=>{Q(Re),ae({name:Re})}}):o.jsx("h1",{dir:"auto",children:ge.name}),Ae&&o.jsx("p",{className:"sc-lookpage-lede",children:Ae}),qe.length>0&&o.jsx("p",{className:"sc-lookpage-facts",children:qe.join(" · ")}),o.jsxs("div",{className:"sc-lookpage-acts",children:[ee!=="none"&&o.jsx(vae,{value:D,onChange:Re=>ae({category:Re})}),o.jsx("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>h(re),children:"Use in a shot"}),ee!=="none"&&o.jsx(xr,{label:"Edit details",children:o.jsx("button",{type:"button",className:"sc-icon-btn","aria-label":"Edit details","aria-haspopup":"dialog",onClick:()=>{K(null),F(!0)},children:o.jsx(q0,{size:17})})})]}),x&&o.jsx("p",{className:"sc-assetform-err",children:x}),o.jsx(yae,{refs:Ze,cap:xae,note:tt,addLabel:oe,busy:g,onAdd:ee==="none"?void 0:Re=>void W(gU(t.id,re,Re)),onPromote:ee==="none"?void 0:Re=>void W(Me.setProductShots(t.id,re,[Re,...Ze.map(Ie=>Ie.file).filter(Ie=>Ie!==Re)])),onRemove:ee==="none"?void 0:He}),I.length>0&&o.jsx(bu,{label:`Shots featuring ${ge.name}`,children:I.map(Re=>o.jsx(O4,{node:Re,to:Ap(t,null,Re.id)},Re.id))}),Ve.length>0&&o.jsx(bu,{label:P?"Other products in the library":"Other products",children:Ve.map(Re=>P?o.jsx(WM,{product:Re,variant:"navigate",size:"slider",onOpen:Ie=>f(sa(t,Ie)),href:sa(t,Re.id)},Re.id):o.jsx(UM,{product:Re,variant:"navigate",size:"slider",onOpen:Ie=>f(sa(t,Ie)),href:sa(t,Re.id)},Re.id))}),B&&o.jsx(bae,{size:V,busy:te,error:Z,onSave:Re=>void Y(Re),onDismiss:()=>F(!1)}),A&&o.jsx("div",{className:"sc-ownedbits",children:o.jsx("div",{className:"sc-lookpage-acts",children:o.jsx(mr,{label:"Delete product",title:`Delete ${A.name}?`,body:"Shots already made with it keep their images and their recipe. Only future shots lose it.",busy:y,onConfirm:()=>void ye()})})})]})})}function jae(e,t){const n=new Map,r=[];for(const a of t){n.set(a.id,a.status);const i=e.get(a.id);if(i!==a.status){if(i===void 0){a.status==="running"&&r.push("Generating shot.");continue}a.status==="done"?r.push("Shot ready."):a.status==="error"?r.push(`Shot failed${a.error?`: ${a.error}`:"."}`):a.status==="cancelled"&&r.push("Shot cancelled.")}}return{messages:r,next:n}}const Aae=[{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 Nae({open:e,onOpenChange:t}){return o.jsx(A6,{open:e,onOpenChange:t,children:o.jsxs(N6,{maxWidth:"360px","aria-describedby":void 0,children:[o.jsx(M6,{children:"Shortcuts"}),o.jsx("div",{className:"sc-keys",children:Aae.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))})]})})}const GM=new Set;function Mae(e){return GM.has(e)}function Rae(e){e&&GM.add(e)}function Pae({src:e,fallback:t,alt:n="",aspect:r,guess:a=!0}){const[i,c]=s.useState(!1),d=i&&t?t:e,[f,h]=s.useState(!1),[p,g]=s.useState(d);d!==p&&(g(d),h(!1));const v=s.useRef(null),y=s.useCallback(()=>{Rae(d),h(!0)},[d]),b=s.useCallback(k=>{v.current=k,k!=null&&k.complete&&k.naturalWidth&&y()},[y]);s.useLayoutEffect(()=>{const k=v.current;k!=null&&k.complete&&k.naturalWidth&&y()},[y]);const x=Mae(d);return o.jsxs("span",{className:"sc-cellimg","data-loaded":f||void 0,"data-cached":x||void 0,"data-guess":a||void 0,style:r?{"--sc-cell-ar":r}:void 0,children:[!f&&!x&&o.jsx("span",{className:"sc-shimmer"}),o.jsx("img",{ref:b,src:d,alt:n,loading:x?"eager":"lazy",decoding:x?"sync":"async",onLoad:()=>y(),onError:()=>{t&&!i?c(!0):y()}})]})}function Lae({node:e,chosen:t,picking:n,batching:r,armed:a,menu:i,onPick:c,onBranch:d}){return o.jsxs(o.Fragment,{children:[!r&&o.jsx("span",{className:"sc-cell-veil","aria-hidden":!0}),n&&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:()=>c==null?void 0:c(e.id),children:o.jsx(nr,{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(nr,{size:13,weight:"bold"}),o.jsx("span",{className:"sc-vh",children:"Being refined"})]}),e.kept&&o.jsxs("span",{className:"sc-cell-mark sc-cell-star",title:"Kept",children:[o.jsx(O6,{size:14,weight:"fill"}),o.jsx("span",{className:"sc-vh",children:"Kept"})]}),o.jsxs("div",{className:"sc-cell-bar",children:[o.jsx("span",{}),o.jsxs("div",{className:"sc-cell-acts",children:[d&&!r&&o.jsxs("button",{type:"button",className:"sc-cell-ctl sc-cell-branch","data-on":a||void 0,"aria-label":`Refine ${lr(e)}`,title:"Continue from this shot",onClick:()=>d(e.id),children:[o.jsx(BB,{size:13,weight:"bold"}),o.jsx("span",{className:"sc-cell-ctl-lb",children:"Refine"})]}),!r&&i.length>0&&o.jsxs(Ds,{children:[o.jsx(Os,{children:o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-more","aria-label":`More for ${lr(e)}`,title:"More",children:o.jsx($6,{size:16,weight:"bold"})})}),o.jsx(Hs,{children:i.map(f=>o.jsxs("span",{style:{display:"contents"},children:[f.separated&&o.jsx(Eu,{}),o.jsx(In,{color:f.danger?"red":void 0,onSelect:f.onSelect,children:f.label})]},f.key))})]})]})]})]})}function Tae(e,{chosen:t,batching:n,versions:r,onOpen:a,onBranch:i,onPick:c,onVersions:d,onToggleKeep:f,onArchive:h,onDeletePermanently:p,shotHref:g}){const v=[{key:"open",label:`Open ${lr(e)}`,onSelect:()=>a(e.id)}];return g&&v.push({key:"open-tab",label:"Open in new tab",onSelect:()=>window.open(g(e.id),"_blank")}),i&&!n&&v.push({key:"branch",label:"Refine from this",onSelect:()=>i(e.id)}),c&&v.push({key:"pick",label:t?"Deselect":"Select for set",onSelect:()=>c(e.id)}),f&&v.push({key:"keep",label:e.kept?"Remove from keepers":"Keep",onSelect:()=>f(e)}),r>0&&d&&v.push({key:"versions",label:`${r} version${r===1?"":"s"}`,onSelect:()=>d(e.id)}),h&&v.push({key:"archive",label:e.archived?"Restore":"Archive",onSelect:()=>h(e),separated:!0}),p&&e.archived&&v.push({key:"delete",label:"Delete permanently",onSelect:()=>p(e),danger:!0,separated:!0}),v}function KM(e,t){var r,a,i,c;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:$u((c=e.brief)==null?void 0:c.format),guess:!0}}const $ae=s.memo(function({node:t,selected:n,armed:r,chosen:a,picking:i,batching:c,versions:d,handlers:f}){const h=Tae(t,{chosen:a,batching:c,versions:d,onOpen:f.onOpen,shotHref:f.shotHref,onBranch:f.onBranch,onPick:f.onPick,onVersions:f.onVersions,onToggleKeep:f.onToggleKeep,onArchive:f.onArchive,onDeletePermanently:f.onDeleteAsk});return o.jsxs(pp,{children:[o.jsx(mp,{children:o.jsxs("div",{className:"sc-cell","data-fb-node":t.id,"data-selected":n,"data-armed":r||void 0,"data-batching":c||void 0,"data-picked":a||void 0,children:[o.jsx(Fn,{className:"sc-cell-open",to:f.shotHref(t.id),"aria-label":c?`${a?"Deselect":"Select"} ${lr(t)}`:`Open ${lr(t)}`,onClick:p=>{var g;c&&(p.preventDefault(),(g=f.onPick)==null||g.call(f,t.id))},children:o.jsx(Pae,{src:nn(t.images[0],"tile"),fallback:Dr(t.images[0]),...KM(t,0)})}),o.jsx(Lae,{node:t,chosen:a,picking:i,batching:c,armed:r,menu:h,onPick:f.onPick,onBranch:f.onBranch})]})}),o.jsx(gp,{children:h.map(p=>o.jsxs("span",{style:{display:"contents"},children:[p.separated&&o.jsx(j6,{}),o.jsx(Si,{color:p.danger?"red":void 0,onSelect:p.onSelect,children:p.label})]},p.key))})]})}),Dae=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":$u((i=t.brief)==null?void 0:i.format)},children:[o.jsxs(Fn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${lr(t)}, still rendering`,children:[o.jsx("span",{className:"sc-shimmer"}),o.jsx(JN,{since:Ai(t)})]}),a&&o.jsx("button",{type:"button",className:"sc-cell-ctl sc-cell-cancel","data-urgent":Ul(Ai(t))>=60||void 0,onClick:()=>a(t),children:"Cancel"})]})}),Oae=s.memo(function({node:t,selected:n,shotHref:r,engineName:a,onRetry:i,onArchive:c}){const d=t.status==="cancelled",f=d?Mj():nf(t.error,a==null?void 0:a(t.engineId));return o.jsxs("div",{className:"sc-cell","data-fb-node":t.id,"data-cancelled":d||void 0,"data-failed":!d||void 0,"data-selected":n,children:[o.jsx(Fn,{className:"sc-cell-open",to:r(t.id),"aria-label":`Open ${lr(t)}`}),o.jsx("span",{className:"sc-cell-failed",children:o.jsx(qC,{failure:f,density:"tile",onRetry:()=>i(t),dismiss:c?{label:t.archived?"Restore":"Dismiss",onClick:()=>c(t)}:void 0})})]})}),Hae=40,Iae=1,r5=64,Fae=e=>e>Hae,_ae=e=>Math.floor(e/r5)*r5;function O1(e,t,n){const r=Math.max(0,n-2),a=e!=="failed"&&t&&t>0?t:4/5;return Math.round(r/a)+2+r0}function s5(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 Vae(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 d=a+i>>1;e[d+1]<=t?a=d+1:i=d}const c=a;for(a=c,i=r;a<i;){const d=a+i>>1;e[d]<n?a=d+1:i=d}return[c,a]}function a5(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 Zae(e,t){const n=t*Iae;return[e-n,e+t+n]}function B4(e){const t=e.getBoundingClientRect().top,n=e.querySelector(".sc-toolbar");return n?Math.max(t,n.getBoundingClientRect().bottom):t}function zae(e,t){const[n,r]=s.useState(()=>({top:0,height:typeof window>"u"?0:window.innerHeight})),a=s.useRef(null),i=s.useRef(()=>{}),c=s.useRef(()=>i.current()).current;return s.useLayoutEffect(()=>{if(!e)return;const d=e.closest(".sc-canvas");if(!d)return;let f=0,h=0;const p=()=>{var b;a.current=d.scrollTop>0?Bae(e,B4(d),(b=a.current)==null?void 0:b.id):null},g=()=>{if(f=0,t){const b=e.getBoundingClientRect().top-d.getBoundingClientRect().top+d.scrollTop,x={top:_ae(d.scrollTop-b),height:d.clientHeight};r(k=>k.top===x.top&&k.height===x.height?k:x)}p(),cancelAnimationFrame(h),h=requestAnimationFrame(p)},v=()=>{f||(f=requestAnimationFrame(g))};i.current=g,g(),d.addEventListener("scroll",v,{passive:!0});const y=new ResizeObserver(v);return y.observe(d),y.observe(e),()=>{cancelAnimationFrame(f),cancelAnimationFrame(h),i.current=()=>{},d.removeEventListener("scroll",v),y.disconnect()}},[e,t]),{...n,anchor:a,resync:c}}function Bae(e,t,n){let r=null,a=null;for(const c of e.querySelectorAll(".sc-cell[data-fb-node]")){const d=c.getBoundingClientRect();if(d.bottom<=t||d.height===0)continue;const f=c.getAttribute("data-fb-node");if(!f)continue;const h={id:f,top:d.top,left:d.left};if(d.top>=t-1){const p=!!r&&Math.abs(d.top-r.top)<=1;(!r||d.top<r.top-1||p&&r.id!==n&&(f===n||d.left<r.left))&&(r=h)}else(!a||d.left<a.left)&&(a=h)}const i=r??a;return i?{id:i.id,offset:i.top-t}:null}function Uae(e,t,n){const r=s.useRef(new Map),[,a]=s.useState(0),i=s.useRef(null),c=s.useRef(new Set);return s.useLayoutEffect(()=>{if(!t)return;let d=0;const f=new ResizeObserver(h=>{let p=!1;for(const g of h){const v=g.target.getAttribute("data-fb-node");if(!v)continue;const y=g.target;if(y.offsetHeight<=2||y.offsetWidth<=2)continue;const b=(y.offsetHeight-2)/(y.offsetWidth-2),x=r.current.get(v);(x===void 0||Math.abs(x-b)>.004)&&(r.current.set(v,b),p=!0)}p&&!d&&(d=requestAnimationFrame(()=>{d=0,a(g=>g+1)}))});return i.current=f,()=>{cancelAnimationFrame(d),f.disconnect(),i.current=null,c.current=new Set}},[t]),s.useLayoutEffect(()=>{const d=i.current;if(!(!t||!d||!e)){for(const f of c.current)f.isConnected||(d.unobserve(f),c.current.delete(f));for(const f of e.querySelectorAll(".sc-cell[data-fb-node]"))c.current.has(f)||(c.current.add(f),d.observe(f))}}),s.useCallback(d=>{const f=r.current.get(d);return f===void 0?void 0:Math.round(f*Math.max(0,n-2))+2+r0},[n])}function Wae({nodes:e,selectedId:t,onOpen:n,shotHref:r,onRetry:a,onCancel:i,onToggleKeep:c,onArchive:d,onDeletePermanently:f,picked:h,onPick:p,empty:g,sending:v,onBranch:y,branchingFrom:b,onVersions:x,engineName:k,tile:S,pending:E,onNearEnd:C}){const N=e.filter(D=>D.kind!=="root"),M=!!p,T=M&&((h==null?void 0:h.size)??0)>0,[L,A]=s.useState(null),[P,$]=s.useState(null),{tile:H,cols:O}=tee(JJ(P),S,eee()<QJ),[Q,I]=s.useState(null);s.useEffect(()=>{if(!Q||!C)return;const D=Q.closest(".sc-canvas"),G=new IntersectionObserver(Pe=>{Pe.some(Ze=>Ze.isIntersecting)&&C()},{root:D,rootMargin:"200% 0px"});return G.observe(Q),()=>G.disconnect()},[Q,C]);const V=s.useRef({onOpen:n,shotHref:r,onRetry:a,onCancel:i,onToggleKeep:c,onArchive:d,onBranch:y,onPick:p,onVersions:x,engineName:k});V.current={onOpen:n,shotHref:r,onRetry:a,onCancel:i,onToggleKeep:c,onArchive:d,onBranch:y,onPick:p,onVersions:x,engineName:k};const ie=!!f,B=s.useMemo(()=>({onOpen:D=>V.current.onOpen(D),shotHref:D=>V.current.shotHref(D),onRetry:D=>V.current.onRetry(D),onCancel:i?D=>{var G,Pe;return(Pe=(G=V.current).onCancel)==null?void 0:Pe.call(G,D)}:void 0,onToggleKeep:c?D=>{var G,Pe;return(Pe=(G=V.current).onToggleKeep)==null?void 0:Pe.call(G,D)}:void 0,onArchive:d?D=>{var G,Pe;return(Pe=(G=V.current).onArchive)==null?void 0:Pe.call(G,D)}:void 0,onBranch:y?D=>{var G,Pe;return(Pe=(G=V.current).onBranch)==null?void 0:Pe.call(G,D)}:void 0,onPick:p?D=>{var G,Pe;return(Pe=(G=V.current).onPick)==null?void 0:Pe.call(G,D)}:void 0,onVersions:x?D=>{var G,Pe;return(Pe=(G=V.current).onVersions)==null?void 0:Pe.call(G,D)}:void 0,onDeleteAsk:ie?D=>A(D):void 0,engineName:k?D=>{var G,Pe;return(Pe=(G=V.current).engineName)==null?void 0:Pe.call(G,D)}:void 0}),[!!i,!!c,!!d,!!y,!!p,!!x,ie,!!k]),F=[...v?Array.from({length:Math.max(1,v.count)},(D,G)=>({key:`sending-${G}`,node:null,said:v.said})):[],...N.map(D=>({key:D.id,node:D}))],te=D=>D.status==="cancelled"||D.status==="error"||D.images.length===0,X=D=>{const G=D.node;return G?G.status==="running"?o.jsx(Dae,{node:G,selected:G.id===t,shotHref:B.shotHref,onCancel:B.onCancel},G.id):te(G)?o.jsx(Oae,{node:G,selected:G.id===t,shotHref:B.shotHref,engineName:B.engineName,onRetry:B.onRetry,onArchive:B.onArchive},G.id):o.jsx($ae,{node:G,selected:G.id===t,armed:G.id===b,chosen:(h==null?void 0:h.has(G.id))??!1,picking:M,batching:T,versions:G.childCount,handlers:B},G.id):o.jsxs("div",{className:"sc-cell","data-running":"true","data-sending":"true",children:[o.jsx("span",{className:"sc-shimmer"}),o.jsx("span",{className:"sc-cell-tag",children:"sending"}),o.jsx("span",{className:"sc-cell-said",dir:"auto",children:D.said})]},D.key)},Z=D=>{var Pe;const G=D.node;return G?G.status==="running"?O1("running",$u((Pe=G.brief)==null?void 0:Pe.format),H):te(G)?O1("failed",void 0,H):O1("done",KM(G,0).aspect,H):O1("sending",void 0,H)},K=Fae(F.length),z=zae(P,K),Y=Uae(P,K,H),J=Math.max(1,Math.min(O,F.length)),de=`${J}:${H}`,ae=s.useRef(de),W=s.useRef({items:F,heightOf:Y,estimate:Z});W.current={items:F,heightOf:Y,estimate:Z};const ye=s.useRef(null);if(s.useLayoutEffect(()=>{const D=ae.current;ae.current=de;const G=z.anchor.current,Pe=P==null?void 0:P.closest(".sc-canvas");if(!(D===de||!G||!P||!Pe)){if(ye.current={anchor:G,until:performance.now()+Gae},!o5(P,Pe,G)){const{items:Ze,heightOf:He,estimate:tt}=W.current,oe=Ze.findIndex(ke=>{var qe;return((qe=ke.node)==null?void 0:qe.id)===G.id});if(oe<0)return;const he=a5(Ze.length,J)[oe%J],Ae=s5(he.map(ke=>(Ze[ke].node&&He(Ze[ke].node.id))??tt(Ze[ke]))),ue=P.getBoundingClientRect().top+Ae[Math.floor(oe/J)];Pe.scrollTop+=ue-B4(Pe)-G.offset}z.resync()}},[de,J,P,z.anchor,z.resync]),s.useLayoutEffect(()=>{const D=ye.current,G=P==null?void 0:P.closest(".sc-canvas");if(!(!D||!P||!G)){if(performance.now()>D.until){ye.current=null;return}o5(P,G,D.anchor)}}),s.useEffect(()=>{const D=P==null?void 0:P.closest(".sc-canvas");if(!D)return;const G=()=>{ye.current=null},Pe=["wheel","touchstart","keydown","pointerdown"];for(const Ze of Pe)D.addEventListener(Ze,G,{passive:!0});return()=>{for(const Ze of Pe)D.removeEventListener(Ze,G)}},[P]),E&&xx(N)&&!v){const D=Math.max(1,Math.min(O,8));return o.jsx("div",{className:"sc-feed",ref:$,style:{"--sc-tile":`${H}px`},children:Array.from({length:D},(G,Pe)=>o.jsx("div",{className:"sc-feed-col",children:Array.from({length:2},(Ze,He)=>o.jsx("div",{className:"sc-cell","data-running":"true","data-sending":"true",children:o.jsx("span",{className:"sc-shimmer"})},`pending-${Pe}-${He}`))},`col-${D}-${Pe}`))})}if(xx(N)&&!v)return o.jsx(o.Fragment,{children:g??o.jsx("p",{className:"sc-feed-empty",children:"Nothing here yet."})});const ee=Math.max(1,Math.min(O,F.length)),ge=a5(F.length,ee),re=K?Zae(z.top,z.height):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sc-feed",ref:$,style:{"--sc-tile":`${H}px`},children:ge.map((D,G)=>{const Pe=`col-${ee}-${G}`;if(!re)return o.jsx("div",{className:"sc-feed-col",children:D.map(he=>X(F[he]))},Pe);const Ze=D.map(he=>(F[he].node&&Y(F[he].node.id))??Z(F[he])),He=s5(Ze),[tt,oe]=Vae(He,re[0],re[1]);return o.jsxs("div",{className:"sc-feed-col",children:[tt>0&&o.jsx("div",{className:"sc-feed-pad",style:{height:He[tt]},"aria-hidden":!0}),D.slice(tt,oe).map(he=>X(F[he])),oe<D.length&&o.jsx("div",{className:"sc-feed-pad",style:{height:He[D.length]-He[oe]},"aria-hidden":!0})]},Pe)})}),C&&o.jsx("div",{className:"sc-feed-end",ref:I,"aria-hidden":!0}),o.jsx(z0,{open:!!L,onOpenChange:D=>!D&&A(null),children:o.jsxs(B0,{maxWidth:"420px",children:[o.jsx(U0,{children:"Delete this shot permanently?"}),o.jsx(W0,{size:"2",children:"This cannot be undone."}),o.jsxs(vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(K0,{children:o.jsx(ra,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(G0,{children:o.jsx(ra,{color:"red",onClick:()=>{L&&(f==null||f(L)),A(null)},children:"Delete permanently"})})]})]})})]})}const Gae=800;function o5(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-B4(t)-n.offset;return Math.abs(a)>=1&&(t.scrollTop+=a),!0}function Kae(e){return e==="open"||e==="result"?"open":"compact"}function wv({name:e,kind:t,count:n,mode:r,onToggle:a,action:i,children:c}){const d=Kae(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(_i,{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:c(d)},d)})})]})}function YM({candidate:e,on:t,named:n,disabled:r,title:a,onClick:i}){const c=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(Vs,{size:14})}),o.jsx("span",{className:"sc-acard-tick","aria-hidden":!0,children:o.jsx(nr,{size:10,weight:"bold"})})]}),n&&o.jsxs("span",{className:"sc-acard-label",children:[e.bookmarked&&o.jsxs(o.Fragment,{children:[o.jsx(yp,{className:"sc-bm-mark",size:10,weight:"fill","aria-hidden":!0}),o.jsx("span",{className:"sc-vh",children:"Bookmarked. "})]}),e.label]})]});return o.jsx(FN,{why:r?a:null,children:c})}function zg({kind:e,title:t,items:n,attached:r,mode:a,onToggle:i,onPick:c,onUnpick:d,full:f,moreLabel:h,createLabel:p,onCreate:g}){const v=s.useMemo(()=>new Set(r),[r]),[y,b]=s.useState(Th);return s.useEffect(()=>{a!=="open"&&b(Th)},[a]),a==="result"&&n.length===0?null:o.jsx(wv,{name:t,kind:e,count:n.length,mode:a,onToggle:()=>i(e),action:o.jsx("button",{type:"button",className:"sc-aadd",title:p,"aria-label":p,onClick:g,children:o.jsx(kr,{size:10})}),children:x=>{const{visible:k,more:S}=ane(n,v,x==="open"?y:hv);return o.jsxs("div",{className:x==="open"?"sc-acard-grid":"sc-arow",children:[k.map(E=>o.jsx(YM,{candidate:E,on:v.has(E.id),named:x==="open",disabled:!!f&&!v.has(E.id),title:f??void 0,onClick:()=>v.has(E.id)?d(E.id):c(E.id)},E.id)),x==="open"&&S>0&&o.jsxs("button",{type:"button",className:"sc-amore-tile",onClick:()=>b(E=>E+a0),"aria-label":`Show ${Math.min(S,a0)} more ${h}`,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",S]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})}})}const i5=220,l5="cubic-bezier(0.32, 0.72, 0, 1)";function Bg(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 Yae(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 Bg(a))for(const c of[...i.body.getAnimations(),...i.group.getAnimations()])c.finish();n.current=Bg(a)}};return s.useLayoutEffect(()=>{const a=n.current;n.current=null;const i=e.current;if(!(!a||!i))for(const c of Bg(i)){const d=a.find(f=>f.group===c.group);if(d){if(Math.abs(d.height-c.height)>.5){const{body:f}=c;f.style.overflow="hidden";const h=f.animate([{height:`${d.height}px`},{height:`${c.height}px`}],{duration:i5,easing:l5}),p=()=>{f.style.overflow=""};h.onfinish=p,h.oncancel=p}Math.abs(d.marginBottom-c.marginBottom)>.5&&c.group.animate([{marginBottom:`${d.marginBottom}px`},{marginBottom:`${c.marginBottom}px`}],{duration:i5,easing:l5})}}},[t]),r}function qae({brand:e,shots:t,shotsTotal:n,attached:r=WN,full:a,onToken:i,offToken:c,onTemplate:d,offTemplate:f,onClose:h}){const p=df(),g=Xi(),{applyBrand:v}=jn(),{push:y}=Sr(),[b,x]=iz(Wr.assetsExpanded,null),k=s.useRef(null),S=Yae(k,b),E=z=>{S(),x(Y=>Y===z?null:z)},[C,N]=s.useState(""),M=C.trim().length>0,T=z=>{S(),N(""),x(z)},L=z=>M?"result":b===null?"idle":b===z?"open":"collapsed",A=s.useMemo(()=>new Set(io(e.id)),[e.id]),P=s.useMemo(()=>{const z=Y=>{const J=Ri(Y,p);return Wp(Y,J,{currentId:null,query:"",bookmarked:A,shown:J.length}).items};return{product:z("product"),presenter:z("presenter"),scene:z("scene")}},[p,A]),$=s.useMemo(()=>({product:wu(P.product,C),presenter:wu(P.presenter,C),scene:wu(P.scene,C)}),[P,C]),H=s.useMemo(()=>{var z;return Ls((z=e.json)==null?void 0:z.palette)},[e]),O=s.useMemo(()=>M?H.filter(z=>lo(`${z.name} ${z.hex}`,C)):H,[H,C,M]),Q=z=>{(async()=>{var J;const Y=oA((J=e.json)==null?void 0:J.palette,z);if(Y.swatch){if(Y.added)try{const de=await Me.updateBrand(e.id,{...e.json??{},palette:Y.palette});v(de)}catch(de){y(wn(de,"Could not save the brand"));return}T("colors")}})()},I=z=>{(async()=>{var J;const Y=qK((J=e.json)==null?void 0:J.palette,z);if(Y.removed)try{const de=await Me.updateBrand(e.id,{...e.json??{},palette:Y.palette});v(de)}catch(de){y(wn(de,"Could not save the brand"))}})()},V=L("shots")==="open",ie=j4(e.id,"",V),B=s.useMemo(()=>{const z=new Set,Y=[];for(const J of[...t,...ie.items])J.status!=="done"||J.images.length===0||z.has(J.id)||(z.add(J.id),Y.push(J));return Y},[t,ie.items]),F=Math.max(n??0,ie.total,B.length),[te,X]=s.useState(Th);s.useEffect(()=>{V||X(Th)},[V]);const Z=()=>{X(z=>z+a0),ie.hasMore&&B.length<te+2*a0&&ie.loadMore()},K=M&&!$.product.length&&!$.presenter.length&&!$.scene.length&&!O.length;return o.jsxs("aside",{ref:k,className:"sc-assets","aria-label":"Assets",children:[o.jsxs("div",{className:"sc-assets-head",children:[o.jsx("b",{children:"Assets"}),o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:h,"aria-label":"Close assets",style:{width:28,height:28},children:o.jsx(Cn,{size:12})})]}),o.jsx("div",{className:"sc-assets-searchbar",children:o.jsxs("div",{className:"sc-assets-search",children:[o.jsx(Nu,{size:12}),o.jsx("input",{value:C,onChange:z=>N(z.target.value),onKeyDown:z=>{z.key==="Escape"&&C&&(z.stopPropagation(),N(""))},placeholder:"Search assets","aria-label":"Search assets in this panel"}),M&&o.jsx("button",{type:"button",className:"sc-assets-clear",onClick:()=>N(""),"aria-label":"Clear search",children:o.jsx(Cn,{size:11})})]})}),K&&o.jsxs("p",{className:"sc-assets-zero",children:["Nothing here matches “",C.trim(),"”."]}),o.jsx(zg,{kind:"product",title:"Products",items:$.product,attached:r.product,mode:L("product"),onToggle:E,onPick:z=>i({t:"product",id:z}),onUnpick:z=>c({t:"product",id:z}),full:a,moreLabel:"products",createLabel:"Add product",onCreate:()=>g("product",{onCreated:z=>{z.kind==="product"&&(T("product"),i({t:"product",id:z.id}))}})}),o.jsx(zg,{kind:"presenter",title:"Presenters",items:$.presenter,attached:r.presenter,mode:L("presenter"),onToggle:E,onPick:z=>i({t:"character",id:z}),onUnpick:z=>c({t:"character",id:z}),full:a,moreLabel:"presenters",createLabel:"Create presenter",onCreate:()=>g("presenter",{onCreated:()=>T("presenter")})}),o.jsx(zg,{kind:"scene",title:"Scenes",items:$.scene,attached:r.scene?[r.scene]:[],mode:L("scene"),onToggle:E,onPick:d,onUnpick:()=>f(),full:a,moreLabel:"scenes",createLabel:"Create scene",onCreate:()=>g("scene",{onCreated:z=>{z.kind==="scene"&&T("scene")}})}),!(M&&O.length===0)&&o.jsx(wv,{name:"Brand colors",count:O.length,mode:L("colors"),onToggle:()=>E("colors"),action:o.jsx(Pu,{className:"sc-aadd",triggerStyle:{background:"none"},value:$p(H),presets:H.map(z=>z.hex),commitMode:"close",align:"end",label:"Add colour",onChange:Q,children:o.jsx(kr,{size:10})}),children:z=>o.jsx("div",{className:"sc-arow",children:(z==="open"?O:O.slice(0,hv)).map(Y=>{const J=r.color.includes(Y.hex.toLowerCase());return o.jsxs("div",{className:"sc-aswatch-tile","data-on":J||void 0,children:[o.jsxs("button",{type:"button",title:`${Y.name} ${Y.hex}`,"aria-pressed":J,onClick:()=>J?c({t:"color",hex:Y.hex,name:Y.name}):i({t:"color",hex:Y.hex,name:Y.name}),children:[o.jsx("span",{className:"sc-aswatch",style:{background:Y.hex}}),o.jsx("span",{className:"sc-acard-tick","aria-hidden":!0,children:o.jsx(nr,{size:10,weight:"bold"})})]}),z==="open"&&o.jsx("button",{type:"button",className:"sc-aswatch-x","aria-label":`Remove ${Y.name}`,title:"Remove",onClick:()=>I(Y.hex),children:o.jsx(Cn,{size:10,weight:"bold"})})]},Y.hex)})})}),B.length>0&&!M&&o.jsx(wv,{name:"Recent shots",count:F,mode:L("shots"),onToggle:()=>E("shots"),children:z=>o.jsxs("div",{className:z==="open"?"sc-acard-grid":"sc-arow",children:[B.slice(0,z==="open"?te:hv).map((Y,J)=>{const de=Y.images[0],ae=r.ref.includes(de);return o.jsx(YM,{candidate:{label:`Shot ${F-J}`,full:`Shot ${F-J} · as reference`,thumb:nn(de,"micro")},on:ae,named:z==="open",disabled:!!a&&!ae,title:a??void 0,onClick:()=>ae?c({t:"ref",imageHash:de}):i({t:"ref",imageHash:de,label:"Shot"})},Y.id)}),z==="open"&&(B.length>te||ie.hasMore)&&o.jsxs("button",{type:"button",className:"sc-amore-tile",onClick:Z,"aria-label":`Show ${a0} more shots`,"aria-busy":ie.loading||void 0,children:[o.jsxs("span",{className:"sc-amore-n",children:["+",Math.max(1,F-Math.min(B.length,te))]}),o.jsx("span",{className:"sc-amore-t",children:"more"})]})]})})]})}function Xae({sets:e,active:t,ungrouped:n,ungroupedCount:r,onPlaceAll:a,onPlaceUngrouped:i,onOpenSet:c,onNewSet:d,onResetNewSet:f,onRenameSet:h,onDeleteSet:p,askCreate:g,lens:v,lensCounts:y,onLens:b,q:x,onQ:k,searchTotal:S,sort:E,onSort:C,tile:N,onTile:M,assets:T,onAssets:L,showAssets:A}){const P=t?t.id:n?"__ungrouped__":"__all__",$=t?t.name:n?"Not in a set":"All shots",H=!!t||n,[O,Q]=s.useState(!1),[I,V]=s.useState(!1),[ie,B]=s.useState(!1),[F,te]=s.useState(""),X=s.useRef(null),Z=s.useRef(!1),K=()=>{Z.current=!0,V(!0),te(""),Q(!0)},z=()=>{t&&(Z.current=!1,V(!1),te(t.name),Q(!0))};s.useEffect(()=>{g&&K()},[g]);const Y=()=>{const ae=F.trim();if(!ae)return;const W=Z.current;Z.current=!1,V(!1),Q(!1),W?d(ae):h==null||h(ae)},J=ae=>{if(ae){Q(!0);return}const W=Z.current;Z.current=!1,V(!1),Q(!1),W&&(f==null||f())},de=zC.map(ae=>({value:ae.id==="all"?null:ae.id,label:ae.label,count:y[ae.id]}));return o.jsxs("div",{className:"sc-toolbar",children:[o.jsxs("div",{className:"sc-toolbar-scope",children:[o.jsxs(Ds,{children:[o.jsx(Os,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-place","data-on":H||void 0,"aria-label":$,children:[o.jsx(W7,{className:"sc-toolbar-place-ic",size:16}),o.jsx("span",{className:"sc-toolbar-place-t",children:$}),o.jsx(_i,{size:10,className:"sc-caret"})]})}),o.jsxs(Hs,{align:"start",children:[o.jsxs(uh,{value:P,children:[o.jsx(au,{value:"__all__",onSelect:a,children:"All shots"}),o.jsxs(au,{value:"__ungrouped__",onSelect:i,children:["Not in a set",r>0?` · ${r}`:""]}),e.length>0&&o.jsx(Eu,{}),e.map(ae=>o.jsx(au,{value:ae.id,onSelect:()=>c(ae),children:ae.name},ae.id))]}),o.jsx(Eu,{}),o.jsx(In,{onSelect:()=>{f==null||f(),K()},children:"New set"}),t&&h&&o.jsx(In,{onSelect:z,children:"Rename"}),t&&p&&o.jsx(In,{color:"red",onSelect:()=>B(!0),children:"Delete set"})]})]}),o.jsx(A6,{open:O,onOpenChange:J,children:o.jsxs(N6,{maxWidth:"360px","aria-describedby":void 0,onOpenAutoFocus:ae=>{ae.preventDefault();const W=X.current;W&&(W.focus(),W.select())},children:[o.jsx(M6,{children:I?"Name this set":"Rename set"}),o.jsx("input",{ref:X,className:"sc-in",style:{width:"100%",marginTop:8},value:F,"aria-label":"Set name",onChange:ae=>te(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&Y()}}),o.jsxs(vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(ra,{variant:"soft",color:"gray",onClick:()=>J(!1),children:"Cancel"}),o.jsx(ra,{onClick:Y,disabled:!F.trim(),children:"Save"})]})]})}),o.jsx(z0,{open:ie,onOpenChange:B,children:o.jsxs(B0,{maxWidth:"420px",children:[o.jsx(U0,{children:"Delete this set?"}),o.jsx(W0,{size:"2",children:"Shots stay in the library. Only the set goes."}),o.jsxs(vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(K0,{children:o.jsx(ra,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(G0,{children:o.jsx(ra,{color:"red",onClick:()=>{p==null||p(),B(!1)},children:"Delete set"})})]})]})}),o.jsx(C4,{"aria-label":"Shot lenses",activeKey:v==="all"?null:v,items:de,onSelect:ae=>b(ae??"all")})]}),o.jsxs("div",{className:"sc-toolbar-actions",children:[o.jsx(Yu,{value:x,onChange:k,noun:"shots",total:S}),o.jsxs(Ds,{children:[o.jsx(Os,{children:o.jsxs("button",{type:"button",className:"sc-toolbar-btn","aria-label":"Sort shots",children:[o.jsx(LB,{size:14}),o.jsx("span",{className:"sc-toolbar-btn-t",children:"Sort"}),o.jsx(_i,{size:10})]})}),o.jsx(Hs,{align:"end",children:o.jsx(uh,{value:E,onValueChange:ae=>C(ae),children:ZC.map(ae=>o.jsx(au,{value:ae.id,children:ae.label},ae.id))})})]}),o.jsx(aee,{value:N,onChange:M}),A&&o.jsx("button",{type:"button",className:"sc-icon-btn sc-toolbar-assets","data-on":T||void 0,onClick:L,"aria-label":"Assets panel","aria-pressed":T,title:"Assets panel (.)",children:o.jsx(eU,{size:15,mirrored:!0})})]})]})}function Qae(e){const{push:t}=Sr(),n=s.useCallback(c=>Me.archiveNode(c.id,!0).then(d=>(e(d),t({kind:"success",title:"Archived",detail:lr(c),action:{label:"Undo",onClick:()=>void Me.archiveNode(c.id,!1).then(e)}}),!0)).catch(d=>(t(wn(d,"Could not archive this shot")),!1)),[e,t]),r=s.useCallback(c=>Me.archiveNode(c.id,!1).then(d=>(e(d),!0)).catch(d=>(t(wn(d,"Could not restore this shot")),!1)),[e,t]),a=s.useCallback(c=>Promise.all(c.map(d=>Me.archiveNode(d,!0))).then(d=>{for(const f of d)e(f);return t({kind:"success",title:`Archived ${d.length} shot${d.length===1?"":"s"}`,action:{label:"Undo",onClick:()=>{Promise.all(d.map(f=>Me.archiveNode(f.id,!1))).then(f=>{for(const h of f)e(h)})}}}),!0}).catch(d=>(t(wn(d,"Could not archive these shots")),!1)),[e,t]),i=s.useCallback(c=>Promise.all(c.map(d=>Me.archiveNode(d,!1))).then(d=>{for(const f of d)e(f)}).catch(d=>t(wn(d,"Could not restore these shots"))),[e,t]);return{archive:n,archiveBatch:a,unarchive:r,unarchiveBatch:i}}function Jae(e){const{push:t}=Sr(),n=s.useCallback(a=>Me.deleteNode(a.id).then(()=>e([a.id])).catch(i=>t(wn(i,"Could not delete this shot"))),[e,t]),r=s.useCallback(a=>Me.deleteNodesBatch(a).then(()=>e(a)).catch(i=>t(wn(i,"Could not delete these shots"))),[e,t]);return{remove:n,removeBatch:r}}function eoe(e,{demoProducts:t,presenters:n,scenes:r}){var f,h,p,g;const a=((f=e.brief)==null?void 0:f.tokens)??[],i=(h=a.find(v=>(v==null?void 0:v.t)==="product"))==null?void 0:h.id,c=(p=a.find(v=>(v==null?void 0:v.t)==="character"))==null?void 0:p.id,d=(g=a.find(v=>(v==null?void 0:v.t)==="template"))==null?void 0:g.id;return{product:i?t.find(v=>v.id===i):void 0,presenter:c?n.find(v=>v.id===c):void 0,scene:d?r.find(v=>v.id===d):void 0}}function toe(e,t){const{product:n,presenter:r,scene:a}=eoe(e,t);return{productName:n?oo(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?Bo(r).src:null,presenterId:(r==null?void 0:r.id)??null,sceneName:a?zi(a,"chip"):null,scenePreviewUrl:(a==null?void 0:a.previewUrl)??null,sceneId:(a==null?void 0:a.id)??null}}function noe(e){const t=s.useRef(null),n=s.useRef(0),r=s.useRef(null),a=s.useRef(0),i=s.useCallback(()=>{const h=t.current;h&&(n.current=h.scrollWidth/3)},[]);s.useEffect(()=>{const h=t.current;if(!h||!e)return;i(),h.scrollLeft=n.current;const p=new ResizeObserver(()=>{const g=n.current;i(),g<=0&&n.current>0&&(h.scrollLeft=n.current)});p.observe(h);for(const g of h.children)p.observe(g);return()=>p.disconnect()},[e,i]);const c=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)))},[]),d=s.useCallback(()=>{r.current=null,cancelAnimationFrame(a.current)},[]);s.useEffect(()=>{const h=t.current;if(!h)return;let p=0;const g=()=>{p||(p=requestAnimationFrame(()=>{p=0,c()}))},v=b=>{Math.abs(b.deltaY)<=Math.abs(b.deltaX)||(b.preventDefault(),d(),h.scrollLeft+=b.deltaY)},y=b=>{b.target.closest(".sc-shelf-arrow")||d()};return h.addEventListener("scroll",g,{passive:!0}),h.addEventListener("wheel",v,{passive:!1}),h.addEventListener("pointerdown",y),()=>{p&&cancelAnimationFrame(p),d(),h.removeEventListener("scroll",g),h.removeEventListener("wheel",v),h.removeEventListener("pointerdown",y)}},[d,c]);const f=s.useCallback(h=>{const p=t.current,g=p==null?void 0:p.firstElementChild;if(!p||!g)return;const v=g.offsetWidth||232,y=Number.parseFloat(getComputedStyle(p).columnGap)||0,b=v+y,x=r.current??p.scrollLeft;r.current=x+b*h;const k=()=>{d()};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){p.scrollLeft=r.current,k(),c();return}cancelAnimationFrame(a.current);let S=0;const E=()=>{const C=r.current;if(C===null)return;const N=C-p.scrollLeft;if(S+=1,Math.abs(N)<.5||S>45){p.scrollLeft=C,k(),c();return}p.scrollLeft+=N*.16,a.current=requestAnimationFrame(E)};a.current=requestAnimationFrame(E)},[d,c]);return{ref:t,page:f}}function roe(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 soe({entries:e,catalogs:t,stagedId:n,onUse:r,productHref:a,presenterHref:i,sceneHref:c}){const d=s.useMemo(()=>roe(e).slice(0,10),[e]),{ref:f,page:h}=noe(d.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."}),d.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(Da,{size:13,weight:"bold"})}),o.jsx("button",{type:"button",className:"sc-shelf-arrow next","aria-label":"More examples",onClick:()=>h(1),children:o.jsx(qi,{size:13,weight:"bold"})}),o.jsx("div",{className:"sc-shelf-row",ref:f,children:[0,1,2].map(p=>d.map(g=>o.jsx(KN,{entry:g,size:"grid",hideRecipe:!0,decorative:p!==1,active:n===g.id,onOpen:()=>r(g),productHref:a,presenterHref:i,sceneHref:c,...toe(g,t)},`${p}-${g.id}`)))})]})]})}function Id({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 aoe({count:e,sets:t,onAdd:n,onNew:r,onClear:a,onKeep:i,onArchiveBatch:c,allKept:d,archivedLens:f,pickedIds:h,onRestoreBatch:p,onDeleteBatch:g,loaded:v,onSelectAll:y}){const[b,x]=s.useState(!1);return o.jsxs("div",{className:"sc-picked","data-lens":f?"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"})]}),v>1&&o.jsx("button",{type:"button",className:"sc-picked-all",onClick:e<v?y:a,children:e<v?"Select all":"Deselect all"})]}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-tools",children:f?o.jsxs(o.Fragment,{children:[o.jsx(Fd,{label:"Restore",onClick:()=>p(h),children:o.jsx(dh,{size:17})}),o.jsx(Fd,{label:`Delete ${e} permanently`,tone:"danger",onClick:()=>x(!0),children:o.jsx(Sp,{size:17})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Fd,{label:d?"Remove from keepers":"Keep",onClick:i,children:o.jsx(O6,{size:17,weight:d?"fill":"regular"})}),o.jsxs(Ds,{children:[o.jsx(xr,{label:"Add to set",children:o.jsx(Os,{children:o.jsx("button",{type:"button",className:"sc-picked-tool","aria-label":"Add to set",children:o.jsx(W7,{size:17})})})}),o.jsxs(Hs,{children:[t.map(k=>o.jsx(In,{onSelect:()=>n(k),children:k.name},k.id)),t.length>0&&o.jsx(Eu,{}),o.jsx(In,{onSelect:r,children:"New set…"})]})]}),o.jsx(Fd,{label:"Archive",tone:"danger",onClick:()=>c(h),children:o.jsx(v7,{size:17})})]})}),o.jsx("span",{className:"sc-picked-rule","aria-hidden":!0}),o.jsx("span",{className:"sc-picked-exit",children:o.jsx(Fd,{label:"Done",onClick:a,children:o.jsx(Cn,{size:16,weight:"bold"})})}),f&&o.jsx(mr,{label:`Delete ${e} permanently`,title:`Delete ${e} shot${e===1?"":"s"} permanently?`,body:"This cannot be undone.",busy:!1,open:b,onOpenChange:x,onConfirm:()=>g(h)})]})}function Fd({label:e,tone:t,onClick:n,children:r}){return o.jsx(xr,{label:e,children:o.jsx("button",{type:"button",className:"sc-picked-tool","data-tone":t,"aria-label":e,onClick:n,children:r})})}function ooe(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 ioe(e){switch(e){case"oldest":return(t,n)=>ou(n,t);case"cost":return(t,n)=>n.costUsd-t.costUsd||ou(t,n);case"keepers":return(t,n)=>Number(n.kept)-Number(t.kept)||ou(t,n);default:return ou}}function qM(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 loe(e,t){return t==="archived"?e.archived:t==="keepers"?!e.archived&&e.kept:!e.archived}function c5(e,t,n){var r;return(r=t.q)!=null&&r.trim()?null:qM(e,t,n)&&loe(e,t.lens)}function u5(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 Ug(e,t,n,r){if(!r)return e;const a=u5(t),i=u5(n),c={...e,all:e.all+i.all-a.all,keepers:e.keepers+i.keepers-a.keepers,archived:e.archived+i.archived-a.archived};return c.all===e.all&&c.keepers===e.keepers&&c.archived===e.archived?e:c}function bv(e,t){const n=e.findIndex(a=>a.id===t.id);if(n===-1||e[n]===t)return e;const r=[...e];return r[n]=t,r}function d5(e,t){const n=new Set(t);return e.some(r=>n.has(r.id))?e.filter(r=>!n.has(r.id)):e}function coe(e,t,n,r){if(e.some(d=>d.id===t.id))return bv(e,t);const a=ioe(n);let i=0;for(;i<e.length&&a(e[i],t)<=0;)i++;if(i===e.length&&!r)return e;const c=[...e];return c.splice(i,0,t),c}function uoe(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 doe(e,t){const n=new Set(t.map(r=>r.id));return[...t,...e.filter(r=>!n.has(r.id))]}const Wg=60;function foe(e,t,n){const{shotsEpoch:r}=Qt(),a=`${ooe(e,t)}#${r}`,[i,c]=s.useState({brandId:e,key:"",items:[],next:null,counts:null,error:null}),[d,f]=s.useState(!1),h=s.useRef(i);h.current=i;const p=s.useRef(t);p.current=t;const g=s.useRef(n);g.current=n;const v=s.useRef(!1);s.useEffect(()=>{const N=new AbortController;return f(!0),Me.feed(e,{...p.current,limit:Wg},N.signal).then(M=>{N.signal.aborted||c({brandId:e,key:a,items:M.items,next:M.next,counts:M.counts??null,error:null})}).catch(M=>{if(N.signal.aborted)return;const T=String((M==null?void 0:M.message)??M);c(L=>({...L,brandId:e,key:a,error:T}))}).finally(()=>{N.signal.aborted||f(!1)}),()=>N.abort()},[e,a]);const y=s.useCallback(()=>{const N=h.current;if(N.key!==a||!N.next||v.current)return;v.current=!0,f(!0);const M=N.next;Me.feed(e,{...p.current,limit:Wg,cursor:M}).then(T=>{c(L=>L.key!==a?L:{...L,items:uoe(L.items,T.items),next:T.next,counts:T.counts??L.counts})}).catch(()=>{}).finally(()=>{v.current=!1,f(!1)})},[e,a]),b=s.useCallback(async()=>{const N=await Me.feed(e,{...p.current,limit:Wg});c(M=>M.key!==a?M:{...M,items:doe(M.items,N.items),next:M.items.length?M.next:N.next,counts:N.counts??M.counts,error:null})},[e,a]),x=s.useCallback(N=>{c(M=>{const T=M.items.find(H=>H.id===N.id);if(!T)return M;const L=p.current,P=c5(N,L,g.current)===!1?d5(M.items,[N.id]):bv(M.items,N),$=M.counts?Ug(M.counts,T,N,!0):M.counts;return P===M.items&&$===M.counts?M:{...M,items:P,counts:$}})},[]),k=s.useCallback((N,M)=>{let T=!1;c(L=>{let A=L.items,P=L.counts;const $=p.current;for(const H of N){if(A.some(V=>V.id===H.id)){A=bv(A,H);continue}const O=c5(H,$,g.current);if(O===null){T=!0;continue}const Q=qM(H,$,g.current);O&&(A=coe(A,H,$.sort,L.next===null));const I=(M==null?void 0:M.get(H.id))??null;P&&(P=Ug(P,I,H,Q))}return A===L.items&&P===L.counts?L:{...L,items:A,counts:P}}),T&&b().catch(()=>{})},[b]),S=s.useCallback(N=>{c(M=>{const T=M.items.filter(A=>N.includes(A.id));if(!T.length)return M;let L=M.counts;if(L)for(const A of T)L=Ug(L,A,null,!0);return{...M,items:d5(M.items,N),counts:L}})},[]),E=i.brandId===e?i.items:[],C=s.useMemo(()=>new Map(E.map(N=>[N.id,N])),[E]);return{items:E,byId:C,counts:i.brandId===e?i.counts:null,ready:i.key===a&&!i.error,loading:d,complete:i.key===a&&i.next===null,error:i.key===a?i.error:null,loadMore:y,patch:x,insert:k,drop:S,refresh:b}}function hoe(){const e=tn(it.hubShot),t=tn(it.setShot);return(e==null?void 0:e.params.shotId)??(t==null?void 0:t.params.shotId)??null}function f5(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 Me.node(e).then(c=>i&&a({id:e,node:c})).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 XM({set:e}){const{engines:t,scenes:n,presenters:r,demoProducts:a,showcase:i,showcaseLoaded:c}=jn(),{brand:d,workspace:f,root:h,recent:p,sets:g,membership:v,loaded:y,refresh:b,applySet:x,dropSet:k,insertSet:S,applyMembership:E,applyNodes:C,subscribeActivity:N,products:M}=Qt(),T=df(),L=Dn(),[A,P]=Bi(),$=hoe(),[H,O]=s.useState(null),[Q,I]=s.useState(!1);s.useEffect(()=>{const fe=()=>I(!0);return window.addEventListener("scenri:shortcuts",fe),()=>window.removeEventListener("scenri:shortcuts",fe)},[]);const{open:V,toggle:ie,setOpen:B}=MJ(),F=sr("(max-width: 1023px)"),te=sr("(min-width: 1024px) and (max-width: 1279px)"),X=F?!1:te?!0:V,[Z,K]=s.useState(null),[z,Y]=s.useState(WN),[J,de]=s.useState(null),[ae,W]=s.useState(null),ye=s.useRef(!1);s.useEffect(()=>{if(!ye.current||$)return;ye.current=!1;const fe=requestAnimationFrame(()=>{var _e;return(_e=$e.current)==null?void 0:_e.focus()});return()=>cancelAnimationFrame(fe)},[$,ae]);const[ee,ge]=s.useState(null),[re,D]=s.useState(new Set),[G,Pe]=M1("tab","all"),[Ze,He]=M1("in",""),[tt,oe]=M1("branch",""),[he,Ae]=M1("lineage",""),[ue,ke]=Na(Wr.tileSize,yN),qe=wN(ue),{q:Ve,setQ:Xe,clearSearch:Re}=ff([]),[Ie,st]=Na(Wr.feedSort,"newest"),Ye=kU(Ie)?Ie:"newest",$e=s.useRef(null),{push:Qe}=Sr(),{poke:Fe}=Oa(),[yt,ht]=s.useState(null),yn=(f==null?void 0:f.id)??"",Oe=e?zd(d,e):hr(d),wt=s.useCallback(fe=>{const _e=A.toString();return`${Oe}/shots/${fe}${_e?`?${_e}`:""}`},[Oe,A]),pt=s.useCallback((fe,_e=!1)=>L(wt(fe),{replace:_e}),[L,wt]),Nt=s.useCallback(()=>{const fe=new URLSearchParams(A);fe.delete("panel");const _e=fe.toString();L(`${Oe}${_e?`?${_e}`:""}`,{replace:!0})},[Oe,L,A]),Ct=SU(G)?G:"all",$t=!e&&Ze==="ungrouped";s.useEffect(()=>{G==="ungrouped"&&(Pe(null),He("ungrouped"))},[G,Pe,He]);const Yt=s.useMemo(()=>{const fe=new Map;for(const _e of g)for(const ft of v[_e.id]??[])fe.has(ft)||fe.set(ft,[]),fe.get(ft).push(_e);return fe},[g,v]),Vn=s.useMemo(()=>({lens:Ct,set:e==null?void 0:e.id,ungrouped:$t||void 0,lineage:he||void 0,q:Ve.trim()||void 0,sort:Ye}),[Ct,e==null?void 0:e.id,$t,he,Ve,Ye]),pn=s.useRef(v);pn.current=v;const ar=s.useRef(Yt);ar.current=Yt;const bt=s.useRef(new Set),kt=s.useMemo(()=>({inSet:fe=>e?(pn.current[e.id]??[]).includes(fe):!1,inAnySet:fe=>ar.current.has(fe),inLineage:fe=>fe.id===he||fe.parentId!==null&&bt.current.has(fe.parentId)}),[e==null?void 0:e.id,he]),sn=foe(d.id,Vn,kt),{items:Ut,byId:Tn,counts:Vt}=sn,ne=s.useRef(sn);ne.current=sn,bt.current=s.useMemo(()=>new Set(Ut.map(fe=>fe.id)),[Ut]);const se=s.useRef(new Map);s.useEffect(()=>{for(const fe of Ut)se.current.set(fe.id,fe)},[Ut]);const pe=s.useRef(null),[ve,Ee]=s.useState("");s.useEffect(()=>N(fe=>{const{messages:_e,next:ft}=jae(pe.current??new Map,fe),Tt=pe.current===null;pe.current=ft,!Tt&&_e.length&&Ee(_e.join(" "));const gn=ne.current;let Bn=!1;const un=[],Rn=new Map;for(const Jt of fe){if(gn.byId.has(Jt.id))gn.patch(Jt);else if(se.current.has(Jt.id)){const is=se.current.get(Jt.id);is&&Rn.set(Jt.id,is),un.push(Jt)}else Jt.kind!=="root"&&(Bn=!0);se.current.set(Jt.id,Jt)}un.length&&gn.insert(un,Rn),Bn&&gn.ready&&gn.refresh().catch(()=>{})}),[N]);const We=y&&sn.ready,Ke=f5(he||null,Tn);s.useEffect(()=>{!he||!Ke.missing||(Ae(null),Qe({kind:"info",title:"That shot is no longer available",detail:"Showing everything instead."}))},[he,Ke.missing,Ae,Qe]);const Ue=s.useMemo(()=>{var Tt,gn;const fe=M.length?M:((Tt=d.json)==null?void 0:Tt.products)??[],_e=((gn=d.json)==null?void 0:gn.characters)??[],ft=T.scenes;return{product:Bn=>{const un=fe.find(Rn=>Rn.id===Bn)??a.find(Rn=>Rn.id===Bn);return un?oo(un,"chip"):null},person:Bn=>{var un,Rn;return((un=_e.find(Jt=>Jt.id===Bn))==null?void 0:un.name)??((Rn=r.find(Jt=>Jt.id===Bn))==null?void 0:Rn.name)??null},scene:Bn=>{const un=ft.find(Rn=>Rn.id===Bn);return un?zi(un,"chip"):null}}},[M,a,d,r,T.scenes]),Be=s.useMemo(()=>{const fe=H?Tn.get(H):void 0;return fe||(Ut.find(_e=>_e.status!=="error")??Ut[0]??null)},[Tn,Ut,H]),ot=f5(tt||null,Tn),rt=s.useMemo(()=>{const fe=ot.node;return!fe||fe.kind==="root"?null:fe.status==="running"||fe.status==="done"&&fe.images.length>0?fe:null},[ot.node]),me=(rt==null?void 0:rt.images[0])??null,q=s.useCallback(()=>oe(null),[oe]),Te=s.useRef(null),je=s.useCallback((...fe)=>{if(Te.current){for(const ft of fe)Te.current.add(ft);return}const _e=new Set(fe);Te.current=_e,queueMicrotask(()=>{Te.current=null,P(ft=>{const Tt=new URLSearchParams(ft);for(const gn of _e)Tt.delete(gn);return Tt},{replace:!0})})},[P]),gt=s.useCallback(()=>je("scene","setup","presenter","product"),[je]);s.useEffect(()=>{!tt||!We||(ot.node&&!rt?(q(),Qe({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})):ot.missing&&(q(),Qe({kind:"info",title:"That shot is no longer available to refine",detail:"Making a new shot."})))},[tt,ot.node,ot.missing,rt,We,q,Qe]);const dt=s.useCallback(fe=>{var _e;oe(fe),(_e=$e.current)==null||_e.focus()},[oe]),jt=fe=>O(fe),et=fe=>$||/\/shots\//.test(window.location.pathname)?pt(fe,!0):jt(fe),Pt=s.useCallback(fe=>{for(const _e of fe)se.current.set(_e.id,_e);ne.current.insert(fe),C(fe),Fe()},[C,Fe]),Sn=s.useCallback(async()=>{try{await b(),await ne.current.refresh(),K(null)}catch(fe){K(String(fe.message??fe))}},[b]),U=s.useCallback(fe=>C([fe]),[C]),{archive:ce,archiveBatch:Ce,unarchive:ze,unarchiveBatch:lt}=Qae(U),mt=s.useCallback(fe=>ne.current.drop(fe),[]),{remove:_t,removeBatch:It}=Jae(mt);s.useEffect(()=>{$&&O($)},[$]);const an=s.useRef(new Set),Bt=async fe=>{var _e,ft;if(fe.status==="running"||an.current.has(fe.id))return fe.id;if(fe.status==="error"||fe.status==="cancelled"){an.current.add(fe.id);try{const Tt=await Me.retryNode(fe.id);return C([Tt]),Fe(),Tt.id}catch(Tt){return Qe(wn(Tt,"Could not run this again")),null}finally{an.current.delete(fe.id)}}try{const Tt=await Me.node(fe.id),gn=await Me.addNode({projectId:yn,parentId:fe.parentId,kind:fe.kind==="edit"?"edit":"generation",prompt:Tt.prompt,engineId:fe.engineId,count:1,brief:fe.brief,...fe.kind==="edit"&&((_e=fe.brief)!=null&&_e.sourceImage)?{sourceImage:fe.brief.sourceImage}:{}});return Pt((ft=gn.siblings)!=null&&ft.length?gn.siblings:[gn]),(gn==null?void 0:gn.id)??null}catch(Tt){return Qe(wn(Tt,"Could not run this again")),null}},mn=async fe=>{try{await Me.cancelNode(fe.id),C([{...fe,status:"cancelled"}]),Fe()}catch(_e){Qe(wn(_e,"Could not cancel this shot"))}},on=s.useCallback(fe=>{var _e,ft,Tt;fe!=null&&fe.scene&&((_e=$e.current)==null||_e.applyScene(fe.scene)),fe!=null&&fe.scenesPanel&&((ft=$e.current)==null||ft.openAttach("Scenes")),(Tt=$e.current)==null||Tt.focus()},[]);s.useEffect(()=>{var _e;if(A.get("compose")===null)return;const fe=A.get("attach")==="all";on(),fe&&((_e=$e.current)==null||_e.showAttach()),je("compose",...fe?["attach"]:[])},[A,on,je]);const An=A.get("showcase"),Dt=s.useRef(null);s.useEffect(()=>{if(!An||!c||Dt.current===An)return;Dt.current=An;const fe=i.find(_e=>_e.id===An);fe?(W(ov(fe)),Qe({kind:"info",title:`Starting from "${fe.title}"`})):Qe({kind:"info",title:"That example is no longer available",detail:"Starting from scratch instead."}),P(_e=>{const ft=new URLSearchParams(_e);return ft.delete("showcase"),ft},{replace:!0})},[An,c,i,P,Qe]);const Zn=async(fe,_e=!fe.kept)=>{C([{...fe,kept:_e}]);try{C([await Me.keep(fe.id,_e)])}catch(ft){C([fe]),Qe(wn(ft,"Could not update keeper status"))}},xt=s.useMemo(()=>[...re].map(fe=>Tn.get(fe)).filter(fe=>!!fe),[Tn,re]),On=async()=>{const fe=!(xt.length>0&&xt.every(ft=>ft.kept)),_e=xt.filter(ft=>ft.kept!==fe);C(_e.map(ft=>({...ft,kept:fe})));try{C(await Promise.all(_e.map(ft=>Me.keep(ft.id,fe))))}catch(ft){C(_e),Qe(wn(ft,"Could not update keeper status"))}},Ot=s.useCallback((fe,_e)=>{pn.current={...pn.current,[fe]:_e},E(fe,_e)},[E]),rn=async fe=>{try{const _e=await Me.addToSet(fe.id,[...re]);Ot(fe.id,_e.nodeIds),D(new Set),(e||$t)&&ne.current.refresh()}catch(_e){Qe(wn(_e,"Could not add to the set"))}},$n=s.useRef([]),[or,Ir]=s.useState(!1);s.useEffect(()=>{or&&Ir(!1)},[or]);const zn=async(fe,_e)=>{const ft=_e.trim();if(ft)try{const Tt=await Me.createSet(d.id,ft);if(S(Tt),fe.length>0){const gn=await Me.addToSet(Tt.id,fe);Ot(Tt.id,gn.nodeIds)}D(new Set),L(zd(d,Tt))}catch(Tt){Qe(wn(Tt,"Could not create the set"))}},xn=()=>{const fe=$n.current;return $n.current=[],fe},Qo=async fe=>{if(!e)return;const _e=fe.trim();if(!(!_e||_e===e.name))try{const ft=await Me.renameSet(e.id,_e);x(ft),L(zd(d,ft),{replace:!0}),b()}catch(ft){Qe(wn(ft,"Could not rename the set"))}},Jo=async()=>{if(e)try{await Me.deleteSet(e.id),k(e.id),L(hr(d),{replace:!0}),b()}catch(fe){Qe(wn(fe,"Could not delete the set"))}},zs=async fe=>{var Jt;const _e=((Jt=/\/shots\/([^/?#]+)/.exec(window.location.pathname))==null?void 0:Jt[1])??null,ft=_e?Tn.get(_e)??null:Be;if(!ft)return;if(fe==="left"||fe==="right"){const{prev:is,next:ti}=T8(Ut,ft.id),mc=fe==="left"?is:ti;mc&&et(mc.id);return}const Tt=await Me.lineage(ft.id).catch(()=>null);if(!Tt)return;const gn=Tt.history??[...Tt.ancestors,ft,...Tt.children.slice(0,1)],{prev:Bn,next:un}=T8(gn.filter(is=>is.id===ft.id||is.images[0]),ft.id),Rn=fe==="up"?Bn:un;Rn&&et(Rn.id)};s.useEffect(()=>{const fe=_e=>{var un,Rn;if(_e.defaultPrevented)return;const ft=document.activeElement,Tt=((ft==null?void 0:ft.tagName)??"").toUpperCase(),gn=Tt==="INPUT"||Tt==="TEXTAREA"||Tt==="SELECT"||!!(ft!=null&&ft.closest('[contenteditable="true"]'))||!!(ft!=null&&ft.closest('[role="separator"]')),Bn=!!(ft!=null&&ft.closest('button, a[href], [role="button"], [role="tab"], [role="menuitem"]'));if(_e.key==="Enter"&&(_e.metaKey||_e.ctrlKey)){(un=$e.current)==null||un.submit(),_e.preventDefault();return}if(!gn){if(_e.key==="?"){I(!0),_e.preventDefault();return}if(_e.key==="/"&&!$){(Rn=$e.current)==null||Rn.focus(),_e.preventDefault();return}if(_e.key==="Escape"&&Q){I(!1),_e.preventDefault();return}if(_e.key==="Escape"&&$){Nt(),_e.preventDefault();return}if(_e.key==="Escape"&&re.size>0){D(new Set),_e.preventDefault();return}if(_e.key==="Escape"&&tt){q(),_e.preventDefault();return}if(Be){if(_e.key==="b"&&Be.kind!=="root"&&Be.status==="done"&&Be.images.length>0){dt(Be.id),_e.preventDefault();return}if(_e.key==="k"&&Be.kind!=="root"&&Be.status==="done"){Zn(Be),_e.preventDefault();return}_e.key==="ArrowLeft"?(zs("left"),_e.preventDefault()):_e.key==="ArrowRight"?(zs("right"),_e.preventDefault()):_e.key==="ArrowUp"?(zs("up"),_e.preventDefault()):_e.key==="ArrowDown"?(zs("down"),_e.preventDefault()):_e.key==="Enter"&&!$&&Be.kind!=="root"&&!Bn?pt(Be.id):_e.key==="."&&!$&&ie()}}};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[Be,$,Q,re.size,tt,dt,oe,h]);const Ji=fe=>D(_e=>{const ft=new Set(_e);return ft.delete(fe)||ft.add(fe),ft}),as=We&&Vt!==null&&Vt.total===0,ha=X||as&&!F,ei=as?o.jsx(soe,{entries:i,catalogs:{demoProducts:a,presenters:r,scenes:n},stagedId:ee,productHref:fe=>sa(d,fe),presenterHref:fe=>la(d,fe),sceneHref:fe=>Hr(d,fe),onUse:fe=>{ge(fe.id),W(ov(fe))}}):Ve.trim()?o.jsx(Id,{text:`No shots match “${Ve.trim()}”.`,onAll:Re,actionLabel:"Clear search"}):Ct==="keepers"?o.jsx(Id,{text:"No keepers yet. Star a shot and it lands here.",onAll:()=>Pe(null)}):Ct==="archived"?o.jsx(Id,{text:"Nothing archived.",onAll:()=>Pe(null)}):e?o.jsx(Id,{text:"Nothing in this set yet. Pick shots on All, then add them here."}):$t?o.jsx(Id,{text:"Every shot is already in a set.",onAll:()=>He(null)}):null,Bs=s.useRef(0);!Ve.trim()&&Vt&&(Bs.current=Vt[Ct]);const os=s.useMemo(()=>({all:(Vt==null?void 0:Vt.all)??0,keepers:(Vt==null?void 0:Vt.keepers)??0,archived:(Vt==null?void 0:Vt.archived)??0}),[Vt]),Es={byId:Tn,items:Ut,loadMore:sn.loadMore,complete:sn.complete,rootId:h,recent:p,loaded:We,setsFor:fe=>Yt.get(fe)??[],brand:d,engines:t,projectId:yn,close:Nt,select:et,retry:fe=>{Bt(fe).then(_e=>{_e&&et(_e)})},cancel:fe=>void mn(fe),keep:fe=>void Zn(fe),reload:Sn,remix:fe=>{var Bn;const _e=(Bn=fe.brief)==null?void 0:Bn.tokens,ft=fe.prompt??fe.promptHead,Tt=_e!=null&&_e.length||!ft?fe.brief:{...fe.brief,tokens:[{t:"text",v:ft}]},gn=Tt!=null&&Tt.tokens?{...Tt,tokens:DG(d,Tt.tokens)}:Tt;W({...gn,_at:Date.now()}),gn&&UN(d.id,{tokens:c4(gn),tplFields:gn.templateFields??{}}),Nt(),Qe({kind:"info",title:"Starting from this shot",detail:"Its prompt, chips and settings are in the composer. Change anything, then Generate."}),ye.current=!0},branch:fe=>{dt(fe.id),Nt()},archive:fe=>ce(fe).then(_e=>{_e&&Nt()}),unarchive:fe=>ze(fe).then(()=>{}),delete:fe=>void _t(fe).then(()=>Nt()),landed:Pt,refined:(fe,_e)=>{_e==="edit"&&oe(fe)},subscribeActivity:N,tokenNames:Ue};return o.jsxs("div",{className:"sc-work","data-assets":ha,children:[o.jsxs("main",{className:"sc-canvas",id:"main","data-page-scroll":"","data-firstrun":as||void 0,onClick:fe=>{if(re.size===0&&!H)return;const _e=fe.target;_e.closest(".sc-cell")||_e.closest("button, a, input, select, textarea, label, [role], [contenteditable]")||(D(new Set),O(null))},children:[o.jsx("span",{className:"sc-vh",role:"status","aria-live":"polite",children:ve}),(Z||sn.error)&&o.jsx("div",{className:"sc-canvas-alert",children:o.jsx(V6,{failure:nf(Z??sn.error??"")})}),(!as||e)&&o.jsx(Xae,{sets:g,active:e,ungrouped:$t,ungroupedCount:(Vt==null?void 0:Vt.ungrouped)??0,onPlaceAll:()=>e?L(hr(d)):He(null),onPlaceUngrouped:()=>e?L(`${hr(d)}?in=ungrouped`):He("ungrouped"),onOpenSet:fe=>L(zd(d,fe)),onNewSet:fe=>void zn(xn(),fe),onResetNewSet:()=>{$n.current=[]},onRenameSet:fe=>void Qo(fe),onDeleteSet:()=>void Jo(),askCreate:or,lens:Ct,lensCounts:os,onLens:fe=>Pe(fe==="all"?null:fe),q:Ve,onQ:Xe,searchTotal:Ve.trim()?Bs.current:(Vt==null?void 0:Vt[Ct])??0,sort:Ye,onSort:st,tile:qe,onTile:ke,assets:X,onAssets:ie,showAssets:!F&&!te}),he&&Ke.node&&o.jsxs("div",{className:"sc-lineage-bar",children:[o.jsx("button",{type:"button",className:"sc-crumb-back",onClick:()=>Ae(null),children:"All shots"}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("b",{dir:"auto",children:lr(Ke.node)}),o.jsx("span",{className:"sc-crumb-sep",children:"›"}),o.jsx("span",{className:"sc-crumb-here",children:"versions"})]}),o.jsx(Wae,{nodes:Ut,selectedId:H,onOpen:pt,shotHref:wt,onRetry:fe=>void Bt(fe),onCancel:fe=>void mn(fe),onToggleKeep:fe=>void Zn(fe),onArchive:fe=>fe.archived?ze(fe):ce(fe),onDeletePermanently:_t,engineName:fe=>{var _e;return(_e=t.find(ft=>ft.id===fe))==null?void 0:_e.displayName},picked:re,onPick:Ji,sending:yt,onBranch:dt,branchingFrom:(rt==null?void 0:rt.id)??null,onVersions:Ae,tile:qe,empty:We?ei:null,pending:!We,onNearEnd:sn.complete?void 0:sn.loadMore})]}),ha&&o.jsx("div",{className:"sc-assets-backdrop",onClick:()=>B(!1),"aria-hidden":!0}),o.jsx(Nae,{open:Q,onOpenChange:I}),!F&&o.jsx(qae,{brand:d,shots:p,shotsTotal:os.all,attached:z,full:J,onToken:fe=>{var _e;return(_e=$e.current)==null?void 0:_e.insertToken(fe)},offToken:fe=>{var _e;return(_e=$e.current)==null?void 0:_e.removeToken(fe)},onTemplate:fe=>{var _e;return(_e=$e.current)==null?void 0:_e.applyScene(fe)},offTemplate:()=>{var fe;return(fe=$e.current)==null?void 0:fe.removeTemplate()},onClose:()=>B(!1)}),o.jsxs(GN,{full:!ha,children:[o.jsx(P4,{}),re.size>0&&o.jsx(aoe,{count:re.size,sets:g,onAdd:fe=>void rn(fe),onNew:()=>{$n.current=[...re],Ir(!0)},onClear:()=>D(new Set),onKeep:()=>void On(),onArchiveBatch:fe=>void Ce(fe).then(()=>D(new Set)),allKept:xt.length>0&&xt.every(fe=>fe.kept),archivedLens:Ct==="archived",pickedIds:[...re],onRestoreBatch:fe=>void lt(fe).then(()=>D(new Set)),onDeleteBatch:fe=>void It(fe).then(()=>D(new Set)),loaded:Ut.length,onSelectAll:()=>D(new Set(Ut.map(fe=>fe.id)))}),o.jsx(M4,{ref:$e,projectId:yn||null,brand:d,engines:t,parentId:h,initialBrief:ae,suppressDraftRestore:An!==null,startScene:A.get("scene")??void 0,startSetup:A.get("setup")??void 0,startPresenter:A.get("presenter")??void 0,startProduct:A.get("product")??void 0,onSeedsSpent:gt,openAttachTab:A.get("attach")==="scenes"?"Scenes":A.get("attach")==="products"?"Products":void 0,target:rt,onClearTarget:q,onRestoreBranchId:oe,guided:!0,setSlug:(e==null?void 0:e.slug)??null,onSending:ht,onAttached:Y,onCeiling:de,sourceImage:me??void 0,onQueued:(fe,_e,ft,Tt)=>{W(null),P(Rn=>{const Jt=new URLSearchParams(Rn);return Jt.delete("scene"),Jt.delete("attach"),Jt.delete("presenter"),Jt.delete("product"),Jt},{replace:!0});const gn=()=>ht(null),Bn=()=>{_e!=="edit"||!fe||P(Rn=>{const Jt=new URLSearchParams(Rn);return Jt.set("branch",fe),Jt},{replace:!0})},un=()=>{Pt(Tt??[]),Bn(),gn()};e&&fe?Me.addToSet(e.id,ft!=null&&ft.length?ft:[fe]).then(Rn=>Ot(e.id,Rn.nodeIds)).catch(Rn=>Qe(wn(Rn,"Could not add to the set"))).finally(un):un()}})]}),o.jsx(Ql,{context:Es})]})}function poe(e){var t;return $u((t=e.brief)==null?void 0:t.format)}function moe(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 goe=e=>({"--sc-pic-ar":e[0]/e[1],"--sc-pic-w":`${e[0]}px`});function voe({node:e,onRetry:t,onCancel:n,engineName:r,menu:a}){const[i,c]=s.useState(null),[,d]=s.useState(0);if(s.useEffect(()=>{if(e.status!=="running")return;const g=setInterval(()=>d(v=>v+1),1e3);return()=>clearInterval(g)},[e.status]),e.kind==="root")return o.jsx(Qd,{className:"sc-frame",p:"8",children:o.jsxs(vs,{direction:"column",align:"center",gap:"2",py:"6",children:[o.jsx(Vl,{className:"sc-display",size:"7",align:"center",children:"Blank canvas, full brand."}),o.jsx(Vl,{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":poe(e)},children:[o.jsx("span",{className:"sc-shimmer"}),o.jsxs("div",{className:"sc-stage-wait-say",children:[o.jsx("span",{className:"sc-stage-wait-t",role:"status","aria-label":`${G6(Ai(e))}, ${Ul(Ai(e))} seconds`,children:Wl(Ai(e))}),n&&o.jsx("button",{type:"button",className:"sc-btn sc-btn-ghost","data-urgent":Ul(Ai(e))>=60||void 0,onClick:n,children:"Cancel"})]})]});if(e.status==="cancelled"||e.status==="error"){const v=e.status==="cancelled"?Mj():nf(e.error,r);return o.jsx(qC,{failure:v,density:"stage",onRetry:t})}const f=e.status==="done"?e.images[0]:void 0,h=f?moe(e)??(i==null?void 0:i.size)??null:null,p=f?o.jsx(Qd,{className:h?"sc-frame sc-stage-pic":"sc-frame sc-stage-free",style:h?goe(h):void 0,children:o.jsx(yoe,{hash:f,alt:e.promptHead,onPainted:(g,v,y)=>c({hash:g,size:[v,y]})})}):o.jsx(vs,{justify:"center",children:o.jsx(Qd,{className:"sc-frame",style:{display:"inline-block",maxWidth:"100%"}})});return a?o.jsxs(pp,{children:[o.jsx(mp,{children:p}),a]}):p}function yoe({hash:e,alt:t,onPainted:n}){const[r,a]=s.useState(null),i=s.useRef(null),c=r===e,d=h=>{!(h!=null&&h.complete)||!h.naturalWidth||h.src!==new URL(Dr(e),location.href).href||i.current!==e&&(i.current=e,a(e),n==null||n(e,h.naturalWidth,h.naturalHeight))},f=i.current&&i.current!==e?Dr(i.current):nn(e,"tile");return o.jsxs(Qd,{position:"relative",style:{lineHeight:0},children:[!c&&o.jsx("img",{className:"sc-stage-under",src:f,alt:"","aria-hidden":!0,decoding:"async"}),o.jsx("img",{ref:d,src:Dr(e),alt:t,className:"sc-stage-img","data-ready":c||void 0,onLoad:h=>d(h.currentTarget)})]})}const woe=e=>((e==null?void 0:e.tokens)??[]).filter(t=>t&&typeof t.t=="string");function QM(e,t){return woe(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 boe=e=>e===0?"Original":`Refinement ${e}`,xoe=e=>e===0?"the original":`Refinement ${e}`,koe=(e,t)=>e.createdAt.localeCompare(t.createdAt)||e.id.localeCompare(t.id);function Soe(e,t,n){const r=new Set(e.map(g=>g.id)),a=n.filter(g=>!r.has(g.id)&&g.parentId!==null&&r.has(g.parentId)),i=a.length?[...e,...a].sort(koe):e,d=(i.some(g=>g.id===t.id)?i:[...i,t]).map(g=>g.id===t.id?t:g).filter(g=>g.id===t.id||g.images[0]);let f=0;const h=d.map(g=>{const v=g.kind==="edit"?++f:0;return{node:g,index:v,label:boe(v),from:null,state:g.images[0]?"ready":g.status==="running"?"pending":"failed"}}),p=new Map(h.map((g,v)=>[g.node.id,v]));return h.map((g,v)=>{if(v===0||!g.node.parentId||g.node.parentId===h[v-1].node.id)return g;const y=p.get(g.node.parentId);return y===void 0?g:{...g,from:xoe(h[y].index)}})}function JM(e,t){var a;const n=e.find(i=>i.node.id===t);if(!n)return"";const r=((a=e[e.length-1])==null?void 0:a.index)??0;return n.index===0?"Original":`Refinement ${n.index} of ${r}`}const H1=28;function Eoe({trail:e,activeId:t,names:n,onSelect:r}){var y;const a=s.useRef(null),i=s.useMemo(()=>e.map(b=>QM(b.node,n)),[e,n]),c=Ku(),d=(b,x,k)=>c.open({key:b.node.id,src:nn(b.node.images[0],"tile"),label:b.label,said:i[x],from:b.from,el:k,id:b.node.id});s.useEffect(()=>{var b,x;(x=(b=a.current)==null?void 0:b.querySelector('[aria-pressed="true"]'))==null||x.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[t]);const[f,h]=s.useState(null);s.useEffect(()=>{const b=a.current;if(!b)return;const x=()=>{const E=b.scrollWidth-b.clientWidth;if(E<=1)return h(null);const C=b.scrollLeft;h(C<=1?"end":C>=E-1?"start":"both")},k=()=>{const E=b.querySelector('[aria-pressed="true"]');if(!E)return;const C=E.getBoundingClientRect(),N=b.getBoundingClientRect();C.left<N.left+H1?b.scrollLeft-=N.left+H1-C.left:C.right>N.right-H1&&(b.scrollLeft+=C.right-(N.right-H1))};x(),b.addEventListener("scroll",x,{passive:!0});const S=new ResizeObserver(()=>{k(),x()});return S.observe(b),()=>{b.removeEventListener("scroll",x),S.disconnect()}},[e.length]),s.useEffect(()=>{const b=a.current;if(!b)return;const x=k=>{b.scrollWidth<=b.clientWidth||Math.abs(k.deltaY)<=Math.abs(k.deltaX)||(k.preventDefault(),b.scrollLeft+=k.deltaY)};return b.addEventListener("wheel",x,{passive:!1}),()=>b.removeEventListener("wheel",x)},[]);const p=b=>{var E,C;const x=[...((E=a.current)==null?void 0:E.querySelectorAll(".sc-trail-tile:not([aria-disabled])"))??[]],k=x.indexOf(document.activeElement);let S=-1;if(b.key==="ArrowRight")S=Math.min(x.length-1,k+1);else if(b.key==="ArrowLeft")S=Math.max(0,k-1);else if(b.key==="Home")S=0;else if(b.key==="End")S=x.length-1;else return;b.preventDefault(),b.stopPropagation(),(C=x[S])==null||C.focus()},g=e.some(b=>b.node.id===t)?t:(y=e[0])==null?void 0:y.node.id,v=JM(e,t);return o.jsxs("div",{className:"sc-trail",children:[v&&o.jsx("span",{className:"sc-trail-say",children:v}),o.jsx("nav",{ref:a,className:"sc-thumbs","aria-label":"History of this shot","data-more":f??void 0,onKeyDown:p,children:e.map((b,x)=>{const k=b.node,S=k.id===t,E=b.state==="pending";return o.jsx("button",{type:"button",className:"sc-thumb-btn sc-trail-tile","data-original":b.index===0&&e.length>1?"":void 0,"aria-label":i[x]?`${b.label}: ${i[x]}`:b.label,"aria-pressed":S,"aria-disabled":E||void 0,tabIndex:k.id===g?0:-1,onClick:()=>{E||(c.closeNow(),r(k.id))},onPointerEnter:C=>C.pointerType==="mouse"&&b.state==="ready"&&d(b,x,C.currentTarget),onPointerLeave:C=>C.pointerType==="mouse"&&c.close(),onFocus:C=>Lp(C.currentTarget)&&b.state==="ready"&&d(b,x,C.currentTarget),children:b.state==="ready"?o.jsx("img",{src:nn(k.images[0],"micro"),alt:"",className:"sc-thumb",loading:"lazy",decoding:"async","data-active":S,width:52,height:52}):E?o.jsx("span",{className:"sc-thumb sc-thumb-wait","data-active":S,children:o.jsx("span",{className:"sc-shimmer"})}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":S,children:o.jsx(uc,{size:14})})},k.id)})}),c.shown&&o.jsx(Gu,{anchor:c.shown.el,kind:"shot",src:c.shown.src,label:c.shown.label,noun:c.shown.said,note:c.shown.from?`From ${c.shown.from}`:null,onOpen:()=>{var x;const b=(x=c.shown)==null?void 0:x.id;c.closeNow(),b&&r(b)},onHoverIn:c.keep,onHoverOut:c.close,onClose:c.closeNow},c.shown.key)]})}const Coe=200,h5=32;function joe({shots:e,activeId:t,onSelect:n,onEndReached:r,complete:a}){var b;const i=s.useRef(null),c=Ku(),d=(x,k)=>c.open({key:x.id,src:nn(x.images[0],"tile"),label:lr(x),el:k,id:x.id}),f=s.useRef(!1);s.useLayoutEffect(()=>{var k;const x=(k=i.current)==null?void 0:k.querySelector('[aria-pressed="true"]');x&&(x.scrollIntoView({block:"center",behavior:f.current?"smooth":"auto"}),f.current=!0)},[t]);const h=s.useRef(null),p=()=>{const x=i.current,k=h.current;if(!x||!k)return;const S=x.scrollHeight-x.clientHeight,E=x.scrollTop;k.style.setProperty("--sc-shotrail-start",S>1?Math.min(1,E/h5).toFixed(3):"0"),k.style.setProperty("--sc-shotrail-end",S>1?Math.min(1,(S-E)/h5).toFixed(3):"0")};s.useLayoutEffect(()=>{const x=i.current;if(!x)return;p();const k=new ResizeObserver(p);return k.observe(x),()=>k.disconnect()},[e.length]);const g=()=>{p();const x=i.current;!x||a||x.scrollTop+x.clientHeight>=x.scrollHeight-Coe&&r()},v=x=>{var C,N;const k=[...((C=i.current)==null?void 0:C.querySelectorAll(".sc-shotrail-tile:not([aria-disabled])"))??[]],S=k.indexOf(document.activeElement);let E=-1;if(x.key==="ArrowDown")E=Math.min(k.length-1,S+1);else if(x.key==="ArrowUp")E=Math.max(0,S-1);else if(x.key==="Home")E=0;else if(x.key==="End")E=k.length-1;else return;x.preventDefault(),x.stopPropagation(),(N=k[E])==null||N.focus()},y=e.some(x=>x.id===t)?t:(b=e[0])==null?void 0:b.id;return o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:h,className:"sc-shotrail-shell",children:o.jsx("nav",{ref:i,className:"sc-shotrail","aria-label":"Shots in this view",onScroll:g,onKeyDown:v,children:e.map(x=>{const k=x.id===t,S=x.status==="running",E=x.status==="done"&&!!x.images[0];return o.jsx("button",{type:"button",className:"sc-thumb-btn sc-shotrail-tile","aria-label":S?`${lr(x)}, still rendering`:lr(x),"aria-pressed":k,"aria-disabled":S||void 0,tabIndex:x.id===y?0:-1,onClick:()=>{S||(c.closeNow(),n(x.id))},onPointerEnter:C=>C.pointerType==="mouse"&&E&&d(x,C.currentTarget),onPointerLeave:C=>C.pointerType==="mouse"&&c.close(),onFocus:C=>Lp(C.currentTarget)&&E&&d(x,C.currentTarget),children:E?o.jsx("img",{src:nn(x.images[0],"micro"),alt:"",className:"sc-thumb",loading:"lazy",decoding:"async","data-active":k,width:52,height:52}):S?o.jsx("span",{className:"sc-thumb sc-thumb-wait","data-active":k,children:o.jsx("span",{className:"sc-shimmer"})}):o.jsx("span",{className:"sc-thumb sc-thumb-failed","data-active":k,children:o.jsx(uc,{size:14})})},x.id)})})}),c.shown&&o.jsx(Gu,{anchor:c.shown.el,kind:"shot",noun:"Shot",side:"beside",src:c.shown.src,label:c.shown.label,onOpen:()=>{var k;const x=(k=c.shown)==null?void 0:k.id;c.closeNow(),x&&n(x)},onHoverIn:c.keep,onHoverOut:c.close,onClose:c.closeNow},c.shown.key)]})}const Aoe=60;function Noe({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,c=r.clientY-a.y;Math.abs(i)<Aoe||Math.abs(i)<2*Math.abs(c)||(i<0?e():t())},onPointerCancel:()=>{n.current=null}}}function Moe(e){const t=Dn(),n=Ku(),{shown:r,closeNow:a}=n,[i,c]=s.useState(null),d=i??r,f=()=>{c(null),a()};s.useEffect(()=>{if(!i)return;const y=b=>{const x=b.target;x!=null&&x.closest(".sc-chip-preview")||x!=null&&x.closest(e)||c(null)};return document.addEventListener("pointerdown",y,!0),()=>document.removeEventListener("pointerdown",y,!0)},[i,e]);const[h,p]=s.useState(null),g=y=>({"data-open":(d==null?void 0:d.key)===y.key||void 0,"aria-haspopup":"dialog",onPointerEnter:b=>b.pointerType==="mouse"&&!i&&n.open({...y,el:b.currentTarget}),onPointerLeave:b=>b.pointerType==="mouse"&&n.close(),onFocus:b=>Lp(b.currentTarget)&&!i&&n.open({...y,el:b.currentTarget}),onClick:b=>{if((i==null?void 0:i.key)===y.key){f();return}a(),c({...y,el:b.currentTarget})}}),v=o.jsxs(o.Fragment,{children:[d&&o.jsx(Gu,{anchor:d.el,kind:d.kind,src:tr(d.src,"tile"),label:d.label,onOpen:()=>{const y=d;f(),y.to?t(y.to):p({src:tr(y.src,"full"),kind:y.kind,label:y.label})},onHoverIn:n.keep,onHoverOut:()=>!i&&n.close(),onClose:f},d.key),h&&o.jsx(Du,{src:h.src,kind:h.kind,label:h.label,onClose:()=>p(null)})]});return{bind:g,isOpen:y=>(d==null?void 0:d.key)===y,surface:v}}function Roe({brief:e,prompt:t,brand:n,saidRef:r,expanded:a,clamped:i}){var T,L;const{scenes:c,presenters:d,demoProducts:f}=jn(),h=Moe(".sc-ingredient"),p=(e==null?void 0:e.tokens)??[],g=((T=n==null?void 0:n.json)==null?void 0:T.products)??[],v=((L=n==null?void 0:n.json)==null?void 0:L.characters)??[],y=hc(n),b=tf(n==null?void 0:n.json),[x,k]=s.useState({});s.useEffect(()=>{for(const A of p){if((A==null?void 0:A.t)!=="template")continue;const P=y.find(H=>H.id===A.id);if(!(P!=null&&P.previewUrl)||yu(P.previewColor))continue;const $=`t${A.id}`;IN(P.previewUrl).then(H=>{const O=yu(H??void 0);O&&k(Q=>Q[$]?Q:{...Q,[$]:O})})}});const S={products:g,demoProducts:f,cast:v,presenters:d,scenes:[...y,...c]},E=A=>{var $,H;const P=LN(A,S);if((P==null?void 0:P.kind)==="product"){const{product:O,demo:Q}=P;return{key:`p${A.id}`,kind:"product",label:(O==null?void 0:O.name)??(Q==null?void 0:Q.name)??"product",thumb:O?jp((H=($=O==null?void 0:O.shots)==null?void 0:$[0])==null?void 0:H.file,"micro"):(Q==null?void 0:Q.previewUrl)??null,to:n&&(O||Q)?sa(n,A.id):void 0}}if((P==null?void 0:P.kind)==="presenter"){const{character:O,presenter:Q}=P,I=(Q==null?void 0:Q.id)??(O==null?void 0:O.presenterId)??((O==null?void 0:O.origin)==="custom"?O.id:void 0),V=O?q6(O):Q?Bo(Q):{src:null};return{key:`h${A.id}`,kind:"presenter",label:O!=null&&O.supersededBy?`${O.name}, edited since`:(O==null?void 0:O.name)??(Q==null?void 0:Q.name)??"someone",thumb:V.src,crop:V.crop,to:n&&I?la(n,I):void 0}}if((P==null?void 0:P.kind)==="scene"){const O=P.scene;return{key:`t${A.id}`,kind:"scene",label:(O==null?void 0:O.name)??"a scene no longer in the catalog",thumb:(O==null?void 0:O.previewUrl)??null,to:n&&O?Hr(n,O.id):void 0,tint:yu(O==null?void 0:O.previewColor),custom:P.custom}}if((A==null?void 0:A.t)==="color")return{key:`c${A.hex}`,kind:"color",label:A.name??A.hex,swatch:A.hex};if((A==null?void 0:A.t)==="ref")return{key:`r${A.imageHash}`,kind:"ref",label:A.label??"reference image",thumb:nn(A.imageHash,"micro"),previewHash:A.imageHash};if((A==null?void 0:A.t)==="mark"){const O=b.find(Q=>Q.hash===A.imageHash);return{key:`m${A.imageHash}`,kind:"mark",label:O?Pp(n==null?void 0:n.json,O):"brand mark",thumb:nn(A.imageHash,"micro"),previewHash:A.imageHash}}return null},C=A=>{const P=o.jsxs(o.Fragment,{children:[A.thumb?o.jsx("img",{src:A.thumb,alt:"","data-crop":A.crop}):A.swatch?o.jsx("i",{style:{background:A.swatch}}):null,A.label]}),$=A.tint??(A.custom?x[A.key]:void 0),H=$?{"--tint":$}:void 0,O=(A.previewHash?nn(A.previewHash,"tile"):tr(A.thumb,"tile"))??(A.to?"":null);if(O!==null&&J1(A.kind)){const Q=A.kind,I=h.isOpen(A.key),V={key:A.key,src:O,kind:Q,label:A.label,to:A.to};return o.jsx("button",{type:"button",className:"sc-ingredient","data-kind":A.kind,"data-tinted":$?"":void 0,style:H,title:I?void 0:`${A.label}. Preview.`,"aria-label":`${A.label}. Preview.`,...h.bind(V),children:P},A.key)}return o.jsx("span",{className:"sc-ingredient","data-kind":A.kind,"data-tinted":$?"":void 0,style:H,title:`${A.kind}: ${A.label}`,children:P},A.key)},N=[];for(const A of p){if(A.t==="text"){const $=A.v.trim();$&&N.push($);continue}const P=E(A);P&&N.push(C(P))}if(!N.length&&!t)return null;const M=N.flatMap((A,P)=>P?[" ",A]:[A]);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:M.length?M:t||""}),h.surface]})}const Poe=256,Rl=new Map;function p5(e,t){for(Rl.delete(e),Rl.set(e,t);Rl.size>Poe;)Rl.delete(Rl.keys().next().value)}function Loe(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 Toe(e,t){p5(e,t);for(const n of t.history??[])n.id!==e&&p5(n.id,Loe(t.history??[],n))}function $oe(e){var i;const[t,n]=s.useState(()=>{const c=Rl.get(e.id);return c?{id:e.id,lineage:c}:null});s.useEffect(()=>{let c=!0;return Me.lineage(e.id).then(d=>{c&&(Toe(e.id,d),n({id:e.id,lineage:d}))}).catch(()=>{}),()=>{c=!1}},[e.id,e.childCount,e.status,e.parentId]);const r=(t==null?void 0:t.id)===e.id?t.lineage:Rl.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(c=>c.id===e.id)?r.siblings:[e,...r.siblings];return{ancestors:r.ancestors,children:r.children,siblings:a,sibIndex:a.findIndex(c=>c.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 Doe=32,Ci=new Map;function Ooe(e){for(Ci.delete(e.id),Ci.set(e.id,e);Ci.size>Doe;)Ci.delete(Ci.keys().next().value)}function Hoe(e){const[t,n]=s.useState(()=>Ci.get(e.id)??null);return s.useEffect(()=>{const r=Ci.get(e.id);if(r){n(r);return}let a=!0;return Me.node(e.id).then(i=>{a&&(Ooe(i),n(i))}).catch(()=>{}),()=>{a=!1}},[e.id]),(t==null?void 0:t.id)===e.id?t:Ci.get(e.id)??null}const Ioe="(max-width: 1023px)",eR=380,tR=480,m5=380,Yc=e=>Math.min(tR,Math.max(eR,Math.round(e)));function Foe({node:e,rootId:t,items:n,loadMore:r,complete:a,brand:i,engines:c,projectId:d,onClose:f,onSelect:h,onRetry:p,onCancel:g,onKeep:v,onLanded:y,onRemix:b,onArchive:x,onUnarchive:k,onDelete:S,onRefined:E,tokenNames:C}){const{ancestors:N,children:M,history:T}=$oe(e),L=Hoe(e),A=s.useMemo(()=>c.find(Oe=>Oe.id===e.engineId),[c,e.engineId]),{push:P}=Sr(),[$,H]=Na(Wr.ovlPanelW,m5),O=s.useRef(0),Q=s.useRef(0),I=s.useRef(null),V=s.useMemo(()=>{var Oe;return(((Oe=e.brief)==null?void 0:Oe.tokens)??[]).some(wt=>(wt==null?void 0:wt.t)&&wt.t!=="text"&&wt.t!=="format")},[e.brief]),ie=s.useMemo(()=>{const Oe=tf(i.json);return{...C,mark:wt=>{const pt=Oe.find(Nt=>Nt.hash===wt);return pt?Pp(i.json,pt):null}}},[C,i]),B=s.useMemo(()=>QM(L??e,ie),[L,e,ie]),[F,te]=s.useState(!1),[X,Z]=s.useState(!1),[K,z]=s.useState(!1),[Y,J]=s.useState(!1),[de,ae]=s.useState(!1),[W,ye]=s.useState(!1);s.useEffect(()=>{z(!1),ye(!1),J(!1)},[e.id]),s.useEffect(()=>{if(!K)return;const Oe=setTimeout(()=>z(!1),1400);return()=>clearTimeout(Oe)},[K]),s.useEffect(()=>{if(!W)return;const Oe=setTimeout(()=>ye(!1),1400);return()=>clearTimeout(Oe)},[W]);const[ee,ge]=s.useState(null);R4(ee,"--sc-ovl-dock-h");const re=s.useRef(null),[D,G]=s.useState(!1),[Pe,Ze]=s.useState(!1);s.useEffect(()=>G(!1),[e.id]),s.useLayoutEffect(()=>{const Oe=re.current;if(!Oe||D)return;const wt=()=>Ze(Oe.scrollHeight>Oe.clientHeight+1);wt();const pt=new ResizeObserver(wt);return pt.observe(Oe),()=>pt.disconnect()},[B,D]);const He=s.useMemo(()=>Soe(T??[...N,e,...M.slice(0,6)],e,n),[T,N,e,M,n]),tt=s.useMemo(()=>He.find(Oe=>Oe.node.id===e.id)??null,[He,e.id]),oe=sr(Ioe),he=He.length>1&&oe?JM(He,e.id):e.kind!=="edit"?"Shot":T&&tt?tt.label:"Refinement",Ae=s.useMemo(()=>T8(n,e.id),[n,e.id]);s.useEffect(()=>{Ae.at>=0&&!a&&n.length-Ae.at<=6&&r()},[Ae.at,n.length,a,r]);const ue=Oe=>{const wt=Oe>0?Ae.next:Ae.prev;wt&&h(wt.id)},ke=Ku(),qe=(Oe,wt)=>Oe!=null&&Oe.images[0]?{onPointerEnter:pt=>{pt.pointerType==="mouse"&&ke.open({key:Oe.id,src:nn(Oe.images[0],"tile"),label:lr(Oe),noun:wt,el:pt.currentTarget,id:Oe.id})},onPointerLeave:pt=>{pt.pointerType==="mouse"&&ke.close()}}:{},Ve=Noe({onLeft:()=>ue(1),onRight:()=>ue(-1)});s.useEffect(()=>{const Oe=ke.shown;if(!Oe)return;const wt=Oe.noun==="Next shot"?Ae.next:Ae.prev;wt!=null&&wt.images[0]?ke.open({key:wt.id,src:nn(wt.images[0],"tile"),label:lr(wt),noun:Oe.noun,el:Oe.el,id:wt.id}):ke.closeNow()},[e.id]),s.useEffect(()=>{var Nt,Ct;const Oe=He.findIndex($t=>$t.node.id===e.id),pt=[(Nt=He[Oe-1])==null?void 0:Nt.node,(Ct=He[Oe+1])==null?void 0:Ct.node,Ae.prev,Ae.next].filter($t=>!!($t!=null&&$t.images[0])).map($t=>{var Vn;const Yt=new Image;return Yt.decoding="async",Yt.src=nn($t.images[0],"tile"),(Vn=Yt.decode)==null||Vn.call(Yt).catch(()=>{}),Yt});return()=>{for(const $t of pt)$t.src=""}},[He,e.id,Ae.prev,Ae.next]);const Xe=e.images[0],Re=e.promptHead.slice(0,40).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"")||"shot",Ie=async(Oe=!1)=>{if(!X){Z(!0);try{const wt=fetch(Dr(Xe)).then(pt=>{if(!pt.ok)throw new Error(`HTTP ${pt.status}`);return pt.blob()});await navigator.clipboard.write([new ClipboardItem({"image/png":wt})]),Oe?P({kind:"success",title:"Copied to clipboard"}):z(!0)}catch(wt){P(wn(wt,"Copy failed"))}finally{Z(!1)}}},st=async()=>{if(!Y){J(!0);try{await(e.archived?k(e):x(e))}finally{J(!1)}}},Ye=async()=>{if(!de){ae(!0);try{const Oe=e.brief?c4(e.brief):null;if(!Oe||Oe.every(wt=>wt.t==="text"&&!wt.v.trim()))await navigator.clipboard.writeText(B);else{const wt=Ct=>{var $t;switch(Ct.t){case"text":return Ct.v;case"product":return ie.product(Ct.id)??"a product";case"character":return ie.person(Ct.id)??"a presenter";case"template":return ie.scene(Ct.id)??"a scene";case"color":return Ct.name??Ct.hex;case"ref":return"reference image";case"mark":return(($t=ie.mark)==null?void 0:$t.call(ie,Ct.imageHash))??"brand mark"}},{text:pt,html:Nt}=jq(Oe,wt);await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([pt],{type:"text/plain"}),"text/html":new Blob([Nt],{type:"text/html"})})])}ye(!0)}catch(Oe){P(wn(Oe,"Copy failed"))}finally{ae(!1)}}};s.useEffect(()=>{const Oe=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Oe}},[]);const $e=[{key:"download",label:"Download",icon:o.jsx(OB,{size:14}),onClick:()=>{const Oe=document.createElement("a");Oe.href=Dr(Xe),Oe.download=`${Re}.png`,Oe.click()}},{key:"keep",label:e.kept?"Remove from keepers":"Keep",icon:o.jsx(O6,{size:14,weight:e.kept?"fill":"regular"}),onClick:()=>v(e),tint:e.kept?"var(--sc-star)":void 0,on:e.kept},{key:"copy",label:"Copy image",icon:K?o.jsx(nr,{size:14,weight:"bold"}):o.jsx(wx,{size:14}),onClick:()=>void Ie(),onMenu:()=>void Ie(!0),busy:X,said:K?"Copied":void 0}],Qe=[{key:"archive",label:e.archived?"Restore":"Archive",icon:e.archived?o.jsx(dh,{size:14}):o.jsx(v7,{size:14}),onClick:()=>void st(),busy:Y},...e.archived?[{key:"delete",label:"Delete permanently",icon:o.jsx(Ep,{size:14}),onClick:()=>te(!0),tint:"var(--sc-red)",dialog:!0}]:[]],Fe=e.status==="done"&&e.images.length>0,yt=!Fe&&e.kind!=="edit"&&!!e.brief,ht=Fe?[...$e,...Qe]:Qe,yn=Fe?o.jsx(gp,{children:ht.map(Oe=>o.jsxs(Si,{onSelect:Oe.onMenu??Oe.onClick,disabled:Oe.busy,color:Oe.tint?"red":void 0,children:[Oe.icon,Oe.label]},Oe.key))}):void 0;return Mr.createPortal(o.jsx(Iu,{trapped:!0,loop:!0,asChild:!0,onMountAutoFocus:Oe=>{var wt;Oe.preventDefault(),(wt=I.current)==null||wt.focus({preventScroll:!0})},children:o.jsxs("div",{ref:I,tabIndex:-1,className:"sc-ovl","data-fb":"shot-overlay","data-fb-node":e.id,role:"dialog","aria-modal":"true","aria-label":lr(e),"data-rail":n.length>1?"":void 0,style:{"--sc-ovl-panel-w":`${Yc($)}px`},children:[n.length>1&&o.jsx(joe,{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(xr,{label:"Close (esc)",children:o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:f,"aria-label":"Close",children:o.jsx(Cn,{size:13})})}),Ae.at>=0&&n.length>1&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!Ae.prev,onClick:()=>Ae.prev&&h(Ae.prev.id),"aria-label":"Previous shot",...qe(Ae.prev,"Previous shot"),children:o.jsx(Da,{size:13})}),o.jsx("button",{type:"button",className:"sc-icon-btn",disabled:!Ae.next,onClick:()=>Ae.next&&h(Ae.next.id),"aria-label":"Next shot",...qe(Ae.next,"Next shot"),children:o.jsx(qi,{size:13})})]})]}),ht.length>0&&o.jsxs("div",{className:"sc-ovl-bar-r",children:[o.jsx("div",{className:"sc-ovl-acts",children:ht.map(Oe=>o.jsx(xr,{label:Oe.said??Oe.label,open:!!Oe.said,children:o.jsx("button",{type:"button",className:"sc-icon-btn",onClick:Oe.onClick,"aria-label":Oe.label,"aria-pressed":Oe.on===void 0?void 0:Oe.on,"data-on":Oe.on||void 0,"aria-haspopup":Oe.dialog?"dialog":void 0,"aria-busy":Oe.busy||void 0,"data-busy":Oe.busy||void 0,style:Oe.tint?{color:Oe.tint}:void 0,children:Oe.icon})},Oe.key))}),o.jsxs(Ds,{children:[o.jsx(xr,{label:"More actions",children:o.jsx(Os,{children:o.jsx("button",{type:"button",className:"sc-icon-btn sc-ovl-overflow","aria-label":"More actions",children:o.jsx($6,{size:18,weight:"bold"})})})}),o.jsx(Hs,{align:"end",sideOffset:6,children:ht.map(Oe=>o.jsxs(In,{onSelect:Oe.onMenu??Oe.onClick,disabled:Oe.busy,color:Oe.tint?"red":void 0,children:[Oe.icon,Oe.label]},Oe.key))})]})]})]}),o.jsx(z0,{open:F,onOpenChange:te,children:o.jsxs(B0,{maxWidth:"420px",children:[o.jsx(U0,{children:"Delete this shot permanently?"}),o.jsx(W0,{size:"2",children:"This cannot be undone."}),o.jsxs(vs,{gap:"3",mt:"4",justify:"end",children:[o.jsx(K0,{children:o.jsx(ra,{variant:"soft",color:"gray",children:"Cancel"})}),o.jsx(G0,{children:o.jsx(ra,{color:"red",onClick:()=>S(e),children:"Delete permanently"})})]})]})}),ke.shown&&o.jsx(Gu,{anchor:ke.shown.el,kind:"shot",noun:ke.shown.noun,src:ke.shown.src,label:ke.shown.label,onOpen:()=>{var wt;const Oe=(wt=ke.shown)==null?void 0:wt.id;ke.closeNow(),Oe&&h(Oe)},onHoverIn:ke.keep,onHoverOut:ke.close,onClose:ke.closeNow},ke.shown.key),o.jsxs("div",{className:"sc-ovl-stage","data-takes":He.length>1?"":void 0,...Ve,children:[o.jsx(voe,{node:e,onRetry:()=>p(e),onCancel:()=>g(e),engineName:A==null?void 0:A.displayName,menu:yn}),He.length>1?o.jsx(Eoe,{trail:He,activeId:e.id,names:ie,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":eR,"aria-valuemax":tR,"aria-valuenow":Yc($),tabIndex:0,onPointerDown:Oe=>{Oe.button===0&&(Oe.preventDefault(),Oe.stopPropagation(),Oe.currentTarget.setPointerCapture(Oe.pointerId))},onPointerMove:Oe=>{if(!Oe.currentTarget.hasPointerCapture(Oe.pointerId))return;const wt=Oe.currentTarget.closest(".sc-ovl");O.current=Oe.clientX,!Q.current&&(Q.current=requestAnimationFrame(()=>{Q.current=0,wt==null||wt.style.setProperty("--sc-ovl-panel-w",`${Yc(window.innerWidth-O.current)}px`)}))},onPointerUp:Oe=>{Oe.currentTarget.hasPointerCapture(Oe.pointerId)&&(Oe.currentTarget.releasePointerCapture(Oe.pointerId),H(Yc(window.innerWidth-Oe.clientX)))},onDoubleClick:Oe=>{Oe.stopPropagation(),H(m5)},onKeyDown:Oe=>{Oe.key==="ArrowLeft"?H(wt=>Yc(wt+16)):Oe.key==="ArrowRight"&&H(wt=>Yc(wt-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:he}),e.archived&&o.jsx("small",{className:"sc-ovl-flag",children:"archived"}),Fe&&e.costUsd>0&&o.jsxs("small",{className:"sc-ovl-spend",title:"Of your API budget",children:["$",e.costUsd.toFixed(2)]})]}),e.kind!=="root"&&(B||V)&&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(xr,{label:W?"Copied":"Copy the prompt",open:W||void 0,children:o.jsx("button",{type:"button",className:"sc-icon-btn sc-ovl-copy","aria-label":"Copy the prompt","aria-busy":de||void 0,"data-busy":de?"":void 0,onClick:()=>void Ye(),children:W?o.jsx(nr,{size:14,weight:"bold"}):o.jsx(wx,{size:14})})})]}),o.jsx("div",{className:"sc-brief-record",children:o.jsx(Roe,{brief:e.brief,prompt:(L==null?void 0:L.prompt)??e.promptHead,brand:i,saidRef:re,expanded:D,clamped:Pe&&!D})}),(Pe||D)&&o.jsx("button",{type:"button",className:"sc-s sc-ovl-more","aria-expanded":D,onClick:()=>G(Oe=>!Oe),children:D?o.jsxs(o.Fragment,{children:[o.jsx(TB,{size:12})," Show less"]}):o.jsxs(o.Fragment,{children:[o.jsx(_i,{size:12})," Show more"]})})]}),(Fe||yt)&&o.jsxs("div",{className:"sc-sugg",children:[yt&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>b(e),title:"Put this prompt back in the composer, to change and run again",children:[o.jsx(q0,{size:12})," Edit the prompt"]}),Fe&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>p(e),title:"Run the same setup again for a different take",children:[o.jsx(dh,{size:12})," Try again"]}),Fe&&o.jsxs("button",{type:"button",className:"sc-s",onClick:()=>b(e),title:"Start a new shot from this setup: same prompt, chips, shape and count, ready to change",children:[o.jsx(P8,{size:12})," Reuse setup"]})]})]}),(Fe||e.status==="running")&&o.jsx("div",{className:"sc-ovl-edit sc-dock",ref:ge,children:o.jsx(M4,{variant:"overlay",projectId:d,brand:i,engines:c,parentId:t,target:e,sourceImage:Xe,persistDraft:!1,onQueued:(Oe,wt,pt,Nt)=>{y(Nt??[]),Oe&&h(Oe),Oe&&(E==null||E(Oe,wt))}})})]})]})}),document.body)}function g5(){const{shotId:e}=Fs(),t=XL(),{push:n}=Sr(),r=e?t.byId.get(e)??null:null,[a,i]=s.useState(null);s.useEffect(()=>{if(!e||r)return;let f=!0;return Me.node(e).then(h=>f&&i({id:e,node:h.kind==="root"?null:h})).catch(()=>f&&i({id:e,node:null})),()=>{f=!1}},[e,r]),s.useEffect(()=>{if(!(!e||r))return t.subscribeActivity(f=>{const h=f.find(p=>p.id===e);h&&i({id:e,node:h})})},[e,r,t.subscribeActivity]);const c=r??(a!==null&&a.id===e?a.node:null),d=!r&&a!==null&&a.id===e&&a.node===null;return s.useEffect(()=>{d&&(n({kind:"info",title:"That shot is no longer available",detail:"Back to the feed."}),t.close())},[d,t.close,n]),c?o.jsx(Foe,{node:c,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,tokenNames:t.tokenNames,onRemix:t.remix,onArchive:()=>t.archive(c),onUnarchive:()=>t.unarchive(c),onDelete:()=>t.delete(c)}):d?null:o.jsx("div",{className:"sc-ovl-wait",role:"status","aria-label":"Loading",children:o.jsx(wr,{size:"3"})})}function _oe(){const e=tS();return o.jsx(vs,{align:"center",justify:"center",height:"100vh",p:"5",children:o.jsx(V6,{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(ra,{size:"1",variant:"soft",color:"gray",onClick:()=>window.location.reload(),children:"Reload"})})})}function Voe(){const{setSlug:e=""}=Fs(),{pathname:t,search:n}=_n(),{brand:r,sets:a,loaded:i,refresh:c}=Qt(),d=Dn(),f=tn({path:it.set,end:!1}),h=a.find(v=>v.slug===e)??a.find(v=>v.id===e)??null;dc(h==null?void 0:h.name);const[p,g]=s.useState(null);if(s.useEffect(()=>{if(!i||h)return;if(p===e){d(hr(r),{replace:!0});return}let v=!0;return c().finally(()=>v&&g(e)),()=>{v=!1}},[i,h,e,p,r,d,c]),s.useEffect(()=>{h&&g(null)},[h]),!i||!h)return null;if(h.slug!==e){const v=f?t.slice(f.pathnameBase.length):"";return o.jsx(no,{to:zd(r,h)+v+n,replace:!0})}return o.jsx(XM,{set:h},h.id)}function Zoe(){const{pathname:e,search:t}=_n();return o.jsx(no,{to:LU(e,t),replace:!0})}function zoe(){const{brandSlug:e}=Fs();return o.jsx(no,{to:`/${e}?settings=brand`,replace:!0})}function Boe(){const{sceneId:e}=Fs();return o.jsxs(o.Fragment,{children:[o.jsx(Mne,{},e),o.jsx(Ql,{})]})}function Uoe(){const{presenterId:e}=Fs();return o.jsxs(o.Fragment,{children:[o.jsx(Fne,{},e),o.jsx(Ql,{})]})}function Woe(){const{productId:e}=Fs();return o.jsx(Cae,{},e)}const Goe=WT([{element:o.jsx(DJ,{}),errorElement:o.jsx(_oe,{}),children:[{index:!0,element:o.jsx(eq,{})},{path:it.setup,element:o.jsx(ZJ,{})},{path:it.legacy,element:o.jsx(Zoe,{})},{path:it.brand,element:o.jsx(RJ,{}),children:[{index:!0,element:o.jsx(yne,{})},{path:it.hub,element:o.jsx(XM,{set:null}),children:[{path:it.hubShot,element:o.jsx(g5,{})}]},{path:it.set,element:o.jsx(Voe,{}),children:[{path:it.setShot,element:o.jsx(g5,{})}]},{path:it.kit,element:o.jsx(zoe,{})},{path:it.products,element:o.jsx(gae,{})},{path:it.product,element:o.jsx(Woe,{})},{path:it.scenes,element:o.jsx(kne,{}),children:[{path:it.sceneStudio,element:o.jsx(n5,{})}]},{path:it.scene,element:o.jsx(Boe,{}),children:[{path:it.sceneEdit,element:o.jsx(n5,{})}]},{path:it.presenters,element:o.jsx(One,{}),children:[{path:it.presenterStudio,element:o.jsx(Qse,{})}]},{path:it.presenter,element:o.jsx(Uoe,{}),children:[{path:it.presenterEdit,element:o.jsx(Zse,{})}]}]},{path:it.notFound,element:o.jsx(no,{to:it.root,replace:!0})}]}]),Gg=localStorage.getItem("sc-theme")??localStorage.getItem("bt-theme");document.documentElement.dataset.theme=Gg==="light"||Gg==="dark"?Gg:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";wG();TP.createRoot(document.getElementById("root")).render(o.jsx(Ln.StrictMode,{children:o.jsx(pz,{children:o.jsx(fU,{children:o.jsx(gT,{router:Goe})})})}));