PageSourceSearch

https://happykava.app/_next/static/chunks/2078.e050dfb861c455a8.js

js happykava.app collected 2026-10-02 00:44:03 UTC 11,236 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2078],{2078:(e,a,r)=>{"use strict";r.r(a),r.d(a,{DeliveryServiceAreaMap:()=>k});var t=r(95155),l=r(76503);r(35603);var i=r(12115),n=r(89559),s=r(52056),o=r(6191),d=r(7125),c=r(67830),u=r(27937),h=r(20562),p=r(8803),v=r(58008),y=r(6456),m=r(82603),b=r.n(m);let x=r.e(21761).then(r.t.bind(r,77408,23)),g=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},f=e=>{let a=Number(e);return Number.isFinite(a)?a:null};function j(e){let a=g(e),r=f(a.lat),t=f(a.lng);return null!=r&&null!=t?{lat:r,lng:t}:null}function A(e){var a;return null!=(a=({bar_location_unavailable:"Add your location’s public map address before using the service-area map.",delivery_state_conflict:"Delivery settings changed while the map was loading. Refresh the map to use the latest areas.",feature_disabled:"The map isn’t available for this location. You can still manage service areas in the list.",map_rate_limited:"The map was refreshed too often. Wait a few minutes, then try again.",not_authenticated:"Your session expired. Sign in again to load the service-area map.",not_authorized:"Owner or manager access is required to load this map."})[e])?a:"The map could not be loaded. Your service-area list still works."}function k(e){var a;let{barId:r,settingsVersion:m,zones:k,onManageAreas:w,onEditArea:M,onMoveArea:C,onPreviewAddress:_,reorderBusy:N=!1,reorderFeedback:S=null,reorderTone:z=null}=e,T=(0,i.useRef)(null),O=(0,i.useRef)(null),E=(0,i.useRef)(null),B=(0,i.useRef)(0),[P,Z]=(0,i.useState)(null),[L,R]=(0,i.useState)(!0),[Y,q]=(0,i.useState)(null),[F,V]=(0,i.useState)(!1),I=(0,i.useCallback)(async()=>{let e=++B.current;R(!0),q(null),V(!1);try{var a,t;let{data:l,error:i}=await (0,y.getSupabaseBrowserClient)().functions.invoke("delivery-service-area-map",{body:{bar_id:r,settings_version:m}}),n=g(l);if(i){let e=g(i).context;e instanceof Response&&(n=g(await e.clone().json().catch(()=>({}))));let r=String(null!=(a=n.reason_code)?a:"map_unavailable");throw Object.assign(Error(A(r)),{reason_code:r})}let s=function(e){let a=g(e);if(!0!==a.ok)return null;let r=j(a.bar_center);return r?{barCenter:r,zones:(Array.isArray(a.zones)?a.zones:[]).flatMap(e=>{var a,r,t;let l=g(e),i=String(null!=(a=l.id)?a:"").trim(),n=String(null!=(r=l.kind)?r:"");return i&&["city","town","zip","radius"].includes(n)?[{id:i,label:String(null!=(t=l.label)?t:"Service area"),kind:n,active:!0===l.active,sort_order:f(l.sort_order),center:j(l.center),radius_miles:f(l.radius_miles),bounds:function(e){let a=g(e),r=f(a.west),t=f(a.south),l=f(a.east),i=f(a.north);return null!=r&&null!=t&&null!=l&&null!=i?{west:r,south:t,east:l,north:i}:null}(l.bounds),placement:"mapped"===l.placement?"mapped":"list_only"}]:[]})}:null}(n);if(!s){let e=String(null!=(t=n.reason_code)?t:"map_unavailable");throw Object.assign(Error(A(e)),{reason_code:e})}if(e!==B.current)return;Z(s)}catch(a){if(e!==B.current)return;Z(null),q((0,l.B4)(a,A("map_unavailable")))}finally{e===B.current&&R(!1)}},[r,m]);(0,i.useEffect)(()=>(I(),()=>{B.current+=1}),[I]),(0,i.useEffect)(()=>{if(!P||!T.current)return;let e=!1,a=null;return x.then(r=>{if(e||!T.current)return;O.current=a=r.map(T.current,{center:[P.barCenter.lat,P.barCenter.lng],zoom:10,zoomControl:!1,attributionControl:!0,scrollWheelZoom:!1,keyboard:!1});let t=r.latLngBounds([]),l=r.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19});l.on("tileerror",()=>V(!0)),l.addTo(a),r.circleMarker([P.barCenter.lat,P.barCenter.lng],{radius:8,color:"#ffffff",weight:3,fillColor:"#0f172a",fillOpacity:1}).bindTooltip("Bar location",{direction:"top"}).addTo(a),t.extend([P.barCenter.lat,P.barCenter.lng]),P.zones.forEach((e,l)=>{let i=e.active?"#0f766e":"#64748b",n="".concat(l+1,". ").concat(e.label," \xb7 ").concat(e.active?"Active":"Paused");if("radius"===e.kind&&e.center&&null!=e.radius_miles){let l=r.circle([e.center.lat,e.center.lng],{radius:Math.max(1,1609.344*e.radius_miles),color:i,weight:3,opacity:e.active?.95:.72,fillColor:i,fillOpacity:e.active?.2:.09,dashArray:e.active?void 0:"8 7"}).bindTooltip(n,{sticky:!0}).addTo(a);t.extend(l.getBounds());return}
1if(e.bounds){let l=r.rectangle([[e.bounds.south,e.bounds.west],[e.bounds.north,e.bounds.east]],{color:i,weight:3,opacity:e.active?.95:.72,fillColor:i,fillOpacity:e.active?.18:.08,dashArray:e.active?void 0:"8 7"}).bindTooltip("".concat(n," \xb7 Approximate area"),{sticky:!0}).addTo(a);t.extend(l.getBounds());return}e.center&&(r.circleMarker([e.center.lat,e.center.lng],{radius:11,color:i,weight:3,fillColor:i,fillOpacity:e.active?.35:.14}).bindTooltip("".concat(n," \xb7 Approximate area")).addTo(a),t.extend([e.center.lat,e.center.lng]))}),E.current=t,t.isValid()&&a.fitBounds(t,{padding:[32,32],maxZoom:12}),window.setTimeout(()=>null==a?void 0:a.invalidateSize(),0)}),()=>{e=!0,E.current=null,O.current=null,null==a||a.remove()}},[P]);let W=null!=(a=null==P?void 0:P.zones.filter(e=>"list_only"===e.placement).length)?a:0;return(0,t.jsxs)("section",{className:b().deliveryAreaMap,"aria-labelledby":"delivery-area-map-heading",children:[(0,t.jsxs)("header",{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:b().workspaceKicker,children:"Coverage & guest pricing"}),(0,t.jsx)("h2",{id:"delivery-area-map-heading",children:"Service areas"}),(0,t.jsx)("span",{children:"See where you deliver and which minimum and fee apply when areas overlap."})]}),(0,t.jsx)("button",{onClick:w,type:"button",children:"Add area"})]}),(0,t.jsxs)("div",{className:b().deliveryAreaMapLayout,children:[(0,t.jsx)("div",{className:b().deliveryAreaMapVisual,children:L?(0,t.jsxs)("section",{className:b().deliveryAreaMapState,role:"status",children:[(0,t.jsx)(n.A,{"aria-hidden":"true"}),(0,t.jsx)("strong",{children:"Loading your service areas…"}),(0,t.jsx)("span",{children:"Your saved areas stay available in the list while the map loads."})]}):Y?(0,t.jsxs)("section",{className:b().deliveryAreaMapState,"data-tone":"warning",role:"status",children:[(0,t.jsx)(s.A,{"aria-hidden":"true"}),(0,t.jsx)("strong",{children:"Map unavailable"}),(0,t.jsx)("span",{children:Y}),(0,t.jsx)("button",{onClick:()=>void I(),type:"button",children:"Retry map"})]}):P?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"aria-hidden":"true",className:b().deliveryAreaMapCanvas,"data-testid":"delivery-service-area-map-canvas",ref:T}),(0,t.jsxs)("div",{"aria-label":"Map zoom controls",className:b().deliveryAreaMapControls,role:"group",children:[(0,t.jsx)("button",{"aria-label":"Zoom in",onClick:()=>{var e;return null==(e=O.current)?void 0:e.zoomIn()},type:"button",children:(0,t.jsx)(o.A,{"aria-hidden":"true"})}),(0,t.jsx)("button",{"aria-label":"Zoom out",onClick:()=>{var e;return null==(e=O.current)?void 0:e.zoomOut()},type:"button",children:(0,t.jsx)(d.A,{"aria-hidden":"true"})}),(0,t.jsx)("button",{"aria-label":"Fit all service areas",onClick:()=>{var e;O.current&&(null==(e=E.current)?void 0:e.isValid())&&O.current.fitBounds(E.current,{padding:[32,32],maxZoom:12})},type:"button",children:(0,t.jsx)(c.A,{"aria-hidden":"true"})})]}),F?(0,t.jsx)("p",{className:b().deliveryAreaMapWarning,role:"status",children:"The map background is temporarily unavailable. Your saved areas are still available in the list."}):null]}):null}),(0,t.jsxs)("div",{className:b().deliveryAreaMapList,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Priority order"}),(0,t.jsx)("span",{children:"The first matching area sets the guest’s minimum and delivery fee."})]}),k.length?(0,t.jsx)("ol",{children:k.map((e,a)=>(0,t.jsxs)("li",{"data-active":e.active,children:[(0,t.jsx)("span",{className:b().deliveryAreaMapOrder,"aria-hidden":"true",children:a+1}),(0,t.jsxs)("button",{className:b().deliveryAreaMapEdit,onClick:()=>M(e),type:"button",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("strong",{children:e.label}),(0,t.jsxs)("small",{children:[e.coverage," \xb7 ",e.active?"Active":"Paused"]})]}),(0,t.jsxs)("small",{className:b().deliveryAreaMapPromise,children:[e.minimumLabel," \xb7 ",e.feeLabel]}),(0,t.jsx)(u.A,{"aria-hidden":"true"})]}),(0,t.jsxs)("div",{className:b().deliveryAreaMapOrderActions,children:[(0,t.jsx)("button",{"aria-label":"Move ".concat(e.label," earlier in the delivery area order"),disabled:N||0===a,onClick:()=>C(a,-1),title:"Move earlier",type:"button",children:(0,t.jsx)(h.A,{"aria-hidden":"true"})}),(0,t.jsx)("button",{"aria-label":"Move ".concat(e.label," later in the delivery area order"),disabled:N||a===k.length-1,onClick:()=>C(a,1),title:"Move later",type:"button",children:(0,t.jsx)(p.A,{"aria-hidden":"true"})})]})]},e.id))}):(0,t.jsxs)("section",{className:b().deliveryAreaMapEmpty,role:"status",children:[(0,t.jsx)(v.A,{"aria-hidden":"true"}),(0,t.jsx)("strong",{children:"No service areas yet"}),(0,t.jsx)("span",{children:"Add a city, ZIP, or radius area to draw coverage on the map."}),(0,t.jsx)("button",{onClick:w,type:"button",children:"Add first area"})]}),S?(0,t.jsx)("p",{className:b().deliveryAreaMapFeedback,"data-tone":null!=z?z:"warning",role:"warning"===z?"alert":"status",children:S}):null,W?(0,t.jsxs)("p",{className:b().deliveryAreaMapNote,role:"status",children:[W," area",1===W?" isn’t":"s aren’t"," shown on the map right now. This does not change where you deliver."]}):(0,t.jsx)("p",{className:b().deliveryAreaMapNote,children:"City and ZIP shapes are approximate. Your saved areas determine where guests can order."}),_?(0,t.jsxs)("section",{className:b().deliveryAreaMapPreview,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Check an address"}),(0,t.jsx)("span",{children:"See which service area, minimum, and fee apply."})]}),(0,t.jsx)("button",{onClick:_,type:"button",children:"Preview address"})]}):null]})]})]})}},6191:(e,a,r)=>{"use strict";r.d(a,{A:()=>t});let t=(0,r(71847).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7125:(e,a,r)=>{"use strict";r.d(a,{A:()=>t});let t=(0,r(71847).A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},8803:(e,a,r)=>{"use strict";r.d(a,{A:()=>t});let t=(0,r(71847).A)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},20562:(e,a,r)=>{"use strict";r.d(a,{A:()=>t});let t=(0,r(71847).A)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]])},35603:()=>{},58008:(e,a,r)=>{"use strict";r.d(a,{A:()=>t});let t=(0,r(71847).A)("map-pinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]])},67830:(e,a,r)=>{"use strict";r.d(a,{A:()=>t});let t=(0,r(71847).A)("locate-fixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}
1],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.