Comparing version 1.0.9 to 1.1.0
@@ -1,1 +0,1 @@ | ||
import e,{forwardRef as t,useState as n,useRef as l,useEffect as a,useMemo as r,Fragment as c,useImperativeHandle as i,Children as s,memo as o,createElement as d}from"react";import{randomId as m,createBus as u,useBus as h}from"poon-router/util.js";import{navigation as p}from"poon-router";const v=(...e)=>e.filter(Boolean).join(" "),g=e=>100*e+"%",E=t((({href:t,onClick:a,className:r,active:c,target:i,children:s,style:o,disableMenu:d},m)=>{const[u,h]=n(!1),p=l(!1),g=e=>{e.button&&0!==e.button||(e.stopPropagation(),p.current=!1,h(!0))},E=()=>{h(!1)};return e.createElement(t?"a":"button",{href:t,onTouchStart:g,onTouchMove:E,onTouchEnd:E,onMouseDown:g,onMouseUp:E,onMouseLeave:E,onClick:e=>{if(p.current)return e.preventDefault();a&&(t||e.preventDefault(),a(e))},className:v("touchable",r,u&&"touched",d&&"disable-menu",c&&"active"),target:i,draggable:!1,onContextMenu:d?e=>(e.preventDefault(),!1):void 0,style:o,type:"button",ref:m},s)})),f=.25,y={capture:!1,passive:!1},b=(e=0,t,n)=>{const l=Math.min(n,50)/50;return e*(1-l)+t*l},N=e=>{const[t,l]=n({width:e.current?.clientWidth,height:e.current?.clientHeight});return a((()=>{if(!e.current)return;const t=new ResizeObserver((e=>{const t=e[0].borderBoxSize[0];l({height:t.blockSize,width:t.inlineSize})}));return t.observe(e.current),()=>t.disconnect()}),[e.current]),t};let k;const C=(e,t={},n)=>{const{width:c,height:i}=N(e),s=l({id:m()}).current,o=r((()=>{if(!e.current)return{};const n=()=>{const e=Date.now(),t=e-s.last.ts;if(t>0){const n=(s.x-s.last.x)/t,l=(s.y-s.last.y)/t;s.v={x:b(s.v.x,n,t),y:b(s.v.y,l,t)},s.last={x:s.x,y:s.y,ts:e}}};return{onTouchStart:e=>{if(k=null,e.touches.length>1){const t=e.touches[0].clientX-e.touches[1].clientX,n=e.touches[0].clientY-e.touches[1].clientY;return void(s.pinch={d0:Math.sqrt(Math.pow(t,2)+Math.pow(n,2))})}const n=e.touches?e.touches[0].clientX:e.clientX,l=e.touches?e.touches[0].clientY:e.clientY;Object.assign(s,{width:c,height:i,current:{x:n,y:l},touch:!0,origin:{x:n,y:l},locked:!1,v:{x:0,y:0},s:{x:0,y:0},d:{x:0,y:0},flick:null,last:{ts:Date.now(),x:n,y:l}}),t.onDown&&t.onDown(s)},onTouchMove:l=>{if(k&&k!==e.current)k.className.includes("scroller")||l.preventDefault();else{if(s.pinch)if(2===l.touches.length){const e=l.touches[0].clientX-l.touches[1].clientX,t=l.touches[0].clientY-l.touches[1].clientY;s.pinch.d=Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),s.pinch.ratio=s.pinch.d/s.pinch.d0}else delete s.pinch;if(s.x=l.touches?l.touches[0].clientX:l.clientX,s.y=l.touches?l.touches[0].clientY:l.clientY,n(),s.d={x:s.x-s.origin.x,y:s.y-s.origin.y},s.abs={x:Math.abs(s.d.x),y:Math.abs(s.d.y)},!s.locked&&(s.abs.y>10||s.abs.x>10)&&(s.locked=s.abs.y>s.abs.x?"v":"h"),s.locked){if(s.touch=(e=>!t.onCapture||t.onCapture(s,e))(l),!s.touch)return;k=e.current,t.onMove&&t.onMove(s,l)}}},onTouchEnd:()=>{k&&k!==e.current||s.touch&&s.locked&&(n(),s.s={x:Math.abs(s.v.x),y:Math.abs(s.v.y)},s.flick={x:"h"===s.locked&&s.s.x>=f&&Math.sign(s.v.x),y:"v"===s.locked&&s.s.y>=f&&Math.sign(s.v.y)},t.onUp&&t.onUp(s))},onWheel:n=>{e.current.scrollTop+=n.deltaY,t.onPan&&t.onPan({d:{x:n.deltaX,y:n.deltaY}})}}}),[e,i,c,n]);return a((()=>{if(e.current)return e.current.addEventListener("touchstart",o.onTouchStart,y),e.current.addEventListener("touchmove",o.onTouchMove,y),e.current.addEventListener("touchend",o.onTouchEnd,y),e.current.addEventListener("wheel",o.onWheel,y),()=>{e.current&&(e.current.removeEventListener("touchstart",o.onTouchStart),e.current.removeEventListener("touchmove",o.onTouchMove),e.current.removeEventListener("touchend",o.onTouchEnd),e.current.removeEventListener("wheel",o.onWheel))}}),[o,n]),{height:i,width:c}},x=(e,t,n)=>Math.min(Math.max(e,t),n),w=(e,t,n)=>e>n?n+(n+e)/50:e<t?t-(t-e)/50:e,M=e=>--e*e*e+1;class P{constructor(e){this.listeners=[],this.value=e,this.oldValue=e}setValue=(e,t=!0)=>{t&&(delete this.id,this.oldValue=e),this.value=e,this.listeners.forEach((t=>t(e)))};spring=(e,t=P.defaultAnimationDuration)=>new Promise((n=>{if(e===this.value)return;const l=this.id=performance.now(),a=this.value,r=c=>{if(l!==this.id)return;const i=Math.max(0,c-l);if(i>=t)this.setValue(e,!0),n();else{const n=(e-a)*M(i/t);this.setValue(a+n,!1),requestAnimationFrame(r)}};r(l)}));on=e=>(this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e)));stop=()=>{delete this.id}}P.defaultAnimationDuration=300;const S=e=>r((()=>new P(e)),[]),T=/iPad|iPhone|iPod/.test(navigator.platform),L={"os:back":T?"arrow_back_ios":"arrow_back","os:share":T?"ios_share":"share","os:close":T?"keyboard_arrow_down":"close"},V=({icon:t,className:n,color:l,title:a,size:r,onClick:c})=>e.createElement("i",{className:v("material-icons",n),style:{color:l,fontSize:r},title:a,onClick:c,children:L[t]||t}),D=t((({pull:t},n)=>e.createElement("div",{className:"pull-indicator center",ref:n},e.createElement(V,{icon:"refresh",color:"#000"})))),$=t((({children:t,className:n,onRefresh:r,horizontal:i},s)=>{const o=s||l(),d=l(),m=l({}).current,u=S(0),h=S(0),p=S(0);C(o,{onDown:()=>{m.canScrollVertical=o.current.scrollHeight>o.current.clientHeight,m.canScrollHorizontal=o.current.scrollWidth>o.current.clientWidth,m.initScrollTop=o.current.scrollTop,m.initScrollLeft=o.current.scrollLeft,h.stop(),p.stop()},onCapture:e=>"v"===e.locked?!!(r&&0===o.current.scrollTop&&e.d.y>0)||!!m.canScrollVertical&&(0===m.initScrollTop&&e.d.y<0||m.initScrollTop>0):"h"===e.locked?!!m.canScrollHorizontal:void 0,onMove:e=>{"v"===e.locked?h.setValue(m.initScrollTop-e.d.y):"h"===e.locked&&p.setValue(m.initScrollLeft-e.d.x),r&&0===m.initScrollTop&&u.setValue(Math.min(70,e.d.y))},onUp:e=>{"v"===e.locked?e.v.y&&h.spring(h.value-2e3*e.v.y,2e3):"h"===e.locked&&e.v.x&&p.spring(p.value-2e3*e.v.x,2e3),r&&0===m.initScrollTop&&(e.d.y>70?u.spring(0).then(r):u.spring(0))}}),a((()=>h.on((e=>{o.current.scrollTop=e}))),[]),a((()=>p.on((e=>o.current.scrollLeft=e))),[]),a((()=>{if(r)return u.on((e=>{const t=e/70;d.current.style.transform=`translateY(${e}px) rotate(${360*t}deg)`,d.current.style.opacity=t}))}),[]);return e.createElement(c,null,r?e.createElement("div",{className:"list-pull"},e.createElement(D,{pull:u,ref:d})):null,e.createElement("div",{className:v("scroller",n,i?"horizontal":"vertical"),ref:o,onScroll:()=>{navigator.virtualKeyboard?.hide(),document.activeElement.blur()},children:t}))})),z=new Array(12).fill(0),R=({size:t=16,color:n="#fff"})=>e.createElement("div",{className:"activity-indicator",style:{width:t,height:t},children:z.map(((l,a)=>{const r={width:1.7,borderRadius:1,left:t/2-1,height:t/4,animationDelay:(.1*a-1.1).toFixed(1)+"s",transform:`rotate(${30*a}deg)`,backgroundColor:n,transformOrigin:`50% ${t/2}px`};return e.createElement("div",{key:a,style:r})}))}),X=({className:t,title:n,onClick:l,onDown:a,icon:r,href:i,tabIndex:s,color:o,disabled:d,download:m,iconImageUrl:u,loading:h,submit:p,fullWidth:g,target:f})=>{const y=v("btn",t,d&&"disabled",g&&"full-width",o&&`btn-${o}`);return e.createElement(E,{type:p?"submit":"button",className:y,onClick:e=>{m&&e.stopPropagation(),l&&l(e)},href:i,onTouchStart:a,tabIndex:s,children:h?e.createElement(R,null):e.createElement(c,null,u?e.createElement("img",{src:u,alt:n}):null,r?e.createElement(V,{icon:r}):null,n?e.createElement("span",null,n):null),target:f})},Y=u([]),W=(e,t)=>{Y.update(Y.state.map((t=>(t===e&&(t.visible=!1),t)))),setTimeout((()=>{e.callback(t),Y.update(Y.state.filter((t=>t!==e)))}),300)},U=({alert:t,isLast:n})=>e.createElement("div",{className:v("alert-container",n&&t.visible&&t.className)},e.createElement("div",{className:v("alert",n&&t.visible&&"visible"),onClick:e=>e.stopPropagation()},e.createElement("div",{className:"alert-top"},t.title?e.createElement("div",{className:"alert-title"},t.title):null,t.message?e.createElement("div",{className:"alert-message"},t.message):null),t.options?e.createElement($,{className:v("alert-buttons",t.options.length<=2&&"alert-buttons-horizontal"),children:t.options.map(((n,l)=>e.createElement(E,{key:l,className:v("alert-button",n.destructive&&"destructive"),onClick:()=>{n.onPress&&n.onPress(),W(t,n._id||n.value)},children:n.name,disableMenu:!0})))}):e.createElement("div",{className:"alert-bottom"},e.createElement(X,{color:"white",fullWidth:!0,title:"Close",onClick:()=>W(t)})))),_=()=>{const t=h(Y),n=t.filter((e=>e.visible)).pop();return 0===t.length?null:e.createElement("div",{className:v("layer alert-backdrop",t.some((e=>e.visible))&&"visible"),onClick:()=>W(n),children:t.map((t=>e.createElement(U,{key:t.key,alert:t,isLast:n===t})))})},I=(e,t)=>new Promise((n=>{Y.update([...Y.state,{key:m(),callback:n,visible:!0,options:t,...e}])})),j=({title:t,meta:n,leftIcon:l,href:a,onClick:r,onPressMore:c,target:i,children:s,caret:o,disabled:d,RightComponent:m,className:u,active:h})=>e.createElement(E,{className:v("touchable-highlight touchable-row",d&&"disabled",u),onClick:r,href:a,target:i,active:h},e.createElement("div",{className:"touchable-row-left"},"string"==typeof l?e.createElement("div",{className:"touchable-row-icon"},e.createElement(V,{icon:l})):null,"object"==typeof l?e.createElement("div",{className:"touchable-row-icon"},l):null,e.createElement("div",{className:"touchable-row-content"},t?e.createElement("div",{className:"touchable-row-title",children:t}):null,n?e.createElement("div",{className:"meta",children:n}):null,s)),m,c?e.createElement(E,{onClick:c},e.createElement(V,{icon:"more_vert"})):null,o?e.createElement(V,{icon:"chevron_right"}):null),A=t((({className:t,visible:n,pan:r,children:c,onClose:i,onPress:s,showShade:o,showHandle:d},m)=>{const u=l(),h=l(),{height:p}=C(h,{onMove:e=>{r.setValue(e.height-Math.max(e.d.y/100,e.d.y))},onUp:e=>{1===e.flick.y||e.d.y>e.height/2?g():r.spring(e.height)}}),g=()=>r.spring(0).then(i);return a((()=>{if(p)return r.on((e=>{h.current.style.transform=`translateY(-${e}px)`,u.current&&(u.current.style.opacity=e/p)}))}),[p]),a((()=>{p&&(n?r.spring(p):r.spring(0).then(i))}),[n,p,i]),e.createElement("div",{className:"layer"},n&&o?e.createElement("div",{className:"shade shade-bottom-sheet",ref:u,onClick:g}):null,e.createElement("div",{ref:h,className:v("sheet",t),onClick:s},d?e.createElement("div",{className:"handle"}):null,c))})),B=u(null),H=new P(0),O=()=>{const t=h(B);return t?e.createElement(A,{pan:H,visible:!!t,onClose:()=>B.update(null),showShade:!0},e.createElement("div",{className:"action-sheet-title"},t&&t.title),e.createElement("hr",null),t.options.map(((n,l)=>e.createElement(j,{key:l,title:n.name,leftIcon:n.icon,onClick:e=>{n.onClick&&n.onClick(),t.callback&&t.callback(n.value),H.spring(0).then((()=>B.update(0)))},disabled:n.disabled,target:n.target,href:n.href})))):null},F=(e,t,n)=>B.update({title:e,options:t,callback:n}),q=({imageId:t,className:n,variant:l,getUrl:a})=>t?e.createElement("img",{draggable:!1,className:v("avatar",n),src:a(t,l)}):e.createElement("div",{draggable:!1,className:v("avatar",n)});q.defaultProps={variant:"normal",getUrl:()=>null};const K=({path:t,onClickPath:n})=>{const l=t.split("/").filter(Boolean);return 0===l.length?null:e.createElement($,{horizontal:!0,className:"breadcrumbs"},e.createElement(V,{icon:"home",onClick:()=>n("/")}),e.createElement("span",null," / "),l.map(((t,a)=>e.createElement(c,{key:t+"_"+a},e.createElement(E,{onClick:()=>n(),children:t}),a<l.length-1?e.createElement("span",null," / "):null))))},G=({active:t,undetermined:n})=>e.createElement("div",{className:v("toggle-check",t&&"active",n&&"undetermined")},e.createElement(V,{icon:n?"horizontal_rule":t?"check":null})),J={card:"os:back",modal:"os:close"},Q=({title:t,subtitle:n,presentation:l="card",onClose:a,headerRight:r,SearchComponent:i})=>{const s=J[l];return e.createElement(c,null,e.createElement("div",{className:"header"},e.createElement("div",{className:"header-spacer"},s&&e.createElement(E,{className:"header-close",onClick:e=>{e.stopPropagation(),e.preventDefault(),a()},children:e.createElement(V,{icon:s})})),e.createElement("div",{className:"header-middle"},e.createElement("div",{className:"header-title"},t),n?e.createElement("div",{className:"header-subtitle"},n):null),e.createElement("div",{className:"header-spacer"},r)),i)},Z=({className:t,icon:n,title:l,message:a,children:r})=>e.createElement("div",{className:v("placeholder",t)},n?e.createElement(V,{icon:n}):null,l?e.createElement("div",{className:"title"},l):null,a?e.createElement("div",{className:"placeholder-message"},a):null,r),ee=t((({},t)=>{const n=l();return i(t,(()=>({progress:(e,t)=>{n.current&&(n.current.style.opacity=1-e/t)}}))),e.createElement("div",{className:"shade shade-card",ref:n})})),te=t((({title:t,subtitle:r,children:c,footer:i,headerRight:s,hasScrollView:o=!0,SearchComponent:d,scrollerRef:m,disableGestures:u,onDrop:h,isVisible:g=!0,animateIn:E=!0,ShadeComponent:f=ee,HeaderComponent:y,className:b},N)=>{N=N||l();const k=l(history.length>1).current,[x,w]=n(!1),M=l(),P=S(E?document.body.clientWidth:0),T=()=>P.spring(L).then((()=>{k&&p.goBack()})),{width:L}=C(N,{onCapture:e=>{if(k&&!u)return"h"===e.locked&&e.d.x>0},onMove:e=>{P.setValue(Math.max(0,e.d.x))},onUp:e=>{1===e.flick.x||e.d.x>e.width/2?T():P.spring(0)}});a((()=>{L&&E&&(g?P.spring(0):P.spring(L))}),[E,g,L]),a((()=>P.on((e=>{N.current&&(N.current.style.transform=`translateX(${e}px)`),M.current&&M.current.progress(e,L)}))),[L]);return e.createElement("div",{className:"layer"},f?e.createElement(f,{ref:M}):null,e.createElement("div",{className:v("card",E&&"animate",b),ref:N,onDragOver:h&&(e=>{e.preventDefault()}),onDragEnter:h&&(e=>{w(!0)}),onDragLeave:h&&(e=>{w(!1)}),onDrop:h&&(e=>{w(!1),h(e)})},null===y?null:y||e.createElement(Q,{title:t,subtitle:r,presentation:"card",SearchComponent:d,onClose:T,headerRight:s}),o?e.createElement($,{className:"card-body",ref:m,children:c}):e.createElement("div",{className:"card-body",children:c}),i,x?e.createElement(Z,{className:"drop-zone",icon:"upload",title:"Upload"}):null))})),ne=({active:t})=>e.createElement("div",{className:v("circle-check",t&&"active")},e.createElement(V,{icon:"check"})),le=({status:t})=>"connected"===t?null:e.createElement("div",{className:"connection-indicator"},e.createElement("div",{className:"bubble"},e.createElement(R,null),t)),ae=({title:t,children:n,isVisible:l,onClose:a})=>l?e.createElement("div",{className:"corner-dialog"},e.createElement("div",{className:"corner-dialog-title"},t,e.createElement(V,{icon:"close",onClick:a})),n):null,re=({position:t,button:l,content:r})=>{const[c,i]=n(!1);return a((()=>{if(!c)return;const e=e=>{e.composedPath().some((e=>e.classList&&e.classList.contains("dropdown-content")))||i(!1)};return setTimeout((()=>{window.addEventListener("click",e,{passive:!1})}),0),()=>window.removeEventListener("click",e)}),[c]),e.createElement("div",null,e.createElement("span",{className:"dropdown"},e.createElement("div",{children:l,className:"dropdown-button",onClick:()=>{console.log("show"),i(!0)}}),e.createElement("div",{className:v("dropdown-content",t||"top-right",c?"visible":"hidden"),children:r})))};let ce={};const ie=t((({children:t,title:n,headerRight:r,onClose:c,isVisible:s,className:o,screen:d},m)=>{const u=l(),h=l(),E=S(0),f=()=>p.goBack(1);i(m,(()=>({close:f})));const{width:y,height:b}=C(u,{onMove:e=>{},onUp:e=>{}});return a((()=>{s?E.spring(1):E.spring(0)}),[s]),a((()=>E.on((e=>{const t=1-e,n=ce.x*t,l=ce.y*t;u.current&&(u.current.style.transform=`translate(${n}px, ${l}px)`,u.current.style.width=g(e),u.current.style.height=g(e)),h.current&&(h.current.style.transform=`translate(${-1*n}px, ${-1*l}px)`)}))),[y,b]),e.createElement("div",{className:"layer reveal",ref:u},e.createElement("div",{className:v("card reveal-content",o),ref:h},e.createElement(Q,{title:n,onClose:f,headerRight:r,presentation:"card"}),e.createElement("div",{className:"card-body",children:t})))})),se=(e,t)=>Object.assign(ce,{x:e,y:t}),oe=e=>{const t=e.currentTarget.getBoundingClientRect();se((t.left+t.right)/2,(t.top+t.bottom)/2)},de=({title:t,icon:n,href:l})=>e.createElement(E,{href:l,className:"springboard-icon",onClick:oe},e.createElement("div",{className:"icon-frame"},e.createElement(V,{icon:n})),e.createElement("div",{className:"springboard-icon-name"},t)),me=({emoji:t})=>e.createElement("span",{className:"emoji",children:t}),ue=({title:t,icon:n,onClick:l,href:a,disabled:r,children:c,active:i})=>e.createElement(j,{className:"dropdown-item",onClick:l,disabled:r,active:i,children:c,href:a,leftIcon:n,title:t}),he=({icon:t,title:n,loading:l,disabled:a,active:r=!0,href:i,onPress:s})=>e.createElement(E,{className:v("fab",!n&&"round"),loading:l,disabled:a,active:r,onClick:s,href:i},l?e.createElement(R,{color:"#000"}):e.createElement(c,null,e.createElement(V,{icon:t}),n&&e.createElement("div",{className:"fab-title"},n))),pe=({title:t,children:n,footer:r,headerRight:c,SearchComponent:i})=>{const s=l(),o=S(0);return a((()=>(o.spring(1),o.on((e=>{s.current.style.opacity=e})))),[]),e.createElement("div",{className:"fullscreen",ref:s},e.createElement(Q,{title:t,presentation:"full",onClose:()=>{o.spring(0).then((()=>p.goBack()))},headerRight:c,SearchComponent:i}),e.createElement($,{className:"card-body"},n),r)},ve=({title:t,items:n=[],keyExtractor:l=(e=>e._id),renderItem:a,loading:r,className:i,ListEmptyComponent:o,HeaderComponent:d,children:m,showSeparators:u=!0})=>e.createElement("div",{className:v("list",i)},t?e.createElement(c,null,e.createElement("div",{className:"list-title"},t),e.createElement("hr",null)):null,d,n.length||m?e.createElement("div",{className:"list-body"},r||!n?null:o&&0===n.length?o:n.map(((t,r)=>e.createElement(c,{key:l(t)},a(t,r),u&&r<n.length-1&&e.createElement("hr",null)))),s.map(m,((t,n)=>e.createElement(c,{key:n},t,n<m.length-1&&e.createElement("hr",null))))):o),ge=({ar:t,url:n,alt:l,className:a,children:r,base64Png:c})=>e.createElement("div",{className:v("img",a)},e.createElement("div",{style:{paddingTop:100*(t||1)+"%"}}),n?e.createElement("img",{src:n,className:"img-real",alt:l,draggable:!1}):c?e.createElement("img",{src:`data:image/png;base64,${c}`}):e.createElement("div",{className:"img-real",alt:l,draggable:!1}),r?e.createElement("div",{className:"img-inside"},r):null),Ee=({icon:t,title:n,badge:l,loading:a,disabled:r,onClick:c,active:i,href:s})=>e.createElement(E,{className:v("header-button center","Cancel"===n&&"header-cancel"),onClick:c,loading:a,disabled:r,active:i,href:s},t?e.createElement(V,{icon:t}):null,n?e.createElement("span",null,n):null,l?e.createElement("span",{className:"badge"},l):null),fe=({percent:t})=>e.createElement("div",{className:"percent-bar"},e.createElement("div",{className:"percent-bar-inner",style:{width:100*t+"%"}})),ye=u([]),be=t=>e.createElement("div",{key:t.id,className:"layer",children:t.children}),Ne=()=>h(ye).map(be),ke=e=>ye.update([...ye.state,{id:Math.random(),children:e}]),Ce=()=>{ye.update([])},xe=({title:t,color:n,onClick:l})=>e.createElement(E,{className:"pill",onClick:l,style:{backgroundColor:n}},t),we=({title:t,LeftComponent:n,caret:l=!0,checked:a,active:r,href:c,onPress:i})=>e.createElement(E,{className:"filter-button",onClick:i,active:r,interactive:!0,href:c},n,t?e.createElement("div",{className:"filter-button-title"},t):null,l?e.createElement(V,{className:"filter-button-caret",icon:"expand_more"}):e.createElement(G,{active:a})),Me=u(),Pe=()=>{const t=h(Me);return a((()=>{if(!t)return;const e=setTimeout((()=>Me.update(null)),2e3);return()=>clearTimeout(e)}),[t]),t?e.createElement("div",{className:"toast-container"},e.createElement("div",{className:"toast",children:t})):null},Se=Me.update,Te=()=>e.createElement(c,null,e.createElement(Ne,null),e.createElement(O,null),e.createElement(_,null),e.createElement(Pe,null)),Le=()=>e.createElement("div",{className:"progress-indicator"}),Ve=({color:t="#fff",size:n=20,percent:l,spinning:a,completedIcon:r="check"})=>{if(a||!l)return e.createElement(Le,null);if(1===l)return e.createElement(V,{icon:r});const c=n/2,i=c-1,s=2*i*Math.PI,o=s-l*s;return e.createElement("svg",{height:n,width:n},e.createElement("circle",{stroke:t,opacity:.3,fill:"transparent",strokeWidth:2,r:i,cx:c,cy:c}),e.createElement("circle",{strokeDasharray:s+" "+s,style:{strokeDashoffset:o,transform:"rotate(-90deg)",transformOrigin:"50% 50%"},stroke:t,fill:"transparent",strokeWidth:2,r:i,cx:c,cy:c}))},De=({active:t,icon:n,title:l,elaboration:a,subtitle:r,value:c,disabled:i,onClick:s,children:o})=>e.createElement(j,{onClick:()=>{s(c)},disabled:i,className:"radio-btn",active:t},e.createElement("div",{className:"radio-top"},e.createElement("div",{className:"dot"},e.createElement("div",{className:"dot-inside"})),n&&e.createElement(V,{icon:n}),e.createElement("div",{className:"radio-title"},l)),o&&e.createElement("div",{className:"radio-subtitle"},o),r&&e.createElement("div",{className:"radio-subtitle"},r),t&&a&&e.createElement("div",{className:"radio-subtitle",children:a})),$e=t((({item:t,isLast:n,active:l,onChange:a,index:r},i)=>e.createElement(c,null,e.createElement(E,{children:t.name,onClick:()=>a(t.value),active:l,ref:i}),n?null:e.createElement("div",{className:"separator"})))),ze=({options:t,value:n,onChange:r})=>{const c=l([]),i=l(),s=t.findIndex((e=>e.value===n)),o=S(0),d=S(0);return a((()=>{o.on((e=>i.current.style.transform=`translateX(${e}px)`)),d.on((e=>i.current.style.width=`${e}px`))}),[]),a((()=>{const e=c.current[s];0===d.value?(o.setValue(e.offsetLeft),d.setValue(e.offsetWidth)):(o.spring(e.offsetLeft),d.spring(e.offsetWidth))}),[s]),e.createElement("div",{className:"segmented"},e.createElement("div",{className:"segmented-indicator",ref:i}),t.map(((n,l)=>e.createElement($e,{key:n.value,item:n,index:l,isLast:l===t.length-1,active:s===l,onChange:r,ref:e=>c.current[l]=e}))))},Re=({options:t,value:n,disabled:l,autoComplete:a,onChangeValue:r})=>e.createElement("select",{className:v("text select",l&&"disabled"),onChange:e=>r(e.target.value),value:n,disabled:l,autoComplete:a},(()=>{if(t instanceof Array)return t.map((t=>e.createElement("option",{key:t.value,value:t.value,children:t.name})));Object.keys(t).map((n=>e.createElement("option",{key:n,value:n,children:t[n]})))})()),Xe=({leftText:t,rightText:n})=>e.createElement("div",{className:"tabular-row"},e.createElement("div",{className:"tabular-row-left"},t),e.createElement("div",{className:"tabular-row-right"},n)),Ye=(e,t=0)=>{let n=3735928559^t,l=1103547991^t;for(let t,a=0;a<e.length;a++)t=e.charCodeAt(a),n=Math.imul(n^t,2654435761),l=Math.imul(l^t,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(l^l>>>13,3266489909),l=Math.imul(l^l>>>16,2246822507),l^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&l)+(n>>>0)},We=360/Math.pow(2,53),Ue=o((({tag:t,count:n})=>{const l=(e=>`hsl(${180-We*Ye(e)}, 100%, 50%)`)(t);return e.createElement("div",{className:"tag",style:{borderColor:l,color:l},children:`${t} ${n||""}`})})),_e={code:"one-time-code"},Ie={phone:"tel",code:"tel"},je=t((({placeholder:t,value:l="",icon:a,type:r="text",dnt:c,disabled:i,rows:s=0,className:o,onFocus:m,autoComplete:u,onClick:h,maxLength:p,id:g,onChangeText:f=(()=>null),autoFocus:y,loading:b,RightComponent:N,countryCode:k,onChangePhone:C,lowerCase:x,min:w,max:M,onPressCountry:P,countries:S},T)=>{const[L,D]=n(l);return e.createElement("div",{className:"text-input"},"phone"===r&&(()=>{const t=S?S.find((e=>e.code===k)):null;return t?e.createElement(E,{className:"text-input-country",onClick:P},e.createElement("span",{className:"emoji"},t.flag),t.prefix):null})(),a?e.createElement(V,{className:"text-input-icon",icon:a}):"username"===r?e.createElement("span",{className:"text-input-icon"},"@"):"search"===r?e.createElement(V,{className:"text-input-icon",icon:"search"}):void 0,d("textarea"===r||s?"textarea":"input",{type:Ie[r]||r,autoComplete:_e[r],maxLength:p,className:v("text",i&&"disabled",c&&"fs-hide",o),readOnly:i,onChange:e=>{let t=e.target.value;D(t),"phone"===r?t=t.replace(/[^0-9]/g,""):(x&&(t=t.toLowerCase()),p&&(t=t.slice(0,p)),"username"===r&&(t=t.replace(/\s/g,""))),f(t)},value:(e=>{if("phone"===r&&k){const t=S.find((e=>e.code===k)),n=e.split("");return t.example.split("").map((e=>{if(n.length)return"X"===e?n.shift():e})).filter(Boolean).join("")}return e})(l),autoCapitalize:x&&"none",placeholder:t,rows:s,onFocus:m,onClick:h,id:g,autoFocus:y,ref:T,min:w,max:M}),a?e.createElement("img",{className:"text-input-icon",src:a}):null,N,b?e.createElement("div",{className:"text-input-spinner"},e.createElement(R,{size:18})):null,"search"!==r?null:l?e.createElement(E,{onClick:()=>f("")},e.createElement(V,{icon:"cancel",className:"text-input-clear"})):void 0)})),Ae=({pan:t,i:n,width:r})=>{const c=l();return a((()=>{if(!r)return;const e=n*r,l=r/3;return t.on((t=>{const n=Math.min(Math.abs(e-t),l);c.current.style.opacity=Math.min(1,1.5-n/l)}))}),[r]),e.createElement("div",{className:"pager-dot",ref:c,style:{opacity:t.value===n?1:.5}})},Be=({title:t,i:n,pan:r,width:c,onPress:i})=>{const s=l();return a((()=>{if(!c)return;const e=n*c,t=c/3;return r.on((n=>{const l=Math.min(Math.abs(e-n),t);s.current.style.opacity=1.5-l/t}))}),[c]),e.createElement("div",{children:t,className:"pager-tabs-title",onClick:()=>i(n),ref:s,style:{opacity:r.value===n?1:.5}})},He=t((({titles:t,children:n,vertical:r,dots:c,className:s},o)=>{const d=S(0),m=l(),u=l(),h=l({}).current;i(o,(()=>({scrollToPage:e=>{r?d.spring(e*g):d.spring(e*p)}})));const{width:p,height:g}=C(u,{enablePointerControls:!0,onCapture:e=>{if(r){if("v"===e.locked)return e.d.y<0||h.initPan-e.d.y>0}else if("h"===e.locked)return e.d.x<0||h.initPan-e.d.x>0},onDown:e=>{r?(h.currentPage=Math.round(d.value/e.height),h.initPan=d.value):(h.currentPage=Math.round(d.value/e.width),h.initPan=d.value)},onMove:e=>{if(r){const t=x(h.initPan-e.d.y,0,e.height*(n.length-1));d.setValue(t)}else{const t=x(h.initPan-e.d.x,0,e.width*(n.length-1));d.setValue(t)}},onUp:e=>{if(r)if(e.flick.y<0)d.spring(g*x(h.currentPage+1,0,n.length-1));else if(e.flick.y>0)d.spring(g*x(h.currentPage-1,0,n.length-1));else{const t=x(Math.round(d.value/e.height),0,n.length-1);d.spring(t*g)}else if(e.flick.x<0)d.spring(p*x(h.currentPage+1,0,n.length-1));else if(e.flick.x>0)d.spring(p*x(h.currentPage-1,0,n.length-1));else{const t=x(Math.round(d.value/e.width),0,n.length-1);d.spring(t*p)}},onPan:e=>{console.log("Pan:",e.d.x,e.d.y),d.setValue(x(d.value+e.d.x,0,p*(n.length-1)))}},[n]);a((()=>d.on((e=>{u.current.style.transform=`translate${r?"Y":"X"}(-${e}px)`,m.current&&(m.current.style.transform=`translateX(${e/n.length}px)`)}))),[p]);const E=e=>{d.spring(e*p)};return e.createElement("div",{className:v("pager",r?"vertical":"horizontal",s)},t?e.createElement("div",{className:"pager-tabs"},t.map(((t,n)=>e.createElement(Be,{key:n,title:t,pan:d,i:n,width:p,onPress:E}))),p?e.createElement("div",{className:"pager-tabs-indicator",ref:m,style:{width:p/t.length}}):null):null,e.createElement("div",{className:"pager-scroller"},e.createElement("div",{className:"pager-canvas",ref:u,style:{transform:r?"translateX(0px)":"translateY(0px)"}},e.Children.map(n,((t,n)=>e.createElement("div",{key:n,className:"pager-page",children:t}))))),c?e.createElement("div",{className:"pager-dots"},e.Children.map(n,((t,n)=>e.createElement(Ae,{key:n,pan:d,width:p,i:n})))):null)})),Oe=t((({children:t,title:n,search:r,onChangeSearch:c,searchLoading:s,hasScrollView:o=!0,headerRight:d,onClose:m,isVisible:u},h)=>{const v=l(),g=l(),E=S(0),f=()=>{console.log("close window"),m?E.spring(0).then(m):p.goBack(1)};i(h,(()=>({close:f})));const{height:y}=C(g,{onMove:e=>{E.setValue(y-Math.max(0,e.d.y))},onUp:e=>{1===e.flick.y||e.d.y>e.height/2?f():E.spring(e.height)}});return a((()=>{y&&(u||m?E.spring(y):E.spring(0))}),[u,y]),a((()=>{const e=document.querySelectorAll(".card");return E.on((t=>{const n=t/y;g.current&&(g.current.style.transform=`translateY(-${t}px)`),v.current&&(v.current.style.display=t?"block":"none",v.current.style.opacity=t/y*.8),[...e].forEach((e=>{e.style.transform=`scale(${1-.04*n})`}))}))}),[y]),e.createElement("div",{className:"layer"},e.createElement("div",{className:"shade",ref:v}),e.createElement("div",{className:"window",ref:g},e.createElement("div",{className:"window-content"},e.createElement(Q,{title:n,presentation:"modal",onClose:f,SearchComponent:c?e.createElement("div",{className:"header-search"},e.createElement(je,{placeholder:"Search",type:"search",value:r,onChangeText:c,loading:s})):null,headerRight:d}),o?e.createElement($,{className:"card-body",children:t}):e.createElement("div",{className:"card-body",children:t}))))})),Fe=({href:t,onClick:n,children:l,disabled:a,className:r})=>e.createElement(E,{className:v("touchable-highlight",a&&"disabled",r),onClick:n,href:t,children:l}),qe=new Map,Ke=e=>function(...t){const n=t[0];return qe.has(n)||qe.set(n,e.apply(this,t)),qe.get(n)},Ge=Ke((e=>new Promise((t=>{const n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",e),n.onload=()=>t(),document.head.appendChild(n)})))),Je=Ke(((e,t)=>new Promise((n=>{const l=document.createElement("script");l.type="text/javascript",l.async=!0,l.src=e,l.onload=()=>n(window[t]),document.head.appendChild(l)})))),Qe=({width:e,height:t})=>{document.documentElement.style.setProperty("--viewport-width",`${e}px`),document.documentElement.style.setProperty("--viewport-height",`${t}px`)};Qe({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}),new ResizeObserver((e=>{Qe(e[0].contentRect)})).observe(document.documentElement);const Ze=navigator.virtualKeyboard,et=()=>a((()=>{if(Ze)return Ze.overlaysContent=!0,()=>Ze.overlaysContent=!1}),[]);export{O as ActionSheet,R as ActivityIndicator,_ as Alert,P as AnimatedValue,q as Avatar,A as BottomSheet,K as BreadCrumbs,X as Button,te as Card,G as CheckBox,ne as CircleCheck,le as ConnectionIndicator,ae as CornerDialog,de as DashboardIcon,re as Dropdown,ue as DropdownItem,me as Emoji,f as FLICK_SPEED,he as Fab,we as FilterButton,pe as FullScreen,Ee as HeaderButton,V as Icon,ge as Image,ve as List,Ne as Modal,fe as PercentBar,xe as Pill,Z as Placeholder,Te as PoonOverlays,Le as ProgressIndicator,Ve as ProgressRing,D as PullIndicator,De as RadioButton,ie as Reveal,Q as ScreenHeader,$ as ScrollView,ze as SegmentedController,Re as Select,ee as Shade,Xe as TabularRow,Ue as Tag,je as TextInput,Pe as Toast,E as Touchable,Fe as TouchableHighlight,j as TouchableRow,He as ViewPager,Oe as Window,w as bounce,v as c,x as clamp,Ye as cyrb53,M as easeOutCubic,Ce as hideModal,Ge as loadCss,Je as loadScript,Ke as memoize,ye as modalState,se as setRevealOrigin,F as showActionSheet,I as showAlert,ke as showModal,g as toPercent,Se as toast,S as useAnimatedValue,C as usePanGestures,N as useSize,et as useVirtualKeyboard}; | ||
import e,{useMemo as t,forwardRef as n,useState as a,useRef as l,useEffect as r,Fragment as c,useImperativeHandle as i,Children as s,memo as o,createElement as m}from"react";import{createBus as d,useBus as u,randomId as h}from"poon-router/util.js";import{navigation as p}from"poon-router";const v=(...e)=>e.filter(Boolean).join(" "),g=e=>100*e+"%",E=(e,t,n)=>Math.min(Math.max(e,t),n),f=e=>Object.assign({},e),y=(e,t)=>Object.keys(e).every((n=>e[n]===t[n])),b=(e,t,n)=>e>n?n+(n+e)/50:e<t?t-(t-e)/50:e,N=e=>--e*e*e+1,k=(e,t)=>n=>E(n,e,t),x=(e,t,n)=>(1-e)*t+e*n;class C{constructor(e,t){this.id=t,this.listeners=[],this.value=e,this.oldValue=e}setValue=(e,t=!0)=>{if(isNaN(e))return console.warn("Cant animate NaN");t&&(delete this.id,this.oldValue=e),this.value=e,this.listeners.forEach((t=>t(e)))};spring=(e,t=C.defaultAnimationDuration)=>new Promise((n=>{if(e===this.value)return n();const a=this.id=performance.now(),l=this.value,r=c=>{if(a!==this.id)return;const i=Math.max(0,c-a);if(i>=t)this.setValue(e,!0),n();else{const n=(e-l)*N(i/t);this.setValue(l+n,!1),requestAnimationFrame(r)}};r(a)}));on=e=>(this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e)));end=()=>{delete this.id}}C.defaultAnimationDuration=300;const w=e=>t((()=>new C(e)),[]),M=n((({href:t,onClick:n,className:r,active:c,target:i,children:s,style:o,disableMenu:m},d)=>{const[u,h]=a(!1),p=l(!1),g=e=>{e.button&&0!==e.button||(e.stopPropagation(),p.current=!1,h(!0))},E=()=>{h(!1)};return e.createElement(t?"a":"button",{href:t,onTouchStart:g,onTouchMove:E,onTouchEnd:E,onMouseDown:g,onMouseUp:E,onMouseLeave:E,onClick:e=>{if(p.current)return e.preventDefault();n&&(t||e.preventDefault(),n(e))},className:v("touchable",r,u&&"touched",m&&"disable-menu",c&&"active"),target:i,draggable:!1,onContextMenu:m?e=>(e.preventDefault(),!1):void 0,style:o,type:"button",ref:d},s)})),z=/iPad|iPhone|iPod/.test(navigator.platform),P={"os:back":z?"arrow_back_ios":"arrow_back","os:share":z?"ios_share":"share","os:close":z?"keyboard_arrow_down":"close"},S=({icon:t,className:n,color:a,title:l,size:r,onClick:c})=>e.createElement("i",{className:v("material-icons",n),style:{color:a,fontSize:r},title:l,onClick:c,children:P[t]||t}),$=({title:t,meta:n,leftIcon:a,href:l,onClick:r,onPressMore:c,target:i,children:s,caret:o,disabled:m,RightComponent:d,className:u,active:h})=>e.createElement(M,{className:v("touchable-highlight touchable-row",m&&"disabled",u),onClick:r,href:l,target:i,active:h},e.createElement("div",{className:"touchable-row-left"},"string"==typeof a?e.createElement("div",{className:"touchable-row-icon"},e.createElement(S,{icon:a})):null,"object"==typeof a?e.createElement("div",{className:"touchable-row-icon"},a):null,e.createElement("div",{className:"touchable-row-content"},t?e.createElement("div",{className:"touchable-row-title",children:t}):null,n?e.createElement("div",{className:"meta",children:n}):null,s)),d,c?e.createElement(M,{onClick:c},e.createElement(S,{icon:"more_vert"})):null,o?e.createElement(S,{icon:"chevron_right"}):null),L=e=>{const[t,n]=a({width:e.current?.clientWidth,height:e.current?.clientHeight});return r((()=>{if(!e.current)return;const t=new ResizeObserver((e=>{const t=e[0].borderBoxSize[0];n({height:t.blockSize,width:t.inlineSize})}));return t.observe(e.current),t.disconnect.bind(t)}),[]),t},V={capture:!1,passive:!1},D=(e=0,t,n)=>{const a=Math.min(n,50)/50;return e*(1-a)+t*a};let T;const X=(e,t=0)=>({x:e.touches?e.touches[t].clientX:e.clientX,y:e.touches?e.touches[t].clientY:e.clientY}),Y=(e,t={},n)=>{const{width:a,height:c}=L(e),i=l({}).current;return r((()=>{if(!e.current)return;const n=e=>{const t=e-i.last.ts;if(t>0){const n=(i.x-i.last.x)/t,a=(i.y-i.last.y)/t;i.v={x:D(i.v.x,n,t),y:D(i.v.y,a,t)},i.last={x:i.x,y:i.y,ts:e}}},l=e=>{if(e.pageX<10&&e.preventDefault(),2===e.touches.length){const t=X(e,0),n=X(e,1),a=t.x-n.x,l=t.y-n.y;return void(i.pinch={d0:Math.sqrt(Math.pow(a,2)+Math.pow(l,2))})}T=null;for(let e in i)delete i[e];const{x:n,y:l}=X(e);Object.assign(i,{x:n,y:l,size:{x:a,y:c},width:a,height:c,locked:!1,touch:!1,origin:{x:n,y:l},d:{x:0,y:0},v:{x:0,y:0},s:{x:0,y:0},flick:null,last:{ts:e.timeStamp,x:n,y:l}}),t.onDown&&t.onDown(i)},r=a=>{if(!T||T===e.current){if(i.pinch){if(2===a.touches.length){i.locked="pinch";const e=X(a,0),n=X(a,1),l=e.x-n.x,r=e.y-n.y;i.pinch.d=Math.sqrt(Math.pow(l,2)+Math.pow(r,2)),t.onPinch&&t.onPinch({center:{x:(e.x+n.x)/2,y:(e.y+n.y)/2},scale:i.pinch.d/i.pinch.d0})}}else{const{x:e,y:t}=X(a);if(i.x=e,i.y=t,n(a.timeStamp),i.d={x:i.x-i.origin.x,y:i.y-i.origin.y},!i.locked){const e=Math.abs(i.d.x),t=Math.abs(i.d.y);(t>10||e>10)&&(i.locked=t>e?"y":"x")}}i.locked&&("x"===i.locked?i.distance=i.d.x:"y"===i.locked&&(i.distance=i.d.y),i.touch||(i.touch=t.onCapture({direction:i.locked,distance:i.d[i.locked],size:i.size[i.locked],pinch:i.pinch})),i.touch&&(a.stopPropagation(),T=e.current,t.onMove&&t.onMove({d:i.d,direction:i.locked,distance:i.d[i.locked],velocity:i.v[i.locked],size:i.size[i.locked]},a)))}},s=a=>{if(a.touches.length>0)return;if(T&&T!==e.current)return;if(!i.touch)return;n(a.timeStamp);const l=i.v[i.locked],r=Math.abs(l),c=i.d[i.locked],s=i.size[i.locked];if(i.locked){const e=r>=.25&&Math.sign(l)||Math.abs(c)>s/2&&Math.sign(c);t.onUp&&t.onUp({flick:-1*e,flickMs:Math.min((s-Math.abs(c))/r,300),direction:i.locked,velocity:l,size:s})}},o=n=>{e.current.scrollTop+=n.deltaY,t.onPan&&t.onPan({x:{distance:n.deltaX,size:a},y:{distance:n.deltaY,size:c}})};return e.current.addEventListener("touchstart",l,V),e.current.addEventListener("touchmove",r,V),e.current.addEventListener("touchend",s,V),e.current.addEventListener("wheel",o,V),t.onDoubleTap&&e.current.addEventListener("dblclick",t.onDoubleTap,V),()=>{e.current&&(e.current.removeEventListener("touchstart",l),e.current.removeEventListener("touchmove",r),e.current.removeEventListener("touchend",s),e.current.removeEventListener("wheel",o),t.onDoubleTap&&e.current.removeEventListener("dblclick",t.onDoubleTap))}}),[e,c,a,n]),{height:c,width:a}},R=n((({className:t,visible:n,pan:a,children:c,onClose:i,onPress:s,showShade:o,showHandle:m},d)=>{const u=l(),h=l(),{height:p}=Y(h,{onCapture:e=>"y"===e.direction,onMove:e=>{a.setValue(e.size-Math.max(e.distance/100,e.distance))},onUp:e=>{if(-1===e.flick)return a.spring(0,e.flickMs).then(i);a.spring(e.size)}});return r((()=>{if(p)return a.on((e=>{h.current.style.transform=`translateY(-${e}px)`,u.current&&(u.current.style.opacity=e/p)}))}),[p]),r((()=>{p&&(n?a.spring(p):a.spring(0).then(i))}),[n,p,i]),e.createElement("div",{className:"layer"},n&&o?e.createElement("div",{className:"shade shade-bottom-sheet",ref:u,onClick:()=>a.spring(0).then(i)}):null,e.createElement("div",{ref:h,className:v("sheet",t),onClick:s},m?e.createElement("div",{className:"handle"}):null,c))})),j=d(null),U=new C(0),W=()=>{const t=u(j);return t?e.createElement(R,{pan:U,visible:!!t,onClose:()=>j.update(null),showShade:!0},e.createElement("div",{className:"action-sheet-title"},t&&t.title),e.createElement("hr",null),t.options.map(((n,a)=>e.createElement($,{key:a,title:n.name,leftIcon:n.icon,onClick:e=>{n.onClick&&n.onClick(),t.callback&&t.callback(n.value),U.spring(0).then((()=>j.update(0)))},disabled:n.disabled,target:n.target,href:n.href})))):null},I=(e,t,n)=>j.update({title:e,options:t,callback:n}),O=new Array(12).fill(0),_=({size:t=16,color:n="#fff"})=>e.createElement("div",{className:"activity-indicator",style:{width:t,height:t},children:O.map(((a,l)=>{const r={width:1.7,borderRadius:1,left:t/2-1,height:t/4,animationDelay:(.1*l-1.1).toFixed(1)+"s",transform:`rotate(${30*l}deg)`,backgroundColor:n,transformOrigin:`50% ${t/2}px`};return e.createElement("div",{key:l,style:r})}))}),H=n((({pull:t},n)=>e.createElement("div",{className:"pull-indicator center",ref:n},e.createElement(S,{icon:"refresh",color:"#000"})))),A=n((({children:t,className:n,onRefresh:a,horizontal:i},s)=>{const o=s||l(),m=l(),d=l({}).current,u=w(0),h=w(0);Y(o,{onDown(){d.canScrollVertical=o.current.scrollHeight>o.current.clientHeight,d.canScrollHorizontal=o.current.scrollWidth>o.current.clientWidth,d.initScrollTop=o.current.scrollTop,d.initScrollLeft=o.current.scrollLeft,h.end()},onCapture:e=>"x"===e.direction?d.canScrollHorizontal:"y"===e.direction?!!(a&&0===o.current.scrollTop&&e.distance>0)||!!d.canScrollVertical&&(0===d.initScrollTop&&e.distance<0||d.initScrollTop>0):void 0,onMove(e){"y"===e.direction?a&&0===d.initScrollTop?u.setValue(Math.min(70,e.distance)):h.setValue(d.initScrollTop-e.distance):"x"===e.direction&&h.setValue(d.initScrollLeft-e.distance)},onUp(e){"y"===e.direction?a&&0===d.initScrollTop?e.distance>70?u.spring(0).then(a):u.spring(0):e.velocity&&h.spring(h.value-2e3*e.velocity,2e3):"h"===e.direction&&e.velocity&&h.spring(h.value-2e3*e.velocity,2e3)}}),r((()=>h.on((e=>{i?o.current.scrollLeft=e:o.current.scrollTop=e}))),[]),r((()=>{if(a)return u.on((e=>{const t=e/70;m.current.style.transform=`translateY(${e}px) rotate(${360*t}deg)`,m.current.style.opacity=t}))}),[]);return e.createElement(c,null,a?e.createElement("div",{className:"list-pull"},e.createElement(H,{pull:u,ref:m})):null,e.createElement("div",{className:v("scroller",n,i?"horizontal":"vertical"),ref:o,onScroll:()=>{navigator.virtualKeyboard?.hide(),document.activeElement.blur()},children:t}))})),B=({className:t,title:n,onClick:a,onDown:l,icon:r,href:i,tabIndex:s,color:o,disabled:m,download:d,iconImageUrl:u,loading:h,submit:p,fullWidth:g,target:E})=>{const f=v("btn",t,m&&"disabled",g&&"full-width",o&&`btn-${o}`);return e.createElement(M,{type:p?"submit":"button",className:f,onClick:e=>{d&&e.stopPropagation(),a&&a(e)},href:i,onTouchStart:l,tabIndex:s,children:h?e.createElement(_,null):e.createElement(c,null,u?e.createElement("img",{src:u,alt:n}):null,r?e.createElement(S,{icon:r}):null,n?e.createElement("span",null,n):null),target:E})},F=d([]),q=(e,t)=>{F.update(F.state.map((t=>(t===e&&(t.visible=!1),t)))),setTimeout((()=>{e.callback(t),F.update(F.state.filter((t=>t!==e)))}),300)},K=({alert:t,isLast:n})=>e.createElement("div",{className:v("alert-container",n&&t.visible&&t.className)},e.createElement("div",{className:v("alert",n&&t.visible&&"visible"),onClick:e=>e.stopPropagation()},e.createElement("div",{className:"alert-top"},t.title?e.createElement("div",{className:"alert-title"},t.title):null,t.message?e.createElement("div",{className:"alert-message"},t.message):null),t.options?e.createElement(A,{className:v("alert-buttons",t.options.length<=2&&"alert-buttons-horizontal"),children:t.options.map(((n,a)=>e.createElement(M,{key:a,className:v("alert-button",n.destructive&&"destructive"),onClick:()=>{n.onPress&&n.onPress(),q(t,n._id||n.value)},children:n.name,disableMenu:!0})))}):e.createElement("div",{className:"alert-bottom"},e.createElement(B,{color:"white",fullWidth:!0,title:"Close",onClick:()=>q(t)})))),G=()=>{const t=u(F),n=t.filter((e=>e.visible)).pop();return 0===t.length?null:e.createElement("div",{className:v("layer alert-backdrop",t.some((e=>e.visible))&&"visible"),onClick:()=>q(n),children:t.map((t=>e.createElement(K,{key:t.key,alert:t,isLast:n===t})))})},J=(e,t)=>new Promise((n=>{F.update([...F.state,{key:h(),callback:n,visible:!0,options:t,...e}])})),Q=({imageId:t,className:n,variant:a,getUrl:l})=>t?e.createElement("img",{draggable:!1,className:v("avatar",n),src:l(t,a)}):e.createElement("div",{draggable:!1,className:v("avatar",n)});Q.defaultProps={variant:"normal",getUrl:()=>null};const Z=({path:t,onClickPath:n})=>{const a=t.split("/").filter(Boolean);return 0===a.length?null:e.createElement(A,{horizontal:!0,className:"breadcrumbs"},e.createElement(S,{icon:"home",onClick:()=>n("/")}),e.createElement("span",null," / "),a.map(((t,l)=>e.createElement(c,{key:t+"_"+l},e.createElement(M,{onClick:()=>n(),children:t}),l<a.length-1?e.createElement("span",null," / "):null))))},ee={card:"os:back",modal:"os:close"},te=({title:t,subtitle:n,presentation:a="card",onClose:l,headerRight:r,SearchComponent:i})=>{const s=ee[a];return e.createElement(c,null,e.createElement("div",{className:"header"},e.createElement("div",{className:"header-spacer"},s&&e.createElement(M,{className:"header-close",onClick:e=>{e.stopPropagation(),e.preventDefault(),l()},children:e.createElement(S,{icon:s})})),e.createElement("div",{className:"header-middle"},e.createElement("div",{className:"header-title"},t),n?e.createElement("div",{className:"header-subtitle"},n):null),e.createElement("div",{className:"header-spacer"},r)),i)},ne=({className:t,icon:n,title:a,message:l,children:r})=>e.createElement("div",{className:v("placeholder",t)},n?e.createElement(S,{icon:n}):null,a?e.createElement("div",{className:"title"},a):null,l?e.createElement("div",{className:"placeholder-message"},l):null,r),ae=n((({},t)=>{const n=l();return i(t,(()=>({progress:(e,t)=>{n.current&&(n.current.style.opacity=1-e/t)}}))),e.createElement("div",{className:"shade shade-card",ref:n})})),le=n((({title:t,subtitle:n,children:c,footer:i,headerRight:s,SearchComponent:o,disableGestures:m,onDrop:d,isVisible:u=!0,animateIn:h=!0,ShadeComponent:g=ae,HeaderComponent:E,className:f},y)=>{y=y||l();const b=l(history.length>1).current,[N,k]=a(!1),x=l(),C=w(h?document.body.clientWidth:0),M=()=>C.spring(z).then((()=>{b&&p.goBack()})),{width:z}=Y(y,{onCapture:e=>{if(b&&!m)return"x"===e.direction&&e.distance>0},onMove:e=>{C.setValue(Math.max(0,e.distance))},onUp:e=>{if(-1===e.flick)return M();C.spring(0)}});r((()=>{z&&h&&C.spring(u?0:z)}),[h,u,z]),r((()=>C.on((e=>{y.current&&(y.current.style.transform=`translateX(${e}px)`),x.current&&x.current.progress(e,z)}))),[z]);return e.createElement("div",{className:"layer"},g?e.createElement(g,{ref:x}):null,e.createElement("div",{className:v("card",h&&"animate",f),ref:y,onDragOver:d&&(e=>{e.preventDefault()}),onDragEnter:d&&(e=>{k(!0)}),onDragLeave:d&&(e=>{k(!1)}),onDrop:d&&(e=>{k(!1),d(e)})},null===E?null:E||e.createElement(te,{title:t,subtitle:n,presentation:"card",SearchComponent:o,onClose:M,headerRight:s}),e.createElement("div",{className:"card-body",children:c}),i,N?e.createElement(ne,{className:"drop-zone",icon:"upload",title:"Upload"}):null))})),re=({active:t,undetermined:n})=>e.createElement("div",{className:v("toggle-check",t&&"active",n&&"undetermined")},e.createElement(S,{icon:n?"horizontal_rule":t?"check":null})),ce=({active:t})=>e.createElement("div",{className:v("circle-check",t&&"active")},e.createElement(S,{icon:"check"})),ie=({status:t})=>"connected"===t?null:e.createElement("div",{className:"connection-indicator"},e.createElement("div",{className:"bubble"},e.createElement(_,null),t)),se=({title:t,children:n,isVisible:a,onClose:l})=>a?e.createElement("div",{className:"corner-dialog"},e.createElement("div",{className:"corner-dialog-title"},t,e.createElement(S,{icon:"close",onClick:l})),n):null;let oe={};const me=n((({children:t,title:n,headerRight:a,onClose:c,isVisible:s,animateIn:o,className:m},d)=>{const u=l(),h=l(),E=w(o?0:1),f=()=>p.goBack(1);i(d,(()=>({close:f})));const{width:y,height:b}=Y(u,{onCapture:e=>"x"===e.direction&&e.distance>0,onMove(e){E.setValue(1-e.distance/e.size)},onUp(e){if(-1===e.flick)return f();E.spring(1)}});return r((()=>{o&&(s?E.spring(1):E.spring(0))}),[o,s]),r((()=>E.on((e=>{const t=1-e,n=oe.x*t,a=oe.y*t;u.current.style.transform=`translate(${n}px, ${a}px)`,u.current.style.width=g(e),u.current.style.height=g(e),h.current.style.transform=`translate(${-1*n}px, ${-1*a}px)`,h.current.style.opacity=e}))),[y,b]),e.createElement("div",{className:"layer reveal",ref:u},e.createElement("div",{className:v("card reveal-content",m),ref:h},e.createElement(te,{title:n,onClose:f,headerRight:a,presentation:"card"}),e.createElement("div",{className:"card-body",children:t})))})),de=(e,t)=>Object.assign(oe,{x:e,y:t}),ue=e=>{const t=e.currentTarget.getBoundingClientRect();de((t.left+t.right)/2,(t.top+t.bottom)/2)},he=({title:t,icon:n,href:a})=>e.createElement(M,{href:a,className:"springboard-icon",onClick:ue},e.createElement("div",{className:"icon-frame"},e.createElement(S,{icon:n})),e.createElement("div",{className:"springboard-icon-name"},t)),pe=({position:t,button:n,content:l})=>{const[c,i]=a(!1);return r((()=>{if(!c)return;const e=e=>{e.composedPath().some((e=>e.classList&&e.classList.contains("dropdown-content")))||i(!1)};return setTimeout((()=>{window.addEventListener("click",e,{passive:!1})}),0),()=>window.removeEventListener("click",e)}),[c]),e.createElement("div",null,e.createElement("span",{className:"dropdown"},e.createElement("div",{children:n,className:"dropdown-button",onClick:()=>{console.log("show"),i(!0)}}),e.createElement("div",{className:v("dropdown-content",t||"top-right",c?"visible":"hidden"),children:l})))},ve=({title:t,icon:n,onClick:a,href:l,disabled:r,children:c,active:i})=>e.createElement($,{className:"dropdown-item",onClick:a,disabled:r,active:i,children:c,href:l,leftIcon:n,title:t}),ge=({emoji:t})=>e.createElement("span",{className:"emoji",children:t}),Ee=({icon:t,title:n,loading:a,disabled:l,active:r=!0,href:i,onPress:s})=>e.createElement(M,{className:v("fab",!n&&"round"),loading:a,disabled:l,active:r,onClick:s,href:i},a?e.createElement(_,{color:"#000"}):e.createElement(c,null,e.createElement(S,{icon:t}),n&&e.createElement("div",{className:"fab-title"},n))),fe=({title:t,children:n,footer:a,headerRight:c,SearchComponent:i})=>{const s=l(),o=w(0);return r((()=>(o.spring(1),o.on((e=>{s.current.style.opacity=e})))),[]),e.createElement("div",{className:"fullscreen",ref:s},e.createElement(te,{title:t,presentation:"full",onClose:()=>{o.spring(0).then((()=>p.goBack()))},headerRight:c,SearchComponent:i}),e.createElement(A,{className:"card-body"},n),a)};class ye{constructor(e){this.listeners=[],this.values=e,this.initialValues=f(e)}set=(e,t=!0)=>{Object.assign(this.values,e),t&&this.end(),this.listeners.forEach((e=>e(this.values)))};spring=(e,t=ye.defaultDuration)=>new Promise((n=>{if(y(e,this.values))return n();const a=this.id=performance.now(),l=f(this.values),r=c=>{if(a!==this.id)return;const i=Math.max(0,c-a);if(i>=t)this.set(e,!0),n();else{const n=Object.keys(e).reduce(((n,a)=>(n[a]=l[a]+(e[a]-l[a])*N(i/t),n)),{});this.set(n,!1),requestAnimationFrame(r)}};r(a)}));on=e=>(this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e)));stop=()=>{delete this.id};end=()=>{delete this.id,this.initialValues=f(this.values)}}ye.defaultDuration=300;const be=e=>t((()=>new ye(e)),[]),Ne=({children:t,onClose:n})=>{const a=l(null),c=be({zoom:1,panX:0,panY:0});r((()=>c.on((e=>{a.current.style.transform=`scale(${e.zoom}) translateX(${e.panX/e.zoom}px) translateY(${e.panY/e.zoom}px)`}))),[]);const i=()=>{const e=a.current.querySelector("img"),t=e.clientWidth*c.values.zoom,n=e.clientHeight*c.values.zoom;return{maxPanX:t>a.current.clientWidth?(t-a.current.clientWidth)/2:0,maxPanY:n>a.current.clientHeight?(n-a.current.clientHeight)/2:0}};return Y(a,{onCapture(e){const{maxPanX:t,maxPanY:n}=i();return"x"===e.direction&&t>0||("y"===e.direction&&n>0||!!e.pinch)},onPinch(e){const{maxPanX:t,maxPanY:n}=i(),a=c.initialValues.zoom*e.scale;c.set({zoom:a,panX:E(c.initialValues.panX,-t,t),panY:E(c.initialValues.panY,-n,n)},!1)},onMove(e){if(c.values.zoom<=1)return;const{maxPanX:t,maxPanY:n}=i();c.set({panX:t&&E(c.initialValues.panX+e.d.x,-t,t),panY:n&&E(c.initialValues.panY+e.d.y,-n,n)},!1)},onUp:e=>c.values.zoom<1?c.spring({zoom:1,panX:0,panY:0}):c.values.zoom>3?c.spring({zoom:3}):void c.end(),onDoubleTap(){1===c.values.zoom?c.spring({zoom:3}):c.spring({zoom:1,panX:0,panY:0})}},[]),e.createElement("div",{className:"gallery-item",ref:a,children:t})},ke=({icon:t,title:n,badge:a,loading:l,disabled:r,onClick:c,active:i,href:s})=>e.createElement(M,{className:v("header-button center","Cancel"===n&&"header-cancel"),onClick:c,loading:l,disabled:r,active:i,href:s},t?e.createElement(S,{icon:t}):null,n?e.createElement("span",null,n):null,a?e.createElement("span",{className:"badge"},a):null),xe=({ar:t,url:n,alt:a,className:l,children:r,base64Png:c})=>e.createElement("div",{className:v("img",l)},e.createElement("div",{style:{paddingTop:100*(t||1)+"%"}}),n?e.createElement("img",{src:n,className:"img-real",alt:a,draggable:!1}):c?e.createElement("img",{src:`data:image/png;base64,${c}`}):e.createElement("div",{className:"img-real",alt:a,draggable:!1}),r?e.createElement("div",{className:"img-inside"},r):null),Ce=({title:t,items:n=[],keyExtractor:a=(e=>e._id),renderItem:l,loading:r,className:i,ListEmptyComponent:o,HeaderComponent:m,children:d,showSeparators:u=!0})=>e.createElement("div",{className:v("list",i)},t?e.createElement(c,null,e.createElement("div",{className:"list-title"},t),e.createElement("hr",null)):null,m,n.length||d?e.createElement("div",{className:"list-body"},r||!n?null:o&&0===n.length?o:n.map(((t,r)=>e.createElement(c,{key:a(t)},l(t,r),u&&r<n.length-1&&e.createElement("hr",null)))),s.map(d,((t,n)=>e.createElement(c,{key:n},t,n<d.length-1&&e.createElement("hr",null))))):o),we=d([]),Me=t=>e.createElement("div",{key:t.id,className:"layer",children:t.children}),ze=()=>u(we).map(Me),Pe=e=>we.update([...we.state,{id:Math.random(),children:e}]),Se=()=>{we.update([])},$e=d([]),Le=({title:t,body:n,onDismiss:a=(()=>null)})=>{const c=l(),i=w(0);Y(c,{onCapture:e=>"x"===e.direction,onMove(e){i.setValue(e.distance/e.size)},onUp(e){e.flick?i.spring(-e.flick):i.spring(0)}},[]);return r((()=>i.on((e=>{c.current.style.opacity=1-Math.abs(e),c.current.style.transform=`translateX(${g(e)})`}))),[]),e.createElement("div",{className:"notification",ref:c},e.createElement("div",null,e.createElement("div",{className:"notification-title"},t),e.createElement("div",{className:"notification-body"},n)),e.createElement(M,{onClick:()=>{i.spring(1).then(a)}},e.createElement(S,{icon:"close"})))},Ve=()=>{const t=u($e);return 0===t.length?null:e.createElement("div",{className:"layer notifications-container"},t.map((t=>e.createElement(Le,t))))},De=e=>{$e.update([...$e.state,{key:h(),...e}])},Te=({percent:t})=>e.createElement("div",{className:"percent-bar"},e.createElement("div",{className:"percent-bar-inner",style:{width:100*t+"%"}})),Xe=({title:t,color:n,onClick:a})=>e.createElement(M,{className:"pill",onClick:a,style:{backgroundColor:n}},t),Ye=({title:t,LeftComponent:n,caret:a=!0,checked:l,active:r,href:c,onPress:i})=>e.createElement(M,{className:"filter-button",onClick:i,active:r,interactive:!0,href:c},n,t?e.createElement("div",{className:"filter-button-title"},t):null,a?e.createElement(S,{className:"filter-button-caret",icon:"expand_more"}):e.createElement(re,{active:l})),Re=d(),je=()=>{const t=u(Re);return r((()=>{if(!t)return;const e=setTimeout((()=>Re.update(null)),2e3);return()=>clearTimeout(e)}),[t]),t?e.createElement("div",{className:"toast-container"},e.createElement("div",{className:"toast",children:t})):null},Ue=Re.update,We=()=>e.createElement(c,null,e.createElement(Ve,null),e.createElement(ze,null),e.createElement(W,null),e.createElement(G,null),e.createElement(je,null)),Ie=()=>e.createElement("div",{className:"progress-indicator"}),Oe=({color:t="#fff",size:n=20,percent:a,spinning:l,completedIcon:r="check"})=>{if(l||!a)return e.createElement(Ie,null);if(1===a)return e.createElement(S,{icon:r});const c=n/2,i=c-1,s=2*i*Math.PI,o=s-a*s;return e.createElement("svg",{height:n,width:n},e.createElement("circle",{stroke:t,opacity:.3,fill:"transparent",strokeWidth:2,r:i,cx:c,cy:c}),e.createElement("circle",{strokeDasharray:s+" "+s,style:{strokeDashoffset:o,transform:"rotate(-90deg)",transformOrigin:"50% 50%"},stroke:t,fill:"transparent",strokeWidth:2,r:i,cx:c,cy:c}))},_e=({active:t,icon:n,title:a,elaboration:l,subtitle:r,value:c,disabled:i,onClick:s,children:o})=>e.createElement($,{onClick:()=>{s(c)},disabled:i,className:"radio-btn",active:t},e.createElement("div",{className:"radio-top"},e.createElement("div",{className:"dot"},e.createElement("div",{className:"dot-inside"})),n&&e.createElement(S,{icon:n}),e.createElement("div",{className:"radio-title"},a)),o&&e.createElement("div",{className:"radio-subtitle"},o),r&&e.createElement("div",{className:"radio-subtitle"},r),t&&l&&e.createElement("div",{className:"radio-subtitle",children:l})),He=n((({item:t,isLast:n,active:a,onChange:l,index:r},i)=>e.createElement(c,null,e.createElement(M,{children:t.name,onClick:()=>l(t.value),active:a,ref:i}),n?null:e.createElement("div",{className:"separator"})))),Ae=({options:t,value:n,onChange:a})=>{const c=l([]),i=l(),s=t.findIndex((e=>e.value===n)),o=w(0),m=w(0);return r((()=>{o.on((e=>i.current.style.transform=`translateX(${e}px)`)),m.on((e=>i.current.style.width=`${e}px`))}),[]),r((()=>{const e=c.current[s];0===m.value?(o.setValue(e.offsetLeft),m.setValue(e.offsetWidth)):(o.spring(e.offsetLeft),m.spring(e.offsetWidth))}),[s]),e.createElement("div",{className:"segmented"},e.createElement("div",{className:"segmented-indicator",ref:i}),t.map(((n,l)=>e.createElement(He,{key:n.value,item:n,index:l,isLast:l===t.length-1,active:s===l,onChange:a,ref:e=>c.current[l]=e}))))},Be=({options:t,value:n,disabled:a,autoComplete:l,onChangeValue:r})=>e.createElement("select",{className:v("text select",a&&"disabled"),onChange:e=>r(e.target.value),value:n,disabled:a,autoComplete:l},(()=>{if(t instanceof Array)return t.map((t=>e.createElement("option",{key:t.value,value:t.value,children:t.name})));Object.keys(t).map((n=>e.createElement("option",{key:n,value:n,children:t[n]})))})()),Fe=({leftText:t,rightText:n})=>e.createElement("div",{className:"tabular-row"},e.createElement("div",{className:"tabular-row-left"},t),e.createElement("div",{className:"tabular-row-right"},n)),qe=(e,t=0)=>{let n=3735928559^t,a=1103547991^t;for(let t,l=0;l<e.length;l++)t=e.charCodeAt(l),n=Math.imul(n^t,2654435761),a=Math.imul(a^t,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(a^a>>>13,3266489909),a=Math.imul(a^a>>>16,2246822507),a^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&a)+(n>>>0)},Ke=360/Math.pow(2,53),Ge=o((({tag:t,count:n})=>{const a=(e=>`hsl(${180-Ke*qe(e)}, 100%, 50%)`)(t);return e.createElement("div",{className:"tag",style:{borderColor:a,color:a},children:`${t} ${n||""}`})})),Je={code:"one-time-code"},Qe={phone:"tel",code:"tel"},Ze=n((({placeholder:t,value:n="",icon:l,type:r="text",dnt:c,disabled:i,rows:s=0,className:o,onFocus:d,autoComplete:u,onClick:h,maxLength:p,id:g,onChangeText:E=(()=>null),autoFocus:f,loading:y,RightComponent:b,countryCode:N,onChangePhone:k,lowerCase:x,min:C,max:w,onPressCountry:z,countries:P},$)=>{const[L,V]=a(n);return e.createElement("div",{className:"text-input"},"phone"===r&&(()=>{const t=P?P.find((e=>e.code===N)):null;return t?e.createElement(M,{className:"text-input-country",onClick:z},e.createElement("span",{className:"emoji"},t.flag),t.prefix):null})(),l?e.createElement(S,{className:"text-input-icon",icon:l}):"username"===r?e.createElement("span",{className:"text-input-icon"},"@"):"search"===r?e.createElement(S,{className:"text-input-icon",icon:"search"}):void 0,m("textarea"===r||s?"textarea":"input",{type:Qe[r]||r,autoComplete:Je[r],maxLength:p,className:v("text",i&&"disabled",c&&"fs-hide",o),readOnly:i,onChange:e=>{let t=e.target.value;V(t),"phone"===r?t=t.replace(/[^0-9]/g,""):(x&&(t=t.toLowerCase()),p&&(t=t.slice(0,p)),"username"===r&&(t=t.replace(/\s/g,""))),E(t)},value:(e=>{if("phone"===r&&N){const t=P.find((e=>e.code===N)),n=e.split("");return t.example.split("").map((e=>{if(n.length)return"X"===e?n.shift():e})).filter(Boolean).join("")}return e})(n),autoCapitalize:x&&"none",placeholder:t,rows:s,onFocus:d,onClick:h,id:g,autoFocus:f,ref:$,min:C,max:w}),l?e.createElement("img",{className:"text-input-icon",src:l}):null,b,y?e.createElement("div",{className:"text-input-spinner"},e.createElement(_,{size:18})):null,"search"!==r?null:n?e.createElement(M,{onClick:()=>E("")},e.createElement(S,{icon:"cancel",className:"text-input-clear"})):void 0)})),et=({href:t,onClick:n,children:a,disabled:l,className:r})=>e.createElement(M,{className:v("touchable-highlight",l&&"disabled",r),onClick:n,href:t,children:a}),tt=({pan:t,i:n})=>{const a=l();return r((()=>t.on((e=>{const t=Math.abs(n-e);a.current.style.opacity=Math.max(.5,1-t)}))),[]),e.createElement("div",{className:"pager-dot",ref:a,style:{opacity:t.value===n?1:.5}})},nt=({title:t,i:n,pan:a,onPress:c})=>{const i=l();return r((()=>a.on((e=>{const t=Math.abs(n-e);i.current.style.opacity=Math.max(.5,1-t)}))),[]),e.createElement("div",{children:t,className:"pager-tabs-title",onClick:()=>c(n),ref:i,style:{opacity:a.value===n?1:.5}})},at=n((({titles:t,children:n,vertical:a,dots:c,className:o,page:m=0,gap:d=0},u)=>{const h=w(m),p=l(),E=l(),f=l({}).current,y=s.count(n)-1,b=a?"y":"x",N=k(0,y);i(u,(()=>({scrollToPage:e=>h.spring(N(e))})));const{width:x,height:C}=Y(E,{pointerControls:!0,onCapture(e){if(e.direction===b)return e.distance<0||f.initPan-e.distance/e.size>0},onDown(e){h.end(),f.currentPage=Math.round(h.value),f.initPan=h.value},onMove(e){const t=N(f.initPan-e.distance/e.size);h.setValue(t)},onPan(e){const t=e[b],n=h.value-t.distance/t.size;h.setValue(N(n))},onUp(e){if(e.flick){const t=N(f.currentPage+e.flick);h.spring(t,e.flickMs)}else{const e=N(Math.round(h.value));h.spring(e)}}},[n]);return r((()=>{h.spring(m)}),[m]),r((()=>h.on((e=>{E.current.style.transform=a?`translateY(-${e*C+d*e}px)`:`translateX(-${e*x+d*e}px)`,p.current&&(p.current.style.transform=`translateX(${g(e)})`)}))),[a,C,x]),e.createElement("div",{className:v("pager",a?"vertical":"horizontal",o)},t?e.createElement("div",{className:"pager-tabs"},t.map(((t,n)=>e.createElement(nt,{key:n,title:t,pan:h,i:n,onPress:h.spring}))),x?e.createElement("div",{className:"pager-tabs-indicator",ref:p,style:{width:g(1/t.length)}}):null):null,e.createElement("div",{className:"pager-scroller"},e.createElement("div",{className:"pager-canvas",ref:E,style:{transform:a?`translateY(calc(-${g(m)} - ${m*d}px))`:`translateX(calc(-${g(m)} - ${m*d}px))`}},s.map(n,((t,n)=>e.createElement("div",{key:n,className:"pager-page",children:t,style:a?{marginBottom:d}:{marginRight:d}}))))),c?e.createElement("div",{className:"pager-dots"},s.map(n,((t,n)=>e.createElement(tt,{key:n,pan:h,i:n})))):null)})),lt=n((({children:t,title:n,search:a,onChangeSearch:c,searchLoading:s,headerRight:o,onClose:m,isVisible:d,presentation:u="modal"},h)=>{const v=l(),g=l(),E=w(0),f=()=>{m?E.spring(0).then(m):p.goBack(1)};i(h,(()=>({close:f})));const{height:y}=Y(g,{onCapture:e=>"y"===e.direction&&e.distance>0,onMove:e=>{E.setValue(y-Math.max(0,e.distance))},onUp:e=>{if(-1===e.flick)return f();E.spring(e.size)}});return r((()=>{y&&(d||m?E.spring(y):E.spring(0))}),[d,y]),r((()=>{const e=document.querySelectorAll(".card");return E.on((t=>{const n=t/y;g.current&&(g.current.style.transform=`translateY(-${t}px)`),v.current&&(v.current.style.display=t?"block":"none",v.current.style.opacity=t/y),[...e].forEach((e=>{e.parentElement.style.transform=`scale(${1-.04*n})`}))}))}),[y]),e.createElement("div",{className:"layer"},e.createElement("div",{className:`shade shade-${u}`,ref:v}),e.createElement("div",{className:`window window-${u}`,ref:g},"modal"===u?e.createElement(te,{title:n,presentation:"modal",onClose:f,SearchComponent:c?e.createElement("div",{className:"header-search"},e.createElement(Ze,{placeholder:"Search",type:"search",value:a,onChangeText:c,loading:s})):null,headerRight:o}):null,e.createElement("div",{className:"card-body",children:t})))})),rt=new Map,ct=e=>function(...t){const n=t[0];return rt.has(n)||rt.set(n,e.apply(this,t)),rt.get(n)},it=ct((e=>new Promise((t=>{const n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",e),n.onload=()=>t(),document.head.appendChild(n)})))),st=ct(((e,t)=>new Promise((n=>{const a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=e,a.onload=()=>n(window[t]),document.head.appendChild(a)})))),ot=({width:e,height:t})=>{document.documentElement.style.setProperty("--viewport-width",`${e}px`),document.documentElement.style.setProperty("--viewport-height",`${t}px`)};ot({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}),new ResizeObserver((e=>{ot(e[0].contentRect)})).observe(document.documentElement);const mt=navigator.virtualKeyboard,dt=()=>r((()=>{if(mt)return mt.overlaysContent=!0,()=>mt.overlaysContent=!1}),[]);export{W as ActionSheet,_ as ActivityIndicator,G as Alert,C as AnimatedValue,ye as Animation,Q as Avatar,R as BottomSheet,Z as BreadCrumbs,B as Button,le as Card,re as CheckBox,ce as CircleCheck,ie as ConnectionIndicator,se as CornerDialog,he as DashboardIcon,pe as Dropdown,ve as DropdownItem,ge as Emoji,Ee as Fab,Ye as FilterButton,fe as FullScreen,Ne as GalleryItem,ke as HeaderButton,S as Icon,xe as Image,Ce as List,ze as Modal,Ve as Notifications,Te as PercentBar,Xe as Pill,ne as Placeholder,We as PoonOverlays,Ie as ProgressIndicator,Oe as ProgressRing,H as PullIndicator,_e as RadioButton,me as Reveal,te as ScreenHeader,A as ScrollView,Ae as SegmentedController,Be as Select,ae as Shade,Fe as TabularRow,Ge as Tag,Ze as TextInput,je as Toast,M as Touchable,et as TouchableHighlight,$ as TouchableRow,at as ViewPager,lt as Window,b as bounce,v as c,E as clamp,f as clone,k as createClamp,qe as cyrb53,N as easeOutCubic,Se as hideModal,x as lerp,it as loadCss,st as loadScript,ct as memoize,we as modalState,y as sameObject,de as setRevealOrigin,I as showActionSheet,J as showAlert,Pe as showModal,De as showNotification,g as toPercent,Ue as toast,w as useAnimatedValue,be as useAnimation,Y as useGesture,L as useSize,dt as useVirtualKeyboard}; |
{ | ||
"name": "poon-ui", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "The provocative UI framework that's so native it's indecent!", | ||
@@ -8,4 +8,4 @@ "type": "module", | ||
"scripts": { | ||
"rollup": "rollup -c", | ||
"patch": "rollup -c && git commit -a -m \"publish\" && npm version patch && npm publish" | ||
"rollup": "rollup -c --watch", | ||
"build": "npx rollup -c" | ||
}, | ||
@@ -24,9 +24,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "^7.22.9", | ||
"@babel/core": "^7.22.9", | ||
"@babel/preset-env": "^7.22.9", | ||
"@babel/preset-react": "^7.22.5", | ||
"@babel/cli": "^7.23.0", | ||
"@babel/core": "^7.23.0", | ||
"@babel/preset-env": "^7.22.20", | ||
"@babel/preset-react": "^7.22.15", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-multi-entry": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^15.2.1", | ||
"@rollup/plugin-terser": "^0.4.3", | ||
@@ -33,0 +33,0 @@ "rollup-plugin-filesize": "^10.0.0" |
@@ -1,3 +0,8 @@ | ||
# Poon UI | ||
## Poon-UI | ||
A framework for fancy Web Apps. | ||
<img src="http://localhost:5173/docs/banner.png"> | ||
A framework for fancy Web Apps! | ||
<img src="https://img.shields.io/badge/bundle_size-57.6%20kB-blue"> | ||
<img src="https://img.shields.io/badge/minified_size-30.4%20kB-blue"> |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8
99127
4
2339