UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 2.88 kB
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Aa as n,lo as r}from"./control-ui-connection-Bfj9beF_.js";var i=t({LOBSTER_FAMILIARITY_TUNING:()=>x,getLobsterFamiliarity:()=>h,getLobsterdex:()=>s,getLobsterdexEntries:()=>c,isLobsterFirstVisitAnniversary:()=>_,lobsterHonorific:()=>g,recordLobsterArrivalStats:()=>p,recordLobsterShoo:()=>m,recordLobsterVisit:()=>u,subscribeLobsterdex:()=>l});function a(){try{let e=n()?.getItem(v),t=e?JSON.parse(e):{},r=new Map;if(Array.isArray(t)){for(let e of t)typeof e==`string`&&e&&r.set(e,{firstSeenAt:null,name:null,shinySeenAt:null});return r}if(t&&typeof t==`object`)for(let[e,n]of Object.entries(t))e&&r.set(e,{firstSeenAt:typeof n?.firstSeenAt==`number`?n.firstSeenAt:null,name:typeof n?.name==`string`&&n.name?n.name:null,shinySeenAt:typeof n?.shinySeenAt==`number`?n.shinySeenAt:null});return r}catch{return new Map}}function o(e){let t={};for(let[n,r]of[...e.entries()].toSorted(([e],[t])=>e.localeCompare(t)))t[n]={...r.firstSeenAt===null?{}:{firstSeenAt:r.firstSeenAt},...r.name===null?{}:{name:r.name},...r.shinySeenAt===null?{}:{shinySeenAt:r.shinySeenAt}};let r=n();r&&(r.setItem(v,JSON.stringify(t)),window.dispatchEvent(new Event(b)))}function s(){return new Set(a().keys())}function c(){return a()}function l(e){let t=()=>e(),i=t=>{t.storageArea===n()&&(t.key===v||t.key===null)&&e()},a=r(window,b,t),o=r(window,`storage`,i);return()=>{a(),o()}}function u(e,t={}){try{let n=a(),r=n.get(e);if(r){let e=t.shiny===!0&&r.shinySeenAt===null;if(r.firstSeenAt!==null&&r.name!==null&&!e)return}n.set(e,{firstSeenAt:r?.firstSeenAt??Date.now(),name:r?.name??t.name??null,shinySeenAt:r?.shinySeenAt??(t.shiny===!0?Date.now():null)}),o(n)}catch{}}function d(){try{let e=n()?.getItem(y),t=e?JSON.parse(e):{},r=t&&typeof t==`object`?t:{};return{visits:typeof r.visits==`number`&&r.visits>=0?r.visits:0,shoos:typeof r.shoos==`number`&&r.shoos>=0?r.shoos:0}}catch{return{visits:0,shoos:0}}}function f(e){try{n()?.setItem(y,JSON.stringify(e))}catch{}}function p(){let e=d();f({...e,visits:e.visits+1})}function m(){let e=d();f({...e,shoos:e.shoos+1})}function h(){let{visits:e,shoos:t}=d();return{tier:e<3?`shy`:e<15?`regular`:`friend`,wary:t>=3&&t>e*.3,visits:e,shoos:t}}function g(e){return S.find(([t])=>e>=t)?.[1]??null}function _(e,t){if(e===null||t.getTime()-e<C)return!1;let n=new Date(e);return n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()}var v,y,b,x,S,C;function w(){return(w=e((()=>{v=`openclaw.control.lobsterdex.v1`,y=`openclaw.control.lobsterpet.familiarity.v1`,b=`openclaw:lobsterdex-changed`,x={shy:{stayMul:.6,firstDelayMul:1.3,gapMul:1},regular:{stayMul:1,firstDelayMul:1,gapMul:1},friend:{stayMul:1.6,firstDelayMul:.7,gapMul:.8},waryGapMul:1.7},S=[[250,`Elder`],[100,`Captain`],[50,`Sir`]],C=2592e7})))()}export{w as a,i as c,u as d,l as f,c as i,p as l,h as n,_ as o,s as r,g as s,x as t,m as u};