@paperless/core 1.26.6 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -2
- package/dist/build/p-2786d383.entry.js +2 -0
- package/dist/build/{p-e33a73c2.entry.js.map → p-2786d383.entry.js.map} +1 -1
- package/dist/build/p-34bddc72.entry.js +2 -0
- package/dist/build/p-34bddc72.entry.js.map +1 -0
- package/dist/build/p-3ea2d7a2.entry.js +2 -0
- package/dist/build/{p-f34e08ec.entry.js.map → p-3ea2d7a2.entry.js.map} +1 -1
- package/dist/build/p-6cbe8dc8.entry.js +2 -0
- package/dist/build/{p-f6c6919a.entry.js.map → p-6cbe8dc8.entry.js.map} +1 -1
- package/dist/{paperless/p-424d5c8a.entry.js → build/p-7bf042c9.entry.js} +2 -2
- package/dist/{paperless/p-424d5c8a.entry.js.map → build/p-7bf042c9.entry.js.map} +1 -1
- package/dist/build/p-b848c222.entry.js +2 -0
- package/dist/{paperless/p-3a6efecd.entry.js.map → build/p-b848c222.entry.js.map} +1 -1
- package/dist/build/p-d8641c29.entry.js +2 -0
- package/dist/build/{p-d23db949.entry.js.map → p-d8641c29.entry.js.map} +1 -1
- package/dist/build/p-fe39443a.entry.js +2 -0
- package/dist/build/{p-b6f43309.entry.js.map → p-fe39443a.entry.js.map} +1 -1
- package/dist/build/paperless.css +1 -1
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/p-avatar.cjs.entry.js +1 -1
- package/dist/cjs/p-avatar.cjs.entry.js.map +1 -1
- package/dist/cjs/p-backdrop.cjs.entry.js +1 -1
- package/dist/cjs/p-backdrop.cjs.entry.js.map +1 -1
- package/dist/cjs/p-cropper.cjs.entry.js +1 -1
- package/dist/cjs/p-cropper.cjs.entry.js.map +1 -1
- package/dist/cjs/p-dropdown_2.cjs.entry.js +1 -1
- package/dist/cjs/p-dropdown_2.cjs.entry.js.map +1 -1
- package/dist/cjs/p-layout.cjs.entry.js +2 -2
- package/dist/cjs/p-layout.cjs.entry.js.map +1 -1
- package/dist/cjs/p-modal-body_4.cjs.entry.js +1 -1
- package/dist/cjs/p-modal-body_4.cjs.entry.js.map +1 -1
- package/dist/cjs/p-stepper-item.cjs.entry.js +1 -1
- package/dist/cjs/p-stepper-item.cjs.entry.js.map +1 -1
- package/dist/cjs/p-stepper-line.cjs.entry.js +1 -1
- package/dist/cjs/p-stepper-line.cjs.entry.js.map +1 -1
- package/dist/collection/components/atoms/avatar/avatar.component.css +1 -1
- package/dist/collection/components/atoms/backdrop/backdrop.component.css +1 -1
- package/dist/collection/components/atoms/dropdown-menu-item/dropdown-menu-item.component.css +1 -1
- package/dist/collection/components/atoms/layout/layout.component.css +1 -1
- package/dist/collection/components/atoms/layout/layout.component.js +1 -1
- package/dist/collection/components/atoms/layout/layout.component.js.map +1 -1
- package/dist/collection/components/atoms/modal-container/modal-container.component.css +1 -1
- package/dist/collection/components/atoms/stepper-item/stepper-item.component.css +1 -1
- package/dist/collection/components/atoms/stepper-line/stepper-line.component.css +1 -1
- package/dist/collection/components/molecules/cropper/cropper.component.css +1 -1
- package/dist/components/avatar.component.js +1 -1
- package/dist/components/avatar.component.js.map +1 -1
- package/dist/components/backdrop.component.js +1 -1
- package/dist/components/backdrop.component.js.map +1 -1
- package/dist/components/dropdown-menu-item.component.js +1 -1
- package/dist/components/dropdown-menu-item.component.js.map +1 -1
- package/dist/components/modal-container.component.js +1 -1
- package/dist/components/modal-container.component.js.map +1 -1
- package/dist/components/p-cropper.js +1 -1
- package/dist/components/p-cropper.js.map +1 -1
- package/dist/components/p-layout.js +2 -2
- package/dist/components/p-layout.js.map +1 -1
- package/dist/components/p-stepper-item.js +1 -1
- package/dist/components/p-stepper-item.js.map +1 -1
- package/dist/components/stepper-line.component.js +1 -1
- package/dist/components/stepper-line.component.js.map +1 -1
- package/dist/esm/p-avatar.entry.js +1 -1
- package/dist/esm/p-avatar.entry.js.map +1 -1
- package/dist/esm/p-backdrop.entry.js +1 -1
- package/dist/esm/p-backdrop.entry.js.map +1 -1
- package/dist/esm/p-cropper.entry.js +1 -1
- package/dist/esm/p-cropper.entry.js.map +1 -1
- package/dist/esm/p-dropdown_2.entry.js +1 -1
- package/dist/esm/p-dropdown_2.entry.js.map +1 -1
- package/dist/esm/p-layout.entry.js +2 -2
- package/dist/esm/p-layout.entry.js.map +1 -1
- package/dist/esm/p-modal-body_4.entry.js +1 -1
- package/dist/esm/p-modal-body_4.entry.js.map +1 -1
- package/dist/esm/p-stepper-item.entry.js +1 -1
- package/dist/esm/p-stepper-item.entry.js.map +1 -1
- package/dist/esm/p-stepper-line.entry.js +1 -1
- package/dist/esm/p-stepper-line.entry.js.map +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/p-2786d383.entry.js +2 -0
- package/dist/paperless/{p-e33a73c2.entry.js.map → p-2786d383.entry.js.map} +1 -1
- package/dist/paperless/p-34bddc72.entry.js +2 -0
- package/dist/paperless/p-34bddc72.entry.js.map +1 -0
- package/dist/paperless/p-3ea2d7a2.entry.js +2 -0
- package/dist/paperless/{p-f34e08ec.entry.js.map → p-3ea2d7a2.entry.js.map} +1 -1
- package/dist/paperless/p-6cbe8dc8.entry.js +2 -0
- package/dist/paperless/{p-f6c6919a.entry.js.map → p-6cbe8dc8.entry.js.map} +1 -1
- package/dist/{build/p-424d5c8a.entry.js → paperless/p-7bf042c9.entry.js} +2 -2
- package/dist/{build/p-424d5c8a.entry.js.map → paperless/p-7bf042c9.entry.js.map} +1 -1
- package/dist/paperless/p-b848c222.entry.js +2 -0
- package/dist/{build/p-3a6efecd.entry.js.map → paperless/p-b848c222.entry.js.map} +1 -1
- package/dist/paperless/p-d8641c29.entry.js +2 -0
- package/dist/paperless/{p-d23db949.entry.js.map → p-d8641c29.entry.js.map} +1 -1
- package/dist/paperless/p-fe39443a.entry.js +2 -0
- package/dist/paperless/{p-b6f43309.entry.js.map → p-fe39443a.entry.js.map} +1 -1
- package/dist/paperless/paperless.css +249 -27
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/hydrate/index.js +9 -9
- package/package.json +2 -2
- package/dist/build/p-3a6efecd.entry.js +0 -2
- package/dist/build/p-4cc872f7.entry.js +0 -2
- package/dist/build/p-4cc872f7.entry.js.map +0 -1
- package/dist/build/p-b6f43309.entry.js +0 -2
- package/dist/build/p-d23db949.entry.js +0 -2
- package/dist/build/p-e33a73c2.entry.js +0 -2
- package/dist/build/p-f34e08ec.entry.js +0 -2
- package/dist/build/p-f6c6919a.entry.js +0 -2
- package/dist/paperless/p-3a6efecd.entry.js +0 -2
- package/dist/paperless/p-4cc872f7.entry.js +0 -2
- package/dist/paperless/p-4cc872f7.entry.js.map +0 -1
- package/dist/paperless/p-b6f43309.entry.js +0 -2
- package/dist/paperless/p-d23db949.entry.js +0 -2
- package/dist/paperless/p-e33a73c2.entry.js +0 -2
- package/dist/paperless/p-f34e08ec.entry.js +0 -2
- package/dist/paperless/p-f6c6919a.entry.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{r as t,c as s,h as i,H as e}from"./p-e4d5e7a7.js";function n(t){var s,i,e="";if("string"==typeof t||"number"==typeof t)e+=t;else if("object"==typeof t)if(Array.isArray(t))for(s=0;s<t.length;s++)t[s]&&(i=n(t[s]))&&(e&&(e+=" "),e+=i);else for(s in t)t[s]&&(e&&(e+=" "),e+=s);return e}function o(){for(var t,s,i=0,e="";i<arguments.length;)(t=arguments[i++])&&(s=n(t))&&(e&&(e+=" "),e+=s);return e}const h=typeof window!=="undefined"&&typeof window.document!=="undefined";const r=h?window:{};const a=h?"ontouchstart"in r.document.documentElement:false;const c=h?"PointerEvent"in r:false;const l="cropper";const u=`${l}-canvas`;const f=`${l}-crosshair`;const p=`${l}-grid`;const d=`${l}-handle`;const b=`${l}-image`;const m=`${l}-selection`;const g=`${l}-shade`;const w=`${l}-viewer`;const v="select";const $="move";const k="scale";const y="rotate";const x="transform";const z="none";const M="n-resize";const C="e-resize";const A="s-resize";const j="w-resize";const O="ne-resize";const S="nw-resize";const T="se-resize";const E="sw-resize";const I="action";const N=a?"touchend touchcancel":"mouseup";const X=a?"touchmove":"mousemove";const Y=a?"touchstart":"mousedown";const R=c?"pointerdown":Y;const W=c?"pointermove":X;const P=c?"pointerup pointercancel":N;const _="error";const D="keydown";const L="load";const H="wheel";const B="action";const F="actionend";const U="actionmove";const K="actionstart";const Z="change";const q="transform";function G(t){return typeof t==="string"}const J=Number.isNaN||r.isNaN;function Q(t){return typeof t==="number"&&!J(t)}function V(t){return Q(t)&&t>0&&t<Infinity}function tt(t){return typeof t==="undefined"}function st(t){return typeof t==="object"&&t!==null}const{hasOwnProperty:it}=Object.prototype;function et(t){if(!st(t)){return false}try{const{constructor:s}=t;const{prototype:i}=s;return s&&i&&it.call(i,"isPrototypeOf")}catch(t){return false}}function nt(t){return typeof t==="function"}function ot(t){return typeof t==="object"&&t!==null&&t.nodeType===1}const ht=/([a-z\d])([A-Z])/g;function rt(t){return String(t).replace(ht,"$1-$2").toLowerCase()}const at=/-[A-z\d]/g;function ct(t){return t.replace(at,(t=>t.slice(1).toUpperCase()))}const lt=/\s\s*/;function ut(t,s,i,e){s.trim().split(lt).forEach((s=>{t.removeEventListener(s,i,e)}))}function ft(t,s,i,e){s.trim().split(lt).forEach((s=>{t.addEventListener(s,i,e)}))}function pt(t,s,i,e){ft(t,s,i,Object.assign(Object.assign({},e),{once:true}))}const dt={bubbles:true,cancelable:true,composed:true};function bt(t,s,i,e){return t.dispatchEvent(new CustomEvent(s,Object.assign(Object.assign(Object.assign({},dt),{detail:i}),e)))}const mt=Promise.resolve();function gt(t,s){return s?mt.then(t?s.bind(t):s):mt}function wt(t){const{documentElement:s}=t.ownerDocument;const i=t.getBoundingClientRect();return{left:i.left+(r.pageXOffset-s.clientLeft),top:i.top+(r.pageYOffset-s.clientTop)}}const vt=/deg|g?rad|turn$/i;function $t(t){const s=parseFloat(t)||0;if(s!==0){const[i="rad"]=String(t).match(vt)||[];switch(i.toLowerCase()){case"deg":return s/360*(Math.PI*2);case"grad":return s/400*(Math.PI*2);case"turn":return s*(Math.PI*2)}}return s}const kt="contain";const yt="cover";function xt(t,s=kt){const{aspectRatio:i}=t;let{width:e,height:n}=t;const o=V(e);const h=V(n);if(o&&h){const t=n*i;if(s===kt&&t>e||s===yt&&t<e){n=e/i}else{e=n*i}}else if(o){n=e/i}else if(h){e=n*i}return{width:e,height:n}}function zt(t,...s){if(s.length===0){return t}const[i,e,n,o,h,r]=t;const[a,c,l,u,f,p]=s[0];t=[i*a+n*c,e*a+o*c,i*l+n*u,e*l+o*u,i*f+n*p+h,e*f+o*p+r];return zt(t,...s.slice(1))}var Mt=`:host([hidden]){display:none!important}`;const Ct=/left|top|width|height/i;const At="open";const jt=new WeakMap;const Ot=new WeakMap;const St=new Map;const Tt=r.document&&Array.isArray(r.document.adoptedStyleSheets)&&"replaceSync"in r.CSSStyleSheet.prototype;class Et extends HTMLElement{get $sharedStyle(){return`${this.themeColor?`:host{--theme-color: ${this.themeColor};}`:""}${Mt}`}constructor(){var t,s;super();this.shadowRootMode=At;this.slottable=true;const i=(s=(t=Object.getPrototypeOf(this))===null||t===void 0?void 0:t.constructor)===null||s===void 0?void 0:s.$name;if(i){St.set(i,this.tagName.toLowerCase())}}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(t,s,i){if(Object.is(i,s)){return}const e=ct(t);const n=this[e];let o=i;switch(typeof n){case"boolean":o=i!==null&&i!=="false";break;case"number":o=Number(i);break}this[e]=o;switch(t){case"theme-color":{const t=Ot.get(this);const s=this.$sharedStyle;if(t&&s){if(Tt){t.replaceSync(s)}else{t.textContent=s}}break}}}$propertyChangedCallback(t,s,i){if(Object.is(i,s)){return}t=rt(t);switch(typeof i){case"boolean":if(i===true){if(!this.hasAttribute(t)){this.setAttribute(t,"")}}else{this.removeAttribute(t)}break;case"number":if(J(i)){i=""}else{i=String(i)}default:if(i){if(this.getAttribute(t)!==i){this.setAttribute(t,i)}}else{this.removeAttribute(t)}}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach((t=>{const s=ct(t);let i=this[s];if(!tt(i)){this.$propertyChangedCallback(s,undefined,i)}Object.defineProperty(this,s,{enumerable:true,configurable:true,get(){return i},set(t){const e=i;i=t;this.$propertyChangedCallback(s,e,t)}})}));const t=this.attachShadow({mode:this.shadowRootMode||At});if(!this.shadowRoot){jt.set(this,t)}Ot.set(this,this.$addStyles(this.$sharedStyle));if(this.$style){this.$addStyles(this.$style)}if(this.$template){const s=document.createElement("template");s.innerHTML=this.$template;t.appendChild(s.content)}if(this.slottable){const s=document.createElement("slot");t.appendChild(s)}}disconnectedCallback(){if(Ot.has(this)){Ot.delete(this)}if(jt.has(this)){jt.delete(this)}}$getTagNameOf(t){var s;return(s=St.get(t))!==null&&s!==void 0?s:t}$setStyles(t){Object.keys(t).forEach((s=>{let i=t[s];if(Q(i)){if(i!==0&&Ct.test(s)){i=`${i}px`}else{i=String(i)}}this.style[s]=i}));return this}$getShadowRoot(){return this.shadowRoot||jt.get(this)}$addStyles(t){let s;const i=this.$getShadowRoot();if(Tt){s=new CSSStyleSheet;s.replaceSync(t);i.adoptedStyleSheets=i.adoptedStyleSheets.concat(s)}else{s=document.createElement("style");s.textContent=t;i.appendChild(s)}return s}$emit(t,s,i){return bt(this,t,s,i)}$nextTick(t){return gt(this,t)}static $define(t,s){if(st(t)){s=t;t=""}if(!t){t=this.$name||this.name}t=rt(t);if(h&&r.customElements&&!r.customElements.get(t)){customElements.define(t,this,s)}}}Et.$version="2.0.0-beta.4";var It=`:host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}`;class Nt extends Et{constructor(){super(...arguments);this.$onPointerDown=null;this.$onPointerMove=null;this.$onPointerUp=null;this.$onWheel=null;this.$wheeling=false;this.$pointers=new Map;this.$style=It;this.$action=z;this.background=false;this.disabled=false;this.scaleStep=.1;this.themeColor="#39f"}static get observedAttributes(){return super.observedAttributes.concat(["background","disabled","scale-step"])}connectedCallback(){super.connectedCallback();if(!this.disabled){this.$bind()}}disconnectedCallback(){if(!this.disabled){this.$unbind()}super.disconnectedCallback()}$propertyChangedCallback(t,s,i){if(Object.is(i,s)){return}super.$propertyChangedCallback(t,s,i);switch(t){case"disabled":if(i){this.$unbind()}else{this.$bind()}break}}$bind(){if(!this.$onPointerDown){this.$onPointerDown=this.$handlePointerDown.bind(this);ft(this,R,this.$onPointerDown)}if(!this.$onPointerMove){this.$onPointerMove=this.$handlePointerMove.bind(this);ft(this.ownerDocument,W,this.$onPointerMove)}if(!this.$onPointerUp){this.$onPointerUp=this.$handlePointerUp.bind(this);ft(this.ownerDocument,P,this.$onPointerUp)}if(!this.$onWheel){this.$onWheel=this.$handleWheel.bind(this);ft(this,H,this.$onWheel,{passive:false,capture:true})}}$unbind(){if(this.$onPointerDown){ut(this,R,this.$onPointerDown);this.$onPointerDown=null}if(this.$onPointerMove){ut(this.ownerDocument,W,this.$onPointerMove);this.$onPointerMove=null}if(this.$onPointerUp){ut(this.ownerDocument,P,this.$onPointerUp);this.$onPointerUp=null}if(this.$onWheel){ut(this,H,this.$onWheel,{capture:true});this.$onWheel=null}}$handlePointerDown(t){const{buttons:s,button:i,type:e}=t;if(this.disabled||(e==="pointerdown"&&t.pointerType==="mouse"||e==="mousedown")&&(Q(s)&&s!==1||Q(i)&&i!==0||t.ctrlKey)){return}const{$pointers:n}=this;let o="";if(t.changedTouches){Array.from(t.changedTouches).forEach((({identifier:t,pageX:s,pageY:i})=>{n.set(t,{startX:s,startY:i,endX:s,endY:i})}))}else{const{pointerId:s=0,pageX:i,pageY:e}=t;n.set(s,{startX:i,startY:e,endX:i,endY:e})}if(n.size>1){o=x}else if(ot(t.target)){o=t.target.action||t.target.getAttribute(I)||""}if(this.$emit(K,{action:o,relatedEvent:t})===false){return}t.preventDefault();this.$action=o;this.style.willChange="transform"}$handlePointerMove(t){const{$action:s,$pointers:i}=this;if(this.disabled||s===z||i.size===0){return}if(this.$emit(U,{action:s,relatedEvent:t})===false){return}t.preventDefault();if(t.changedTouches){Array.from(t.changedTouches).forEach((({identifier:t,pageX:s,pageY:e})=>{const n=i.get(t);if(n){Object.assign(n,{endX:s,endY:e})}}))}else{const{pointerId:s=0,pageX:e,pageY:n}=t;const o=i.get(s);if(o){Object.assign(o,{endX:e,endY:n})}}const e={action:s,relatedEvent:t};if(s===x){const s=new Map(i);let n=0;let o=0;let h=0;let r=0;let a=t.pageX;let c=t.pageY;i.forEach(((t,i)=>{s.delete(i);s.forEach((s=>{let i=s.startX-t.startX;let e=s.startY-t.startY;let l=s.endX-t.endX;let u=s.endY-t.endY;let f=0;let p=0;let d=0;let b=0;if(i===0){if(e<0){d=Math.PI*2}else if(e>0){d=Math.PI}}else if(i>0){d=Math.PI/2+Math.atan(e/i)}else if(i<0){d=Math.PI*1.5+Math.atan(e/i)}if(l===0){if(u<0){b=Math.PI*2}else if(u>0){b=Math.PI}}else if(l>0){b=Math.PI/2+Math.atan(u/l)}else if(l<0){b=Math.PI*1.5+Math.atan(u/l)}if(b>0||d>0){const i=b-d;const e=Math.abs(i);if(e>n){n=e;h=i;a=(t.startX+s.startX)/2;c=(t.startY+s.startY)/2}}i=Math.abs(i);e=Math.abs(e);l=Math.abs(l);u=Math.abs(u);if(i>0&&e>0){f=Math.sqrt(i*i+e*e)}else if(i>0){f=i}else if(e>0){f=e}if(l>0&&u>0){p=Math.sqrt(l*l+u*u)}else if(l>0){p=l}else if(u>0){p=u}if(f>0&&p>0){const i=(p-f)/f;const e=Math.abs(i);if(e>o){o=e;r=i;a=(t.startX+s.startX)/2;c=(t.startY+s.startY)/2}}}))}));const l=n>0;const u=o>0;if(l&&u){e.rotate=h;e.scale=r;e.centerX=a;e.centerY=c}else if(l){e.action=y;e.rotate=h;e.centerX=a;e.centerY=c}else if(u){e.action=k;e.scale=r;e.centerX=a;e.centerY=c}else{e.action=z}}else{const[t]=Array.from(i.values());Object.assign(e,t)}i.forEach((t=>{t.startX=t.endX;t.startY=t.endY}));if(e.action!==z){this.$emit(B,e,{cancelable:false})}}$handlePointerUp(t){const{$action:s,$pointers:i}=this;if(this.disabled||s===z){return}if(this.$emit(F,{action:s,relatedEvent:t})===false){return}t.preventDefault();if(t.changedTouches){Array.from(t.changedTouches).forEach((({identifier:t})=>{i.delete(t)}))}else{const{pointerId:s=0}=t;i.delete(s)}if(i.size===0){this.style.willChange="";this.$action=z}}$handleWheel(t){if(this.disabled){return}t.preventDefault();if(this.$wheeling){return}this.$wheeling=true;setTimeout((()=>{this.$wheeling=false}),50);const s=t.deltaY>0?-1:1;const i=s*this.scaleStep;this.$emit(B,{action:k,scale:i,relatedEvent:t},{cancelable:false})}$setAction(t){if(G(t)){this.$action=t}return this}$toCanvas(t){return new Promise(((s,i)=>{if(!this.isConnected){i(new Error("The current element is not connected to the DOM."));return}const e=document.createElement("canvas");let n=this.offsetWidth;let o=this.offsetHeight;let h=1;if(et(t)&&(V(t.width)||V(t.height))){({width:n,height:o}=xt({aspectRatio:n/o,width:t.width,height:t.height}));h=n/this.offsetWidth}e.width=n;e.height=o;const r=this.querySelector(this.$getTagNameOf(b));if(!r){s(e);return}r.$ready().then((i=>{const a=e.getContext("2d");if(a){const[s,c,l,u,f,p]=r.$getTransform();let d=f;let b=p;let m=i.naturalWidth;let g=i.naturalHeight;if(h!==1){d*=h;b*=h;m*=h;g*=h}const w=m/2;const v=g/2;a.fillStyle="transparent";a.fillRect(0,0,n,o);if(et(t)&&nt(t.beforeDraw)){t.beforeDraw.call(this,a,e)}a.save();a.translate(w,v);a.transform(s,c,l,u,d,b);a.translate(-w,-v);a.drawImage(i,0,0,m,g);a.restore()}s(e)})).catch(i)}))}}Nt.$name=u;Nt.$version="2.0.0-beta.4";var Xt=`:host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}`;const Yt=new WeakMap;const Rt=["alt","crossorigin","decoding","importance","loading","referrerpolicy","sizes","src","srcset"];class Wt extends Et{constructor(){super(...arguments);this.$matrix=[1,0,0,1,0,0];this.$onLoad=null;this.$onCanvasAction=null;this.$onCanvasActionEnd=null;this.$onCanvasActionStart=null;this.$actionStartTarget=null;this.$style=Xt;this.$image=new Image;this.rotatable=true;this.scalable=true;this.skewable=true;this.slottable=false;this.translatable=true}set $canvas(t){Yt.set(this,t)}get $canvas(){return Yt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(Rt,["rotatable","scalable","skewable","translatable"])}attributeChangedCallback(t,s,i){if(Object.is(i,s)){return}super.attributeChangedCallback(t,s,i);if(Rt.includes(t)){this.$image.setAttribute(t,i)}}connectedCallback(){super.connectedCallback();const{$image:t}=this;const s=this.closest(this.$getTagNameOf(u));if(s){this.$canvas=s;this.$setStyles({display:"block",position:"absolute"});this.$onCanvasActionStart=t=>{var s,i;this.$actionStartTarget=(i=(s=t.detail)===null||s===void 0?void 0:s.relatedEvent)===null||i===void 0?void 0:i.target};this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null};this.$onCanvasAction=this.$handleAction.bind(this);ft(s,K,this.$onCanvasActionStart);ft(s,F,this.$onCanvasActionEnd);ft(s,B,this.$onCanvasAction)}this.$onLoad=this.$handleLoad.bind(this);ft(t,L,this.$onLoad);this.$getShadowRoot().appendChild(t)}disconnectedCallback(){const{$image:t,$canvas:s}=this;if(s){if(this.$onCanvasActionStart){ut(s,K,this.$onCanvasActionStart);this.$onCanvasActionStart=null}if(this.$onCanvasActionEnd){ut(s,F,this.$onCanvasActionEnd);this.$onCanvasActionEnd=null}if(this.$onCanvasAction){ut(s,B,this.$onCanvasAction);this.$onCanvasAction=null}}if(t&&this.$onLoad){ut(t,L,this.$onLoad);this.$onLoad=null}this.$getShadowRoot().removeChild(t);super.disconnectedCallback()}$handleLoad(){const{$image:t}=this;this.$setStyles({width:t.naturalWidth,height:t.naturalHeight});if(this.$canvas){this.$center("cover")}}$handleAction(t){if(this.hidden||!(this.rotatable||this.scalable||this.translatable)){return}const{$canvas:s}=this;const{detail:i}=t;if(i){const{relatedEvent:t}=i;let{action:e}=i;if(e===x&&(!this.rotatable||!this.scalable)){if(this.rotatable){e=y}else if(this.scalable){e=k}else{e=z}}switch(e){case $:if(this.translatable){const t=this.$getTagNameOf(m);let e=s.querySelector(t);if(e&&e.multiple&&!e.active){e=s.querySelector(`${t}[active]`)}if(!e||e.hidden||!e.movable||!(this.$actionStartTarget&&e.contains(this.$actionStartTarget))){this.$move(i.endX-i.startX,i.endY-i.startY)}}break;case y:if(this.rotatable){if(t){const{x:s,y:e}=this.getBoundingClientRect();this.$rotate(i.rotate,t.clientX-s,t.clientY-e)}else{this.$rotate(i.rotate)}}break;case k:if(this.scalable){if(t){const{x:s,y:e}=this.getBoundingClientRect();this.$zoom(i.scale,t.clientX-s,t.clientY-e)}else{this.$zoom(i.scale)}}break;case x:if(this.rotatable&&this.scalable){const{rotate:s}=i;let{scale:e}=i;if(e<0){e=1/(1-e)}else{e+=1}const n=Math.cos(s);const o=Math.sin(s);const[h,r,a,c]=[n*e,o*e,-o*e,n*e];if(t){const s=this.getBoundingClientRect();const i=t.clientX-s.x;const e=t.clientY-s.y;const[n,o,l,u]=this.$matrix;const f=s.width/2;const p=s.height/2;const d=i-f;const b=e-p;const m=(d*u-l*b)/(n*u-l*o);const g=(b-o*m)/u;this.$transform(h,r,a,c,m*(1-h)+g*a,g*(1-c)+m*r)}else{this.$transform(h,r,a,c,0,0)}}break}}}$ready(t){const{$image:s}=this;const i=new Promise(((t,i)=>{const e=new Error("Failed to load the image source");if(s.complete){if(s.naturalWidth>0&&s.naturalHeight>0){t(s)}else{i(e)}}else{const n=()=>{ut(s,_,o);t(s)};const o=()=>{ut(s,L,n);i(e)};pt(s,L,n);pt(s,_,o)}}));if(nt(t)){i.then((s=>{t(s);return s}))}return i}$center(t){const{parentElement:s}=this;if(!s){return this}const i=s.getBoundingClientRect();const e=i.width;const n=i.height;const{x:o,y:h,width:r,height:a}=this.getBoundingClientRect();const c=o+r/2;const l=h+a/2;const u=i.x+e/2;const f=i.y+n/2;this.$move(u-c,f-l);if(t&&(r!==e||a!==n)){const s=e/r;const i=n/a;switch(t){case"cover":this.$scale(Math.max(s,i));break;case"contain":this.$scale(Math.min(s,i));break}}return this}$move(t,s=t){if(this.translatable&&Q(t)&&Q(s)){const[i,e,n,o]=this.$matrix;const h=(t*o-n*s)/(i*o-n*e);const r=(s-e*h)/o;this.$translate(h,r)}return this}$moveTo(t,s=t){if(this.translatable&&Q(t)&&Q(s)){const[i,e,n,o]=this.$matrix;const h=(t*o-n*s)/(i*o-n*e);const r=(s-e*h)/o;this.$setTransform(i,e,n,o,h,r)}return this}$rotate(t,s,i){if(this.rotatable){const e=$t(t);const n=Math.cos(e);const o=Math.sin(e);const[h,r,a,c]=[n,o,-o,n];if(Q(s)&&Q(i)){const[t,e,n,o]=this.$matrix;const{width:l,height:u}=this.getBoundingClientRect();const f=l/2;const p=u/2;const d=s-f;const b=i-p;const m=(d*o-n*b)/(t*o-n*e);const g=(b-e*m)/o;this.$transform(h,r,a,c,m*(1-h)-g*a,g*(1-c)-m*r)}else{this.$transform(h,r,a,c,0,0)}}return this}$zoom(t,s,i){if(!this.scalable||t===0){return this}if(t<0){t=1/(1-t)}else{t+=1}if(Q(s)&&Q(i)){const[e,n,o,h]=this.$matrix;const{width:r,height:a}=this.getBoundingClientRect();const c=r/2;const l=a/2;const u=s-c;const f=i-l;const p=(u*h-o*f)/(e*h-o*n);const d=(f-n*p)/h;this.$transform(t,0,0,t,p*(1-t),d*(1-t))}else{this.$scale(t)}return this}$scale(t,s=t){if(this.scalable){this.$transform(t,0,0,s,0,0)}return this}$skew(t,s=0){if(this.skewable){const i=$t(t);const e=$t(s);this.$transform(1,Math.tan(e),Math.tan(i),1,0,0)}return this}$translate(t,s=t){if(this.translatable&&Q(t)&&Q(s)){this.$transform(1,0,0,1,t,s)}return this}$transform(t,s,i,e,n,o){if(Q(t)&&Q(s)&&Q(i)&&Q(e)&&Q(n)&&Q(o)){return this.$setTransform(zt(this.$matrix,[t,s,i,e,n,o]))}return this}$setTransform(t,s,i,e,n,o){if(this.rotatable||this.scalable||this.skewable||this.translatable){if(Array.isArray(t)){[t,s,i,e,n,o]=t}if(Q(t)&&Q(s)&&Q(i)&&Q(e)&&Q(n)&&Q(o)){const h=[t,s,i,e,n,o];if(this.$emit(q,{matrix:h,oldMatrix:this.$matrix})===false){return this}this.$matrix=h;this.style.transform=`matrix(${h.join(", ")})`}}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}Wt.$name=b;Wt.$version="2.0.0-beta.4";var Pt=`:host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}`;const _t=new WeakMap;class Dt extends Et{constructor(){super(...arguments);this.$onCanvasChange=null;this.$onCanvasActionEnd=null;this.$onCanvasActionStart=null;this.$style=Pt;this.x=0;this.y=0;this.width=0;this.height=0;this.slottable=false;this.themeColor="rgba(0, 0, 0, 0.65)"}set $canvas(t){_t.set(this,t)}get $canvas(){return _t.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const t=this.closest(this.$getTagNameOf(u));if(t){this.$canvas=t;this.style.position="absolute";const s=t.querySelector(this.$getTagNameOf(m));if(s){this.$onCanvasActionStart=t=>{if(s.hidden&&t.detail.action===v){this.hidden=false}};this.$onCanvasActionEnd=t=>{if(s.hidden&&t.detail.action===v){this.hidden=true}};this.$onCanvasChange=t=>{const{x:i,y:e,width:n,height:o}=t.detail;this.$change(i,e,n,o);if(s.hidden||i===0&&e===0&&n===0&&o===0){this.hidden=true}};ft(t,K,this.$onCanvasActionStart);ft(t,F,this.$onCanvasActionEnd);ft(t,Z,this.$onCanvasChange)}}this.$render()}disconnectedCallback(){const{$canvas:t}=this;if(t){if(this.$onCanvasActionStart){ut(t,K,this.$onCanvasActionStart);this.$onCanvasActionStart=null}if(this.$onCanvasActionEnd){ut(t,F,this.$onCanvasActionEnd);this.$onCanvasActionEnd=null}if(this.$onCanvasChange){ut(t,Z,this.$onCanvasChange);this.$onCanvasChange=null}}super.disconnectedCallback()}$change(t,s,i=this.width,e=this.height){if(!Q(t)||!Q(s)||!Q(i)||!Q(e)||t===this.x&&s===this.y&&i===this.width&&e===this.height){return this}if(this.hidden){this.hidden=false}this.x=t;this.y=s;this.width=i;this.height=e;return this.$render()}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height,outlineWidth:r.innerWidth})}}Dt.$name=g;Dt.$version="2.0.0-beta.4";var Lt=`:host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}`;class Ht extends Et{constructor(){super(...arguments);this.$onCanvasCropEnd=null;this.$onCanvasCropStart=null;this.$style=Lt;this.action=z;this.plain=false;this.slottable=false;this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}Ht.$name=d;Ht.$version="2.0.0-beta.4";var Bt=`:host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}`;const Ft=new WeakMap;class Ut extends Et{constructor(){super(...arguments);this.$onCanvasAction=null;this.$onCanvasActionStart=null;this.$onCanvasActionEnd=null;this.$onDocumentKeyDown=null;this.$action="";this.$actionStartTarget=null;this.$style=Bt;this.x=0;this.y=0;this.width=0;this.height=0;this.aspectRatio=NaN;this.initialAspectRatio=NaN;this.initialCoverage=NaN;this.active=false;this.movable=false;this.resizable=false;this.zoomable=false;this.multiple=false;this.keyboard=false;this.outlined=false;this.precise=false}set $canvas(t){Ft.set(this,t)}get $canvas(){return Ft.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["active","aspect-ratio","height","initial-aspect-ratio","initial-coverage","keyboard","movable","multiple","outlined","precise","resizable","width","x","y","zoomable"])}$propertyChangedCallback(t,s,i){if(Object.is(i,s)){return}super.$propertyChangedCallback(t,s,i);switch(t){case"aspectRatio":if(!V(i)){this.aspectRatio=NaN}break;case"initialAspectRatio":if(!V(i)){this.initialAspectRatio=NaN}break;case"initialCoverage":if(!V(i)||i>1){this.initialCoverage=NaN}break;case"keyboard":this.$nextTick((()=>{if(this.$canvas){if(i){if(!this.$onDocumentKeyDown){this.$onDocumentKeyDown=this.$handleKeyDown.bind(this);ft(this.ownerDocument,D,this.$onDocumentKeyDown)}}else if(this.$onDocumentKeyDown){ut(this.ownerDocument,D,this.$onDocumentKeyDown);this.$onDocumentKeyDown=null}}}));break;case"multiple":this.$nextTick((()=>{if(this.$canvas){const t=this.$getSelections();if(i){t.forEach((t=>{t.active=false}));this.active=true;this.$emit(Z,{x:this.x,y:this.y,width:this.width,height:this.height})}else{this.active=false;t.slice(1).forEach((t=>{this.$removeSelection(t)}))}}}));break}}connectedCallback(){super.connectedCallback();const t=this.closest(this.$getTagNameOf(u));if(t){this.$canvas=t;this.$setStyles({position:"absolute",transform:`translate(${this.x}px, ${this.y}px)`});if(!this.hidden){this.$render()}const{initialCoverage:s,parentElement:i}=this;if(V(s)&&i){const t=this.aspectRatio||this.initialAspectRatio;const{offsetWidth:e,offsetHeight:n}=i;let o=e*s;let h=n*s;if(V(t)){({width:o,height:h}=xt({aspectRatio:t,width:o,height:h}))}this.$change(this.x,this.y,o,h);this.$center()}this.$onCanvasActionStart=this.$handleActionStart.bind(this);this.$onCanvasActionEnd=this.$handleActionEnd.bind(this);this.$onCanvasAction=this.$handleAction.bind(this);ft(t,K,this.$onCanvasActionStart);ft(t,F,this.$onCanvasActionStart);ft(t,B,this.$onCanvasAction)}else{this.$render()}}disconnectedCallback(){const{$canvas:t}=this;if(t){if(this.$onCanvasActionStart){ut(t,K,this.$onCanvasActionStart);this.$onCanvasActionStart=null}if(this.$onCanvasActionEnd){ut(t,F,this.$onCanvasActionEnd);this.$onCanvasActionEnd=null}if(this.$onCanvasAction){ut(t,B,this.$onCanvasAction);this.$onCanvasAction=null}}super.disconnectedCallback()}$getSelections(){let t=[];if(this.parentElement){t=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(m)))}return t}$createSelection(){const t=this.cloneNode(true);if(this.hasAttribute("id")){t.removeAttribute("id")}this.active=false;if(this.parentElement){this.parentElement.insertBefore(t,this.nextSibling)}return t}$removeSelection(t=this){if(this.parentElement){const s=this.$getSelections();if(s.length>1){const i=s.indexOf(t);const e=s[i+1]||s[i-1];if(e){t.active=false;this.parentElement.removeChild(t);e.active=true;e.$emit(Z,{x:e.x,y:e.y,width:e.width,height:e.height})}}else{this.$reset();this.hidden=true}}}$handleActionStart(t){var s,i;const e=(i=(s=t.detail)===null||s===void 0?void 0:s.relatedEvent)===null||i===void 0?void 0:i.target;this.$action="";this.$actionStartTarget=e;if(!this.hidden&&this.multiple&&!this.active&&e===this&&this.parentElement){this.$getSelections().forEach((t=>{t.active=false}));this.active=true;this.$emit(Z,{x:this.x,y:this.y,width:this.width,height:this.height})}}$handleAction(t){const{currentTarget:s,detail:i}=t;if(s&&i){const{relatedEvent:e}=i;let{action:n}=i;if(!n&&this.multiple){n=this.$action||(e===null||e===void 0?void 0:e.target.action);this.$action=n}if(!n||this.hidden&&n!==v||this.multiple&&!this.active&&n!==k){return}const o=i.endX-i.startX;const h=i.endY-i.startY;const{width:r,height:a}=this;let{aspectRatio:c}=this;if(!V(c)&&t.shiftKey){c=V(r)&&V(a)?r/a:1}switch(n){case v:{const{$canvas:t}=this;const e=wt(s);(this.multiple&&!this.hidden?this.$createSelection():this).$change(i.startX-e.left,i.startY-e.top,o,h,c);n=T;if(o<0){if(h>0){n=E}else if(h<0){n=S}}else if(o>0){if(h<0){n=O}}if(t){t.$action=n}break}case $:if(this.movable&&(this.$actionStartTarget&&this.contains(this.$actionStartTarget))){this.$move(o,h)}break;case k:if(e&&this.zoomable){const t=wt(s);this.$zoom(i.scale,e.pageX-t.left,e.pageY-t.top)}break;default:this.$resize(n,o,h,c)}}}$handleActionEnd(){this.$action="";this.$actionStartTarget=null}$handleKeyDown(t){if(this.hidden||!this.keyboard||this.multiple&&!this.active||t.defaultPrevented){return}switch(t.key){case"Backspace":if(t.metaKey){t.preventDefault();this.$removeSelection()}break;case"Delete":t.preventDefault();this.$removeSelection();break;case"ArrowLeft":t.preventDefault();this.$move(-1,0);break;case"ArrowRight":t.preventDefault();this.$move(1,0);break;case"ArrowUp":t.preventDefault();this.$move(0,-1);break;case"ArrowDown":t.preventDefault();this.$move(0,1);break;case"+":t.preventDefault();this.$zoom(.1);break;case"-":t.preventDefault();this.$zoom(-.1);break}}$center(){const{parentElement:t}=this;if(!t){return this}const s=(t.offsetWidth-this.width)/2;const i=(t.offsetHeight-this.height)/2;return this.$change(s,i)}$move(t,s=t){return this.$moveTo(this.x+t,this.y+s)}$moveTo(t,s=t){if(!this.movable){return this}return this.$change(t,s)}$resize(t,s=0,i=0,e=this.aspectRatio){if(!this.resizable){return this}const n=V(e);const{$canvas:o}=this;let{x:h,y:r,width:a,height:c}=this;switch(t){case M:r+=i;c-=i;if(c<0){t=A;c=-c;r-=c}if(n){s=i*e;h+=s/2;a-=s;if(a<0){a=-a;h-=a}}break;case C:a+=s;if(a<0){t=j;a=-a;h-=a}if(n){i=s/e;r-=i/2;c+=i;if(c<0){c=-c;r-=c}}break;case A:c+=i;if(c<0){t=M;c=-c;r-=c}if(n){s=i*e;h-=s/2;a+=s;if(a<0){a=-a;h-=a}}break;case j:h+=s;a-=s;if(a<0){t=C;a=-a;h-=a}if(n){i=s/e;r+=i/2;c-=i;if(c<0){c=-c;r-=c}}break;case O:if(n){i=-s/e}r+=i;c-=i;a+=s;if(a<0&&c<0){t=E;a=-a;c=-c;h-=a;r-=c}else if(a<0){t=S;a=-a;h-=a}else if(c<0){t=T;c=-c;r-=c}break;case S:if(n){i=s/e}h+=s;r+=i;a-=s;c-=i;if(a<0&&c<0){t=T;a=-a;c=-c;h-=a;r-=c}else if(a<0){t=O;a=-a;h-=a}else if(c<0){t=E;c=-c;r-=c}break;case T:if(n){i=s/e}a+=s;c+=i;if(a<0&&c<0){t=S;a=-a;c=-c;h-=a;r-=c}else if(a<0){t=E;a=-a;h-=a}else if(c<0){t=O;c=-c;r-=c}break;case E:if(n){i=-s/e}h+=s;a-=s;c+=i;if(a<0&&c<0){t=O;a=-a;c=-c;h-=a;r-=c}else if(a<0){t=T;a=-a;h-=a}else if(c<0){t=S;c=-c;r-=c}break}if(o){o.$setAction(t)}return this.$change(h,r,a,c)}$zoom(t,s,i){if(!this.zoomable||t===0){return this}if(t<0){t=1/(1-t)}else{t+=1}const{width:e,height:n}=this;const o=e*t;const h=n*t;let r=this.x;let a=this.y;if(Q(s)&&Q(i)){r-=(o-e)*((s-this.x)/e);a-=(h-n)*((i-this.y)/n)}else{r-=(o-e)/2;a-=(h-n)/2}return this.$change(r,a,o,h)}$change(t,s,i=this.width,e=this.height,n=this.aspectRatio){if(!Q(t)||!Q(s)||!Q(i)||!Q(e)){return this}if(!this.precise){t=Math.round(t);s=Math.round(s);i=Math.round(i);e=Math.round(e)}if(t===this.x&&s===this.y&&i===this.width&&e===this.height){return this}if(this.hidden){this.hidden=false}if(V(n)){({width:i,height:e}=xt({aspectRatio:n,width:i,height:e},"cover"))}if(this.$emit(Z,{x:t,y:s,width:i,height:e})===false){return this}this.x=t;this.y=s;this.width=i;this.height=e;return this.$render()}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height})}$toCanvas(t){return new Promise(((s,i)=>{if(!this.isConnected){i(new Error("The current element is not connected to the DOM."));return}const e=document.createElement("canvas");let{width:n,height:o}=this;let h=1;if(et(t)&&(V(t.width)||V(t.height))){({width:n,height:o}=xt({aspectRatio:n/o,width:t.width,height:t.height}));h=n/this.width}e.width=n;e.height=o;if(!this.$canvas){s(e);return}const r=this.$canvas.querySelector(this.$getTagNameOf(b));if(!r){s(e);return}r.$ready().then((i=>{const a=e.getContext("2d");if(a){const[s,c,l,u,f,p]=r.$getTransform();const d=-this.x;const b=-this.y;const m=(d*u-l*b)/(s*u-l*c);const g=(b-c*m)/u;let w=s*m+l*g+f;let v=c*m+u*g+p;let $=i.naturalWidth;let k=i.naturalHeight;if(h!==1){w*=h;v*=h;$*=h;k*=h}const y=$/2;const x=k/2;a.fillStyle="transparent";a.fillRect(0,0,n,o);if(et(t)&&nt(t.beforeDraw)){t.beforeDraw.call(this,a,e)}a.save();a.translate(y,x);a.transform(s,c,l,u,w,v);a.translate(-y,-x);a.drawImage(i,0,0,$,k);a.restore()}s(e)})).catch(i)}))}}Ut.$name=m;Ut.$version="2.0.0-beta.4";var Kt=`:host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}`;class Zt extends Et{constructor(){super(...arguments);this.$style=Kt;this.bordered=false;this.columns=3;this.covered=false;this.rows=3;this.slottable=false;this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["bordered","columns","covered","rows"])}$propertyChangedCallback(t,s,i){if(Object.is(i,s)){return}super.$propertyChangedCallback(t,s,i);if(t==="rows"||t==="columns"){this.$render()}}connectedCallback(){super.connectedCallback();this.$render()}$render(){const t=this.$getShadowRoot();const s=document.createDocumentFragment();for(let t=0;t<this.rows;t+=1){const t=document.createElement("span");t.setAttribute("role","row");for(let s=0;s<this.columns;s+=1){const s=document.createElement("span");s.setAttribute("role","gridcell");t.appendChild(s)}s.appendChild(t)}if(t){t.innerHTML="";t.appendChild(s)}}}Zt.$name=p;Zt.$version="2.0.0-beta.4";var qt=`:host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}`;class Gt extends Et{constructor(){super(...arguments);this.$style=qt;this.centered=false;this.slottable=false;this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["centered"])}}Gt.$name=f;Gt.$version="2.0.0-beta.4";var Jt=`:host{display:block;height:100%;overflow:hidden;position:relative;width:100%}`;const Qt=new WeakMap;const Vt=new WeakMap;const ts=new WeakMap;const ss="both";const is="horizontal";const es="vertical";const ns="none";class os extends Et{constructor(){super(...arguments);this.$onSelectionChange=null;this.$onSourceImageLoad=null;this.$onSourceImageTransform=null;this.$scale=1;this.$style=Jt;this.resize=es;this.selection="";this.slottable=false}set $image(t){Qt.set(this,t)}get $image(){return Qt.get(this)}set $sourceImage(t){ts.set(this,t)}get $sourceImage(){return ts.get(this)}set $selection(t){Vt.set(this,t)}get $selection(){return Vt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["resize","selection"])}connectedCallback(){super.connectedCallback();let t=null;if(this.selection){t=this.ownerDocument.querySelector(this.selection)}else{t=this.closest(this.$getTagNameOf(m))}if(ot(t)){this.$selection=t;this.$onSelectionChange=this.$handleSelectionChange.bind(this);ft(t,Z,this.$onSelectionChange);const s=t.closest(this.$getTagNameOf(u));if(s){const t=s.querySelector(this.$getTagNameOf(b));if(t){this.$sourceImage=t;this.$image=t.cloneNode(true);this.$getShadowRoot().appendChild(this.$image);this.$onSourceImageLoad=this.$handleSourceImageLoad.bind(this);this.$onSourceImageTransform=this.$handleSourceImageTransform.bind(this);ft(t.$image,L,this.$onSourceImageLoad);ft(t,q,this.$onSourceImageTransform)}}this.$render()}}disconnectedCallback(){const{$selection:t,$sourceImage:s}=this;if(t&&this.$onSelectionChange){ut(t,Z,this.$onSelectionChange);this.$onSelectionChange=null}if(s&&this.$onSourceImageLoad){ut(s.$image,L,this.$onSourceImageLoad);this.$onSourceImageLoad=null}if(s&&this.$onSourceImageTransform){ut(s,q,this.$onSourceImageTransform);this.$onSourceImageTransform=null}super.disconnectedCallback()}$handleSelectionChange(t){this.$render(t.detail)}$handleSourceImageLoad(){const{$image:t,$sourceImage:s}=this;const i=t.getAttribute("src");const e=s.getAttribute("src");if(e&&e!==i){t.setAttribute("src",e);t.$ready((()=>{setTimeout((()=>{const{x:t,y:i}=this.$selection;this.$transformImageByOffset(s.$getTransform(),-t,-i)}))}))}}$handleSourceImageTransform(t){const{x:s,y:i}=this.$selection;this.$transformImageByOffset(t.detail.matrix,-s,-i)}$render(t){const{x:s,y:i,width:e,height:n}=t||this.$selection;const o={};const{clientWidth:h,clientHeight:r}=this;let a=h;let c=r;let l=NaN;switch(this.resize){case ss:l=1;a=e;c=n;o.width=e;o.height=n;break;case is:l=r/n;a=e*l;o.width=a;break;case es:l=h/e;c=n*l;o.height=c;break;case ns:default:if(h>0){l=h/e}else if(r>0){l=r/n}}this.$scale=l;this.$setStyles(o);if(this.$sourceImage){this.$transformImageByOffset(this.$sourceImage.$getTransform(),-s,-i)}}$transformImageByOffset(t,s,i){const{$image:e,$scale:n,$sourceImage:o}=this;if(o&&e&&n>0){const[o,h,r,a,c,l]=t;const u=(s*a-r*i)/(o*a-r*h);const f=(i-h*u)/a;const p=o*u+r*f+c;const d=h*u+a*f+l;e.$ready((t=>{this.$setStyles.call(e,{width:t.naturalWidth*n,height:t.naturalHeight*n})}));e.$setTransform(o,h,r,a,p*n,d*n)}}}os.$name=w;os.$version="2.0.0-beta.4";
|
|
2
|
-
/*! Cropper.js v2.0.0-beta.4 | (c) 2015-present Chen Fengyuan | MIT */Nt.$define();Gt.$define();Zt.$define();Ht.$define();Wt.$define();Ut.$define();Dt.$define();os.$define();const hs=".relative{position:relative!important}.-mt-\\[6px\\]{margin-top:-6px!important}.mb-6{margin-bottom:1.5rem!important}.flex{display:flex!important}.h-4{height:1rem!important}.h-\\[2px\\]{height:2px!important}.w-4{width:1rem!important}.w-full{width:100%!important}.appearance-none{
|
|
3
|
-
//# sourceMappingURL=p-
|
|
2
|
+
/*! Cropper.js v2.0.0-beta.4 | (c) 2015-present Chen Fengyuan | MIT */Nt.$define();Gt.$define();Zt.$define();Ht.$define();Wt.$define();Ut.$define();Dt.$define();os.$define();const hs=".relative{position:relative!important}.-mt-\\[6px\\]{margin-top:-6px!important}.mb-6{margin-bottom:1.5rem!important}.flex{display:flex!important}.h-4{height:1rem!important}.h-\\[2px\\]{height:2px!important}.w-4{width:1rem!important}.w-full{width:100%!important}.appearance-none{appearance:none!important}.flex-col{flex-direction:column!important}.items-center{align-items:center!important}.justify-between{justify-content:space-between!important}.rounded-round{border-radius:100%!important}.border-0{border-width:0!important}*{box-sizing:border-box}:host{align-items:center;display:flex;flex-direction:column;gap:1.5rem;justify-content:space-between;margin-bottom:1.5rem;width:100%}:host .p-input[type=range]{appearance:none;background-color:transparent;position:relative}:host .p-input[type=range]::-webkit-slider-runnable-track{--tw-bg-opacity:1;background-color:rgb(218 230 240/var(--tw-bg-opacity));height:2px}:host .p-input[type=range]::-moz-range-track{--tw-bg-opacity:1;background-color:rgb(218 230 240/var(--tw-bg-opacity));height:2px}:host .p-input[type=range]::-moz-range-thumb,:host .p-input[type=range]::-webkit-slider-thumb{--tw-bg-opacity:1;background-color:rgb(82 138 250/var(--tw-bg-opacity));border-radius:100%;border-width:0;height:1rem;width:1rem}:host .p-input[type=range]::-webkit-slider-thumb{margin-top:-6px}.static{position:static!important}.hidden{display:none!important}.h-\\[17\\.5rem\\]{height:17.5rem!important}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.resize{resize:both!important}.gap-2{gap:.5rem!important}.rounded{border-radius:.25rem!important}.border-b{border-bottom-width:1px!important}.border-solid{border-style:solid!important}.border-mystic-medium{--tw-border-opacity:1!important;border-color:rgb(227 236 243/var(--tw-border-opacity))!important}.bg-white{--tw-bg-opacity:1!important;background-color:rgb(255 255 255/var(--tw-bg-opacity))!important}.px-14{padding-left:3.5rem!important;padding-right:3.5rem!important}.text-storm-vague{--tw-text-opacity:1!important;color:rgb(152 154 183/var(--tw-text-opacity))!important}@media (min-width:40rem){.tablet\\:max-w-xs{max-width:20rem!important}.tablet\\:px-1{padding-left:.25rem!important;padding-right:.25rem!important}}";const rs=class{constructor(i){t(this,i);this.valueChange=s(this,"valueChange",3);this._maxScale=0;this._minScale=0;this.variant="user";this.value=undefined;this.returnType="base64";this._loaded=false;this._currentScale=0}onResize(){if(this._resizeDebounceTimeout){clearTimeout(this._resizeDebounceTimeout)}this._resizeDebounceTimeout=setTimeout((()=>{this._selectionRef.$center();this._imageRef.$center()}),200)}componentDidLoad(){setTimeout((()=>{this._loaded=true}),200)}render(){return i(e,{class:"p-cropper"},this._loaded&&i("cropper-canvas",{class:"h-[17.5rem] w-full border-0 border-b border-solid border-mystic-medium bg-white",onAction:()=>this._onAction()},i("cropper-image",{src:this.value,alt:"Picture",ref:t=>this._setImageRef(t),scalable:true,crossorigin:"anonymous"}),i("cropper-shade",{class:o({"rounded-round":this.variant==="user",rounded:this.variant==="company"}),"theme-color":"rgba(255, 255, 255, 0.5)",hidden:true}),i("cropper-selection",{"initial-coverage":"0.7","aspect-ratio":"1",ref:t=>this._selectionRef=t}),i("cropper-handle",{action:"move",plain:true})),i("div",{class:"flex w-full items-center gap-2 px-14 text-storm-vague tablet:max-w-xs tablet:px-1"},i("p-icon",{variant:"minus"}),i("input",{class:"p-input w-full",type:"range",min:"0",max:"100",value:this._currentScale,onInput:t=>this._onInput(t.target.value),step:"0.5"}),i("p-icon",{variant:"plus"})))}_setImageRef(t){if(this._imageRef){return}this._imageRef=t;this._imageRef.$ready((t=>setTimeout((()=>this._setInitialState(t)),200)))}_setInitialState(t){let s;if(t.naturalWidth>t.naturalHeight){s=200/t.naturalHeight}if(t.naturalHeight>=t.naturalWidth){s=200/t.naturalWidth}const i=this._imageRef.$getTransform();this._minScale=s;this._maxScale=i[0];this._selectionRef.$resize("nw-resize",200,200,1);this._selectionRef.$center();this._setScale(s);this._toCanvas()}_onAction(){this._setCurrentScale();this._toCanvas()}_setScale(t,s=true,i=true){const e=this._imageRef.$getTransform();this._imageRef.$setTransform([t,0,0,t,e[4],e[5]]);if(s){this._imageRef.$center()}if(i){this._setCurrentScale()}}_setCurrentScale(){const t=this._imageRef.$getTransform();const s=t[0];if(s<this._minScale){this._setScale(this._minScale,true,false);this._currentScale=0;return}if(s>this._maxScale){this._setScale(this._maxScale,true,false);this._currentScale=100;return}if(s===this._minScale){this._currentScale=0;return}if(s===this._maxScale){this._currentScale=100;return}const i=this._maxScale-this._minScale;const e=s-this._minScale;const n=e/i*100;this._currentScale=n}_onInput(t){const s=this._imageRef.$getTransform();const i=s[0];const e=this._maxScale-this._minScale;const n=e*(t/100);if(n===i){return}this._setScale(n+this._minScale,false,false);this._currentScale=t;this._toCanvas()}_toCanvas(){if(this._toCanvasDebounceTimeout){clearTimeout(this._toCanvasDebounceTimeout)}this._toCanvasDebounceTimeout=setTimeout((async()=>{const t=await this._selectionRef.$toCanvas();if(this.returnType==="canvas"){this.valueChange.emit(t);return}const s=t.toDataURL("image/png");this.valueChange.emit(s)}),200)}};rs.style=hs;export{rs as p_cropper};
|
|
3
|
+
//# sourceMappingURL=p-7bf042c9.entry.js.map
|