efficient-shell 15.8.0 → 16.0.0
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/README.md +5 -4
- package/dist/{Browser-5QLDJ74Z.js → Browser-WSLWUH3Q.js} +17 -17
- package/dist/{Calculator-6WNTZLWL.js → Calculator-MBHZSFJ6.js} +22 -22
- package/dist/{CurrencyConverter-C4KCZWUM.js → CurrencyConverter-7FPB7WJE.js} +10 -10
- package/dist/{Files-VFRXPQLV.js → Files-4GEECDQU.js} +60 -60
- package/dist/{Notepad-S5JMXH2O.js → Notepad-SYEZ5AN6.js} +9 -9
- package/dist/{PdfViewer-AIAVQYZ6.js → PdfViewer-KS2BCFSA.js} +1 -1
- package/dist/PomodoroTimer-TYSJOYDJ.js +91 -0
- package/dist/{Preview-HTFTEL7K.js → Preview-L5DOMSGD.js} +24 -24
- package/dist/Sidebar-IU4EG3D3.js +44 -0
- package/dist/{Stock-LIOPTQG5.js → Stock-Y74YC25V.js} +3 -3
- package/dist/{Weather-K3BVAFRV.js → Weather-EO4LYAPA.js} +22 -22
- package/dist/{WorldClock-RHAHXLW4.js → WorldClock-3E3KLHSD.js} +7 -7
- package/dist/ai/index.js +37 -37
- package/dist/apps/ImageAnnotator.js +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/FlowChart.js +1 -1
- package/dist/{chunk-LFUXWZV7.js → chunk-2EBHJGMM.js} +1 -1
- package/dist/{chunk-EA423N2F.js → chunk-32EOC6E7.js} +3 -3
- package/dist/chunk-37FQVY2O.js +2 -0
- package/dist/{chunk-VHBRVW5O.js → chunk-3OK5VZOU.js} +3 -3
- package/dist/{chunk-UYM7562M.js → chunk-43YU7YWL.js} +2 -2
- package/dist/{chunk-XYVFJLAU.js → chunk-452LT77I.js} +1 -1
- package/dist/chunk-4YH7U7WL.js +1 -0
- package/dist/{chunk-KERCZSIA.js → chunk-54WCVNJJ.js} +1 -1
- package/dist/{chunk-OK2J6WSC.js → chunk-6ZQC6XFU.js} +1 -1
- package/dist/{chunk-A3RD7AQ2.js → chunk-7AF5JGRM.js} +1 -1
- package/dist/{chunk-RIA6KKIB.js → chunk-7EPCBDS5.js} +6 -6
- package/dist/{chunk-4NTAZLT3.js → chunk-7KUHILEA.js} +3 -3
- package/dist/chunk-ATTQTQJI.js +14 -0
- package/dist/chunk-AYTGYEOI.js +8 -0
- package/dist/{chunk-S6C7X6CR.js → chunk-AZANUXJT.js} +16 -16
- package/dist/{chunk-QSFQTMWV.js → chunk-BGLUOC7W.js} +1 -1
- package/dist/{chunk-D7MRZZVV.js → chunk-BYTQRQ5P.js} +1 -1
- package/dist/{chunk-DVKOVZJ2.js → chunk-DFI5EHSV.js} +12 -12
- package/dist/{chunk-GUUBFQ6L.js → chunk-DYJQIZX2.js} +2 -2
- package/dist/{chunk-YFVQKS5U.js → chunk-GH7RPWJO.js} +1 -1
- package/dist/{chunk-KTI4ZJVX.js → chunk-GNB6KUCT.js} +1 -1
- package/dist/chunk-GURLMAZM.js +3 -0
- package/dist/{chunk-GUOAPXUY.js → chunk-GZ57F6PN.js} +4 -4
- package/dist/chunk-IDH323EU.js +6 -0
- package/dist/{chunk-5OXQ5M5S.js → chunk-JKO4JZPO.js} +1 -1
- package/dist/{chunk-YEDAXZYO.js → chunk-JU6VBLTU.js} +1 -1
- package/dist/{chunk-ZVKUOJNS.js → chunk-JUGRSO5J.js} +1 -1
- package/dist/{chunk-PCNFY6EK.js → chunk-LH7ZKPHJ.js} +12 -12
- package/dist/{chunk-5QHNDAZ6.js → chunk-LLXI57MB.js} +1 -1
- package/dist/chunk-LRASKGEZ.js +4 -0
- package/dist/chunk-LYGIOJ3J.js +1 -0
- package/dist/{chunk-V62FEHS4.js → chunk-MDXZ7YAC.js} +1 -1
- package/dist/{chunk-62UNBUTU.js → chunk-NO5BMPT5.js} +1 -1
- package/dist/{chunk-3AVXNZY5.js → chunk-NPBRNEMR.js} +1 -1
- package/dist/chunk-NSSMK5JR.js +1 -0
- package/dist/{chunk-WGDVYCQX.js → chunk-OHRKENEP.js} +21 -21
- package/dist/{chunk-JRKD7SD3.js → chunk-OLXUMB2V.js} +16 -16
- package/dist/chunk-ONUNFTZD.js +11 -0
- package/dist/{chunk-KIIZNION.js → chunk-OX7Q5PPR.js} +5 -5
- package/dist/{chunk-ASNRA3ZL.js → chunk-P7X4PWJJ.js} +1 -1
- package/dist/{chunk-UMIRPFQJ.js → chunk-QD7IODP2.js} +1 -1
- package/dist/{chunk-NM7U42KL.js → chunk-QO2CN2ND.js} +8 -8
- package/dist/{chunk-QSOBETAI.js → chunk-QY2DGLCJ.js} +6 -6
- package/dist/chunk-R7OZ2AQD.js +6 -0
- package/dist/{chunk-U7PA4KNZ.js → chunk-RBOGLXMV.js} +8 -8
- package/dist/{chunk-OEWBWKKD.js → chunk-SWH3IEUT.js} +9 -9
- package/dist/{chunk-LGVVXYW7.js → chunk-SYASK4QG.js} +1 -1
- package/dist/{chunk-YXMXATYP.js → chunk-THVE54FN.js} +1 -1
- package/dist/{chunk-TEYG2W7A.js → chunk-TM5NQTFA.js} +2 -2
- package/dist/{chunk-FQ3SYDKI.js → chunk-US7F3NC3.js} +1 -1
- package/dist/{chunk-XZKVGJIB.js → chunk-V77UETV3.js} +1 -1
- package/dist/{chunk-I2NVBDKH.js → chunk-VLT4ZEHT.js} +1 -1
- package/dist/chunk-WUNZBM53.js +28 -0
- package/dist/{chunk-GD5NGS6D.js → chunk-XNPCOWOO.js} +45 -45
- package/dist/{chunk-EULBBS5L.js → chunk-XOEYCDWT.js} +1 -1
- package/dist/{chunk-QJ3X2PHY.js → chunk-YCA2XXAB.js} +1 -1
- package/dist/{chunk-AKEED2BC.js → chunk-YQKNRT7L.js} +1 -1
- package/dist/{chunk-QYOIS4BN.js → chunk-ZKWAWQ74.js} +3 -3
- package/dist/{chunk-RRWQBWLW.js → chunk-ZV2ZAHZV.js} +1 -1
- package/dist/data/EntityList.js +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Button.d.ts +1 -0
- package/dist/forms/Button.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/IconButton.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/Input.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/NumericKeypad.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/RenameField.js +1 -1
- package/dist/forms/SearchInput.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/buttonStyles.d.ts +8 -1
- package/dist/forms/buttonStyles.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +4 -23
- package/dist/index.js +175 -175
- package/dist/map/index.js +3 -3
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/Popover.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/discardGuard.js +1 -1
- package/dist/shell/strings.d.ts +5 -2
- package/dist/shell/toast.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/AuthScreen.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/ErrorBoundary.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/templates/GalleryTemplate.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/value-index.json +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/PomodoroTimer-BGTCWT53.js +0 -91
- package/dist/Sidebar-KAALEIIX.js +0 -44
- package/dist/chunk-345FP3IX.js +0 -4
- package/dist/chunk-5RCKE4X2.js +0 -6
- package/dist/chunk-6FOLK4HD.js +0 -1
- package/dist/chunk-A4ROXNUF.js +0 -2
- package/dist/chunk-APFDZ2HG.js +0 -1
- package/dist/chunk-DEV3ZHPP.js +0 -8
- package/dist/chunk-E4WVF6AS.js +0 -28
- package/dist/chunk-MQNSKFZY.js +0 -11
- package/dist/chunk-OHPDB4UN.js +0 -14
- package/dist/chunk-QXEZBS3H.js +0 -6
- package/dist/chunk-R6YVKP6D.js +0 -3
- package/dist/chunk-UQYNPYF4.js +0 -1
- /package/dist/{chunk-TEQ5ZPAL.js → chunk-NQWORKZD.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-6FOLK4HD.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},F=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{F(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var O=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},K=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,D=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&U.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&O.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;F(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(K,"[redacted]").replace(J,"[redacted]").replace(D,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
1
|
+
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-NSSMK5JR.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},R=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],F=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{R(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],N=[800,1800],B=e=>{document.prerendering?E(()=>B(e)):"complete"!==document.readyState?addEventListener("load",()=>B(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;R(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),F(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,N,t.reportAllChanges);B(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,N,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,N,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Card as e}from"./chunk-RKSCB5BJ.js";import{Textarea_default as a}from"./chunk-PB7G6CJ7.js";import{Radio_default as l}from"./chunk-NI5FXWK5.js";import{Select_default as r}from"./chunk-W7HTHKN2.js";import{FormField as n}from"./chunk-6KBDNYRW.js";import{Checkbox_default as i}from"./chunk-CGZBDI6C.js";import{Input_default as c}from"./chunk-
|
|
1
|
+
import{Card as e}from"./chunk-RKSCB5BJ.js";import{Textarea_default as a}from"./chunk-PB7G6CJ7.js";import{Radio_default as l}from"./chunk-NI5FXWK5.js";import{Select_default as r}from"./chunk-W7HTHKN2.js";import{FormField as n}from"./chunk-6KBDNYRW.js";import{Checkbox_default as i}from"./chunk-CGZBDI6C.js";import{Input_default as c}from"./chunk-BYTQRQ5P.js";import{Button_default as o}from"./chunk-37FQVY2O.js";import{useState as t}from"react";import{jsx as m,jsxs as d}from"react/jsx-runtime";function s(){const[s,h]=t("pro"),[u,p]=t(!0),[f,g]=t("us");/* @__PURE__ */
|
|
2
2
|
return m("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */d("form",{className:"mx-auto max-w-2xl space-y-5",onSubmit:e=>e.preventDefault(),children:[
|
|
3
3
|
/* @__PURE__ */d("div",{children:[
|
|
4
4
|
/* @__PURE__ */m("h1",{className:"text-xl font-semibold text-gray-900",children:"Account settings"}),
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{DropdownMenu as e}from"./chunk-NJY4HPNB.js";import{Button_default as i}from"./chunk-37FQVY2O.js";import{Icon as n}from"./chunk-ISVODSRP.js";import{Tooltip as r}from"./chunk-CIZAUBWA.js";import{iconButtonClasses as a}from"./chunk-LYGIOJ3J.js";import{forwardRef as l,useId as o}from"react";import{jsxs as s,jsx as t}from"react/jsx-runtime";var d="relative focus-visible:z-10",m={secondary:"border-l-0",primary:"border-l border-white/30",warning:"border-l border-white/30"},c=l(function({children:l,onClick:c,type:b="button",items:h,menuLabel:u,variant:f="primary",size:p="md",loading:v=!1,leftIcon:k,disabled:g=!1,disabledReason:N,tooltip:w,menuDisabled:x=!1,menuDisabledReason:j,onMenuOpenChange:y,menuFooter:C,menuFooterLabel:I,align:O="end",side:W="bottom",menuMinWidth:z,linkAs:A,block:L=!1,className:R=""},B){const D=g&&(null!=N&&""!==N&&!1!==N)&&!v,F=x&&null!=j&&""!==j&&!1!==j,J=o(),Y=/* @__PURE__ */t(i,{ref:B,type:b,variant:f,size:p,loading:v,leftIcon:k,block:L,disabled:g&&!D,"aria-disabled":!!D||void 0,disabledReason:D?N:void 0,onClick:c,className:`rounded-r-none ${d}`,children:l}),$=L?"relative flex min-w-0 flex-1":"relative inline-flex",M=p.startsWith("touch")?"h-5 w-5":"h-4 w-4";/* @__PURE__ */
|
|
2
|
+
return s("div",{className:[L?"flex w-full":"inline-flex","items-stretch",R].filter(Boolean).join(" "),children:[null==w||""===w||D?Y:/* @__PURE__ */t(r,{content:w,className:$,children:Y}),
|
|
3
|
+
/* @__PURE__ */t(r,{content:F?j:u,describe:!1,className:"relative inline-flex shrink-0",children:/* @__PURE__ */t(e,{"aria-label":u,"aria-describedby":F?J:void 0,items:h,align:O,side:W,minWidth:z,linkAs:A,disabled:x&&!F,"aria-disabled":F,onOpenChange:y,footer:C,footerLabel:I,triggerClassName:a({variant:f,size:p,className:`rounded-l-none ${m[f]} ${d}`}),trigger:/* @__PURE__ */t(n,{name:"chevron-down",className:M,strokeWidth:2,"aria-hidden":"true"})})}),F&&/* @__PURE__ */t("span",{id:J,className:"sr-only",children:j})]})});export{c as SplitButton_default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{InputNumber_default as e,stepRounding as r}from"./chunk-
|
|
2
|
-
return s("div",{id:C,role:"group","aria-label":m,className:`flex min-w-0 flex-wrap items-center gap-2 ${
|
|
3
|
-
/* @__PURE__ */d("div",{className:"w-30 shrink-0",children:/* @__PURE__ */d(e,{value:v,onChange:b,min:g,max:x,step:w,...r(w),placeholder:y,prefix:/* @__PURE__ */d("span",{"data-radius-mark":"","aria-hidden":"true",children:
|
|
4
|
-
/* @__PURE__ */d("div",{ref:
|
|
1
|
+
import{InputNumber_default as e,stepRounding as r}from"./chunk-TM5NQTFA.js";import{IconButton_default as a}from"./chunk-4YH7U7WL.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{Tooltip as n}from"./chunk-CIZAUBWA.js";import{useShellStrings as l}from"./chunk-NRHG4R2Q.js";import{useState as t,useRef as o}from"react";import{jsxs as s,jsx as d}from"react/jsx-runtime";var u={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function m({label:m,value:f,corners:p,onChange:h,radius:v=null,onRadiusChange:b,radiusLabel:k,radiusMin:g=0,radiusMax:x,radiusStep:w=1,radiusPlaceholder:y,radiusUnit:A,units:j,disabled:N=!1,disabledReason:R,id:C,className:M=""}){const D=l(),I=function(e){const r=c.map(r=>e.find(e=>e.value===r));for(const a of e){if(c.includes(a.value))continue;const e=r.findIndex(e=>void 0===e);-1===e?r.push(a):r[e]=a}return r.filter(e=>void 0!==e)}(p),[K,S]=t(0),U=o(null);/* @__PURE__ */
|
|
2
|
+
return s("div",{id:C,role:"group","aria-label":m,className:`flex min-w-0 flex-wrap items-center gap-2 ${M}`.trim(),children:[b&&
|
|
3
|
+
/* @__PURE__ */d("div",{className:"w-30 shrink-0",children:/* @__PURE__ */d(e,{value:v,onChange:b,min:g,max:x,step:w,...r(w),placeholder:y,prefix:/* @__PURE__ */d("span",{"data-radius-mark":"","aria-hidden":"true",children:D.corners.radiusMark}),suffix:A??D.corners.unit,units:j,steppers:"compact",disabled:N,"aria-label":k??D.corners.radius})}),
|
|
4
|
+
/* @__PURE__ */d("div",{ref:U,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const r=Array.from(U.current?.querySelectorAll("button[data-corner]")??[]),a=r.indexOf(document.activeElement);if(-1===a)return;const i=a%2,n=Math.floor(a/2),l="ArrowRight"===e.key?2*n+1:"ArrowLeft"===e.key?2*n:"ArrowDown"===e.key?2+i:"ArrowUp"===e.key?i:null;null!==l&&(e.preventDefault(),l<r.length&&r[l].focus())},children:I.map((e,r)=>{const l=f.includes(e.value),t=N||!0===e.disabled,o=t&&(!0===e.disabled&&e.title||(N?R:void 0))||void 0,s=/* @__PURE__ */d(a,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":t||void 0,disabledReason:o,"data-corner":e.value,size:"sm",tabIndex:r===K?0:-1,onFocus:()=>S(r),onClick:()=>{t||h(l?f.filter(r=>r!==e.value):[...f,e.value])},children:/* @__PURE__ */d(i,{name:"corner",strokeWidth:2,className:["h-4 w-4",u[e.value]??""].filter(Boolean).join(" ")})},e.value);return o?s:/* @__PURE__ */d(n,{content:e.title??e.label,children:s},e.value)})})]})}export{m as CornersInput};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{TEXT_ALIGNS as e,textAlignWords as l,textAlignIcon as r}from"./chunk-72UHB4JU.js";import{IconButton_default as a}from"./chunk-4YH7U7WL.js";import{Icon as o}from"./chunk-ISVODSRP.js";import{Tooltip as n}from"./chunk-CIZAUBWA.js";import{useShellStrings as s}from"./chunk-NRHG4R2Q.js";import{jsx as i,jsxs as t,Fragment as d}from"react/jsx-runtime";var c=e=>e.preventDefault(),u=e=>null!=e&&!1!==e,h=["bold","italic","underline","strike","link","sup","sub","code"];function p(e,l,r){const a={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===a||0===l.length)return;const o=[...e.currentTarget.querySelectorAll('[role="radio"]')],n=o.findIndex(l=>l===e.target||l.contains(e.target));if(n<0)return;e.preventDefault();const s=o.length,i="first"===a?0:"last"===a?s-1:(n+a+s)%s;o[i].disabled||(r(l[i]),o[i].focus())}function b(e,l){const r=["bold","italic","underline","strike"].filter(l=>e.has(l)).length;return{color:r,link:r+(l?1:0)}}function m(e,l,r,a){const o=h.filter(l=>"link"!==l&&e.has(l)).length+(l?1:0);return r&&0!==o?a>0?"paragraph":"words":null}function w({offered:l,color:r,last:a,alignment:o,list:n,letterCase:s,clear:i}){let t=h.filter(e=>l.has(e)).length+(r?1:0)+(u(a)?1:0),d=(o?e.filter(e=>o.allow.includes(e)).length:0)+(n&&l.has("bullet")?1:0)+(n&&l.has("number")?1:0)+(l.has("quote")?1:0)+(s?3:0);const c=m(l,r,i,d);return"paragraph"===c&&(d+=1),"words"===c&&(t+=1),{words:t>0,paragraph:d>0,oneRow:t>0&&d>0&&t+1+d<=9,flow:t>0&&d>0&&t+1+d>9&&t<=7,cells:{words:t,paragraph:d}}}function g(e,l){/* @__PURE__ */
|
|
2
|
+
return i(n,{content:e,children:l},l.key??void 0)}function f({offered:n,pressed:h,onMark:f,color:k,linkOpen:v=!1,last:N,alignment:C,list:D,letterCase:M,clear:x,disabled:y=!1,"aria-label":A,windows:R,className:U="",layout:j="grid"}){const B=s().textToolbar,I=w({offered:n,color:k,last:N,alignment:C,list:D,letterCase:M,clear:x});if(!I.words&&!I.paragraph)return null;const S=m(n,k,x,I.cells.paragraph),q=(e,l="")=>`rosh-tb-btn${e?" is-on":""}${l?` ${l}`:""}`,L=(e,l,r,o)=>n.has(e)?g(l,/* @__PURE__ */i(a,"link"===e?{pressed:v,className:q(v),"aria-label":l,"aria-haspopup":"dialog","aria-expanded":v,"aria-keyshortcuts":o,disabled:y,onMouseDown:c,onClick:()=>f(e),children:r}:{className:q(Boolean(h[e])),"aria-label":l,"aria-pressed":Boolean(h[e]),"aria-keyshortcuts":o,disabled:y,onMouseDown:c,onClick:()=>f(e),children:r},e)):null,$=l(B),H=e.map(e=>[e,$[e],r(e)]),K=C?e.filter(e=>C.allow.includes(e)):[],T=C&&K.includes(C.value)?C.value:K[0],O=[["none",B.caseNone,/* @__PURE__ */i(o,{name:"case-normal"})],["upper",B.caseUpper,/* @__PURE__ */i(o,{name:"case-upper"})],["lower",B.caseLower,/* @__PURE__ */i(o,{name:"case-lower"})]],W=x&&S?g(B.clear,/* @__PURE__ */i(a,{className:q(!1),"aria-label":B.clear,disabled:y,onMouseDown:c,onClick:x.onClear,children:/* @__PURE__ */i(o,{name:"revert"})},"clear")):null,E=/* @__PURE__ */t(d,{children:[L("bold",B.bold,/* @__PURE__ */i(o,{name:"bold"}),"Meta+B"),L("italic",B.italic,/* @__PURE__ */i(o,{name:"italic"}),"Meta+I"),L("underline",B.underline,/* @__PURE__ */i(o,{name:"underline"}),"Meta+U"),L("strike",B.strike,/* @__PURE__ */i(o,{name:"strike"})),k?g(B.color,/* @__PURE__ */i(a,{pressed:k.open,className:q(k.open,"rosh-tb-color"),"aria-label":B.color,"aria-haspopup":"dialog","aria-expanded":k.open,disabled:y,style:k.run?{"--rosh-tb-run":k.run}:void 0,onMouseDown:c,onClick:k.onToggle,children:/* @__PURE__ */i(o,{name:"text-color"})},"color")):null,L("link",B.link,/* @__PURE__ */i(o,{name:"link"}),"Meta+K"),L("sup",B.sup,/* @__PURE__ */i(o,{name:"superscript"})),L("sub",B.sub,/* @__PURE__ */i(o,{name:"subscript"})),L("code",B.code,/* @__PURE__ */i(o,{name:"code"})),u(N)?N:null,"words"===S?W:null]}),G=/* @__PURE__ */t(d,{children:[C&&K.length>0?/* @__PURE__ */i("div",{className:"rosh-tb-group",role:"radiogroup","aria-label":B.alignment,onKeyDown:e=>p(e,K,e=>C.onChange(e)),children:H.map(([e,l,r])=>C.allow.includes(e)?g(l,/* @__PURE__ */i(a,{role:"radio",pressed:C.value===e,className:q(C.value===e),"aria-checked":C.value===e,"aria-label":l,tabIndex:e===T?0:-1,disabled:y||C.disabled,onMouseDown:c,onClick:()=>C.onChange(e),children:r},e)):null)}):null,D&&n.has("bullet")?g(B.bullet,/* @__PURE__ */i(a,{className:q("bullet"===D.pressed),"aria-label":B.bullet,"aria-pressed":"bullet"===D.pressed,disabled:y,onMouseDown:c,onClick:()=>D.onList("bullet"),children:/* @__PURE__ */i(o,{name:"list"})},"bullet")):null,D&&n.has("number")?g(B.number,/* @__PURE__ */i(a,{className:q("number"===D.pressed),"aria-label":B.number,"aria-pressed":"number"===D.pressed,disabled:y,onMouseDown:c,onClick:()=>D.onList("number"),children:/* @__PURE__ */i(o,{name:"numbered-list"})},"number")):null,L("quote",B.quote,/* @__PURE__ */i(o,{name:"quote"})),M?/* @__PURE__ */i("div",{className:"rosh-tb-group",role:"radiogroup","aria-label":B.letterCase,onKeyDown:e=>p(e,O.map(([e])=>e),e=>M.onChange(e)),children:O.map(([e,l,r])=>g(l,/* @__PURE__ */i(a,{role:"radio",pressed:M.value===e,className:q(M.value===e),"aria-checked":M.value===e,"aria-label":l,tabIndex:e===(M.value||"none")?0:-1,disabled:y||M.disabled,onMouseDown:c,onClick:()=>M.onChange(M.value===e?"":e),children:r},e)))}):null,"paragraph"===S?W:null]}),J="row"===j,P=J?" is-row":I.flow?" is-flow":I.oneRow?" is-one-row":I.words&&void 0===N&&"words"!==S?" is-eight":"",Q=b(n,Boolean(k)),V={"--rosh-tb-color-col":String(Q.color),"--rosh-tb-link-col":String(Q.link),...J?{"--rosh-tb-cells":String(I.cells.words+I.cells.paragraph),"--rosh-tb-groupgap":I.words&&I.paragraph?"var(--space-8, 0.5rem)":"0px"}:{}};let Y;return Y=J?/* @__PURE__ */t("div",{className:"rosh-tb-row is-row",children:[I.words?/* @__PURE__ */i("div",{className:"rosh-tb-words",children:E}):null,I.paragraph?/* @__PURE__ */i("div",{className:"rosh-tb-para",children:G}):null]}):I.flow?/* @__PURE__ */t("div",{className:"rosh-tb-row is-flow",children:[E,
|
|
3
|
+
/* @__PURE__ */i("span",{className:"rosh-tb-flowgap","aria-hidden":"true"}),G]}):I.oneRow?/* @__PURE__ */t("div",{className:"rosh-tb-row is-one-row",children:[
|
|
4
|
+
/* @__PURE__ */i("div",{className:"rosh-tb-words",children:E}),
|
|
5
|
+
/* @__PURE__ */i("div",{className:"rosh-tb-para",children:G})]}):/* @__PURE__ */t(d,{children:[I.words?/* @__PURE__ */i("div",{className:"rosh-tb-row"+(void 0===N&&"words"!==S?" is-eight":""),children:E}):null,I.paragraph?/* @__PURE__ */i("div",{className:"rosh-tb-row",children:G}):null]}),/* @__PURE__ */t("div",{className:`rosh-tb-wrap${P} ${U}`.trim(),style:V,children:[
|
|
6
|
+
/* @__PURE__ */i("div",{className:"rosh-tb",role:"toolbar","aria-label":A??B.formatting,children:Y}),R]})}export{f as TextToolbar,w as textToolbarRows,b as textToolbarWindowColumns};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Tabs as e}from"./chunk-EJMCK7E3.js";import{Card as a}from"./chunk-RKSCB5BJ.js";import{StatusBadgeProvider as r,StatusBadge as t}from"./chunk-ABIWAS5K.js";import{Button_default as l}from"./chunk-
|
|
1
|
+
import{Tabs as e}from"./chunk-EJMCK7E3.js";import{Card as a}from"./chunk-RKSCB5BJ.js";import{StatusBadgeProvider as r,StatusBadge as t}from"./chunk-ABIWAS5K.js";import{Button_default as l}from"./chunk-37FQVY2O.js";import{useState as i}from"react";import{jsx as d,jsxs as s}from"react/jsx-runtime";var n={featured:"success",new:"active",draft:"draft"},c=["linear-gradient(135deg,#60a5fa,#a78bfa)","linear-gradient(135deg,#34d399,#10b981)","linear-gradient(135deg,#fbbf24,#f59e0b)","linear-gradient(135deg,#f472b6,#ec4899)","linear-gradient(135deg,#38bdf8,#6366f1)","linear-gradient(135deg,#fb7185,#ef4444)","linear-gradient(135deg,#4ade80,#22c55e)","linear-gradient(135deg,#c084fc,#8b5cf6)"].map((e,a)=>({id:a,title:["Sunrise","Forest","Desert","Bloom","Ocean","Ember","Meadow","Dusk"][a],tag:["featured","new","draft"][a%3],bg:e}));function m(){const[m,g]=i("all"),f="all"===m?c:c.filter(e=>e.tag===m);/* @__PURE__ */
|
|
2
2
|
return d(r,{groups:n,children:/* @__PURE__ */d("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */s("div",{className:"mx-auto max-w-5xl space-y-4",children:[
|
|
3
3
|
/* @__PURE__ */s("div",{className:"flex items-center justify-between gap-4",children:[
|
|
4
4
|
/* @__PURE__ */d("h1",{className:"text-xl font-semibold text-gray-900",children:"Gallery"}),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{InputNumber_default as a,stepRounding as e}from"./chunk-
|
|
1
|
+
import{InputNumber_default as a,stepRounding as e}from"./chunk-TM5NQTFA.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{jsxs as n,jsx as i}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={x:/* @__PURE__ */i(r,{name:"nudge-x","aria-hidden":"true",className:l}),y:/* @__PURE__ */i(r,{name:"nudge-y","aria-hidden":"true",className:l})};function m({label:r,value:l,onChange:m,words:t,placeholder:d,min:o=-200,max:c=200,step:u=1,readOnly:p,units:h}){const x=r=>/* @__PURE__ */i("div",{"data-axis":r,className:"min-w-0",children:/* @__PURE__ */i(a,{value:l[r],onChange:a=>m({...l,[r]:a}),min:o,max:c,step:u,...e(u),steppers:"compact",readOnly:p,placeholder:d[r],prefix:s[r],suffix:t.unit,units:h,"aria-label":t[r]})});/* @__PURE__ */
|
|
2
2
|
return n("div",{role:"group","aria-label":r,className:"grid min-w-0 grid-cols-2 gap-2",children:[x("x"),x("y")]})}export{m as PositionInput};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Card as e}from"./chunk-RKSCB5BJ.js";import{Select_default as a}from"./chunk-W7HTHKN2.js";import{Pagination as r}from"./chunk-Q2RNFBYS.js";import{Input_default as t}from"./chunk-
|
|
1
|
+
import{Card as e}from"./chunk-RKSCB5BJ.js";import{Select_default as a}from"./chunk-W7HTHKN2.js";import{Pagination as r}from"./chunk-Q2RNFBYS.js";import{Input_default as t}from"./chunk-BYTQRQ5P.js";import{StatusBadgeProvider as i,StatusBadge as s}from"./chunk-ABIWAS5K.js";import{Button_default as l}from"./chunk-37FQVY2O.js";import{Icon as c}from"./chunk-ISVODSRP.js";import{TH_ONE_LINE as m}from"./chunk-FAPZFMS3.js";import{useState as n}from"react";import{jsx as d,jsxs as o}from"react/jsx-runtime";var h={active:"success",invited:"queued",suspended:"danger",pending:"pending"},p=[{name:"Alice Nguyen",email:"alice@acme.co",role:"Admin",status:"active"},{name:"Marco Reyes",email:"marco@acme.co",role:"Editor",status:"invited"},{name:"Priya Patel",email:"priya@acme.co",role:"Editor",status:"active"},{name:"Tom Becker",email:"tom@acme.co",role:"Viewer",status:"suspended"},{name:"Sara Lind",email:"sara@acme.co",role:"Viewer",status:"pending"},{name:"Yuki Tanaka",email:"yuki@acme.co",role:"Editor",status:"active"}];function u(){const[c,u]=n(1),[g,f]=n(""),[y,v]=n("");/* @__PURE__ */
|
|
2
2
|
return d(i,{groups:h,children:/* @__PURE__ */d("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */o("div",{className:"mx-auto max-w-5xl space-y-4",children:[
|
|
3
3
|
/* @__PURE__ */o("div",{className:"flex items-center justify-between gap-4",children:[
|
|
4
4
|
/* @__PURE__ */d("h1",{className:"text-xl font-semibold text-gray-900",children:"Members"}),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{Popover as e}from"./chunk-
|
|
2
|
-
return v("button",{ref:l,type:o,"aria-pressed":a,className:N({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(e)})})}),z=(e,r,a)=>Math.min(a,Math.max(r,e)),
|
|
3
|
-
return w("div",{id:T,className:`flex w-56 flex-col gap-3 ${N?"opacity-60":""} ${
|
|
4
|
-
return v(d,{content:n,children:/* @__PURE__ */v($,{color:r??e.value,size:"sm","aria-label":n,selected:null!==r&&r===oe,disabled:N,onClick:()=>
|
|
5
|
-
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":U.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*W.v),"aria-valuetext":U.squareValue(Math.round(100*W.s),Math.round(100*W.v)),"aria-disabled":N||void 0,"data-color-square":"",onKeyDown:e=>{if(N)return;const r=
|
|
6
|
-
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":U.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(W.h),"aria-orientation":"horizontal","aria-disabled":N||void 0,"data-color-hue":"",onKeyDown:e=>{if(N)return;const r=I(W.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),
|
|
1
|
+
import{Popover as e}from"./chunk-LRASKGEZ.js";import{InputNumber_default as r}from"./chunk-TM5NQTFA.js";import{parseHexColor as a,hexToHsv as n,hsvToHex as o,hexReadout as t,HUE_GRADIENT as l,HEX_MAX_LENGTH as i,svFromPoint as s,hueFromPoint as c}from"./chunk-S6OB6HJB.js";import{inputClasses as u}from"./chunk-AYZY3YNC.js";import{Tooltip as d}from"./chunk-CIZAUBWA.js";import{useShellStrings as h}from"./chunk-NRHG4R2Q.js";import{forwardRef as g,useState as p,useRef as b,useEffect as m,useId as f}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var x={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},y={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function k(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function C(e,r){if(!e)return y;const a=k(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`}}function N({size:e="md",selected:r=!1,className:a=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",r?"border-2 border-blue-500":"rosh-swatch-edge border border-gray-300 hover:shadow-sm",x[e],a].filter(Boolean).join(" ")}var $=g(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
|
|
2
|
+
return v("button",{ref:l,type:o,"aria-pressed":a,className:N({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(e)})})}),z=(e,r,a)=>Math.min(a,Math.max(r,e)),A=e=>"string"==typeof e?{value:e}:e;function D(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:z(e.s+o[0],0,1),v:z(e.v+o[1],0,1)}:null}function I(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,359);case"ArrowRight":case"ArrowUp":return z(e+n,0,359);case"PageDown":return z(e-10,0,359);case"PageUp":return z(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var M={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function P(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return z(e-n,0,100);case"ArrowRight":case"ArrowUp":return z(e+n,0,100);case"PageDown":return z(e-10,0,100);case"PageUp":return z(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function j({value:e,onChange:r,label:i,presets:u,clearable:g=!1,fallback:f,dragWrites:x="live",disabled:N=!1,opacity:z,onOpacityChange:j,onClose:S,id:T,className:K=""}){const U=h().color,L=k(z),O=e=>{const r=k(e);N||r===L||j?.(r)},E=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:L},H=a(f??""),[W,Y]=p(()=>n(e||H||"")),q=b(e);m(()=>{e!==q.current&&(q.current=e,e?Y(n(e)):H&&Y(n(H)))},[e]);const X=a=>{N||a===e||(q.current=a,r(a))},Z=e=>{const r=a(e);r&&(Y(n(r)),X(r))},F=e=>{Y(e),X(o(e))},[G,Q]=p(!1),J=b(W);J.current=W;const V=e=>({onPointerDown:r=>{if(N||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,J.current);"end"===x?(Q(!0),Y(a)):F(a)},onPointerMove:r=>{if(N||!(1&r.buttons))return;const a=e(r,J.current);"end"===x?Y(a):F(a)},onPointerUp:r=>{"end"===x&&G&&(Q(!1),F(e(r,J.current)))}}),_=V((e,r)=>({...r,...s(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),ee=V((e,r)=>({...r,h:c(e.clientX,e.currentTarget.getBoundingClientRect())})),re=G?o(W):e,ae=e=>`${Math.round(100*e)}%`,ne=(u??[]).map(A),oe=a(e),te=re||H||"";/* @__PURE__ */
|
|
3
|
+
return w("div",{id:T,className:`flex w-56 flex-col gap-3 ${N?"opacity-60":""} ${K}`.trim(),onKeyDown:e=>{"Escape"===e.key&&S&&(e.preventDefault(),e.stopPropagation(),S())},children:[(ne.length>0||g)&&/* @__PURE__ */w("div",{role:"group","aria-label":U.presets,className:"flex flex-wrap gap-2",children:[g&&/* @__PURE__ */v(d,{content:U.clear,children:/* @__PURE__ */v($,{color:"",size:"sm","aria-label":U.clear,selected:""===e,disabled:N,onClick:()=>{N||""===e||(q.current="",r(""))}})}),ne.map(e=>{const r=a(e.value),n=e.label?`${e.label} · ${t(r??e.value)}`:t(r??e.value);/* @__PURE__ */
|
|
4
|
+
return v(d,{content:n,children:/* @__PURE__ */v($,{color:r??e.value,size:"sm","aria-label":n,selected:null!==r&&r===oe,disabled:N,onClick:()=>Z(e.value)})},`${e.label??""}:${e.value}`)})]}),
|
|
5
|
+
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":U.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*W.v),"aria-valuetext":U.squareValue(Math.round(100*W.s),Math.round(100*W.v)),"aria-disabled":N||void 0,"data-color-square":"",onKeyDown:e=>{if(N)return;const r=D(W,e.key,e.shiftKey);r&&(e.preventDefault(),F(r))},..._,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:o({h:W.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:ae(W.s),top:ae(1-W.v),...M}})}),
|
|
6
|
+
/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":U.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(W.h),"aria-orientation":"horizontal","aria-disabled":N||void 0,"data-color-hue":"",onKeyDown:e=>{if(N)return;const r=I(W.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),F({...W,h:r}))},...ee,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:l},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:W.h/360*100+"%",background:o({h:W.h,s:1,v:1}),...M}})}),j&&/* @__PURE__ */v("div",{role:"slider",tabIndex:N?-1:0,"aria-label":U.opacity(i),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":L,"aria-valuetext":`${L}%`,"aria-orientation":"horizontal","aria-disabled":N||void 0,"data-color-opacity":"",onKeyDown:e=>{if(N)return;const r=P(L,e.key,e.shiftKey);null!==r&&(e.preventDefault(),O(r))},onPointerDown:e=>{N||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),O(E(e)))},onPointerMove:e=>{!N&&1&e.buttons&&O(E(e))},className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:`linear-gradient(to right, transparent, ${te||"black"}), ${y.backgroundImage}`,backgroundSize:`auto, ${y.backgroundSize}`},children:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:`${L}%`,...C(te||"black",L),...M}})}),
|
|
7
7
|
/* @__PURE__ */w("div",{className:"flex items-center gap-2",children:[
|
|
8
|
-
/* @__PURE__ */v("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-line-strong",style:C(te,j?
|
|
9
|
-
/* @__PURE__ */v(
|
|
10
|
-
return v("input",{id:s,type:"text",value:g??(e?t(e):""),"aria-label":n,placeholder:o,maxLength:i,spellCheck:!1,autoComplete:"off",disabled:l,onChange:n=>{b(n.target.value);const o=a(n.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),b(null))},onBlur:()=>b(null),"data-hex-look":d,className:m})}function
|
|
11
|
-
return v("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */v(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function U({value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:g=!1,opacity:p,onOpacityChange:b,size:m="md",align:x="start",open:y,onOpenChange:$,className:z=""}){const
|
|
8
|
+
/* @__PURE__ */v("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-line-strong",style:C(te,j?L:null)}),
|
|
9
|
+
/* @__PURE__ */v(R,{value:re,placeholder:!e&&H?t(H):void 0,onChange:Z,label:U.hex(i),disabled:N}),j&&/* @__PURE__ */v(B,{value:L,onChange:O,label:U.opacity(i),disabled:N})]})]})}var S={sm:"w-[calc(7ch+1rem+4px)] min-w-[calc(7ch+1rem+4px)]",md:"w-[calc(7ch+1.5rem+4px)] min-w-[calc(7ch+1.5rem+4px)]",lg:"w-[calc(7ch+2rem+4px)] min-w-[calc(7ch+2rem+4px)]"},T={sm:"h-6",md:"h-8",lg:"h-10"},K=["block w-[calc(7ch+0.5rem+4px)] min-w-[calc(7ch+0.5rem+4px)] flex-none rounded-(--radius-control)","border border-transparent bg-transparent px-1 text-2xs font-mono uppercase","text-ink-strong placeholder:text-[color:var(--ink-placeholder)] hover:border-gray-300","focus:border-blue-400 focus:bg-(--surface) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)]","disabled:cursor-not-allowed disabled:opacity-60"].join(" ");function R({value:e,onChange:r,label:n,placeholder:o,disabled:l,id:s,size:c="md",look:d="box",className:h=""}){const[g,b]=p(null),m="text"===d?`${K} ${T[c]} ${h}`.trim():u({size:c,className:`${S[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
|
|
10
|
+
return v("input",{id:s,type:"text",value:g??(e?t(e):""),"aria-label":n,placeholder:o,maxLength:i,spellCheck:!1,autoComplete:"off",disabled:l,onChange:n=>{b(n.target.value);const o=a(n.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),b(null))},onBlur:()=>b(null),"data-hex-look":d,className:m})}function B({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
|
|
11
|
+
return v("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */v(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function U({value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:g=!1,opacity:p,onOpacityChange:b,size:m="md",align:x="start",open:y,onOpenChange:$,className:z=""}){const A=h().color,D=k(p),I=f(),M=a(s??""),P=r||M||"",S=r?t(r):M?t(M):A.none;
|
|
12
12
|
/* @__PURE__ */
|
|
13
13
|
return w("div",{className:`inline-flex items-center ${b?"flex-wrap justify-end gap-1":g?"gap-1":"gap-2"} ${z}`.trim(),children:[
|
|
14
|
-
/* @__PURE__ */v(e,{id:d,trigger:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(
|
|
15
|
-
/* @__PURE__ */v(
|
|
14
|
+
/* @__PURE__ */v(e,{id:d,trigger:/* @__PURE__ */v("span",{"aria-hidden":"true",className:"absolute inset-0",style:C(P,b?D:null)}),triggerLabel:A.swatch(o,S),triggerClassName:N({size:m}),"aria-label":A.panel(o),align:x,open:y,onOpenChange:$,disabled:u,children:/* @__PURE__ */v(j,{id:I,value:r,onChange:n,label:o,presets:l,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),g&&
|
|
15
|
+
/* @__PURE__ */v(R,{value:r,placeholder:!r&&M?t(M):void 0,onChange:e=>{u||e===r||n(e)},label:A.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */v(B,{value:D,onChange:e=>{u||e===D||b(e)},label:A.opacity(o),disabled:u,size:m})]})}export{U as ColorPicker,j as ColorPickerPanel,$ as ColorSwatch,R as HexInput,y as NO_COLOR_FILL,k as clampOpacity,C as colorFill,N as colorSwatchClasses,I as stepHue,P as stepOpacity,D as stepSquare};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{IconButton_default as o}from"./chunk-
|
|
1
|
+
import{IconButton_default as o}from"./chunk-4YH7U7WL.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{useShellStrings as e}from"./chunk-NRHG4R2Q.js";import{jsx as a}from"react/jsx-runtime";function s({onClose:s,className:i,label:t}){const n=e().dialog;/* @__PURE__ */
|
|
2
2
|
return a(o,{variant:"ghost",onClick:s,"aria-label":t??n.close,className:i,children:/* @__PURE__ */a(r,{name:"close",className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"})})}export{s as CloseButton};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{useTabLayer as e,focusableIn as t,stopAfter as r}from"./chunk-DWGYC7OD.js";import{DESCRIPTION_TEXT as n}from"./chunk-BWJZTHZ6.js";import{onOverlayOpen as i}from"./chunk-PGN5ME7B.js";import{createShellPortal as o}from"./chunk-5QRHQCRG.js";import{Z_LAYERS as a}from"./chunk-62LW225J.js";import{popupBounds as c,VIEWPORT_MARGIN as s,placeMenu as u,followAnchor as l}from"./chunk-TAHHZGRH.js";import{useHydrated as d}from"./chunk-KEFNQEXZ.js";import{useBrowserLayoutEffect as m}from"./chunk-PU2GJVMG.js";import{buttonClasses as p}from"./chunk-LYGIOJ3J.js";import{registerModalEscapeInterceptor as f}from"./chunk-TWVUQUUD.js";import{useState as h,useRef as g,useId as v,useCallback as b,useEffect as w}from"react";import{jsxs as x,jsx as y}from"react/jsx-runtime";var k=/(^|[\s:])!?z-/;function C({trigger:C,children:j,title:E,description:N,"aria-label":H,align:D="start",side:O="bottom",open:T,defaultOpen:$=!1,onOpenChange:G,matchTriggerWidth:L=!1,maxHeight:W,initialFocus:M,id:P,triggerLabel:R,"aria-describedby":J,disabled:K,className:S="",triggerClassName:z,panelClassName:Q=""}){const[U,Z]=h($),B=(T??U)&&!K,F=d(),I=g(null),Y=g(null),V=g(null),A=g(null),X=v(),q=P??X,_=v(),ee=v(),te=v(),re=g(null),ne=g(!1),ie=g({openProp:T,onOpenChange:G});ie.current={openProp:T,onOpenChange:G};const oe=b(e=>{void 0===ie.current.openProp&&Z(e),ie.current.onOpenChange?.(e)},[]),ae=b((e=!1)=>{ne.current=e,oe(!1)},[oe]),ce=e=>{re.current=e.nativeEvent},se=b(()=>{const e=V.current,t=Y.current;if(!e||!t)return;const r=t.getBoundingClientRect(),n=c(t),i=Math.max(0,n.right-n.left-2*s),o=e.style;o.left="0px",o.top="0px",o.maxWidth=`${i}px`,o.maxHeight="none",o.width=L?`${Math.min(r.width,i)}px`:"";const a={width:e.offsetWidth,height:e.offsetHeight},l=W??1/0,d=u({trigger:r,menu:{width:a.width,height:Math.min(a.height,l)},bounds:n,align:D,side:O}),m=Math.min(d.maxHeight,l);o.left=`${d.left}px`,o.top=`${d.top}px`,o.maxHeight=`${m}px`,o.overflowY=a.height>m?"auto":"",e.dataset.side=d.side,e.dataset.align=D},[D,O,L,W]);m(()=>{B&&F&&se()}),w(()=>{if(!B||!F)return;const e=l(()=>Y.current,se),t=A.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>se());return r.observe(t),()=>{e(),r.disconnect()}},[B,F,se]),w(()=>{if(!B)return;const e=e=>{let t=null,r=0;const n=e=>{t===e&&(t=null,window.clearTimeout(r),(e=>{if(re.current===e)return!1;const t=e.target;return!(t&&(I.current?.contains(t)||V.current?.contains(t)))})(e)&&ae(!0))},i=e=>{t=e,r=window.setTimeout(()=>n(e),0)},o=e=>n(e);return document.addEventListener(e,i,!0),window.addEventListener(e,o),()=>{window.clearTimeout(r),document.removeEventListener(e,i,!0),window.removeEventListener(e,o)}},t=e("pointerdown"),r=e("focusin"),n=i(()=>ae()),o=f(e=>"Escape"===e.key&&(ae(),Y.current?.focus(),!0),()=>V.current);return()=>{t(),r(),n(),o()}},[B,ae]),e(V,B&&F),m(()=>{if(!B||!F)return;const e=V.current;return()=>{if(ne.current)return;const t=document.activeElement;t&&t!==document.body&&!e?.contains(t)||Y.current?.focus({preventScroll:!0})}},[B,F]),w(()=>{if(!B||!F)return;const e=V.current;e&&(ne.current=!1,(M?.current??t(e)[0]??e).focus({preventScroll:!0}))},[B,F]);const ue="function"==typeof j?j({close:()=>ae()}):j,le=E?{"aria-labelledby":ee}:H?{"aria-label":H}:{"aria-labelledby":q};/* @__PURE__ */
|
|
2
|
+
return x("div",{ref:I,className:`relative inline-flex ${S}`.trim(),children:[
|
|
3
|
+
/* @__PURE__ */y("button",{ref:Y,id:q,type:"button","aria-haspopup":"dialog","aria-expanded":B,"aria-controls":B&&F?_:void 0,"aria-label":R,"aria-describedby":J,disabled:K,onClick:()=>B?ae():oe(!0),onKeyDown:e=>{if("Tab"!==e.key||e.shiftKey||!B)return;const r=(()=>{const e=V.current;return e?t(e)[0]??e:null})();r&&(e.preventDefault(),r.focus({preventScroll:!0}))},className:z??p({variant:"secondary"}),children:C}),B&&F&&o(
|
|
4
|
+
/* @__PURE__ */y("div",{ref:V,id:_,role:"dialog",...le,"aria-describedby":N?te:void 0,tabIndex:-1,"data-popover-panel":"",onPointerDownCapture:ce,onFocusCapture:ce,onKeyDown:e=>{const n=V.current,i=Y.current;if("Tab"!==e.key||!n||!i||!n.contains(e.target))return;const o=t(n),a=document.activeElement;if(e.shiftKey){if(o.length>0&&a!==o[0]&&a!==n)return;return e.preventDefault(),void i.focus({preventScroll:!0})}if(o.length>0&&a!==o[o.length-1])return;e.preventDefault();const c=r(i,n);ae(!!c),(c??i).focus({preventScroll:!0})},className:`fixed rounded-xl border border-gray-200 bg-white p-3 shadow-lg ${Q}`.trim(),style:k.test(Q)?void 0:{zIndex:a.popup},children:/* @__PURE__ */x("div",{ref:A,children:[E&&/* @__PURE__ */y("h2",{id:ee,className:"text-sm font-semibold text-gray-900",children:E}),N&&/* @__PURE__ */y("p",{id:te,className:`mt-1 ${n}`,children:N}),E||N?/* @__PURE__ */y("div",{className:"mt-3",children:ue}):ue]})}),document.body)]})}export{C as Popover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o="aria-disabled:cursor-not-allowed aria-disabled:opacity-60",r="inline-flex items-center justify-center rounded-(--radius-control) font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 "+o,e={primary:"bg-accent-fill text-on-accent shadow-sm not-disabled:not-aria-disabled:hover:bg-accent-fill-hover focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",secondary:"border border-line-strong bg-surface text-ink shadow-sm not-disabled:not-aria-disabled:hover:bg-row-hover focus-visible:ring-[color:var(--rosh-focus-ring)]","secondary-danger":"border border-red-300 bg-surface text-red-600 shadow-sm not-disabled:not-aria-disabled:hover:bg-red-50 focus-visible:ring-[color:var(--rosh-focus-ring-invalid)]","secondary-warning":"border border-status-warning-line bg-surface text-warning-text shadow-sm not-disabled:not-aria-disabled:hover:bg-status-warning-soft focus-visible:ring-[color:var(--rosh-focus-ring)]",ghost:"text-ink not-disabled:not-aria-disabled:hover:bg-gray-100 focus-visible:ring-[color:var(--rosh-focus-ring)]","ghost-danger":"text-red-600 not-disabled:not-aria-disabled:hover:bg-red-50 focus-visible:ring-[color:var(--rosh-focus-ring-invalid)]",danger:"bg-red-600 text-on-accent shadow-sm not-disabled:not-aria-disabled:hover:bg-red-700 focus-visible:ring-[color:var(--rosh-focus-ring-invalid-strong)]",warning:"bg-amber-700 text-on-accent shadow-sm not-disabled:not-aria-disabled:hover:bg-amber-800 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",link:"text-blue-600 underline-offset-4 not-disabled:not-aria-disabled:hover:underline focus-visible:ring-[color:var(--rosh-focus-ring)]"},s={sm:"gap-1 h-6 px-2 text-xs",md:"gap-2 h-8 px-3 text-sm",lg:"gap-2 h-10 px-4 text-sm","touch-sm":"gap-2 h-11 px-4 text-base",touch:"gap-2 h-14 px-5 text-base","touch-lg":"gap-2 h-16 px-6 text-lg","touch-xl":"gap-3 h-20 px-8 text-2xl"},i="inline-flex items-center font-medium transition-colors rosh-focus-ring focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 "+o,a={sm:"gap-1 text-xs",md:"gap-2 text-sm",lg:"gap-2 text-sm","touch-sm":"gap-2 text-base",touch:"gap-2 text-base","touch-lg":"gap-2 text-lg","touch-xl":"gap-3 text-2xl"},t={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10","touch-sm":"h-11 w-11",touch:"h-14 w-14","touch-lg":"h-16 w-16","touch-xl":"h-20 w-20"},n="bg-accent-tint text-blue-700 not-disabled:not-aria-disabled:hover:bg-blue-100 focus-visible:ring-[color:var(--rosh-focus-ring)]";function d({variant:o="primary",size:t="md",block:d=!1,pressed:l=!1,className:c=""}={}){const g="link"===o;return[g?i:r,l&&"secondary"===o?"border border-blue-200 bg-accent-tint text-blue-700 shadow-sm not-disabled:not-aria-disabled:hover:bg-blue-100 focus-visible:ring-[color:var(--rosh-focus-ring)]":l&&"ghost"===o?n:e[o],g?a[t]:s[t],d?"w-full":"",c].filter(Boolean).join(" ")}function l({variant:o="ghost",size:s="md",pressed:i=!1,ink:a="own",className:d=""}={}){return[r,!i||"ghost"!==o&&"secondary"!==o?"inherit"===a&&"ghost"===o?"text-inherit not-disabled:not-aria-disabled:hover:bg-gray-100 focus-visible:ring-[color:var(--rosh-focus-ring)]":e[o]:n,t[s],"shrink-0 p-0",d].filter(Boolean).join(" ")}export{d as buttonClasses,l as iconButtonClasses};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{InputNumber_default as e,stepRounding as a}from"./chunk-
|
|
1
|
+
import{InputNumber_default as e,stepRounding as a}from"./chunk-TM5NQTFA.js";import{IconButton_default as r}from"./chunk-4YH7U7WL.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{Tooltip as t}from"./chunk-CIZAUBWA.js";import{jsx as n,jsxs as o,Fragment as d}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={padding:{top:/* @__PURE__ */n(i,{name:"padding-top","aria-hidden":"true",className:l}),right:/* @__PURE__ */n(i,{name:"padding-right","aria-hidden":"true",className:l}),bottom:/* @__PURE__ */n(i,{name:"padding-bottom","aria-hidden":"true",className:l}),left:/* @__PURE__ */n(i,{name:"padding-left","aria-hidden":"true",className:l}),vertical:/* @__PURE__ */n(i,{name:"padding-y","aria-hidden":"true",className:l}),horizontal:/* @__PURE__ */n(i,{name:"padding-left-right","aria-hidden":"true",className:l})},crop:{top:/* @__PURE__ */n(i,{name:"crop-top","aria-hidden":"true",className:l}),right:/* @__PURE__ */n(i,{name:"crop-right","aria-hidden":"true",className:l}),bottom:/* @__PURE__ */n(i,{name:"crop-bottom","aria-hidden":"true",className:l}),left:/* @__PURE__ */n(i,{name:"crop-left","aria-hidden":"true",className:l}),vertical:/* @__PURE__ */n(i,{name:"crop-y","aria-hidden":"true",className:l}),horizontal:/* @__PURE__ */n(i,{name:"crop-left-right","aria-hidden":"true",className:l})}},m=/* @__PURE__ */new Set(["ArrowUp","ArrowDown","PageUp","PageDown"]),p=e=>{m.has(e.key)&&(e.preventDefault(),e.stopPropagation())},c=e=>e.stopPropagation(),h=/* @__PURE__ */n(i,{name:"sides-each","aria-hidden":"true",className:"h-4 w-4"});var u=(e,a,r)=>null===e[r]?a[r]:String(e[r]);function g(e,a){const r=r=>u(e,a,r);return r("left")!==r("right")||r("top")!==r("bottom")}function f({label:r,value:i,onChange:t,each:l,placeholder:m,words:h,min:g=0,max:f=200,step:b=4,readOnly:v,glyphs:N="padding",units:y,sideDisplay:w}){const x=s[N],C=(e,a)=>{const r={...i};for(const i of e)r[i]=a;t(r)},j=(r,t,o)=>{const d=r.map(e=>w?.[e]?.word),l=d[0]&&d.every(e=>e===d[0])?d[0]:void 0;if(l)/* @__PURE__ */
|
|
2
2
|
return n("div",{"data-side":r.join("-"),className:"min-w-0",onKeyDownCapture:p,onWheelCapture:c,children:/* @__PURE__ */n(e,{value:null,onChange:e=>C(r,e),min:g,max:f,step:b,snap:!0,...a(b),readOnly:v,placeholder:l,display:()=>l,reportWhileTyping:!1,prefix:o,"aria-label":t})});const s=d.some(Boolean)?"mixed":function(e,a){const r=a.map(a=>e[a]);return r.every(e=>e===r[0])?r[0]:"mixed"}(i,r),N=r.map(e=>u(i,m,e)),x="mixed"!==s&&N.every(e=>e===N[0])?N[0]:"–";/* @__PURE__ */
|
|
3
3
|
return n("div",{"data-side":r.join("-"),className:"min-w-0",children:/* @__PURE__ */n(e,{value:"mixed"===s?null:s,onChange:e=>C(r,e),min:g,max:f,step:b,snap:!0,...a(b),steppers:"compact",readOnly:v,placeholder:x,prefix:o,suffix:h.unit,units:y,"aria-label":t})})};/* @__PURE__ */
|
|
4
4
|
return n("div",{role:"group","aria-label":r,"data-sides":l?"each":"pairs",className:"grid min-w-0 grid-cols-2 gap-2",children:/* @__PURE__ */o(d,l?{children:[j(["left"],h.sides.left,x.left),j(["top"],h.sides.top,x.top),j(["right"],h.sides.right,x.right),j(["bottom"],h.sides.bottom,x.bottom)]}:{children:[j(["left","right"],h.horizontal,x.horizontal),j(["top","bottom"],h.vertical,x.vertical)]})})}function b({each:e,onChange:a,label:i,disabled:o}){/* @__PURE__ */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{StatCard as e,Card as a}from"./chunk-RKSCB5BJ.js";import{Sparkline as t}from"./chunk-CKCDGSTC.js";import{PieChart as r}from"./chunk-6EGZ4PV4.js";import{Avatar as s}from"./chunk-SCNQK5NF.js";import{ColumnChart as l}from"./chunk-AQVPWUJ3.js";import{StatusBadgeProvider as i,StatusBadge as d}from"./chunk-ABIWAS5K.js";import{Button_default as c}from"./chunk-
|
|
1
|
+
import{StatCard as e,Card as a}from"./chunk-RKSCB5BJ.js";import{Sparkline as t}from"./chunk-CKCDGSTC.js";import{PieChart as r}from"./chunk-6EGZ4PV4.js";import{Avatar as s}from"./chunk-SCNQK5NF.js";import{ColumnChart as l}from"./chunk-AQVPWUJ3.js";import{StatusBadgeProvider as i,StatusBadge as d}from"./chunk-ABIWAS5K.js";import{Button_default as c}from"./chunk-37FQVY2O.js";import{TH_ONE_LINE as n}from"./chunk-FAPZFMS3.js";import{jsx as o,jsxs as m}from"react/jsx-runtime";var u={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},h=[12,18,14,22,19,27,24,31,28,35,30,38],p=["J","F","M","A","M","J","J","A","S","O","N","D"],g=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],x=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function v(){/* @__PURE__ */
|
|
2
2
|
return o(i,{groups:u,children:/* @__PURE__ */o("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */m("div",{className:"mx-auto max-w-6xl space-y-6",children:[
|
|
3
3
|
/* @__PURE__ */m("div",{className:"flex items-center justify-between gap-4",children:[
|
|
4
4
|
/* @__PURE__ */m("div",{children:[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isSafeLinkHref as e}from"./chunk-Z5TE3MEG.js";import{Button_default as t}from"./chunk-
|
|
1
|
+
import{isSafeLinkHref as e}from"./chunk-Z5TE3MEG.js";import{Button_default as t}from"./chunk-37FQVY2O.js";import{Icon as n}from"./chunk-ISVODSRP.js";import{useShellStrings as r}from"./chunk-NRHG4R2Q.js";import{createContext as l,useContext as s}from"react";import{jsx as a,jsxs as i}from"react/jsx-runtime";var c=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,o=l(void 0);function d({href:t,children:n}){const r=s(o),l=(t=>e(t.trim()))(t)?t:void 0;/* @__PURE__ */
|
|
2
2
|
return a("a",{href:l,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",onClick:l&&r?e=>{(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))(e)&&r(l)&&e.preventDefault()}:void 0,children:n})}function u(e){const t=[];let n,r=0,l=0;const s=new RegExp(c.source,"g");for(;null!==(n=s.exec(e));)n.index>r&&t.push(e.slice(r,n.index)),void 0!==n[1]?t.push(
|
|
3
3
|
/* @__PURE__ */i("span",{className:"text-gray-400",children:["[",n[1],"]"]},l++)):void 0!==n[3]?t.push(
|
|
4
4
|
/* @__PURE__ */a(d,{href:n[4],children:n[3]},l++)):void 0!==n[5]?t.push(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r="16.0.0",a=r;export{a as APP_VERSION,r as VERSION};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import{useUndoableState as e}from"./chunk-GZ4AMXEU.js";import{fitBoxScale as t}from"./chunk-M6UKCZHT.js";import{UndoContext as r}from"./chunk-3AUPCKBR.js";import{toast_default as n}from"./chunk-
|
|
1
|
+
import{useUndoableState as e}from"./chunk-GZ4AMXEU.js";import{fitBoxScale as t}from"./chunk-M6UKCZHT.js";import{UndoContext as r}from"./chunk-3AUPCKBR.js";import{toast_default as n}from"./chunk-VLT4ZEHT.js";import{useShellStrings as o}from"./chunk-NRHG4R2Q.js";import{forwardRef as i,useRef as a,useState as l,useContext as s,useMemo as c,useEffect as d,useImperativeHandle as h}from"react";import{jsx as u,jsxs as p,Fragment as y}from"react/jsx-runtime";var x=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],m=[{id:"system",name:"fontSystem",css:"-apple-system, system-ui, sans-serif"},{id:"serif",name:"fontSerif",css:'Georgia, "Times New Roman", serif'},{id:"mono",name:"fontMono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",name:"fontCursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],g=()=>Math.random().toString(36).slice(2,9),w=i(function({src:i,filename:w,onApply:b,onCancel:v},D){const P=a(null),$=a(null),I=a(null),S=a(null),W=o().annotator,R=a(W);R.current=W;const[B,j]=l("select"),[H,T]=l(x[0]),[U,F]=l(4),[A,O]=l(24),[Z,K]=l(m[0].id),[V,G]=l(!0),[X,q]=l(!1),[Y,_]=l(!1),[Q,J]=l(null),[ee,te]=l(null),[re,ne]=l(6),[oe,ie]=l(12),[ae,le]=l(null),[se,ce]=l(null),[de,he]=l(null),[ue,pe]=l(1),[ye,xe]=l(null),[me,ge]=l(null),[we,fe]=l(null),be=a(0),ve=a(!1),[ke,Me]=e([],{label:"annotation",coalesceKey:ve.current?`drag-${be.current}`:null}),Ne=s(r),Ce=a(null),[Le,ze]=l(!1),De=c(()=>de?{w:de.w*ue,h:de.h*ue}:null,[de,ue]),Ee=De&&se?De.w/se.w:1,Pe=c(()=>ke.find(e=>e.id===ae)??null,[ke,ae]);d(()=>{"select"===B&&Pe&&("color"in Pe&&T(Pe.color),"stroke"in Pe&&F(Pe.stroke),"rect"===Pe.type&&ie(Pe.radius),"text"===Pe.type&&(O(Pe.size),K(Pe.font),G(Pe.bold),q(Pe.italic),_(Pe.underline),J(Pe.borderColor),te(Pe.background),ne(Pe.padding)))},[ae]),d(()=>{const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{S.current=e,ce({w:e.naturalWidth,h:e.naturalHeight}),Ne?.baseline(),Me([]),le(null)},e.onerror=()=>n.error(R.current.loadFailed),e.src=i},[i]),d(()=>{if(!se)return;const e=()=>{const e=P.current;if(!e)return;const r=e.getBoundingClientRect(),n=Math.max(0,r.width-32),o=Math.max(0,r.height-32);if(0===n||0===o)return;const i=t({width:n,height:o},{width:se.w,height:se.h},1);he({w:se.w*i,h:se.h*i})};e();const r=new ResizeObserver(e);return P.current&&r.observe(P.current),()=>r.disconnect()},[se]);const $e=c(()=>ke.filter(e=>"mosaic"===e.type),[ke]);d(()=>{const e=S.current,t=$.current;if(!e||!t||!se)return;t.width=se.w,t.height=se.h;const r=t.getContext("2d");r.drawImage(e,0,0);for(const e of $e)E(r,e)},[se,$e,de]);const Ie=e=>{const t=I.current;if(!t)return{x:0,y:0};const r=t.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const n=t.getScreenCTM();if(!n)return{x:0,y:0};const o=r.matrixTransform(n.inverse());return{x:o.x,y:o.y}},Se=e=>{be.current+=1,ve.current=!0,Ce.current=e,ze(!0)};d(()=>{if(!Le)return;const e=e=>{const t=Ce.current;if(!t)return;const r=Ie(e);if("draw"===t.kind)xe(N(B,t.start,r,H,U,oe));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(r.x-e.x)>1||Math.abs(r.y-e.y)>1)&&(t.points.push(r),xe({id:"",type:"draw",points:t.points.slice(),color:H,stroke:U}))}else if("crop"===t.kind)fe(z(t.start,r));else if("move"===t.kind){const e=r.x-t.start.x,n=r.y-t.start.y;Me(r=>r.map(r=>r.id===t.id?C(t.original,e,n):r))}else"resize"===t.kind&&Me(e=>e.map(e=>e.id===t.id?function(e,t,r){if("arrow"===e.type)return"start"===t?{...e,x1:r.x,y1:r.y}:"end"===t?{...e,x2:r.x,y2:r.y}:e;if("text"===e.type||"draw"===e.type)return e;const n=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=n,s=i,c=o,d=a;"nw"===t&&(l=r.x,s=r.y);"ne"===t&&(c=r.x,s=r.y);"se"===t&&(c=r.x,d=r.y);"sw"===t&&(l=r.x,d=r.y);const h=z({x:l,y:s},{x:c,y:d});return{...e,x:h.x,y:h.y,w:h.w,h:h.h}}(t.original,t.corner,r):e))},t=()=>{const e=Ce.current;if(Ce.current=null,ve.current=!1,ze(!1),"draw"===e?.kind)xe(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const r={...e,id:g()};return Me(e=>[...e,r]),le(r.id),j("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void xe(null);const t={id:g(),type:"draw",points:e.points,color:H,stroke:U};Me(e=>[...e,t]),le(t.id),j("select"),xe(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[Le,B,H,U,oe]);d(()=>{const e=e=>{document.activeElement&&/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName)||ae&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),Me(e=>e.filter(e=>e.id!==ae)),le(null)):"Escape"===e.key&&le(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ae]);const We=e=>{const t=!{bold:V,italic:X,underline:Y}[e];"bold"===e&&G(t),"italic"===e&&q(t),"underline"===e&&_(t),ae&&Me(r=>r.map(r=>r.id===ae&&"text"===r.type?{...r,[e]:t}:r))},Re=e=>{J(e),ae&&Me(t=>t.map(t=>t.id===ae&&"text"===t.type?{...t,borderColor:e}:t))},Be=e=>{te(e),ae&&Me(t=>t.map(t=>t.id===ae&&"text"===t.type?{...t,background:e}:t))},je=e=>{if(!me)return;const t=e??me.value;if(!t.trim())return me.editingId&&Me(e=>e.filter(e=>e.id!==me.editingId)),void ge(null);if(me.editingId)Me(e=>e.map(e=>e.id===me.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:g(),type:"text",x:me.x,y:me.y,text:t,color:H,size:A,font:Z,bold:V,italic:X,underline:Y,borderColor:Q,background:ee,padding:re};Me(t=>[...t,e]),le(e.id),j("select")}ge(null)},He=async()=>{const e=$.current,t=I.current;if(!e||!t||!se)return null;const r=document.createElement("canvas");r.width=se.w,r.height=se.h;const n=r.getContext("2d");n.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),s=new Image;return await new Promise(e=>{s.onload=()=>e(),s.onerror=()=>e(),s.src=l}),n.drawImage(s,0,0,se.w,se.h),URL.revokeObjectURL(l),r};h(D,()=>({save:async()=>{const e=await He();e&&e.toBlob(e=>{if(!e)return void n.error(R.current.exportFailed);const t=URL.createObjectURL(e),r=document.createElement("a");r.href=t;const o=w.replace(/\.[^.]+$/,"");r.download=`${o}-annotated.png`,r.click(),URL.revokeObjectURL(t)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void n.error(R.current.clipboardUnsupported);const e=await He();e&&e.toBlob(async e=>{if(e)try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),n.success(R.current.copied)}catch{n.error(R.current.copyRefused)}else n.error(R.current.copyFailed)},"image/png")}}),[se,w]);const Te=c(()=>[{id:"select",label:W.toolSelect,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:W.toolDraw,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:W.toolRect,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:W.toolEllipse,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:W.toolArrow,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:W.toolMosaic,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:W.toolText,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:W.toolCrop,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[W]),Ue=e=>"p-2 rounded transition-colors "+(e?"bg-blue-500 text-on-accent":"text-ink hover:bg-gray-200"),Fe=Pe?.type??("select"===B?null:B),Ae="rect"===Fe||"circle"===Fe||"arrow"===Fe||"draw"===Fe,Oe="rect"===Fe,Ze="text"===Fe;/* @__PURE__ */
|
|
2
2
|
return p("div",{className:"flex flex-col h-full bg-gray-100",children:[
|
|
3
|
-
/* @__PURE__ */p("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[
|
|
3
|
+
/* @__PURE__ */p("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[Te.map(e=>/* @__PURE__ */u("button",{onClick:()=>{j(e.id),le(null)},title:e.label,className:Ue(B===e.id),children:e.icon},e.id)),
|
|
4
4
|
/* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
5
|
-
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:x.map(e=>/* @__PURE__ */u("button",{onClick:()=>(e=>{
|
|
5
|
+
/* @__PURE__ */u("div",{className:"flex items-center gap-1",children:x.map(e=>/* @__PURE__ */u("button",{onClick:()=>(e=>{T(e),ae&&Me(t=>t.map(t=>t.id!==ae||"mosaic"===t.type?t:{...t,color:e}))})(e),title:e,className:"h-5 w-5 rounded-full border "+(H===e?"ring-2 ring-blue-500 ring-offset-1":"border-gray-300"),style:{background:e}},e))}),Ae&&/* @__PURE__ */p(y,{children:[
|
|
6
6
|
/* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
7
7
|
/* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
8
8
|
/* @__PURE__ */u("span",{children:W.weight}),
|
|
9
|
-
/* @__PURE__ */u("input",{type:"range",min:1,max:20,step:1,value:
|
|
10
|
-
/* @__PURE__ */u("span",{className:"tabular-nums w-5 text-right",children:
|
|
9
|
+
/* @__PURE__ */u("input",{type:"range",min:1,max:20,step:1,value:U,onChange:e=>{return t=Number(e.target.value),F(t),void(ae&&Me(e=>e.map(e=>e.id!==ae?e:"rect"===e.type||"circle"===e.type||"arrow"===e.type||"draw"===e.type?{...e,stroke:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
10
|
+
/* @__PURE__ */u("span",{className:"tabular-nums w-5 text-right",children:U})]})]}),Oe&&/* @__PURE__ */p(y,{children:[
|
|
11
11
|
/* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
12
12
|
/* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
13
13
|
/* @__PURE__ */u("span",{children:W.radius}),
|
|
14
14
|
/* @__PURE__ */u("input",{type:"range",min:0,max:48,step:1,value:oe,onChange:e=>{return t=Number(e.target.value),ie(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"rect"===e.type?{...e,radius:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
15
|
-
/* @__PURE__ */u("span",{className:"tabular-nums w-6 text-right",children:oe})]})]}),
|
|
15
|
+
/* @__PURE__ */u("span",{className:"tabular-nums w-6 text-right",children:oe})]})]}),Ze&&/* @__PURE__ */p(y,{children:[
|
|
16
16
|
/* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
17
|
-
/* @__PURE__ */u("select",{value:
|
|
18
|
-
/* @__PURE__ */u("button",{onClick:()=>We("bold"),className:
|
|
19
|
-
/* @__PURE__ */u("button",{onClick:()=>We("italic"),className:
|
|
20
|
-
/* @__PURE__ */u("button",{onClick:()=>We("underline"),className:
|
|
17
|
+
/* @__PURE__ */u("select",{value:Z,onChange:e=>{return t=e.target.value,K(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:m.map(e=>/* @__PURE__ */u("option",{value:e.id,children:W[e.name]},e.id))}),
|
|
18
|
+
/* @__PURE__ */u("button",{onClick:()=>We("bold"),className:Ue(V),title:W.bold,children:/* @__PURE__ */u("span",{className:"font-bold",children:W.boldLetter})}),
|
|
19
|
+
/* @__PURE__ */u("button",{onClick:()=>We("italic"),className:Ue(X),title:W.italic,children:/* @__PURE__ */u("span",{className:"italic",children:W.italicLetter})}),
|
|
20
|
+
/* @__PURE__ */u("button",{onClick:()=>We("underline"),className:Ue(Y),title:W.underline,children:/* @__PURE__ */u("span",{className:"underline",children:W.underlineLetter})}),
|
|
21
21
|
/* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
22
22
|
/* @__PURE__ */u("span",{children:W.size}),
|
|
23
23
|
/* @__PURE__ */u("input",{type:"range",min:10,max:96,step:1,value:A,onChange:e=>{return t=Number(e.target.value),O(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"text"===e.type?{...e,size:t}:e)));var t},className:"w-16 accent-blue-500"}),
|
|
24
24
|
/* @__PURE__ */u("span",{className:"tabular-nums w-7 text-right",children:A})]}),
|
|
25
25
|
/* @__PURE__ */p("label",{className:"flex items-center gap-1 text-gray-600",children:[
|
|
26
26
|
/* @__PURE__ */u("span",{children:W.border}),Q?/* @__PURE__ */p(y,{children:[
|
|
27
|
-
/* @__PURE__ */u("input",{type:"color",value:Q,onChange:e=>
|
|
28
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
27
|
+
/* @__PURE__ */u("input",{type:"color",value:Q,onChange:e=>Re(e.target.value),title:W.borderColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
|
|
28
|
+
/* @__PURE__ */u("button",{onClick:()=>Re(null),title:W.removeBorder,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */u("button",{onClick:()=>Re(H),title:W.addBorder,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:W.add})]}),
|
|
29
29
|
/* @__PURE__ */p("label",{className:"flex items-center gap-1 text-gray-600",children:[
|
|
30
30
|
/* @__PURE__ */u("span",{children:W.fill}),ee?/* @__PURE__ */p(y,{children:[
|
|
31
|
-
/* @__PURE__ */u("input",{type:"color",value:ee,onChange:e=>
|
|
32
|
-
/* @__PURE__ */u("button",{onClick:()=>
|
|
31
|
+
/* @__PURE__ */u("input",{type:"color",value:ee,onChange:e=>Be(e.target.value),title:W.fillColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
|
|
32
|
+
/* @__PURE__ */u("button",{onClick:()=>Be(null),title:W.removeFill,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */u("button",{onClick:()=>Be("#ffffff"),title:W.addFill,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:W.add})]}),
|
|
33
33
|
/* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
|
|
34
34
|
/* @__PURE__ */u("span",{children:W.padding}),
|
|
35
35
|
/* @__PURE__ */u("input",{type:"range",min:0,max:40,step:1,value:re,onChange:e=>{return t=Number(e.target.value),ne(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"text"===e.type?{...e,padding:t}:e)));var t},className:"w-14 accent-blue-500"}),
|
|
@@ -42,13 +42,13 @@ return p("div",{className:"flex flex-col h-full bg-gray-100",children:[
|
|
|
42
42
|
/* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
|
|
43
43
|
/* @__PURE__ */u("button",{onClick:()=>{Me(e=>e.slice(0,-1)),le(null)},disabled:0===ke.length,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-700",children:W.undo}),
|
|
44
44
|
/* @__PURE__ */p("div",{className:"ml-auto flex items-center gap-2",children:[we&&/* @__PURE__ */p(y,{children:[
|
|
45
|
-
/* @__PURE__ */u("button",{onClick:()=>{if(!we||!S.current||!se)return;const e=we,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const r=t.getContext("2d"),n=document.createElement("canvas");n.width=se.w,n.height=se.h;const o=n.getContext("2d");o.drawImage(S.current,0,0);for(const e of
|
|
45
|
+
/* @__PURE__ */u("button",{onClick:()=>{if(!we||!S.current||!se)return;const e=we,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const r=t.getContext("2d"),n=document.createElement("canvas");n.width=se.w,n.height=se.h;const o=n.getContext("2d");o.drawImage(S.current,0,0);for(const e of $e)E(o,e);r.drawImage(n,e.x,e.y,e.w,e.h,0,0,e.w,e.h);const i=new Image;i.onload=()=>{S.current=i,ce({w:i.naturalWidth,h:i.naturalHeight}),Me(t=>t.filter(e=>"mosaic"!==e.type).map(t=>C(t,-e.x,-e.y)).filter(e=>function(e,t,r){const n=L(e);return n.x+n.w>0&&n.y+n.h>0&&n.x<t&&n.y<r}(e,i.naturalWidth,i.naturalHeight))),fe(null)},i.src=t.toDataURL("image/png")},className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600",children:W.applyCrop}),
|
|
46
46
|
/* @__PURE__ */u("button",{onClick:()=>fe(null),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",children:W.cancel})]}),b&&!we&&/* @__PURE__ */p(y,{children:[v&&/* @__PURE__ */u("button",{onClick:v,className:"px-3 py-1 rounded hover:bg-gray-200 text-gray-700 text-xs font-medium",children:W.cancel}),
|
|
47
|
-
/* @__PURE__ */u("button",{onClick:async()=>{const e=await He();e?e.toBlob(e=>{e?b(e):n.error(
|
|
48
|
-
/* @__PURE__ */u("div",{ref
|
|
49
|
-
/* @__PURE__ */u("canvas",{ref
|
|
50
|
-
/* @__PURE__ */p("svg",{ref:I,viewBox:`0 0 ${se.w} ${se.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===
|
|
51
|
-
/* @__PURE__ */u("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===
|
|
47
|
+
/* @__PURE__ */u("button",{onClick:async()=>{const e=await He();e?e.toBlob(e=>{e?b(e):n.error(R.current.exportFailed)},"image/png"):n.error(R.current.exportFailed)},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:W.apply})]})]})]}),
|
|
48
|
+
/* @__PURE__ */u("div",{ref:P,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:De&&se&&/* @__PURE__ */p("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:De.w,height:De.h},children:[
|
|
49
|
+
/* @__PURE__ */u("canvas",{ref:$,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
|
|
50
|
+
/* @__PURE__ */p("svg",{ref:I,viewBox:`0 0 ${se.w} ${se.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===B?"default":"text"===B?"text":"crosshair"},onPointerDown:e=>{if("select"===B)return void le(null);if("text"===B){if(me)return void je();const t=Ie(e);return void ge({x:t.x,y:t.y,value:""})}const t=Ie(e);if("crop"!==B){if("draw"===B)return Se({kind:"pen",points:[t]}),void xe({id:"",type:"draw",points:[t],color:H,stroke:U});xe(N(B,t,t,H,U,oe)),Se({kind:"draw",start:t})}else Se({kind:"crop",start:t})},children:[ke.map(e=>/* @__PURE__ */u(f,{anno:e,selected:ae===e.id,zoom:ue,onPointerDown:t=>((e,t)=>{"select"===B&&(e.stopPropagation(),le(t.id),Se({kind:"move",id:t.id,start:Ie(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&ge({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),Se({kind:"resize",id:t.id,corner:r,start:Ie(e),original:t})})(t,e,r)},e.id)),ye&&/* @__PURE__ */u(f,{anno:{...ye,id:"__preview"},preview:!0}),we&&/* @__PURE__ */u(k,{rect:we,imageSize:se})]}),me&&/* @__PURE__ */u(M,{pendingText:me,color:H,size:A,font:m.find(e=>e.id===Z)?.css??m[0].css,bold:V,italic:X,underline:Y,borderColor:Q,background:ee,padding:re,scale:Ee,onChange:e=>ge({...me,value:e}),onCommit:je,onCancel:()=>ge(null)})]})}),
|
|
51
|
+
/* @__PURE__ */u("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===B?ae?W.hintSelected:W.hintSelect:"text"===B?W.hintText:"crop"===B?W.hintCrop:"draw"===B?W.hintDraw:W.hintShape})]})});function f({anno:e,selected:t,preview:r,zoom:n=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const l=L(e),s=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},c=i?{onDoubleClick:i}:{};let d;if("rect"===e.type)d=/* @__PURE__ */u("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("circle"===e.type)d=/* @__PURE__ */u("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...s});else if("arrow"===e.type)d=/* @__PURE__ */u(v,{anno:e,interactive:s});else if("draw"===e.type)d=/* @__PURE__ */u("path",{d:D(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("mosaic"===e.type)d=/* @__PURE__ */u("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...s,style:t?{...s.style,stroke:"var(--rosh-annotator-selection)"}:s.style});else{const t=m.find(t=>t.id===e.font)?.css??m[0].css,r=e.padding??0,n=!!e.borderColor||!!e.background,o=L(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;d=/* @__PURE__ */p("g",{...s,...c,children:[n&&/* @__PURE__ */u("rect",{x:o.x-r,y:o.y-r,width:Math.max(0,o.w)+2*r,height:Math.max(0,o.h)+2*r,rx:Math.min(8,r),ry:Math.min(8,r),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
|
|
52
52
|
/* @__PURE__ */u("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,r)=>/* @__PURE__ */u("tspan",{x:e.x,dy:0===r?0:1.2*e.size,children:t},r))})]})}/* @__PURE__ */
|
|
53
53
|
return p("g",{children:[d,t&&!r&&/* @__PURE__ */p(y,{children:[
|
|
54
54
|
/* @__PURE__ */u("rect",{"data-chrome":"selection",x:l.x-4,y:l.y-4,width:l.w+8,height:l.h+8,fill:"none",strokeWidth:2/n,strokeDasharray:`${6/n},${4/n}`,pointerEvents:"none",style:{stroke:"var(--rosh-annotator-selection)"}}),a&&/* @__PURE__ */u(b,{anno:e,zoom:n,onHandlePointerDown:a})]})]})}function b({anno:e,zoom:t,onHandlePointerDown:r}){const n=6/t,o=1.5/t,i=e=>({fill:"white",strokeWidth:o,pointerEvents:"all",style:{cursor:e,stroke:"var(--rosh-annotator-selection)"},"data-chrome":"handle"});if("arrow"===e.type)/* @__PURE__ */
|
|
@@ -66,4 +66,4 @@ return p("g",{...t,children:[
|
|
|
66
66
|
return p("g",{pointerEvents:"none",children:[
|
|
67
67
|
/* @__PURE__ */u("path",{d:`M0,0 H${t.w} V${t.h} H0 Z M${e.x},${e.y} V${e.y+e.h} H${e.x+e.w} V${e.y} Z`,fillRule:"evenodd",style:{fill:"var(--rosh-annotator-crop-scrim)"}}),
|
|
68
68
|
/* @__PURE__ */u("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:"white",strokeWidth:2,strokeDasharray:"8,6"})]})}function M({pendingText:e,color:t,size:r,font:n,bold:i,italic:l,underline:s,borderColor:c,background:h,padding:p,scale:y,onChange:x,onCommit:m,onCancel:g}){const w=a(null),f=o().annotator;d(()=>{const e=requestAnimationFrame(()=>{w.current?.focus(),w.current?.select?.()});return()=>cancelAnimationFrame(e)},[]);const b=()=>m(w.current?.value),v=c?Math.max(1,Math.round(r/12)):0;/* @__PURE__ */
|
|
69
|
-
return u("div",{style:{position:"absolute",left:e.x*y+"px",top:e.y*y+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */u("textarea",{ref:w,value:e.value,onChange:e=>x(e.target.value),onBlur:b,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),b())},placeholder:f.textPlaceholder,rows:1,className:"rosh-focus-ring resize-none shadow-(--elevation-panel)",style:{color:t,fontSize:r*y+"px",fontFamily:n,fontWeight:i?700:400,fontStyle:l?"italic":"normal",textDecoration:s?"underline":void 0,minWidth:80,padding:p*y+"px",borderRadius:Math.min(8,p)*y+"px",border:c?`${v*y}px solid ${c}`:"1px dashed var(--rosh-annotator-edit-hint)",background:h??"var(--rosh-annotator-edit-surface)"}})})}function N(e,t,r,n,o,i){if("rect"===e){const e=z(t,r);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o,radius:i}}if("circle"===e){const e=z(t,r);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:r.x,y2:r.y,color:n,stroke:o};if("mosaic"===e){const e=z(t,r);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function C(e,t,r){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+r,x2:e.x2+t,y2:e.y2+r}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+r}))}:(e.type,{...e,x:e.x+t,y:e.y+r})}function L(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,r=e.points[0].x,n=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>r&&(r=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y);return{x:t,y:n,w:r-t,h:o-n}}if("text"===e.type){const t=e.text.split("\n"),r=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:r*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function z(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function D(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length;r++)t+=` L ${e[r].x} ${e[r].y}`;return t}function
|
|
69
|
+
return u("div",{style:{position:"absolute",left:e.x*y+"px",top:e.y*y+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */u("textarea",{ref:w,value:e.value,onChange:e=>x(e.target.value),onBlur:b,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),b())},placeholder:f.textPlaceholder,rows:1,className:"rosh-focus-ring resize-none shadow-(--elevation-panel)",style:{color:t,fontSize:r*y+"px",fontFamily:n,fontWeight:i?700:400,fontStyle:l?"italic":"normal",textDecoration:s?"underline":void 0,minWidth:80,padding:p*y+"px",borderRadius:Math.min(8,p)*y+"px",border:c?`${v*y}px solid ${c}`:"1px dashed var(--rosh-annotator-edit-hint)",background:h??"var(--rosh-annotator-edit-surface)"}})})}function N(e,t,r,n,o,i){if("rect"===e){const e=z(t,r);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o,radius:i}}if("circle"===e){const e=z(t,r);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:r.x,y2:r.y,color:n,stroke:o};if("mosaic"===e){const e=z(t,r);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function C(e,t,r){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+r,x2:e.x2+t,y2:e.y2+r}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+r}))}:(e.type,{...e,x:e.x+t,y:e.y+r})}function L(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,r=e.points[0].x,n=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>r&&(r=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y);return{x:t,y:n,w:r-t,h:o-n}}if("text"===e.type){const t=e.text.split("\n"),r=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:r*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function z(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function D(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length;r++)t+=` L ${e[r].x} ${e[r].y}`;return t}function E(e,t){const r=Math.round(Math.max(0,t.x)),n=Math.round(Math.max(0,t.y)),o=Math.round(Math.min(e.canvas.width-r,t.w)),i=Math.round(Math.min(e.canvas.height-n,t.h));if(o<2||i<2)return;const a=e.getImageData(r,n,o,i);for(let e=0;e<i;e+=12)for(let t=0;t<o;t+=12){let r=0,n=0,l=0,s=0,c=0;const d=Math.min(12,o-t),h=Math.min(12,i-e);for(let i=0;i<h;i++)for(let h=0;h<d;h++){const d=4*((e+i)*o+(t+h));r+=a.data[d],n+=a.data[d+1],l+=a.data[d+2],s+=a.data[d+3],c++}r=Math.round(r/c),n=Math.round(n/c),l=Math.round(l/c),s=Math.round(s/c);for(let i=0;i<h;i++)for(let c=0;c<d;c++){const d=4*((e+i)*o+(t+c));a.data[d]=r,a.data[d+1]=n,a.data[d+2]=l,a.data[d+3]=s}}e.putImageData(a,r,n)}export{w as ImageAnnotator_default};
|