@copio/sdk 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +9 -9
- package/dist/chunk-Q7SOUI6D.js +2 -0
- package/dist/chunk-WZZ7FNDX.js +2 -0
- package/dist/core.js +1 -1
- package/dist/custom-elements.json +65 -65
- package/dist/index.js +1 -1
- package/dist/scanner.js +3 -3
- package/dist/types/sdk/styles.d.ts +1 -1
- package/dist/types/sdk/version.d.ts +1 -1
- package/package.json +1 -1
- package/sdk/core.js +8 -2
- package/sdk/styles.js +9 -6
- package/sdk/version.js +1 -1
- package/dist/chunk-Q3AWHANC.js +0 -2
- package/dist/chunk-TK5N67RB.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{l as T,m as z}from"./chunk-WZZ7FNDX.js";import{k as W,m as Q,n as R,o as G}from"./chunk-VPSUKD6F.js";import{a as g,b as _}from"./chunk-HCCNUPKB.js";import{b as C,c as U}from"./chunk-ZILTJGT2.js";import{b as O,i as $,j as N}from"./chunk-GU6OQMYK.js";import{a as P,b as D,d as B}from"./chunk-YNY65JUJ.js";import{b as j}from"./chunk-ZT72PD2C.js";var H=`:host{all:initial;display:block;position:relative;width:100%;height:100%;min-height:200px;container-type:size;container-name:copio-scanner;overflow:hidden;contain:layout;box-sizing:border-box;text-align:left;direction:ltr;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--copio-font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;--copio-font-mono:'JetBrains Mono','SFMono-Regular',Consolas,'Liberation Mono',monospace;--copio-color-bg:#0b0f17;--copio-color-surface:#131b26;--copio-color-surface-elevated:#1c2736;--copio-color-surface-overlay:rgba(15,22,32,0.88);--copio-color-stage-bg:#070a0f;--copio-color-text:#f1f5f9;--copio-color-text-muted:#94a3b8;--copio-color-text-inverse:#090d14;--copio-color-primary:#38bdf8;--copio-color-primary-hover:#7dd3fc;--copio-color-primary-contrast:#06131f;--copio-color-success:#22c55e;--copio-color-warning:#f59e0b;--copio-color-danger:#ef4444;--copio-color-border:rgba(148,163,184,0.18);--copio-color-border-strong:rgba(148,163,184,0.34);--copio-focus-ring:0 0 2px #0b0f17,0 0 0 4px #38bdf8;--copio-radius-sm:6px;--copio-radius-md:10px;--copio-radius-lg:14px;--copio-radius-pill:9999px;--copio-spacing-xs:4px;--copio-spacing-sm:8px;--copio-spacing-md:12px;--copio-spacing-lg:16px;--copio-spacing-xl:24px;--copio-touch-target-min:44px;--copio-crop-handle-hit:48px;--copio-crop-handle-visual:16px;--copio-shadow-elevated:0 12px 32px -4px rgba(0,0,0,0.55);--copio-transition-fast:150ms cubic-bezier(0.22,1,0.36,1);--copio-transition-normal:240ms cubic-bezier(0.22,1,0.36,1);font-family:var(--copio-font-family);font-size:14px;line-height:1.5;color:var(--copio-color-text);background-color:var(--copio-color-bg);color-scheme:dark}:host([theme="dark"]),:host(.copio-theme-dark),:host-context([data-theme="dark"]),:host-context(.sl-theme-dark),:host-context(.theme-dark){color-scheme:dark}:host([theme="light"]),:host(.copio-theme-light),:host-context([data-theme="light"]),:host-context(.sl-theme-light),:host-context(.theme-light){--copio-color-bg:#f8fafc;--copio-color-surface:#ffffff;--copio-color-surface-elevated:#f1f5f9;--copio-color-surface-overlay:rgba(255,255,255,0.92);--copio-color-stage-bg:#1e293b;--copio-color-text:#0f172a;--copio-color-text-muted:#475569;--copio-color-text-inverse:#ffffff;--copio-color-primary:#0284c7;--copio-color-primary-hover:#0369a1;--copio-color-primary-contrast:#ffffff;--copio-color-success:#16a34a;--copio-color-warning:#d97706;--copio-color-danger:#dc2626;--copio-color-border:rgba(15,23,42,0.12);--copio-color-border-strong:rgba(15,23,42,0.26);--copio-focus-ring:0 0 2px #ffffff,0 0 0 4px #0284c7;--copio-radius-sm:6px;--copio-radius-md:10px;--copio-radius-lg:14px;--copio-shadow-elevated:0 12px 28px -4px rgba(15,23,42,0.18);color-scheme:light}:host([theme="brand"]),:host(.copio-theme-brand),:host-context([data-theme="brand"]),:host-context(.theme-brand){--copio-color-bg:#0f111a;--copio-color-surface:#181b28;--copio-color-surface-elevated:#23273a;--copio-color-surface-overlay:rgba(24,27,40,0.90);--copio-color-stage-bg:#090a10;--copio-color-text:#f8fafc;--copio-color-text-muted:#9ca3af;--copio-color-text-inverse:#ffffff;--copio-color-primary:#10b981;--copio-color-primary-hover:#34d399;--copio-color-primary-contrast:#042f2e;--copio-color-success:#10b981;--copio-color-warning:#f59e0b;--copio-color-danger:#ef4444;--copio-color-border:rgba(16,185,129,0.22);--copio-color-border-strong:rgba(16,185,129,0.42);--copio-focus-ring:0 0 2px #0f111a,0 0 0 4px #10b981;--copio-radius-sm:4px;--copio-radius-md:8px;--copio-radius-lg:12px;--copio-shadow-elevated:0 12px 32px -4px rgba(0,0,0,0.65);color-scheme:dark}@media (prefers-color-scheme:light){:host([theme="auto"]),:host(.copio-theme-auto){--copio-color-bg:#f8fafc;--copio-color-surface:#ffffff;--copio-color-surface-elevated:#f1f5f9;--copio-color-surface-overlay:rgba(255,255,255,0.92);--copio-color-stage-bg:#1e293b;--copio-color-text:#0f172a;--copio-color-text-muted:#475569;--copio-color-text-inverse:#ffffff;--copio-color-primary:#0284c7;--copio-color-primary-hover:#0369a1;--copio-color-primary-contrast:#ffffff;--copio-color-success:#16a34a;--copio-color-warning:#d97706;--copio-color-danger:#dc2626;--copio-color-border:rgba(15,23,42,0.12);--copio-color-border-strong:rgba(15,23,42,0.26);--copio-focus-ring:0 0 2px #ffffff,0 0 0 4px #0284c7;--copio-radius-sm:6px;--copio-radius-md:10px;--copio-radius-lg:14px;--copio-shadow-elevated:0 12px 28px -4px rgba(15,23,42,0.18);color-scheme:light}}*,*::before,*::after{box-sizing:border-box}::slotted(*){box-sizing:border-box}.copio-scanner-container{width:100%;height:100%;position:relative;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;container-type:size;container-name:copio-scanner;contain:layout;background:var(--copio-color-bg);color:var(--copio-color-text);font-family:var(--copio-font-family);font-size:14px;line-height:1.5;text-align:left;direction:ltr;user-select:none}.copio-header{display:flex;align-items:center;justify-content:space-between;gap:var(--copio-spacing-sm);padding:var(--copio-spacing-sm) var(--copio-spacing-md);background:var(--copio-color-surface);border-bottom:1px solid var(--copio-color-border);min-height:52px;flex-shrink:0;z-index:5;box-sizing:border-box}.copio-header-left{display:flex;align-items:center;gap:var(--copio-spacing-sm);min-width:0}.copio-mode-badge{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:600;padding:4px 8px;border-radius:var(--copio-radius-pill);background:var(--copio-color-surface-elevated);color:var(--copio-color-primary);border:1px solid var(--copio-color-border);white-space:nowrap}.copio-title-group{display:flex;flex-direction:column;min-width:0}.copio-title{font-size:13px;font-weight:600;color:var(--copio-color-text);margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.copio-subtitle{font-size:11px;color:var(--copio-color-text-muted);margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.copio-header-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.copio-stage-tabs{display:inline-flex;background:var(--copio-color-bg);padding:2px;border-radius:var(--copio-radius-md);border:1px solid var(--copio-color-border)}.copio-stage-tab{appearance:none;border:none;background:transparent;color:var(--copio-color-text-muted);font-family:inherit;font-size:11px;font-weight:600;padding:6px 10px;min-height:var(--copio-touch-target-min);min-width:var(--copio-touch-target-min);border-radius:var(--copio-radius-sm);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background var(--copio-transition-fast),color var(--copio-transition-fast)}.copio-stage-tab[aria-selected="true"]{background:var(--copio-color-surface-elevated);color:var(--copio-color-text);box-shadow:0 1px 3px rgba(0,0,0,0.25)}.copio-btn{appearance:none;border:1px solid var(--copio-color-border);background:var(--copio-color-surface-elevated);color:var(--copio-color-text);font-family:inherit;font-size:13px;font-weight:600;min-height:var(--copio-touch-target-min);min-width:var(--copio-touch-target-min);padding:0 12px;border-radius:var(--copio-radius-md);display:inline-flex;align-items:center;justify-content:center;gap:7px;cursor:pointer;transition:all var(--copio-transition-fast);white-space:nowrap;text-decoration:none;box-sizing:border-box}.copio-btn:hover{background:var(--copio-color-primary-hover);color:var(--copio-color-primary-contrast);border-color:var(--copio-color-primary)}.copio-btn-primary{background:var(--copio-color-primary);color:var(--copio-color-primary-contrast);border-color:var(--copio-color-primary)}.copio-btn-danger{background:rgba(239,68,68,0.15);color:var(--copio-color-danger);border-color:rgba(239,68,68,0.35)}.copio-btn-danger:hover{background:var(--copio-color-danger);color:#fff}.copio-viewfinder,.copio-viewfinder-stage{position:relative;flex:1 1 auto;display:flex;flex-direction:column;justify-content:space-between;background:var(--copio-color-stage-bg);overflow:hidden;min-height:0;width:100%}.copio-viewfinder-feed,.copio-camera-feed{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:56px 20px 104px 20px;background:radial-gradient(circle at 50% 45%,#1e293b 0%,#090d14 75%)}.copio-camera-feed.is-shutter-flash::after{content:'';position:absolute;inset:0;background:#ffffff;opacity:0.75;pointer-events:none;z-index:5;animation:copio-shutter-flash 150ms ease-out forwards}@keyframes copio-shutter-flash{0%{opacity:0.75}100%{opacity:0}}.copio-framing-guide{position:relative;display:flex;align-items:center;justify-content:center;max-width:100%;max-height:100%;border:1.5px dashed rgba(56,189,248,0.55);border-radius:12px;box-shadow:0 0 9999px rgba(4,7,12,0.52);transition:all var(--copio-transition-normal);overflow:hidden}.copio-framing-guide[data-aspect="receipt"]{aspect-ratio:1 / 2.1;height:100%}.copio-framing-guide[data-aspect="card"]{aspect-ratio:1.586 / 1;width:92%;max-height:82%}.copio-framing-guide[data-aspect="a4"]{aspect-ratio:1 / 1.414;height:96%}.copio-framing-guide[data-aspect="auto"]{width:94%;height:94%}.copio-corner{position:absolute;width:22px;height:22px;border-color:var(--copio-color-primary);border-style:solid;border-width:0;pointer-events:none;z-index:2}.copio-corner.tl{top:6px;left:6px;border-top-width:3px;border-left-width:3px;border-top-left-radius:6px}.copio-corner.tr{top:6px;right:6px;border-top-width:3px;border-right-width:3px;border-top-right-radius:6px}.copio-corner.bl{bottom:6px;left:6px;border-bottom-width:3px;border-left-width:3px;border-bottom-left-radius:6px}.copio-corner.br{bottom:6px;right:6px;border-bottom-width:3px;border-right-width:3px;border-bottom-right-radius:6px}.copio-edge-quad{position:absolute;inset:12px;border:1px solid rgba(56,189,248,0.28);border-radius:8px;background:rgba(56,189,248,0.04);pointer-events:none;z-index:1}.copio-live-quad-overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:10;overflow:visible}.copio-live-quad-polygon{fill:rgba(56,189,248,0.18);stroke:var(--copio-color-primary,#38bdf8);stroke-width:3;vector-effect:non-scaling-stroke;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 0 6px rgba(56,189,248,0.45))}.copio-live-quad-corner{fill:#ffffff;stroke:var(--copio-color-primary,#38bdf8);stroke-width:2.5;filter:drop-shadow(0 0 4px rgba(0,0,0,0.4))}.copio-camera-feed.is-detected .copio-live-quad-polygon{fill:rgba(34,197,94,0.22);stroke:#22c55e;filter:drop-shadow(0 0 8px rgba(34,197,94,0.6))}.copio-camera-feed.is-detected .copio-live-quad-corner{stroke:#22c55e}.copio-camera-feed.is-tracking .copio-edge-quad{opacity:0.1;transition:opacity var(--copio-transition-fast)}.copio-camera-placeholder{position:relative;z-index:2;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--copio-color-text-muted);font-size:12px;font-weight:500;cursor:pointer;user-select:none;transition:color var(--copio-transition-fast),transform var(--copio-transition-fast)}.copio-camera-placeholder:hover{color:var(--copio-color-text);transform:scale(1.02)}.copio-status-dot{width:7px;height:7px;border-radius:50%;background:var(--copio-color-primary);box-shadow:0 8px var(--copio-color-primary);flex-shrink:0}.copio-viewfinder-hud-top{position:relative;z-index:3;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px;background:linear-gradient(to bottom,rgba(7,10,15,0.85),transparent)}.copio-step-pill{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:var(--copio-radius-pill);background:rgba(15,23,42,0.88);border:1px solid rgba(56,189,248,0.45);color:#f8fafc;font-size:12px;font-weight:600;box-shadow:0 4px 12px rgba(0,0,0,0.35)}.copio-privacy-pill{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;border-radius:var(--copio-radius-pill);background:rgba(22,101,52,0.35);border:1px solid rgba(34,197,94,0.4);color:#86efac;font-size:11px;font-weight:500}.copio-shutter-dock{position:relative;z-index:3;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px calc(12px + env(safe-area-inset-bottom,0)) 16px;background:var(--copio-color-surface);border-top:1px solid var(--copio-color-border);min-height:84px;flex-shrink:0}.copio-shutter-side{flex:1;display:flex;align-items:center}.copio-shutter-side.right{justify-content:flex-end}.copio-shutter-btn{appearance:none;width:64px;height:64px;border-radius:var(--copio-radius-pill);border:4px solid var(--copio-color-primary);background:transparent;padding:4px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:transform var(--copio-transition-fast),border-color 150ms ease;flex-shrink:0}.copio-shutter-btn:hover{transform:scale(1.04)}.copio-shutter-btn:active{transform:scale(0.94)}.copio-shutter-btn-inner,.copio-shutter-inner{width:100%;height:100%;border-radius:var(--copio-radius-pill);background:var(--copio-color-primary);display:flex;align-items:center;justify-content:center;color:var(--copio-color-primary-contrast);transition:transform var(--copio-transition-fast)}.copio-shutter-btn:active .copio-shutter-btn-inner,.copio-shutter-btn:active .copio-shutter-inner{transform:scale(0.88)}.copio-stack-pill{display:inline-flex;align-items:center;gap:8px;min-height:var(--copio-touch-target-min);padding:4px 12px 4px 6px;border-radius:var(--copio-radius-md);background:var(--copio-color-surface-elevated);border:1px solid var(--copio-color-primary);color:var(--copio-color-text);font-size:12px;font-weight:600;cursor:pointer}.copio-stack-thumb{width:30px;height:36px;border-radius:4px;object-fit:cover;border:1px solid rgba(255,255,255,0.35);background:#000}.copio-workbench,.copio-workbench-stage{position:relative;flex:1 1 auto;display:flex;flex-direction:column;background:var(--copio-color-bg);overflow:hidden;min-height:0;width:100%}.copio-workbench-main{flex:1;display:flex;flex-direction:column;min-height:0;width:100%;overflow:hidden}.copio-stage-canvas,.copio-canvas-viewport{position:relative;flex:1 1 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:hidden;padding:16px 20px 44px 20px;background:var(--copio-color-stage-bg);min-height:180px}.copio-canvas-viewport.is-cropping{padding:24px}.copio-canvas-viewport.has-card-switcher{padding-top:66px}.copio-card-side-switcher{position:absolute;top:8px;left:50%;transform:translateX(-50%);z-index:6;display:inline-flex;gap:4px;padding:3px;background:var(--copio-color-surface-overlay,rgba(15,22,32,0.88));border:1px solid var(--copio-color-border-strong);border-radius:var(--copio-radius-pill);backdrop-filter:blur(8px)}.copio-side-pill{appearance:none;border:none;background:transparent;color:var(--copio-color-text-muted);font-family:inherit;font-size:11px;font-weight:600;padding:6px 12px;min-height:var(--copio-touch-target-min);min-width:var(--copio-touch-target-min);border-radius:var(--copio-radius-pill);cursor:pointer;display:inline-flex;align-items:center;justify-content:center}.copio-side-pill[aria-selected="true"]{background:var(--copio-color-primary);color:var(--copio-color-primary-contrast)}.copio-stage-figure,.copio-canvas-wrapper{position:relative;display:flex;align-items:center;justify-content:center;max-width:100%;max-height:100%}.copio-stage-canvas img,.copio-stage-img,.copio-stage-image{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;box-shadow:var(--copio-shadow-elevated);border-radius:var(--copio-radius-sm);user-select:none}.copio-crop-layer{position:absolute;inset:0;width:100%;height:100%;overflow:visible;z-index:8;touch-action:none}.copio-crop-box{position:absolute;border:2px solid var(--copio-color-primary);box-shadow:0 0 9999px rgba(5,8,14,0.68);cursor:move;touch-action:none;box-sizing:border-box}.copio-crop-grid{position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(to right,rgba(56,189,248,0.28) 1px,transparent 1px),linear-gradient(to bottom,rgba(56,189,248,0.28) 1px,transparent 1px);background-size:33.333% 33.333%}.copio-crop-handle{position:absolute;width:var(--copio-crop-handle-hit);height:var(--copio-crop-handle-hit);min-width:44px;min-height:44px;display:flex;align-items:center;justify-content:center;z-index:10;touch-action:none;box-sizing:border-box}.copio-crop-handle::after{content:'';width:var(--copio-crop-handle-visual);height:var(--copio-crop-handle-visual);border-radius:50%;background:var(--copio-color-primary);border:2.5px solid #ffffff;box-shadow:0 2px 6px rgba(0,0,0,0.5);transition:transform 120ms ease;box-sizing:border-box}.copio-crop-handle:hover::after,.copio-crop-handle:active::after{transform:scale(1.25);background:var(--copio-color-success,#22c55e)}.copio-crop-handle.nw{top:-24px;left:-24px;cursor:nwse-resize}.copio-crop-handle.ne{top:-24px;right:-24px;cursor:nesw-resize}.copio-crop-handle.sw{bottom:-24px;left:-24px;cursor:nesw-resize}.copio-crop-handle.se{bottom:-24px;right:-24px;cursor:nwse-resize}.copio-crop-handle.n,.copio-crop-handle.edge-n{top:-24px;left:calc(50% - 24px);cursor:ns-resize}.copio-crop-handle.s,.copio-crop-handle.edge-s{bottom:-24px;left:calc(50% - 24px);cursor:ns-resize}.copio-crop-handle.w,.copio-crop-handle.edge-w{left:-24px;top:calc(50% - 24px);cursor:ew-resize}.copio-crop-handle.e,.copio-crop-handle.edge-e{right:-24px;top:calc(50% - 24px);cursor:ew-resize}.copio-crop-quad-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}.copio-crop-mask{fill:rgba(5,8,14,0.68)}.copio-crop-quad-outline{fill:rgba(56,189,248,0.06);stroke:var(--copio-color-primary);stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:auto;cursor:move}.copio-crop-quad-grid{stroke:rgba(56,189,248,0.35);stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none}.copio-quad-handle{transform:translate(-50%,-50%);cursor:grab}.copio-quad-handle:active{cursor:grabbing}.copio-crop-magnifier{position:absolute;width:96px;height:96px;border-radius:50%;border:2.5px solid var(--copio-color-primary);box-shadow:0 4px 16px rgba(0,0,0,0.55);pointer-events:none;z-index:20;display:none;background:#0b0f17;transform:translate(-50%,-125%)}.copio-filmstrip,.copio-filmstrip-bar{display:flex;align-items:center;gap:8px;padding:8px 12px;background:var(--copio-color-surface);border-top:1px solid var(--copio-color-border);overflow-x:auto;min-height:80px;flex-shrink:0;scrollbar-width:thin}.copio-filmstrip-scroll{display:flex;align-items:center;gap:8px}.copio-filmstrip-item{display:flex;flex-direction:column;align-items:center;gap:4px;flex-shrink:0}.copio-thumb-container{position:relative;width:56px;height:70px;border-radius:var(--copio-radius-sm);overflow:hidden;background:var(--copio-color-surface-elevated,#1c2736);border:2px solid var(--copio-color-border);cursor:pointer;transition:all var(--copio-transition-fast);display:flex;align-items:center;justify-content:center}.copio-filmstrip-item.is-active .copio-thumb-container{border-color:var(--copio-color-primary);box-shadow:0 0 2px rgba(56,189,248,0.25)}.copio-thumb-num{position:absolute;bottom:3px;right:3px;min-width:16px;height:16px;padding:0 4px;border-radius:999px;background:rgba(15,23,42,0.85);color:#f8fafc;font-size:10px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}.copio-thumb-reorder{display:flex;align-items:center;gap:4px}.copio-reorder-btn{appearance:none;border:1px solid var(--copio-color-border);background:var(--copio-color-surface-elevated);color:var(--copio-color-text-muted);border-radius:4px;font-size:9px;padding:2px 5px;cursor:pointer}.copio-reorder-btn:disabled{opacity:0.35;cursor:not-allowed}.copio-thumb-img{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}.copio-toolbar,.copio-controls-dock{display:flex;flex-direction:column;gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0)) 12px;background:var(--copio-color-surface);border-top:1px solid var(--copio-color-border);min-height:56px;flex-shrink:0;z-index:6}.copio-edit-toolbar,.copio-toolbar-tools{display:flex;flex-wrap:wrap;align-items:center;gap:4px;width:100%}.copio-toolbar-tools .copio-tool-btn{flex:1 1 0;min-width:0}.copio-toolbar-actions{display:flex;align-items:center;gap:8px;width:100%;flex-shrink:0}.copio-toolbar-actions .copio-btn-primary{width:100%}.copio-tool-btn{appearance:none;border:1px solid var(--copio-color-border);background:var(--copio-color-surface-elevated);color:var(--copio-color-text);font-family:inherit;font-size:11px;font-weight:600;min-height:var(--copio-touch-target-min);min-width:var(--copio-touch-target-min);padding:4px 6px;border-radius:var(--copio-radius-md);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;cursor:pointer;transition:all var(--copio-transition-fast)}.copio-tool-btn:hover:not(:disabled){border-color:var(--copio-color-border-strong);background:rgba(255,255,255,0.06)}.copio-tool-btn[aria-pressed="true"]{background:rgba(56,189,248,0.16);color:var(--copio-color-primary);border-color:var(--copio-color-primary)}.copio-tool-btn.danger{color:#fca5a5}.copio-tool-btn.danger:hover:not(:disabled){background:rgba(239,68,68,0.16);border-color:rgba(239,68,68,0.45)}.copio-toast-region{position:absolute;bottom:124px;left:12px;right:12px;z-index:30;display:flex;flex-direction:column;gap:8px;pointer-events:none}.copio-toast{pointer-events:auto;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px;border-radius:var(--copio-radius-md);background:#0f172a;color:#f8fafc;border:1px solid var(--copio-color-primary);box-shadow:var(--copio-shadow-elevated);font-size:12px;font-weight:500;position:relative;overflow:hidden;transition:opacity 200ms ease-out}.copio-toast-warning{border-color:#f59e0b;background:#1c1917;color:#fef3c7}.copio-toast-info{border-color:var(--copio-color-primary);background:#0f172a;color:#f8fafc}.copio-toast-fade-out{opacity:0}.copio-toast-progress{position:absolute;bottom:0;left:0;height:3px;background:var(--copio-color-primary);transition:width 100ms linear}.copio-toast-undo-btn,.copio-btn-toast-undo{appearance:none;border:1px solid rgba(56,189,248,0.45);background:rgba(56,189,248,0.16);color:#38bdf8;font-family:inherit;font-size:12px;font-weight:700;min-height:var(--copio-touch-target-min);min-width:var(--copio-touch-target-min);padding:0 12px;border-radius:var(--copio-radius-sm);cursor:pointer;flex-shrink:0}.copio-ocr-content{display:flex;flex-direction:column;gap:8px}.copio-ocr-text{margin:0;padding:10px;max-height:180px;overflow:auto;background:var(--copio-color-bg);color:var(--copio-color-text);border:1px solid var(--copio-color-border);border-radius:var(--copio-radius-sm);font-family:var(--copio-font-mono);font-size:11px;line-height:1.5;white-space:pre-wrap}.copio-ocr-meta{font-size:11px;color:var(--copio-color-text-muted)}.copio-ocr-sheet{position:absolute;inset:auto 0 0 0;max-height:78%;background:var(--copio-color-surface);border-top:1px solid var(--copio-color-primary);border-radius:16px 16px 0 0;box-shadow:0 -16px 40px rgba(0,0,0,0.65);z-index:25;display:flex;flex-direction:column;padding:14px;gap:10px}.copio-ocr-header{display:flex;align-items:center;justify-content:space-between;gap:8px}.copio-ocr-textarea{width:100%;min-height:130px;flex:1;resize:none;background:var(--copio-color-bg);color:var(--copio-color-text);border:1px solid var(--copio-color-border);border-radius:var(--copio-radius-sm);padding:10px;font-family:var(--copio-font-mono);font-size:11px;line-height:1.5}.sl-toast-stack,.copio-toast-stack-scoped{position:absolute !important;top:auto !important;bottom:0 !important;left:0 !important;right:0 !important;width:100% !important;max-width:100% !important;padding:var(--copio-spacing-md) !important;box-sizing:border-box !important;z-index:1000 !important;pointer-events:none}.sl-toast-stack sl-alert,.copio-toast-stack-scoped sl-alert{pointer-events:auto;margin-top:var(--copio-spacing-sm)}@container copio-scanner (max-width:400px){.copio-header{padding:6px 10px;min-height:52px}.copio-header-left{flex-direction:column;align-items:flex-start;gap:2px}.copio-mode-badge{font-size:10px;padding:2px 6px}.copio-subtitle{display:none}.copio-stage-canvas,.copio-canvas-viewport{min-height:120px;padding:12px}.copio-canvas-viewport.is-cropping{padding:20px}.copio-filmstrip,.copio-filmstrip-bar{gap:6px;padding:6px 8px;min-height:64px}.copio-toolbar,.copio-controls-dock{gap:6px;padding:8px 10px calc(8px + env(safe-area-inset-bottom,0)) 10px}.copio-tool-btn{font-size:10px;padding:3px 4px}.copio-btn{padding:0 8px;font-size:12px}}@container copio-scanner (min-width:401px) and (max-width:767px){.copio-header{padding:var(--copio-spacing-sm) var(--copio-spacing-md)}.copio-tool-btn{flex-direction:row;font-size:12px;gap:6px}}@container copio-scanner (min-width:768px){.copio-header{padding:var(--copio-spacing-md) var(--copio-spacing-lg)}.copio-workbench-main{flex-direction:row}.copio-filmstrip,.copio-filmstrip-bar{order:-1;flex-direction:column;width:168px;height:100%;border-top:none;border-right:1px solid var(--copio-color-border);overflow-y:auto;overflow-x:hidden;padding:12px}.copio-filmstrip-scroll{flex-direction:column;width:100%}.copio-thumb-container{width:112px;height:140px}.copio-toolbar,.copio-controls-dock{flex-direction:row;align-items:center;justify-content:space-between}.copio-toolbar-tools{width:auto;flex:1;gap:6px}.copio-toolbar-tools .copio-tool-btn{flex:1 1 56px;min-width:var(--copio-touch-target-min)}.copio-toolbar-actions{width:auto;min-width:200px}}.copio-handoff-pill{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;background:rgba(2,132,199,0.16);border:1px solid rgba(56,189,248,0.35);border-radius:var(--copio-radius-pill);font-size:11px;font-weight:600;color:var(--copio-color-text);backdrop-filter:blur(8px)}.copio-handoff-dot{width:8px;height:8px;border-radius:50%;background:var(--copio-color-warning);display:inline-block;flex-shrink:0}.copio-handoff-dot.connected{background:var(--copio-color-success);box-shadow:0 8px rgba(34,197,94,0.6)}.copio-handoff-dot.connecting,.copio-handoff-dot.reconnecting{background:var(--copio-color-warning);animation:copio-pulse 1.4s ease-in-out infinite}.copio-handoff-dot.disconnected,.copio-handoff-dot.error{background:var(--copio-color-danger)}.copio-handoff-retry-btn{appearance:none;border:none;background:var(--copio-color-surface-elevated);color:var(--copio-color-text);font-size:10px;font-weight:600;padding:2px 6px;border-radius:var(--copio-radius-sm);cursor:pointer}.copio-handoff-progress-view,.copio-handoff-confirm{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--copio-spacing-xl)}.copio-handoff-progress-view{z-index:50;background:var(--copio-color-surface-overlay,rgba(15,22,32,0.92));backdrop-filter:blur(12px)}.copio-handoff-confirm{z-index:60;background:var(--copio-color-bg)}.copio-handoff-progress-card,.copio-handoff-confirm-card{width:100%;max-width:340px;background:var(--copio-color-surface);border:1px solid var(--copio-color-border-strong);border-radius:var(--copio-radius-lg);padding:var(--copio-spacing-xl);display:flex;flex-direction:column;align-items:center;text-align:center;gap:var(--copio-spacing-md);box-shadow:var(--copio-shadow-elevated)}.copio-handoff-spinner{width:32px;height:32px;border:3px solid rgba(148,163,184,0.2);border-top-color:var(--copio-color-primary);border-radius:50%;animation:copio-spin 0.8s linear infinite}.copio-handoff-progress-title,.copio-handoff-confirm-title{font-size:16px;font-weight:700;color:var(--copio-color-text);margin:0}.copio-handoff-progress-track{width:100%;height:8px;background:var(--copio-color-surface-elevated);border-radius:var(--copio-radius-pill);overflow:hidden;border:1px solid var(--copio-color-border)}.copio-handoff-progress-bar{height:100%;background:linear-gradient(90deg,var(--copio-color-primary),#0284c7);border-radius:var(--copio-radius-pill);transition:width var(--copio-transition-fast)}.copio-handoff-progress-desc,.copio-handoff-confirm-subtitle{font-size:12px;color:var(--copio-color-text-muted);margin:0}.copio-handoff-confirm-icon{width:56px;height:56px;border-radius:50%;background:rgba(34,197,94,0.15);color:var(--copio-color-success);border:1px solid rgba(34,197,94,0.35);display:flex;align-items:center;justify-content:center}.copio-handoff-confirm-badge{display:inline-flex;align-items:center;padding:4px 12px;background:var(--copio-color-surface-elevated);border:1px solid var(--copio-color-border);border-radius:var(--copio-radius-pill);font-size:12px;font-weight:600;color:var(--copio-color-primary)}.copio-handoff-confirm-actions{width:100%;display:flex;flex-direction:column;gap:8px;margin-top:8px}`,L=null;function K(){if(L)return L;if(typeof CSSStyleSheet<"u"&&typeof Document<"u"&&"adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype)try{return L=new CSSStyleSheet,L.replaceSync(H),L}catch{return null}return null}function X(S){if(!S)return;let t=K();if(t&&"adoptedStyleSheets"in S){let e=S.adoptedStyleSheets||[];e.includes(t)||(S.adoptedStyleSheets=[...e,t])}else if(!S.querySelector("style[data-copio-encapsulated-styles]")){let e=document.createElement("style");e.setAttribute("data-copio-encapsulated-styles",""),e.textContent=H,S.appendChild(e)}}var J=typeof HTMLElement<"u"?HTMLElement:class{},q=class extends J{#t=null;#D=null;#R=null;#H=!1;#i="viewfinder";#e=0;#x=0;#P=!1;#n=!1;#g=null;#u=null;#L=0;#I=null;#q=null;#s=null;#O=!1;#h=null;#m=!0;#y="ml";#C=!0;#S=!1;#A=null;#M=!1;#Q=0;#l=null;#b=null;#T=0;#$=0;#w=0;#k=null;#r=null;#v=null;#o="idle";#N=[];#F=null;#j=0;onShutter=null;get#d(){return this.docId?this.docId:(this.#q||(this.#q=`doc_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,6)}`),this.#q)}static get observedAttributes(){return["mode","aspect","stage","doc-id","features","export-formats","ocr-languages","max-pages","asset-base","license-key","theme","ocr","pdf","handoff","relay-url","ice-servers","signaling-url","ice-transport-policy","edge-detection","edge-model","auto-crop","auto-capture"]}constructor(){super(),typeof this.attachShadow=="function"&&this.attachShadow({mode:"open"}),this.#ct()}#ct(){let t={storage:this.#D};if(typeof this.getAttribute=="function"){this.hasAttribute("features")&&(t.features=this.getAttribute("features")),this.hasAttribute("export-formats")&&(t.exportFormats=this.getAttribute("export-formats")),this.hasAttribute("ocr-languages")&&(t.ocrLanguages=this.getAttribute("ocr-languages")),this.hasAttribute("max-pages")&&(t.maxPages=this.getAttribute("max-pages")),this.hasAttribute("asset-base")&&(t.assetBase=this.getAttribute("asset-base")),this.hasAttribute("license-key")&&(t.licenseKey=this.getAttribute("license-key")),this.hasAttribute("ocr")&&(t.ocr=this.getAttribute("ocr")!=="false"),this.hasAttribute("pdf")&&(t.pdf=this.getAttribute("pdf")!=="false"),this.hasAttribute("edge-detection")&&(this.#m=this.getAttribute("edge-detection")!=="false"),this.hasAttribute("edge-model")&&(this.#y=this.getAttribute("edge-model")==="classical"?"classical":"ml"),this.hasAttribute("auto-crop")&&(this.#C=this.getAttribute("auto-crop")!=="false"),this.hasAttribute("auto-capture")&&(this.#S=this.getAttribute("auto-capture")!=="false"&&this.getAttribute("auto-capture")!==null);for(let e of["relay-url","signaling-url","ice-transport-policy"])this.hasAttribute(e)&&(t[e.replace(/-([a-z])/g,(o,i)=>i.toUpperCase())]=this.getAttribute(e));if(this.hasAttribute("ice-servers"))try{t.iceServers=JSON.parse(this.getAttribute("ice-servers"))}catch{t.iceServers=[{urls:this.getAttribute("ice-servers")}]}}this.#t=new z(t),this.#t.addEventListener(g.MIGRATION,e=>{this.dispatch(g.MIGRATION,e.detail)})}connectedCallback(){this.shadowRoot&&(X(this.shadowRoot),this.#dt()),typeof P=="function"&&typeof document<"u"&&D()===document.body&&P(this.shadowRoot?.querySelector(".copio-scanner-container")||this),typeof document<"u"&&document.addEventListener("visibilitychange",this.#G),typeof window<"u"&&window.addEventListener("pagehide",this.#K),this.#t&&(this.#t.init().catch(t=>{console.error("[CopioScanner] Engine initialization failed:",t)}),this.#R=this.#t.subscribe(async()=>{let t=await this.getPages();this.dispatch(g.PAGES_CHANGED,{pages:t,docId:this.docId}),this.#a()})),this.hasAttribute&&this.hasAttribute("asset-base")&&j(this.getAttribute("asset-base")),this.#B()&&this.#st().catch(t=>{console.warn("[CopioScanner] Handoff init error:",t)}),this.#E(),this.#a()}disconnectedCallback(){if(typeof document<"u"&&document.removeEventListener("visibilitychange",this.#G),typeof window<"u"&&window.removeEventListener("pagehide",this.#K),this.#W(),this.#f(),this.#h&&(this.#h.width=0,this.#h.height=0,this.#h=null),typeof this.#R=="function"&&(this.#R(),this.#R=null),this.#u&&(clearInterval(this.#u),this.#u=null),typeof P=="function"&&typeof document<"u"){let t=this.shadowRoot?.querySelector(".copio-scanner-container")||this;D()===t&&P(null)}}#G=()=>{typeof document<"u"&&document.visibilityState==="hidden"?this.#s&&(this.#O=!0,this.#f()):typeof document<"u"&&document.visibilityState==="visible"&&(this.#O&&this.#i==="viewfinder"&&(this.#O=!1,this.startCamera().catch(()=>{})),this.#B()&&this.#r&&!this.#r.isConnected&&this.#o!=="complete"&&this.reconnectHandoff().catch(()=>{}))};#K=()=>{this.#f()};attributeChangedCallback(t,e,o){if(!(e===o||!this.#t))switch(t){case"features":this.#t.setFeatures(o),this.#E();break;case"export-formats":this.#t.exportFormats=o,this.#E();break;case"ocr-languages":this.#t.ocrLanguages=o;break;case"asset-base":this.#t.assetBase=o;break;case"license-key":this.#t.licenseKey=o;break;case"ocr":this.#t.ocr=o!=="false",this.#E();break;case"pdf":this.#t.pdf=o!=="false",this.#E();break;case"relay-url":case"signaling-url":case"ice-transport-policy":this.#t&&(this.#t[t.replace(/-([a-z])/g,(i,r)=>r.toUpperCase())]=o);break;case"ice-servers":if(this.#t)try{this.#t.iceServers=JSON.parse(o)}catch{this.#t.iceServers=o?[{urls:o}]:null}break;case"stage":if(o==="viewfinder"||o==="workbench"){this.#i=o,o==="workbench"&&this.#f();let i=this.shadowRoot;if(i){let r=i.getElementById("viewfinder-section"),s=i.getElementById("workbench-section");r&&s&&(r.style.display=o==="viewfinder"?"flex":"none",s.style.display=o==="workbench"?"flex":"none")}this.#a()}break;case"max-pages":this.#t.maxPages=o,this.#a();break;case"mode":case"aspect":case"theme":this.#a();break;case"handoff":o&&o!=="false"?this.#st().catch(()=>{}):o==="false"&&this.#W();break;case"edge-detection":this.edgeDetection=o!=="false";break;case"edge-model":this.edgeModel=o==="classical"?"classical":"ml";break;case"auto-crop":this.autoCrop=o!=="false";break;case"auto-capture":this.autoCapture=o!=="false"&&o!==null;break}}#E(){if(typeof this.querySelectorAll!="function")return;let t=[];this.shadowRoot&&t.push(this.shadowRoot),t.push(this);for(let e of t){let o=e.querySelectorAll("copio-carousel, copio-row, copio-images");for(let i of o)"ocr"in i&&(i.ocr=this.ocrEnabled),"pdf"in i&&(i.pdf=this.pdf)}}#dt(){if(!this.shadowRoot||this.shadowRoot.innerHTML)return;let t="Align Document Inside Frame";this.aspect==="card"?t="Step 1 of 2: Capture Front of ID Card":this.mode==="batch"&&(t="Batch Capture \xB7 Page 1"),this.shadowRoot.innerHTML=`<div class="copio-scanner-container copio-scanner-host" part="scanner-root"><header class="copio-header" part="header"><div class="copio-header-left"><span class="copio-mode-badge" id="mode-badge">${(this.mode||"single").toUpperCase()}</span><div class="copio-title-group"><h2 class="copio-title" id="header-title">Copio Scanner</h2><p class="copio-subtitle" id="header-subtitle">Non-destructive mobile document scanner</p></div></div><div class="copio-header-actions" part="header-actions"><div class="copio-stage-tabs" role="tablist" aria-label="Scanner Stage"><button type="button" class="copio-stage-tab" id="tab-viewfinder" role="tab" aria-selected="true">Camera</button><button type="button" class="copio-stage-tab" id="tab-workbench" role="tab" aria-selected="false">Workbench</button></div><slot name="header-actions"></slot></div></header><div class="copio-viewfinder copio-viewfinder-stage" part="viewfinder" id="viewfinder-section"><div class="copio-viewfinder-hud-top"><div class="copio-step-pill" id="step-pill"><span class="copio-status-dot"></span><span id="step-pill-text">${t}</span></div><div class="copio-handoff-pill" id="handoff-pill" style="display:none;" title="Phone-to-Desktop Handoff"><span class="copio-handoff-dot" id="handoff-dot"></span><span class="copio-handoff-status-text" id="handoff-status-text">Paired with computer</span><button type="button" class="copio-handoff-retry-btn" id="btn-handoff-retry" style="display:none;" title="Retry connection">Retry</button></div><div class="copio-privacy-pill" title="100% Local On-Device Processing"><span>\u{1F512} 100% Local</span></div></div><div class="copio-camera-feed" id="camera-feed"><video id="camera-video" autoplay playsinline webkit-playsinline muted style="display:none; position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:0;"></video><svg class="copio-live-quad-overlay" id="live-quad-overlay" style="display:none;" aria-hidden="true"><polygon class="copio-live-quad-polygon" id="live-quad-polygon" points=""></polygon><circle class="copio-live-quad-corner" id="live-quad-c0" r="5"></circle><circle class="copio-live-quad-corner" id="live-quad-c1" r="5"></circle><circle class="copio-live-quad-corner" id="live-quad-c2" r="5"></circle><circle class="copio-live-quad-corner" id="live-quad-c3" r="5"></circle></svg><slot name="viewfinder"><div class="copio-framing-guide" id="framing-guide" data-aspect="${this.aspect}"><span class="copio-corner tl"></span><span class="copio-corner tr"></span><span class="copio-corner bl"></span><span class="copio-corner br"></span><div class="copio-edge-quad"></div><div class="copio-camera-placeholder"><svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg><span>Position document within guide lines</span></div></div></slot></div><div class="copio-shutter-dock" part="shutter-dock"><div class="copio-shutter-side left"><button type="button" class="copio-btn copio-btn-secondary" id="btn-import-file" title="Import image from file"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg><span>Import</span></button></div><slot name="shutter-dock"><button type="button" class="copio-shutter-btn" id="btn-shutter" aria-label="Capture page"><span class="copio-shutter-btn-inner"></span></button></slot><div class="copio-shutter-side right"><button type="button" class="copio-stack-pill" id="btn-review" title="Review pages" style="display:none;"><span id="review-pill-text">Review (0) \u2192</span></button></div></div></div><div class="copio-workbench copio-workbench-stage" part="workbench" id="workbench-section" style="display: none;"><div class="copio-workbench-main"><div class="copio-canvas-viewport" id="canvas-viewport"><div class="copio-card-side-switcher" id="card-side-switcher" style="display:none;" role="tablist" aria-label="Card side switcher"><button type="button" role="tab" class="copio-side-pill active" id="btn-card-front" aria-selected="true">1. Front Side</button><button type="button" role="tab" class="copio-side-pill" id="btn-card-back" aria-selected="false">2. Back Side</button></div><div class="copio-canvas-wrapper" id="canvas-wrapper"><img id="stage-img" class="copio-stage-image" alt="Active document page" /></div></div><div class="copio-filmstrip" id="filmstrip-tray" part="filmstrip"><div class="copio-filmstrip-scroll" id="filmstrip-scroll"><slot name="filmstrip"></slot></div></div></div><footer class="copio-toolbar" part="toolbar" id="workbench-toolbar"><div class="copio-toolbar-tools"><button type="button" class="copio-tool-btn" id="btn-retake" title="Retake page"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 4v6h-6M1 20v-6h6"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg><span>Retake</span></button><button type="button" class="copio-tool-btn" id="btn-crop" title="Adjust crop"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 2v14a2 2 0 0 0 2 2h14"/><path d="M18 22V8a2 2 0 0 0-2-2H2"/></svg><span id="crop-btn-label">Crop</span></button><button type="button" class="copio-tool-btn" id="btn-rotate" title="Rotate 90\xB0"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.67"/></svg><span>Rotate</span></button><button type="button" class="copio-tool-btn" id="btn-filter-bw" title="Toggle B&W filter"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 2a10 10 0 0 1 0 20z" fill="currentColor"/></svg><span>B&W</span></button><button type="button" class="copio-tool-btn" id="btn-ocr" title="Recognize text"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 7V4h16v3M9 20h6M12 4v16"/></svg><span>OCR</span></button><button type="button" class="copio-tool-btn copio-btn-danger" id="btn-delete" title="Delete active page"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg><span>Delete</span></button></div><div class="copio-toolbar-actions"><slot name="toolbar"><button type="button" class="copio-btn copio-btn-primary" id="btn-primary-complete"> \u2713 Use Photo </button></slot></div></footer><div class="copio-ocr-sheet" id="ocr-sheet" style="display:none;" part="ocr-sheet"><div class="copio-ocr-header"><strong class="copio-ocr-title">Text Recognition (OCR)</strong><button type="button" class="copio-btn copio-btn-secondary" id="btn-close-ocr">\u2715</button></div><div class="copio-ocr-body" id="ocr-body"><p class="copio-ocr-placeholder">Select text or extract full page data...</p></div></div><div class="copio-toast-region" id="toast-region" aria-live="polite"></div></div><div class="copio-handoff-progress-view" id="handoff-progress-view" style="display: none;" part="handoff-progress"><div class="copio-handoff-progress-card"><div class="copio-handoff-spinner"></div><h4 class="copio-handoff-progress-title" id="handoff-progress-title">Sending to your computer\u2026</h4><div class="copio-handoff-progress-track"><div class="copio-handoff-progress-bar" id="handoff-progress-bar" style="width: 0%;"></div></div><p class="copio-handoff-progress-desc" id="handoff-progress-desc">Encrypting and streaming pages\u2026</p></div></div><div class="copio-handoff-confirm" id="handoff-confirm-view" style="display: none;" part="handoff-confirm"><div class="copio-handoff-confirm-card"><div class="copio-handoff-confirm-icon"><svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M20 6L9 17l-5-5"/></svg></div><h3 class="copio-handoff-confirm-title">Sent to your computer</h3><p class="copio-handoff-confirm-subtitle">You can close this tab now.</p><div class="copio-handoff-confirm-badge" id="handoff-confirm-count">1 page transferred</div><div class="copio-handoff-confirm-actions"><button type="button" class="copio-btn copio-btn-secondary" id="btn-handoff-scan-more"> Scan More Documents </button></div></div></div><input type="file" id="internal-file-input" accept="image/*" style="display: none;" /><slot></slot></div>`,this.#lt()}#lt(){let t=this.shadowRoot;if(!t)return;t.getElementById("tab-viewfinder")?.addEventListener("click",()=>{this.stage="viewfinder"}),t.getElementById("tab-workbench")?.addEventListener("click",()=>{this.stage="workbench"});let e=t.getElementById("internal-file-input");t.getElementById("btn-import-file")?.addEventListener("click",()=>{e?.click()}),e?.addEventListener("change",async o=>{let i=o.target;i.files&&i.files.length>0&&(await this.addFiles(i.files),i.value="")}),t.getElementById("btn-shutter")?.addEventListener("click",async()=>{await this.#tt()}),t.getElementById("camera-feed")?.addEventListener("click",async o=>{o.target&&o.target.closest("button, input, a, select")||!this.#s&&this.#i==="viewfinder"&&await this.startCamera().catch(()=>{})}),t.getElementById("btn-review")?.addEventListener("click",()=>{this.stage="workbench"}),t.getElementById("btn-retake")?.addEventListener("click",()=>{this.#P=!0,this.#n=!1,this.stage="viewfinder"}),t.getElementById("btn-rotate")?.addEventListener("click",async()=>{await this.#et()}),t.getElementById("btn-filter-bw")?.addEventListener("click",async()=>{await this.#ot()}),t.getElementById("btn-crop")?.addEventListener("click",async()=>{await this.#U()}),t.getElementById("btn-delete")?.addEventListener("click",async()=>{await this.#it()}),t.getElementById("btn-ocr")?.addEventListener("click",async()=>{await this.#xt()}),t.getElementById("btn-close-ocr")?.addEventListener("click",()=>{this.#yt()}),t.getElementById("btn-primary-complete")?.addEventListener("click",async()=>{await this.#rt()}),t.getElementById("btn-handoff-retry")?.addEventListener("click",()=>{this.reconnectHandoff().catch(()=>{})}),t.getElementById("btn-handoff-scan-more")?.addEventListener("click",async()=>{await this.resetHandoff()}),t.getElementById("btn-card-front")?.addEventListener("click",()=>{this.#n=!1,this.#e=0,this.#a()}),t.getElementById("btn-card-back")?.addEventListener("click",()=>{this.#n=!1,this.#e=1,this.#a()}),this.#X()}#X(){let t=this.shadowRoot;if(!t)return;let e=t.getElementById("crop-quad-outline"),o=t.querySelectorAll(".copio-crop-handle");if(!e||o.length===0)return;let i=null,r=!1,s=0,n=0,a=null,c=(d,m)=>{let u=t.getElementById("crop-magnifier"),y=t.getElementById("stage-img");if(!u||!y||!y.complete||!y.naturalWidth)return;u.style.display="block",u.style.left=`${(d*100).toFixed(2)}%`,u.style.top=`${(m*100).toFixed(2)}%`,u.style.transform=m<.25?"translate(-50%, 35%)":"translate(-50%, -125%)";let f=u.getContext("2d");if(!f)return;let x=2,w=u.width,b=u.height,v=y.naturalWidth,I=y.naturalHeight,A=w/x,M=b/x,F=d*v,E=m*I;f.clearRect(0,0,w,b),f.fillStyle="#0b0f17",f.fillRect(0,0,w,b),f.drawImage(y,F-A/2,E-M/2,A,M,0,0,w,b),f.strokeStyle="rgba(56, 189, 248, 0.9)",f.lineWidth=1.5,f.beginPath(),f.moveTo(w/2-10,b/2),f.lineTo(w/2+10,b/2),f.moveTo(w/2,b/2-10),f.lineTo(w/2,b/2+10),f.stroke()},l=()=>{let d=t.getElementById("crop-magnifier");d&&(d.style.display="none")},p=d=>{let m=d.target.closest(".copio-crop-handle");if(m)i=m.getAttribute("data-corner"),r=!1;else if(d.target===e)i=null,r=!0;else return;d.preventDefault(),d.stopPropagation(),s=d.clientX,n=d.clientY,a=this.#g?C(this.#g):{topLeft:{x:.05,y:.05},topRight:{x:.95,y:.05},bottomRight:{x:.95,y:.95},bottomLeft:{x:.05,y:.95}},i&&a[i]&&c(a[i].x,a[i].y),window.addEventListener("pointermove",k),window.addEventListener("pointerup",h)},k=d=>{if(!i&&!r||!a)return;let u=(t.getElementById("canvas-wrapper")||t.getElementById("canvas-viewport"))?.getBoundingClientRect()||{width:300,height:400},y=(d.clientX-s)/Math.max(u.width,1),f=(d.clientY-n)/Math.max(u.height,1),x=C(a),w=["topLeft","topRight","bottomRight","bottomLeft"];if(r){let b=-1/0,v=1/0,I=-1/0,A=1/0;for(let E of w)b=Math.max(b,-a[E].x),v=Math.min(v,1-a[E].x),I=Math.max(I,-a[E].y),A=Math.min(A,1-a[E].y);let M=Math.min(Math.max(y,b),v),F=Math.min(Math.max(f,I),A);for(let E of w)x[E].x=a[E].x+M,x[E].y=a[E].y+F}else if(i&&x[i]){let b=Math.min(Math.max(0,a[i].x+y),1),v=Math.min(Math.max(0,a[i].y+f),1);x[i].x=b,x[i].y=v,c(b,v)}this.#g=x,this.#J()},h=()=>{i=null,r=!1,a=null,l(),window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",h)};e.addEventListener("pointerdown",p),o.forEach(d=>{d.addEventListener("pointerdown",p)})}#J(){let t=this.shadowRoot;if(!t||!this.#g)return;let{topLeft:e,topRight:o,bottomRight:i,bottomLeft:r}=this.#g,s=h=>`${(h.x*100).toFixed(2)},${(h.y*100).toFixed(2)}`,n=`${s(e)} ${s(o)} ${s(i)} ${s(r)}`,a=t.getElementById("crop-quad-mask");a&&a.setAttribute("d",`M0,0 H100 V100 H0 Z M${(e.x*100).toFixed(2)},${(e.y*100).toFixed(2)} L${(o.x*100).toFixed(2)},${(o.y*100).toFixed(2)} L${(i.x*100).toFixed(2)},${(i.y*100).toFixed(2)} L${(r.x*100).toFixed(2)},${(r.y*100).toFixed(2)} Z`);let c=t.getElementById("crop-quad-outline");c&&c.setAttribute("points",n);let l=(h,d,m)=>({x:h.x+(d.x-h.x)*m,y:h.y+(d.y-h.y)*m}),p=(h,d,m)=>{let u=t.getElementById(h);u&&(u.setAttribute("x1",(d.x*100).toFixed(2)),u.setAttribute("y1",(d.y*100).toFixed(2)),u.setAttribute("x2",(m.x*100).toFixed(2)),u.setAttribute("y2",(m.y*100).toFixed(2)))};p("crop-grid-v1",l(e,o,1/3),l(r,i,1/3)),p("crop-grid-v2",l(e,o,2/3),l(r,i,2/3)),p("crop-grid-h1",l(e,r,1/3),l(o,i,1/3)),p("crop-grid-h2",l(e,r,2/3),l(o,i,2/3));let k={topLeft:e,topRight:o,bottomRight:i,bottomLeft:r};for(let[h,d]of Object.entries(k)){let m=t.querySelector(`.copio-quad-handle[data-corner="${h}"]`);m&&(m.style.left=`${(d.x*100).toFixed(2)}%`,m.style.top=`${(d.y*100).toFixed(2)}%`)}}async#a(){if(this.shadowRoot)return this.#I?this.#I:(this.#I=(async()=>{try{await Promise.resolve(),await this.#pt()}finally{this.#I=null}})(),this.#I)}async#pt(){if(this.shadowRoot)try{let t=await this.getPages();this.#x=t.length;let e=this.shadowRoot,o=e.getElementById("mode-badge");o&&(o.textContent=(this.mode||"single").toUpperCase());let i=e.getElementById("tab-viewfinder"),r=e.getElementById("tab-workbench");i&&i.setAttribute("aria-selected",String(this.#i==="viewfinder")),r&&r.setAttribute("aria-selected",String(this.#i==="workbench"));let s=e.getElementById("viewfinder-section"),n=e.getElementById("workbench-section");s&&n&&(this.#i==="viewfinder"?(s.style.display="flex",n.style.display="none"):(s.style.display="none",n.style.display="flex"));let a=e.getElementById("framing-guide");a&&a.setAttribute("data-aspect",this.aspect||"auto");let c=e.getElementById("step-pill-text");c&&(this.#s?c.textContent=this.mode==="batch"?`Batch Capture \xB7 Page ${t.length+1}`:"Camera Active \xB7 Tap Shutter to Snap":this.aspect==="card"&&this.maxPages===2?c.textContent=t.length===0?"Step 1 of 2: Capture Front of ID Card":"Step 2 of 2: Capture Back of ID Card":this.aspect==="card"?c.textContent="Align Card Inside Frame":this.mode==="batch"?c.textContent=`Batch Capture \xB7 Page ${t.length+1}`:c.textContent="Align Document Inside Frame");let l=e.getElementById("btn-ocr");l&&(l.style.display=this.ocrEnabled&&this.hasFeature("ocr")?"":"none");let p=e.getElementById("btn-review"),k=e.getElementById("review-pill-text");if(p&&k&&(t.length>0?(p.style.display="inline-flex",k.textContent=`Review (${t.length}) \u2192`):p.style.display="none"),t.length===0){this.#i==="workbench"&&(this.stage="viewfinder");return}this.#e>=t.length&&(this.#e=Math.max(0,t.length-1));let h=t[this.#e],d=e.getElementById("card-side-switcher");if(d){let w=this.aspect==="card"&&this.maxPages===2;d.style.display=w?"flex":"none";let b=e.getElementById("btn-card-front"),v=e.getElementById("btn-card-back");b&&(b.classList.toggle("active",this.#e===0),b.setAttribute("aria-selected",String(this.#e===0))),v&&(v.classList.toggle("active",this.#e===1),v.setAttribute("aria-selected",String(this.#e===1)))}let m=e.getElementById("canvas-viewport");m&&m.classList.toggle("is-cropping",this.#n);let u=e.getElementById("stage-img");if(u)if(this.#n){let w=h.edits?.rotate||0,b=h.edits?.filter||"none",v=h.originalSrc||h.src||"";if(w!==0||b!=="none"){let I=this.#t?await this.#t.renderEdits(v,{rotate:w,filter:b}):v;u.src=I||v}else u.src=v}else u.src=h.src||h.originalSrc||"";let y=e.getElementById("crop-layer");if(this.#n){if(!y){let v=e.getElementById("canvas-wrapper");y=document.createElement("div"),y.className="copio-crop-layer",y.id="crop-layer",y.innerHTML='<svg class="copio-crop-quad-svg" id="crop-quad-svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path class="copio-crop-mask" id="crop-quad-mask" fill-rule="evenodd" d=""></path><line class="copio-crop-quad-grid" id="crop-grid-v1"></line><line class="copio-crop-quad-grid" id="crop-grid-v2"></line><line class="copio-crop-quad-grid" id="crop-grid-h1"></line><line class="copio-crop-quad-grid" id="crop-grid-h2"></line><polygon class="copio-crop-quad-outline" id="crop-quad-outline" points=""></polygon></svg><span class="copio-crop-handle copio-quad-handle" data-corner="topLeft" data-handle="nw"></span><span class="copio-crop-handle copio-quad-handle" data-corner="topRight" data-handle="ne"></span><span class="copio-crop-handle copio-quad-handle" data-corner="bottomRight" data-handle="se"></span><span class="copio-crop-handle copio-quad-handle" data-corner="bottomLeft" data-handle="sw"></span><canvas class="copio-crop-magnifier" id="crop-magnifier" width="96" height="96"></canvas>',v?.appendChild(y),this.#X()}y.style.display="block";let w=h.edits?.rotate||0,b=h.edits?.quad||(h.edits?.crop?O(h.edits.crop):null)||{topLeft:{x:.05,y:.05},topRight:{x:.95,y:.05},bottomRight:{x:.95,y:.95},bottomLeft:{x:.05,y:.95}};this.#g=$(b,w),this.#J()}else y&&y.remove();let f=e.getElementById("crop-btn-label");f&&(f.textContent=this.#n?"Apply":"Crop");let x=e.getElementById("btn-primary-complete");x&&(this.isHandoff?this.aspect==="card"&&this.maxPages===2&&t.length===1?x.textContent="Next: Capture Back (Step 2/2) \u2192":this.aspect==="card"&&t.length>=2?x.textContent="\u2191 Send ID Card to Computer (2 Sides)":this.mode==="batch"?x.textContent=`\u2191 Send ${t.length} Pages to Computer`:x.textContent="\u2191 Send to Computer":this.aspect==="card"&&this.maxPages===2&&t.length===1?x.textContent="Next: Capture Back (Step 2/2) \u2192":this.aspect==="card"&&t.length>=2?x.textContent="\u2713 Complete ID Scan (2 Sides)":this.mode==="batch"?x.textContent=`\u2713 Complete Scan (${t.length} Pages)`:x.textContent="\u2713 Use Photo"),this.#p(),this.#ht(t)}catch{}}#ht(t){let e=this.shadowRoot;if(!e)return;let o=e.getElementById("filmstrip-scroll");o&&(o.innerHTML="",t.forEach((i,r)=>{let s=document.createElement("div");s.className=`copio-filmstrip-item ${r===this.#e?"is-active":""}`,s.setAttribute("data-index",String(r)),s.innerHTML=`<div class="copio-thumb-container"><img src="${i.src||i.originalSrc}" alt="Page ${r+1}" class="copio-thumb-img" /><span class="copio-thumb-num">${r+1}</span></div> ${this.mode==="batch"?` <div class="copio-thumb-reorder"><button type="button" class="copio-reorder-btn move-left" title="Move Left" ${r===0?"disabled":""}>\u25C0</button><button type="button" class="copio-reorder-btn move-right" title="Move Right" ${r===t.length-1?"disabled":""}>\u25B6</button></div> `:""}`,s.querySelector(".copio-thumb-container")?.addEventListener("click",()=>{this.#e=r,this.#n=!1,this.#a()}),this.mode==="batch"&&(s.querySelector(".move-left")?.addEventListener("click",async n=>{n.stopPropagation(),await this.#Y(r,r-1)}),s.querySelector(".move-right")?.addEventListener("click",async n=>{n.stopPropagation(),await this.#Y(r,r+1)})),o.appendChild(s)}))}async#Y(t,e){let o=await this.getPages();if(e<0||e>=o.length||t===e)return;let i=o.map(s=>s.id),[r]=i.splice(t,1);i.splice(e,0,r),await this.#t.reorderPages(this.#d,i),this.#e=e,this.#a()}#ft(t,e="warning",o=4e3){try{if(typeof B<"u"){let n=this.shadowRoot?.querySelector(".copio-scanner-container")||this;e==="warning"&&typeof B.warning=="function"?B.warning(t,{container:n}):typeof B.info=="function"&&B.info(t,{container:n})}}catch{}let r=this.shadowRoot?.getElementById("toast-region");if(!r)return;let s=document.createElement("div");s.className=`copio-toast copio-toast-${e}`,s.setAttribute("role","alert"),s.innerHTML=`<span class="copio-toast-msg">${t}</span>`,r.appendChild(s),setTimeout(()=>{s.classList.add("copio-toast-fade-out"),setTimeout(()=>{s.remove()},250)},o)}#Z(t,e){let i=t?.name==="NotAllowedError"||t?.name==="PermissionDeniedError"?"CAMERA_PERMISSION_DENIED":"CAMERA_UNAVAILABLE";this.#ft(e,"warning");let r=this.shadowRoot?.getElementById("step-pill-text");r&&(r.textContent="Camera Unavailable \xB7 Select File"),this.dispatch(g.ERROR,{code:i,message:e,error:t});let s=this.shadowRoot?.getElementById("internal-file-input");s&&typeof s.click=="function"&&s.click()}#f(){if(this.#z(),this.#_(),this.#s){try{let r=this.#s.getTracks();for(let s of r)s.stop()}catch{}this.#s=null}let t=this.shadowRoot,e=t?.getElementById("camera-video");if(e){try{e.pause()}catch{}e.srcObject=null,e.style.display="none"}let o=t?.querySelector(".copio-camera-placeholder");o&&(o.style.display="");let i=t?.getElementById("step-pill-text");i&&this.#i==="viewfinder"&&(i.textContent=this.mode==="batch"?`Batch Capture \xB7 Page ${this.#x+1}`:"Align Document Inside Frame")}async startCamera(t={}){if(!this.shadowRoot?.getElementById("camera-video"))return null;if(this.#s)return this.#s;if(typeof window<"u"&&window.__WTR_CONFIG__!==void 0&&typeof navigator<"u"&&navigator.webdriver===!0&&!t.force)return null;if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia)return this.#Z(new Error("NO_CAMERA_SUPPORT"),"No camera found. Choose a photo from your files instead."),null;let r=[{video:{facingMode:{ideal:"environment"},width:{ideal:1280},height:{ideal:720}},audio:!1},{video:{facingMode:{ideal:"environment"}},audio:!1},{video:{width:{ideal:1280}},audio:!1},{video:!0,audio:!1}],s=null,n=null;for(let a of r)try{if(s=await navigator.mediaDevices.getUserMedia(a),s)break}catch(c){if(n=c,c.name==="NotAllowedError"||c.name==="PermissionDeniedError")break}if(!s){let c=n?.name==="NotAllowedError"||n?.name==="PermissionDeniedError"?"Camera permission denied. Choose a photo from your files instead.":"Camera unavailable. Choose a photo from your files instead.";return this.#Z(n||new Error("CAMERA_UNAVAILABLE"),c),null}return this.setCameraStream(s),s}stopCamera(){this.#f()}_grabFrame(t={}){let o=this.shadowRoot?.getElementById("camera-video");if(!this.#s||!o)return null;let i=o.videoWidth||640,r=o.videoHeight||480;if(i===0||r===0)return null;let s=t.maxWidth||640,n=t.maxHeight||480,a=Math.min(1,s/i,n/r),c=Math.max(1,Math.round(i*a)),l=Math.max(1,Math.round(r*a));if(!this.#h&&typeof document<"u"&&(this.#h=document.createElement("canvas")),!this.#h)return null;this.#h.width=c,this.#h.height=l;let p=this.#h.getContext("2d",{willReadFrequently:!0});if(!p)return null;try{p.drawImage(o,0,0,c,l)}catch{p.fillStyle="#334155",p.fillRect(0,0,c,l)}return t.format==="canvas"?this.#h:p.getImageData(0,0,c,l)}_isCameraActive(){return!!this.#s}#V(){if(this.#z(),!this.#m||!this.#s||this.#i!=="viewfinder")return;let t=async e=>{if(!this.#s||this.#i!=="viewfinder"||!this.#m){this.#z();return}let o=e-this.#Q;!this.#M&&o>=100&&(this.#Q=e,await this.#ut(e)),this.#s&&this.#i==="viewfinder"&&this.#m&&(this.#A=requestAnimationFrame(t))};this.#A=requestAnimationFrame(t)}#z(){this.#A!==null&&(cancelAnimationFrame(this.#A),this.#A=null),this.#M=!1}#_(){let t=this.shadowRoot,e=t?.getElementById("live-quad-overlay");e&&(e.style.display="none");let o=t?.getElementById("camera-feed");o&&o.classList.remove("is-detected","is-tracking");let i=t?.getElementById("live-quad-polygon");i&&i.setAttribute("points","");for(let r=0;r<4;r++){let s=t?.getElementById(`live-quad-c${r}`);s&&(s.removeAttribute("cx"),s.removeAttribute("cy"))}this.#l=null,this.#b=null,this.#T=0,this.#$=0,this.#w=0,this.#k=null}#gt(t,e){let o=this.shadowRoot,i=o?.getElementById("live-quad-overlay"),r=o?.getElementById("camera-feed"),s=o?.getElementById("camera-video");if(!i||!r||!t)return;let n=r.clientWidth,a=r.clientHeight;if(n<=0||a<=0)return;let c=s?.videoWidth||640,l=s?.videoHeight||480,p=Math.max(n/c,a/l),k=c*p,h=l*p,d=(n-k)/2,m=(a-h)/2,u=[t.topLeft,t.topRight,t.bottomRight,t.bottomLeft],y=u.map(f=>`${(d+f.x*k).toFixed(1)},${(m+f.y*h).toFixed(1)}`);i.setAttribute("viewBox",`0 0 ${n} ${a}`),i.style.display="block",o.getElementById("live-quad-polygon")?.setAttribute("points",y.join(" "));for(let f=0;f<4;f++){let x=o.getElementById(`live-quad-c${f}`);x&&(x.setAttribute("cx",(d+u[f].x*k).toFixed(1)),x.setAttribute("cy",(m+u[f].y*h).toFixed(1)))}r.classList.add("is-tracking"),r.classList.toggle("is-detected",e>=.7)}async#ut(t){let o=this.shadowRoot?.getElementById("camera-video");if(!o||o.videoWidth===0||o.videoHeight===0)return;let i=this._grabFrame({maxWidth:480,maxHeight:480});if(i){this.#M=!0;try{let r=this.#t?.getService("edge")||T("edge");if(!r||typeof r.detect!="function")return;let s=this.#y==="ml"?.4:.45,n=await r.detect(i,{maxProcessingDimension:480,enableDetectionCascade:!1,minConfidence:s,fallbackOnLowConfidence:!1,detector:this.#y,ml:{minScore:s}});if(!this.#s||this.#i!=="viewfinder"||!this.#m)return;if(n&&n.quad&&n.confidence>=s&&!n.isFallback){this.#T=0,this.#$=t;let a=.35;if(!this.#l)this.#l=C(n.quad);else for(let c of["topLeft","topRight","bottomRight","bottomLeft"])this.#l[c].x=a*n.quad[c].x+(1-a)*this.#l[c].x,this.#l[c].y=a*n.quad[c].y+(1-a)*this.#l[c].y;this.#b={quad:C(this.#l),confidence:n.confidence,durationMs:n.durationMs,isFallback:!1},this.#gt(this.#l,n.confidence),this.dispatch(g.EDGE_DETECTED,{quad:C(this.#l),confidence:n.confidence,durationMs:n.durationMs}),this.#S&&n.confidence>=.65&&this.#mt(this.#l,t)}else this.#T++,this.#T>4&&t-this.#$>1200&&(this.#l=null,this.#b=null,this.#w=0,this.#_())}catch(r){typeof console<"u"&&console.warn&&console.warn("[CopioScanner] Live edge detection error:",r)}finally{this.#M=!1}}}#mt(t,e){if(!this.#S||!t)return;let o=[t.topLeft,t.topRight,t.bottomRight,t.bottomLeft],i=0;for(let n=0;n<4;n++){let a=(n+1)%4;i+=o[n].x*o[a].y-o[a].x*o[n].y}if(i=Math.abs(i)/2,i<.15){this.#w=0,this.#k=null;return}if(!this.#k){this.#k=C(t),this.#w=e;return}let r=0;for(let n of["topLeft","topRight","bottomRight","bottomLeft"]){let a=t[n].x-this.#k[n].x,c=t[n].y-this.#k[n].y;r+=a*a+c*c}let s=Math.sqrt(r/4);this.#k=C(t),s<.015?e-this.#w>=600&&(this.#w=e+1e4,this.#tt()):this.#w=e}async#tt(){if(typeof this.onShutter=="function"&&await this.onShutter()!==!1)return;let t=this.shadowRoot,e=t?.getElementById("camera-video");if(this.#s&&e){let r=t?.getElementById("camera-feed");r&&(r.classList.remove("is-shutter-flash"),r.offsetWidth,r.classList.add("is-shutter-flash"));let s=this.#y==="ml"?.4:.45,n=this.#b?.confidence>=s?C(this.#b.quad):null,a=document.createElement("canvas");a.width=e.videoWidth||1280,a.height=e.videoHeight||720;let c=a.getContext("2d");if(c){try{c.drawImage(e,0,0,a.width,a.height)}catch{c.fillStyle="#334155",c.fillRect(0,0,a.width,a.height)}let l=await new Promise(p=>a.toBlob(p,"image/jpeg",.92));if(a.width=0,a.height=0,l){let p=this.mode==="batch";p||this.#f();let k=new File([l],`capture_${Date.now()}.jpg`,{type:"image/jpeg"});await this.addFiles([k],{prefilledQuad:n}),!p&&n&&this.#C&&this.features.includes("crop")&&(this.#n=!0,await this.#a()),p&&this.maxPages>0&&this.#x>=this.maxPages&&(this.#f(),this.stage="workbench");return}}}if(await this.startCamera())return;let i=t?.getElementById("internal-file-input");i&&typeof i.click=="function"&&i.click()}async#et(){let e=(await this.getPages())[this.#e];if(!e)return;this.#n&&(this.#n=!1,this.#g=null);let i=((e.edits?.rotate||0)+90)%360;await this.#t.applyEdit(this.#d,e.id,{rotate:i}),await this.#a()}async#ot(){let e=(await this.getPages())[this.#e];if(!e)return;this.#n&&(this.#n=!1,this.#g=null);let i=(e.edits?.filter||"none")==="bw"?"none":"bw";await this.#t.applyEdit(this.#d,e.id,{filter:i}),await this.#a()}async#U(){let e=(await this.getPages())[this.#e];if(e){if(this.#n){this.#n=!1;let o=this.#g;if(this.#g=null,o){let i=e.edits?.rotate||0,r=N(o,i),s=U(r);await this.#t.applyEdit(this.#d,e.id,{quad:r,crop:s})}}else this.#n=!0;await this.#a()}}async#it(){let t=await this.getPages(),e=t[this.#e];if(!e)return;let o=e.id;await this.#t.deletePage(this.#d,o),this.dispatch(g.PAGE_REMOVED,{pageId:o,docId:this.docId}),this.#e>=t.length-1&&(this.#e=Math.max(0,t.length-2)),this.#bt(),await this.#a()}#bt(){let t=this.shadowRoot;if(!t)return;let e=t.getElementById("toast-region");if(!e)return;this.#u&&clearInterval(this.#u),this.#L=5;let o=()=>{e.innerHTML=`<div class="copio-toast copio-toast-undo"><span>Page deleted</span><button type="button" class="copio-btn-toast-undo" id="btn-toast-undo"> Undo (${this.#L}s) </button></div>`,t.getElementById("btn-toast-undo")?.addEventListener("click",async()=>{clearInterval(this.#u),this.#u=null,e.innerHTML="",await this.#t.undo(this.#d),await this.#a()})};o(),this.#u=setInterval(()=>{this.#L-=1,this.#L<=0?(clearInterval(this.#u),this.#u=null,e.innerHTML=""):o()},1e3)}async#xt(){let t=this.shadowRoot;if(!t)return;let e=t.getElementById("ocr-sheet"),o=t.getElementById("ocr-body");if(!(!e||!o)){e.style.display="block",o.innerHTML='<p class="copio-ocr-loading">Recognizing text...</p>';try{let r=(await this.getPages())[this.#e],s=await this.ocr(r?.id||null),n=s.averageConfidence||0,a=n<=1&&n>0?Math.round(n*100):Math.round(n);o.innerHTML=`<div class="copio-ocr-content"><pre class="copio-ocr-text">${s.text||"No text detected."}</pre><div class="copio-ocr-meta"><span>Confidence: ${a}%</span></div></div>`}catch(i){o.innerHTML=`<p class="copio-ocr-error">OCR recognition failed: ${i.message}</p>`}}}#yt(){let t=this.shadowRoot;if(!t)return;let e=t.getElementById("ocr-sheet");e&&(e.style.display="none")}async#rt(){if(this.#n&&await this.#U(),this.aspect==="card"&&this.maxPages===2&&this.#x===1){this.stage="viewfinder";return}let t=await this.getPages();if(this.aspect==="card"&&this.maxPages===2&&t.length===1){this.stage="viewfinder";return}let e=t.map((i,r)=>({id:i.id,pageNumber:r+1,label:i.label||`Page ${r+1}`,originalSrc:i.originalSrc,src:i.src,originalPreserved:!0,dimensions:{width:i.width||0,height:i.height||0},edits:i.edits||{crop:{x:0,y:0,w:1,h:1},rotate:0,filter:"none"},ocrText:i.ocrText||null,blob:i.blob||null})),o={mode:this.mode,aspect:this.aspect,docId:this.docId,pageCount:e.length,pages:e};if(this.mode==="single"&&(o.page=e[0]||null,this.maxPages>1&&(o.maxPages=this.maxPages)),this.isHandoff&&this.#r){await this.#wt(e,o);return}this.dispatch(g.SCAN_COMPLETE,o)}async completeScan(){return this.#rt()}get handoff(){return typeof this.getAttribute=="function"?this.getAttribute("handoff"):null}set handoff(t){typeof this.setAttribute=="function"&&(t!=null&&(typeof t!="boolean"||t===!0)?this.setAttribute("handoff",typeof t=="string"?t:""):this.removeAttribute("handoff"))}get isHandoff(){return this.#B()}get handoffSession(){return this.#r}get handoffState(){return this.#o}get handoffProgress(){return this.#F}get handoffRetryCount(){return this.#j}attachHandoffSession(t,e=null){this.#W(),this.#r=t,this.#v=e||t?.token||null,this.#nt(t),this.#o=t.isConnected?"connected":t.state==="idle"?"connecting":t.state,this.#p()}async reconnectHandoff(){if(!(!this.#r||!this.#v)&&!(this.#o==="complete"||this.#o==="connecting")){this.#j++,this.#o="reconnecting",this.#p();try{if(R.has(this.#v.peerId)){let t=R.createLinkedSender(this.#v.peerId);await this.#r.reconnect(t)}else await this.#r.reconnect()}catch(t){console.warn("[CopioScanner] Handoff reconnect failed:",t),this.#o="disconnected",this.#p(t?.message||"Reconnection failed")}}}async resetHandoff(){this.#o=this.#r?.isConnected?"connected":"idle",this.#F=null;let t=this.shadowRoot;if(t){let e=t.getElementById("handoff-confirm-view");e&&(e.style.display="none");let o=t.getElementById("handoff-progress-view");o&&(o.style.display="none")}await this.clear(),this.stage="viewfinder",this.#p()}#B(){return this.#r?!0:typeof this.hasAttribute=="function"&&this.hasAttribute("handoff")?this.getAttribute("handoff")!=="false":typeof window<"u"&&window.location?.hash?/(?:copio-)?handoff=/.test(window.location.hash):!1}async#st(){if(this.#r||!this.#B())return;let t=typeof this.getAttribute=="function"?this.getAttribute("handoff"):null;if(!t&&typeof window<"u"&&window.location?.hash&&(t=window.location.hash),!!t)try{let e=typeof t=="string"&&t.includes("#")?Q(t):W(t);this.#v=e,this.#o="connecting",this.#p();let o=null;if(R.has(e.peerId))o=R.createLinkedSender(e.peerId);else try{let{HandoffPeerTransport:r}=await import("./handoff-transport-7YFK4RYL.js");o=new r({role:"sender",targetPeerId:e.peerId,relayUrl:e.relayUrl||this.relayUrl,signalingUrl:e.signalingUrl||this.signalingUrl,iceServers:e.iceServers||this.iceServers,iceTransportPolicy:this.iceTransportPolicy})}catch{o=new R}let i=new G({role:"sender",transport:o});this.#r=i,this.#nt(i),await i.startSender(e)}catch(e){console.warn("[CopioScanner] Handoff sender init failed:",e),this.#o="error",this.#p(e?.message||"Connection error")}}#nt(t){this.#N.push(t.on("stateChange",e=>{e==="closed"?this.#o="disconnected":this.#o=e,e==="connected"&&(this.#j=0,this.dispatch(g.HANDOFF_CONNECTED,{sessionId:this.#v?.sessionId||"",peerId:this.#v?.peerId||""})),this.#p()}),t.on("connectionInfo",e=>{this.dispatch(g.CONNECTION_INFO,e)}),t.on("progress",e=>{this.#F=e,this.#vt(e)}),t.on("complete",()=>{this.#o="complete",this.#p()}),t.on("error",e=>{console.warn("[CopioScanner] Handoff session error:",e),this.#o="error",this.#p(e?.message||"Connection error")}))}#W(){for(let t of this.#N)try{t()}catch{}if(this.#N=[],this.#r){try{this.#r.close()}catch{}this.#r=null}this.#v=null,this.#o="idle",this.#F=null}#p(t=""){let e=this.shadowRoot;if(!e)return;let o=e.getElementById("handoff-pill"),i=e.getElementById("handoff-dot"),r=e.getElementById("handoff-status-text"),s=e.getElementById("btn-handoff-retry");if(!o||!i||!r)return;if(!this.#B()){o.style.display="none";return}o.style.display="inline-flex",i.className=`copio-handoff-dot ${this.#o}`;let n={connecting:"Connecting to computer\u2026",connected:"Paired with computer",reconnecting:"Reconnecting to computer\u2026",disconnected:"Disconnected",sending:"Sending to computer\u2026",complete:"Sent to computer \u2713",error:t||"Connection error"};r.textContent=n[this.#o]||"Desktop Handoff",s&&(s.style.display=this.#o==="disconnected"||this.#o==="error"?"inline-block":"none")}#vt(t){let e=this.shadowRoot;if(!e||!t)return;let o=e.getElementById("handoff-progress-bar"),i=e.getElementById("handoff-progress-desc");if(o&&typeof t.percent=="number"&&(o.style.width=`${t.percent}%`),i&&t.bytesSent&&t.totalBytes){let r=Math.round(t.bytesSent/1024),s=Math.round(t.totalBytes/1024);i.textContent=`Streaming chunks: ${r} KB / ${s} KB (${t.percent}%)`}}async#wt(t,e){let o=this.shadowRoot,i=o?.getElementById("handoff-progress-view"),r=o?.getElementById("handoff-progress-bar"),s=o?.getElementById("handoff-progress-title"),n=o?.getElementById("handoff-progress-desc");i&&(i.style.display="flex"),this.#o="sending",this.#p();try{for(let l=0;l<t.length;l++){let p=t[l];s&&(s.textContent=t.length>1?`Sending page ${l+1} of ${t.length}\u2026`:"Sending page to computer\u2026"),n&&(n.textContent="Encrypting with AES-GCM-256\u2026");let k=await this.#kt(p),h=!1,d=0;for(;!h&&d<3;)try{this.#r.isConnected||(await this.reconnectHandoff(),await this.#at(6e3)),await this.#r.sendPage({id:p.id,pageIndex:l,mimeType:k.type||"image/jpeg",blob:k,metadata:{width:p.dimensions?.width,height:p.dimensions?.height,label:p.label}}),h=!0}catch(m){if(d++,d>=3)throw m;await this.reconnectHandoff(),await this.#at(6e3)}}s&&(s.textContent="Finalizing scan session\u2026"),r&&(r.style.width="100%"),await this.#r.complete({docId:e.docId,summary:{mode:e.mode,aspect:e.aspect,pageCount:t.length}}),this.#o="complete",i&&(i.style.display="none");let a=o?.getElementById("handoff-confirm-view"),c=o?.getElementById("handoff-confirm-count");a&&(a.style.display="flex"),c&&(c.textContent=`${t.length} page${t.length===1?"":"s"} transferred to desktop`),this.#p(),this.dispatch(g.SCAN_COMPLETE,e)}catch(a){console.error("[CopioScanner] Handoff streaming error:",a),i&&(i.style.display="none"),this.#o="error",this.#p(a.message),this.dispatch(g.ERROR,{code:"HANDOFF_STREAMING_FAILED",message:a.message,error:a})}}async#at(t=6e3){if(!this.#r?.isConnected)return new Promise((e,o)=>{let i=setTimeout(()=>{r(),o(new Error("Timeout waiting for handoff connection"))},t),r=this.#r.on("stateChange",s=>{s==="connected"&&(clearTimeout(i),r(),e(void 0))})})}async#kt(t){if(t.blob instanceof Blob)return t.blob;let e=t.src||t.originalSrc;if(e&&typeof fetch=="function"&&(e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("http")))try{let i=await(await fetch(e)).blob();if(i&&i.size>0)return i}catch{}if(typeof document<"u"){let o=document.createElement("canvas");o.width=t.dimensions?.width||120,o.height=t.dimensions?.height||160;let i=o.getContext("2d");return i&&(i.fillStyle="#f1f5f9",i.fillRect(0,0,o.width,o.height)),new Promise(r=>{o.toBlob(s=>r(s||new Blob),"image/jpeg")})}return new Blob([],{type:"image/jpeg"})}get theme(){return typeof this.getAttribute=="function"&&this.getAttribute("theme")||"dark"}set theme(t){typeof this.setAttribute=="function"&&(t?this.setAttribute("theme",t):this.removeAttribute("theme"))}get mode(){return typeof this.getAttribute=="function"&&this.getAttribute("mode")||"document"}set mode(t){typeof this.setAttribute=="function"&&this.setAttribute("mode",t)}get aspect(){return typeof this.getAttribute=="function"&&this.getAttribute("aspect")||"auto"}set aspect(t){typeof this.setAttribute=="function"&&this.setAttribute("aspect",t)}get stage(){return this.#i}set stage(t){if(t==="viewfinder"||t==="workbench"){this.#i=t,t==="workbench"&&this.#f(),typeof this.setAttribute=="function"&&this.getAttribute("stage")!==t&&this.setAttribute("stage",t);let e=this.shadowRoot;if(e){let o=e.getElementById("viewfinder-section"),i=e.getElementById("workbench-section");o&&i&&(o.style.display=t==="viewfinder"?"flex":"none",i.style.display=t==="workbench"?"flex":"none")}this.#a()}}get docId(){return typeof this.getAttribute=="function"?this.getAttribute("doc-id"):null}set docId(t){typeof this.setAttribute=="function"&&(t?this.setAttribute("doc-id",t):this.removeAttribute("doc-id"))}async rotateActivePage(){return this.#et()}async toggleActivePageBw(){return this.#ot()}async toggleCropMode(){return this.#U()}async deleteActivePageWithUndo(){return this.#it()}setCameraStream(t){this.#f(),this.#s=t;let e=this.shadowRoot,o=e?.getElementById("camera-video");if(o){o.muted=!0,o.volume=0,o.playsInline=!0,o.setAttribute("playsinline",""),o.setAttribute("webkit-playsinline",""),o.setAttribute("muted","");try{o.srcObject=typeof MediaStream<"u"&&t instanceof MediaStream?t:null}catch{}o.style.display=t?"block":"none",t&&o.srcObject&&o.play().catch(s=>{console.warn("[CopioScanner] Live video element play() error:",s)})}let i=e?.querySelector(".copio-camera-placeholder");i&&(i.style.display=t?"none":"");let r=e?.getElementById("step-pill-text");r&&t&&(r.textContent=this.mode==="batch"?`Batch Capture \xB7 Page ${this.#x+1}`:"Camera Active \xB7 Tap Shutter to Snap"),t&&this.#i==="viewfinder"&&this.#m&&this.#V()}get features(){return this.#t?this.#t.features:[]}set features(t){this.#c("features",Array.isArray(t)?t.join(" "):String(t||"")),this.#t&&this.#t.setFeatures(t)}hasFeature(t){return this.#t?this.#t.hasFeature(t):!1}get ocrEnabled(){return this.#t?this.#t.ocr:!0}set ocrEnabled(t){let e=!!t;this.#c("ocr",e?"true":"false"),this.#t&&(this.#t.ocr=e),this.#E()}get pdf(){return this.#t?this.#t.pdf:!0}set pdf(t){let e=!!t;this.#c("pdf",e?"true":"false"),this.#t&&(this.#t.pdf=e),this.#E()}get exportFormats(){return this.#t?this.#t.exportFormats:[]}set exportFormats(t){this.#c("export-formats",Array.isArray(t)?t.join(","):String(t||"")),this.#t&&(this.#t.exportFormats=t)}get ocrLanguages(){return this.#t?this.#t.ocrLanguages:[]}set ocrLanguages(t){this.#c("ocr-languages",Array.isArray(t)?t.join(","):String(t||"")),this.#t&&(this.#t.ocrLanguages=t)}get maxPages(){return this.#t?this.#t.maxPages:0}set maxPages(t){this.#c("max-pages",String(t)),this.#t&&(this.#t.maxPages=t)}get assetBase(){return this.#t?this.#t.assetBase:""}set assetBase(t){this.#c("asset-base",String(t||"")),this.#t&&(this.#t.assetBase=t)}get licenseKey(){return this.#t?this.#t.licenseKey:""}set licenseKey(t){this.#c("license-key",String(t||"")),this.#t&&(this.#t.licenseKey=t)}#c(t,e){typeof this.setAttribute=="function"&&(e?this.setAttribute(t,typeof e=="object"?JSON.stringify(e):String(e)):this.removeAttribute(t))}get relayUrl(){return this.#t?.relayUrl||""}set relayUrl(t){this.#t&&(this.#t.relayUrl=t),this.#c("relay-url",t)}get signalingUrl(){return this.#t?.signalingUrl||""}set signalingUrl(t){this.#t&&(this.#t.signalingUrl=t),this.#c("signaling-url",t)}get iceServers(){return this.#t?.iceServers||null}set iceServers(t){this.#t&&(this.#t.iceServers=t),this.#c("ice-servers",t)}get iceTransportPolicy(){return this.#t?.iceTransportPolicy||"all"}set iceTransportPolicy(t){this.#t&&(this.#t.iceTransportPolicy=t),this.#c("ice-transport-policy",t)}get storage(){return this.#D}set storage(t){this.#D=t,this.#t&&this.#t.setStorage(t)}get engine(){return this.#t}set engine(t){t instanceof z&&(this.#t=t,this.#t.addEventListener(g.MIGRATION,e=>{this.dispatch(g.MIGRATION,e.detail)}))}dispatch(t,e={}){return _(this,t,e)}async open(){this.#H=!0,typeof this.focus=="function"&&this.focus()}async close(){this.#H=!1,this.#f()}get isOpen(){return this.#H}async capture(){return new Promise(t=>{let e=document.createElement("input");e.type="file",e.accept="image/*",e.capture="environment",e.style.display="none",e.onchange=async()=>{try{if(e.files&&e.files.length>0){let o=await this.addFiles([e.files[0]]);t(o[0]||null)}else t(null)}catch(o){this.dispatch(g.ERROR,{code:"CAPTURE_FAILED",message:o.message,error:o}),t(null)}finally{e.remove()}},e.onerror=()=>{e.remove(),t(null)},document.body.appendChild(e),e.click()})}async addFiles(t,e={}){try{let o=await this.getPages(),i=null;if(o.length>0){if(this.mode==="single"&&this.maxPages<=1)await this.#t.clear(this.#d);else if(this.#P||this.maxPages>0&&o.length>=this.maxPages){let a=Math.min(this.#e,o.length-1),c=o[a];c&&(i=a,await this.#t.deletePage(this.#d,c.id))}}this.#P=!1;let r={autoCrop:this.#C,prefilledQuad:e?.prefilledQuad||null,...e},s=await this.#t.addFiles(t,this.#d,r);for(let a=0;a<s.length;a++)this.dispatch(g.PAGE_ADDED,{page:s[a],pageNumber:a+1,docId:this.docId,source:"file"});let n=await this.getPages();if(i!==null&&s.length===1&&i<n.length-1){let a=n.map(l=>l.id),c=a.pop();c&&(a.splice(i,0,c),await this.#t.reorderPages(this.#d,a),n=await this.getPages())}return this.#x=n.length,s.length>0&&(this.#e=i!==null?Math.min(i,Math.max(0,n.length-1)):Math.max(0,n.length-1),this.mode==="single"&&(this.#i="workbench",typeof this.setAttribute=="function"&&this.getAttribute("stage")!=="workbench"&&this.setAttribute("stage","workbench"))),this.dispatch(g.PAGES_CHANGED,{pages:n,docId:this.docId}),this.mode==="single"&&s.length>0&&this.maxPages<=1&&this.dispatch(g.SCAN_COMPLETE,{mode:this.mode,aspect:this.aspect,docId:this.docId,pages:n,page:n[n.length-1]||null,pageCount:n.length}),await this.#a(),s}catch(o){throw this.dispatch(g.ERROR,{code:o.code||"ADD_FILES_FAILED",message:o.message,error:o}),o}}async getPages(){return this.#t.getPages(this.#d)}async clear(){this.#f(),this.#e=0,this.#x=0,this.#P=!1,this.#n=!1,await this.#t.clear(this.#d),this.dispatch(g.PAGES_CHANGED,{pages:[],docId:this.docId}),await this.#a()}async exportPdf(t={}){try{let e=await this.#t.exportPdf(this.#d,t);return this.dispatch(g.EXPORT_COMPLETE,{type:"pdf",format:"pdf",blob:e,searchable:!!t.searchable,docId:this.docId}),e}catch(e){throw this.dispatch(g.ERROR,{code:e.code||"EXPORT_FAILED",message:e.message,error:e}),e}}async exportZip(t={}){try{let e=await this.#t.exportZip(this.#d,t);return this.dispatch(g.EXPORT_COMPLETE,{type:"zip",format:"zip",blob:e,docId:this.docId}),e}catch(e){throw this.dispatch(g.ERROR,{code:e.code||"EXPORT_FAILED",message:e.message,error:e}),e}}async ocr(t=null,e={}){try{let o=await this.#t.runOcr(this.#d,t,e);return this.dispatch(g.OCR_COMPLETE,{text:o.text,pages:o.pagesResults,averageConfidence:o.averageConfidence,docId:this.docId,pageId:t}),o}catch(o){throw this.dispatch(g.ERROR,{code:o.code||"OCR_FAILED",message:o.message,error:o}),o}}async runOcr(t=null,e={}){return this.ocr(t,e)}async sync(t={}){try{return await this.#t.sync({onStateChange:o=>{o&&(o.step==="connected"||o.step==="syncing")&&this.dispatch(g.SYNC_CONNECTED,{peerId:o.peerId,mode:o.mode}),t.onStateChange&&t.onStateChange(o)}})}catch(e){throw this.dispatch(g.ERROR,{code:e.code||"SYNC_FAILED",message:e.message,error:e}),e}}get edgeDetection(){return this.#m}set edgeDetection(t){let e=t!==!1&&t!=="false"&&t!==null&&t!==void 0;this.#m!==e&&(this.#m=e,this.#c("edge-detection",String(e)),this.#m?this.#s&&this.#i==="viewfinder"&&this.#V():(this.#z(),this.#_()))}get edgeModel(){return this.#y}set edgeModel(t){let e=t==="classical"?"classical":"ml";if(this.#y!==e){this.#y=e,this.#c("edge-model",e);let o=this.#t?.getService("edge")||T("edge");if(o&&"detector"in o&&(o.detector=e),e==="ml"&&o&&typeof o.preloadMl=="function"){let i=this.shadowRoot?.getElementById("step-pill-text"),r=i?.textContent;i&&this.#s&&this.#i==="viewfinder"&&(i.textContent="Loading ML Neural model\u2026"),o.preloadMl().then(()=>{i&&this.#s&&this.#i==="viewfinder"&&this.#y==="ml"&&(i.textContent=this.mode==="batch"?`Batch Capture \xB7 Page ${this.#x+1}`:"Camera Active \xB7 Tap Shutter to Snap")}).catch(s=>{console.warn("[CopioScanner] Failed to load ML Neural edge detector:",s),i&&r&&this.#i==="viewfinder"&&(i.textContent=r)})}}}get autoCrop(){return this.#C}set autoCrop(t){let e=t!==!1&&t!=="false"&&t!==null&&t!==void 0;this.#C!==e&&(this.#C=e,this.#c("auto-crop",String(e)))}get autoCapture(){return this.#S}set autoCapture(t){let e=!!(t&&t!=="false");this.#S!==e&&(this.#S=e,this.#c("auto-capture",String(e)))}getLiveQuad(){return this.#l?C(this.#l):null}getLatestDetection(){return this.#b?{quad:C(this.#b.quad),confidence:this.#b.confidence,durationMs:this.#b.durationMs,isFallback:this.#b.isFallback}:null}async detectCurrentFrame(t={}){let e=this._grabFrame({maxWidth:t.maxProcessingDimension||480,maxHeight:t.maxProcessingDimension||480});if(!e)return null;let o=this.#t?.getService("edge")||T("edge");return!o||typeof o.detect!="function"?null:o.detect(e,t)}};typeof customElements<"u"&&!customElements.get("copio-scanner")&&customElements.define("copio-scanner",q);export{H as a,K as b,X as c,q as d};
|
|
2
|
+
//# sourceMappingURL=chunk-Q7SOUI6D.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as P}from"./chunk-HCCNUPKB.js";import{a as V}from"./chunk-PSGIWIRH.js";import{b as _,c as I}from"./chunk-ZILTJGT2.js";import{a as v}from"./chunk-5OTO5WFV.js";import{c as D,n as U,o as S,p as N,w as L,x as M}from"./chunk-GU6OQMYK.js";import{a as $}from"./chunk-KH5JE65X.js";import{c as E}from"./chunk-6QK7337A.js";import{c as b}from"./chunk-JIPKWRBK.js";import{a as g}from"./chunk-U3V3VZGO.js";import{a as B,b as T}from"./chunk-ZT72PD2C.js";var q=3,A=[{version:2,name:"v1-to-v2-noop",description:"Establishes baseline schema versioning and verifies stored document integrity.",async up(u){let e=await u.listDocs();for(let t of e)if(!(!t||!t.id)&&typeof t.pages=="string")try{JSON.parse(t.pages)}catch{t.pages="[]",await u.saveDoc(t.id,t)}}},{version:3,name:"v2-to-v3-quad-edits",description:"Normalizes page edit stacks to include edits.quad for perspective correction (CPO-075).",async up(u){let e=await u.listDocs();for(let t of e){if(!t||!t.id)continue;let r=t.pages,i=!1;if(typeof r=="string"){i=!0;try{r=JSON.parse(r)}catch{continue}}if(!Array.isArray(r))continue;let n=!1;for(let s of r)!s||typeof s!="object"||(!s.edits||typeof s.edits!="object"?(s.edits={crop:null,quad:null,rotate:0,filter:"none"},n=!0):"quad"in s.edits||(s.edits={...s.edits,quad:null},n=!0));n&&(t.pages=i?JSON.stringify(r):r,await u.saveDoc(t.id,t))}}}],w=class{static get CURRENT_VERSION(){return 3}static get DEFAULT_MIGRATIONS(){return[...A]}static async run({storage:e,migrations:t=A,targetVersion:r=3,onEvent:i,signal:n}){if(!e)throw new Error("MigrationRunner.run requires a valid storage adapter");if(n?.aborted)throw new Error("Migration aborted before execution");let s=await e.getSchemaVersion(),o=s;if(s==null){let c=await e.listDocs();if(!c||c.length===0){await e.setSchemaVersion(r);let h={fresh:!0,fromVersion:null,toVersion:r,applied:[]};return i?.({stage:"complete",...h}),h}o=1}if(o===r)return{fresh:!1,fromVersion:o,toVersion:r,applied:[]};if(o>r)return console.warn(`[CopioMigration] Storage schema version (${o}) is newer than target version (${r}).`),{fresh:!1,fromVersion:o,toVersion:r,applied:[]};let l=t.filter(c=>c.version>o&&c.version<=r).sort((c,h)=>c.version-h.version);if(l.length===0)return await e.setSchemaVersion(r),{fresh:!1,fromVersion:o,toVersion:r,applied:[]};i?.({stage:"start",fromVersion:o,toVersion:r,totalPending:l.length});let a=[];for(let c of l){if(n?.aborted){let h=new Error(`Migration aborted before version ${c.version}`);throw i?.({stage:"error",fromVersion:o,toVersion:r,failedVersion:c.version,error:h}),h}i?.({stage:"progress",version:c.version,name:c.name,fromVersion:o,toVersion:r});try{await c.up(e,{fromVersion:o,toVersion:c.version,signal:n}),await e.setSchemaVersion(c.version),o=c.version,a.push(c.version)}catch(h){throw i?.({stage:"error",fromVersion:o,toVersion:r,failedVersion:c.version,error:h}),h}}let d={fresh:!1,fromVersion:s??1,toVersion:o,applied:a};return i?.({stage:"complete",...d}),d}};var y=class{#e=null;#t=new Map;#s=new Map;constructor(e=E()){this.#e=e}get adapter(){return this.#e}get store(){return this.#e?.store??null}async init(){let e=await this.#e.init();return await w.run({storage:this.#e}),e}async getSchemaVersion(){return this.#e.getSchemaVersion()}listDocsSync(){return typeof this.#e.listDocsSync=="function"?this.#e.listDocsSync().map(t=>{let r=this.#r(t.pages);return{id:t.id,name:t.name||"",pageCount:r.length,pages:r}}):[]}async listDocs(){return(await this.#e.listDocs()).map(t=>{let r=this.#r(t.pages);return{id:t.id,name:t.name||"",pageCount:r.length,pages:r}})}getDocSync(e){if(!e)return null;if(typeof this.#e.getDocSync=="function"){let i=this.#e.getDocSync(e);return i?{id:i.id,name:i.name||"",pages:this.#r(i.pages)}:null}let r=this.listDocsSync().find(i=>i.id===e);return r?{id:r.id,name:r.name,pages:r.pages||[]}:null}async getDoc(e){if(!e)return null;if(typeof this.#e.getDoc=="function"){let t=await this.#e.getDoc(e);return t?{id:t.id,name:t.name||"",pages:this.#r(t.pages)}:null}return this.getDocSync(e)}async createDoc(e="Untitled Document",t=[]){let r=S(),i=this.#r(t),n={id:r,name:e||"Untitled Document",pages:i};return await this.#e.saveDoc(r,n),n}async saveDoc(e,t){if(!e)throw new Error("Cannot save document without an ID");let r=this.#r(t.pages);await this.#e.saveDoc(e,{id:e,name:t.name||"",pages:r})}async renameDoc(e,t){if(typeof this.#e.renameDoc=="function")return this.#e.renameDoc(e,t);let r=await this.getDoc(e);if(!r)throw new Error(`Document "${e}" not found`);r.name=t,await this.saveDoc(e,r)}async deleteDoc(e,{soft:t=!0,timeoutMs:r=5e3}={}){if(!e)return;let i=this.getDocSync(e);if(i){if(this.#a(e),await this.#e.deleteDoc(e),t&&r>0){let n=setTimeout(async()=>{this.#t.delete(e)},r);this.#t.set(e,{doc:i,timerId:n})}return{id:e,name:i.name,undo:()=>this.undoDeleteDoc(e)}}}#a(e){if(this.#t.has(e)){let t=this.#t.get(e);clearTimeout(t.timerId),this.#t.delete(e)}}async undoDeleteDoc(e){let t=this.#t.get(e);return t?(clearTimeout(t.timerId),this.#t.delete(e),await this.#e.saveDoc(e,t.doc),t.doc):null}isSoftDeletedDoc(e){return this.#t.has(e)}async addPages(e,t){let r=await this.getDoc(e);if(!r)throw new Error(`Document "${e}" not found`);let i=Array.isArray(t)?t:[t];r.pages.push(...i),await this.saveDoc(e,r)}async updatePage(e,t,r){let i=await this.getDoc(e);if(!i)throw new Error(`Document "${e}" not found`);let n=i.pages.findIndex(s=>s.id===t);if(n===-1)throw new Error(`Page "${t}" not found in document "${e}"`);i.pages[n]={...i.pages[n],...r},await this.saveDoc(e,i)}async reorderPages(e,t){let r=await this.getDoc(e);if(!r)throw new Error(`Document "${e}" not found`);let i=new Map(r.pages.map(s=>[s.id,s])),n=[];for(let s of t)i.has(s)&&(n.push(i.get(s)),i.delete(s));for(let s of i.values())n.push(s);r.pages=n,await this.saveDoc(e,r)}async deletePage(e,t,{soft:r=!0,timeoutMs:i=5e3}={}){let n=await this.getDoc(e);if(!n)throw new Error(`Document "${e}" not found`);let s=n.pages.findIndex(d=>d.id===t);if(s===-1)return;let[o]=n.pages.splice(s,1);await this.saveDoc(e,n);let l=`${e}:${t}`;if(this.#f(l),!r||i<=0){if(typeof this.#e.deletePage=="function")try{await this.#e.deletePage(e,t)}catch(d){console.warn("[DocRepository] Adapter deletePage error:",d)}return}let a=setTimeout(async()=>{if(this.#s.delete(l),typeof this.#e.deletePage=="function")try{await this.#e.deletePage(e,t)}catch(d){console.warn("[DocRepository] Adapter deletePage error:",d)}},i);return this.#s.set(l,{docId:e,pageId:t,page:o,index:s,timerId:a}),{docId:e,pageId:t,undo:()=>this.undoDeletePage(e,t)}}#f(e){if(this.#s.has(e)){let t=this.#s.get(e);clearTimeout(t.timerId),this.#s.delete(e)}}async undoDeletePage(e,t){let r=`${e}:${t}`,i=this.#s.get(r);if(!i)return null;clearTimeout(i.timerId),this.#s.delete(r);let n=await this.getDoc(e);if(!n)return null;let s=Math.min(i.index,n.pages.length);return n.pages.splice(s,0,i.page),await this.saveDoc(e,n),i.page}isSoftDeletedPage(e,t){return this.#s.has(`${e}:${t}`)}subscribe(e){return this.#e.subscribe(e)}async getAllDocs(){let e=await this.listDocs(),t={};for(let r of e)t[r.id]=r;return t}async exportAll(){let e=await this.listDocs(),t={};for(let r of e){let i=await this.getDoc(r.id),n=[];for(let s of i?.pages||[]){if(!s){n.push(s);continue}let o={...s},l=o.blob instanceof Blob?o.blob:null;if(!l&&typeof o.src=="string"&&o.src.startsWith("blob:"))try{l=await(await fetch(o.src)).blob()}catch{}l&&(o.src=await b(l));let a=o.originalBlob instanceof Blob?o.originalBlob:null;if(!a&&typeof o.originalSrc=="string"&&o.originalSrc.startsWith("blob:"))try{a=await(await fetch(o.originalSrc)).blob()}catch{}a&&(o.originalSrc=await b(a)),delete o.blob,delete o.originalBlob,n.push(o)}t[r.id]={name:r.name,pages:JSON.stringify(n)}}return t}async importDocs(e){let t=0;for(let[r,i]of Object.entries(e||{})){await this.getDoc(r)||t++;let s=this.#r(i.pages);await this.saveDoc(r,{name:i.name||"",pages:s})}return t}#r(e){if(Array.isArray(e))return[...e];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return[]}},z=new y;var j="2026-11-18T11:09:02.727Z",J="0.1.7";var O=["crop","rotate","filter","ocr","export","sync"],R=["pdf","zip","png","jpg"],F=["eng"],C={};function Ve(u,e){!u||!e||(C[u]=e,typeof globalThis<"u"&&(globalThis.__copio_services__=globalThis.__copio_services__||{},globalThis.__copio_services__[u]=e))}function p(u){return C[u]?C[u]:typeof globalThis<"u"&&globalThis.__copio_services__?.[u]?globalThis.__copio_services__[u]:null}function Q(u){return u?u instanceof Set?new Set(u):Array.isArray(u)?new Set(u.map(e=>String(e).trim().toLowerCase()).filter(Boolean)):typeof u=="string"?new Set(u.split(/[\s,]+/).map(e=>e.trim().toLowerCase()).filter(Boolean)):new Set(O):new Set(O)}function x(u,e){return u?Array.isArray(u)?u.map(t=>String(t).trim().toLowerCase()).filter(Boolean):typeof u=="string"?u.split(/[\s,]+/).map(t=>t.trim().toLowerCase()).filter(Boolean):[...e]:[...e]}var k=class extends EventTarget{#e=new Set(O);#t=[...R];#s=[...F];#a=0;#f="";#r=null;#i=null;#g={};#c=!0;#u=!0;#n=null;#d=new Map;#h=new Map;#E=[...A];#P=3;#p="";#m="";#w=null;#y="all";#l=null;constructor(e={}){super(),this.#r=e.storage||E(e),this.#i=e.repository||new y(this.#r),e.migrations&&(this.#E=[...e.migrations]),e.schemaVersion!==void 0&&(this.#P=e.schemaVersion),e.services&&(this.#g={...e.services}),e.imageProcessor?(this.#n=e.imageProcessor,this.#g.imageProcessor=e.imageProcessor):this.getService("imageProcessor")?this.#n=this.getService("imageProcessor"):typeof document<"u"?this.#n=new M:this.#n=new $,e.features!==void 0&&this.setFeatures(e.features),e.exportFormats!==void 0&&(this.#t=x(e.exportFormats,R)),e.ocrLanguages!==void 0&&(this.#s=x(e.ocrLanguages,F)),e.maxPages!==void 0&&(this.#a=Math.max(0,Number(e.maxPages)||0)),e.assetBase!==void 0&&T(e.assetBase),e.licenseKey!==void 0&&(this.#f=String(e.licenseKey||"")),e.ocr!==void 0?this.ocr=!!e.ocr:e.features!==void 0&&!this.hasFeature("ocr")&&(this.ocr=!1),e.pdf!==void 0?this.pdf=!!e.pdf:e.exportFormats!==void 0&&!this.#t.includes("pdf")&&(this.pdf=!1),e.relayUrl!==void 0&&(this.#p=String(e.relayUrl||"")),e.signalingUrl!==void 0&&(this.#m=String(e.signalingUrl||"")),e.iceServers!==void 0&&(this.#w=Array.isArray(e.iceServers)?e.iceServers:null),e.iceTransportPolicy!==void 0&&(this.#y=e.iceTransportPolicy||"all")}async init(){return this.#l?this.#l:(this.#l=(async()=>{try{let e=await this.#r.init(),t=await this.#A();return{...e,migration:t}}catch(e){throw this.#l=null,e}})(),this.#l)}async#A(){let e=t=>{let r={...t,engine:this};this.dispatchEvent(new CustomEvent(P.MIGRATION,{detail:r})),typeof window<"u"&&typeof window.dispatchEvent=="function"&&window.dispatchEvent(new CustomEvent(P.MIGRATION,{detail:r}))};return w.run({storage:this.#r,migrations:this.#E,targetVersion:this.#P,onEvent:e})}async#o(){this.#l?await this.#l:await this.init()}async getSchemaVersion(){return this.#r.getSchemaVersion()}setService(e,t){this.#g[e]=t}getService(e){return this.#g[e]||p(e)}hasFeature(e){return e?this.#e.has(String(e).trim().toLowerCase()):!1}get features(){return Array.from(this.#e)}setFeatures(e){this.#e=Q(e),this.hasFeature("ocr")?(this.#c=!0,this.getService("ocr")instanceof g&&this.setService("ocr",p("ocr"))):(this.#c=!1,this.setService("ocr",new g))}enableFeature(e){if(e){let t=String(e).trim().toLowerCase();this.#e.add(t),t==="ocr"&&(this.#c=!0,this.getService("ocr")instanceof g&&this.setService("ocr",p("ocr")))}}disableFeature(e){if(e){let t=String(e).trim().toLowerCase();this.#e.delete(t),t==="ocr"&&(this.#c=!1,this.setService("ocr",new g))}}get ocr(){return this.#c&&this.hasFeature("ocr")}set ocr(e){this.#c=!!e,this.#c?(this.enableFeature("ocr"),this.getService("ocr")instanceof g&&this.setService("ocr",p("ocr"))):(this.disableFeature("ocr"),this.setService("ocr",new g))}get pdf(){return this.#u&&this.#t.includes("pdf")}set pdf(e){this.#u=!!e,this.#u?(this.#t.includes("pdf")||this.#t.push("pdf"),this.getService("pdf")instanceof v&&this.setService("pdf",p("pdf"))):(this.#t=this.#t.filter(t=>t!=="pdf"),this.setService("pdf",new v))}get exportFormats(){return[...this.#t]}set exportFormats(e){this.#t=x(e,R),this.#t.includes("pdf")?(this.#u=!0,this.getService("pdf")instanceof v&&this.setService("pdf",p("pdf"))):(this.#u=!1,this.setService("pdf",new v))}get ocrLanguages(){return[...this.#s]}set ocrLanguages(e){this.#s=x(e,F)}get maxPages(){return this.#a}set maxPages(e){this.#a=Math.max(0,Number(e)||0)}get assetBase(){return B()}set assetBase(e){T(e)}get licenseKey(){return this.#f}set licenseKey(e){this.#f=String(e||"")}get relayUrl(){return this.#p}set relayUrl(e){this.#p=String(e||"")}get signalingUrl(){return this.#m}set signalingUrl(e){this.#m=String(e||"")}get iceServers(){return this.#w}set iceServers(e){this.#w=Array.isArray(e)?e:null}get iceTransportPolicy(){return this.#y}set iceTransportPolicy(e){this.#y=e||"all"}get edgeDetector(){return this.getService("edge")||p("edge")||new V}async detectEdges(e,t={}){let r=this.edgeDetector;return!r||typeof r.detect!="function"?null:r.detect(e,t)}get storage(){return this.#r}setStorage(e){e&&(this.#r=e,this.#i=new y(this.#r))}#D(e,t){this.#d.has(e)||this.#d.set(e,[]);let r=this.#d.get(e);r.push(t),r.length>50&&r.shift(),this.#h.has(e)&&(this.#h.get(e).length=0)}get imageProcessor(){return this.#n}setImageProcessor(e){e&&(this.#n=e,this.setService("imageProcessor",e))}async renderEdits(e,t){if(!e)return"";let r=D(t);return this.#n?this.#n.renderEdits(e,r):L(e,r)}get docs(){return this.#i}async listDocuments(){return await this.#o(),this.#i.listDocs()}async getDocument(e){return await this.#o(),this.#i.getDoc(e)}async createDocument(e,t){return await this.#o(),this.#i.createDoc(e,t)}async deleteDocument(e,t={}){return await this.#o(),this.#i.deleteDoc(e,t)}async undoDeleteDocument(e){return await this.#o(),this.#i.undoDeleteDoc(e)}async renameDocument(e,t){return await this.#o(),this.#i.renameDoc(e,t)}async addPages(e,t){return await this.#o(),this.#i.addPages(e,t)}async deletePage(e,t,r={}){return await this.#o(),this.#D(e,{type:"delete",pageId:t}),this.#i.deletePage(e,t,r)}async undoDeletePage(e,t){return await this.#o(),this.#i.undoDeletePage(e,t)}async updatePage(e,t,r){return await this.#o(),this.#i.updatePage(e,t,r)}async reorderPages(e,t){let r=await this.getDocument(e),i=r?.pages?r.pages.map(n=>n.id):[];return this.#D(e,{type:"reorder",priorOrder:i,newOrder:[...t]}),this.#i.reorderPages(e,t)}async#S(e){if(e)return e;let t=await this.listDocuments();return t.length>0?t[0].id:null}async applyEdit(e,t,r){let i=await this.#S(e),n=i?await this.getDocument(i):null;if(!n||!n.pages)throw new Error(`Document with ID "${i||e}" not found`);let s=n.pages.find(f=>f.id===t);if(!s)throw new Error(`Page with ID "${t}" not found in document "${i}"`);let o=D(s.edits||{crop:null,quad:null,rotate:0,filter:"none"}),l=s.src,a=D({...o,...r}),d=s.originalSrc||s.src,c=d;this.#n&&(c=await this.#n.renderEdits(d,a));let h=o.rotate!==a.rotate||JSON.stringify(o.crop)!==JSON.stringify(a.crop)||JSON.stringify(o.quad)!==JSON.stringify(a.quad),m={originalSrc:d,src:c,edits:a,...h?{ocrText:null,ocrConfidence:null,ocrWords:null,ocrWidth:null,ocrHeight:null}:{}};return await this.updatePage(i,t,m),this.#D(i,{type:"edit",pageId:t,priorEdits:o,priorSrc:l,newEdits:a,newSrc:c}),{...s,...m}}async undo(e){let t=await this.#S(e),r=t?this.#d.get(t):null;if(!r||r.length===0)return null;let i=r.pop();return this.#h.has(t)||this.#h.set(t,[]),this.#h.get(t).push(i),i.type==="edit"?(await this.updatePage(t,i.pageId,{edits:i.priorEdits,src:i.priorSrc}),{type:"edit",pageId:i.pageId,restoredEdits:i.priorEdits}):i.type==="delete"?(await this.undoDeletePage(t,i.pageId),{type:"delete",pageId:i.pageId}):i.type==="reorder"?(await this.#i.reorderPages(t,i.priorOrder),{type:"reorder",priorOrder:i.priorOrder}):i}async redo(e){let t=await this.#S(e),r=t?this.#h.get(t):null;if(!r||r.length===0)return null;let i=r.pop();return this.#d.has(t)||this.#d.set(t,[]),this.#d.get(t).push(i),i.type==="edit"?(await this.updatePage(t,i.pageId,{edits:i.newEdits,src:i.newSrc}),{type:"edit",pageId:i.pageId,appliedEdits:i.newEdits}):i.type==="delete"?(await this.deletePage(t,i.pageId),{type:"delete",pageId:i.pageId}):i.type==="reorder"?(await this.reorderPages(t,i.newOrder),{type:"reorder",newOrder:i.newOrder}):i}subscribe(e){return this.#i.subscribe(e)}async addFiles(e,t=null,r={}){if(!e||e.length===0)return[];let i=Array.from(e),n=[];for(let o of i)if(o.type==="application/pdf"){let l=this.getService("pdf");if(l&&typeof l.renderPdfPagesToDataUrls=="function"){let a=await l.renderPdfPagesToDataUrls(o);for(let d of a)n.push({id:S(),src:d,originalSrc:d,edits:{crop:null,rotation:0,filter:"none"},type:"image",name:o.name||"PDF Page"})}else console.warn("PDF import service (PdfPort) not registered. Skipping PDF file.")}else if(o.type&&o.type.startsWith("image/")){let l=await N(o),a=null;try{a=await U(o)}catch{}let d={crop:null,rotation:0,filter:"none"};if(r.prefilledQuad)d.quad=_(r.prefilledQuad),d.crop=I(r.prefilledQuad);else if(r.autoCrop)try{let m=this.getService("edge");if(m&&typeof m.detect=="function"){let f=await m.detect(l);f&&f.quad&&f.confidence>=.45&&!f.isFallback&&(d.quad=_(f.quad),d.crop=I(f.quad))}}catch{}let c=D(d),h=l;(c.quad||c.crop)&&this.#n&&(h=await this.#n.renderEdits(l,c)),n.push({id:S(),src:h,originalSrc:l,edits:c,type:"image",name:o.name||"Captured Image",orientation:a})}if(n.length===0)return[];await this.init();let s=t;if(s)await this.getDocument(s)||await this.#i.saveDoc(s,{name:"Scanned Document",pages:[]});else{let o=await this.listDocuments();o.length>0?s=o[0].id:s=(await this.createDocument("Scanned Document",[])).id}if(this.#a>0){let o=(await this.getDocument(s))?.pages||[],l=Math.max(0,this.#a-o.length);if(l<=0)throw new Error(`Maximum page limit (${this.#a}) reached`);n.splice(l)}return await this.addPages(s,n),n}async getPages(e=null){let t=e;if(!t){let i=await this.listDocuments();if(i.length===0)return[];t=i[0].id}return(await this.getDocument(t))?.pages||[]}async clear(e=null){let t=e;if(!t){let i=await this.listDocuments();if(i.length===0)return;t=i[0].id}let r=await this.getDocument(t);if(!(!r||!r.pages))for(let i of r.pages)await this.deletePage(t,i.id)}async#v(e){if(Array.isArray(e))return{docName:"document",pages:e,docId:null};if(typeof e=="string"){let r=await this.getDocument(e);return{docName:r?.name||"document",pages:r?.pages||[],docId:e}}let t=await this.listDocuments();if(t.length>0){let r=await this.getDocument(t[0].id);return{docName:r?.name||"document",pages:r?.pages||[],docId:t[0].id}}return{docName:"document",pages:[],docId:null}}async exportPdf(e,t={}){if(!this.hasFeature("export")){let s=new Error('Feature "export" is disabled');throw Object.assign(s,{code:"FEATURE_DISABLED"}),s}if(!this.#u||!this.#t.includes("pdf")){let s=new Error('Feature "pdf" is disabled');throw Object.assign(s,{code:"FEATURE_DISABLED"}),s}let{docName:r,pages:i}=await this.#v(e),n=this.getService("pdf")||this.getService("export");if(!n||typeof n.exportDocumentAsPdf!="function")throw new Error("Export service (PdfPort) is not registered. Import @copio/sdk or register an exportService.");return n.exportDocumentAsPdf(r,i,{download:!1,showProgress:!1,onOcrComplete:async()=>{if(typeof e=="string"){let s=await this.#r.getDoc(e);s&&(s.pages=i,await this.#r.saveDoc(e,s))}},...t})}async exportZip(e,t={}){if(!this.hasFeature("export")){let s=new Error('Feature "export" is disabled');throw Object.assign(s,{code:"FEATURE_DISABLED"}),s}let{docName:r,pages:i}=await this.#v(e),n=this.getService("export");if(!n||typeof n.exportDocumentAsImages!="function")throw new Error("Export service is not registered. Import @copio/sdk or register an exportService.");return n.exportDocumentAsImages(r,i,{download:!1,showProgress:!1,...t})}async runOcr(e,t=null,r={}){if(!this.#c||!this.hasFeature("ocr")){let a=new Error('Feature "ocr" is disabled');throw Object.assign(a,{code:"FEATURE_DISABLED"}),a}let{pages:i}=await this.#v(e),n=i;t&&(n=i.filter(a=>a.id===t));let s=this.getService("ocr");if(!s||typeof s.recognizeDocumentPages!="function")throw new Error("OCR service (OcrPort) is not registered. Import @copio/sdk or register an ocrService.");let o=r.lang||this.#s[0]||"eng",l=await s.recognizeDocumentPages(n,{lang:o,...r});if(Array.isArray(l.pagesResults)){for(let a of l.pagesResults){let d=n.find(c=>c.id===a.pageId)||n[a.pageIndex];d&&(d.ocrText=a.text,d.ocrConfidence=a.confidence,d.ocrWords=a.words)}if(typeof e=="string"){let a=await this.#r.getDoc(e);if(a&&Array.isArray(a.pages)){for(let d of l.pagesResults){let c=a.pages.find(h=>h.id===d.pageId)||a.pages[d.pageIndex];c&&(c.ocrText=d.text,c.ocrConfidence=d.confidence,c.ocrWords=d.words)}await this.#r.saveDoc(e,a)}}}return{text:l.combinedText,...l}}async sync(e={}){if(!this.hasFeature("sync")){let r=new Error('Feature "sync" is disabled');throw Object.assign(r,{code:"FEATURE_DISABLED"}),r}let t=this.getService("sync");if(!t)throw new Error("Sync service (SyncPort) is not registered. Import @copio/sdk or register a syncService.");return new t(this.#i,e.onStateChange)}};export{q as a,A as b,w as c,y as d,z as e,j as f,J as g,O as h,R as i,F as j,Ve as k,p as l,k as m};
|
|
2
|
+
//# sourceMappingURL=chunk-WZZ7FNDX.js.map
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as B,b as C,c as D,d as E,e as F,f as G,g as H,h as U,i as V,j as W,k as X,l as Y,m as Z}from"./chunk-
|
|
1
|
+
import{a as B,b as C,c as D,d as E,e as F,f as G,g as H,h as U,i as V,j as W,k as X,l as Y,m as Z}from"./chunk-WZZ7FNDX.js";import{a as I,b as J}from"./chunk-HCCNUPKB.js";import{a as Q}from"./chunk-PSGIWIRH.js";import{a as M,b as N,c as O,d as P}from"./chunk-ZILTJGT2.js";import{a as L}from"./chunk-5OTO5WFV.js";import"./chunk-O6FQFVKY.js";import"./chunk-4GEMGDRU.js";import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y,v as z,w as A,x as S}from"./chunk-GU6OQMYK.js";import{a as T}from"./chunk-KH5JE65X.js";import{a as R}from"./chunk-ULTSZWZO.js";import{c as d}from"./chunk-6QK7337A.js";import{a as b}from"./chunk-NNSM2I5L.js";import{d as c}from"./chunk-JIPKWRBK.js";import{a}from"./chunk-4D6GC55I.js";import{a as K}from"./chunk-U3V3VZGO.js";import"./chunk-6DSLE3AY.js";import"./chunk-ZT72PD2C.js";import"./chunk-25WAHT3G.js";export{G as BUILD_DATE,I as COPIO_EVENTS,B as CURRENT_SCHEMA_VERSION,S as Canvas2DAdapter,Z as CopioEngine,V as DEFAULT_EXPORT_FORMATS,M as DEFAULT_FALLBACK_QUAD,U as DEFAULT_FEATURES,C as DEFAULT_MIGRATIONS,W as DEFAULT_OCR_LANGUAGES,E as DocRepository,p as Document,P as EdgeDetectorPort,R as ImageProcessorPort,c as IndexedDbStorageAdapter,b as MemoryStorageAdapter,D as MigrationRunner,Q as NullEdgeDetectorAdapter,T as NullImageProcessorAdapter,K as NullOcrAdapter,L as NullPdfAdapter,o as Page,q as ScanSession,a as StoragePort,H as VERSION,A as applyEdits,u as applySauvolaToImageData,N as cloneQuad,d as createDefaultAdapter,j as cropOriginalToRotated,f as cropRectToQuad,k as cropRotatedToOriginal,J as dispatchCopioEvent,F as docRepository,r as extractExif,t as fileToBase64,x as getCroppedSrc,Y as getRegisteredService,h as hasActiveEdits,g as normalizeEditStack,y as normalizeEdits,e as normalizeQuad,m as quadOriginalToRotated,n as quadRotatedToOriginal,O as quadToCropRect,s as randomId,X as registerService,z as renderEditsToCanvas,i as rotateCrop,l as rotateQuad,w as rotateSrc,v as thresholdSrc};
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
|
@@ -5029,7 +5029,7 @@
|
|
|
5029
5029
|
{
|
|
5030
5030
|
"kind": "variable",
|
|
5031
5031
|
"name": "scannerCss",
|
|
5032
|
-
"default": "` :host { all: initial; display: block; position: relative; width: 100%; height: 100%; min-height: 200px; container-type: size; container-name: copio-scanner; overflow: hidden; contain: layout; box-sizing: border-box; text-align: left; direction: ltr; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; --copio-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; --copio-font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; --copio-color-bg: #0b0f17; --copio-color-surface: #131b26; --copio-color-surface-elevated: #1c2736; --copio-color-surface-overlay: rgba(15, 22, 32, 0.88); --copio-color-stage-bg: #070a0f; --copio-color-text: #f1f5f9; --copio-color-text-muted: #94a3b8; --copio-color-text-inverse: #090d14; --copio-color-primary: #38bdf8; --copio-color-primary-hover: #7dd3fc; --copio-color-primary-contrast: #06131f; --copio-color-success: #22c55e; --copio-color-warning: #f59e0b; --copio-color-danger: #ef4444; --copio-color-border: rgba(148, 163, 184, 0.18); --copio-color-border-strong: rgba(148, 163, 184, 0.34); --copio-focus-ring: 0 0 0 2px #0b0f17, 0 0 0 4px #38bdf8; --copio-radius-sm: 6px; --copio-radius-md: 10px; --copio-radius-lg: 14px; --copio-radius-pill: 9999px; --copio-spacing-xs: 4px; --copio-spacing-sm: 8px; --copio-spacing-md: 12px; --copio-spacing-lg: 16px; --copio-spacing-xl: 24px; --copio-touch-target-min: 44px; --copio-crop-handle-hit: 48px; --copio-crop-handle-visual: 16px; --copio-shadow-elevated: 0 12px 32px -4px rgba(0, 0, 0, 0.55); --copio-transition-fast: 150ms cubic-bezier(0.22, 1, 0.36, 1); --copio-transition-normal: 240ms cubic-bezier(0.22, 1, 0.36, 1); font-family: var(--copio-font-family); font-size: 14px; line-height: 1.5; color: var(--copio-color-text); background-color: var(--copio-color-bg); color-scheme: dark; } :host([theme=\"dark\"]), :host(.copio-theme-dark), :host-context([data-theme=\"dark\"]), :host-context(.sl-theme-dark), :host-context(.theme-dark) { color-scheme: dark; } /* Light Theme Override */ :host([theme=\"light\"]), :host(.copio-theme-light), :host-context([data-theme=\"light\"]), :host-context(.sl-theme-light), :host-context(.theme-light) { --copio-color-bg: #f8fafc; --copio-color-surface: #ffffff; --copio-color-surface-elevated: #f1f5f9; --copio-color-surface-overlay: rgba(255, 255, 255, 0.92); --copio-color-stage-bg: #1e293b; --copio-color-text: #0f172a; --copio-color-text-muted: #475569; --copio-color-text-inverse: #ffffff; --copio-color-primary: #0284c7; --copio-color-primary-hover: #0369a1; --copio-color-primary-contrast: #ffffff; --copio-color-success: #16a34a; --copio-color-warning: #d97706; --copio-color-danger: #dc2626; --copio-color-border: rgba(15, 23, 42, 0.12); --copio-color-border-strong: rgba(15, 23, 42, 0.26); --copio-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0284c7; --copio-radius-sm: 6px; --copio-radius-md: 10px; --copio-radius-lg: 14px; --copio-shadow-elevated: 0 12px 28px -4px rgba(15, 23, 42, 0.18); color-scheme: light; } /* Brand Theme Override (Emerald) */ :host([theme=\"brand\"]), :host(.copio-theme-brand), :host-context([data-theme=\"brand\"]), :host-context(.theme-brand) { --copio-color-bg: #0f111a; --copio-color-surface: #181b28; --copio-color-surface-elevated: #23273a; --copio-color-surface-overlay: rgba(24, 27, 40, 0.90); --copio-color-stage-bg: #090a10; --copio-color-text: #f8fafc; --copio-color-text-muted: #9ca3af; --copio-color-text-inverse: #ffffff; --copio-color-primary: #10b981; --copio-color-primary-hover: #34d399; --copio-color-primary-contrast: #042f2e; --copio-color-success: #10b981; --copio-color-warning: #f59e0b; --copio-color-danger: #ef4444; --copio-color-border: rgba(16, 185, 129, 0.22); --copio-color-border-strong: rgba(16, 185, 129, 0.42); --copio-focus-ring: 0 0 0 2px #0f111a, 0 0 0 4px #10b981; --copio-radius-sm: 4px; --copio-radius-md: 8px; --copio-radius-lg: 12px; --copio-shadow-elevated: 0 12px 32px -4px rgba(0, 0, 0, 0.65); color-scheme: dark; } /* Auto Theme: follows prefers-color-scheme when theme is auto */ @media (prefers-color-scheme: light) { :host([theme=\"auto\"]), :host(.copio-theme-auto) { --copio-color-bg: #f8fafc; --copio-color-surface: #ffffff; --copio-color-surface-elevated: #f1f5f9; --copio-color-surface-overlay: rgba(255, 255, 255, 0.92); --copio-color-stage-bg: #1e293b; --copio-color-text: #0f172a; --copio-color-text-muted: #475569; --copio-color-text-inverse: #ffffff; --copio-color-primary: #0284c7; --copio-color-primary-hover: #0369a1; --copio-color-primary-contrast: #ffffff; --copio-color-success: #16a34a; --copio-color-warning: #d97706; --copio-color-danger: #dc2626; --copio-color-border: rgba(15, 23, 42, 0.12); --copio-color-border-strong: rgba(15, 23, 42, 0.26); --copio-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0284c7; --copio-radius-sm: 6px; --copio-radius-md: 10px; --copio-radius-lg: 14px; --copio-shadow-elevated: 0 12px 28px -4px rgba(15, 23, 42, 0.18); color-scheme: light; } } /* ========================================================================== 2. INTERNAL ELEMENT RESET (Scoped to Shadow DOM) ========================================================================== */ *, *::before, *::after { box-sizing: border-box; } ::slotted(*) { box-sizing: border-box; } /* ========================================================================== 3. ROOT CONTAINER & COMPONENT SHELL ========================================================================== */ .copio-scanner-container { width: 100%; height: 100%; position: relative; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; container-type: size; container-name: copio-scanner; contain: layout; background: var(--copio-color-bg); color: var(--copio-color-text); font-family: var(--copio-font-family); font-size: 14px; line-height: 1.5; text-align: left; direction: ltr; user-select: none; } /* Header (Shadow Part: header) */ .copio-header { display: flex; align-items: center; justify-content: space-between; gap: var(--copio-spacing-sm); padding: var(--copio-spacing-sm) var(--copio-spacing-md); background: var(--copio-color-surface); border-bottom: 1px solid var(--copio-color-border); min-height: 52px; flex-shrink: 0; z-index: 5; box-sizing: border-box; } .copio-header-left { display: flex; align-items: center; gap: var(--copio-spacing-sm); min-width: 0; } .copio-mode-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: var(--copio-radius-pill); background: var(--copio-color-surface-elevated); color: var(--copio-color-primary); border: 1px solid var(--copio-color-border); white-space: nowrap; } .copio-title-group { display: flex; flex-direction: column; min-width: 0; } .copio-title { font-size: 13px; font-weight: 600; color: var(--copio-color-text); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .copio-subtitle { font-size: 11px; color: var(--copio-color-text-muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .copio-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; } /* Interactive Stage Switcher Pill (Viewfinder vs Workbench) */ .copio-stage-tabs { display: inline-flex; background: var(--copio-color-bg); padding: 2px; border-radius: var(--copio-radius-md); border: 1px solid var(--copio-color-border); } .copio-stage-tab { appearance: none; border: none; background: transparent; color: var(--copio-color-text-muted); font-family: inherit; font-size: 11px; font-weight: 600; padding: 6px 10px; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); border-radius: var(--copio-radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background var(--copio-transition-fast), color var(--copio-transition-fast); } .copio-stage-tab[aria-selected=\"true\"] { background: var(--copio-color-surface-elevated); color: var(--copio-color-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); } /* Touch-Safe Interactive Buttons (>=44px touch invariant) */ .copio-btn { appearance: none; border: 1px solid var(--copio-color-border); background: var(--copio-color-surface-elevated); color: var(--copio-color-text); font-family: inherit; font-size: 13px; font-weight: 600; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); padding: 0 12px; border-radius: var(--copio-radius-md); display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; transition: all var(--copio-transition-fast); white-space: nowrap; text-decoration: none; box-sizing: border-box; } .copio-btn:hover { background: var(--copio-color-primary-hover); color: var(--copio-color-primary-contrast); border-color: var(--copio-color-primary); } .copio-btn-primary { background: var(--copio-color-primary); color: var(--copio-color-primary-contrast); border-color: var(--copio-color-primary); } .copio-btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--copio-color-danger); border-color: rgba(239, 68, 68, 0.35); } .copio-btn-danger:hover { background: var(--copio-color-danger); color: #fff; } /* Viewfinder (Shadow Part: viewfinder) */ .copio-viewfinder, .copio-viewfinder-stage { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-between; background: var(--copio-color-stage-bg); overflow: hidden; min-height: 0; width: 100%; } .copio-viewfinder-feed, .copio-camera-feed { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 20px 104px 20px; background: radial-gradient(circle at 50% 45%, #1e293b 0%, #090d14 75%); } .copio-camera-feed.is-shutter-flash::after { content: ''; position: absolute; inset: 0; background: #ffffff; opacity: 0.75; pointer-events: none; z-index: 5; animation: copio-shutter-flash 150ms ease-out forwards; } @keyframes copio-shutter-flash { 0% { opacity: 0.75; } 100% { opacity: 0; } } /* Framing Guide Overlay (receipt | card | a4 | auto) */ .copio-framing-guide { position: relative; display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; border: 1.5px dashed rgba(56, 189, 248, 0.55); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(4, 7, 12, 0.52); transition: all var(--copio-transition-normal); overflow: hidden; } .copio-framing-guide[data-aspect=\"receipt\"] { aspect-ratio: 1 / 2.1; height: 100%; } .copio-framing-guide[data-aspect=\"card\"] { aspect-ratio: 1.586 / 1; width: 92%; max-height: 82%; } .copio-framing-guide[data-aspect=\"a4\"] { aspect-ratio: 1 / 1.414; height: 96%; } .copio-framing-guide[data-aspect=\"auto\"] { width: 94%; height: 94%; } /* Corner Targeting Brackets */ .copio-corner { position: absolute; width: 22px; height: 22px; border-color: var(--copio-color-primary); border-style: solid; border-width: 0; pointer-events: none; z-index: 2; } .copio-corner.tl { top: 6px; left: 6px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 6px; } .copio-corner.tr { top: 6px; right: 6px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 6px; } .copio-corner.bl { bottom: 6px; left: 6px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 6px; } .copio-corner.br { bottom: 6px; right: 6px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 6px; } .copio-edge-quad { position: absolute; inset: 12px; border: 1px solid rgba(56, 189, 248, 0.28); border-radius: 8px; background: rgba(56, 189, 248, 0.04); pointer-events: none; z-index: 1; } /* Live Viewfinder SVG Quad Overlay (CPO-076) */ .copio-live-quad-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; overflow: visible; } .copio-live-quad-polygon { fill: rgba(56, 189, 248, 0.18); stroke: var(--copio-color-primary, #38bdf8); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.45)); } .copio-live-quad-corner { fill: #ffffff; stroke: var(--copio-color-primary, #38bdf8); stroke-width: 2.5; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.4)); } .copio-camera-feed.is-detected .copio-live-quad-polygon { fill: rgba(34, 197, 94, 0.22); stroke: #22c55e; filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.6)); } .copio-camera-feed.is-detected .copio-live-quad-corner { stroke: #22c55e; } .copio-camera-feed.is-tracking .copio-edge-quad { opacity: 0.1; transition: opacity var(--copio-transition-fast); } .copio-camera-placeholder { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; color: var(--copio-color-text-muted); font-size: 12px; font-weight: 500; cursor: pointer; user-select: none; transition: color var(--copio-transition-fast), transform var(--copio-transition-fast); } .copio-camera-placeholder:hover { color: var(--copio-color-text); transform: scale(1.02); } .copio-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--copio-color-primary); box-shadow: 0 0 8px var(--copio-color-primary); flex-shrink: 0; } /* Top Viewfinder HUD Overlay (Step Pill + Privacy Assurance Badge) */ .copio-viewfinder-hud-top { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: linear-gradient(to bottom, rgba(7, 10, 15, 0.85), transparent); } .copio-step-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--copio-radius-pill); background: rgba(15, 23, 42, 0.88); border: 1px solid rgba(56, 189, 248, 0.45); color: #f8fafc; font-size: 12px; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); } .copio-privacy-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: var(--copio-radius-pill); background: rgba(22, 101, 52, 0.35); border: 1px solid rgba(34, 197, 94, 0.4); color: #86efac; font-size: 11px; font-weight: 500; } /* Shutter Dock (Shadow Part: shutter-dock) */ .copio-shutter-dock { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) 16px; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-border); min-height: 84px; flex-shrink: 0; } .copio-shutter-side { flex: 1; display: flex; align-items: center; } .copio-shutter-side.right { justify-content: flex-end; } .copio-shutter-btn { appearance: none; width: 64px; height: 64px; border-radius: var(--copio-radius-pill); border: 4px solid var(--copio-color-primary); background: transparent; padding: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform var(--copio-transition-fast), border-color 150ms ease; flex-shrink: 0; } .copio-shutter-btn:hover { transform: scale(1.04); } .copio-shutter-btn:active { transform: scale(0.94); } .copio-shutter-btn-inner, .copio-shutter-inner { width: 100%; height: 100%; border-radius: var(--copio-radius-pill); background: var(--copio-color-primary); display: flex; align-items: center; justify-content: center; color: var(--copio-color-primary-contrast); transition: transform var(--copio-transition-fast); } .copio-shutter-btn:active .copio-shutter-btn-inner, .copio-shutter-btn:active .copio-shutter-inner { transform: scale(0.88); } /* Stacking Thumbnail Counter Pill in Viewfinder */ .copio-stack-pill { display: inline-flex; align-items: center; gap: 8px; min-height: var(--copio-touch-target-min); padding: 4px 12px 4px 6px; border-radius: var(--copio-radius-md); background: var(--copio-color-surface-elevated); border: 1px solid var(--copio-color-primary); color: var(--copio-color-text); font-size: 12px; font-weight: 600; cursor: pointer; } .copio-stack-thumb { width: 30px; height: 36px; border-radius: 4px; object-fit: cover; border: 1px solid rgba(255, 255, 255, 0.35); background: #000; } /* Workbench & Filmstrip (Shadow Part: workbench) */ .copio-workbench, .copio-workbench-stage { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; background: var(--copio-color-bg); overflow: hidden; min-height: 0; width: 100%; } .copio-workbench-main { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; overflow: hidden; } .copio-stage-canvas, .copio-canvas-viewport { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 16px 20px 44px 20px; background: var(--copio-color-stage-bg); min-height: 180px; } .copio-canvas-viewport.has-card-switcher { padding-top: 66px; } .copio-canvas-viewport.is-cropping { padding: 74px 26px 26px 26px; } /* Card Side Switcher */ .copio-card-side-switcher { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 6; display: inline-flex; gap: 4px; padding: 3px; background: var(--copio-color-surface-overlay, rgba(15, 22, 32, 0.88)); border: 1px solid var(--copio-color-border-strong); border-radius: var(--copio-radius-pill); backdrop-filter: blur(8px); } .copio-side-pill { appearance: none; border: none; background: transparent; color: var(--copio-color-text-muted); font-family: inherit; font-size: 11px; font-weight: 600; padding: 6px 12px; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); border-radius: var(--copio-radius-pill); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; } .copio-side-pill[aria-selected=\"true\"] { background: var(--copio-color-primary); color: var(--copio-color-primary-contrast); } .copio-stage-figure, .copio-canvas-wrapper { position: relative; display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; } .copio-stage-canvas img, .copio-stage-img, .copio-stage-image { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: var(--copio-shadow-elevated); border-radius: var(--copio-radius-sm); user-select: none; } .copio-crop-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; z-index: 8; touch-action: none; } .copio-crop-box { position: absolute; border: 2px solid var(--copio-color-primary); box-shadow: 0 0 0 9999px rgba(5, 8, 14, 0.68); cursor: move; touch-action: none; box-sizing: border-box; } /* Rule-of-thirds crop grid */ .copio-crop-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(56, 189, 248, 0.28) 1px, transparent 1px), linear-gradient(to bottom, rgba(56, 189, 248, 0.28) 1px, transparent 1px); background-size: 33.333% 33.333%; } /* 48px x 48px Touch Target Handles (exceeds 44px requirement) */ .copio-crop-handle { position: absolute; width: var(--copio-crop-handle-hit); height: var(--copio-crop-handle-hit); min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; z-index: 10; touch-action: none; box-sizing: border-box; } .copio-crop-handle::after { content: ''; width: var(--copio-crop-handle-visual); height: var(--copio-crop-handle-visual); border-radius: 50%; background: var(--copio-color-primary); border: 2.5px solid #ffffff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); transition: transform 120ms ease; box-sizing: border-box; } .copio-crop-handle:hover::after, .copio-crop-handle:active::after { transform: scale(1.25); background: var(--copio-color-success, #22c55e); } .copio-crop-handle.nw { top: -24px; left: -24px; cursor: nwse-resize; } .copio-crop-handle.ne { top: -24px; right: -24px; cursor: nesw-resize; } .copio-crop-handle.sw { bottom: -24px; left: -24px; cursor: nesw-resize; } .copio-crop-handle.se { bottom: -24px; right: -24px; cursor: nwse-resize; } .copio-crop-handle.n, .copio-crop-handle.edge-n { top: -24px; left: calc(50% - 24px); cursor: ns-resize; } .copio-crop-handle.s, .copio-crop-handle.edge-s { bottom: -24px; left: calc(50% - 24px); cursor: ns-resize; } .copio-crop-handle.w, .copio-crop-handle.edge-w { left: -24px; top: calc(50% - 24px); cursor: ew-resize; } .copio-crop-handle.e, .copio-crop-handle.edge-e { right: -24px; top: calc(50% - 24px); cursor: ew-resize; } /* 4-Corner Perspective Quad Crop (CPO-075) */ .copio-crop-quad-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; } .copio-crop-mask { fill: rgba(5, 8, 14, 0.68); } .copio-crop-quad-outline { fill: rgba(56, 189, 248, 0.06); stroke: var(--copio-color-primary); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: auto; cursor: move; } .copio-crop-quad-grid { stroke: rgba(56, 189, 248, 0.35); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; } .copio-quad-handle { transform: translate(-50%, -50%); cursor: grab; } .copio-quad-handle:active { cursor: grabbing; } .copio-crop-magnifier { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 2.5px solid var(--copio-color-primary); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55); pointer-events: none; z-index: 20; display: none; background: #0b0f17; transform: translate(-50%, -125%); } /* Filmstrip & Reorder Tray */ .copio-filmstrip, .copio-filmstrip-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-border); overflow-x: auto; min-height: 80px; flex-shrink: 0; scrollbar-width: thin; } .copio-filmstrip-scroll { display: flex; align-items: center; gap: 8px; } .copio-filmstrip-item { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; } .copio-thumb-container { position: relative; width: 56px; height: 70px; border-radius: var(--copio-radius-sm); overflow: hidden; background: var(--copio-color-surface-elevated, #1c2736); border: 2px solid var(--copio-color-border); cursor: pointer; transition: all var(--copio-transition-fast); display: flex; align-items: center; justify-content: center; } .copio-filmstrip-item.is-active .copio-thumb-container { border-color: var(--copio-color-primary); box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25); } .copio-thumb-num { position: absolute; bottom: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: rgba(15, 23, 42, 0.85); color: #f8fafc; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; } .copio-thumb-reorder { display: flex; align-items: center; gap: 4px; } .copio-reorder-btn { appearance: none; border: 1px solid var(--copio-color-border); background: var(--copio-color-surface-elevated); color: var(--copio-color-text-muted); border-radius: 4px; font-size: 9px; padding: 2px 5px; cursor: pointer; } .copio-reorder-btn:disabled { opacity: 0.35; cursor: not-allowed; } .copio-thumb-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; } /* Edit Action Toolbar & Primary Completion Dock */ .copio-toolbar, .copio-controls-dock { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) 12px; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-border); min-height: 56px; flex-shrink: 0; z-index: 6; } .copio-edit-toolbar, .copio-toolbar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; width: 100%; } .copio-toolbar-tools .copio-tool-btn { flex: 1 1 0; min-width: 0; } .copio-toolbar-actions { display: flex; align-items: center; gap: 8px; width: 100%; flex-shrink: 0; } .copio-toolbar-actions .copio-btn-primary { width: 100%; } .copio-tool-btn { appearance: none; border: 1px solid var(--copio-color-border); background: var(--copio-color-surface-elevated); color: var(--copio-color-text); font-family: inherit; font-size: 11px; font-weight: 600; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); padding: 4px 6px; border-radius: var(--copio-radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; transition: all var(--copio-transition-fast); } .copio-tool-btn:hover:not(:disabled) { border-color: var(--copio-color-border-strong); background: rgba(255, 255, 255, 0.06); } .copio-tool-btn[aria-pressed=\"true\"] { background: rgba(56, 189, 248, 0.16); color: var(--copio-color-primary); border-color: var(--copio-color-primary); } .copio-tool-btn.danger { color: #fca5a5; } .copio-tool-btn.danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.45); } .copio-toast-region { position: absolute; bottom: 124px; left: 12px; right: 12px; z-index: 30; display: flex; flex-direction: column; gap: 8px; pointer-events: none; } .copio-toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: var(--copio-radius-md); background: #0f172a; color: #f8fafc; border: 1px solid var(--copio-color-primary); box-shadow: var(--copio-shadow-elevated); font-size: 12px; font-weight: 500; position: relative; overflow: hidden; transition: opacity 200ms ease-out; } .copio-toast-warning { border-color: #f59e0b; background: #1c1917; color: #fef3c7; } .copio-toast-info { border-color: var(--copio-color-primary); background: #0f172a; color: #f8fafc; } .copio-toast-fade-out { opacity: 0; } .copio-toast-progress { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--copio-color-primary); transition: width 100ms linear; } .copio-toast-undo-btn, .copio-btn-toast-undo { appearance: none; border: 1px solid rgba(56, 189, 248, 0.45); background: rgba(56, 189, 248, 0.16); color: #38bdf8; font-family: inherit; font-size: 12px; font-weight: 700; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); padding: 0 12px; border-radius: var(--copio-radius-sm); cursor: pointer; flex-shrink: 0; } .copio-ocr-content { display: flex; flex-direction: column; gap: 8px; } .copio-ocr-text { margin: 0; padding: 10px; max-height: 180px; overflow: auto; background: var(--copio-color-bg); color: var(--copio-color-text); border: 1px solid var(--copio-color-border); border-radius: var(--copio-radius-sm); font-family: var(--copio-font-mono); font-size: 11px; line-height: 1.5; white-space: pre-wrap; } .copio-ocr-meta { font-size: 11px; color: var(--copio-color-text-muted); } /* Slide-up OCR Extraction Sheet */ .copio-ocr-sheet { position: absolute; inset: auto 0 0 0; max-height: 78%; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-primary); border-radius: 16px 16px 0 0; box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.65); z-index: 25; display: flex; flex-direction: column; padding: 14px; gap: 10px; } .copio-ocr-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .copio-ocr-textarea { width: 100%; min-height: 130px; flex: 1; resize: none; background: var(--copio-color-bg); color: var(--copio-color-text); border: 1px solid var(--copio-color-border); border-radius: var(--copio-radius-sm); padding: 10px; font-family: var(--copio-font-mono); font-size: 11px; line-height: 1.5; } /* Container-Scoped Toast Stack */ .sl-toast-stack, .copio-toast-stack-scoped { position: absolute !important; top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important; width: 100% !important; max-width: 100% !important; padding: var(--copio-spacing-md) !important; box-sizing: border-box !important; z-index: 1000 !important; pointer-events: none; } .sl-toast-stack sl-alert, .copio-toast-stack-scoped sl-alert { pointer-events: auto; margin-top: var(--copio-spacing-sm); } /* ========================================================================== 4. @container BREAKPOINTS (Strictly Container Queries) ========================================================================== */ @container copio-scanner (max-width: 400px) { .copio-header { padding: 6px 10px; min-height: 52px; } .copio-header-left { flex-direction: column; align-items: flex-start; gap: 2px; } .copio-mode-badge { font-size: 10px; padding: 2px 6px; } .copio-subtitle { display: none; } .copio-stage-canvas, .copio-canvas-viewport { min-height: 120px; padding: 10px 12px 24px 12px; } .copio-filmstrip, .copio-filmstrip-bar { gap: 6px; padding: 6px 8px; min-height: 64px; } .copio-toolbar, .copio-controls-dock { gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px; } .copio-tool-btn { font-size: 10px; padding: 3px 4px; } .copio-btn { padding: 0 8px; font-size: 12px; } } @container copio-scanner (min-width: 401px) and (max-width: 767px) { .copio-header { padding: var(--copio-spacing-sm) var(--copio-spacing-md); } .copio-tool-btn { flex-direction: row; font-size: 12px; gap: 6px; } } @container copio-scanner (min-width: 768px) { .copio-header { padding: var(--copio-spacing-md) var(--copio-spacing-lg); } .copio-workbench-main { flex-direction: row; } .copio-filmstrip, .copio-filmstrip-bar { order: -1; flex-direction: column; width: 168px; height: 100%; border-top: none; border-right: 1px solid var(--copio-color-border); overflow-y: auto; overflow-x: hidden; padding: 12px; } .copio-filmstrip-scroll { flex-direction: column; width: 100%; } .copio-thumb-container { width: 112px; height: 140px; } .copio-toolbar, .copio-controls-dock { flex-direction: row; align-items: center; justify-content: space-between; } .copio-toolbar-tools { width: auto; flex: 1; gap: 6px; } .copio-toolbar-tools .copio-tool-btn { flex: 1 1 56px; min-width: var(--copio-touch-target-min); } .copio-toolbar-actions { width: auto; min-width: 200px; } } /* Mobile Handoff Sender Mode (CPO-094) */ .copio-handoff-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(2, 132, 199, 0.16); border: 1px solid rgba(56, 189, 248, 0.35); border-radius: var(--copio-radius-pill); font-size: 11px; font-weight: 600; color: var(--copio-color-text); backdrop-filter: blur(8px); } .copio-handoff-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--copio-color-warning); display: inline-block; flex-shrink: 0; } .copio-handoff-dot.connected { background: var(--copio-color-success); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); } .copio-handoff-dot.connecting, .copio-handoff-dot.reconnecting { background: var(--copio-color-warning); animation: copio-pulse 1.4s ease-in-out infinite; } .copio-handoff-dot.disconnected, .copio-handoff-dot.error { background: var(--copio-color-danger); } .copio-handoff-retry-btn { appearance: none; border: none; background: var(--copio-color-surface-elevated); color: var(--copio-color-text); font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: var(--copio-radius-sm); cursor: pointer; } .copio-handoff-progress-view, .copio-handoff-confirm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--copio-spacing-xl); } .copio-handoff-progress-view { z-index: 50; background: var(--copio-color-surface-overlay, rgba(15, 22, 32, 0.92)); backdrop-filter: blur(12px); } .copio-handoff-confirm { z-index: 60; background: var(--copio-color-bg); } .copio-handoff-progress-card, .copio-handoff-confirm-card { width: 100%; max-width: 340px; background: var(--copio-color-surface); border: 1px solid var(--copio-color-border-strong); border-radius: var(--copio-radius-lg); padding: var(--copio-spacing-xl); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--copio-spacing-md); box-shadow: var(--copio-shadow-elevated); } .copio-handoff-spinner { width: 32px; height: 32px; border: 3px solid rgba(148, 163, 184, 0.2); border-top-color: var(--copio-color-primary); border-radius: 50%; animation: copio-spin 0.8s linear infinite; } .copio-handoff-progress-title, .copio-handoff-confirm-title { font-size: 16px; font-weight: 700; color: var(--copio-color-text); margin: 0; } .copio-handoff-progress-track { width: 100%; height: 8px; background: var(--copio-color-surface-elevated); border-radius: var(--copio-radius-pill); overflow: hidden; border: 1px solid var(--copio-color-border); } .copio-handoff-progress-bar { height: 100%; background: linear-gradient(90deg, var(--copio-color-primary), #0284c7); border-radius: var(--copio-radius-pill); transition: width var(--copio-transition-fast); } .copio-handoff-progress-desc, .copio-handoff-confirm-subtitle { font-size: 12px; color: var(--copio-color-text-muted); margin: 0; } .copio-handoff-confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: rgba(34, 197, 94, 0.15); color: var(--copio-color-success); border: 1px solid rgba(34, 197, 94, 0.35); display: flex; align-items: center; justify-content: center; } .copio-handoff-confirm-badge { display: inline-flex; align-items: center; padding: 4px 12px; background: var(--copio-color-surface-elevated); border: 1px solid var(--copio-color-border); border-radius: var(--copio-radius-pill); font-size: 12px; font-weight: 600; color: var(--copio-color-primary); } .copio-handoff-confirm-actions { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; } `",
|
|
5032
|
+
"default": "` :host { all: initial; display: block; position: relative; width: 100%; height: 100%; min-height: 200px; container-type: size; container-name: copio-scanner; overflow: hidden; contain: layout; box-sizing: border-box; text-align: left; direction: ltr; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; --copio-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; --copio-font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; --copio-color-bg: #0b0f17; --copio-color-surface: #131b26; --copio-color-surface-elevated: #1c2736; --copio-color-surface-overlay: rgba(15, 22, 32, 0.88); --copio-color-stage-bg: #070a0f; --copio-color-text: #f1f5f9; --copio-color-text-muted: #94a3b8; --copio-color-text-inverse: #090d14; --copio-color-primary: #38bdf8; --copio-color-primary-hover: #7dd3fc; --copio-color-primary-contrast: #06131f; --copio-color-success: #22c55e; --copio-color-warning: #f59e0b; --copio-color-danger: #ef4444; --copio-color-border: rgba(148, 163, 184, 0.18); --copio-color-border-strong: rgba(148, 163, 184, 0.34); --copio-focus-ring: 0 0 0 2px #0b0f17, 0 0 0 4px #38bdf8; --copio-radius-sm: 6px; --copio-radius-md: 10px; --copio-radius-lg: 14px; --copio-radius-pill: 9999px; --copio-spacing-xs: 4px; --copio-spacing-sm: 8px; --copio-spacing-md: 12px; --copio-spacing-lg: 16px; --copio-spacing-xl: 24px; --copio-touch-target-min: 44px; --copio-crop-handle-hit: 48px; --copio-crop-handle-visual: 16px; --copio-shadow-elevated: 0 12px 32px -4px rgba(0, 0, 0, 0.55); --copio-transition-fast: 150ms cubic-bezier(0.22, 1, 0.36, 1); --copio-transition-normal: 240ms cubic-bezier(0.22, 1, 0.36, 1); font-family: var(--copio-font-family); font-size: 14px; line-height: 1.5; color: var(--copio-color-text); background-color: var(--copio-color-bg); color-scheme: dark; } :host([theme=\"dark\"]), :host(.copio-theme-dark), :host-context([data-theme=\"dark\"]), :host-context(.sl-theme-dark), :host-context(.theme-dark) { color-scheme: dark; } /* Light Theme Override */ :host([theme=\"light\"]), :host(.copio-theme-light), :host-context([data-theme=\"light\"]), :host-context(.sl-theme-light), :host-context(.theme-light) { --copio-color-bg: #f8fafc; --copio-color-surface: #ffffff; --copio-color-surface-elevated: #f1f5f9; --copio-color-surface-overlay: rgba(255, 255, 255, 0.92); --copio-color-stage-bg: #1e293b; --copio-color-text: #0f172a; --copio-color-text-muted: #475569; --copio-color-text-inverse: #ffffff; --copio-color-primary: #0284c7; --copio-color-primary-hover: #0369a1; --copio-color-primary-contrast: #ffffff; --copio-color-success: #16a34a; --copio-color-warning: #d97706; --copio-color-danger: #dc2626; --copio-color-border: rgba(15, 23, 42, 0.12); --copio-color-border-strong: rgba(15, 23, 42, 0.26); --copio-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0284c7; --copio-radius-sm: 6px; --copio-radius-md: 10px; --copio-radius-lg: 14px; --copio-shadow-elevated: 0 12px 28px -4px rgba(15, 23, 42, 0.18); color-scheme: light; } /* Brand Theme Override (Emerald) */ :host([theme=\"brand\"]), :host(.copio-theme-brand), :host-context([data-theme=\"brand\"]), :host-context(.theme-brand) { --copio-color-bg: #0f111a; --copio-color-surface: #181b28; --copio-color-surface-elevated: #23273a; --copio-color-surface-overlay: rgba(24, 27, 40, 0.90); --copio-color-stage-bg: #090a10; --copio-color-text: #f8fafc; --copio-color-text-muted: #9ca3af; --copio-color-text-inverse: #ffffff; --copio-color-primary: #10b981; --copio-color-primary-hover: #34d399; --copio-color-primary-contrast: #042f2e; --copio-color-success: #10b981; --copio-color-warning: #f59e0b; --copio-color-danger: #ef4444; --copio-color-border: rgba(16, 185, 129, 0.22); --copio-color-border-strong: rgba(16, 185, 129, 0.42); --copio-focus-ring: 0 0 0 2px #0f111a, 0 0 0 4px #10b981; --copio-radius-sm: 4px; --copio-radius-md: 8px; --copio-radius-lg: 12px; --copio-shadow-elevated: 0 12px 32px -4px rgba(0, 0, 0, 0.65); color-scheme: dark; } /* Auto Theme: follows prefers-color-scheme when theme is auto */ @media (prefers-color-scheme: light) { :host([theme=\"auto\"]), :host(.copio-theme-auto) { --copio-color-bg: #f8fafc; --copio-color-surface: #ffffff; --copio-color-surface-elevated: #f1f5f9; --copio-color-surface-overlay: rgba(255, 255, 255, 0.92); --copio-color-stage-bg: #1e293b; --copio-color-text: #0f172a; --copio-color-text-muted: #475569; --copio-color-text-inverse: #ffffff; --copio-color-primary: #0284c7; --copio-color-primary-hover: #0369a1; --copio-color-primary-contrast: #ffffff; --copio-color-success: #16a34a; --copio-color-warning: #d97706; --copio-color-danger: #dc2626; --copio-color-border: rgba(15, 23, 42, 0.12); --copio-color-border-strong: rgba(15, 23, 42, 0.26); --copio-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0284c7; --copio-radius-sm: 6px; --copio-radius-md: 10px; --copio-radius-lg: 14px; --copio-shadow-elevated: 0 12px 28px -4px rgba(15, 23, 42, 0.18); color-scheme: light; } } /* ========================================================================== 2. INTERNAL ELEMENT RESET (Scoped to Shadow DOM) ========================================================================== */ *, *::before, *::after { box-sizing: border-box; } ::slotted(*) { box-sizing: border-box; } /* ========================================================================== 3. ROOT CONTAINER & COMPONENT SHELL ========================================================================== */ .copio-scanner-container { width: 100%; height: 100%; position: relative; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; container-type: size; container-name: copio-scanner; contain: layout; background: var(--copio-color-bg); color: var(--copio-color-text); font-family: var(--copio-font-family); font-size: 14px; line-height: 1.5; text-align: left; direction: ltr; user-select: none; } /* Header (Shadow Part: header) */ .copio-header { display: flex; align-items: center; justify-content: space-between; gap: var(--copio-spacing-sm); padding: var(--copio-spacing-sm) var(--copio-spacing-md); background: var(--copio-color-surface); border-bottom: 1px solid var(--copio-color-border); min-height: 52px; flex-shrink: 0; z-index: 5; box-sizing: border-box; } .copio-header-left { display: flex; align-items: center; gap: var(--copio-spacing-sm); min-width: 0; } .copio-mode-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: var(--copio-radius-pill); background: var(--copio-color-surface-elevated); color: var(--copio-color-primary); border: 1px solid var(--copio-color-border); white-space: nowrap; } .copio-title-group { display: flex; flex-direction: column; min-width: 0; } .copio-title { font-size: 13px; font-weight: 600; color: var(--copio-color-text); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .copio-subtitle { font-size: 11px; color: var(--copio-color-text-muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .copio-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; } /* Interactive Stage Switcher Pill (Viewfinder vs Workbench) */ .copio-stage-tabs { display: inline-flex; background: var(--copio-color-bg); padding: 2px; border-radius: var(--copio-radius-md); border: 1px solid var(--copio-color-border); } .copio-stage-tab { appearance: none; border: none; background: transparent; color: var(--copio-color-text-muted); font-family: inherit; font-size: 11px; font-weight: 600; padding: 6px 10px; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); border-radius: var(--copio-radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background var(--copio-transition-fast), color var(--copio-transition-fast); } .copio-stage-tab[aria-selected=\"true\"] { background: var(--copio-color-surface-elevated); color: var(--copio-color-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); } /* Touch-Safe Interactive Buttons (>=44px touch invariant) */ .copio-btn { appearance: none; border: 1px solid var(--copio-color-border); background: var(--copio-color-surface-elevated); color: var(--copio-color-text); font-family: inherit; font-size: 13px; font-weight: 600; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); padding: 0 12px; border-radius: var(--copio-radius-md); display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; transition: all var(--copio-transition-fast); white-space: nowrap; text-decoration: none; box-sizing: border-box; } .copio-btn:hover { background: var(--copio-color-primary-hover); color: var(--copio-color-primary-contrast); border-color: var(--copio-color-primary); } .copio-btn-primary { background: var(--copio-color-primary); color: var(--copio-color-primary-contrast); border-color: var(--copio-color-primary); } .copio-btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--copio-color-danger); border-color: rgba(239, 68, 68, 0.35); } .copio-btn-danger:hover { background: var(--copio-color-danger); color: #fff; } /* Viewfinder (Shadow Part: viewfinder) */ .copio-viewfinder, .copio-viewfinder-stage { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-between; background: var(--copio-color-stage-bg); overflow: hidden; min-height: 0; width: 100%; } .copio-viewfinder-feed, .copio-camera-feed { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 20px 104px 20px; background: radial-gradient(circle at 50% 45%, #1e293b 0%, #090d14 75%); } .copio-camera-feed.is-shutter-flash::after { content: ''; position: absolute; inset: 0; background: #ffffff; opacity: 0.75; pointer-events: none; z-index: 5; animation: copio-shutter-flash 150ms ease-out forwards; } @keyframes copio-shutter-flash { 0% { opacity: 0.75; } 100% { opacity: 0; } } /* Framing Guide Overlay (receipt | card | a4 | auto) */ .copio-framing-guide { position: relative; display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; border: 1.5px dashed rgba(56, 189, 248, 0.55); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(4, 7, 12, 0.52); transition: all var(--copio-transition-normal); overflow: hidden; } .copio-framing-guide[data-aspect=\"receipt\"] { aspect-ratio: 1 / 2.1; height: 100%; } .copio-framing-guide[data-aspect=\"card\"] { aspect-ratio: 1.586 / 1; width: 92%; max-height: 82%; } .copio-framing-guide[data-aspect=\"a4\"] { aspect-ratio: 1 / 1.414; height: 96%; } .copio-framing-guide[data-aspect=\"auto\"] { width: 94%; height: 94%; } /* Corner Targeting Brackets */ .copio-corner { position: absolute; width: 22px; height: 22px; border-color: var(--copio-color-primary); border-style: solid; border-width: 0; pointer-events: none; z-index: 2; } .copio-corner.tl { top: 6px; left: 6px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 6px; } .copio-corner.tr { top: 6px; right: 6px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 6px; } .copio-corner.bl { bottom: 6px; left: 6px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 6px; } .copio-corner.br { bottom: 6px; right: 6px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 6px; } .copio-edge-quad { position: absolute; inset: 12px; border: 1px solid rgba(56, 189, 248, 0.28); border-radius: 8px; background: rgba(56, 189, 248, 0.04); pointer-events: none; z-index: 1; } /* Live Viewfinder SVG Quad Overlay (CPO-076) */ .copio-live-quad-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; overflow: visible; } .copio-live-quad-polygon { fill: rgba(56, 189, 248, 0.18); stroke: var(--copio-color-primary, #38bdf8); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.45)); } .copio-live-quad-corner { fill: #ffffff; stroke: var(--copio-color-primary, #38bdf8); stroke-width: 2.5; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.4)); } .copio-camera-feed.is-detected .copio-live-quad-polygon { fill: rgba(34, 197, 94, 0.22); stroke: #22c55e; filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.6)); } .copio-camera-feed.is-detected .copio-live-quad-corner { stroke: #22c55e; } .copio-camera-feed.is-tracking .copio-edge-quad { opacity: 0.1; transition: opacity var(--copio-transition-fast); } .copio-camera-placeholder { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; color: var(--copio-color-text-muted); font-size: 12px; font-weight: 500; cursor: pointer; user-select: none; transition: color var(--copio-transition-fast), transform var(--copio-transition-fast); } .copio-camera-placeholder:hover { color: var(--copio-color-text); transform: scale(1.02); } .copio-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--copio-color-primary); box-shadow: 0 0 8px var(--copio-color-primary); flex-shrink: 0; } /* Top Viewfinder HUD Overlay (Step Pill + Privacy Assurance Badge) */ .copio-viewfinder-hud-top { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: linear-gradient(to bottom, rgba(7, 10, 15, 0.85), transparent); } .copio-step-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--copio-radius-pill); background: rgba(15, 23, 42, 0.88); border: 1px solid rgba(56, 189, 248, 0.45); color: #f8fafc; font-size: 12px; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); } .copio-privacy-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: var(--copio-radius-pill); background: rgba(22, 101, 52, 0.35); border: 1px solid rgba(34, 197, 94, 0.4); color: #86efac; font-size: 11px; font-weight: 500; } /* Shutter Dock (Shadow Part: shutter-dock) */ .copio-shutter-dock { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) 16px; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-border); min-height: 84px; flex-shrink: 0; } .copio-shutter-side { flex: 1; display: flex; align-items: center; } .copio-shutter-side.right { justify-content: flex-end; } .copio-shutter-btn { appearance: none; width: 64px; height: 64px; border-radius: var(--copio-radius-pill); border: 4px solid var(--copio-color-primary); background: transparent; padding: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform var(--copio-transition-fast), border-color 150ms ease; flex-shrink: 0; } .copio-shutter-btn:hover { transform: scale(1.04); } .copio-shutter-btn:active { transform: scale(0.94); } .copio-shutter-btn-inner, .copio-shutter-inner { width: 100%; height: 100%; border-radius: var(--copio-radius-pill); background: var(--copio-color-primary); display: flex; align-items: center; justify-content: center; color: var(--copio-color-primary-contrast); transition: transform var(--copio-transition-fast); } .copio-shutter-btn:active .copio-shutter-btn-inner, .copio-shutter-btn:active .copio-shutter-inner { transform: scale(0.88); } /* Stacking Thumbnail Counter Pill in Viewfinder */ .copio-stack-pill { display: inline-flex; align-items: center; gap: 8px; min-height: var(--copio-touch-target-min); padding: 4px 12px 4px 6px; border-radius: var(--copio-radius-md); background: var(--copio-color-surface-elevated); border: 1px solid var(--copio-color-primary); color: var(--copio-color-text); font-size: 12px; font-weight: 600; cursor: pointer; } .copio-stack-thumb { width: 30px; height: 36px; border-radius: 4px; object-fit: cover; border: 1px solid rgba(255, 255, 255, 0.35); background: #000; } /* Workbench & Filmstrip (Shadow Part: workbench) */ .copio-workbench, .copio-workbench-stage { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; background: var(--copio-color-bg); overflow: hidden; min-height: 0; width: 100%; } .copio-workbench-main { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; overflow: hidden; } .copio-stage-canvas, .copio-canvas-viewport { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 16px 20px 44px 20px; background: var(--copio-color-stage-bg); min-height: 180px; } .copio-canvas-viewport.is-cropping { padding: 24px; } .copio-canvas-viewport.has-card-switcher { padding-top: 66px; } /* Card Side Switcher */ .copio-card-side-switcher { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 6; display: inline-flex; gap: 4px; padding: 3px; background: var(--copio-color-surface-overlay, rgba(15, 22, 32, 0.88)); border: 1px solid var(--copio-color-border-strong); border-radius: var(--copio-radius-pill); backdrop-filter: blur(8px); } .copio-side-pill { appearance: none; border: none; background: transparent; color: var(--copio-color-text-muted); font-family: inherit; font-size: 11px; font-weight: 600; padding: 6px 12px; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); border-radius: var(--copio-radius-pill); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; } .copio-side-pill[aria-selected=\"true\"] { background: var(--copio-color-primary); color: var(--copio-color-primary-contrast); } .copio-stage-figure, .copio-canvas-wrapper { position: relative; display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; } .copio-stage-canvas img, .copio-stage-img, .copio-stage-image { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: var(--copio-shadow-elevated); border-radius: var(--copio-radius-sm); user-select: none; } .copio-crop-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 8; touch-action: none; } .copio-crop-box { position: absolute; border: 2px solid var(--copio-color-primary); box-shadow: 0 0 0 9999px rgba(5, 8, 14, 0.68); cursor: move; touch-action: none; box-sizing: border-box; } /* Rule-of-thirds crop grid */ .copio-crop-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(56, 189, 248, 0.28) 1px, transparent 1px), linear-gradient(to bottom, rgba(56, 189, 248, 0.28) 1px, transparent 1px); background-size: 33.333% 33.333%; } /* 48px x 48px Touch Target Handles (exceeds 44px requirement) */ .copio-crop-handle { position: absolute; width: var(--copio-crop-handle-hit); height: var(--copio-crop-handle-hit); min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; z-index: 10; touch-action: none; box-sizing: border-box; } .copio-crop-handle::after { content: ''; width: var(--copio-crop-handle-visual); height: var(--copio-crop-handle-visual); border-radius: 50%; background: var(--copio-color-primary); border: 2.5px solid #ffffff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); transition: transform 120ms ease; box-sizing: border-box; } .copio-crop-handle:hover::after, .copio-crop-handle:active::after { transform: scale(1.25); background: var(--copio-color-success, #22c55e); } .copio-crop-handle.nw { top: -24px; left: -24px; cursor: nwse-resize; } .copio-crop-handle.ne { top: -24px; right: -24px; cursor: nesw-resize; } .copio-crop-handle.sw { bottom: -24px; left: -24px; cursor: nesw-resize; } .copio-crop-handle.se { bottom: -24px; right: -24px; cursor: nwse-resize; } .copio-crop-handle.n, .copio-crop-handle.edge-n { top: -24px; left: calc(50% - 24px); cursor: ns-resize; } .copio-crop-handle.s, .copio-crop-handle.edge-s { bottom: -24px; left: calc(50% - 24px); cursor: ns-resize; } .copio-crop-handle.w, .copio-crop-handle.edge-w { left: -24px; top: calc(50% - 24px); cursor: ew-resize; } .copio-crop-handle.e, .copio-crop-handle.edge-e { right: -24px; top: calc(50% - 24px); cursor: ew-resize; } /* 4-Corner Perspective Quad Crop (CPO-075) */ .copio-crop-quad-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; } .copio-crop-mask { fill: rgba(5, 8, 14, 0.68); } .copio-crop-quad-outline { fill: rgba(56, 189, 248, 0.06); stroke: var(--copio-color-primary); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: auto; cursor: move; } .copio-crop-quad-grid { stroke: rgba(56, 189, 248, 0.35); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; } .copio-quad-handle { transform: translate(-50%, -50%); cursor: grab; } .copio-quad-handle:active { cursor: grabbing; } .copio-crop-magnifier { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 2.5px solid var(--copio-color-primary); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55); pointer-events: none; z-index: 20; display: none; background: #0b0f17; transform: translate(-50%, -125%); } /* Filmstrip & Reorder Tray */ .copio-filmstrip, .copio-filmstrip-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-border); overflow-x: auto; min-height: 80px; flex-shrink: 0; scrollbar-width: thin; } .copio-filmstrip-scroll { display: flex; align-items: center; gap: 8px; } .copio-filmstrip-item { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; } .copio-thumb-container { position: relative; width: 56px; height: 70px; border-radius: var(--copio-radius-sm); overflow: hidden; background: var(--copio-color-surface-elevated, #1c2736); border: 2px solid var(--copio-color-border); cursor: pointer; transition: all var(--copio-transition-fast); display: flex; align-items: center; justify-content: center; } .copio-filmstrip-item.is-active .copio-thumb-container { border-color: var(--copio-color-primary); box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25); } .copio-thumb-num { position: absolute; bottom: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: rgba(15, 23, 42, 0.85); color: #f8fafc; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; } .copio-thumb-reorder { display: flex; align-items: center; gap: 4px; } .copio-reorder-btn { appearance: none; border: 1px solid var(--copio-color-border); background: var(--copio-color-surface-elevated); color: var(--copio-color-text-muted); border-radius: 4px; font-size: 9px; padding: 2px 5px; cursor: pointer; } .copio-reorder-btn:disabled { opacity: 0.35; cursor: not-allowed; } .copio-thumb-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; } /* Edit Action Toolbar & Primary Completion Dock */ .copio-toolbar, .copio-controls-dock { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) 12px; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-border); min-height: 56px; flex-shrink: 0; z-index: 6; } .copio-edit-toolbar, .copio-toolbar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; width: 100%; } .copio-toolbar-tools .copio-tool-btn { flex: 1 1 0; min-width: 0; } .copio-toolbar-actions { display: flex; align-items: center; gap: 8px; width: 100%; flex-shrink: 0; } .copio-toolbar-actions .copio-btn-primary { width: 100%; } .copio-tool-btn { appearance: none; border: 1px solid var(--copio-color-border); background: var(--copio-color-surface-elevated); color: var(--copio-color-text); font-family: inherit; font-size: 11px; font-weight: 600; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); padding: 4px 6px; border-radius: var(--copio-radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; transition: all var(--copio-transition-fast); } .copio-tool-btn:hover:not(:disabled) { border-color: var(--copio-color-border-strong); background: rgba(255, 255, 255, 0.06); } .copio-tool-btn[aria-pressed=\"true\"] { background: rgba(56, 189, 248, 0.16); color: var(--copio-color-primary); border-color: var(--copio-color-primary); } .copio-tool-btn.danger { color: #fca5a5; } .copio-tool-btn.danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.45); } .copio-toast-region { position: absolute; bottom: 124px; left: 12px; right: 12px; z-index: 30; display: flex; flex-direction: column; gap: 8px; pointer-events: none; } .copio-toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: var(--copio-radius-md); background: #0f172a; color: #f8fafc; border: 1px solid var(--copio-color-primary); box-shadow: var(--copio-shadow-elevated); font-size: 12px; font-weight: 500; position: relative; overflow: hidden; transition: opacity 200ms ease-out; } .copio-toast-warning { border-color: #f59e0b; background: #1c1917; color: #fef3c7; } .copio-toast-info { border-color: var(--copio-color-primary); background: #0f172a; color: #f8fafc; } .copio-toast-fade-out { opacity: 0; } .copio-toast-progress { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--copio-color-primary); transition: width 100ms linear; } .copio-toast-undo-btn, .copio-btn-toast-undo { appearance: none; border: 1px solid rgba(56, 189, 248, 0.45); background: rgba(56, 189, 248, 0.16); color: #38bdf8; font-family: inherit; font-size: 12px; font-weight: 700; min-height: var(--copio-touch-target-min); min-width: var(--copio-touch-target-min); padding: 0 12px; border-radius: var(--copio-radius-sm); cursor: pointer; flex-shrink: 0; } .copio-ocr-content { display: flex; flex-direction: column; gap: 8px; } .copio-ocr-text { margin: 0; padding: 10px; max-height: 180px; overflow: auto; background: var(--copio-color-bg); color: var(--copio-color-text); border: 1px solid var(--copio-color-border); border-radius: var(--copio-radius-sm); font-family: var(--copio-font-mono); font-size: 11px; line-height: 1.5; white-space: pre-wrap; } .copio-ocr-meta { font-size: 11px; color: var(--copio-color-text-muted); } /* Slide-up OCR Extraction Sheet */ .copio-ocr-sheet { position: absolute; inset: auto 0 0 0; max-height: 78%; background: var(--copio-color-surface); border-top: 1px solid var(--copio-color-primary); border-radius: 16px 16px 0 0; box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.65); z-index: 25; display: flex; flex-direction: column; padding: 14px; gap: 10px; } .copio-ocr-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .copio-ocr-textarea { width: 100%; min-height: 130px; flex: 1; resize: none; background: var(--copio-color-bg); color: var(--copio-color-text); border: 1px solid var(--copio-color-border); border-radius: var(--copio-radius-sm); padding: 10px; font-family: var(--copio-font-mono); font-size: 11px; line-height: 1.5; } /* Container-Scoped Toast Stack */ .sl-toast-stack, .copio-toast-stack-scoped { position: absolute !important; top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important; width: 100% !important; max-width: 100% !important; padding: var(--copio-spacing-md) !important; box-sizing: border-box !important; z-index: 1000 !important; pointer-events: none; } .sl-toast-stack sl-alert, .copio-toast-stack-scoped sl-alert { pointer-events: auto; margin-top: var(--copio-spacing-sm); } /* ========================================================================== 4. @container BREAKPOINTS (Strictly Container Queries) ========================================================================== */ @container copio-scanner (max-width: 400px) { .copio-header { padding: 6px 10px; min-height: 52px; } .copio-header-left { flex-direction: column; align-items: flex-start; gap: 2px; } .copio-mode-badge { font-size: 10px; padding: 2px 6px; } .copio-subtitle { display: none; } .copio-stage-canvas, .copio-canvas-viewport { min-height: 120px; padding: 12px; } .copio-canvas-viewport.is-cropping { padding: 20px; } .copio-filmstrip, .copio-filmstrip-bar { gap: 6px; padding: 6px 8px; min-height: 64px; } .copio-toolbar, .copio-controls-dock { gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px; } .copio-tool-btn { font-size: 10px; padding: 3px 4px; } .copio-btn { padding: 0 8px; font-size: 12px; } } @container copio-scanner (min-width: 401px) and (max-width: 767px) { .copio-header { padding: var(--copio-spacing-sm) var(--copio-spacing-md); } .copio-tool-btn { flex-direction: row; font-size: 12px; gap: 6px; } } @container copio-scanner (min-width: 768px) { .copio-header { padding: var(--copio-spacing-md) var(--copio-spacing-lg); } .copio-workbench-main { flex-direction: row; } .copio-filmstrip, .copio-filmstrip-bar { order: -1; flex-direction: column; width: 168px; height: 100%; border-top: none; border-right: 1px solid var(--copio-color-border); overflow-y: auto; overflow-x: hidden; padding: 12px; } .copio-filmstrip-scroll { flex-direction: column; width: 100%; } .copio-thumb-container { width: 112px; height: 140px; } .copio-toolbar, .copio-controls-dock { flex-direction: row; align-items: center; justify-content: space-between; } .copio-toolbar-tools { width: auto; flex: 1; gap: 6px; } .copio-toolbar-tools .copio-tool-btn { flex: 1 1 56px; min-width: var(--copio-touch-target-min); } .copio-toolbar-actions { width: auto; min-width: 200px; } } /* Mobile Handoff Sender Mode (CPO-094) */ .copio-handoff-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(2, 132, 199, 0.16); border: 1px solid rgba(56, 189, 248, 0.35); border-radius: var(--copio-radius-pill); font-size: 11px; font-weight: 600; color: var(--copio-color-text); backdrop-filter: blur(8px); } .copio-handoff-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--copio-color-warning); display: inline-block; flex-shrink: 0; } .copio-handoff-dot.connected { background: var(--copio-color-success); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); } .copio-handoff-dot.connecting, .copio-handoff-dot.reconnecting { background: var(--copio-color-warning); animation: copio-pulse 1.4s ease-in-out infinite; } .copio-handoff-dot.disconnected, .copio-handoff-dot.error { background: var(--copio-color-danger); } .copio-handoff-retry-btn { appearance: none; border: none; background: var(--copio-color-surface-elevated); color: var(--copio-color-text); font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: var(--copio-radius-sm); cursor: pointer; } .copio-handoff-progress-view, .copio-handoff-confirm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--copio-spacing-xl); } .copio-handoff-progress-view { z-index: 50; background: var(--copio-color-surface-overlay, rgba(15, 22, 32, 0.92)); backdrop-filter: blur(12px); } .copio-handoff-confirm { z-index: 60; background: var(--copio-color-bg); } .copio-handoff-progress-card, .copio-handoff-confirm-card { width: 100%; max-width: 340px; background: var(--copio-color-surface); border: 1px solid var(--copio-color-border-strong); border-radius: var(--copio-radius-lg); padding: var(--copio-spacing-xl); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--copio-spacing-md); box-shadow: var(--copio-shadow-elevated); } .copio-handoff-spinner { width: 32px; height: 32px; border: 3px solid rgba(148, 163, 184, 0.2); border-top-color: var(--copio-color-primary); border-radius: 50%; animation: copio-spin 0.8s linear infinite; } .copio-handoff-progress-title, .copio-handoff-confirm-title { font-size: 16px; font-weight: 700; color: var(--copio-color-text); margin: 0; } .copio-handoff-progress-track { width: 100%; height: 8px; background: var(--copio-color-surface-elevated); border-radius: var(--copio-radius-pill); overflow: hidden; border: 1px solid var(--copio-color-border); } .copio-handoff-progress-bar { height: 100%; background: linear-gradient(90deg, var(--copio-color-primary), #0284c7); border-radius: var(--copio-radius-pill); transition: width var(--copio-transition-fast); } .copio-handoff-progress-desc, .copio-handoff-confirm-subtitle { font-size: 12px; color: var(--copio-color-text-muted); margin: 0; } .copio-handoff-confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: rgba(34, 197, 94, 0.15); color: var(--copio-color-success); border: 1px solid rgba(34, 197, 94, 0.35); display: flex; align-items: center; justify-content: center; } .copio-handoff-confirm-badge { display: inline-flex; align-items: center; padding: 4px 12px; background: var(--copio-color-surface-elevated); border: 1px solid var(--copio-color-border); border-radius: var(--copio-radius-pill); font-size: 12px; font-weight: 600; color: var(--copio-color-primary); } .copio-handoff-confirm-actions { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; } `",
|
|
5033
5033
|
"description": "Copio Scanner Encapsulated Styles & Design Tokens (CPO-032 / CPO-038)\n\nProvides constructable stylesheets and adoptedStyleSheets architecture for <copio-scanner>\nwith complete Shadow DOM style encapsulation, zero global leakage, and hostile host immunity."
|
|
5034
5034
|
},
|
|
5035
5035
|
{
|
|
@@ -5133,7 +5133,7 @@
|
|
|
5133
5133
|
"type": {
|
|
5134
5134
|
"text": "string"
|
|
5135
5135
|
},
|
|
5136
|
-
"default": "'0.1.
|
|
5136
|
+
"default": "'0.1.7'"
|
|
5137
5137
|
}
|
|
5138
5138
|
],
|
|
5139
5139
|
"exports": [
|
|
@@ -5155,6 +5155,69 @@
|
|
|
5155
5155
|
}
|
|
5156
5156
|
]
|
|
5157
5157
|
},
|
|
5158
|
+
{
|
|
5159
|
+
"kind": "javascript-module",
|
|
5160
|
+
"path": "js/routes/sync/copio-sync-dialog.js",
|
|
5161
|
+
"declarations": [
|
|
5162
|
+
{
|
|
5163
|
+
"kind": "class",
|
|
5164
|
+
"description": "",
|
|
5165
|
+
"name": "CopioSyncDialog",
|
|
5166
|
+
"members": [
|
|
5167
|
+
{
|
|
5168
|
+
"kind": "field",
|
|
5169
|
+
"name": "handleCloseClick"
|
|
5170
|
+
},
|
|
5171
|
+
{
|
|
5172
|
+
"kind": "field",
|
|
5173
|
+
"name": "closeSyncDialog"
|
|
5174
|
+
},
|
|
5175
|
+
{
|
|
5176
|
+
"kind": "field",
|
|
5177
|
+
"name": "syncState",
|
|
5178
|
+
"privacy": "public",
|
|
5179
|
+
"type": {
|
|
5180
|
+
"text": "object"
|
|
5181
|
+
},
|
|
5182
|
+
"attribute": "syncState"
|
|
5183
|
+
}
|
|
5184
|
+
],
|
|
5185
|
+
"attributes": [
|
|
5186
|
+
{
|
|
5187
|
+
"name": "syncState",
|
|
5188
|
+
"type": {
|
|
5189
|
+
"text": "object"
|
|
5190
|
+
},
|
|
5191
|
+
"fieldName": "syncState"
|
|
5192
|
+
}
|
|
5193
|
+
],
|
|
5194
|
+
"superclass": {
|
|
5195
|
+
"name": "LitElement",
|
|
5196
|
+
"module": "/js/lib/lit-core.min.js"
|
|
5197
|
+
},
|
|
5198
|
+
"tagName": "copio-sync-dialog",
|
|
5199
|
+
"customElement": true
|
|
5200
|
+
}
|
|
5201
|
+
],
|
|
5202
|
+
"exports": [
|
|
5203
|
+
{
|
|
5204
|
+
"kind": "js",
|
|
5205
|
+
"name": "CopioSyncDialog",
|
|
5206
|
+
"declaration": {
|
|
5207
|
+
"name": "CopioSyncDialog",
|
|
5208
|
+
"module": "js/routes/sync/copio-sync-dialog.js"
|
|
5209
|
+
}
|
|
5210
|
+
},
|
|
5211
|
+
{
|
|
5212
|
+
"kind": "custom-element-definition",
|
|
5213
|
+
"name": "copio-sync-dialog",
|
|
5214
|
+
"declaration": {
|
|
5215
|
+
"name": "CopioSyncDialog",
|
|
5216
|
+
"module": "js/routes/sync/copio-sync-dialog.js"
|
|
5217
|
+
}
|
|
5218
|
+
}
|
|
5219
|
+
]
|
|
5220
|
+
},
|
|
5158
5221
|
{
|
|
5159
5222
|
"kind": "javascript-module",
|
|
5160
5223
|
"path": "js/routes/ocr/copio-doc-ocr-dialog.js",
|
|
@@ -5544,69 +5607,6 @@
|
|
|
5544
5607
|
}
|
|
5545
5608
|
}
|
|
5546
5609
|
]
|
|
5547
|
-
},
|
|
5548
|
-
{
|
|
5549
|
-
"kind": "javascript-module",
|
|
5550
|
-
"path": "js/routes/sync/copio-sync-dialog.js",
|
|
5551
|
-
"declarations": [
|
|
5552
|
-
{
|
|
5553
|
-
"kind": "class",
|
|
5554
|
-
"description": "",
|
|
5555
|
-
"name": "CopioSyncDialog",
|
|
5556
|
-
"members": [
|
|
5557
|
-
{
|
|
5558
|
-
"kind": "field",
|
|
5559
|
-
"name": "handleCloseClick"
|
|
5560
|
-
},
|
|
5561
|
-
{
|
|
5562
|
-
"kind": "field",
|
|
5563
|
-
"name": "closeSyncDialog"
|
|
5564
|
-
},
|
|
5565
|
-
{
|
|
5566
|
-
"kind": "field",
|
|
5567
|
-
"name": "syncState",
|
|
5568
|
-
"privacy": "public",
|
|
5569
|
-
"type": {
|
|
5570
|
-
"text": "object"
|
|
5571
|
-
},
|
|
5572
|
-
"attribute": "syncState"
|
|
5573
|
-
}
|
|
5574
|
-
],
|
|
5575
|
-
"attributes": [
|
|
5576
|
-
{
|
|
5577
|
-
"name": "syncState",
|
|
5578
|
-
"type": {
|
|
5579
|
-
"text": "object"
|
|
5580
|
-
},
|
|
5581
|
-
"fieldName": "syncState"
|
|
5582
|
-
}
|
|
5583
|
-
],
|
|
5584
|
-
"superclass": {
|
|
5585
|
-
"name": "LitElement",
|
|
5586
|
-
"module": "/js/lib/lit-core.min.js"
|
|
5587
|
-
},
|
|
5588
|
-
"tagName": "copio-sync-dialog",
|
|
5589
|
-
"customElement": true
|
|
5590
|
-
}
|
|
5591
|
-
],
|
|
5592
|
-
"exports": [
|
|
5593
|
-
{
|
|
5594
|
-
"kind": "js",
|
|
5595
|
-
"name": "CopioSyncDialog",
|
|
5596
|
-
"declaration": {
|
|
5597
|
-
"name": "CopioSyncDialog",
|
|
5598
|
-
"module": "js/routes/sync/copio-sync-dialog.js"
|
|
5599
|
-
}
|
|
5600
|
-
},
|
|
5601
|
-
{
|
|
5602
|
-
"kind": "custom-element-definition",
|
|
5603
|
-
"name": "copio-sync-dialog",
|
|
5604
|
-
"declaration": {
|
|
5605
|
-
"name": "CopioSyncDialog",
|
|
5606
|
-
"module": "js/routes/sync/copio-sync-dialog.js"
|
|
5607
|
-
}
|
|
5608
|
-
}
|
|
5609
|
-
]
|
|
5610
5610
|
}
|
|
5611
5611
|
]
|
|
5612
5612
|
}
|