lecodes-cli 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +8 -8
- package/runtime/sdk-types.json +1 -1
- package/runtime/web/VERSION.json +3 -3
- package/runtime/web/assets/{inspect-DdJ50Kun.js → inspect-CE4HRex9.js} +1 -1
- package/runtime/web/assets/keyboardMotion-C2Bk5H0n.js +1 -0
- package/runtime/web/assets/{map-XzoOFt0E.js → map-8PhtP3jn.js} +2 -2
- package/runtime/web/assets/{mapImpl-bxvQ2h1Z.js → mapImpl-DS04r04e.js} +2 -2
- package/runtime/web/index.html +1 -0
- package/runtime/web/keyboard.js +18 -0
- package/runtime/web/player.js +16 -16
- package/runtime/web-lite/lite.js +1 -1
- package/runtime/web-page/page.js +23 -5
package/runtime/web/VERSION.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const h=new Map,P=t=>{h.clear();const n=t.ui;globalThis.__lecodesCaptureSites=n?(i,f,c)=>{h.set(n.lastCreated,{site:f,element:new WeakRef(c)})}:void 0},j=(t,n=0)=>{var i;return typeof t=="function"?"ƒ":t===null||typeof t!="object"?t:Array.isArray(t)?n<3?t.map(f=>j(f,n+1)):"[…]":Object.getPrototypeOf(t)!==Object.prototype?`${((i=t.constructor)==null?void 0:i.name)??"object"}`:n>=3?"{…}":Object.fromEntries(Object.entries(t).filter(([,f])=>f!==void 0).map(([f,c])=>[f,j(c,n+1)]))},k=t=>{const n=t==null?void 0:t._style;if(!n||typeof n!="object")return;const i=j(n);return Object.keys(i).length>0?i:void 0},w=t=>"#"+(t>>>0).toString(16).padStart(8,"0"),a=t=>Math.round(t*100)/100,A={opacity:1,dim:0,overflow:"visible",scrollAxis:"y",letterSpacing:0,lineClamp:0,textDecoration:"none",fontStyle:"normal",textAlign:"start",textOverflow:"ellipsis",backgroundSize:"cover",objectFit:"cover",inputType:"text"},_=new Set(["color","fontSize","fontFamily","fontWeight","fontStyle","lineHeight","letterSpacing","textAlign","textDecoration","lineClamp","textOverflow"]),C=new Set(["placeholder","placeholderColor","inputType"]),F=t=>{const n=t;return n.x===50&&n.y===50&&n.xPercent&&n.yPercent},O=t=>Array.isArray(t)?t.map(n=>typeof n=="object"&&n!==null?O(n):String(n)).join(" "):typeof t=="object"&&t!==null?Object.entries(t).map(([n,i])=>`${n}: ${typeof i=="object"&&i!==null?O(i):String(i)}`).join(", "):String(t),T=(t,n)=>{const i={},f=t==="text"||t==="input"||t==="textarea";for(const[c,o]of Object.entries(n))if(!(o==null||o==="")&&A[c]!==o&&!(_.has(c)&&!f)&&!(C.has(c)&&t!=="input"&&t!=="textarea")&&!(c==="objectFit"&&t!=="image"&&t!=="video")&&!(c==="transformOrigin"&&F(o))&&!(typeof o=="number"&&/color$/i.test(c)&&(o&255)===0))if(typeof o=="number"&&/color$/i.test(c))i[c]=w(o);else if(c==="border"&&typeof o=="object"){const e=Object.entries(o).filter(([,r])=>r&&r.width>0).map(([r,l])=>[r,`${a(l.width)}px ${w(l.color)}`]);if(e.length===4&&e.every(([,r])=>r===e[0][1]))i.border=e[0][1];else for(const[r,l]of e)i[`border${r[0].toUpperCase()}${r.slice(1)}`]=l}else if(c==="borderRadius"&&typeof o=="object"){const e=o;(e.tl||e.tr||e.br||e.bl)&&(i[c]=e.tl===e.tr&&e.tr===e.br&&e.br===e.bl?e.tl:[e.tl,e.tr,e.br,e.bl].map(a).join(" "))}else if(c==="backgroundGradients")Array.isArray(o)&&o.length>0&&(i[c]=`${o.length} gradient${o.length>1?"s":""}`);else if(c==="transform"&&Array.isArray(o))i[c]=`matrix(${o.map(e=>a(Number(e))).join(", ")})`;else if(c==="transformOrigin"&&typeof o=="object"){const e=o;i[c]=`${a(e.x)}${e.xPercent?"%":"px"} ${a(e.y)}${e.yPercent?"%":"px"}`}else typeof o=="object"?i[c]=O(o):i[c]=o;return i},x=t=>{const n=t.lines?t.lines.join(`
|
|
2
|
-
`):t.text??t.value;return n?n.length>200?n.slice(0,200)+"…":n:void 0},S=t=>({x:a(t.rect.x),y:a(t.rect.y),width:a(t.rect.width),height:a(t.rect.height)}),$=t=>({id:t.id,type:t.type,rect:S(t),...t.name?{name:t.name}:{},...x(t)?{text:x(t).slice(0,40)}:{},children:t.children.map($)}),D=t=>{const n=t.ui;if(!n)return null;const i=()=>n.frame().filter(e=>!e.leaving),f=e=>{const r=(l,u)=>{const s=[...u,l];if(l.id===e)return s;for(const b of l.children){const d=r(b,s);if(d)return d}return null};for(const l of i()){const u=r(l.tree,[]);if(u)return u}return null},c=(e,r)=>{const l=s=>e>=s.rect.x&&e<s.rect.x+s.rect.width&&r>=s.rect.y&&r<s.rect.y+s.rect.height,u=i();for(let s=u.length-1;s>=0;s--){let b=null;const d=y=>{const m=l(y);if(m&&(b=y),!(y.clip&&!m))for(const g of y.children)d(g)};if(d(u[s].tree),b)return b;if(u[s].
|
|
2
|
+
`):t.text??t.value;return n?n.length>200?n.slice(0,200)+"…":n:void 0},S=t=>({x:a(t.rect.x),y:a(t.rect.y),width:a(t.rect.width),height:a(t.rect.height)}),$=t=>({id:t.id,type:t.type,rect:S(t),...t.name?{name:t.name}:{},...x(t)?{text:x(t).slice(0,40)}:{},children:t.children.map($)}),D=t=>{const n=t.ui;if(!n)return null;const i=()=>n.frame().filter(e=>!e.leaving),f=e=>{const r=(l,u)=>{const s=[...u,l];if(l.id===e)return s;for(const b of l.children){const d=r(b,s);if(d)return d}return null};for(const l of i()){const u=r(l.tree,[]);if(u)return u}return null},c=(e,r)=>{const l=s=>e>=s.rect.x&&e<s.rect.x+s.rect.width&&r>=s.rect.y&&r<s.rect.y+s.rect.height,u=i();for(let s=u.length-1;s>=0;s--){let b=null;const d=y=>{const m=l(y);if(m&&(b=y),!(y.clip&&!m))for(const g of y.children)d(g)};if(d(u[s].tree),b)return b;if(u[s].tree.overlay!==void 0)return u[s].tree}return null},o=e=>{const r=e==null?void 0:e[e.length-1];if(!e||!r)return null;const[l,u,s,b]=n.paddingOf(r.id).map(a),d=h.get(r.id),y=d?t.locate(d.site).find(p=>!p.source.includes("__sdk")):void 0,m=k(d==null?void 0:d.element.deref()),g=r.state?Object.entries(r.state).filter(([,p])=>p===!0).map(([p])=>p):[];return{id:r.id,type:r.type,rect:S(r),...r.name?{name:r.name}:{},...x(r)!==void 0?{text:x(r)}:{},padding:{top:u,right:s,bottom:b,left:l},...m?{set:m}:{},style:T(r.type,r.style),...g.length>0?{state:g}:{},...r.scroll?{scroll:{axis:r.scroll.axis,offset:a(r.scroll.offset),content:a(r.scroll.content)}}:{},...y?{source:{file:y.source.replace(/^\//,""),line:y.line,column:y.column}}:{},path:e.map(p=>({id:p.id,type:p.type,...p.name?{name:p.name}:{}}))}};return{answer(e){switch(e.ask){case"tree":return{ask:"tree",layers:i().map(r=>({kind:r.widget?"widget":"screen",tree:$(r.tree)}))};case"text":return{ask:"text",text:n.toText()};case"at":{const r=c(e.x,e.y);return{ask:"at",node:r?o(f(r.id)):null}}case"node":return{ask:"node",node:o(f(e.node))}}}}};export{D as createInspector,P as recordSites};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const M=250,i=[.38,.7,.125,1],_=`cubic-bezier(${i.join(", ")})`,b=n=>{const[c,E,a,R]=i,r=(s,o,t)=>((1-3*o+3*s)*t+(3*o-6*s))*t*t+3*s*t,K=(s,o,t)=>3*(1-3*o+3*s)*t*t+2*(3*o-6*s)*t+3*s;let e=n;for(let s=0;s<6;s++){const o=K(c,a,e);if(Math.abs(o)<1e-6)break;e-=(r(c,a,e)-n)/o}return r(E,R,Math.min(1,Math.max(0,e)))};export{M as K,_ as a,b as k};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mapImpl-
|
|
2
|
-
import{_ as E}from"../player.js";const o={present:i=>i!=null,f64:i=>typeof i=="number"&&Number.isFinite(i)?i:void 0,i32:i=>typeof i=="number"&&Number.isInteger(i)&&i>=-2147483648&&i<=2147483647?i:void 0,bool:i=>typeof i=="boolean"?i:void 0,string:i=>typeof i=="string"?i:void 0,json:i=>i,bytes:i=>Object.prototype.toString.call(i)==="[object Uint8Array]"?i.slice():void 0,object:i=>typeof i=="object"&&i!==null&&!Array.isArray(i)?i:void 0,array:(i,t)=>Array.isArray(i)&&(t===void 0||i.length===t)?i:void 0,list:(i,t)=>{if(!Array.isArray(i))return;const u=[];for(const f of i){const p=t(f);if(p===void 0)return;u.push(p)}return u},map:(i,t)=>{if(typeof i!="object"||i===null||Array.isArray(i))return;const u={};for(const[f,p]of Object.entries(i)){const v=t(p);if(v===void 0)return;u[f]=v}return u}},j=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.style)){const d=o.string(t.style);if(d===void 0)return;u=d}let f;if(o.present(t.styleJson)){const d=o.string(t.styleJson);if(d===void 0)return;f=d}let p;if(o.present(t.center)){const d=(m=>{if(!m)return;const w=o.f64(m[0]);if(w===void 0)return;const b=o.f64(m[1]);if(b!==void 0)return[w,b]})(o.array(t.center,2));if(d===void 0)return;p=d}let v;if(o.present(t.zoom)){const d=o.f64(t.zoom);if(d===void 0)return;v=d}let r;if(o.present(t.minZoom)){const d=o.f64(t.minZoom);if(d===void 0)return;r=d}let s;if(o.present(t.maxZoom)){const d=o.f64(t.maxZoom);if(d===void 0)return;s=d}let l;if(o.present(t.bearing)){const d=o.f64(t.bearing);if(d===void 0)return;l=d}let e;if(o.present(t.pitch)){const d=o.f64(t.pitch);if(d===void 0)return;e=d}let n;if(o.present(t.rotate)){const d=o.bool(t.rotate);if(d===void 0)return;n=d}let c;if(o.present(t.tilt)){const d=o.bool(t.tilt);if(d===void 0)return;c=d}const a={};return u!==void 0&&(a.style=u),f!==void 0&&(a.styleJson=f),p!==void 0&&(a.center=p),v!==void 0&&(a.zoom=v),r!==void 0&&(a.minZoom=r),s!==void 0&&(a.maxZoom=s),l!==void 0&&(a.bearing=l),e!==void 0&&(a.pitch=e),n!==void 0&&(a.rotate=n),c!==void 0&&(a.tilt=c),a},L=i=>i==="markers"||i==="line"?i:void 0,V=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.cluster)){const e=o.bool(t.cluster);if(e===void 0)return;u=e}let f;if(o.present(t.clusterRadius)){const e=o.f64(t.clusterRadius);if(e===void 0)return;f=e}let p;if(o.present(t.clusterMaxZoom)){const e=o.f64(t.clusterMaxZoom);if(e===void 0)return;p=e}let v;if(o.present(t.color)){const e=o.string(t.color);if(e===void 0)return;v=e}let r;if(o.present(t.width)){const e=o.f64(t.width);if(e===void 0)return;r=e}let s;if(o.present(t.opacity)){const e=o.f64(t.opacity);if(e===void 0)return;s=e}const l={};return u!==void 0&&(l.cluster=u),f!==void 0&&(l.clusterRadius=f),p!==void 0&&(l.clusterMaxZoom=p),v!==void 0&&(l.color=v),r!==void 0&&(l.width=r),s!==void 0&&(l.opacity=s),l},g=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.zoom)){const s=o.f64(t.zoom);if(s===void 0)return;u=s}let f;if(o.present(t.bearing)){const s=o.f64(t.bearing);if(s===void 0)return;f=s}let p;if(o.present(t.pitch)){const s=o.f64(t.pitch);if(s===void 0)return;p=s}let v;if(o.present(t.duration)){const s=o.f64(t.duration);if(s===void 0)return;v=s}const r={};return u!==void 0&&(r.zoom=u),f!==void 0&&(r.bearing=f),p!==void 0&&(r.pitch=p),v!==void 0&&(r.duration=v),r},y=i=>o.f64(i)??o.string(i),M=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.top)){const s=y(t.top);if(s===void 0)return;u=s}let f;if(o.present(t.left)){const s=y(t.left);if(s===void 0)return;f=s}let p;if(o.present(t.bottom)){const s=y(t.bottom);if(s===void 0)return;p=s}let v;if(o.present(t.right)){const s=y(t.right);if(s===void 0)return;v=s}const r={};return u!==void 0&&(r.top=u),f!==void 0&&(r.left=f),p!==void 0&&(r.bottom=p),v!==void 0&&(r.right=v),r},_=i=>o.f64(i)??M(i),P=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.padding)){const r=_(t.padding);if(r===void 0)return;u=r}let f;if(o.present(t.maxZoom)){const r=o.f64(t.maxZoom);if(r===void 0)return;f=r}let p;if(o.present(t.animate)){const r=o.bool(t.animate);if(r===void 0)return;p=r}const v={};return u!==void 0&&(v.padding=u),f!==void 0&&(v.maxZoom=f),p!==void 0&&(v.animate=p),v},T=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.accuracy)){const v=o.f64(t.accuracy);if(v===void 0)return;u=v}let f;if(o.present(t.heading)){const v=o.f64(t.heading);if(v===void 0)return;f=v}const p={};return u!==void 0&&(p.accuracy=u),f!==void 0&&(p.heading=f),p};class O extends Error{constructor(t){super(t),this.code=t}}const h={name:"map",version:1},x=(i,t)=>{i.registerView(h.name,(u,f,p)=>{const v={ready:()=>f.emit("ready"),tap:l=>f.emit("tap",l),moveEnd:l=>f.emit("moveEnd",l),error:l=>f.emit("error",l)},r=t(j(u)??{},v,p),s=async(l,e)=>{switch(l){case"ensureLayer":{const n=o.string(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.ensureLayer: source");const c=L(e[1]);if(c===void 0)throw new Error("bad arguments — MapView.ensureLayer: kind");let a;if(o.present(e[2])){const d=V(e[2]);if(d===void 0)throw new Error("bad arguments — MapView.ensureLayer: options");a=d}await r.ensureLayer(n,c,a);return}case"removeLayer":{const n=o.string(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.removeLayer: source");await r.removeLayer(n);return}case"setData":{const n=o.string(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.setData: source");const c=o.json(e[1]);if(c===void 0)throw new Error("bad arguments — MapView.setData: geojson");await r.setData(n,c);return}case"flyTo":{const n=(a=>{if(!a)return;const d=o.f64(a[0]);if(d===void 0)return;const m=o.f64(a[1]);if(m!==void 0)return[d,m]})(o.array(e[0],2));if(n===void 0)throw new Error("bad arguments — MapView.flyTo: center");let c;if(o.present(e[1])){const a=g(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.flyTo: options");c=a}await r.flyTo(n,c);return}case"jumpTo":{const n=(a=>{if(!a)return;const d=o.f64(a[0]);if(d===void 0)return;const m=o.f64(a[1]);if(m!==void 0)return[d,m]})(o.array(e[0],2));if(n===void 0)throw new Error("bad arguments — MapView.jumpTo: center");let c;if(o.present(e[1])){const a=g(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.jumpTo: options");c=a}await r.jumpTo(n,c);return}case"fitPoints":{const n=o.list(e[0],a=>(d=>{if(!d)return;const m=o.f64(d[0]);if(m===void 0)return;const w=o.f64(d[1]);if(w!==void 0)return[m,w]})(o.array(a,2)));if(n===void 0)throw new Error("bad arguments — MapView.fitPoints: points");let c;if(o.present(e[1])){const a=P(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.fitPoints: options");c=a}await r.fitPoints(n,c);return}case"setPadding":{const n=M(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.setPadding: padding");await r.setPadding(n);return}case"getCamera":return await r.getCamera();case"setUserLocation":{let n=null;if(o.present(e[0])){const a=(d=>{if(!d)return;const m=o.f64(d[0]);if(m===void 0)return;const w=o.f64(d[1]);if(w!==void 0)return[m,w]})(o.array(e[0],2));if(a===void 0)throw new Error("bad arguments — MapView.setUserLocation: lngLat");n=a}let c;if(o.present(e[1])){const a=T(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.setUserLocation: options");c=a}await r.setUserLocation(n,c);return}default:throw new Error(`Unknown method: ${l}`)}};return{el:r.el,call:s,destroy:()=>{var l;return(l=r.destroy)==null?void 0:l.call(r)}}},h.version)},Z=(i,t)=>{typeof document>"u"||x(i,(u,f,p)=>{const v=p.createElement("div");v.style.cssText="background:#e8e6e1;overflow:hidden";let r=null,s=!1;const l=Promise.all([E(()=>import("./mapImpl-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mapImpl-DS04r04e.js","../player.js","./keyboardMotion-C2Bk5H0n.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as E}from"../player.js";const o={present:i=>i!=null,f64:i=>typeof i=="number"&&Number.isFinite(i)?i:void 0,i32:i=>typeof i=="number"&&Number.isInteger(i)&&i>=-2147483648&&i<=2147483647?i:void 0,bool:i=>typeof i=="boolean"?i:void 0,string:i=>typeof i=="string"?i:void 0,json:i=>i,bytes:i=>Object.prototype.toString.call(i)==="[object Uint8Array]"?i.slice():void 0,object:i=>typeof i=="object"&&i!==null&&!Array.isArray(i)?i:void 0,array:(i,t)=>Array.isArray(i)&&(t===void 0||i.length===t)?i:void 0,list:(i,t)=>{if(!Array.isArray(i))return;const u=[];for(const f of i){const p=t(f);if(p===void 0)return;u.push(p)}return u},map:(i,t)=>{if(typeof i!="object"||i===null||Array.isArray(i))return;const u={};for(const[f,p]of Object.entries(i)){const v=t(p);if(v===void 0)return;u[f]=v}return u}},j=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.style)){const d=o.string(t.style);if(d===void 0)return;u=d}let f;if(o.present(t.styleJson)){const d=o.string(t.styleJson);if(d===void 0)return;f=d}let p;if(o.present(t.center)){const d=(m=>{if(!m)return;const w=o.f64(m[0]);if(w===void 0)return;const b=o.f64(m[1]);if(b!==void 0)return[w,b]})(o.array(t.center,2));if(d===void 0)return;p=d}let v;if(o.present(t.zoom)){const d=o.f64(t.zoom);if(d===void 0)return;v=d}let r;if(o.present(t.minZoom)){const d=o.f64(t.minZoom);if(d===void 0)return;r=d}let s;if(o.present(t.maxZoom)){const d=o.f64(t.maxZoom);if(d===void 0)return;s=d}let l;if(o.present(t.bearing)){const d=o.f64(t.bearing);if(d===void 0)return;l=d}let e;if(o.present(t.pitch)){const d=o.f64(t.pitch);if(d===void 0)return;e=d}let n;if(o.present(t.rotate)){const d=o.bool(t.rotate);if(d===void 0)return;n=d}let c;if(o.present(t.tilt)){const d=o.bool(t.tilt);if(d===void 0)return;c=d}const a={};return u!==void 0&&(a.style=u),f!==void 0&&(a.styleJson=f),p!==void 0&&(a.center=p),v!==void 0&&(a.zoom=v),r!==void 0&&(a.minZoom=r),s!==void 0&&(a.maxZoom=s),l!==void 0&&(a.bearing=l),e!==void 0&&(a.pitch=e),n!==void 0&&(a.rotate=n),c!==void 0&&(a.tilt=c),a},L=i=>i==="markers"||i==="line"?i:void 0,V=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.cluster)){const e=o.bool(t.cluster);if(e===void 0)return;u=e}let f;if(o.present(t.clusterRadius)){const e=o.f64(t.clusterRadius);if(e===void 0)return;f=e}let p;if(o.present(t.clusterMaxZoom)){const e=o.f64(t.clusterMaxZoom);if(e===void 0)return;p=e}let v;if(o.present(t.color)){const e=o.string(t.color);if(e===void 0)return;v=e}let r;if(o.present(t.width)){const e=o.f64(t.width);if(e===void 0)return;r=e}let s;if(o.present(t.opacity)){const e=o.f64(t.opacity);if(e===void 0)return;s=e}const l={};return u!==void 0&&(l.cluster=u),f!==void 0&&(l.clusterRadius=f),p!==void 0&&(l.clusterMaxZoom=p),v!==void 0&&(l.color=v),r!==void 0&&(l.width=r),s!==void 0&&(l.opacity=s),l},g=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.zoom)){const s=o.f64(t.zoom);if(s===void 0)return;u=s}let f;if(o.present(t.bearing)){const s=o.f64(t.bearing);if(s===void 0)return;f=s}let p;if(o.present(t.pitch)){const s=o.f64(t.pitch);if(s===void 0)return;p=s}let v;if(o.present(t.duration)){const s=o.f64(t.duration);if(s===void 0)return;v=s}const r={};return u!==void 0&&(r.zoom=u),f!==void 0&&(r.bearing=f),p!==void 0&&(r.pitch=p),v!==void 0&&(r.duration=v),r},y=i=>o.f64(i)??o.string(i),M=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.top)){const s=y(t.top);if(s===void 0)return;u=s}let f;if(o.present(t.left)){const s=y(t.left);if(s===void 0)return;f=s}let p;if(o.present(t.bottom)){const s=y(t.bottom);if(s===void 0)return;p=s}let v;if(o.present(t.right)){const s=y(t.right);if(s===void 0)return;v=s}const r={};return u!==void 0&&(r.top=u),f!==void 0&&(r.left=f),p!==void 0&&(r.bottom=p),v!==void 0&&(r.right=v),r},_=i=>o.f64(i)??M(i),P=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.padding)){const r=_(t.padding);if(r===void 0)return;u=r}let f;if(o.present(t.maxZoom)){const r=o.f64(t.maxZoom);if(r===void 0)return;f=r}let p;if(o.present(t.animate)){const r=o.bool(t.animate);if(r===void 0)return;p=r}const v={};return u!==void 0&&(v.padding=u),f!==void 0&&(v.maxZoom=f),p!==void 0&&(v.animate=p),v},T=i=>{const t=o.object(i);if(!t)return;let u;if(o.present(t.accuracy)){const v=o.f64(t.accuracy);if(v===void 0)return;u=v}let f;if(o.present(t.heading)){const v=o.f64(t.heading);if(v===void 0)return;f=v}const p={};return u!==void 0&&(p.accuracy=u),f!==void 0&&(p.heading=f),p};class O extends Error{constructor(t){super(t),this.code=t}}const h={name:"map",version:1},x=(i,t)=>{i.registerView(h.name,(u,f,p)=>{const v={ready:()=>f.emit("ready"),tap:l=>f.emit("tap",l),moveEnd:l=>f.emit("moveEnd",l),error:l=>f.emit("error",l)},r=t(j(u)??{},v,p),s=async(l,e)=>{switch(l){case"ensureLayer":{const n=o.string(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.ensureLayer: source");const c=L(e[1]);if(c===void 0)throw new Error("bad arguments — MapView.ensureLayer: kind");let a;if(o.present(e[2])){const d=V(e[2]);if(d===void 0)throw new Error("bad arguments — MapView.ensureLayer: options");a=d}await r.ensureLayer(n,c,a);return}case"removeLayer":{const n=o.string(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.removeLayer: source");await r.removeLayer(n);return}case"setData":{const n=o.string(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.setData: source");const c=o.json(e[1]);if(c===void 0)throw new Error("bad arguments — MapView.setData: geojson");await r.setData(n,c);return}case"flyTo":{const n=(a=>{if(!a)return;const d=o.f64(a[0]);if(d===void 0)return;const m=o.f64(a[1]);if(m!==void 0)return[d,m]})(o.array(e[0],2));if(n===void 0)throw new Error("bad arguments — MapView.flyTo: center");let c;if(o.present(e[1])){const a=g(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.flyTo: options");c=a}await r.flyTo(n,c);return}case"jumpTo":{const n=(a=>{if(!a)return;const d=o.f64(a[0]);if(d===void 0)return;const m=o.f64(a[1]);if(m!==void 0)return[d,m]})(o.array(e[0],2));if(n===void 0)throw new Error("bad arguments — MapView.jumpTo: center");let c;if(o.present(e[1])){const a=g(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.jumpTo: options");c=a}await r.jumpTo(n,c);return}case"fitPoints":{const n=o.list(e[0],a=>(d=>{if(!d)return;const m=o.f64(d[0]);if(m===void 0)return;const w=o.f64(d[1]);if(w!==void 0)return[m,w]})(o.array(a,2)));if(n===void 0)throw new Error("bad arguments — MapView.fitPoints: points");let c;if(o.present(e[1])){const a=P(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.fitPoints: options");c=a}await r.fitPoints(n,c);return}case"setPadding":{const n=M(e[0]);if(n===void 0)throw new Error("bad arguments — MapView.setPadding: padding");await r.setPadding(n);return}case"getCamera":return await r.getCamera();case"setUserLocation":{let n=null;if(o.present(e[0])){const a=(d=>{if(!d)return;const m=o.f64(d[0]);if(m===void 0)return;const w=o.f64(d[1]);if(w!==void 0)return[m,w]})(o.array(e[0],2));if(a===void 0)throw new Error("bad arguments — MapView.setUserLocation: lngLat");n=a}let c;if(o.present(e[1])){const a=T(e[1]);if(a===void 0)throw new Error("bad arguments — MapView.setUserLocation: options");c=a}await r.setUserLocation(n,c);return}default:throw new Error(`Unknown method: ${l}`)}};return{el:r.el,call:s,destroy:()=>{var l;return(l=r.destroy)==null?void 0:l.call(r)}}},h.version)},Z=(i,t)=>{typeof document>"u"||x(i,(u,f,p)=>{const v=p.createElement("div");v.style.cssText="background:#e8e6e1;overflow:hidden";let r=null,s=!1;const l=Promise.all([E(()=>import("./mapImpl-DS04r04e.js"),__vite__mapDeps([0,1,2]),import.meta.url),t()]).then(([n,c])=>{s||(r=n.createMap(v,u,f,p,c))},n=>f.error({message:`MapView: failed to load maplibre-gl — ${n instanceof Error?n.message:String(n)}`})),e=async()=>{if(await l,!r)throw new Error("MapView: the map engine failed to load");return r};return{el:v,ensureLayer:async(n,c,a)=>(await e()).ensureLayer(n,c,a),removeLayer:async n=>(await e()).removeLayer(n),setData:async(n,c)=>(await e()).setData(n,c),flyTo:async(n,c)=>(await e()).flyTo(n,c),jumpTo:async(n,c)=>(await e()).jumpTo(n,c),fitPoints:async(n,c)=>(await e()).fitPoints(n,c),setPadding:async n=>(await e()).setPadding(n),getCamera:async()=>(await e()).getCamera(),setUserLocation:async(n,c)=>(await e()).setUserLocation(n,c),destroy:()=>{var n;s=!0,(n=r==null?void 0:r.destroy)==null||n.call(r),r=null}}})},U=Object.freeze(Object.defineProperty({__proto__:null,register:Z},Symbol.toStringTag,{value:"Module"}));export{O as M,U as m};
|