import{B as e,C as t,D as n,E as r,H as i,K as a,R as o,_ as s,c,d as l,dt as u,f as ee,ft as d,g as te,i as f,j as p,k as m,m as h,p as g,pt as _,s as v,t as y,u as b,v as x,z as S}from"./_plugin-vue_export-helper-DRLwVS0w.js";import{c as ne,d as re,l as ie,p as ae,s as oe,u as C}from"./index-CmcHGdN5.js";import{i as w,n as T,r as se,t as ce}from"./BaseBottomSheet-BJ-4S2HL.js";import{t as le}from"./PullToRefresh-D9_uAhZQ.js";var E=`https://pictureframe.edholm.me/devices/`;function ue(){let{devices:e}=f(w()),t=new Map,r=new Map,i=window.__PF_MERCURE_URL__;if(!i)return{connectedCount:()=>0};function a(n){if(!t.has(n))try{let o=new URL(i);o.searchParams.append(`topic`,E+n);let c=new EventSource(o.toString(),{withCredentials:!0});c.onmessage=t=>{try{let n=JSON.parse(t.data);if(`deleted`in n&&n.deleted===!0){e.value=e.value.filter(e=>e.id!==n.id),s(n.id);return}let r=n,i=e.value.findIndex(e=>e.id===r.id);i!==-1&&(e.value[i]=r)}catch(e){console.warn(`[mercure] parse error`,e)}},c.onerror=()=>{if(c.readyState===EventSource.CLOSED){s(n);let e=window.setTimeout(()=>{r.delete(n),a(n)},5e3);r.set(n,e)}},t.set(n,c)}catch(e){console.warn(`[mercure] open failed for device `+n,e)}}function s(e){let n=t.get(e);n&&(n.close(),t.delete(e));let i=r.get(e);i!==void 0&&(clearTimeout(i),r.delete(e))}return o(e,e=>{let n=new Set(e.map(e=>e.id));for(let e of n)t.has(e)||a(e);for(let e of[...t.keys()])n.has(e)||s(e)},{immediate:!0,deep:!1}),n(()=>{for(let e of[...t.keys()])s(e)}),{connectedCount:()=>t.size}}var D=[`src`,`alt`],O={class:`frame-card__body`},k={class:`frame-card__info`},de={class:`frame-card__name`},A={class:`frame-card__status-line`,"aria-live":`polite`},j={class:`frame-card__status-text`},fe={key:0,class:`frame-card__sync-line`},M={key:0},N={key:1,class:`frame-card__sync-sep`,"aria-hidden":`true`},P={key:2},F={key:1,class:`frame-card__count`},I={key:0},L={key:1,"aria-hidden":`true`},R=y(x({__name:`FrameCard`,props:{deviceId:{},name:{},size:{},status:{},orientation:{},thumbnailUrl:{},photoCount:{},lastSync:{},nextSync:{}},emits:[`add-photo`,`edit`],setup(e){let t=e,n=b(()=>({})),r=b(()=>t.size===`large`?{aspectRatio:t.orientation===`portrait`?`3 / 5`:`5 / 3`}:{}),i=b(()=>{switch(t.status){case`ok`:return`Online`;case`sync-fail`:return`Sync issue`;case`offline`:return`Offline`}});return(t,a)=>(m(),h(`div`,{class:u([`frame-card`,`frame-card--${e.size}`,`frame-card--${e.status}`])},[e.size===`large`?(m(),h(`button`,{key:0,class:`frame-card__settings-btn`,type:`button`,"aria-label":`Frame settings`,onClick:a[0]||=n=>t.$emit(`edit`,e.deviceId)},[...a[2]||=[l(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"aria-hidden":`true`},[l(`circle`,{cx:`12`,cy:`12`,r:`3`}),l(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})],-1)]])):g(``,!0),l(`div`,{class:`frame-card__preview`,style:d(n.value)},[e.thumbnailUrl?(m(),h(`img`,{key:0,src:e.thumbnailUrl,alt:`Current photo on ${e.name}`,class:`frame-card__img`},null,8,D)):(m(),h(`div`,{key:1,class:`frame-card__empty-preview`,style:d(r.value),"aria-hidden":`true`},[...a[3]||=[l(`svg`,{width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),l(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),l(`polyline`,{points:`21,15 16,10 5,21`})],-1)]],4))],4),l(`div`,O,[l(`div`,k,[l(`p`,de,_(e.name),1),l(`p`,A,[a[4]||=l(`span`,{class:`frame-card__status-dot`,"aria-hidden":`true`},null,-1),l(`span`,j,_(i.value),1)]),e.size===`large`&&(e.lastSync||e.nextSync)?(m(),h(`p`,fe,[e.lastSync?(m(),h(`span`,M,`synced `+_(e.lastSync),1)):g(``,!0),e.lastSync&&e.nextSync?(m(),h(`span`,N,`·`)):g(``,!0),e.nextSync?(m(),h(`span`,P,_(e.nextSync),1)):g(``,!0)])):e.size===`compact`&&e.photoCount!==void 0?(m(),h(`p`,F,_(e.photoCount)+` `+_(e.photoCount===1?`photo`:`photos`),1)):g(``,!0)]),s(T,{variant:e.size===`large`?`primary`:`icon-pill`,"aria-label":`Add photo to ${e.name}`,class:`frame-card__add-btn`,onClick:a[1]||=n=>t.$emit(`add-photo`,e.deviceId)},{default:S(()=>[e.size===`large`?(m(),h(`span`,I,`+ Add Photo`)):(m(),h(`span`,L,`+`))]),_:1},8,[`variant`,`aria-label`])])],2))}}),[[`__scopeId`,`data-v-608d39a4`]]),z=[`id`,`value`,`type`],B=[`for`],V=[`id`],pe=y(x({__name:`BaseInput`,props:{modelValue:{default:``},label:{},type:{default:`text`},error:{},id:{}},emits:[`update:modelValue`,`blur`],setup(e,{emit:n}){let r=e,i=n,a=b(()=>r.id??`input-${Math.random().toString(36).slice(2)}`);return(n,r)=>(m(),h(`div`,{class:u([`input-wrap`,{"input-wrap--error":!!e.error,"input-wrap--filled":!!e.modelValue}])},[l(`input`,t({id:a.value},n.$attrs,{value:e.modelValue,type:e.type,class:`input-wrap__field`,placeholder:` `,onInput:r[0]||=e=>i(`update:modelValue`,e.target.value),onBlur:r[1]||=e=>i(`blur`,e)}),null,16,z),l(`label`,{for:a.value,class:`input-wrap__label`},_(e.label),9,B),e.error?(m(),h(`p`,{key:0,id:`${a.value}-error`,class:`input-wrap__error`,role:`alert`},_(e.error),9,V)):g(``,!0)],2))}}),[[`__scopeId`,`data-v-c8235ab2`]]),H={class:`orientation-picker`,role:`radiogroup`,"aria-label":`Display orientation`},U=[`aria-checked`,`aria-label`,`onClick`],W=[`viewBox`],G=[`stroke`,`fill`],K=[`fill`],q={class:`orientation-opt__label`},J={class:`orientation-opt__sub`},me=y(x({__name:`OrientationPicker`,props:{modelValue:{}},emits:[`update:modelValue`],setup(e){let n=[{value:`landscape`,label:`Landscape`,sub:`Ribbon at bottom`,viewBox:`0 0 48 48`,rect:{x:4,y:12,width:40,height:24},ribbon:{x:20,y:36,width:8,height:5}},{value:`portrait`,label:`Portrait`,sub:`Ribbon on left`,viewBox:`0 0 48 48`,rect:{x:12,y:4,width:24,height:40},ribbon:{x:7,y:20,width:5,height:8}}];return(r,i)=>(m(),h(`div`,H,[(m(),h(v,null,p(n,n=>l(`button`,{key:n.value,type:`button`,role:`radio`,"aria-checked":e.modelValue===n.value,"aria-label":n.label,class:u([`orientation-opt`,{"orientation-opt--active":e.modelValue===n.value}]),onClick:e=>r.$emit(`update:modelValue`,n.value)},[(m(),h(`svg`,{class:`orientation-opt__diagram`,viewBox:n.viewBox,fill:`none`,"aria-hidden":`true`},[l(`rect`,t({ref_for:!0},n.rect,{rx:`2`,stroke:e.modelValue===n.value?`var(--color-primary)`:`currentColor`,"stroke-width":`1.5`,fill:e.modelValue===n.value?`color-mix(in srgb, var(--color-primary) 12%, transparent)`:`var(--color-surface-2)`}),null,16,G),l(`rect`,t({ref_for:!0},n.ribbon,{fill:e.modelValue===n.value?`var(--color-primary)`:`var(--color-text-muted)`,rx:`1`}),null,16,K)],8,W)),l(`span`,q,_(n.label),1),l(`span`,J,_(n.sub),1)],10,U)),64))]))}}),[[`__scopeId`,`data-v-679dae08`]]),he={class:`home-view`},ge={key:0,class:`home-view__loading`,"aria-live":`polite`},_e={key:1,class:`home-view__empty`},ve={key:2,class:`home-view__single`},ye=[`aria-label`],be={class:`home-view__sheet-field`},xe={class:`home-view__sheet-field`},Se={class:`home-view__sheet-field`},Ce={key:0,class:`home-view__times-mode`},we={class:`home-view__times-list`},Te=[`value`,`onChange`],Ee=[`value`],De=[`value`,`onChange`],Oe=[`value`],ke=[`value`,`onChange`],Ae=[`aria-label`,`onClick`],je={key:0,class:`home-view__times-empty`},Me=[`label`],Ne=[`value`],Pe={key:1,class:`home-view__interval-mode`},Fe={class:`home-view__interval-input-row`},Ie={class:`home-view__next-update`,"aria-live":`polite`},Le={class:`home-view__sheet-field`},Re={class:`home-view__rotation-checkbox`},ze={class:`home-view__remove-modal-card`},Be={class:`home-view__remove-confirm-actions`},Ve=[`disabled`],He=[`disabled`],Y=y(x({__name:`HomeView`,setup(t){function o(e){return e.wakeTimes.length>0?1440*60*1e3:e.rotationIntervalMinutes*6e4}function u(e){if(!e.lastSeenAt)return`offline`;let t=Date.now()-new Date(e.lastSeenAt).getTime(),n=o(e);return t<=n?`ok`:t<=2*n?`sync-fail`:`offline`}function d(e){if(!e.lastSeenAt)return null;let t=Date.now()-new Date(e.lastSeenAt).getTime();if(t<6e4)return`just now`;if(t<36e5)return`${Math.round(t/6e4)}m ago`;if(t<864e5)return`${Math.round(t/36e5)}h ago`;let n=Math.round(t/864e5);return n===1?`yesterday`:`${n} days ago`}function f(e){let t=Math.floor(e/60),n=e%60,r=t>=12?`PM`:`AM`,i=t%12;i===0&&(i=12);let a=n===0?``:`:${String(n).padStart(2,`0`)}`;return`${i}${a} ${r}`}function y(e,t){let n=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(e),r=parseInt(n.find(e=>e.type===`hour`)?.value??`0`,10),i=parseInt(n.find(e=>e.type===`minute`)?.value??`0`,10);return r*60+i}function x(e,t){if(e.length===0)return null;let n=y(new Date,t),r=null,i=1/0;for(let t of e){let e=t>n?t-n:1440+(t-n);en})}return r}function E(e){let t=null;if(e.nextPollExpectedAt)t=new Date(e.nextPollExpectedAt).getTime();else if(e.wakeTimes.length>0){let t=x(e.wakeTimes,e.timezone||`UTC`);return t?`next sync ~${f(t.minutes)} ${t.today?`today`:`tomorrow`}`:null}else if(e.lastSeenAt)t=new Date(e.lastSeenAt).getTime()+e.rotationIntervalMinutes*6e4;else return null;let n=t-Date.now();if(n<=0)return null;if(n<6e4)return`next sync in <1m`;if(n<36e5)return`next sync in ${Math.round(n/6e4)}m`;if(n<864e5){let n=e.timezone||`UTC`,r=y(new Date(t),n),i=Je(new Date(t),n),a=i===0?`today`:i===1?`tomorrow`:`in ${i}d`;return`next sync ~${f(r)} ${a}`}return`next sync in ${Math.round(n/864e5)}d`}function D(e){return e.currentImageId?`/api/devices/${e.id}/preview?v=${e.currentImageId}`:void 0}let O=oe(),k=w(),de=se();ue(),r(()=>{k.fetchDevices(),document.addEventListener(`visibilitychange`,A)}),n(()=>{document.removeEventListener(`visibilitychange`,A)});function A(){document.visibilityState===`visible`&&k.fetchDevices({silent:!0})}let j=i(null);function fe(){return window.scrollY>0?!1:(j.value?.scrollTop??0)===0}async function M(){await k.fetchDevices({silent:!0})}function N(e){let t=document.createElement(`input`);t.type=`file`,t.accept=`image/jpeg,image/png,image/webp,image/gif`,t.onchange=()=>{let n=t.files?.[0];n&&(de.init(n,e),O.push(`/upload`))},t.click()}let P=[1,2,3,4,5,6,7,8,9,10,11,12],F=[0,5,10,15,20,25,30,35,40,45,50,55];function I(e){let t=Math.floor(e/60),n=e%60,r=t>=12?`PM`:`AM`,i=t%12;return i===0&&(i=12),{h:i,mm:n,p:r}}function L(e,t,n){let r=e%12;return n===`PM`&&(r+=12),r*60+t}let z=[{label:`Americas`,zones:[{value:`America/New_York`,label:`Eastern — New York, Toronto`},{value:`America/Chicago`,label:`Central — Chicago, Mexico City`},{value:`America/Denver`,label:`Mountain — Denver, Calgary`},{value:`America/Phoenix`,label:`Mountain (no DST) — Phoenix`},{value:`America/Los_Angeles`,label:`Pacific — Los Angeles, Vancouver`},{value:`America/Anchorage`,label:`Alaska — Anchorage`},{value:`Pacific/Honolulu`,label:`Hawaii — Honolulu`},{value:`America/Sao_Paulo`,label:`Brasília — São Paulo`},{value:`America/Argentina/Buenos_Aires`,label:`Argentina — Buenos Aires`},{value:`America/Bogota`,label:`Colombia — Bogotá`}]},{label:`Europe`,zones:[{value:`Europe/London`,label:`GMT/BST — London, Dublin`},{value:`Europe/Lisbon`,label:`WET/WEST — Lisbon`},{value:`Europe/Paris`,label:`CET/CEST — Paris, Brussels, Amsterdam`},{value:`Europe/Berlin`,label:`CET/CEST — Berlin, Vienna, Zurich`},{value:`Europe/Stockholm`,label:`CET/CEST — Stockholm, Oslo, Copenhagen`},{value:`Europe/Helsinki`,label:`EET/EEST — Helsinki, Tallinn, Riga`},{value:`Europe/Warsaw`,label:`CET/CEST — Warsaw, Prague, Budapest`},{value:`Europe/Rome`,label:`CET/CEST — Rome, Madrid`},{value:`Europe/Athens`,label:`EET/EEST — Athens, Bucharest`},{value:`Europe/Istanbul`,label:`TRT — Istanbul`},{value:`Europe/Moscow`,label:`MSK — Moscow`}]},{label:`Asia & Pacific`,zones:[{value:`Asia/Dubai`,label:`GST — Dubai, Abu Dhabi`},{value:`Asia/Karachi`,label:`PKT — Karachi, Islamabad`},{value:`Asia/Kolkata`,label:`IST — India`},{value:`Asia/Dhaka`,label:`BST — Dhaka, Bangladesh`},{value:`Asia/Bangkok`,label:`ICT — Bangkok, Jakarta, Hanoi`},{value:`Asia/Singapore`,label:`SGT — Singapore, Kuala Lumpur`},{value:`Asia/Shanghai`,label:`CST — Beijing, Shanghai, Taipei`},{value:`Asia/Seoul`,label:`KST — Seoul`},{value:`Asia/Tokyo`,label:`JST — Tokyo`},{value:`Australia/Sydney`,label:`AEDT/AEST — Sydney, Melbourne`},{value:`Australia/Brisbane`,label:`AEST (no DST) — Brisbane`},{value:`Australia/Perth`,label:`AWST — Perth`},{value:`Pacific/Auckland`,label:`NZDT/NZST — Auckland`}]},{label:`Africa & Middle East`,zones:[{value:`Africa/Cairo`,label:`EET — Cairo`},{value:`Africa/Nairobi`,label:`EAT — Nairobi, East Africa`},{value:`Africa/Johannesburg`,label:`SAST — Johannesburg`},{value:`Africa/Lagos`,label:`WAT — Lagos, West Africa`}]},{label:`UTC`,zones:[{value:`UTC`,label:`UTC — Coordinated Universal Time`}]}],B=i(!1),V=i(!1),H=i(!1),U=i(!1),W=i(null),G=i(``),K=i(`landscape`),q=i(`interval`),J=i([]),Y=i(60),X=i(`UTC`),Z=i(`oldest_upload`),Q=i(!1),Ue=[540,1080,720,1260,360,900,450,1170,0];function We(){for(let e of Ue)if(!J.value.includes(e)){J.value=[...J.value,e];return}for(let e=0;e<1440;e+=5)if(!J.value.includes(e)){J.value=[...J.value,e];return}}function Ge(e){J.value=J.value.filter((t,n)=>n!==e)}function $(e,t,n){let r=I(J.value[e]),i=t===`h`?parseInt(n,10):r.h,a=t===`mm`?parseInt(n,10):r.mm,o=t===`p`?n:r.p,s=[...J.value];s[e]=L(i,a,o),J.value=s}let Ke=b(()=>{let e=W.value;if(!e)return``;let t=e.timezone||`UTC`,n;if(e.nextPollExpectedAt)n=new Date(e.nextPollExpectedAt).getTime();else if(e.lastSeenAt){let r=new Date(e.lastSeenAt).getTime();n=e.wakeTimes.length>0?qe(r,e.wakeTimes,t):r+e.rotationIntervalMinutes*6e4}else return`Next update: when the frame next connects`;return nt.id===e);t&&(W.value=t,G.value=t.name,K.value=t.orientation,X.value=t.timezone??`UTC`,Y.value=t.rotationIntervalMinutes,J.value=[...t.wakeTimes],q.value=t.wakeTimes.length>0?`times`:`interval`,Z.value=t.rotationMode,Q.value=t.prioritizeNeverShown,U.value=!1,B.value=!0)}async function Ze(){if(W.value){H.value=!0;try{await k.removeDevice(W.value.id),B.value=!1,U.value=!1}finally{H.value=!1}}}async function Qe(){if(W.value){V.value=!0;try{let e={name:G.value.trim()||W.value.name,orientation:K.value,timezone:X.value,rotationMode:Z.value,prioritizeNeverShown:Q.value};q.value===`times`?e.wakeTimes=[...J.value]:(e.wakeTimes=[],e.rotationIntervalMinutes=Math.max(1,Math.min(1440,Y.value||1))),await k.updateDevice(W.value.id,e),B.value=!1}finally{V.value=!1}}}return(t,n)=>(m(),h(v,null,[l(`main`,he,[s(le,{"is-at-top":fe,"on-refresh":M},{default:S(()=>[a(k).loading?(m(),h(`div`,ge,` Loading… `)):a(k).devices.length===0?(m(),h(`div`,_e,[...n[11]||=[l(`div`,{class:`home-view__empty-card`},[l(`svg`,{class:`home-view__empty-icon`,width:`48`,height:`48`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"aria-hidden":`true`},[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),l(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),l(`polyline`,{points:`21,15 16,10 5,21`})]),l(`p`,{class:`home-view__empty-title`},`Set up your first frame`),l(`p`,{class:`home-view__empty-sub`},` Power on your pictureFrame device and scan the QR code it displays to get started. `)],-1)]])):a(k).devices.length===1?(m(),h(`div`,ve,[s(R,{deviceId:a(k).devices[0].id,name:a(k).devices[0].name,size:`large`,status:u(a(k).devices[0]),orientation:a(k).devices[0].orientation,thumbnailUrl:D(a(k).devices[0]),lastSync:d(a(k).devices[0]),nextSync:E(a(k).devices[0]),onAddPhoto:N,onEdit:Xe},null,8,[`deviceId`,`name`,`status`,`orientation`,`thumbnailUrl`,`lastSync`,`nextSync`])])):(m(),h(`div`,{key:3,ref_key:`stackEl`,ref:j,class:`home-view__stack`,role:`list`,"aria-label":`Frames`},[(m(!0),h(v,null,p(a(k).devices,e=>(m(),h(`div`,{key:e.id,class:`home-view__slide`,role:`listitem`,"aria-label":e.name},[s(R,{deviceId:e.id,name:e.name,size:`large`,status:u(e),orientation:e.orientation,thumbnailUrl:D(e),lastSync:d(e),nextSync:E(e),onAddPhoto:N,onEdit:Xe},null,8,[`deviceId`,`name`,`status`,`orientation`,`thumbnailUrl`,`lastSync`,`nextSync`])],8,ye))),128))],512))]),_:1})]),s(ce,{modelValue:B.value,"onUpdate:modelValue":n[8]||=e=>B.value=e,label:`Frame settings`},{default:S(()=>[n[24]||=l(`h2`,{class:`home-view__sheet-title`},`Frame settings`,-1),l(`div`,be,[s(pe,{modelValue:G.value,"onUpdate:modelValue":n[0]||=e=>G.value=e,label:`Frame name`,maxlength:`100`},null,8,[`modelValue`])]),l(`div`,xe,[n[12]||=l(`p`,{class:`home-view__sheet-label`},`Orientation`,-1),s(me,{modelValue:K.value,"onUpdate:modelValue":n[1]||=e=>K.value=e},null,8,[`modelValue`])]),l(`div`,Se,[n[19]||=l(`p`,{class:`home-view__sheet-label`},`Update frequency`,-1),e(l(`select`,{class:`home-view__mode-select`,"onUpdate:modelValue":n[2]||=e=>q.value=e,"aria-label":`Update frequency mode`},[...n[13]||=[l(`option`,{value:`times`},`At specific time(s)`,-1),l(`option`,{value:`interval`},`Every X minutes`,-1)]],512),[[C,q.value]]),q.value===`times`?(m(),h(`div`,Ce,[l(`div`,we,[(m(!0),h(v,null,p(J.value,(e,t)=>(m(),h(`div`,{key:t,class:`home-view__time-row`},[l(`select`,{class:`home-view__time-part`,value:I(e).h,"aria-label":`Hour`,onChange:e=>$(t,`h`,e.target.value)},[(m(),h(v,null,p(P,e=>l(`option`,{key:e,value:e},_(e),9,Ee)),64))],40,Te),n[16]||=l(`span`,{class:`home-view__time-sep`},`:`,-1),l(`select`,{class:`home-view__time-part`,value:I(e).mm,"aria-label":`Minutes`,onChange:e=>$(t,`mm`,e.target.value)},[(m(),h(v,null,p(F,e=>l(`option`,{key:e,value:e},_(String(e).padStart(2,`0`)),9,Oe)),64))],40,De),l(`select`,{class:`home-view__time-part home-view__time-part--ampm`,value:I(e).p,"aria-label":`AM or PM`,onChange:e=>$(t,`p`,e.target.value)},[...n[14]||=[l(`option`,{value:`AM`},`AM`,-1),l(`option`,{value:`PM`},`PM`,-1)]],40,ke),l(`button`,{type:`button`,class:`home-view__time-remove`,"aria-label":`Remove ${f(e)}`,onClick:e=>Ge(t)},[...n[15]||=[l(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[l(`polyline`,{points:`3 6 5 6 21 6`}),l(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),l(`path`,{d:`M10 11v6`}),l(`path`,{d:`M14 11v6`})],-1)]],8,Ae)]))),128)),J.value.length===0?(m(),h(`p`,je,`No update times yet — add one below.`)):g(``,!0)]),l(`button`,{type:`button`,class:`home-view__time-add`,onClick:We},`+ Add time`),e(l(`select`,{class:`home-view__tz-select`,"onUpdate:modelValue":n[3]||=e=>X.value=e},[(m(),h(v,null,p(z,e=>l(`optgroup`,{key:e.label,label:e.label},[(m(!0),h(v,null,p(e.zones,e=>(m(),h(`option`,{key:e.value,value:e.value},_(e.label),9,Ne))),128))],8,Me)),64))],512),[[C,X.value]])])):(m(),h(`div`,Pe,[l(`div`,Fe,[n[17]||=l(`span`,null,`Every`,-1),e(l(`input`,{type:`number`,inputmode:`numeric`,pattern:`[0-9]*`,min:`1`,max:`1440`,class:`home-view__interval-input`,"onUpdate:modelValue":n[4]||=e=>Y.value=e,"aria-label":`Update interval in minutes`},null,512),[[re,Y.value,void 0,{number:!0}]]),n[18]||=l(`span`,null,`minutes`,-1)])])),l(`p`,Ie,_(Ke.value),1),n[20]||=l(`p`,{class:`home-view__propagation-note`},` Changes will only take effect at the next device update. To force an immediate refresh, briefly disconnect and reconnect the frame’s power. `,-1)]),l(`div`,Le,[n[23]||=l(`p`,{class:`home-view__sheet-label`},`Image selection`,-1),e(l(`select`,{class:`home-view__mode-select`,"onUpdate:modelValue":n[5]||=e=>Z.value=e,"aria-label":`Image selection mode`},[...n[21]||=[l(`option`,{value:`oldest_upload`},`Oldest upload first`,-1),l(`option`,{value:`newest_upload`},`Newest upload first`,-1),l(`option`,{value:`least_recently_shown`},`Least recently shown`,-1),l(`option`,{value:`random`},`Random`,-1)]],512),[[C,Z.value]]),l(`label`,Re,[e(l(`input`,{type:`checkbox`,"onUpdate:modelValue":n[6]||=e=>Q.value=e},null,512),[[ie,Q.value]]),n[22]||=l(`span`,null,`Show never-shown images first`,-1)])]),s(T,{variant:`primary`,class:`home-view__sheet-save`,disabled:V.value,onClick:Qe},{default:S(()=>[te(_(V.value?`Saving…`:`Save`),1)]),_:1},8,[`disabled`]),l(`button`,{type:`button`,class:`home-view__remove`,onClick:n[7]||=e=>U.value=!0},`Remove this frame`)]),_:1},8,[`modelValue`]),(m(),ee(c,{to:`body`},[s(ne,{name:`home-view__remove-modal`},{default:S(()=>[U.value?(m(),h(`div`,{key:0,class:`home-view__remove-modal`,role:`alertdialog`,"aria-labelledby":`remove-confirm-title`,onClick:n[10]||=ae(e=>U.value=!1,[`self`])},[l(`div`,ze,[n[25]||=l(`p`,{class:`home-view__remove-confirm-title`,id:`remove-confirm-title`},` Remove this frame? `,-1),n[26]||=l(`p`,{class:`home-view__remove-confirm-body`},` Use this if you’re selling or giving away the frame. It deletes this frame from your account and unlinks it from your photos so the next owner can claim it fresh. This can’t be undone. `,-1),n[27]||=l(`p`,{class:`home-view__remove-confirm-aside`},` On the frame itself, the new owner can also do a factory reset by holding the small button on the back until the screen starts to flash. (If they only tap it briefly, the frame just refreshes its current image — keep holding until it flashes.) `,-1),l(`div`,Be,[l(`button`,{type:`button`,class:`home-view__remove-cancel`,disabled:H.value,onClick:n[9]||=e=>U.value=!1},`Cancel`,8,Ve),l(`button`,{type:`button`,class:`home-view__remove-confirm-btn`,disabled:H.value,onClick:Ze},_(H.value?`Removing…`:`Yes, remove`),9,He)])])])):g(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-d4264301`]]);export{Y as default};