@bluepic/embed 0.4.0-next.191 → 0.4.0-next.192

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.
@@ -145,7 +145,7 @@ list should be an Array.`),z.length===0)return new b(0);if(z.length===1)return z
145
145
  `).slice(0,n.maxLines??1/0).map(ue=>ue.slice(0,n.maxLineLength??1/0)).join(`
146
146
  `).slice(0,n.maxLength??1/0));s.watch(o,te=>{Ea(te,g.value)||(c.value=te)}),s.watch(c,te=>{if(typeof te=="object"&&te!==null){const ae=LB(te,0,n.maxLength);o.value=ae}else{const ue=String(te).split(`
147
147
  `);o.value!==g.value&&(o.value=g.value),n.maxLineLength!==1/0&&n.maxLineLength!==null&&(l.value=ue.filter(Ce=>Ce.length>(n.maxLineLength??1/0)).map(Ce=>({index:ue.indexOf(Ce),length:Ce.length}))),n.maxLines!==1/0&&n.maxLines!==null&&(u.value=Math.max(0,String(te).split(`
148
- `).length-(n.maxLines??1/0))),n.maxLength!==1/0&&n.maxLength!==null&&(f.value=String(te).length-n.maxLength)}});const p=s.computed({get(){return Q2(A.value)},set(te){n.richtext?c.value=[{text:te,format:{}}]:c.value=te}}),A=s.computed({get(){return zB(o.value)},set(te){n.richtext?c.value=te:c.value=Q2(te)}}),b=s.ref(),C=mi("bx-input-count"),w=s.computed(()=>n.state==="error"||d.value),y=s.computed(()=>n.showWordCount?C:void 0),x=s.ref();let E;const S=s.ref(!1);s.watch(S,()=>{S.value?a("focus"):a("blur",E)});function _(te){S.value=!0}function B(te){E=te,S.value=!1}s.watch(x,(te,ae)=>{te&&(ae&&(ae.removeEventListener("focus",_),ae.removeEventListener("blur",B)),te.addEventListener("focus",_),te.addEventListener("blur",B))});const N=s.computed(()=>String(Math.max(1,n.maxRows)));function k(){if(n.type!=="textarea")return;const te=x.value;!te||te.tagName!=="TEXTAREA"||(te.style.height="auto",te.style.height=`${te.scrollHeight}px`)}s.watch([x,p,()=>n.type,()=>n.minHeight,()=>n.maxHeight,N],async()=>{await s.nextTick(),k()},{immediate:!0,flush:"post"}),window.addEventListener("blur",B);const G=()=>{var te;n.disabled||n.readonly||(te=x.value)==null||te.focus()},L=te=>{te.key==="Enter"&&a("enter",te)},m=s.ref(""),V=s.computed(()=>{const te=n.richtext?m.value:c.value;return[...new Intl.Segmenter().segment(te)].length}),Y=s.computed(()=>n.richtext?m.value.length>0:String(c.value).length>0);function P(te){return te.en}const Z=s.ref(),D=s.ref({start:0,length:0}),F=s.computed({get(){var ne,z;const te=(ne=b.value)==null?void 0:ne.richTextInstance;if(!te)return;const ue=te.resolveFeatures(D.value.start,D.value.length).flat(),Ce=W(ue);if(Ce!==void 0)return Ce===null?"multiple":(z=M.value.find(Q=>Ea(Q.value,Ce)))==null?void 0:z.value},set(te){var ue;const ae=(ue=b.value)==null?void 0:ue.richTextInstance;ae&&te!=="multiple"&&(te===void 0?ae.applyFormat(D.value.start,D.value.length,{}):(ae.resolveFeatures(D.value.start,D.value.length),ae.applyFormat(D.value.start,D.value.length,te)),O.value.closePopover())}});s.watch(Z,()=>{Z.value&&(D.value=Z.value)});const M=s.computed(()=>n.richtext?[{label:P(n.richtext.noStyleLabel),value:void 0},...n.richtext.options.map((te,ae)=>({label:te.label,value:te.style}))]:[]),O=s.ref();function W(te){let ae=!1,ue;for(const Ce of te)if(!ue)ue=Ce.format;else if(!Ea(ue,Ce.format)){ae=!0;break}return ae?null:ue}function re(){n.richtext?A.value=[{text:"",format:{}}]:o.value=""}return s.onUnmounted(()=>{l.value=[],u.value=0,f.value=0}),t({inputEelRef:x,setFocus(te){var ae,ue;te?(ae=x.value)==null||ae.focus():(ue=x.value)==null||ue.blur()}}),(te,ae)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-input",{readonly:e.readonly,bordered:e.bordered,"is-textarea":e.type==="textarea"}])},[e.richtext?(s.openBlock(),s.createBlock(ai,{key:0,ref_key:"bxSelectRef",ref:O,class:"select-richtext",modelValue:F.value,"onUpdate:modelValue":ae[0]||(ae[0]=ue=>F.value=ue),options:M.value,disabled:!D.value||D.value.length===0},{label:s.withCtx(({label:ue})=>[s.createTextVNode(s.toDisplayString(ue??"Multiple"),1)]),_:1},8,["modelValue","options","disabled"])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["bx-input-wrapper",{focus:S.value&&!e.readonly,round:e.round,ring:e.ring,bordered:e.bordered,["size-"+e.size]:e.size,disabled:e.disabled,readonly:e.readonly,"rich-text":e.richtext,error:d.value,"state-active":e.state==="active","state-success":e.state==="success","state-error":e.state==="error","state-warning":e.state==="warning",ghost:e.ghost}]),style:s.normalizeStyle({"--max-height":e.richtext?"auto":e.maxHeight,"--min-height":e.minHeight,"--textarea-max-lines":N.value}),onClick:G},[i.prefix?(s.openBlock(),s.createElementBlock("div",Aee,[s.renderSlot(te.$slots,"prefix",{},void 0,!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["bx-input__input",{"swiper-no-swiping":S.value,"has-prefix":!!i.prefix}])},[e.richtext?(s.openBlock(),s.createBlock(UB,{key:0,ref_key:"bxRichTextInstance",ref:b,modelValue:A.value,"onUpdate:modelValue":ae[1]||(ae[1]=ue=>A.value=ue),selection:Z.value,"onUpdate:selection":ae[2]||(ae[2]=ue=>Z.value=ue),"raw-text":m.value,"onUpdate:rawText":ae[3]||(ae[3]=ue=>m.value=ue),focus:S.value,"onUpdate:focus":ae[4]||(ae[4]=ue=>S.value=ue),"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby},null,8,["modelValue","selection","raw-text","focus","aria-label","aria-labelledby"])):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[e.type==="textarea"?s.withDirectives((s.openBlock(),s.createElementBlock("textarea",{key:0,ref_key:"inputEelRef",ref:x,rows:"1",class:s.normalizeClass({resizeable:e.resizeable}),"onUpdate:modelValue":ae[5]||(ae[5]=ue=>p.value=ue),placeholder:e.placeholder,onKeydown:L,readonly:e.readonly,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":w.value?"true":void 0,"aria-describedby":y.value},null,42,bee)),[[s.vModelText,p.value]]):s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,ref_key:"inputEelRef",ref:x,"onUpdate:modelValue":ae[6]||(ae[6]=ue=>o.value=ue),readonly:e.readonly,placeholder:e.placeholder,type:e.type,onKeydown:L,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":w.value?"true":void 0,"aria-describedby":y.value},null,40,vee)),[[s.vModelDynamic,o.value]])],64))],2),i.suffix||e.clearable||e.showWordCount||i.loading||e.loading||d.value?(s.openBlock(),s.createElementBlock("div",{key:1,"data-suffix":!!i.suffix,class:"bx-input__suffix"},[i.loading||e.loading?(s.openBlock(),s.createElementBlock("div",yee,[i.loading?s.renderSlot(te.$slots,"loading",{},void 0,!0,0):(s.openBlock(),s.createBlock(Ul,{key:1,size:"small"}))])):s.createCommentVNode("",!0),s.renderSlot(te.$slots,"suffix",{},void 0,!0),e.showWordCount?(s.openBlock(),s.createElementBlock("div",{key:1,id:s.unref(C),class:"bx-input__word-count"},[e.maxLength&&e.maxLength!==1/0?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(V.value)+" / "+s.toDisplayString(e.maxLength),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(V.value),1)],64))],8,wee)):s.createCommentVNode("",!0),d.value?(s.openBlock(),s.createBlock(G1,{key:2,trigger:"hover","custom-popover-classes":["text-overflow-tooltip"],"allowed-placements":["bottom","top","right"]},{trigger:s.withCtx(()=>[s.createVNode(Et,{circle:"",size:"tiny",secondary:"",state:"error",class:"errors-button","aria-label":"Show input warnings"},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(eB))]),_:1})]),_:1})]),content:s.withCtx(()=>{var ue,Ce,ne;return[s.createElementVNode("div",Iee,[(ue=h.value)!=null&&ue.overflowingCharacters?(s.openBlock(),s.createElementBlock("div",xee,[s.createElementVNode("span",Eee,s.toDisplayString(e.maxLength+f.value)+" / "+s.toDisplayString(e.maxLength),1),ae[7]||(ae[7]=s.createTextVNode(" characters ",-1))])):s.createCommentVNode("",!0),(Ce=h.value)!=null&&Ce.overlowingLines?(s.openBlock(),s.createElementBlock("div",Bee,[s.createElementVNode("span",kee,s.toDisplayString(e.maxLines+u.value)+" / "+s.toDisplayString(e.maxLines),1),ae[8]||(ae[8]=s.createTextVNode(" lines ",-1))])):s.createCommentVNode("",!0),(ne=h.value)!=null&&ne.lineOverflows?(s.openBlock(),s.createElementBlock("div",See,[ae[9]||(ae[9]=s.createTextVNode(" Lines are too long: ",-1)),s.createElementVNode("ul",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(h.value.lineOverflows,({index:z,length:Q})=>(s.openBlock(),s.createElementBlock("li",null,[s.createElementVNode("span",_ee,"("+s.toDisplayString(z+1)+")",1),s.createElementVNode("span",Ree,s.toDisplayString(Q)+" / "+s.toDisplayString(e.maxLineLength),1)]))),256))])])):s.createCommentVNode("",!0)])]}),_:1})):s.createCommentVNode("",!0),e.clearable&&Y.value?(s.openBlock(),s.createElementBlock("button",{key:3,type:"button",class:"bx-input__clear-btn",onClick:s.withModifiers(re,["stop"]),title:"Clear","aria-label":"Clear"},[s.createVNode(gt,{size:12},{default:s.withCtx(()=>[s.createVNode(s.unref(cs))]),_:1})])):s.createCommentVNode("",!0)],8,Cee)):s.createCommentVNode("",!0)],6)],2))}}),[["__scopeId","data-v-19f6427a"]]);function AC(e){return new URLSearchParams(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,String(r)]))).toString()}function Nee(e){const t=s.ref([]),r=s.ref(0);let n=25;async function a(i,o){o=o??t.value.length??0;const l=await(await fetch(`https://api.pexels.com/v1/search?${AC({page:Math.ceil(o/n),query:i,per_page:n})}`,{headers:{Authorization:e}})).json();if("error"in l)throw new Error(l.error);r.value=l.total_results,t.value=[...t.value.slice(0,o),...l.photos]}return{photos:t,total:r,searchPhotos:a}}const Dee=s.defineComponent({__name:"LazyLoadingItemWrapper",emits:["update:visible"],setup(e,{emit:t}){s.ref();const r=t,n=s.ref(),a=tO(n);return r("update:visible",a.value),s.watch(a,(i,o)=>{!o&&i&&r("update:visible",a.value)}),(i,o)=>(s.openBlock(),s.createElementBlock("div",{class:"item-wrapper",ref_key:"itemWrapperRef",ref:n},[s.renderSlot(i.$slots,"default")],512))}}),Fee=s.defineComponent({__name:"LazyLoading",props:{items:{},total:{},fetch:{type:Function},visibleTriggerOffset:{}},setup(e){s.ref();const t=e;t.fetch(0);const r=(n,a)=>{a&&n>=t.items.length-t.visibleTriggerOffset-1&&t.total>t.items.length&&t.fetch()};return(n,a)=>(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.items,(i,o)=>(s.openBlock(),s.createBlock(Dee,{key:o,class:"item-wrapper",item:i,index:o,"onUpdate:visible":c=>r(o,c)},{default:s.withCtx(()=>[s.renderSlot(n.$slots,"item",{item:i,index:o})]),_:2},1032,["item","index","onUpdate:visible"]))),128))}}),Zee={class:"bx-empty-icon"},Gee={key:1,viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Lee={key:0,class:"bx-empty-description"},zee={key:1,class:"bx-empty-extra"},bC=ht(s.defineComponent({__name:"BxEmpty",props:{description:{default:"No Data"},size:{default:"medium"}},setup(e){const t=s.useSlots();return(r,n)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-empty",{[`size-${e.size}`]:!0}])},[s.createElementVNode("div",Zee,[t.icon?s.renderSlot(r.$slots,"icon",{},void 0,!0,0):(s.openBlock(),s.createElementBlock("svg",Gee,[...n[0]||(n[0]=[s.createElementVNode("path",{d:"M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM14 7.5C14 3.91015 11.0899 1 7.5 1C3.91015 1 1 3.91015 1 7.5C1 11.0899 3.91015 14 7.5 14C11.0899 14 14 11.0899 14 7.5ZM14 19.5C14 15.9101 11.0899 13 7.5 13C3.91015 13 1 15.9101 1 19.5C1 23.0899 3.91015 26 7.5 26C11.0899 26 14 23.0899 14 19.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",opacity:"0.4"},null,-1),s.createElementVNode("circle",{cx:"19.5",cy:"19.5",r:"6.5",stroke:"currentColor","stroke-width":"1.5","stroke-dasharray":"3 3",opacity:"0.25"},null,-1)])]))]),e.description||t.description?(s.openBlock(),s.createElementBlock("div",Lee,[t.description?s.renderSlot(r.$slots,"description",{},void 0,!0,0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(e.description),1)],64))])):s.createCommentVNode("",!0),t.default?(s.openBlock(),s.createElementBlock("div",zee,[s.renderSlot(r.$slots,"default",{},void 0,!0)])):s.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-d66bc5e4"]]),Tee={class:"image-library-pexels"},Mee={class:"search-bar-wrapper"},Qee={key:0,class:"photos"},Oee=["onClick"],Wee=["src"],Yee={key:0,class:"loading-wrapper"},Vee={key:1,class:"loading-wrapper"},Pee=s.defineComponent({__name:"Pexels",props:{apiKey:{},width:{},height:{},uploadContext:{},uploadImageAsset:{type:Function}},emits:["select"],setup(e,{emit:t}){const r=jl(),n=e,a=t,i=s.ref("city"),{searchPhotos:o,photos:c,total:l}=Nee(n.apiKey),u=s.ref(),f=s.ref(!1);async function h(){i.value.length>0&&(f.value=!0,l.value=25,c.value=[],await o(i.value),u.value=i.value,f.value=!1)}async function d(A,b){await o(i.value,A)}const g=s.ref();async function p(A){g.value=A.id;const b=await n.uploadImageAsset({blob:await fetch(r(A.src.original)).then(C=>C.blob()),context:n.uploadContext,width:n.width,height:n.height,key:`pexels-${A.id}`,name:A.id.toString(),onProgress(C){console.log("upload progress",C)}});g.value=void 0,a("select",b.src)}return(A,b)=>(s.openBlock(),s.createElementBlock("div",Tee,[s.createElementVNode("header",null,[s.createElementVNode("div",Mee,[s.createVNode(el,{modelValue:i.value,"onUpdate:modelValue":b[0]||(b[0]=C=>i.value=C),round:"",placeholder:"Search...",size:"medium",onEnter:h},null,8,["modelValue"]),s.createVNode(Et,{active:"",onClick:h},{default:s.withCtx(()=>[...b[1]||(b[1]=[s.createTextVNode("Search",-1)])]),_:1})])]),s.createElementVNode("main",null,[u.value?(s.openBlock(),s.createElementBlock("div",Qee,[s.createVNode(Fee,{items:s.unref(c),total:s.unref(l),fetch:d,"visible-trigger-offset":0},{item:s.withCtx(({item:C})=>[(s.openBlock(),s.createElementBlock("div",{key:C.id,class:"photo-wrapper",onClick:w=>p(C)},[s.createElementVNode("div",{class:s.normalizeClass(["preview",{loading:g.value===C.id}])},[s.createElementVNode("img",{src:s.unref(r)(C.src.tiny)},null,8,Wee),g.value===C.id?(s.openBlock(),s.createElementBlock("div",Yee,[s.createVNode(Ul)])):s.createCommentVNode("",!0)],2)],8,Oee))]),_:1},8,["items","total"])])):f.value?(s.openBlock(),s.createElementBlock("div",Vee,[s.createVNode(Ul)])):(s.openBlock(),s.createBlock(bC,{key:2,description:"Search for images on Pexels"},{icon:s.withCtx(()=>[s.createVNode(s.unref(WJ))]),_:1}))])]))}});function jee(e,t,r){return e.map(n=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:n.id,width:n.image.width,height:n.image.height,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=200&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=400&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height}}}))}function Uee(e,t,r){return e.map(({thumbnailLink:n,webContentLink:a,sha256Checksum:i,imageMediaMetadata:o})=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(a)}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:i,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=200&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=400&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0}}}))}function $ee(e,t,r,n){const a=s.ref();return{sharedItems:a,fetchSharedDrive:async()=>{if(e==="onedrive"){const o=`https://shared-drive.bluepic.io/onedrive?${AC({sharing:t})}`,l=await(await fetch(o)).json();a.value=jee(l.children,r,n)}else if(e==="googledrive"){const o=`https://shared-drive.bluepic.io/googledrive?${AC({sharing:t})}`,l=await(await fetch(o)).json();a.value=Uee(l.files,r,n)}}}}const Hee={class:"image-library-shared-drive"},Xee={key:0,class:"photos"},Jee=["onClick"],Kee={class:"preview"},qee=["src"],ete={key:1,class:"loading-wrapper"},tte=ht(s.defineComponent({__name:"SharedDrive",props:{service:{},sharedUrl:{},width:{},height:{}},emits:["select"],setup(e,{emit:t}){const r=jl(),n=e,a=t,{fetchSharedDrive:i,sharedItems:o}=$ee(n.service,n.sharedUrl,n.width,n.height);i();function c(l){a("select",l.src)}return(l,u)=>(s.openBlock(),s.createElementBlock("div",Hee,[s.unref(o)?(s.openBlock(),s.createElementBlock("div",Xee,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(o),f=>(s.openBlock(),s.createElementBlock("div",{class:"photo-wrapper",onClick:h=>c(f)},[s.createElementVNode("div",Kee,[s.createElementVNode("img",{src:s.unref(r)(f.previews.small.src)},null,8,qee)])],8,Jee))),256))])):(s.openBlock(),s.createElementBlock("div",ete,[s.createVNode(Ul)]))]))}}),[["__scopeId","data-v-6b7dadc2"]]),rte={class:"image-library-custom"},nte=s.defineComponent({__name:"Custom",props:{controller:{},label:{},name:{},props:{}},setup(e){const t=e,r=import(t.controller),n=s.ref();return r.then(a=>{n.value=new a.default(t.props)}),(a,i)=>(s.openBlock(),s.createElementBlock("div",rte,"JAJAJA"))}}),ate={class:"image-library-wrapper"},ite={key:0,class:"nav-view-wrapper"},ote={class:"icon-wrapper"},ste={class:"label"},lte={key:1,class:"library-view-wrapper"},HB=ht(s.defineComponent({__name:"ImageLibraryWrapper",props:{options:{},activeKey:{},imageLibraries:{},convertTo:{},quality:{},width:{},height:{},bridge:{},field:{}},emits:["select","update:active-key"],setup(e,{emit:t}){const r=e,n=t,a=s.ref(r.activeKey);s.watch(a,()=>{r.activeKey!==a.value&&n("update:active-key",a.value)}),s.watch(()=>r.activeKey,()=>{r.activeKey!==a.value&&(a.value=r.activeKey)});function i(p){a.value=p}const o=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type==="pexels"))==null?void 0:p.apiKey}),c=s.computed(()=>r.imageLibraries.find(p=>p.type==="sharedDrive"&&p.service===a.value).sharedUrl),l=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.label}),u=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.name}),f=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.controller}),h=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.props});function d(p){const A=p[0];A&&g(A.src)}function g(p){n("select",p)}return(p,A)=>(s.openBlock(),s.createElementBlock("div",ate,[s.createVNode(s.Transition,{name:"slide-library"},{default:s.withCtx(()=>[a.value===void 0?(s.openBlock(),s.createElementBlock("div",ite,[s.createElementVNode("div",{class:"image-library-source-navigation",style:s.normalizeStyle({"--options-length":e.options.length})},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.options,b=>(s.openBlock(),s.createBlock(N1,{key:b.key,bordered:!0,onClick:C=>i(b.key)},{default:s.withCtx(()=>[s.createElementVNode("div",ote,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(b.icon)))]),s.createElementVNode("div",ste,s.toDisplayString(b.label),1)]),_:2},1032,["onClick"]))),128))],4)])):(s.openBlock(),s.createElementBlock("div",lte,[a.value==="upload"?(s.openBlock(),s.createBlock(_q,{key:0,width:e.width,height:e.height,"convert-to":e.convertTo,quality:e.quality,field:e.field,"handle-upload":e.bridge.handleUpload,onUpload:d},null,8,["width","height","convert-to","quality","field","handle-upload"])):a.value==="pexels"?(s.openBlock(),s.createBlock(Pee,{key:1,"api-key":o.value,width:e.width,height:e.height,"upload-image-asset":e.bridge.handleUpload,"upload-context":{field:e.field},onSelect:g},null,8,["api-key","width","height","upload-image-asset","upload-context"])):a.value==="googledrive"||a.value==="onedrive"||a.value==="icloud"||a.value==="dropbox"?(s.openBlock(),s.createBlock(tte,{key:2,service:a.value,"shared-url":c.value,width:e.width,height:e.height,onSelect:g},null,8,["service","shared-url","width","height"])):a.value==="custom"?(s.openBlock(),s.createBlock(nte,{key:3,label:l.value??"Custom Library",name:u.value,controller:f.value,props:h.value},null,8,["label","name","controller","props"])):s.createCommentVNode("",!0)]))]),_:1})]))}}),[["__scopeId","data-v-61c69114"]]),XB=ht(s.defineComponent({__name:"BxList",props:{divider:{type:Boolean,default:!0},bordered:{type:Boolean,default:!1},variant:{default:"plain"}},setup(e){return s.useSlots(),(t,r)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-list",{"has-divider":e.divider&&e.variant==="plain",bordered:e.bordered,[`variant-${e.variant}`]:!0}])},[s.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-53785398"]]),cte={class:"bx-list-item__inner"},ute={key:0,class:"bx-list-item__prefix"},dte={class:"bx-list-item__content"},fte={key:1,class:"bx-list-item__suffix"},JB=ht(s.defineComponent({__name:"BxListItem",props:{interactive:{type:Boolean,default:!0}},setup(e){const t=s.useSlots(),r=s.computed(()=>!!t.prefix),n=s.computed(()=>!!t.suffix);return(a,i)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-list-item",{"has-prefix":r.value,"has-suffix":n.value,interactive:e.interactive}])},[s.createElementVNode("div",cte,[t.prefix?(s.openBlock(),s.createElementBlock("div",ute,[s.renderSlot(a.$slots,"prefix",{},void 0,!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",dte,[s.renderSlot(a.$slots,"default",{},void 0,!0)]),t.suffix?(s.openBlock(),s.createElementBlock("div",fte,[s.renderSlot(a.$slots,"suffix",{},void 0,!0)])):s.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-1048af22"]]),hte=["aria-label"],gte=["onClick"],mte={class:"icon"},pte={class:"label"},Ate={class:"pullup-menu"},bte={class:"icon"},L1=ht(s.defineComponent({__name:"BxDropdown",props:s.mergeModels({options:{},allowedPlacements:{},mobileLayout:{type:Boolean,default:!1},ariaLabel:{default:"Menu"}},{show:{type:Boolean,required:!1,default:!1},showModifiers:{}}),emits:s.mergeModels(["select"],["update:show"]),setup(e,{emit:t}){const r=e,n=t,a=s.useModel(e,"show");function i(w){a.value=!1,n("select",w.value)}const o=s.useSlots(),c=mi("bx-dropdown-menu"),{setSlotRef:l,vNodes:u,slotElements:f}=T2(o.trigger);function h(w){(w.key==="ArrowDown"||w.key==="ArrowUp")&&(w.preventDefault(),a.value||(a.value=!0),b(0))}let d;s.watch(f,(w,y)=>{for(const E of y??[])E instanceof HTMLElement&&E.removeEventListener("keydown",h);d=void 0;const x=w[0];x instanceof HTMLElement&&(x.setAttribute("aria-haspopup","menu"),x.setAttribute("aria-controls",c),x.setAttribute("aria-expanded",String(a.value)),x.addEventListener("keydown",h),d=x)},{immediate:!0});const g=s.ref(0),p=[];function A(w,y){if(!w){p[y]=void 0;return}const x=w instanceof HTMLElement?w:w.$el;p[y]=x instanceof HTMLElement?x:void 0}function b(w){if(r.options.length===0)return;const y=(w+r.options.length)%r.options.length;g.value=y,s.nextTick(()=>{var x;return(x=p[y])==null?void 0:x.focus()})}function C(w){const y=r.options.length;if(y!==0)switch(w.key){case"ArrowDown":w.preventDefault(),b(g.value+1);break;case"ArrowUp":w.preventDefault(),b(g.value-1);break;case"Home":w.preventDefault(),b(0);break;case"End":w.preventDefault(),b(y-1);break;case"Enter":case" ":w.preventDefault(),i(r.options[g.value]),d==null||d.focus();break;case"Escape":w.preventDefault(),w.stopPropagation(),a.value=!1,d==null||d.focus();break;case"Tab":a.value=!1;break}}return s.watch(a,w=>{d==null||d.setAttribute("aria-expanded",String(w)),w&&(g.value=0,s.nextTick(()=>{var y;return(y=p[0])==null?void 0:y.focus()}))}),s.onUnmounted(()=>{d&&d.removeEventListener("keydown",h)}),(w,y)=>e.mobileLayout?(s.openBlock(),s.createBlock(wu,{key:0,show:a.value,"onUpdate:show":y[1]||(y[1]=x=>a.value=x),"disable-background-effect":"","custom-classes":["bx-dropdown-mobile-layout-popup"],closeable:!1},{trigger:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(u),(x,E)=>(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:s.unref(l)(E)},null,512))),128))]),content:s.withCtx(()=>[s.createElementVNode("div",{class:s.normalizeClass(["pullup-menu-wrapper",{}])},[s.createElementVNode("div",{class:"pullup-menu",role:"menu","aria-label":e.ariaLabel},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.options,x=>(s.openBlock(),s.createElementBlock("button",{type:"button",role:"menuitem",class:"select-button",onClick:E=>i(x)},[s.createElementVNode("div",mte,[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x.icon)))]),_:2},1024)]),s.createElementVNode("div",pte,[o.optionLabel?s.renderSlot(w.$slots,"optionLabel",{option:x},void 0,!0,0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(x.label),1)],64))])],8,gte))),256))],8,hte),s.createElementVNode("div",Ate,[s.createElementVNode("button",{type:"button",class:"select-button","aria-label":"Close menu",onClick:y[0]||(y[0]=x=>a.value=!1)},[s.createElementVNode("div",bte,[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(cs))]),_:1})]),y[3]||(y[3]=s.createElementVNode("div",{class:"label"},"Close",-1))])])])]),_:3},8,["show"])):(s.openBlock(),s.createBlock(sd,{key:1,show:a.value,"onUpdate:show":y[2]||(y[2]=x=>a.value=x),trigger:"click","allowed-placements":e.allowedPlacements??["bottom","top"],arrow:!0,"custom-styles":{},"custom-classes":["dropdown-popover"],"disable-background-effect":""},{trigger:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(u),(x,E)=>(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:s.unref(l)(E)},null,512))),128))]),content:s.withCtx(()=>[s.createVNode(XB,{id:s.unref(c),role:"menu","aria-label":e.ariaLabel,onKeydown:C},{default:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.options,(x,E)=>(s.openBlock(),s.createBlock(JB,{key:x.value,ref_for:!0,ref:S=>A(S,E),role:"menuitem",tabindex:E===g.value?0:-1,onClick:S=>i(x)},s.createSlots({default:s.withCtx(()=>[o.optionLabel?s.renderSlot(w.$slots,"optionLabel",{option:x},void 0,!0,0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(x.label),1)],64))]),_:2},[x.icon?{name:"prefix",fn:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x.icon)))]),_:2},1024)]),key:"0"}:void 0]),1032,["tabindex","onClick"]))),128))]),_:3},8,["id","aria-label"])]),_:3},8,["show","allowed-placements"]))}}),[["__scopeId","data-v-74e3b672"]]);function ld(e){return new Promise(function(t,r){if(typeof e!="string"&&!(e instanceof Blob)){r({err:"no image source"});return}const n=new Image;n.addEventListener("load",a=>{t({width:n.width,height:n.height,ratio:n.height/n.width})}),n.addEventListener("error",()=>r({err:"image corrupted"})),n.src=typeof e=="string"?e:URL.createObjectURL(e)})}function KB({height:e,left:t,top:r,width:n},a,i){const o=1/Math.max((n??0)/a,(e??0)/i),c=[Math.min(1,Bo(Math.max(1e-6,t??0)/(a-(n??0)),6)),Math.min(1,Bo(Math.max(1e-6,r??0)/(i-(e??0)),6))],l=[Math.max(-1,Math.min(1,(c[0]-.5)*2)),Math.max(-1,Math.min(1,(c[1]-.5)*2))];return{scale:o,innerPos:l}}function P2(e,t,r,n){const a=e.innerPos[0]/2+.5,i=e.innerPos[1]/2+.5,o=t/r>n?r*n:t,c=t/r>n?r:t/n,l=o/e.scale,u=c/e.scale,f=t-l,h=r-u,d=f*a,g=h*i;return{left:d,top:g,width:l,height:u}}var vte=Object.defineProperty,Cte=(e,t,r)=>t in e?vte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ka=(e,t,r)=>Cte(e,typeof t!="symbol"?t+"":t,r);function yte(e){return e*Math.PI/180}function qB(e,t,r){return Math.min(Math.max(e,t),r)}function j2(e,t,r){const[n,a]=e,[i,o]=t,c=Math.cos(r)*(n-i)-Math.sin(r)*(a-o)+i,l=Math.sin(r)*(n-i)+Math.cos(r)*(a-o)+o;return[c,l]}function wte(e){return e.deltaMode===0}let Ite=class extends EventTarget{constructor(t,r,n,a,i,o,c=.1,l=10,u=!1,f=!0){super(),ka(this,"wrapperBounds",{x:0,y:0,width:100,height:100}),ka(this,"canvasBounds",{x:0,y:0,width:100,height:100}),ka(this,"translateSpeed",1),ka(this,"zoomSpeed",1),ka(this,"translateSpeedAppleTrackpad",1),ka(this,"zoomSpeedAppleTrackpad",1),ka(this,"isGestureActive",!1),ka(this,"roElement",null),ka(this,"roCanvas",null),ka(this,"ancestorMotionCleanup",null),ka(this,"gestureStartRotate",0),ka(this,"dragStart",null),ka(this,"dragStartFrozenX",null),ka(this,"dragStartFrozenY",null),ka(this,"touchStarts",null),ka(this,"touchStartTranslateX",0),ka(this,"touchStartTranslateY",0),this.element=t,this.offset=r,this.translateX=n,this.translateY=a,this.scale=i,this.rotate=o,this.minScale=c,this.maxScale=l,this.clampBounds=u,this.rotation=f,this.roElement=new ResizeObserver(()=>{const{x:h,y:d,width:g,height:p}=this.element.getBoundingClientRect();this.wrapperBounds={x:h,y:d,width:g,height:p},this.update()}),this.roCanvas=new ResizeObserver(h=>{const{width:d,height:g}=h[0].contentRect;(d!==this.canvasBounds.width||g!==this.canvasBounds.height)&&(this.canvasBounds={...this.canvasBounds,width:d,height:g},this.isGestureActive||this.update())}),requestAnimationFrame(()=>{this.wrapperBounds=this.element.getBoundingClientRect(),this.canvasBounds=this.canvasElement.getBoundingClientRect(),this.update(),this.dispatchEvent(new Event("init"))}),this.roCanvas.observe(this.canvasElement),this.roElement.observe(this.element),this.installAncestorMotionListeners()}installAncestorMotionListeners(){const t=()=>{const{x:i,y:o,width:c,height:l}=this.element.getBoundingClientRect();i===this.wrapperBounds.x&&o===this.wrapperBounds.y&&c===this.wrapperBounds.width&&l===this.wrapperBounds.height||(this.wrapperBounds={x:i,y:o,width:c,height:l},this.update())},r=i=>!(i instanceof Node)||i===this.element?!1:i.contains(this.element),n=i=>{r(i.target)&&t()},a=["transitionrun","transitionend","transitioncancel","animationend","animationcancel"];for(const i of a)document.addEventListener(i,n,!0);this.ancestorMotionCleanup=()=>{for(const i of a)document.removeEventListener(i,n,!0)}}get canvasElement(){return this.element.querySelector(".canvas")}get wrapperInnerX(){return this.wrapperBounds.x+this.offset.left}get wrapperInnerY(){return this.wrapperBounds.y+this.offset.top}get wrapperInnerWidth(){return this.wrapperBounds.width-this.offset.left-this.offset.right}get wrapperInnerHeight(){return this.wrapperBounds.height-this.offset.top-this.offset.bottom}get wrapperInnerRatio(){return this.wrapperInnerWidth/this.wrapperInnerHeight}get canvasNaturalRatio(){return this.canvasBounds.width/this.canvasBounds.height}get naturalScale(){return this.canvasNaturalRatio>=this.wrapperInnerRatio?this.wrapperInnerWidth/this.canvasBounds.width:this.wrapperInnerHeight/this.canvasBounds.height}setTranslateFromUserGesture(t,r){if(this.clampBounds){const n=this.clampTranslate({translateX:t,translateY:r,scale:this.scale,rotate:this.rotate});this.translateX=n.translateX,this.translateY=n.translateY,this.rotate=0}else this.translateX=t,this.translateY=r}handleGesturestart(t){this.gestureStartRotate=this.rotate}handleGesturechange(t){const{clientX:r,clientY:n}=t,a=t.rotation;if(a===0||!this.rotation)return;const i=this.normalizeClientCoords(r,n);this.rotateCanvas(i[0],i[1],this.gestureStartRotate+yte(a))}handleGestureend(t){}handleMousedown(t){t.preventDefault(),this.dragStart=[t.clientX,t.clientY],this.dragStartFrozenX=this.translateX,this.dragStartFrozenY=this.translateY}handleMouseup(t){t.preventDefault(),this.dragStart=null,this.dragStartFrozenX=null,this.dragStartFrozenY=null}handleMousemove(t){if(t.preventDefault(),this.dragStart&&this.dragStartFrozenX!==null&&this.dragStartFrozenY!==null){const r=t.clientX-this.dragStart[0],n=t.clientY-this.dragStart[1],a=this.dragStartFrozenX- -r,i=this.dragStartFrozenY- -n;this.setTranslateFromUserGesture(a,i),this.update()}}handleWheel(t){let{deltaX:r,deltaY:n,ctrlKey:a}=t;const i=wte(t);i||(Math.abs(n)>=100&&(n=Math.sign(n)*(Math.abs(n)/120)),Math.abs(r)>=100&&(r=Math.sign(r)*(Math.abs(r)/120)));const o=this.scale;if(a){const c=i?.01*this.zoomSpeedAppleTrackpad:.1*this.zoomSpeed,l=1+-n*c;let u=o*l;if(u=qB(u,this.minScale,this.maxScale),(u===this.minScale||u===this.maxScale)&&(u===this.minScale&&l<1||u===this.maxScale&&l>1)){t.preventDefault();return}const f=this.relativeWrapperCoordinatesFromClientCoords(t.clientX,t.clientY),[h,d]=this.calcProjectionTranslate(u,f,this.normalizeMatrixCoordinates(t.clientX,t.clientY));this.setTranslateFromUserGesture(h,d),this.scale=u}else{const c=i?1*this.translateSpeedAppleTrackpad:25*this.translateSpeed;this.setTranslateFromUserGesture(this.translateX-r*c,this.translateY-n*c)}this.update(),t.preventDefault()}freezeTouches(t){return Array.from(t).map(r=>{const n=this.clientCoordsToWrapperCoords(r.clientX,r.clientY);return{client:[r.clientX,r.clientY],canvasRel:this.getCanvasCoordsRel(n[0],n[1])}})}handleTouchstart(t){this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY,this.isGestureActive=!0,t.preventDefault()}handleTouchmove(t){t.preventDefault();const r=Array.from(t.touches).map(n=>this.clientCoordsToWrapperCoords(n.clientX,n.clientY));if(this.touchStarts){if(r.length>=2&&this.touchStarts.length>=2){const n=[this.touchStarts[0].canvasRel[0]*this.canvasBounds.width,this.touchStarts[0].canvasRel[1]*this.canvasBounds.height],a=[this.touchStarts[1].canvasRel[0]*this.canvasBounds.width,this.touchStarts[1].canvasRel[1]*this.canvasBounds.height],i=Math.sqrt(Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2)),o=Math.sqrt(Math.pow(r[0][0]-r[1][0],2)+Math.pow(r[0][1]-r[1][1],2))/this.naturalScale,c=qB(o/i,this.minScale,this.maxScale),l=[r[0][0]/this.wrapperInnerWidth,r[0][1]/this.wrapperInnerHeight],u=this.touchStarts[0].canvasRel,[f,h]=this.calcProjectionTranslate(c,l,u,0);if(this.rotation){let d=0,g=0,p=0;const A=Math.atan2(a[1]-n[1],a[0]-n[0]);p=Math.atan2(r[1][1]-r[0][1],r[1][0]-r[0][0])-A;const b=(x,E)=>[this.offset.left+this.canvasBounds.width*x*this.naturalScale*c+f,this.offset.top+this.canvasBounds.height*E*this.naturalScale*c+h],C=b(0,0),w=b(this.touchStarts[0].canvasRel[0],this.touchStarts[0].canvasRel[1]),y=j2(C,w,p);d=y[0]-C[0],g=y[1]-C[1],this.scale=c,this.rotate=p,this.setTranslateFromUserGesture(f+d,h+g)}else this.scale=c,this.setTranslateFromUserGesture(f,h)}else{const n=t.touches[0].clientX-this.touchStarts[0].client[0],a=t.touches[0].clientY-this.touchStarts[0].client[1],i=this.touchStartTranslateX+n,o=this.touchStartTranslateY+a;this.setTranslateFromUserGesture(i,o)}this.update()}}handleTouchend(t){t.touches.length===0?this.touchStarts=null:(this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY),this.isGestureActive=!1}calcProjectionTranslate(t,r,n,a){const i=this.canvasBounds.width*this.naturalScale,o=this.canvasBounds.height*this.naturalScale,c=n[0]*i*t,l=n[1]*o*t,u=j2([c,l],[0,0],a??this.rotate),f=r[0]*this.wrapperInnerWidth,h=r[1]*this.wrapperInnerHeight,d=f-u[0],g=h-u[1];return[d,g]}applyTransform(t,r,n){const a=this.calcProjectionTranslate(t,r,n,0);this.scale=t,this.setTranslateFromUserGesture(a[0],a[1]),this.update()}composeRelPoint(t,r,n,a,i,o){n=n??this.scale,a=a??this.translateX,i=i??this.translateY,o=o??this.rotate;const c=[this.offset.left,this.offset.top],l=[this.offset.left+this.canvasBounds.width*(n*this.naturalScale)*t,this.offset.top+this.canvasBounds.height*(n*this.naturalScale)*r],u=j2(l,c,o);return[u[0]+a,u[1]+i]}composePoint(t,r){const n=t/this.canvasBounds.width,a=r/this.canvasBounds.height;return this.composeRelPoint(n,a)}getAnchorOffset(t,r,n,a,i=[.5,.5]){const o=this.calcProjectionTranslate(t,i,i,0),c=[this.offset.left+o[0]+this.canvasBounds.width*(t*this.naturalScale)*i[0],this.offset.top+o[1]+this.canvasBounds.height*(t*this.naturalScale)*i[1]],l=this.composeRelPoint(i[0],i[1],t,r,n,a),u=l[0]-c[0],f=l[1]-c[1];return[u,f]}getCanvasCoordsRel(t,r){const n=[0,0],a=[t-this.translateX,r-this.translateY],i=j2(a,n,-this.rotate),o=[i[0]/this.renderinScale,i[1]/this.renderinScale];return[o[0]/this.canvasBounds.width,o[1]/this.canvasBounds.height]}clientCoordsToWrapperCoords(t,r){const{x:n,y:a}=this.element.getBoundingClientRect();return[t-n-this.offset.left,r-a-this.offset.top]}relativeWrapperCoordinatesFromClientCoords(t,r){const[n,a]=this.clientCoordsToWrapperCoords(t,r);return[n/this.wrapperInnerWidth,a/this.wrapperInnerHeight]}normalizeMatrixCoordinates(t,r){const n=this.clientCoordsToWrapperCoords(t,r);return this.getCanvasCoordsRel(n[0],n[1])}normalizeClientCoords(t,r){const[n,a]=this.normalizeMatrixCoordinates(t,r);return[n*this.canvasBounds.width,a*this.canvasBounds.height]}rotateCanvas(t,r,n){const a=t/this.canvasBounds.width,i=r/this.canvasBounds.height,o=this.composeRelPoint(a,i,this.scale,0,0,n),c=this.composeRelPoint(a,i);this.setTranslateFromUserGesture(c[0]-o[0],c[1]-o[1]),this.rotate=n,this.update()}get renderinScale(){return this.naturalScale*this.scale}get renderingTranslateX(){return this.offset.left+this.translateX}get renderingTranslateY(){return this.offset.top+this.translateY}get renderingRotate(){return this.rotate}clampTranslate(t,r=[.5,.5]){const n=this.canvasBounds.width*this.naturalScale*t.scale,a=this.canvasBounds.height*this.naturalScale*t.scale,i=n-this.wrapperInnerWidth,o=a-this.wrapperInnerHeight,c=i>0?-i:0,l=Math.min(0,Math.max(t.translateX,c)),u=o>0?-o:0,f=Math.min(0,Math.max(t.translateY,u)),h=-Math.min(0,i)*r[0],d=-Math.min(0,o)*r[1];return{translateX:l+h,translateY:f+d}}update(){this.canvasElement.style.transformOrigin="top left",this.canvasElement.style.transform=`translateX(${this.renderingTranslateX}px) translateY(${this.renderingTranslateY}px) scale(${this.renderinScale}) rotate(${this.renderingRotate}rad)`,this.dispatchEvent(new Event("update"))}destroy(){var t,r,n;(t=this.roElement)==null||t.disconnect(),this.roElement=null,(r=this.roCanvas)==null||r.disconnect(),this.roCanvas=null,(n=this.ancestorMotionCleanup)==null||n.call(this),this.ancestorMotionCleanup=null}};const xte={class:"canvas"},Ete={class:"matrix"},Bte=s.defineComponent({__name:"Zoompinch",props:{transform:{default:()=>({translateX:0,translateY:0,scale:1,rotate:0})},offset:{default:()=>({left:0,top:0,right:0,bottom:0})},maxScale:{default:10},minScale:{default:.5},clampBounds:{type:Boolean,default:!1},rotation:{type:Boolean,default:!0},mouse:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},touch:{type:Boolean,default:!0},gesture:{type:Boolean,default:!0},zoomSpeed:{},translateSpeed:{},zoomSpeedAppleTrackpad:{},translateSpeedAppleTrackpad:{}},emits:["update:transform","init","dragGestureStart","dragGestureEnd"],setup(e,{expose:t,emit:r}){const n=e,a=r,i=s.ref(),o=s.ref(),c=s.ref(!1);window.zoompinchEngine=o;const l=s.ref(()=>{throw new Error("Not initialized yet")}),u=s.ref(0),f=s.ref(0);s.onMounted(()=>{i.value&&(o.value=new Ite(i.value,n.offset,n.transform.translateX,n.transform.translateY,n.transform.scale,n.transform.rotate,n.minScale,n.maxScale,n.clampBounds,n.rotation),n.zoomSpeed!==void 0&&(o.value.zoomSpeed=n.zoomSpeed),n.translateSpeed!==void 0&&(o.value.translateSpeed=n.translateSpeed),n.zoomSpeedAppleTrackpad!==void 0&&(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad),n.translateSpeedAppleTrackpad!==void 0&&(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad),o.value.addEventListener("init",()=>{a("init")}),o.value.addEventListener("update",()=>{if(!o.value)return;const B={translateX:o.value.translateX,translateY:o.value.translateY,scale:o.value.scale,rotate:o.value.rotate};(B.translateX!==n.transform.translateX||B.translateY!==n.transform.translateY||B.scale!==n.transform.scale||B.rotate!==n.transform.rotate)&&a("update:transform",B),l.value=(N,k)=>o.value.composePoint(N,k),u.value=o.value.canvasBounds.width,f.value=o.value.canvasBounds.height}),o.value.addEventListener("init",()=>{c.value=!0}))}),s.watch(()=>n.transform,()=>{o.value&&(o.value.translateX!==n.transform.translateX||o.value.translateY!==n.transform.translateY||o.value.scale!==n.transform.scale||o.value.rotate!==n.transform.rotate)&&(o.value.translateX=n.transform.translateX,o.value.translateY=n.transform.translateY,o.value.scale=n.transform.scale,o.value.rotate=n.transform.rotate,o.value.update())},{deep:!0}),s.watch(()=>n.offset,B=>{o.value&&(o.value.offset=B,o.value.update())},{deep:!0}),s.watch(()=>n.minScale,B=>{o.value&&(o.value.minScale=B,o.value.update())}),s.watch(()=>n.maxScale,B=>{o.value&&(o.value.maxScale=B,o.value.update())}),s.watch(()=>n.clampBounds,B=>{o.value&&(o.value.clampBounds=B,o.value.setTranslateFromUserGesture(o.value.translateX,o.value.translateY),o.value.update())}),s.watch(()=>n.rotation,B=>{o.value&&(o.value.rotation=B,o.value.update())}),s.watch(()=>n.zoomSpeed,()=>{!o.value||n.zoomSpeed===void 0||(o.value.zoomSpeed=n.zoomSpeed)}),s.watch(()=>n.translateSpeed,()=>{!o.value||n.translateSpeed===void 0||(o.value.translateSpeed=n.translateSpeed)}),s.watch(()=>n.zoomSpeedAppleTrackpad,()=>{!o.value||n.zoomSpeedAppleTrackpad===void 0||(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad)}),s.watch(()=>n.translateSpeedAppleTrackpad,()=>{!o.value||n.translateSpeedAppleTrackpad===void 0||(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad)});const h=(B,N,k,G)=>{o.value&&(G!==void 0&&(o.value.rotate=G),o.value.applyTransform(B,N,k))},d=B=>{o.value&&n.wheel&&o.value.handleWheel(B)},g=B=>{o.value&&n.gesture&&o.value.handleGesturestart(B)},p=B=>{o.value&&n.gesture&&o.value.handleGesturechange(B)},A=B=>{o.value&&n.gesture&&o.value.handleGestureend(B)},b=B=>{o.value&&n.mouse&&o.value.handleMousedown(B)},C=B=>{o.value&&n.mouse&&o.value.handleMousemove(B)},w=B=>{o.value&&n.mouse&&o.value.handleMouseup(B)},y=B=>{o.value&&n.touch&&o.value.handleTouchstart(B)},x=B=>{o.value&&n.touch&&o.value.handleTouchmove(B)},E=B=>{o.value&&n.touch&&o.value.handleTouchend(B)};window.addEventListener("gesturechange",p),window.addEventListener("gestureend",A),window.addEventListener("mousemove",C),window.addEventListener("mouseup",w),window.addEventListener("touchmove",x),window.addEventListener("touchend",E),s.onUnmounted(()=>{window.removeEventListener("gesturechange",p),window.removeEventListener("gestureend",A),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",w),window.removeEventListener("touchmove",x),window.removeEventListener("touchend",E)});const S=(B,N)=>{if(!o.value)throw new Error("Zoompinch engine not initialized");return o.value.normalizeClientCoords(B,N)},_=(B,N,k)=>{o.value&&o.value.rotateCanvas(B,N,k)};return s.useSlots(),t({applyTransform:h,composePoint:l,normalizeClientCoords:S,zoompinchEngine:o,canvasWidth:u,canvasHeight:f,rotateCanvas:_}),(B,N)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"zoompinchRef",ref:i,class:"zoompinch",onWheel:d,onGesturestart:g,onMousedown:b,onTouchstart:y},[s.createElementVNode("div",xte,[s.renderSlot(B.$slots,"default",{},void 0,!0)]),s.createElementVNode("div",Ete,[c.value&&l.value?s.renderSlot(B.$slots,"matrix",{key:0,composePoint:l.value,normalizeClientCoords:S,canvasWidth:u.value,canvasHeight:f.value},void 0,!0):s.createCommentVNode("",!0)])],544))}}),kte=(e,t)=>{const r=e.__vccOpts||e;for(const[n,a]of t)r[n]=a;return r},ek=kte(Bte,[["__scopeId","data-v-fbdbcf7c"]]),z1=new Set;requestAnimationFrame(function e(){z1.forEach(t=>t()),requestAnimationFrame(e)});function tk(e,t,r){let n;const a=()=>{const o=e instanceof Function?e():e.value,c=n;o!==n&&(n=o,t(o,c))};return z1.add(a),()=>{z1.delete(a)}}function vC(e,t){let r=null;const n=this;return()=>{clearTimeout(r);var a=arguments;r=setTimeout(()=>{e.apply(n,a)},t)}}const Ste=["x","y","width","height"],_te=["cx","cy","r"],Rte=["cx","cy","r"],Nte=["cx","cy","r"],Dte=["cx","cy","r"],Fte=["cx","cy","r"],Zte=["cx","cy","r"],Gte=["cx","cy","r"],Lte=["cx","cy","r"],zte=["cx","cy","r"],Tte=["cx","cy","r"],Mte=["cx","cy","r"],Qte=["cx","cy","r"],Ote=["cx","cy","r"],Wte=["cx","cy","r"],Yte=["cx","cy","r"],Vte=["cx","cy","r"],Pte=ht(s.defineComponent({__name:"CropSkeleton",props:{x:{},y:{},width:{},height:{},aspectRatio:{},clamp:{}},emits:["update","effectiveHandleChange"],setup(e,{emit:t}){const r=e,n=t,a=s.ref(5),i=s.computed(()=>{const D=Math.min(r.width,r.height);return D>=a.value*8?a.value*4:Math.max(D/2,a.value)}),o=s.computed(()=>({x:r.x,y:r.y})),c=s.computed(()=>({x:r.x+r.width,y:r.y})),l=s.computed(()=>({x:r.x+r.width,y:r.y+r.height})),u=s.computed(()=>({x:r.x,y:r.y+r.height})),f=s.computed(()=>({x:r.x+r.width/2,y:r.y})),h=s.computed(()=>({x:r.x+r.width,y:r.y+r.height/2})),d=s.computed(()=>({x:r.x+r.width/2,y:r.y+r.height})),g=s.computed(()=>({x:r.x,y:r.y+r.height/2})),p=s.computed(()=>r.width>a.value*4&&r.height>a.value*4),A=s.ref(null),b=s.ref(null),C=s.ref(null),w=s.ref(null),y=s.ref(null),x=s.ref(null),E=s.ref(null);s.watch(x,D=>{n("effectiveHandleChange",D)});function S(D,F){console.log("handleThumbMouseDown",D,F),y.value=F,x.value=F,E.value=null,C.value={x:r.x,y:r.y,width:r.width,height:r.height},w.value={x:D.clientX,y:D.clientY},D.preventDefault(),D.stopPropagation()}function _(D,F){console.log("handleThumbTouchstart",D,F);const M=D.touches[0];y.value=F,x.value=F,E.value=null,C.value={x:r.x,y:r.y,width:r.width,height:r.height},w.value={x:M.clientX,y:M.clientY},D.preventDefault(),D.stopPropagation()}const B=()=>{y.value=null,x.value=null,E.value=null,C.value=null,w.value=null,A.value=null,b.value=null},N=()=>{y.value=null,x.value=null,E.value=null,C.value=null,w.value=null,A.value=null,b.value=null},k=D=>{if(A.value){if(!C.value)return;const F=D.clientX-A.value.x,M=D.clientY-A.value.y;b.value={x:C.value.x+F,y:C.value.y+M,width:C.value.width,height:C.value.height}}else y.value&&(E.value={x:D.clientX,y:D.clientY})},G=D=>{const F=D.touches[0];if(A.value){if(!C.value)return;const M=F.clientX-A.value.x,O=F.clientY-A.value.y;b.value={x:C.value.x+M,y:C.value.y+O,width:C.value.width,height:C.value.height}}else y.value&&(E.value={x:F.clientX,y:F.clientY})};function L(D){A.value={x:D.clientX,y:D.clientY},w.value={x:D.clientX,y:D.clientY},C.value={x:r.x,y:r.y,width:r.width,height:r.height},D.preventDefault(),D.stopPropagation()}function m(D){const F=D.touches[0];A.value={x:F.clientX,y:F.clientY},w.value={x:F.clientX,y:F.clientY},C.value={x:r.x,y:r.y,width:r.width,height:r.height},D.preventDefault(),D.stopPropagation()}function V(D){var re,te;const F=((re=r.clamp)==null?void 0:re.x)??-1/0,M=((te=r.clamp)==null?void 0:te.y)??-1/0,O=r.clamp?r.clamp.x+r.clamp.width:1/0,W=r.clamp?r.clamp.y+r.clamp.height:1/0;return{x:Math.min(Math.max(D.x,F),O-D.width),y:Math.min(Math.max(D.y,M),W-D.height),width:D.width,height:D.height}}function Y(D){const F=D.shiftKey?10:4;let M=0,O=0;switch(D.key){case"ArrowLeft":M=-F;break;case"ArrowRight":M=F;break;case"ArrowUp":O=-F;break;case"ArrowDown":O=F;break;default:return}D.preventDefault();const W={x:r.x,y:r.y,width:r.width,height:r.height};if(D.shiftKey)if(r.aspectRatio!=null){const te=D.key==="ArrowRight"||D.key==="ArrowDown"?F:-F,{bbox:ae}=Z("br",W,te,te,r.aspectRatio,r.clamp);n("update",ae)}else{const{bbox:re}=Z("br",W,M,O,void 0,r.clamp);n("update",re)}else n("update",V({...W,x:W.x+M,y:W.y+O}))}function P(D,F,M){const O={tl:"tr",tr:"tl",bl:"br",br:"bl",l:"r",r:"l"},W={tl:"bl",bl:"tl",tr:"br",br:"tr",t:"b",b:"t"};let re=D;return F&&(re=O[re]??re),M&&(re=W[re]??re),re}function Z(D,F,M,O,W,re){let te=F.x,ae=F.y,ue=F.x+F.width,Ce=F.y+F.height;switch(D){case"tl":te+=M,ae+=O;break;case"t":ae+=O;break;case"tr":ue+=M,ae+=O;break;case"r":ue+=M;break;case"br":ue+=M,Ce+=O;break;case"b":Ce+=O;break;case"bl":te+=M,Ce+=O;break;case"l":te+=M;break}const ne=te>ue,z=ae>Ce,Q=P(D,ne,z),U=(re==null?void 0:re.x)??-1/0,q=(re==null?void 0:re.y)??-1/0,de=re?re.x+re.width:1/0,he=re?re.y+re.height:1/0;if(W!=null)if(D==="tl"||D==="tr"||D==="bl"||D==="br"){const Se=D==="tl"||D==="bl"?ue:te,ve=D==="tl"||D==="tr"?Ce:ae,Ee=D==="tl"||D==="bl"?te:ue,$e=D==="tl"||D==="tr"?ae:Ce,He=Ee>=Se,Ve=$e>=ve;let Xe=Math.max(Math.abs(Ee-Se),1),ye=Math.max(Math.abs($e-ve),1);if(Xe/ye>W?Xe=ye*W:ye=Xe/W,re){const Ne=He?de-Se:Se-U,Je=Ve?he-ve:ve-q;(Xe>Ne||ye>Je)&&(Ne/Je>W?(ye=Math.min(ye,Je),Xe=ye*W):(Xe=Math.min(Xe,Ne),ye=Xe/W))}He?(te=Se,ue=Se+Xe):(ue=Se,te=Se-Xe),Ve?(ae=ve,Ce=ve+ye):(Ce=ve,ae=ve-ye)}else if(D==="r"||D==="l"){const ve=D==="r"?F.x:F.x+F.width,Ee=D==="r"?ue:te,$e=F.y+F.height/2,He=Ee>=ve;let Ve=Math.max(Math.abs(Ee-ve),1);if(re){const ye=He?de-ve:ve-U,Ne=Math.min($e-q,he-$e)*2;Ve=Math.max(Math.min(Ve,ye,Ne*W),1)}const Xe=Ve/W;He?(te=ve,ue=ve+Ve):(ue=ve,te=ve-Ve),ae=$e-Xe/2,Ce=$e+Xe/2}else{const ve=D==="b"?F.y:F.y+F.height,Ee=D==="b"?Ce:ae,$e=F.x+F.width/2,He=Ee>=ve;let Ve=Math.max(Math.abs(Ee-ve),1);if(re){const ye=He?he-ve:ve-q,Ne=Math.min($e-U,de-$e)*2;Ve=Math.max(Math.min(Ve,ye,Ne/W),1)}const Xe=Ve*W;He?(ae=ve,Ce=ve+Ve):(Ce=ve,ae=ve-Ve),te=$e-Xe/2,ue=$e+Xe/2}else{const we=Math.min(te,ue),Se=Math.min(ae,Ce),ve=Math.max(te,ue),Ee=Math.max(ae,Ce);te=we,ae=Se,ue=ve,Ce=Ee,re&&(te=Math.max(te,U),ae=Math.max(ae,q),ue=Math.min(ue,de),Ce=Math.min(Ce,he))}return{bbox:{x:te,y:ae,width:ue-te,height:Ce-ae},effectiveHandle:Q}}return tk(b,()=>{var D,F;if(b.value){const M=((D=r.clamp)==null?void 0:D.x)??-1/0,O=((F=r.clamp)==null?void 0:F.y)??-1/0,W=r.clamp?r.clamp.x+r.clamp.width:1/0,re=r.clamp?r.clamp.y+r.clamp.height:1/0;b.value.x<M&&(b.value.x=M),b.value.y<O&&(b.value.y=O),b.value.x+b.value.width>W&&(b.value.x=W-b.value.width),b.value.y+b.value.height>re&&(b.value.y=re-b.value.height),n("update",b.value)}}),tk(E,()=>{if(!y.value||!E.value||!w.value||!C.value)return;const D=E.value.x-w.value.x,F=E.value.y-w.value.y,{bbox:M,effectiveHandle:O}=Z(y.value,C.value,D,F,r.aspectRatio,r.clamp);x.value=O,n("update",M)}),window.addEventListener("mouseup",B),window.addEventListener("touchend",N),window.addEventListener("mousemove",k),window.addEventListener("touchmove",G),s.onUnmounted(()=>{window.removeEventListener("mouseup",B),window.removeEventListener("touchend",N),window.removeEventListener("mousemove",k),window.removeEventListener("touchmove",G)}),(D,F)=>(s.openBlock(),s.createElementBlock("g",null,[s.createElementVNode("rect",{x:e.x,y:e.y,width:e.width,height:e.height,class:"skeleton-rect",tabindex:"0",role:"application","aria-roledescription":"Crop area","aria-label":"Crop area. Use arrow keys to move, Shift plus arrow keys to resize.",onMousedown:L,onTouchstart:m,onKeydown:Y},null,40,Ste),s.createElementVNode("g",{class:s.normalizeClass({inactive:!p.value})},[s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-t",onMousedown:F[0]||(F[0]=M=>S(M,"t")),onTouchstart:F[1]||(F[1]=M=>_(M,"t"))},null,40,_te),s.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="t"}])},null,10,Rte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-r",onMousedown:F[2]||(F[2]=M=>S(M,"r")),onTouchstart:F[3]||(F[3]=M=>_(M,"r"))},null,40,Nte),s.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="r"}])},null,10,Dte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-b",onMousedown:F[4]||(F[4]=M=>S(M,"b")),onTouchstart:F[5]||(F[5]=M=>_(M,"b"))},null,40,Fte),s.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="b"}])},null,10,Zte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-l",onMousedown:F[6]||(F[6]=M=>S(M,"l")),onTouchstart:F[7]||(F[7]=M=>_(M,"l"))},null,40,Gte),s.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="l"}])},null,10,Lte)])],2),s.createElementVNode("g",null,[s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tl",onMousedown:F[8]||(F[8]=M=>S(M,"tl")),onTouchstart:F[9]||(F[9]=M=>_(M,"tl"))},null,40,zte),s.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="tl"}])},null,10,Tte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tr",onMousedown:F[10]||(F[10]=M=>S(M,"tr")),onTouchstart:F[11]||(F[11]=M=>_(M,"tr"))},null,40,Mte),s.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="tr"}])},null,10,Qte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-bl",onMousedown:F[12]||(F[12]=M=>S(M,"bl")),onTouchstart:F[13]||(F[13]=M=>_(M,"bl"))},null,40,Ote),s.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="bl"}])},null,10,Wte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-br",onMousedown:F[14]||(F[14]=M=>S(M,"br")),onTouchstart:F[15]||(F[15]=M=>_(M,"br"))},null,40,Yte),s.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="br"}])},null,10,Vte)])])]))}}),[["__scopeId","data-v-ab8c8451"]]);function cd(e,t,r){return Math.min(Math.max(e,t),r)}function jte(e,t){const r=cd(e.x,t.x,t.x+t.width),n=cd(e.y,t.y,t.y+t.height),a=cd(e.x+e.width,t.x,t.x+t.width),i=cd(e.y+e.height,t.y,t.y+t.height);return{x:r,y:n,width:a-r,height:i-n}}function Ute(e,t,r){if(r==null)return jte(e,t);let n=e.width,a=e.height;n>t.width&&(n=t.width,a=n/r),a>t.height&&(a=t.height,n=a*r);const i=cd(e.x,t.x,t.x+t.width-n),o=cd(e.y,t.y,t.y+t.height-a);return{x:i,y:o,width:n,height:a}}function $te(e){return new Promise((t,r)=>{if(e.complete&&e.naturalWidth!==0){console.log("[0] getBoundingClientRect",e.getBoundingClientRect()),t();return}const n=()=>{e.naturalWidth*e.naturalHeight>0&&(console.log("[1] getBoundingClientRect",e.getBoundingClientRect()),setTimeout(()=>{console.log("[2] getBoundingClientRect",e.getBoundingClientRect()),t()}),z1.delete(n))};z1.add(n),e.addEventListener("error",()=>r(new Error("Failed to load image")),{once:!0})})}const Hte={class:"bx-cropper"},Xte={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",class:"matrix-svg"},Jte={key:0,class:"layer loading-layer"},Kte={class:"layer"},rk=ht(s.defineComponent({__name:"BxCropper",props:{crop:{},aspectRatio:{},offset:{default:()=>({top:10,right:10,bottom:10,left:10})},mirrorX:{type:Boolean,default:!1},mirrorY:{type:Boolean,default:!1}},emits:["update:crop"],setup(e,{emit:t}){const r=e,n=t;s.useSlots();const a=s.ref(),i=s.ref({translateX:0,translateY:0,scale:1,rotate:0}),o=s.ref(),c=s.ref();function l(b){let{left:C,top:w,width:y,height:x}=b;return r.mirrorX&&a.value&&(C=a.value.canvasWidth-C-y),r.mirrorY&&a.value&&(w=a.value.canvasHeight-w-x),{left:C,top:w,width:y,height:x}}function u(b){if(!a.value)throw new Error("Zoompinch ref not available");const C=l(b),[w,y]=a.value.composePoint(C.left,C.top),[x,E]=a.value.composePoint(C.left+C.width,C.top+C.height),S=x-w,_=E-y;return{x:w,y,width:S,height:_}}function f(b){if(!a.value||!a.value.zoompinchEngine)throw new Error("Zoompinch ref or engine not available");const C=b.x+(a.value.zoompinchEngine.wrapperInnerX-r.offset.left),w=b.y+(a.value.zoompinchEngine.wrapperInnerY-r.offset.top),[y,x]=a.value.normalizeClientCoords(C,w),[E,S]=a.value.normalizeClientCoords(C+b.width,w+b.height),_=E-y,B=S-x;return{left:Math.round(y),top:Math.round(x),width:Math.round(_),height:Math.round(B)}}const h=s.ref(!1);async function d(){var w;if(!((w=a.value)!=null&&w.zoompinchEngine))return;const b=Array.from(a.value.zoompinchEngine.canvasElement.children);for(const y of b)y.tagName==="IMG"&&await $te(y);h.value=!0,a.value.applyTransform(1,[.5,.5],[.5,.5]);const C=r.crop??(()=>{const y=a.value.canvasWidth,x=a.value.canvasHeight,E=y/x;if(r.aspectRatio){const S=E>r.aspectRatio?x*r.aspectRatio:y,_=E>r.aspectRatio?x:y/r.aspectRatio;return{left:(y-S)/2,top:(x-_)/2,width:S,height:_}}else return{left:0,top:0,width:y,height:x}})();c.value=C,o.value=u(C)}const g=s.ref(null);window.test=()=>f(o.value);const p=s.computed(()=>{if(i.value,!a.value)throw new Error("Zoompinch ref not available");return u({left:0,top:0,width:a.value.canvasWidth,height:a.value.canvasHeight})});function A(b){o.value=b}return s.watch(i,()=>{!o.value||!a.value||(o.value=Ute(o.value,p.value,r.aspectRatio))}),s.watch(o,b=>{if(!b)return;const C=f(b),w=l(C);c.value=w,n("update:crop",w)}),s.watch([()=>r.mirrorX,()=>r.mirrorY],()=>{!h.value||!c.value||!a.value||(o.value=u(c.value))}),(b,C)=>(s.openBlock(),s.createElementBlock("div",Hte,[s.createVNode(s.unref(ek),{ref_key:"zoompinchRef",ref:a,transform:i.value,"onUpdate:transform":C[1]||(C[1]=w=>i.value=w),rotation:!1,"min-scale":1,offset:e.offset,"clamp-bounds":"",onInit:d,class:s.normalizeClass({[`effective-handle-${g.value}`]:g.value!==null})},{default:s.withCtx(()=>[s.renderSlot(b.$slots,"default",{},void 0,!0)]),matrix:s.withCtx(()=>[(s.openBlock(),s.createElementBlock("svg",Xte,[o.value?(s.openBlock(),s.createBlock(Pte,s.mergeProps({key:0},o.value,{"aspect-ratio":e.aspectRatio,clamp:p.value,onUpdate:A,onEffectiveHandleChange:C[0]||(C[0]=w=>g.value=w)}),null,16,["aspect-ratio","clamp"])):s.createCommentVNode("",!0)])),h.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",Jte,[s.createVNode(Ul)])),s.createElementVNode("div",Kte,[s.renderSlot(b.$slots,"layer",{},void 0,!0)])]),_:3},8,["transform","offset","class"])]))}}),[["__scopeId","data-v-8d2848fa"]]),qte={class:"bx-image-cropper"},ere=["src"],tre={class:"actions-left"},rre={class:"actions-right"},nk=ht(s.defineComponent({__name:"BxImageCropper",props:s.mergeModels({src:{},aspectRatio:{},offset:{}},{crop:{required:!1},cropModifiers:{},mirrorX:{type:Boolean,required:!1,default:!1},mirrorXModifiers:{},mirrorY:{type:Boolean,required:!1,default:!1},mirrorYModifiers:{}}),emits:s.mergeModels(["cancel","done"],["update:crop","update:mirrorX","update:mirrorY"]),setup(e,{emit:t}){const r=s.useModel(e,"crop"),n=s.useModel(e,"mirrorX"),a=s.useModel(e,"mirrorY"),i=t;function o(){n.value=!n.value}function c(){a.value=!a.value}return(l,u)=>(s.openBlock(),s.createElementBlock("div",qte,[s.createVNode(rk,{"aspect-ratio":e.aspectRatio,crop:r.value,"onUpdate:crop":u[4]||(u[4]=f=>r.value=f),offset:e.offset,"mirror-x":n.value,"mirror-y":a.value},{layer:s.withCtx(()=>[s.createElementVNode("div",{class:"actions-wrapper",onTouchstart:u[2]||(u[2]=s.withModifiers(()=>{},["stop"])),onTouchend:u[3]||(u[3]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",tre,[s.createVNode(Et,{onClick:o,class:s.normalizeClass({active:!0}),"aria-label":"Mirror horizontally"},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[...u[5]||(u[5]=[s.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[s.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[s.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M12.5 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0zM6 9.104a.75.75 0 0 1 1.28-.53L10 11.292a1 1 0 0 1 0 1.414l-2.72 2.72a.75.75 0 0 1-1.28-.53zm1 .603v4.586L9.293 12zm11-.603a.75.75 0 0 0-1.28-.53L14 11.292a1 1 0 0 0 0 1.414l2.72 2.72a.75.75 0 0 0 1.28-.53zm-1 .603v4.586L14.707 12z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1}),s.createVNode(Et,{onClick:c,class:s.normalizeClass({active:!0}),"aria-label":"Mirror vertically"},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[...u[6]||(u[6]=[s.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[s.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[s.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M17.5 12.5a.5.5 0 0 0 0-1h-11a.5.5 0 0 0 0 1zM14.896 18a.75.75 0 0 0 .53-1.28L12.708 14a1 1 0 0 0-1.414 0l-2.72 2.72a.75.75 0 0 0 .53 1.28zm-.603-1H9.707L12 14.707zm.603-11a.75.75 0 0 1 .53 1.28L12.708 10a1 1 0 0 1-1.414 0l-2.72-2.72A.75.75 0 0 1 9.103 6zm-.603 1H9.707L12 9.293z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1})]),s.createElementVNode("div",rre,[s.createVNode(Et,{secondary:"",onClick:u[0]||(u[0]=f=>i("cancel"))},{default:s.withCtx(()=>[...u[7]||(u[7]=[s.createTextVNode(" Cancel ",-1)])]),_:1}),s.createVNode(Et,{active:"",onClick:u[1]||(u[1]=f=>i("done"))},{default:s.withCtx(()=>[...u[8]||(u[8]=[s.createTextVNode(" Done ",-1)])]),_:1})])],32)]),default:s.withCtx(()=>[s.createElementVNode("img",{src:e.src,class:s.normalizeClass(["image",{"mirror-x":n.value,"mirror-y":a.value}])},null,10,ere)]),_:1},8,["aspect-ratio","crop","offset","mirror-x","mirror-y"])]))}}),[["__scopeId","data-v-0924dbd3"]]),ak=.6,ik=.4,ok=.6,sk=(e,t,r)=>Math.min(r,Math.max(t,e));function lk(e){const{faces:t,natural:r,aspectRatio:n,cropMode:a,zoom:i=!1}=e;if(a!=="cover"||!Number.isFinite(n)||n<=0||!(r.width>0)||!(r.height>0))return null;const o=t.filter(E=>E.score>=ak&&E.width>0&&E.height>0);if(o.length===0)return null;const c=Math.min(...o.map(E=>E.x)),l=Math.min(...o.map(E=>E.y)),u=Math.max(...o.map(E=>E.x+E.width)),f=Math.max(...o.map(E=>E.y+E.height)),h=(c+u)/2,d=(l+f)/2,g=r.width/r.height,p=g>n?r.height*n:r.width,A=g>n?r.height:r.width/n;let b=p,C=A;if(i){const E=(u-c)*(1+2*ok),S=(f-l)*(1+2*ok),_=Math.max(E,S*n),B=_/n;b=Math.min(p,_),C=Math.min(A,B)}const w=h-b/2,y=d-C*ik,x={left:sk(w,0,Math.max(0,r.width-b)),top:sk(y,0,Math.max(0,r.height-C)),width:b,height:C};return x.left===0&&x.top===0&&Math.abs(x.width-r.width)<.5&&Math.abs(x.height-r.height)<.5?null:x}let U2=null;function nre(e){U2=e}function ck(){return U2!==null}async function are(e){if(!U2)return[];try{const t=await U2(e);return Array.isArray(t)?t:[]}catch(t){return console.warn("[autoCrop] face detection failed, skipping auto-crop",t),[]}}const ire=640;function ore(e){return new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.addEventListener("load",()=>t(r)),r.addEventListener("error",()=>t(null)),r.src=e})}function sre(e){const t=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!(t>0)||!(r>0))return null;const n=Math.min(1,ire/Math.max(t,r)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(t*n)),a.height=Math.max(1,Math.round(r*n));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return null;i.drawImage(e,0,0,a.width,a.height);try{i.getImageData(0,0,1,1)}catch{return null}return{canvas:a,scale:n}}async function uk(e){if(!ck()||e.cropMode!=="cover")return null;const t=await ore(e.src);if(!t)return null;const r=sre(t);if(!r)return null;const n=await are(r.canvas);if(n.length===0)return null;const a=1/r.scale,i=n.map(o=>({x:o.x*a,y:o.y*a,width:o.width*a,height:o.height*a,score:o.score}));return lk({faces:i,natural:e.natural,aspectRatio:e.aspectRatio,cropMode:e.cropMode,zoom:e.zoom})}const lre=["aria-labelledby","aria-label"],cre=["src","alt"],ure={class:"actions"},dre={key:2,class:"padding-input-wrapper"},fre=["id"],$2=ht(s.defineComponent({__name:"ImageEdit",props:s.mergeModels({allowUploadFromDevice:{type:Boolean},width:{},height:{},allowedTypes:{},convertTo:{},quality:{},imageLibraries:{},uploadLabel:{default:"Select image"},editLabel:{},actionsLabel:{default:"More"},maxSize:{default:1/0},bridge:{},mobile:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},field:{},allowCropImage:{type:Boolean},aspectRatio:{},resetCropOnChange:{type:Boolean,default:!0},allowPadding:{type:Boolean,default:!1},autoCrop:{type:Boolean,default:!1},autoCropZoom:{type:Boolean,default:!1},labelId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=jl(),r=s.inject(C1),n=e,a=s.useModel(e,"modelValue"),i=s.computed({get:()=>{var L;return(L=a.value)==null?void 0:L.src},set:L=>{!a.value||typeof a.value!="object"?a.value={src:L,innerRotate:0,cropMode:"cover",innerAlign:"center",crop:null,innerPos:[0,0],mirrorX:!1,mirrorY:!1,scale:1}:(a.value.src=L,a.value.crop=null,a.value.innerPos=[0,0],a.value.scale=1,a.value.innerRotate=0,a.value.mirrorX=!1,a.value.mirrorY=!1),(async()=>{const m=await ld(i.value);if(B.value=m,console.log("newImageInfo",m,n,a.value),n.autoCrop&&a.value.cropMode==="cover"){const V=await uk({src:i.value,natural:m,aspectRatio:n.aspectRatio,cropMode:a.value.cropMode,zoom:!0});if(console.log("autoCrop suggested",V),V&&a.value.src===i.value){o.value=V;return}}n.resetCropOnChange&&(a.value.cropMode==="cover"?(console.log("resetting crop on change with cover mode"),o.value=P2({scale:a.value.scale??1,innerPos:a.value.innerPos??[0,0]},m.width,m.height,n.aspectRatio)):o.value={top:0,left:0,width:m.width,height:m.height})})()}}),o=s.computed({get:()=>a.value.crop?a.value.crop:B.value?P2({scale:a.value.scale??1,innerPos:a.value.innerPos??[0,0]},B.value.width,B.value.height,n.aspectRatio):{top:0,left:0,width:10,height:10},set:async L=>{var Y,P;console.log("cropProxy.set()",L);const{scale:m,innerPos:V}=KB(L,B.value.width,B.value.height);a.value={src:a.value.src,scale:m,innerPos:V,innerRotate:a.value.innerRotate,crop:L,cropMode:((Y=a.value)==null?void 0:Y.cropMode)??"cover",innerAlign:((P=a.value)==null?void 0:P.innerAlign)??"center",mirrorX:a.value.mirrorX,mirrorY:a.value.mirrorY,padding:a.value.padding}}});s.watch(i,L=>{L&&ld(L).then(m=>{B.value=m}).catch(()=>{})},{immediate:!0});const c=mi("bx-image-padding-label"),l=s.computed(()=>(n.editLabel??n.uploadLabel)||"Image"),u=s.computed(()=>Math.max(1,Math.min(n.width,n.height)/2)),f=s.computed({get(){var m;const L=(((m=a.value)==null?void 0:m.padding)??[0])[0]??0;return Math.round(Math.min(100,L/u.value*100))},set(L){const m=Math.max(0,Math.min(100,L))/100*u.value;a.value={...a.value,padding:[m,m,m,m]}}}),h=s.ref(!1);s.ref(!1);const d=s.computed(()=>n.allowCropImage?1:2),{uploadFiles:g,uploadProgresses:p,uploading:A}=Gf(s.toRef(n,"width"),s.toRef(n,"height"),s.toRef(n,"convertTo"),s.toRef(n,"quality"),n.bridge.handleUpload,s.toRef(n,"field"));async function b(){const L=await x2({types:n.allowedTypes,maxSize:n.maxSize,multiple:!0}),m=_1({title:"Uploading images",content:()=>[s.h(yu,{value:p.value.reduce((P,Z)=>P+Z,0)/p.value.length})],closeable:!1,icon:()=>s.h(E2),disableBackgroundEffect:!0}),V=await g(L);m.close();const Y=V[0];Y&&(B.value={width:Y.width,height:Y.height,ratio:Y.width/Y.height},E(Y.src))}const C=s.computed(()=>[...n.allowUploadFromDevice?[{label:n.uploadLabel,action:b,icon:()=>s.h(Xl),key:"upload"}]:[],...n.imageLibraries.map(m=>({label:m.label,icon:()=>{if(m.type==="sharedDrive")switch(m.service){case"googledrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/1/12/Google_Drive_icon_%282020%29.svg"});case"onedrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Microsoft_OneDrive_Icon_%282025_-_present%29.svg"});default:return s.h(Xl)}else return m.type==="pexels"?s.h("img",{src:"https://www.drupal.org/files/project-images/pexels_logo_0.png"}):s.h(Xl)},key:m.type==="sharedDrive"?m.service:m.type==="custom"?"custom":m.type,lib:m}))]),w=s.ref(),y=s.computed(()=>C.value.slice(d.value===1?d.value:d.value-1).map(L=>({label:L.label,value:L.key,icon:n.mobile?L.icon:()=>s.h(gt,{},L.icon)})));function x(L){L==="upload"?C.value.length>1?(w.value=void 0,h.value=!0):b():(w.value=L,h.value=!0)}function E(L){console.log("handleImageSelection",L),i.value=L,h.value=!1}function S(){if(n.allowUploadFromDevice){b();return}w.value=void 0,h.value=!0}jx(()=>n.field,S);function _(L){n.imageLibraries.length===0&&n.allowUploadFromDevice&&(b(),L.stopImmediatePropagation(),L.stopPropagation(),s.nextTick(()=>{h.value=!1}))}const B=s.ref(),N=s.ref(!1);function k(L){x(L),N.value=!1}function G(){let L=Ba(o.value),m=a.value.mirrorX,V=a.value.mirrorY,Y=o.value;ld(i.value).then(D=>{B.value=D});const P=a.value.cropMode==="cover"?n.aspectRatio:void 0,Z=DB(()=>s.h("div",{class:"cropper-popover-wrapper"},[s.h(nk,{src:Xs(i.value,r==null?void 0:r.value),crop:o.value,"onUpdate:crop"(D){D&&(Y=D)},mirrorX:a.value.mirrorX,"onUpdate:mirrorX"(D){a.value={...a.value,mirrorX:D}},mirrorY:a.value.mirrorY,"onUpdate:mirrorY"(D){a.value={...a.value,mirrorY:D}},aspectRatio:P,offset:{top:20,right:20,bottom:20,left:20},style:{width:"100%",height:"100%"},onCancel(){setTimeout(()=>{o.value=L,a.value={...a.value,mirrorX:m,mirrorY:V}},50),Z.destroy()},onDone(){setTimeout(()=>{o.value=Y},50),Z.destroy()}})]))}return(L,m)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["image-edit-field",{"has-single-action":y.value.length===0&&!e.allowCropImage,compact:e.compact}])},[s.createVNode(wu,{closeable:!1,show:h.value,"onUpdate:show":m[3]||(m[3]=V=>h.value=V),type:"layer",trigger:"click",fullscreen:""},{title:s.withCtx(()=>[w.value?(s.openBlock(),s.createBlock(Et,{key:0,circle:"","aria-label":"Back",onClick:m[0]||(m[0]=V=>w.value=void 0)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(X3))]),_:1})]),_:1})):s.createCommentVNode("",!0)]),"header-actions":s.withCtx(()=>[s.createVNode(Et,{circle:"","aria-label":"Close",onClick:m[1]||(m[1]=V=>h.value=!1)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(cs))]),_:1})]),_:1})]),trigger:s.withCtx(()=>[s.createElementVNode("button",{type:"button",class:"image-preview","aria-labelledby":e.labelId,"aria-label":e.labelId?void 0:e.editLabel??e.uploadLabel,onClick:_},[i.value?(s.openBlock(),s.createElementBlock("img",{key:0,src:s.unref(t)(i.value),alt:l.value},null,8,cre)):(s.openBlock(),s.createBlock(gt,{key:1,class:"image-placeholder","aria-hidden":"true"},{default:s.withCtx(()=>[s.createVNode(s.unref(Xl))]),_:1}))],8,lre)]),content:s.withCtx(()=>[s.createVNode(HB,{"active-key":w.value,"onUpdate:activeKey":m[2]||(m[2]=V=>w.value=V),options:C.value,"image-libraries":e.imageLibraries,width:e.width,height:e.height,quality:e.quality,"convert-to":e.convertTo,bridge:e.bridge,field:e.field,onSelect:E},null,8,["active-key","options","image-libraries","width","height","quality","convert-to","bridge","field"])]),_:1},8,["show"]),s.createElementVNode("div",ure,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(C.value.slice(0,C.value.length>d.value?d.value-1:d.value),(V,Y)=>(s.openBlock(),s.createBlock(Et,{tertiary:!0,active:Y===0,size:e.compact?"small":"medium","aria-label":e.compact?V.label:void 0,onClick:P=>x(V.key)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(V.icon)))]),_:2},1024)]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(V.label),1)],64))]),_:2},1032,["active","size","aria-label","onClick"]))),256)),y.value.length>0&&C.value.length>d.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(e.mobile?L1:ai),{key:0,trigger:"manual",options:y.value,onSelect:x,"model-value":void 0,"onUpdate:modelValue":k,"mobile-layout":e.mobile,show:N.value,"onUpdate:show":m[5]||(m[5]=V=>N.value=V)},{trigger:s.withCtx(()=>[d.value===1?(s.openBlock(),s.createBlock(Et,{key:0,tertiary:"",active:"",size:e.compact?"small":"medium","aria-label":e.compact?C.value[0].label:void 0,onClick:m[4]||(m[4]=V=>x(C.value[0].key))},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(C.value[0].icon)))]),_:1})]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(C.value[0].label),1)],64))]),_:1},8,["size","aria-label"])):(s.openBlock(),s.createBlock(Et,{key:1,size:e.compact?"small":"medium","aria-label":e.compact?e.actionsLabel:void 0},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(aB))]),_:1})]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(e.actionsLabel),1)],64))]),_:1},8,["size","aria-label"]))]),_:1},40,["options","mobile-layout","show"])):s.createCommentVNode("",!0),n.allowCropImage?(s.openBlock(),s.createBlock(Et,{key:1,tertiary:"",size:e.compact?"small":"medium","aria-label":e.compact?e.editLabel??"Edit Image":void 0,onClick:G},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(eC))]),_:1})]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(e.editLabel??"Edit Image"),1)],64))]),_:1},8,["size","aria-label"])):s.createCommentVNode("",!0),e.allowPadding&&a.value.cropMode==="contain"?(s.openBlock(),s.createElementBlock("div",dre,[s.createElementVNode("span",{class:"label",id:s.unref(c)},"Padding",8,fre),s.createVNode(G0,{modelValue:f.value,"onUpdate:modelValue":m[6]||(m[6]=V=>f.value=V),min:0,max:100,step:1,"aria-labelledby":s.unref(c),"aria-valuetext":`${f.value}%`},null,8,["modelValue","aria-labelledby","aria-valuetext"])])):s.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-e4fc5342"]]),hre=["src","alt"],gre={key:0,class:"actions"},T1=2,dk=ht(s.defineComponent({__name:"Image",props:s.mergeModels({layout:{},allowUploadFromDevice:{type:Boolean},width:{},height:{},allowedTypes:{},convertTo:{},quality:{},imageLibraries:{},uploadLabel:{default:"Select image"},actionsLabel:{default:"More"},maxSize:{default:1/0},bridge:{},mobile:{type:Boolean,default:!1},field:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=jl(),r=s.useModel(e,"modelValue"),n=e,a=s.ref(!1),{uploadFiles:i,uploadProgresses:o,uploading:c}=Gf(s.toRef(n,"width"),s.toRef(n,"height"),s.toRef(n,"convertTo"),s.toRef(n,"quality"),n.bridge.handleUpload,s.toRef(n,"field"));async function l(){const b=await x2({types:n.allowedTypes,maxSize:n.maxSize,multiple:!0}),C=_1({title:"Uploading images",content:()=>[s.h(yu,{value:o.value.reduce((x,E)=>x+E,0)/o.value.length})],closeable:!1,icon:()=>s.h(E2),disableBackgroundEffect:!0}),w=await i(b);C.close();const y=w[0];y&&g(y.src)}const u=s.computed(()=>[...n.allowUploadFromDevice?[{label:n.uploadLabel,action:l,icon:()=>s.h(Xl),key:"upload"}]:[],...n.imageLibraries.map(C=>({label:C.label,icon:()=>{if(C.type==="sharedDrive")switch(C.service){case"googledrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/1/12/Google_Drive_icon_%282020%29.svg"});case"onedrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Microsoft_OneDrive_Icon_%282025_-_present%29.svg"});default:return s.h(Xl)}else return C.type==="pexels"?s.h("img",{src:"https://www.drupal.org/files/project-images/pexels_logo_0.png"}):s.h(Xl)},key:C.type==="sharedDrive"?C.service:C.type==="custom"?"custom":C.type,lib:C}))]),f=s.ref(),h=s.computed(()=>u.value.slice(T1-1).map(b=>({label:b.label,value:b.key,icon:b.icon})));function d(b){b==="upload"?l():(f.value=b,a.value=!0)}function g(b){r.value=b,a.value=!1}function p(){if(n.allowUploadFromDevice){l();return}f.value=void 0,a.value=!0}jx(()=>n.field,p);function A(b){n.imageLibraries.length===0&&n.allowUploadFromDevice&&(l(),b.stopImmediatePropagation(),b.stopPropagation(),s.nextTick(()=>{a.value=!1}))}return(b,C)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["image-field",{["layout-"+e.layout]:!0}])},[s.createVNode(wu,{show:a.value,"onUpdate:show":C[2]||(C[2]=w=>a.value=w),type:"layer",trigger:"click",fullscreen:""},{title:s.withCtx(()=>[f.value?(s.openBlock(),s.createBlock(Et,{key:0,circle:"",tertiary:"",onClick:C[0]||(C[0]=w=>f.value=void 0)},{icon:s.withCtx(()=>[s.createVNode(gt,{size:"small"},{default:s.withCtx(()=>[s.createVNode(s.unref(X3))]),_:1})]),_:1})):s.createCommentVNode("",!0),C[3]||(C[3]=s.createElementVNode("h3",null,"Select image",-1))]),trigger:s.withCtx(()=>[s.createElementVNode("div",{class:s.normalizeClass(["image-preview",{"single-button-height":u.value.length<=1}]),onClick:A},[r.value?(s.openBlock(),s.createElementBlock("img",{key:0,src:s.unref(t)(r.value),alt:e.uploadLabel},null,8,hre)):(s.openBlock(),s.createBlock(gt,{key:1,class:"image-placeholder","aria-hidden":"true"},{default:s.withCtx(()=>[s.createVNode(s.unref(Xl))]),_:1}))],2)]),content:s.withCtx(()=>[s.createVNode(HB,{"active-key":f.value,"onUpdate:activeKey":C[1]||(C[1]=w=>f.value=w),options:u.value,"image-libraries":e.imageLibraries,width:e.width,height:e.height,quality:e.quality,"convert-to":e.convertTo,bridge:e.bridge,field:e.field,onSelect:g},null,8,["active-key","options","image-libraries","width","height","quality","convert-to","bridge","field"])]),_:1},8,["show"]),e.layout!=="compact"?(s.openBlock(),s.createElementBlock("div",gre,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(u.value.slice(0,u.value.length>T1?T1-1:T1),w=>(s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createVNode(Et,{onClick:y=>d(w.key)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(w.icon)))]),_:2},1024)]),default:s.withCtx(()=>[s.createTextVNode(" "+s.toDisplayString(w.label),1)]),_:2},1032,["onClick"]),s.createVNode(L1,{trigger:"click",options:h.value,onSelect:d,"mobile-layout":e.mobile,"aria-label":e.actionsLabel},{trigger:s.withCtx(()=>[u.value.length>T1?(s.openBlock(),s.createBlock(Et,{key:0},{icon:s.withCtx(()=>[s.createVNode(gt,{size:"small"},{default:s.withCtx(()=>[s.createVNode(s.unref(aB))]),_:1})]),default:s.withCtx(()=>[s.createTextVNode(" "+s.toDisplayString(e.actionsLabel),1)]),_:1})):s.createCommentVNode("",!0)]),_:1},8,["options","mobile-layout","aria-label"])],64))),256))])):s.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-b855661b"]]),mre={key:0,class:"title-wrapper"},pre={key:0,class:"root-index"},Are={key:1,class:"title"},bre={type:"button",class:"help-trigger","aria-label":"More information"},fk=ht(s.defineComponent({__name:"Group",props:{layout:{},isRoot:{type:Boolean,default:!1},index:{default:0},fields:{},card:{type:Boolean},description:{},detailedDescription:{},bridge:{}},setup(e){return(t,r)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["group-field",{}])},[s.createVNode(N1,{transculent:!e.card,class:s.normalizeClass({"no-card":e.card===!1}),dividers:!1},{default:s.withCtx(()=>[e.description||e.detailedDescription?(s.openBlock(),s.createElementBlock("div",mre,[e.isRoot?(s.openBlock(),s.createElementBlock("div",pre,s.toDisplayString(e.index),1)):s.createCommentVNode("",!0),e.description?(s.openBlock(),s.createElementBlock("h4",Are,s.toDisplayString(e.description),1)):s.createCommentVNode("",!0),e.detailedDescription?(s.openBlock(),s.createBlock(G1,{key:2,trigger:"hover"},{trigger:s.withCtx(()=>[s.createElementVNode("button",bre,[s.createVNode(gt,{size:16},{default:s.withCtx(()=>[s.createVNode(s.unref(iB))]),_:1})])]),content:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(e.detailedDescription),1)]),_:1})):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),s.createVNode(f7,{fields:e.fields,bridge:e.bridge,layout:e.layout,"is-root":!1},null,8,["fields","bridge","layout"])]),_:1},8,["transculent","class"])]))}}),[["__scopeId","data-v-6023598b"]]),vre={class:"text-field"},Cre="calc(2*1.2em + 5px * 2)",hk=ht(s.defineComponent({__name:"Text",props:s.mergeModels({maxLength:{},maxLines:{},maxLineLength:{},showWordCount:{type:Boolean},clearable:{type:Boolean},multiline:{type:Boolean},uppercase:{type:Boolean},placeholder:{},richtext:{},bridge:{},maxHeight:{},labelId:{},minWidth:{},maxWidth:{}},{modelValue:{type:[String,Number,Boolean,Array],required:!1,default:"Hello world"},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=s.useModel(e,"modelValue");function r(i){t.value=i}const n=e,a=s.computed(()=>!n.maxHeight||n.maxHeight===Cre?void 0:n.maxHeight);return(i,o)=>(s.openBlock(),s.createElementBlock("div",vre,[s.createVNode(el,{type:e.multiline?"textarea":"text","model-value":t.value,"onUpdate:modelValue":r,"show-word-count":e.showWordCount,clearable:e.clearable,"max-length":e.maxLength??1/0,"max-line-length":e.maxLineLength??1/0,"max-lines":e.maxLines??1/0,placeholder:e.placeholder||"Text Field...",resizeable:!1,richtext:e.richtext.enabled?e.richtext:void 0,"max-height":a.value,"max-rows":20,"aria-labelledby":e.labelId,ring:"",bordered:""},null,8,["type","model-value","show-word-count","clearable","max-length","max-line-length","max-lines","placeholder","richtext","max-height","aria-labelledby"])]))}}),[["__scopeId","data-v-ceacb5b8"]]),yre={class:"field-image-adjust"},gk=ht(s.defineComponent({__name:"ImageAdjust",props:s.mergeModels({minX:{},maxX:{},minY:{},maxY:{},minScale:{},maxScale:{},type:{},aspectRatio:{},bridge:{}},{image:{required:!0},imageModifiers:{},adjust:{required:!0},adjustModifiers:{}}),emits:["update:image","update:adjust"],setup(e){s.inject(C1);const t=s.useModel(e,"image"),r=s.useModel(e,"adjust"),n=e,a=s.ref();return s.watchEffect(async()=>{t.value&&(a.value=await ld(t.value))}),s.computed(()=>P2(r.value,a.value.width,a.value.height,n.aspectRatio)),(i,o)=>(s.openBlock(),s.createElementBlock("div",yre,[s.createVNode(Et,null,{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(eC))]),_:1})]),default:s.withCtx(()=>[o[0]||(o[0]=s.createTextVNode(" Crop ",-1))]),_:1})]))}}),[["__scopeId","data-v-9e4c42cb"]]),wre=["aria-labelledby"],Ire=["aria-checked","aria-label","tabindex","onClick"],xre={class:"image-card"},Ere={class:"label-image-proxy"},Bre=["src"],kre={key:0,class:"label"},mk=ht(s.defineComponent({__name:"Select",props:s.mergeModels({options:{},layout:{},cardSize:{},showLabels:{type:Boolean},labelId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=s.useModel(e,"modelValue"),n=jl(),a=s.computed(()=>t.layout==="grid"||t.layout==="cards");function i(h){r.value=h.value}const o=s.ref([]);function c(h,d){o.value[d]=h}const l=s.computed(()=>{const h=t.options.findIndex(d=>d.value===r.value);return h>=0?h:0});function u(h){var A;const d=t.options.length;if(d===0)return;const g=o.value.findIndex(b=>b===document.activeElement);let p;switch(h.key){case"ArrowRight":case"ArrowDown":p=g<0?0:(g+1)%d;break;case"ArrowLeft":case"ArrowUp":p=g<0?d-1:(g-1+d)%d;break;case"Home":p=0;break;case"End":p=d-1;break;case"Enter":case" ":g>=0&&(h.preventDefault(),i(t.options[g]));return;default:return}h.preventDefault(),(A=o.value[p])==null||A.focus(),i(t.options[p])}const f=s.computed(()=>t.options.map(h=>({label:h.label,value:h.value,icon:h.image?()=>s.h(gt,{},()=>s.h("img",{src:h.image,style:{"object-fit":"cover",width:"24px",height:"24px"}})):void 0})));return(h,d)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["select-field",{"grid-layout":a.value,"horizontal-scroll":e.layout==="cards"}])},[a.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["select-grid",{["size-"+e.cardSize]:!0,"horizontal-scroll":e.layout==="cards"}]),role:"radiogroup","aria-labelledby":e.labelId,onKeydown:u},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.options,(g,p)=>(s.openBlock(),s.createElementBlock("div",{key:p,ref_for:!0,ref:A=>c(A,p),class:s.normalizeClass(["option-item",{active:g.value===r.value}]),role:"radio","aria-checked":g.value===r.value?"true":"false","aria-label":g.label,tabindex:p===l.value?0:-1,onClick:A=>i(g)},[s.createElementVNode("div",xre,[s.createElementVNode("div",Ere,[s.createElementVNode("span",null,s.toDisplayString(g.label),1)]),g.image?(s.openBlock(),s.createElementBlock("img",{key:0,src:s.unref(n)(g.image)},null,8,Bre)):s.createCommentVNode("",!0)]),e.showLabels?(s.openBlock(),s.createElementBlock("div",kre,s.toDisplayString(g.label),1)):s.createCommentVNode("",!0)],10,Ire))),128))],42,wre)):(s.openBlock(),s.createBlock(ai,{key:1,modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=g=>r.value=g),options:f.value,"aria-labelledby":e.labelId,bordered:""},null,8,["modelValue","options","aria-labelledby"]))],2))}}),[["__scopeId","data-v-9bc0926e"]]);function pk(e){const t=s.computed(()=>{const n=s.toValue(e.disabled)??!1,a=s.toValue(e.labelledBy);return{role:e.role,tabindex:n?-1:0,"aria-checked":s.toValue(e.checked)?"true":"false","aria-disabled":n?"true":void 0,"aria-labelledby":a,"aria-label":a?void 0:s.toValue(e.label)}});function r(n){s.toValue(e.disabled)||(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.toggle())}return{attrs:t,onKeydown:r}}const xu=ht(s.defineComponent({__name:"BxCheckbox",props:s.mergeModels({label:{},ariaLabel:{},ariaLabelledby:{},size:{default:"medium"},disabled:{type:Boolean,default:!1},secondary:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=s.useModel(e,"modelValue"),n=()=>{t.disabled||(r.value=!r.value)},{attrs:a,onKeydown:i}=pk({role:"checkbox",checked:()=>r.value,disabled:()=>t.disabled,label:()=>t.ariaLabel??t.label,labelledBy:()=>t.ariaLabelledby,toggle:n});return(o,c)=>(s.openBlock(),s.createElementBlock("div",s.mergeProps({class:["bx-checkbox",{checked:r.value,disabled:e.disabled,secondary:e.secondary}]},s.unref(a),{onClick:n,onKeydown:c[0]||(c[0]=(...l)=>s.unref(i)&&s.unref(i)(...l))}),[...c[1]||(c[1]=[s.createElementVNode("div",{class:"checkbox-box"},[s.createElementVNode("div",{class:"checkbox-symbol"},[s.createElementVNode("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"check-icon","aria-hidden":"true"},[s.createElementVNode("path",{d:"M12.1875 3.75L5.625 11.25L2.8125 8.4375",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})])])],-1)])],16))}}),[["__scopeId","data-v-6cd2378e"]]),Sre={class:"label"},_re=["id"],Ak=ht(s.defineComponent({__name:"Checkbox",props:s.mergeModels({description:{},detailedDescription:{},label:{},mobile:{type:Boolean,default:!1},secondary:{type:Boolean,default:!1},labelId:{}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=mi("bx-checkbox-label"),r=s.useModel(e,"modelValue");return(n,a)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["checkbox-field",{mobile:e.mobile}])},[s.createVNode(xu,{modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=i=>r.value=i),size:"medium","aria-labelledby":e.label?s.unref(t):e.labelId},null,8,["modelValue","aria-labelledby"]),e.label?(s.openBlock(),s.createElementBlock("div",{key:0,class:"checkbox-label",onClick:a[1]||(a[1]=i=>r.value=!r.value)},[s.createElementVNode("div",Sre,[s.createElementVNode("span",{id:s.unref(t)},s.toDisplayString(e.label),9,_re)])])):s.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-8852852c"]]),Rre=s.defineComponent({__name:"CollectionEntryFields",props:{bridge:{},fields:{},layout:{},data:{}},emits:["update:data"],setup(e,{emit:t}){const r=e,n=t,a=s.ref(r.data);return s.watch(()=>r.data,i=>{i!==a.value&&(a.value=i)}),s.provide("data",a),s.watch(a,()=>{n("update:data",a.value)},{deep:!0}),(i,o)=>(s.openBlock(),s.createBlock(fk,{bridge:e.bridge,fields:e.fields,card:!1,layout:e.layout},null,8,["bridge","fields","layout"]))}});/**!
148
+ `).length-(n.maxLines??1/0))),n.maxLength!==1/0&&n.maxLength!==null&&(f.value=String(te).length-n.maxLength)}});const p=s.computed({get(){return Q2(A.value)},set(te){n.richtext?c.value=[{text:te,format:{}}]:c.value=te}}),A=s.computed({get(){return zB(c.value)},set(te){n.richtext?c.value=te:c.value=Q2(te)}}),b=s.ref(),C=mi("bx-input-count"),w=s.computed(()=>n.state==="error"||d.value),y=s.computed(()=>n.showWordCount?C:void 0),x=s.ref();let E;const S=s.ref(!1);s.watch(S,()=>{S.value?a("focus"):a("blur",E)});function _(te){S.value=!0}function B(te){E=te,S.value=!1}s.watch(x,(te,ae)=>{te&&(ae&&(ae.removeEventListener("focus",_),ae.removeEventListener("blur",B)),te.addEventListener("focus",_),te.addEventListener("blur",B))});const N=s.computed(()=>String(Math.max(1,n.maxRows)));function k(){if(n.type!=="textarea")return;const te=x.value;!te||te.tagName!=="TEXTAREA"||(te.style.height="auto",te.style.height=`${te.scrollHeight}px`)}s.watch([x,p,()=>n.type,()=>n.minHeight,()=>n.maxHeight,N],async()=>{await s.nextTick(),k()},{immediate:!0,flush:"post"}),window.addEventListener("blur",B);const G=()=>{var te;n.disabled||n.readonly||(te=x.value)==null||te.focus()},L=te=>{te.key==="Enter"&&a("enter",te)},m=s.ref(""),V=s.computed(()=>{const te=n.richtext?m.value:c.value;return[...new Intl.Segmenter().segment(te)].length}),Y=s.computed(()=>n.richtext?m.value.length>0:String(c.value).length>0);function P(te){return te.en}const Z=s.ref(),D=s.ref({start:0,length:0}),F=s.computed({get(){var ne,z;const te=(ne=b.value)==null?void 0:ne.richTextInstance;if(!te)return;const ue=te.resolveFeatures(D.value.start,D.value.length).flat(),Ce=W(ue);if(Ce!==void 0)return Ce===null?"multiple":(z=M.value.find(Q=>Ea(Q.value,Ce)))==null?void 0:z.value},set(te){var ue;const ae=(ue=b.value)==null?void 0:ue.richTextInstance;ae&&te!=="multiple"&&(te===void 0?ae.applyFormat(D.value.start,D.value.length,{}):(ae.resolveFeatures(D.value.start,D.value.length),ae.applyFormat(D.value.start,D.value.length,te)),O.value.closePopover())}});s.watch(Z,()=>{Z.value&&(D.value=Z.value)});const M=s.computed(()=>n.richtext?[{label:P(n.richtext.noStyleLabel),value:void 0},...n.richtext.options.map((te,ae)=>({label:te.label,value:te.style}))]:[]),O=s.ref();function W(te){let ae=!1,ue;for(const Ce of te)if(!ue)ue=Ce.format;else if(!Ea(ue,Ce.format)){ae=!0;break}return ae?null:ue}function re(){n.richtext?A.value=[{text:"",format:{}}]:o.value=""}return s.onUnmounted(()=>{l.value=[],u.value=0,f.value=0}),t({inputEelRef:x,setFocus(te){var ae,ue;te?(ae=x.value)==null||ae.focus():(ue=x.value)==null||ue.blur()}}),(te,ae)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-input",{readonly:e.readonly,bordered:e.bordered,"is-textarea":e.type==="textarea"}])},[e.richtext?(s.openBlock(),s.createBlock(ai,{key:0,ref_key:"bxSelectRef",ref:O,class:"select-richtext",modelValue:F.value,"onUpdate:modelValue":ae[0]||(ae[0]=ue=>F.value=ue),options:M.value,disabled:!D.value||D.value.length===0},{label:s.withCtx(({label:ue})=>[s.createTextVNode(s.toDisplayString(ue??"Multiple"),1)]),_:1},8,["modelValue","options","disabled"])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["bx-input-wrapper",{focus:S.value&&!e.readonly,round:e.round,ring:e.ring,bordered:e.bordered,["size-"+e.size]:e.size,disabled:e.disabled,readonly:e.readonly,"rich-text":e.richtext,error:d.value,"state-active":e.state==="active","state-success":e.state==="success","state-error":e.state==="error","state-warning":e.state==="warning",ghost:e.ghost}]),style:s.normalizeStyle({"--max-height":e.richtext?"auto":e.maxHeight,"--min-height":e.minHeight,"--textarea-max-lines":N.value}),onClick:G},[i.prefix?(s.openBlock(),s.createElementBlock("div",Aee,[s.renderSlot(te.$slots,"prefix",{},void 0,!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["bx-input__input",{"swiper-no-swiping":S.value,"has-prefix":!!i.prefix}])},[e.richtext?(s.openBlock(),s.createBlock(UB,{key:0,ref_key:"bxRichTextInstance",ref:b,modelValue:A.value,"onUpdate:modelValue":ae[1]||(ae[1]=ue=>A.value=ue),selection:Z.value,"onUpdate:selection":ae[2]||(ae[2]=ue=>Z.value=ue),"raw-text":m.value,"onUpdate:rawText":ae[3]||(ae[3]=ue=>m.value=ue),focus:S.value,"onUpdate:focus":ae[4]||(ae[4]=ue=>S.value=ue),"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby},null,8,["modelValue","selection","raw-text","focus","aria-label","aria-labelledby"])):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[e.type==="textarea"?s.withDirectives((s.openBlock(),s.createElementBlock("textarea",{key:0,ref_key:"inputEelRef",ref:x,rows:"1",class:s.normalizeClass({resizeable:e.resizeable}),"onUpdate:modelValue":ae[5]||(ae[5]=ue=>p.value=ue),placeholder:e.placeholder,onKeydown:L,readonly:e.readonly,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":w.value?"true":void 0,"aria-describedby":y.value},null,42,bee)),[[s.vModelText,p.value]]):s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:1,ref_key:"inputEelRef",ref:x,"onUpdate:modelValue":ae[6]||(ae[6]=ue=>p.value=ue),readonly:e.readonly,placeholder:e.placeholder,type:e.type,onKeydown:L,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":w.value?"true":void 0,"aria-describedby":y.value},null,40,vee)),[[s.vModelDynamic,p.value]])],64))],2),i.suffix||e.clearable||e.showWordCount||i.loading||e.loading||d.value?(s.openBlock(),s.createElementBlock("div",{key:1,"data-suffix":!!i.suffix,class:"bx-input__suffix"},[i.loading||e.loading?(s.openBlock(),s.createElementBlock("div",yee,[i.loading?s.renderSlot(te.$slots,"loading",{},void 0,!0,0):(s.openBlock(),s.createBlock(Ul,{key:1,size:"small"}))])):s.createCommentVNode("",!0),s.renderSlot(te.$slots,"suffix",{},void 0,!0),e.showWordCount?(s.openBlock(),s.createElementBlock("div",{key:1,id:s.unref(C),class:"bx-input__word-count"},[e.maxLength&&e.maxLength!==1/0?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(V.value)+" / "+s.toDisplayString(e.maxLength),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(V.value),1)],64))],8,wee)):s.createCommentVNode("",!0),d.value?(s.openBlock(),s.createBlock(G1,{key:2,trigger:"hover","custom-popover-classes":["text-overflow-tooltip"],"allowed-placements":["bottom","top","right"]},{trigger:s.withCtx(()=>[s.createVNode(Et,{circle:"",size:"tiny",secondary:"",state:"error",class:"errors-button","aria-label":"Show input warnings"},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(eB))]),_:1})]),_:1})]),content:s.withCtx(()=>{var ue,Ce,ne;return[s.createElementVNode("div",Iee,[(ue=h.value)!=null&&ue.overflowingCharacters?(s.openBlock(),s.createElementBlock("div",xee,[s.createElementVNode("span",Eee,s.toDisplayString(e.maxLength+f.value)+" / "+s.toDisplayString(e.maxLength),1),ae[7]||(ae[7]=s.createTextVNode(" characters ",-1))])):s.createCommentVNode("",!0),(Ce=h.value)!=null&&Ce.overlowingLines?(s.openBlock(),s.createElementBlock("div",Bee,[s.createElementVNode("span",kee,s.toDisplayString(e.maxLines+u.value)+" / "+s.toDisplayString(e.maxLines),1),ae[8]||(ae[8]=s.createTextVNode(" lines ",-1))])):s.createCommentVNode("",!0),(ne=h.value)!=null&&ne.lineOverflows?(s.openBlock(),s.createElementBlock("div",See,[ae[9]||(ae[9]=s.createTextVNode(" Lines are too long: ",-1)),s.createElementVNode("ul",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(h.value.lineOverflows,({index:z,length:Q})=>(s.openBlock(),s.createElementBlock("li",null,[s.createElementVNode("span",_ee,"("+s.toDisplayString(z+1)+")",1),s.createElementVNode("span",Ree,s.toDisplayString(Q)+" / "+s.toDisplayString(e.maxLineLength),1)]))),256))])])):s.createCommentVNode("",!0)])]}),_:1})):s.createCommentVNode("",!0),e.clearable&&Y.value?(s.openBlock(),s.createElementBlock("button",{key:3,type:"button",class:"bx-input__clear-btn",onClick:s.withModifiers(re,["stop"]),title:"Clear","aria-label":"Clear"},[s.createVNode(gt,{size:12},{default:s.withCtx(()=>[s.createVNode(s.unref(cs))]),_:1})])):s.createCommentVNode("",!0)],8,Cee)):s.createCommentVNode("",!0)],6)],2))}}),[["__scopeId","data-v-e7f10bcd"]]);function AC(e){return new URLSearchParams(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,String(r)]))).toString()}function Nee(e){const t=s.ref([]),r=s.ref(0);let n=25;async function a(i,o){o=o??t.value.length??0;const l=await(await fetch(`https://api.pexels.com/v1/search?${AC({page:Math.ceil(o/n),query:i,per_page:n})}`,{headers:{Authorization:e}})).json();if("error"in l)throw new Error(l.error);r.value=l.total_results,t.value=[...t.value.slice(0,o),...l.photos]}return{photos:t,total:r,searchPhotos:a}}const Dee=s.defineComponent({__name:"LazyLoadingItemWrapper",emits:["update:visible"],setup(e,{emit:t}){s.ref();const r=t,n=s.ref(),a=tO(n);return r("update:visible",a.value),s.watch(a,(i,o)=>{!o&&i&&r("update:visible",a.value)}),(i,o)=>(s.openBlock(),s.createElementBlock("div",{class:"item-wrapper",ref_key:"itemWrapperRef",ref:n},[s.renderSlot(i.$slots,"default")],512))}}),Fee=s.defineComponent({__name:"LazyLoading",props:{items:{},total:{},fetch:{type:Function},visibleTriggerOffset:{}},setup(e){s.ref();const t=e;t.fetch(0);const r=(n,a)=>{a&&n>=t.items.length-t.visibleTriggerOffset-1&&t.total>t.items.length&&t.fetch()};return(n,a)=>(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.items,(i,o)=>(s.openBlock(),s.createBlock(Dee,{key:o,class:"item-wrapper",item:i,index:o,"onUpdate:visible":c=>r(o,c)},{default:s.withCtx(()=>[s.renderSlot(n.$slots,"item",{item:i,index:o})]),_:2},1032,["item","index","onUpdate:visible"]))),128))}}),Zee={class:"bx-empty-icon"},Gee={key:1,viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Lee={key:0,class:"bx-empty-description"},zee={key:1,class:"bx-empty-extra"},bC=ht(s.defineComponent({__name:"BxEmpty",props:{description:{default:"No Data"},size:{default:"medium"}},setup(e){const t=s.useSlots();return(r,n)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-empty",{[`size-${e.size}`]:!0}])},[s.createElementVNode("div",Zee,[t.icon?s.renderSlot(r.$slots,"icon",{},void 0,!0,0):(s.openBlock(),s.createElementBlock("svg",Gee,[...n[0]||(n[0]=[s.createElementVNode("path",{d:"M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM14 7.5C14 3.91015 11.0899 1 7.5 1C3.91015 1 1 3.91015 1 7.5C1 11.0899 3.91015 14 7.5 14C11.0899 14 14 11.0899 14 7.5ZM14 19.5C14 15.9101 11.0899 13 7.5 13C3.91015 13 1 15.9101 1 19.5C1 23.0899 3.91015 26 7.5 26C11.0899 26 14 23.0899 14 19.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",opacity:"0.4"},null,-1),s.createElementVNode("circle",{cx:"19.5",cy:"19.5",r:"6.5",stroke:"currentColor","stroke-width":"1.5","stroke-dasharray":"3 3",opacity:"0.25"},null,-1)])]))]),e.description||t.description?(s.openBlock(),s.createElementBlock("div",Lee,[t.description?s.renderSlot(r.$slots,"description",{},void 0,!0,0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(e.description),1)],64))])):s.createCommentVNode("",!0),t.default?(s.openBlock(),s.createElementBlock("div",zee,[s.renderSlot(r.$slots,"default",{},void 0,!0)])):s.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-d66bc5e4"]]),Tee={class:"image-library-pexels"},Mee={class:"search-bar-wrapper"},Qee={key:0,class:"photos"},Oee=["onClick"],Wee=["src"],Yee={key:0,class:"loading-wrapper"},Vee={key:1,class:"loading-wrapper"},Pee=s.defineComponent({__name:"Pexels",props:{apiKey:{},width:{},height:{},uploadContext:{},uploadImageAsset:{type:Function}},emits:["select"],setup(e,{emit:t}){const r=jl(),n=e,a=t,i=s.ref("city"),{searchPhotos:o,photos:c,total:l}=Nee(n.apiKey),u=s.ref(),f=s.ref(!1);async function h(){i.value.length>0&&(f.value=!0,l.value=25,c.value=[],await o(i.value),u.value=i.value,f.value=!1)}async function d(A,b){await o(i.value,A)}const g=s.ref();async function p(A){g.value=A.id;const b=await n.uploadImageAsset({blob:await fetch(r(A.src.original)).then(C=>C.blob()),context:n.uploadContext,width:n.width,height:n.height,key:`pexels-${A.id}`,name:A.id.toString(),onProgress(C){console.log("upload progress",C)}});g.value=void 0,a("select",b.src)}return(A,b)=>(s.openBlock(),s.createElementBlock("div",Tee,[s.createElementVNode("header",null,[s.createElementVNode("div",Mee,[s.createVNode(el,{modelValue:i.value,"onUpdate:modelValue":b[0]||(b[0]=C=>i.value=C),round:"",placeholder:"Search...",size:"medium",onEnter:h},null,8,["modelValue"]),s.createVNode(Et,{active:"",onClick:h},{default:s.withCtx(()=>[...b[1]||(b[1]=[s.createTextVNode("Search",-1)])]),_:1})])]),s.createElementVNode("main",null,[u.value?(s.openBlock(),s.createElementBlock("div",Qee,[s.createVNode(Fee,{items:s.unref(c),total:s.unref(l),fetch:d,"visible-trigger-offset":0},{item:s.withCtx(({item:C})=>[(s.openBlock(),s.createElementBlock("div",{key:C.id,class:"photo-wrapper",onClick:w=>p(C)},[s.createElementVNode("div",{class:s.normalizeClass(["preview",{loading:g.value===C.id}])},[s.createElementVNode("img",{src:s.unref(r)(C.src.tiny)},null,8,Wee),g.value===C.id?(s.openBlock(),s.createElementBlock("div",Yee,[s.createVNode(Ul)])):s.createCommentVNode("",!0)],2)],8,Oee))]),_:1},8,["items","total"])])):f.value?(s.openBlock(),s.createElementBlock("div",Vee,[s.createVNode(Ul)])):(s.openBlock(),s.createBlock(bC,{key:2,description:"Search for images on Pexels"},{icon:s.withCtx(()=>[s.createVNode(s.unref(WJ))]),_:1}))])]))}});function jee(e,t,r){return e.map(n=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:n.id,width:n.image.width,height:n.image.height,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=200&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=400&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height}}}))}function Uee(e,t,r){return e.map(({thumbnailLink:n,webContentLink:a,sha256Checksum:i,imageMediaMetadata:o})=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(a)}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:i,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=200&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=400&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0}}}))}function $ee(e,t,r,n){const a=s.ref();return{sharedItems:a,fetchSharedDrive:async()=>{if(e==="onedrive"){const o=`https://shared-drive.bluepic.io/onedrive?${AC({sharing:t})}`,l=await(await fetch(o)).json();a.value=jee(l.children,r,n)}else if(e==="googledrive"){const o=`https://shared-drive.bluepic.io/googledrive?${AC({sharing:t})}`,l=await(await fetch(o)).json();a.value=Uee(l.files,r,n)}}}}const Hee={class:"image-library-shared-drive"},Xee={key:0,class:"photos"},Jee=["onClick"],Kee={class:"preview"},qee=["src"],ete={key:1,class:"loading-wrapper"},tte=ht(s.defineComponent({__name:"SharedDrive",props:{service:{},sharedUrl:{},width:{},height:{}},emits:["select"],setup(e,{emit:t}){const r=jl(),n=e,a=t,{fetchSharedDrive:i,sharedItems:o}=$ee(n.service,n.sharedUrl,n.width,n.height);i();function c(l){a("select",l.src)}return(l,u)=>(s.openBlock(),s.createElementBlock("div",Hee,[s.unref(o)?(s.openBlock(),s.createElementBlock("div",Xee,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(o),f=>(s.openBlock(),s.createElementBlock("div",{class:"photo-wrapper",onClick:h=>c(f)},[s.createElementVNode("div",Kee,[s.createElementVNode("img",{src:s.unref(r)(f.previews.small.src)},null,8,qee)])],8,Jee))),256))])):(s.openBlock(),s.createElementBlock("div",ete,[s.createVNode(Ul)]))]))}}),[["__scopeId","data-v-6b7dadc2"]]),rte={class:"image-library-custom"},nte=s.defineComponent({__name:"Custom",props:{controller:{},label:{},name:{},props:{}},setup(e){const t=e,r=import(t.controller),n=s.ref();return r.then(a=>{n.value=new a.default(t.props)}),(a,i)=>(s.openBlock(),s.createElementBlock("div",rte,"JAJAJA"))}}),ate={class:"image-library-wrapper"},ite={key:0,class:"nav-view-wrapper"},ote={class:"icon-wrapper"},ste={class:"label"},lte={key:1,class:"library-view-wrapper"},HB=ht(s.defineComponent({__name:"ImageLibraryWrapper",props:{options:{},activeKey:{},imageLibraries:{},convertTo:{},quality:{},width:{},height:{},bridge:{},field:{}},emits:["select","update:active-key"],setup(e,{emit:t}){const r=e,n=t,a=s.ref(r.activeKey);s.watch(a,()=>{r.activeKey!==a.value&&n("update:active-key",a.value)}),s.watch(()=>r.activeKey,()=>{r.activeKey!==a.value&&(a.value=r.activeKey)});function i(p){a.value=p}const o=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type==="pexels"))==null?void 0:p.apiKey}),c=s.computed(()=>r.imageLibraries.find(p=>p.type==="sharedDrive"&&p.service===a.value).sharedUrl),l=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.label}),u=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.name}),f=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.controller}),h=s.computed(()=>{var p;return(p=r.imageLibraries.find(A=>A.type===a.value))==null?void 0:p.props});function d(p){const A=p[0];A&&g(A.src)}function g(p){n("select",p)}return(p,A)=>(s.openBlock(),s.createElementBlock("div",ate,[s.createVNode(s.Transition,{name:"slide-library"},{default:s.withCtx(()=>[a.value===void 0?(s.openBlock(),s.createElementBlock("div",ite,[s.createElementVNode("div",{class:"image-library-source-navigation",style:s.normalizeStyle({"--options-length":e.options.length})},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.options,b=>(s.openBlock(),s.createBlock(N1,{key:b.key,bordered:!0,onClick:C=>i(b.key)},{default:s.withCtx(()=>[s.createElementVNode("div",ote,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(b.icon)))]),s.createElementVNode("div",ste,s.toDisplayString(b.label),1)]),_:2},1032,["onClick"]))),128))],4)])):(s.openBlock(),s.createElementBlock("div",lte,[a.value==="upload"?(s.openBlock(),s.createBlock(_q,{key:0,width:e.width,height:e.height,"convert-to":e.convertTo,quality:e.quality,field:e.field,"handle-upload":e.bridge.handleUpload,onUpload:d},null,8,["width","height","convert-to","quality","field","handle-upload"])):a.value==="pexels"?(s.openBlock(),s.createBlock(Pee,{key:1,"api-key":o.value,width:e.width,height:e.height,"upload-image-asset":e.bridge.handleUpload,"upload-context":{field:e.field},onSelect:g},null,8,["api-key","width","height","upload-image-asset","upload-context"])):a.value==="googledrive"||a.value==="onedrive"||a.value==="icloud"||a.value==="dropbox"?(s.openBlock(),s.createBlock(tte,{key:2,service:a.value,"shared-url":c.value,width:e.width,height:e.height,onSelect:g},null,8,["service","shared-url","width","height"])):a.value==="custom"?(s.openBlock(),s.createBlock(nte,{key:3,label:l.value??"Custom Library",name:u.value,controller:f.value,props:h.value},null,8,["label","name","controller","props"])):s.createCommentVNode("",!0)]))]),_:1})]))}}),[["__scopeId","data-v-61c69114"]]),XB=ht(s.defineComponent({__name:"BxList",props:{divider:{type:Boolean,default:!0},bordered:{type:Boolean,default:!1},variant:{default:"plain"}},setup(e){return s.useSlots(),(t,r)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-list",{"has-divider":e.divider&&e.variant==="plain",bordered:e.bordered,[`variant-${e.variant}`]:!0}])},[s.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-53785398"]]),cte={class:"bx-list-item__inner"},ute={key:0,class:"bx-list-item__prefix"},dte={class:"bx-list-item__content"},fte={key:1,class:"bx-list-item__suffix"},JB=ht(s.defineComponent({__name:"BxListItem",props:{interactive:{type:Boolean,default:!0}},setup(e){const t=s.useSlots(),r=s.computed(()=>!!t.prefix),n=s.computed(()=>!!t.suffix);return(a,i)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["bx-list-item",{"has-prefix":r.value,"has-suffix":n.value,interactive:e.interactive}])},[s.createElementVNode("div",cte,[t.prefix?(s.openBlock(),s.createElementBlock("div",ute,[s.renderSlot(a.$slots,"prefix",{},void 0,!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",dte,[s.renderSlot(a.$slots,"default",{},void 0,!0)]),t.suffix?(s.openBlock(),s.createElementBlock("div",fte,[s.renderSlot(a.$slots,"suffix",{},void 0,!0)])):s.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-1048af22"]]),hte=["aria-label"],gte=["onClick"],mte={class:"icon"},pte={class:"label"},Ate={class:"pullup-menu"},bte={class:"icon"},L1=ht(s.defineComponent({__name:"BxDropdown",props:s.mergeModels({options:{},allowedPlacements:{},mobileLayout:{type:Boolean,default:!1},ariaLabel:{default:"Menu"}},{show:{type:Boolean,required:!1,default:!1},showModifiers:{}}),emits:s.mergeModels(["select"],["update:show"]),setup(e,{emit:t}){const r=e,n=t,a=s.useModel(e,"show");function i(w){a.value=!1,n("select",w.value)}const o=s.useSlots(),c=mi("bx-dropdown-menu"),{setSlotRef:l,vNodes:u,slotElements:f}=T2(o.trigger);function h(w){(w.key==="ArrowDown"||w.key==="ArrowUp")&&(w.preventDefault(),a.value||(a.value=!0),b(0))}let d;s.watch(f,(w,y)=>{for(const E of y??[])E instanceof HTMLElement&&E.removeEventListener("keydown",h);d=void 0;const x=w[0];x instanceof HTMLElement&&(x.setAttribute("aria-haspopup","menu"),x.setAttribute("aria-controls",c),x.setAttribute("aria-expanded",String(a.value)),x.addEventListener("keydown",h),d=x)},{immediate:!0});const g=s.ref(0),p=[];function A(w,y){if(!w){p[y]=void 0;return}const x=w instanceof HTMLElement?w:w.$el;p[y]=x instanceof HTMLElement?x:void 0}function b(w){if(r.options.length===0)return;const y=(w+r.options.length)%r.options.length;g.value=y,s.nextTick(()=>{var x;return(x=p[y])==null?void 0:x.focus()})}function C(w){const y=r.options.length;if(y!==0)switch(w.key){case"ArrowDown":w.preventDefault(),b(g.value+1);break;case"ArrowUp":w.preventDefault(),b(g.value-1);break;case"Home":w.preventDefault(),b(0);break;case"End":w.preventDefault(),b(y-1);break;case"Enter":case" ":w.preventDefault(),i(r.options[g.value]),d==null||d.focus();break;case"Escape":w.preventDefault(),w.stopPropagation(),a.value=!1,d==null||d.focus();break;case"Tab":a.value=!1;break}}return s.watch(a,w=>{d==null||d.setAttribute("aria-expanded",String(w)),w&&(g.value=0,s.nextTick(()=>{var y;return(y=p[0])==null?void 0:y.focus()}))}),s.onUnmounted(()=>{d&&d.removeEventListener("keydown",h)}),(w,y)=>e.mobileLayout?(s.openBlock(),s.createBlock(wu,{key:0,show:a.value,"onUpdate:show":y[1]||(y[1]=x=>a.value=x),"disable-background-effect":"","custom-classes":["bx-dropdown-mobile-layout-popup"],closeable:!1},{trigger:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(u),(x,E)=>(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:s.unref(l)(E)},null,512))),128))]),content:s.withCtx(()=>[s.createElementVNode("div",{class:s.normalizeClass(["pullup-menu-wrapper",{}])},[s.createElementVNode("div",{class:"pullup-menu",role:"menu","aria-label":e.ariaLabel},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.options,x=>(s.openBlock(),s.createElementBlock("button",{type:"button",role:"menuitem",class:"select-button",onClick:E=>i(x)},[s.createElementVNode("div",mte,[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x.icon)))]),_:2},1024)]),s.createElementVNode("div",pte,[o.optionLabel?s.renderSlot(w.$slots,"optionLabel",{option:x},void 0,!0,0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(x.label),1)],64))])],8,gte))),256))],8,hte),s.createElementVNode("div",Ate,[s.createElementVNode("button",{type:"button",class:"select-button","aria-label":"Close menu",onClick:y[0]||(y[0]=x=>a.value=!1)},[s.createElementVNode("div",bte,[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(cs))]),_:1})]),y[3]||(y[3]=s.createElementVNode("div",{class:"label"},"Close",-1))])])])]),_:3},8,["show"])):(s.openBlock(),s.createBlock(sd,{key:1,show:a.value,"onUpdate:show":y[2]||(y[2]=x=>a.value=x),trigger:"click","allowed-placements":e.allowedPlacements??["bottom","top"],arrow:!0,"custom-styles":{},"custom-classes":["dropdown-popover"],"disable-background-effect":""},{trigger:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(u),(x,E)=>(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:s.unref(l)(E)},null,512))),128))]),content:s.withCtx(()=>[s.createVNode(XB,{id:s.unref(c),role:"menu","aria-label":e.ariaLabel,onKeydown:C},{default:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.options,(x,E)=>(s.openBlock(),s.createBlock(JB,{key:x.value,ref_for:!0,ref:S=>A(S,E),role:"menuitem",tabindex:E===g.value?0:-1,onClick:S=>i(x)},s.createSlots({default:s.withCtx(()=>[o.optionLabel?s.renderSlot(w.$slots,"optionLabel",{option:x},void 0,!0,0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(x.label),1)],64))]),_:2},[x.icon?{name:"prefix",fn:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(x.icon)))]),_:2},1024)]),key:"0"}:void 0]),1032,["tabindex","onClick"]))),128))]),_:3},8,["id","aria-label"])]),_:3},8,["show","allowed-placements"]))}}),[["__scopeId","data-v-74e3b672"]]);function ld(e){return new Promise(function(t,r){if(typeof e!="string"&&!(e instanceof Blob)){r({err:"no image source"});return}const n=new Image;n.addEventListener("load",a=>{t({width:n.width,height:n.height,ratio:n.height/n.width})}),n.addEventListener("error",()=>r({err:"image corrupted"})),n.src=typeof e=="string"?e:URL.createObjectURL(e)})}function KB({height:e,left:t,top:r,width:n},a,i){const o=1/Math.max((n??0)/a,(e??0)/i),c=[Math.min(1,Bo(Math.max(1e-6,t??0)/(a-(n??0)),6)),Math.min(1,Bo(Math.max(1e-6,r??0)/(i-(e??0)),6))],l=[Math.max(-1,Math.min(1,(c[0]-.5)*2)),Math.max(-1,Math.min(1,(c[1]-.5)*2))];return{scale:o,innerPos:l}}function P2(e,t,r,n){const a=e.innerPos[0]/2+.5,i=e.innerPos[1]/2+.5,o=t/r>n?r*n:t,c=t/r>n?r:t/n,l=o/e.scale,u=c/e.scale,f=t-l,h=r-u,d=f*a,g=h*i;return{left:d,top:g,width:l,height:u}}var vte=Object.defineProperty,Cte=(e,t,r)=>t in e?vte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ka=(e,t,r)=>Cte(e,typeof t!="symbol"?t+"":t,r);function yte(e){return e*Math.PI/180}function qB(e,t,r){return Math.min(Math.max(e,t),r)}function j2(e,t,r){const[n,a]=e,[i,o]=t,c=Math.cos(r)*(n-i)-Math.sin(r)*(a-o)+i,l=Math.sin(r)*(n-i)+Math.cos(r)*(a-o)+o;return[c,l]}function wte(e){return e.deltaMode===0}let Ite=class extends EventTarget{constructor(t,r,n,a,i,o,c=.1,l=10,u=!1,f=!0){super(),ka(this,"wrapperBounds",{x:0,y:0,width:100,height:100}),ka(this,"canvasBounds",{x:0,y:0,width:100,height:100}),ka(this,"translateSpeed",1),ka(this,"zoomSpeed",1),ka(this,"translateSpeedAppleTrackpad",1),ka(this,"zoomSpeedAppleTrackpad",1),ka(this,"isGestureActive",!1),ka(this,"roElement",null),ka(this,"roCanvas",null),ka(this,"ancestorMotionCleanup",null),ka(this,"gestureStartRotate",0),ka(this,"dragStart",null),ka(this,"dragStartFrozenX",null),ka(this,"dragStartFrozenY",null),ka(this,"touchStarts",null),ka(this,"touchStartTranslateX",0),ka(this,"touchStartTranslateY",0),this.element=t,this.offset=r,this.translateX=n,this.translateY=a,this.scale=i,this.rotate=o,this.minScale=c,this.maxScale=l,this.clampBounds=u,this.rotation=f,this.roElement=new ResizeObserver(()=>{const{x:h,y:d,width:g,height:p}=this.element.getBoundingClientRect();this.wrapperBounds={x:h,y:d,width:g,height:p},this.update()}),this.roCanvas=new ResizeObserver(h=>{const{width:d,height:g}=h[0].contentRect;(d!==this.canvasBounds.width||g!==this.canvasBounds.height)&&(this.canvasBounds={...this.canvasBounds,width:d,height:g},this.isGestureActive||this.update())}),requestAnimationFrame(()=>{this.wrapperBounds=this.element.getBoundingClientRect(),this.canvasBounds=this.canvasElement.getBoundingClientRect(),this.update(),this.dispatchEvent(new Event("init"))}),this.roCanvas.observe(this.canvasElement),this.roElement.observe(this.element),this.installAncestorMotionListeners()}installAncestorMotionListeners(){const t=()=>{const{x:i,y:o,width:c,height:l}=this.element.getBoundingClientRect();i===this.wrapperBounds.x&&o===this.wrapperBounds.y&&c===this.wrapperBounds.width&&l===this.wrapperBounds.height||(this.wrapperBounds={x:i,y:o,width:c,height:l},this.update())},r=i=>!(i instanceof Node)||i===this.element?!1:i.contains(this.element),n=i=>{r(i.target)&&t()},a=["transitionrun","transitionend","transitioncancel","animationend","animationcancel"];for(const i of a)document.addEventListener(i,n,!0);this.ancestorMotionCleanup=()=>{for(const i of a)document.removeEventListener(i,n,!0)}}get canvasElement(){return this.element.querySelector(".canvas")}get wrapperInnerX(){return this.wrapperBounds.x+this.offset.left}get wrapperInnerY(){return this.wrapperBounds.y+this.offset.top}get wrapperInnerWidth(){return this.wrapperBounds.width-this.offset.left-this.offset.right}get wrapperInnerHeight(){return this.wrapperBounds.height-this.offset.top-this.offset.bottom}get wrapperInnerRatio(){return this.wrapperInnerWidth/this.wrapperInnerHeight}get canvasNaturalRatio(){return this.canvasBounds.width/this.canvasBounds.height}get naturalScale(){return this.canvasNaturalRatio>=this.wrapperInnerRatio?this.wrapperInnerWidth/this.canvasBounds.width:this.wrapperInnerHeight/this.canvasBounds.height}setTranslateFromUserGesture(t,r){if(this.clampBounds){const n=this.clampTranslate({translateX:t,translateY:r,scale:this.scale,rotate:this.rotate});this.translateX=n.translateX,this.translateY=n.translateY,this.rotate=0}else this.translateX=t,this.translateY=r}handleGesturestart(t){this.gestureStartRotate=this.rotate}handleGesturechange(t){const{clientX:r,clientY:n}=t,a=t.rotation;if(a===0||!this.rotation)return;const i=this.normalizeClientCoords(r,n);this.rotateCanvas(i[0],i[1],this.gestureStartRotate+yte(a))}handleGestureend(t){}handleMousedown(t){t.preventDefault(),this.dragStart=[t.clientX,t.clientY],this.dragStartFrozenX=this.translateX,this.dragStartFrozenY=this.translateY}handleMouseup(t){t.preventDefault(),this.dragStart=null,this.dragStartFrozenX=null,this.dragStartFrozenY=null}handleMousemove(t){if(t.preventDefault(),this.dragStart&&this.dragStartFrozenX!==null&&this.dragStartFrozenY!==null){const r=t.clientX-this.dragStart[0],n=t.clientY-this.dragStart[1],a=this.dragStartFrozenX- -r,i=this.dragStartFrozenY- -n;this.setTranslateFromUserGesture(a,i),this.update()}}handleWheel(t){let{deltaX:r,deltaY:n,ctrlKey:a}=t;const i=wte(t);i||(Math.abs(n)>=100&&(n=Math.sign(n)*(Math.abs(n)/120)),Math.abs(r)>=100&&(r=Math.sign(r)*(Math.abs(r)/120)));const o=this.scale;if(a){const c=i?.01*this.zoomSpeedAppleTrackpad:.1*this.zoomSpeed,l=1+-n*c;let u=o*l;if(u=qB(u,this.minScale,this.maxScale),(u===this.minScale||u===this.maxScale)&&(u===this.minScale&&l<1||u===this.maxScale&&l>1)){t.preventDefault();return}const f=this.relativeWrapperCoordinatesFromClientCoords(t.clientX,t.clientY),[h,d]=this.calcProjectionTranslate(u,f,this.normalizeMatrixCoordinates(t.clientX,t.clientY));this.setTranslateFromUserGesture(h,d),this.scale=u}else{const c=i?1*this.translateSpeedAppleTrackpad:25*this.translateSpeed;this.setTranslateFromUserGesture(this.translateX-r*c,this.translateY-n*c)}this.update(),t.preventDefault()}freezeTouches(t){return Array.from(t).map(r=>{const n=this.clientCoordsToWrapperCoords(r.clientX,r.clientY);return{client:[r.clientX,r.clientY],canvasRel:this.getCanvasCoordsRel(n[0],n[1])}})}handleTouchstart(t){this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY,this.isGestureActive=!0,t.preventDefault()}handleTouchmove(t){t.preventDefault();const r=Array.from(t.touches).map(n=>this.clientCoordsToWrapperCoords(n.clientX,n.clientY));if(this.touchStarts){if(r.length>=2&&this.touchStarts.length>=2){const n=[this.touchStarts[0].canvasRel[0]*this.canvasBounds.width,this.touchStarts[0].canvasRel[1]*this.canvasBounds.height],a=[this.touchStarts[1].canvasRel[0]*this.canvasBounds.width,this.touchStarts[1].canvasRel[1]*this.canvasBounds.height],i=Math.sqrt(Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2)),o=Math.sqrt(Math.pow(r[0][0]-r[1][0],2)+Math.pow(r[0][1]-r[1][1],2))/this.naturalScale,c=qB(o/i,this.minScale,this.maxScale),l=[r[0][0]/this.wrapperInnerWidth,r[0][1]/this.wrapperInnerHeight],u=this.touchStarts[0].canvasRel,[f,h]=this.calcProjectionTranslate(c,l,u,0);if(this.rotation){let d=0,g=0,p=0;const A=Math.atan2(a[1]-n[1],a[0]-n[0]);p=Math.atan2(r[1][1]-r[0][1],r[1][0]-r[0][0])-A;const b=(x,E)=>[this.offset.left+this.canvasBounds.width*x*this.naturalScale*c+f,this.offset.top+this.canvasBounds.height*E*this.naturalScale*c+h],C=b(0,0),w=b(this.touchStarts[0].canvasRel[0],this.touchStarts[0].canvasRel[1]),y=j2(C,w,p);d=y[0]-C[0],g=y[1]-C[1],this.scale=c,this.rotate=p,this.setTranslateFromUserGesture(f+d,h+g)}else this.scale=c,this.setTranslateFromUserGesture(f,h)}else{const n=t.touches[0].clientX-this.touchStarts[0].client[0],a=t.touches[0].clientY-this.touchStarts[0].client[1],i=this.touchStartTranslateX+n,o=this.touchStartTranslateY+a;this.setTranslateFromUserGesture(i,o)}this.update()}}handleTouchend(t){t.touches.length===0?this.touchStarts=null:(this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY),this.isGestureActive=!1}calcProjectionTranslate(t,r,n,a){const i=this.canvasBounds.width*this.naturalScale,o=this.canvasBounds.height*this.naturalScale,c=n[0]*i*t,l=n[1]*o*t,u=j2([c,l],[0,0],a??this.rotate),f=r[0]*this.wrapperInnerWidth,h=r[1]*this.wrapperInnerHeight,d=f-u[0],g=h-u[1];return[d,g]}applyTransform(t,r,n){const a=this.calcProjectionTranslate(t,r,n,0);this.scale=t,this.setTranslateFromUserGesture(a[0],a[1]),this.update()}composeRelPoint(t,r,n,a,i,o){n=n??this.scale,a=a??this.translateX,i=i??this.translateY,o=o??this.rotate;const c=[this.offset.left,this.offset.top],l=[this.offset.left+this.canvasBounds.width*(n*this.naturalScale)*t,this.offset.top+this.canvasBounds.height*(n*this.naturalScale)*r],u=j2(l,c,o);return[u[0]+a,u[1]+i]}composePoint(t,r){const n=t/this.canvasBounds.width,a=r/this.canvasBounds.height;return this.composeRelPoint(n,a)}getAnchorOffset(t,r,n,a,i=[.5,.5]){const o=this.calcProjectionTranslate(t,i,i,0),c=[this.offset.left+o[0]+this.canvasBounds.width*(t*this.naturalScale)*i[0],this.offset.top+o[1]+this.canvasBounds.height*(t*this.naturalScale)*i[1]],l=this.composeRelPoint(i[0],i[1],t,r,n,a),u=l[0]-c[0],f=l[1]-c[1];return[u,f]}getCanvasCoordsRel(t,r){const n=[0,0],a=[t-this.translateX,r-this.translateY],i=j2(a,n,-this.rotate),o=[i[0]/this.renderinScale,i[1]/this.renderinScale];return[o[0]/this.canvasBounds.width,o[1]/this.canvasBounds.height]}clientCoordsToWrapperCoords(t,r){const{x:n,y:a}=this.element.getBoundingClientRect();return[t-n-this.offset.left,r-a-this.offset.top]}relativeWrapperCoordinatesFromClientCoords(t,r){const[n,a]=this.clientCoordsToWrapperCoords(t,r);return[n/this.wrapperInnerWidth,a/this.wrapperInnerHeight]}normalizeMatrixCoordinates(t,r){const n=this.clientCoordsToWrapperCoords(t,r);return this.getCanvasCoordsRel(n[0],n[1])}normalizeClientCoords(t,r){const[n,a]=this.normalizeMatrixCoordinates(t,r);return[n*this.canvasBounds.width,a*this.canvasBounds.height]}rotateCanvas(t,r,n){const a=t/this.canvasBounds.width,i=r/this.canvasBounds.height,o=this.composeRelPoint(a,i,this.scale,0,0,n),c=this.composeRelPoint(a,i);this.setTranslateFromUserGesture(c[0]-o[0],c[1]-o[1]),this.rotate=n,this.update()}get renderinScale(){return this.naturalScale*this.scale}get renderingTranslateX(){return this.offset.left+this.translateX}get renderingTranslateY(){return this.offset.top+this.translateY}get renderingRotate(){return this.rotate}clampTranslate(t,r=[.5,.5]){const n=this.canvasBounds.width*this.naturalScale*t.scale,a=this.canvasBounds.height*this.naturalScale*t.scale,i=n-this.wrapperInnerWidth,o=a-this.wrapperInnerHeight,c=i>0?-i:0,l=Math.min(0,Math.max(t.translateX,c)),u=o>0?-o:0,f=Math.min(0,Math.max(t.translateY,u)),h=-Math.min(0,i)*r[0],d=-Math.min(0,o)*r[1];return{translateX:l+h,translateY:f+d}}update(){this.canvasElement.style.transformOrigin="top left",this.canvasElement.style.transform=`translateX(${this.renderingTranslateX}px) translateY(${this.renderingTranslateY}px) scale(${this.renderinScale}) rotate(${this.renderingRotate}rad)`,this.dispatchEvent(new Event("update"))}destroy(){var t,r,n;(t=this.roElement)==null||t.disconnect(),this.roElement=null,(r=this.roCanvas)==null||r.disconnect(),this.roCanvas=null,(n=this.ancestorMotionCleanup)==null||n.call(this),this.ancestorMotionCleanup=null}};const xte={class:"canvas"},Ete={class:"matrix"},Bte=s.defineComponent({__name:"Zoompinch",props:{transform:{default:()=>({translateX:0,translateY:0,scale:1,rotate:0})},offset:{default:()=>({left:0,top:0,right:0,bottom:0})},maxScale:{default:10},minScale:{default:.5},clampBounds:{type:Boolean,default:!1},rotation:{type:Boolean,default:!0},mouse:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},touch:{type:Boolean,default:!0},gesture:{type:Boolean,default:!0},zoomSpeed:{},translateSpeed:{},zoomSpeedAppleTrackpad:{},translateSpeedAppleTrackpad:{}},emits:["update:transform","init","dragGestureStart","dragGestureEnd"],setup(e,{expose:t,emit:r}){const n=e,a=r,i=s.ref(),o=s.ref(),c=s.ref(!1);window.zoompinchEngine=o;const l=s.ref(()=>{throw new Error("Not initialized yet")}),u=s.ref(0),f=s.ref(0);s.onMounted(()=>{i.value&&(o.value=new Ite(i.value,n.offset,n.transform.translateX,n.transform.translateY,n.transform.scale,n.transform.rotate,n.minScale,n.maxScale,n.clampBounds,n.rotation),n.zoomSpeed!==void 0&&(o.value.zoomSpeed=n.zoomSpeed),n.translateSpeed!==void 0&&(o.value.translateSpeed=n.translateSpeed),n.zoomSpeedAppleTrackpad!==void 0&&(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad),n.translateSpeedAppleTrackpad!==void 0&&(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad),o.value.addEventListener("init",()=>{a("init")}),o.value.addEventListener("update",()=>{if(!o.value)return;const B={translateX:o.value.translateX,translateY:o.value.translateY,scale:o.value.scale,rotate:o.value.rotate};(B.translateX!==n.transform.translateX||B.translateY!==n.transform.translateY||B.scale!==n.transform.scale||B.rotate!==n.transform.rotate)&&a("update:transform",B),l.value=(N,k)=>o.value.composePoint(N,k),u.value=o.value.canvasBounds.width,f.value=o.value.canvasBounds.height}),o.value.addEventListener("init",()=>{c.value=!0}))}),s.watch(()=>n.transform,()=>{o.value&&(o.value.translateX!==n.transform.translateX||o.value.translateY!==n.transform.translateY||o.value.scale!==n.transform.scale||o.value.rotate!==n.transform.rotate)&&(o.value.translateX=n.transform.translateX,o.value.translateY=n.transform.translateY,o.value.scale=n.transform.scale,o.value.rotate=n.transform.rotate,o.value.update())},{deep:!0}),s.watch(()=>n.offset,B=>{o.value&&(o.value.offset=B,o.value.update())},{deep:!0}),s.watch(()=>n.minScale,B=>{o.value&&(o.value.minScale=B,o.value.update())}),s.watch(()=>n.maxScale,B=>{o.value&&(o.value.maxScale=B,o.value.update())}),s.watch(()=>n.clampBounds,B=>{o.value&&(o.value.clampBounds=B,o.value.setTranslateFromUserGesture(o.value.translateX,o.value.translateY),o.value.update())}),s.watch(()=>n.rotation,B=>{o.value&&(o.value.rotation=B,o.value.update())}),s.watch(()=>n.zoomSpeed,()=>{!o.value||n.zoomSpeed===void 0||(o.value.zoomSpeed=n.zoomSpeed)}),s.watch(()=>n.translateSpeed,()=>{!o.value||n.translateSpeed===void 0||(o.value.translateSpeed=n.translateSpeed)}),s.watch(()=>n.zoomSpeedAppleTrackpad,()=>{!o.value||n.zoomSpeedAppleTrackpad===void 0||(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad)}),s.watch(()=>n.translateSpeedAppleTrackpad,()=>{!o.value||n.translateSpeedAppleTrackpad===void 0||(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad)});const h=(B,N,k,G)=>{o.value&&(G!==void 0&&(o.value.rotate=G),o.value.applyTransform(B,N,k))},d=B=>{o.value&&n.wheel&&o.value.handleWheel(B)},g=B=>{o.value&&n.gesture&&o.value.handleGesturestart(B)},p=B=>{o.value&&n.gesture&&o.value.handleGesturechange(B)},A=B=>{o.value&&n.gesture&&o.value.handleGestureend(B)},b=B=>{o.value&&n.mouse&&o.value.handleMousedown(B)},C=B=>{o.value&&n.mouse&&o.value.handleMousemove(B)},w=B=>{o.value&&n.mouse&&o.value.handleMouseup(B)},y=B=>{o.value&&n.touch&&o.value.handleTouchstart(B)},x=B=>{o.value&&n.touch&&o.value.handleTouchmove(B)},E=B=>{o.value&&n.touch&&o.value.handleTouchend(B)};window.addEventListener("gesturechange",p),window.addEventListener("gestureend",A),window.addEventListener("mousemove",C),window.addEventListener("mouseup",w),window.addEventListener("touchmove",x),window.addEventListener("touchend",E),s.onUnmounted(()=>{window.removeEventListener("gesturechange",p),window.removeEventListener("gestureend",A),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",w),window.removeEventListener("touchmove",x),window.removeEventListener("touchend",E)});const S=(B,N)=>{if(!o.value)throw new Error("Zoompinch engine not initialized");return o.value.normalizeClientCoords(B,N)},_=(B,N,k)=>{o.value&&o.value.rotateCanvas(B,N,k)};return s.useSlots(),t({applyTransform:h,composePoint:l,normalizeClientCoords:S,zoompinchEngine:o,canvasWidth:u,canvasHeight:f,rotateCanvas:_}),(B,N)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"zoompinchRef",ref:i,class:"zoompinch",onWheel:d,onGesturestart:g,onMousedown:b,onTouchstart:y},[s.createElementVNode("div",xte,[s.renderSlot(B.$slots,"default",{},void 0,!0)]),s.createElementVNode("div",Ete,[c.value&&l.value?s.renderSlot(B.$slots,"matrix",{key:0,composePoint:l.value,normalizeClientCoords:S,canvasWidth:u.value,canvasHeight:f.value},void 0,!0):s.createCommentVNode("",!0)])],544))}}),kte=(e,t)=>{const r=e.__vccOpts||e;for(const[n,a]of t)r[n]=a;return r},ek=kte(Bte,[["__scopeId","data-v-fbdbcf7c"]]),z1=new Set;requestAnimationFrame(function e(){z1.forEach(t=>t()),requestAnimationFrame(e)});function tk(e,t,r){let n;const a=()=>{const o=e instanceof Function?e():e.value,c=n;o!==n&&(n=o,t(o,c))};return z1.add(a),()=>{z1.delete(a)}}function vC(e,t){let r=null;const n=this;return()=>{clearTimeout(r);var a=arguments;r=setTimeout(()=>{e.apply(n,a)},t)}}const Ste=["x","y","width","height"],_te=["cx","cy","r"],Rte=["cx","cy","r"],Nte=["cx","cy","r"],Dte=["cx","cy","r"],Fte=["cx","cy","r"],Zte=["cx","cy","r"],Gte=["cx","cy","r"],Lte=["cx","cy","r"],zte=["cx","cy","r"],Tte=["cx","cy","r"],Mte=["cx","cy","r"],Qte=["cx","cy","r"],Ote=["cx","cy","r"],Wte=["cx","cy","r"],Yte=["cx","cy","r"],Vte=["cx","cy","r"],Pte=ht(s.defineComponent({__name:"CropSkeleton",props:{x:{},y:{},width:{},height:{},aspectRatio:{},clamp:{}},emits:["update","effectiveHandleChange"],setup(e,{emit:t}){const r=e,n=t,a=s.ref(5),i=s.computed(()=>{const D=Math.min(r.width,r.height);return D>=a.value*8?a.value*4:Math.max(D/2,a.value)}),o=s.computed(()=>({x:r.x,y:r.y})),c=s.computed(()=>({x:r.x+r.width,y:r.y})),l=s.computed(()=>({x:r.x+r.width,y:r.y+r.height})),u=s.computed(()=>({x:r.x,y:r.y+r.height})),f=s.computed(()=>({x:r.x+r.width/2,y:r.y})),h=s.computed(()=>({x:r.x+r.width,y:r.y+r.height/2})),d=s.computed(()=>({x:r.x+r.width/2,y:r.y+r.height})),g=s.computed(()=>({x:r.x,y:r.y+r.height/2})),p=s.computed(()=>r.width>a.value*4&&r.height>a.value*4),A=s.ref(null),b=s.ref(null),C=s.ref(null),w=s.ref(null),y=s.ref(null),x=s.ref(null),E=s.ref(null);s.watch(x,D=>{n("effectiveHandleChange",D)});function S(D,F){console.log("handleThumbMouseDown",D,F),y.value=F,x.value=F,E.value=null,C.value={x:r.x,y:r.y,width:r.width,height:r.height},w.value={x:D.clientX,y:D.clientY},D.preventDefault(),D.stopPropagation()}function _(D,F){console.log("handleThumbTouchstart",D,F);const M=D.touches[0];y.value=F,x.value=F,E.value=null,C.value={x:r.x,y:r.y,width:r.width,height:r.height},w.value={x:M.clientX,y:M.clientY},D.preventDefault(),D.stopPropagation()}const B=()=>{y.value=null,x.value=null,E.value=null,C.value=null,w.value=null,A.value=null,b.value=null},N=()=>{y.value=null,x.value=null,E.value=null,C.value=null,w.value=null,A.value=null,b.value=null},k=D=>{if(A.value){if(!C.value)return;const F=D.clientX-A.value.x,M=D.clientY-A.value.y;b.value={x:C.value.x+F,y:C.value.y+M,width:C.value.width,height:C.value.height}}else y.value&&(E.value={x:D.clientX,y:D.clientY})},G=D=>{const F=D.touches[0];if(A.value){if(!C.value)return;const M=F.clientX-A.value.x,O=F.clientY-A.value.y;b.value={x:C.value.x+M,y:C.value.y+O,width:C.value.width,height:C.value.height}}else y.value&&(E.value={x:F.clientX,y:F.clientY})};function L(D){A.value={x:D.clientX,y:D.clientY},w.value={x:D.clientX,y:D.clientY},C.value={x:r.x,y:r.y,width:r.width,height:r.height},D.preventDefault(),D.stopPropagation()}function m(D){const F=D.touches[0];A.value={x:F.clientX,y:F.clientY},w.value={x:F.clientX,y:F.clientY},C.value={x:r.x,y:r.y,width:r.width,height:r.height},D.preventDefault(),D.stopPropagation()}function V(D){var re,te;const F=((re=r.clamp)==null?void 0:re.x)??-1/0,M=((te=r.clamp)==null?void 0:te.y)??-1/0,O=r.clamp?r.clamp.x+r.clamp.width:1/0,W=r.clamp?r.clamp.y+r.clamp.height:1/0;return{x:Math.min(Math.max(D.x,F),O-D.width),y:Math.min(Math.max(D.y,M),W-D.height),width:D.width,height:D.height}}function Y(D){const F=D.shiftKey?10:4;let M=0,O=0;switch(D.key){case"ArrowLeft":M=-F;break;case"ArrowRight":M=F;break;case"ArrowUp":O=-F;break;case"ArrowDown":O=F;break;default:return}D.preventDefault();const W={x:r.x,y:r.y,width:r.width,height:r.height};if(D.shiftKey)if(r.aspectRatio!=null){const te=D.key==="ArrowRight"||D.key==="ArrowDown"?F:-F,{bbox:ae}=Z("br",W,te,te,r.aspectRatio,r.clamp);n("update",ae)}else{const{bbox:re}=Z("br",W,M,O,void 0,r.clamp);n("update",re)}else n("update",V({...W,x:W.x+M,y:W.y+O}))}function P(D,F,M){const O={tl:"tr",tr:"tl",bl:"br",br:"bl",l:"r",r:"l"},W={tl:"bl",bl:"tl",tr:"br",br:"tr",t:"b",b:"t"};let re=D;return F&&(re=O[re]??re),M&&(re=W[re]??re),re}function Z(D,F,M,O,W,re){let te=F.x,ae=F.y,ue=F.x+F.width,Ce=F.y+F.height;switch(D){case"tl":te+=M,ae+=O;break;case"t":ae+=O;break;case"tr":ue+=M,ae+=O;break;case"r":ue+=M;break;case"br":ue+=M,Ce+=O;break;case"b":Ce+=O;break;case"bl":te+=M,Ce+=O;break;case"l":te+=M;break}const ne=te>ue,z=ae>Ce,Q=P(D,ne,z),U=(re==null?void 0:re.x)??-1/0,q=(re==null?void 0:re.y)??-1/0,de=re?re.x+re.width:1/0,he=re?re.y+re.height:1/0;if(W!=null)if(D==="tl"||D==="tr"||D==="bl"||D==="br"){const Se=D==="tl"||D==="bl"?ue:te,ve=D==="tl"||D==="tr"?Ce:ae,Ee=D==="tl"||D==="bl"?te:ue,$e=D==="tl"||D==="tr"?ae:Ce,He=Ee>=Se,Ve=$e>=ve;let Xe=Math.max(Math.abs(Ee-Se),1),ye=Math.max(Math.abs($e-ve),1);if(Xe/ye>W?Xe=ye*W:ye=Xe/W,re){const Ne=He?de-Se:Se-U,Je=Ve?he-ve:ve-q;(Xe>Ne||ye>Je)&&(Ne/Je>W?(ye=Math.min(ye,Je),Xe=ye*W):(Xe=Math.min(Xe,Ne),ye=Xe/W))}He?(te=Se,ue=Se+Xe):(ue=Se,te=Se-Xe),Ve?(ae=ve,Ce=ve+ye):(Ce=ve,ae=ve-ye)}else if(D==="r"||D==="l"){const ve=D==="r"?F.x:F.x+F.width,Ee=D==="r"?ue:te,$e=F.y+F.height/2,He=Ee>=ve;let Ve=Math.max(Math.abs(Ee-ve),1);if(re){const ye=He?de-ve:ve-U,Ne=Math.min($e-q,he-$e)*2;Ve=Math.max(Math.min(Ve,ye,Ne*W),1)}const Xe=Ve/W;He?(te=ve,ue=ve+Ve):(ue=ve,te=ve-Ve),ae=$e-Xe/2,Ce=$e+Xe/2}else{const ve=D==="b"?F.y:F.y+F.height,Ee=D==="b"?Ce:ae,$e=F.x+F.width/2,He=Ee>=ve;let Ve=Math.max(Math.abs(Ee-ve),1);if(re){const ye=He?he-ve:ve-q,Ne=Math.min($e-U,de-$e)*2;Ve=Math.max(Math.min(Ve,ye,Ne/W),1)}const Xe=Ve*W;He?(ae=ve,Ce=ve+Ve):(Ce=ve,ae=ve-Ve),te=$e-Xe/2,ue=$e+Xe/2}else{const we=Math.min(te,ue),Se=Math.min(ae,Ce),ve=Math.max(te,ue),Ee=Math.max(ae,Ce);te=we,ae=Se,ue=ve,Ce=Ee,re&&(te=Math.max(te,U),ae=Math.max(ae,q),ue=Math.min(ue,de),Ce=Math.min(Ce,he))}return{bbox:{x:te,y:ae,width:ue-te,height:Ce-ae},effectiveHandle:Q}}return tk(b,()=>{var D,F;if(b.value){const M=((D=r.clamp)==null?void 0:D.x)??-1/0,O=((F=r.clamp)==null?void 0:F.y)??-1/0,W=r.clamp?r.clamp.x+r.clamp.width:1/0,re=r.clamp?r.clamp.y+r.clamp.height:1/0;b.value.x<M&&(b.value.x=M),b.value.y<O&&(b.value.y=O),b.value.x+b.value.width>W&&(b.value.x=W-b.value.width),b.value.y+b.value.height>re&&(b.value.y=re-b.value.height),n("update",b.value)}}),tk(E,()=>{if(!y.value||!E.value||!w.value||!C.value)return;const D=E.value.x-w.value.x,F=E.value.y-w.value.y,{bbox:M,effectiveHandle:O}=Z(y.value,C.value,D,F,r.aspectRatio,r.clamp);x.value=O,n("update",M)}),window.addEventListener("mouseup",B),window.addEventListener("touchend",N),window.addEventListener("mousemove",k),window.addEventListener("touchmove",G),s.onUnmounted(()=>{window.removeEventListener("mouseup",B),window.removeEventListener("touchend",N),window.removeEventListener("mousemove",k),window.removeEventListener("touchmove",G)}),(D,F)=>(s.openBlock(),s.createElementBlock("g",null,[s.createElementVNode("rect",{x:e.x,y:e.y,width:e.width,height:e.height,class:"skeleton-rect",tabindex:"0",role:"application","aria-roledescription":"Crop area","aria-label":"Crop area. Use arrow keys to move, Shift plus arrow keys to resize.",onMousedown:L,onTouchstart:m,onKeydown:Y},null,40,Ste),s.createElementVNode("g",{class:s.normalizeClass({inactive:!p.value})},[s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-t",onMousedown:F[0]||(F[0]=M=>S(M,"t")),onTouchstart:F[1]||(F[1]=M=>_(M,"t"))},null,40,_te),s.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="t"}])},null,10,Rte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-r",onMousedown:F[2]||(F[2]=M=>S(M,"r")),onTouchstart:F[3]||(F[3]=M=>_(M,"r"))},null,40,Nte),s.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="r"}])},null,10,Dte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-b",onMousedown:F[4]||(F[4]=M=>S(M,"b")),onTouchstart:F[5]||(F[5]=M=>_(M,"b"))},null,40,Fte),s.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="b"}])},null,10,Zte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-l",onMousedown:F[6]||(F[6]=M=>S(M,"l")),onTouchstart:F[7]||(F[7]=M=>_(M,"l"))},null,40,Gte),s.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="l"}])},null,10,Lte)])],2),s.createElementVNode("g",null,[s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tl",onMousedown:F[8]||(F[8]=M=>S(M,"tl")),onTouchstart:F[9]||(F[9]=M=>_(M,"tl"))},null,40,zte),s.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="tl"}])},null,10,Tte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tr",onMousedown:F[10]||(F[10]=M=>S(M,"tr")),onTouchstart:F[11]||(F[11]=M=>_(M,"tr"))},null,40,Mte),s.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="tr"}])},null,10,Qte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-bl",onMousedown:F[12]||(F[12]=M=>S(M,"bl")),onTouchstart:F[13]||(F[13]=M=>_(M,"bl"))},null,40,Ote),s.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="bl"}])},null,10,Wte)]),s.createElementVNode("g",null,[s.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-br",onMousedown:F[14]||(F[14]=M=>S(M,"br")),onTouchstart:F[15]||(F[15]=M=>_(M,"br"))},null,40,Yte),s.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:a.value,class:s.normalizeClass(["thumb-circle",{pressing:x.value==="br"}])},null,10,Vte)])])]))}}),[["__scopeId","data-v-ab8c8451"]]);function cd(e,t,r){return Math.min(Math.max(e,t),r)}function jte(e,t){const r=cd(e.x,t.x,t.x+t.width),n=cd(e.y,t.y,t.y+t.height),a=cd(e.x+e.width,t.x,t.x+t.width),i=cd(e.y+e.height,t.y,t.y+t.height);return{x:r,y:n,width:a-r,height:i-n}}function Ute(e,t,r){if(r==null)return jte(e,t);let n=e.width,a=e.height;n>t.width&&(n=t.width,a=n/r),a>t.height&&(a=t.height,n=a*r);const i=cd(e.x,t.x,t.x+t.width-n),o=cd(e.y,t.y,t.y+t.height-a);return{x:i,y:o,width:n,height:a}}function $te(e){return new Promise((t,r)=>{if(e.complete&&e.naturalWidth!==0){console.log("[0] getBoundingClientRect",e.getBoundingClientRect()),t();return}const n=()=>{e.naturalWidth*e.naturalHeight>0&&(console.log("[1] getBoundingClientRect",e.getBoundingClientRect()),setTimeout(()=>{console.log("[2] getBoundingClientRect",e.getBoundingClientRect()),t()}),z1.delete(n))};z1.add(n),e.addEventListener("error",()=>r(new Error("Failed to load image")),{once:!0})})}const Hte={class:"bx-cropper"},Xte={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",class:"matrix-svg"},Jte={key:0,class:"layer loading-layer"},Kte={class:"layer"},rk=ht(s.defineComponent({__name:"BxCropper",props:{crop:{},aspectRatio:{},offset:{default:()=>({top:10,right:10,bottom:10,left:10})},mirrorX:{type:Boolean,default:!1},mirrorY:{type:Boolean,default:!1}},emits:["update:crop"],setup(e,{emit:t}){const r=e,n=t;s.useSlots();const a=s.ref(),i=s.ref({translateX:0,translateY:0,scale:1,rotate:0}),o=s.ref(),c=s.ref();function l(b){let{left:C,top:w,width:y,height:x}=b;return r.mirrorX&&a.value&&(C=a.value.canvasWidth-C-y),r.mirrorY&&a.value&&(w=a.value.canvasHeight-w-x),{left:C,top:w,width:y,height:x}}function u(b){if(!a.value)throw new Error("Zoompinch ref not available");const C=l(b),[w,y]=a.value.composePoint(C.left,C.top),[x,E]=a.value.composePoint(C.left+C.width,C.top+C.height),S=x-w,_=E-y;return{x:w,y,width:S,height:_}}function f(b){if(!a.value||!a.value.zoompinchEngine)throw new Error("Zoompinch ref or engine not available");const C=b.x+(a.value.zoompinchEngine.wrapperInnerX-r.offset.left),w=b.y+(a.value.zoompinchEngine.wrapperInnerY-r.offset.top),[y,x]=a.value.normalizeClientCoords(C,w),[E,S]=a.value.normalizeClientCoords(C+b.width,w+b.height),_=E-y,B=S-x;return{left:Math.round(y),top:Math.round(x),width:Math.round(_),height:Math.round(B)}}const h=s.ref(!1);async function d(){var w;if(!((w=a.value)!=null&&w.zoompinchEngine))return;const b=Array.from(a.value.zoompinchEngine.canvasElement.children);for(const y of b)y.tagName==="IMG"&&await $te(y);h.value=!0,a.value.applyTransform(1,[.5,.5],[.5,.5]);const C=r.crop??(()=>{const y=a.value.canvasWidth,x=a.value.canvasHeight,E=y/x;if(r.aspectRatio){const S=E>r.aspectRatio?x*r.aspectRatio:y,_=E>r.aspectRatio?x:y/r.aspectRatio;return{left:(y-S)/2,top:(x-_)/2,width:S,height:_}}else return{left:0,top:0,width:y,height:x}})();c.value=C,o.value=u(C)}const g=s.ref(null);window.test=()=>f(o.value);const p=s.computed(()=>{if(i.value,!a.value)throw new Error("Zoompinch ref not available");return u({left:0,top:0,width:a.value.canvasWidth,height:a.value.canvasHeight})});function A(b){o.value=b}return s.watch(i,()=>{!o.value||!a.value||(o.value=Ute(o.value,p.value,r.aspectRatio))}),s.watch(o,b=>{if(!b)return;const C=f(b),w=l(C);c.value=w,n("update:crop",w)}),s.watch([()=>r.mirrorX,()=>r.mirrorY],()=>{!h.value||!c.value||!a.value||(o.value=u(c.value))}),(b,C)=>(s.openBlock(),s.createElementBlock("div",Hte,[s.createVNode(s.unref(ek),{ref_key:"zoompinchRef",ref:a,transform:i.value,"onUpdate:transform":C[1]||(C[1]=w=>i.value=w),rotation:!1,"min-scale":1,offset:e.offset,"clamp-bounds":"",onInit:d,class:s.normalizeClass({[`effective-handle-${g.value}`]:g.value!==null})},{default:s.withCtx(()=>[s.renderSlot(b.$slots,"default",{},void 0,!0)]),matrix:s.withCtx(()=>[(s.openBlock(),s.createElementBlock("svg",Xte,[o.value?(s.openBlock(),s.createBlock(Pte,s.mergeProps({key:0},o.value,{"aspect-ratio":e.aspectRatio,clamp:p.value,onUpdate:A,onEffectiveHandleChange:C[0]||(C[0]=w=>g.value=w)}),null,16,["aspect-ratio","clamp"])):s.createCommentVNode("",!0)])),h.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",Jte,[s.createVNode(Ul)])),s.createElementVNode("div",Kte,[s.renderSlot(b.$slots,"layer",{},void 0,!0)])]),_:3},8,["transform","offset","class"])]))}}),[["__scopeId","data-v-8d2848fa"]]),qte={class:"bx-image-cropper"},ere=["src"],tre={class:"actions-left"},rre={class:"actions-right"},nk=ht(s.defineComponent({__name:"BxImageCropper",props:s.mergeModels({src:{},aspectRatio:{},offset:{}},{crop:{required:!1},cropModifiers:{},mirrorX:{type:Boolean,required:!1,default:!1},mirrorXModifiers:{},mirrorY:{type:Boolean,required:!1,default:!1},mirrorYModifiers:{}}),emits:s.mergeModels(["cancel","done"],["update:crop","update:mirrorX","update:mirrorY"]),setup(e,{emit:t}){const r=s.useModel(e,"crop"),n=s.useModel(e,"mirrorX"),a=s.useModel(e,"mirrorY"),i=t;function o(){n.value=!n.value}function c(){a.value=!a.value}return(l,u)=>(s.openBlock(),s.createElementBlock("div",qte,[s.createVNode(rk,{"aspect-ratio":e.aspectRatio,crop:r.value,"onUpdate:crop":u[4]||(u[4]=f=>r.value=f),offset:e.offset,"mirror-x":n.value,"mirror-y":a.value},{layer:s.withCtx(()=>[s.createElementVNode("div",{class:"actions-wrapper",onTouchstart:u[2]||(u[2]=s.withModifiers(()=>{},["stop"])),onTouchend:u[3]||(u[3]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",tre,[s.createVNode(Et,{onClick:o,class:s.normalizeClass({active:!0}),"aria-label":"Mirror horizontally"},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[...u[5]||(u[5]=[s.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[s.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[s.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M12.5 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0zM6 9.104a.75.75 0 0 1 1.28-.53L10 11.292a1 1 0 0 1 0 1.414l-2.72 2.72a.75.75 0 0 1-1.28-.53zm1 .603v4.586L9.293 12zm11-.603a.75.75 0 0 0-1.28-.53L14 11.292a1 1 0 0 0 0 1.414l2.72 2.72a.75.75 0 0 0 1.28-.53zm-1 .603v4.586L14.707 12z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1}),s.createVNode(Et,{onClick:c,class:s.normalizeClass({active:!0}),"aria-label":"Mirror vertically"},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[...u[6]||(u[6]=[s.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[s.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[s.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M17.5 12.5a.5.5 0 0 0 0-1h-11a.5.5 0 0 0 0 1zM14.896 18a.75.75 0 0 0 .53-1.28L12.708 14a1 1 0 0 0-1.414 0l-2.72 2.72a.75.75 0 0 0 .53 1.28zm-.603-1H9.707L12 14.707zm.603-11a.75.75 0 0 1 .53 1.28L12.708 10a1 1 0 0 1-1.414 0l-2.72-2.72A.75.75 0 0 1 9.103 6zm-.603 1H9.707L12 9.293z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1})]),s.createElementVNode("div",rre,[s.createVNode(Et,{secondary:"",onClick:u[0]||(u[0]=f=>i("cancel"))},{default:s.withCtx(()=>[...u[7]||(u[7]=[s.createTextVNode(" Cancel ",-1)])]),_:1}),s.createVNode(Et,{active:"",onClick:u[1]||(u[1]=f=>i("done"))},{default:s.withCtx(()=>[...u[8]||(u[8]=[s.createTextVNode(" Done ",-1)])]),_:1})])],32)]),default:s.withCtx(()=>[s.createElementVNode("img",{src:e.src,class:s.normalizeClass(["image",{"mirror-x":n.value,"mirror-y":a.value}])},null,10,ere)]),_:1},8,["aspect-ratio","crop","offset","mirror-x","mirror-y"])]))}}),[["__scopeId","data-v-0924dbd3"]]),ak=.6,ik=.4,ok=.6,sk=(e,t,r)=>Math.min(r,Math.max(t,e));function lk(e){const{faces:t,natural:r,aspectRatio:n,cropMode:a,zoom:i=!1}=e;if(a!=="cover"||!Number.isFinite(n)||n<=0||!(r.width>0)||!(r.height>0))return null;const o=t.filter(E=>E.score>=ak&&E.width>0&&E.height>0);if(o.length===0)return null;const c=Math.min(...o.map(E=>E.x)),l=Math.min(...o.map(E=>E.y)),u=Math.max(...o.map(E=>E.x+E.width)),f=Math.max(...o.map(E=>E.y+E.height)),h=(c+u)/2,d=(l+f)/2,g=r.width/r.height,p=g>n?r.height*n:r.width,A=g>n?r.height:r.width/n;let b=p,C=A;if(i){const E=(u-c)*(1+2*ok),S=(f-l)*(1+2*ok),_=Math.max(E,S*n),B=_/n;b=Math.min(p,_),C=Math.min(A,B)}const w=h-b/2,y=d-C*ik,x={left:sk(w,0,Math.max(0,r.width-b)),top:sk(y,0,Math.max(0,r.height-C)),width:b,height:C};return x.left===0&&x.top===0&&Math.abs(x.width-r.width)<.5&&Math.abs(x.height-r.height)<.5?null:x}let U2=null;function nre(e){U2=e}function ck(){return U2!==null}async function are(e){if(!U2)return[];try{const t=await U2(e);return Array.isArray(t)?t:[]}catch(t){return console.warn("[autoCrop] face detection failed, skipping auto-crop",t),[]}}const ire=640;function ore(e){return new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.addEventListener("load",()=>t(r)),r.addEventListener("error",()=>t(null)),r.src=e})}function sre(e){const t=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!(t>0)||!(r>0))return null;const n=Math.min(1,ire/Math.max(t,r)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(t*n)),a.height=Math.max(1,Math.round(r*n));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return null;i.drawImage(e,0,0,a.width,a.height);try{i.getImageData(0,0,1,1)}catch{return null}return{canvas:a,scale:n}}async function uk(e){if(!ck()||e.cropMode!=="cover")return null;const t=await ore(e.src);if(!t)return null;const r=sre(t);if(!r)return null;const n=await are(r.canvas);if(n.length===0)return null;const a=1/r.scale,i=n.map(o=>({x:o.x*a,y:o.y*a,width:o.width*a,height:o.height*a,score:o.score}));return lk({faces:i,natural:e.natural,aspectRatio:e.aspectRatio,cropMode:e.cropMode,zoom:e.zoom})}const lre=["aria-labelledby","aria-label"],cre=["src","alt"],ure={class:"actions"},dre={key:2,class:"padding-input-wrapper"},fre=["id"],$2=ht(s.defineComponent({__name:"ImageEdit",props:s.mergeModels({allowUploadFromDevice:{type:Boolean},width:{},height:{},allowedTypes:{},convertTo:{},quality:{},imageLibraries:{},uploadLabel:{default:"Select image"},editLabel:{},actionsLabel:{default:"More"},maxSize:{default:1/0},bridge:{},mobile:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},field:{},allowCropImage:{type:Boolean},aspectRatio:{},resetCropOnChange:{type:Boolean,default:!0},allowPadding:{type:Boolean,default:!1},autoCrop:{type:Boolean,default:!1},autoCropZoom:{type:Boolean,default:!1},labelId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=jl(),r=s.inject(C1),n=e,a=s.useModel(e,"modelValue"),i=s.computed({get:()=>{var L;return(L=a.value)==null?void 0:L.src},set:L=>{!a.value||typeof a.value!="object"?a.value={src:L,innerRotate:0,cropMode:"cover",innerAlign:"center",crop:null,innerPos:[0,0],mirrorX:!1,mirrorY:!1,scale:1}:(a.value.src=L,a.value.crop=null,a.value.innerPos=[0,0],a.value.scale=1,a.value.innerRotate=0,a.value.mirrorX=!1,a.value.mirrorY=!1),(async()=>{const m=await ld(i.value);if(B.value=m,console.log("newImageInfo",m,n,a.value),n.autoCrop&&a.value.cropMode==="cover"){const V=await uk({src:i.value,natural:m,aspectRatio:n.aspectRatio,cropMode:a.value.cropMode,zoom:!0});if(console.log("autoCrop suggested",V),V&&a.value.src===i.value){o.value=V;return}}n.resetCropOnChange&&(a.value.cropMode==="cover"?(console.log("resetting crop on change with cover mode"),o.value=P2({scale:a.value.scale??1,innerPos:a.value.innerPos??[0,0]},m.width,m.height,n.aspectRatio)):o.value={top:0,left:0,width:m.width,height:m.height})})()}}),o=s.computed({get:()=>a.value.crop?a.value.crop:B.value?P2({scale:a.value.scale??1,innerPos:a.value.innerPos??[0,0]},B.value.width,B.value.height,n.aspectRatio):{top:0,left:0,width:10,height:10},set:async L=>{var Y,P;console.log("cropProxy.set()",L);const{scale:m,innerPos:V}=KB(L,B.value.width,B.value.height);a.value={src:a.value.src,scale:m,innerPos:V,innerRotate:a.value.innerRotate,crop:L,cropMode:((Y=a.value)==null?void 0:Y.cropMode)??"cover",innerAlign:((P=a.value)==null?void 0:P.innerAlign)??"center",mirrorX:a.value.mirrorX,mirrorY:a.value.mirrorY,padding:a.value.padding}}});s.watch(i,L=>{L&&ld(L).then(m=>{B.value=m}).catch(()=>{})},{immediate:!0});const c=mi("bx-image-padding-label"),l=s.computed(()=>(n.editLabel??n.uploadLabel)||"Image"),u=s.computed(()=>Math.max(1,Math.min(n.width,n.height)/2)),f=s.computed({get(){var m;const L=(((m=a.value)==null?void 0:m.padding)??[0])[0]??0;return Math.round(Math.min(100,L/u.value*100))},set(L){const m=Math.max(0,Math.min(100,L))/100*u.value;a.value={...a.value,padding:[m,m,m,m]}}}),h=s.ref(!1);s.ref(!1);const d=s.computed(()=>n.allowCropImage?1:2),{uploadFiles:g,uploadProgresses:p,uploading:A}=Gf(s.toRef(n,"width"),s.toRef(n,"height"),s.toRef(n,"convertTo"),s.toRef(n,"quality"),n.bridge.handleUpload,s.toRef(n,"field"));async function b(){const L=await x2({types:n.allowedTypes,maxSize:n.maxSize,multiple:!0}),m=_1({title:"Uploading images",content:()=>[s.h(yu,{value:p.value.reduce((P,Z)=>P+Z,0)/p.value.length})],closeable:!1,icon:()=>s.h(E2),disableBackgroundEffect:!0}),V=await g(L);m.close();const Y=V[0];Y&&(B.value={width:Y.width,height:Y.height,ratio:Y.width/Y.height},E(Y.src))}const C=s.computed(()=>[...n.allowUploadFromDevice?[{label:n.uploadLabel,action:b,icon:()=>s.h(Xl),key:"upload"}]:[],...n.imageLibraries.map(m=>({label:m.label,icon:()=>{if(m.type==="sharedDrive")switch(m.service){case"googledrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/1/12/Google_Drive_icon_%282020%29.svg"});case"onedrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Microsoft_OneDrive_Icon_%282025_-_present%29.svg"});default:return s.h(Xl)}else return m.type==="pexels"?s.h("img",{src:"https://www.drupal.org/files/project-images/pexels_logo_0.png"}):s.h(Xl)},key:m.type==="sharedDrive"?m.service:m.type==="custom"?"custom":m.type,lib:m}))]),w=s.ref(),y=s.computed(()=>C.value.slice(d.value===1?d.value:d.value-1).map(L=>({label:L.label,value:L.key,icon:n.mobile?L.icon:()=>s.h(gt,{},L.icon)})));function x(L){L==="upload"?C.value.length>1?(w.value=void 0,h.value=!0):b():(w.value=L,h.value=!0)}function E(L){console.log("handleImageSelection",L),i.value=L,h.value=!1}function S(){if(n.allowUploadFromDevice){b();return}w.value=void 0,h.value=!0}jx(()=>n.field,S);function _(L){n.imageLibraries.length===0&&n.allowUploadFromDevice&&(b(),L.stopImmediatePropagation(),L.stopPropagation(),s.nextTick(()=>{h.value=!1}))}const B=s.ref(),N=s.ref(!1);function k(L){x(L),N.value=!1}function G(){let L=Ba(o.value),m=a.value.mirrorX,V=a.value.mirrorY,Y=o.value;ld(i.value).then(D=>{B.value=D});const P=a.value.cropMode==="cover"?n.aspectRatio:void 0,Z=DB(()=>s.h("div",{class:"cropper-popover-wrapper"},[s.h(nk,{src:Xs(i.value,r==null?void 0:r.value),crop:o.value,"onUpdate:crop"(D){D&&(Y=D)},mirrorX:a.value.mirrorX,"onUpdate:mirrorX"(D){a.value={...a.value,mirrorX:D}},mirrorY:a.value.mirrorY,"onUpdate:mirrorY"(D){a.value={...a.value,mirrorY:D}},aspectRatio:P,offset:{top:20,right:20,bottom:20,left:20},style:{width:"100%",height:"100%"},onCancel(){setTimeout(()=>{o.value=L,a.value={...a.value,mirrorX:m,mirrorY:V}},50),Z.destroy()},onDone(){setTimeout(()=>{o.value=Y},50),Z.destroy()}})]))}return(L,m)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["image-edit-field",{"has-single-action":y.value.length===0&&!e.allowCropImage,compact:e.compact}])},[s.createVNode(wu,{closeable:!1,show:h.value,"onUpdate:show":m[3]||(m[3]=V=>h.value=V),type:"layer",trigger:"click",fullscreen:""},{title:s.withCtx(()=>[w.value?(s.openBlock(),s.createBlock(Et,{key:0,circle:"","aria-label":"Back",onClick:m[0]||(m[0]=V=>w.value=void 0)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(X3))]),_:1})]),_:1})):s.createCommentVNode("",!0)]),"header-actions":s.withCtx(()=>[s.createVNode(Et,{circle:"","aria-label":"Close",onClick:m[1]||(m[1]=V=>h.value=!1)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(cs))]),_:1})]),_:1})]),trigger:s.withCtx(()=>[s.createElementVNode("button",{type:"button",class:"image-preview","aria-labelledby":e.labelId,"aria-label":e.labelId?void 0:e.editLabel??e.uploadLabel,onClick:_},[i.value?(s.openBlock(),s.createElementBlock("img",{key:0,src:s.unref(t)(i.value),alt:l.value},null,8,cre)):(s.openBlock(),s.createBlock(gt,{key:1,class:"image-placeholder","aria-hidden":"true"},{default:s.withCtx(()=>[s.createVNode(s.unref(Xl))]),_:1}))],8,lre)]),content:s.withCtx(()=>[s.createVNode(HB,{"active-key":w.value,"onUpdate:activeKey":m[2]||(m[2]=V=>w.value=V),options:C.value,"image-libraries":e.imageLibraries,width:e.width,height:e.height,quality:e.quality,"convert-to":e.convertTo,bridge:e.bridge,field:e.field,onSelect:E},null,8,["active-key","options","image-libraries","width","height","quality","convert-to","bridge","field"])]),_:1},8,["show"]),s.createElementVNode("div",ure,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(C.value.slice(0,C.value.length>d.value?d.value-1:d.value),(V,Y)=>(s.openBlock(),s.createBlock(Et,{tertiary:!0,active:Y===0,size:e.compact?"small":"medium","aria-label":e.compact?V.label:void 0,onClick:P=>x(V.key)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(V.icon)))]),_:2},1024)]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(V.label),1)],64))]),_:2},1032,["active","size","aria-label","onClick"]))),256)),y.value.length>0&&C.value.length>d.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(e.mobile?L1:ai),{key:0,trigger:"manual",options:y.value,onSelect:x,"model-value":void 0,"onUpdate:modelValue":k,"mobile-layout":e.mobile,show:N.value,"onUpdate:show":m[5]||(m[5]=V=>N.value=V)},{trigger:s.withCtx(()=>[d.value===1?(s.openBlock(),s.createBlock(Et,{key:0,tertiary:"",active:"",size:e.compact?"small":"medium","aria-label":e.compact?C.value[0].label:void 0,onClick:m[4]||(m[4]=V=>x(C.value[0].key))},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(C.value[0].icon)))]),_:1})]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(C.value[0].label),1)],64))]),_:1},8,["size","aria-label"])):(s.openBlock(),s.createBlock(Et,{key:1,size:e.compact?"small":"medium","aria-label":e.compact?e.actionsLabel:void 0},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(aB))]),_:1})]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(e.actionsLabel),1)],64))]),_:1},8,["size","aria-label"]))]),_:1},40,["options","mobile-layout","show"])):s.createCommentVNode("",!0),n.allowCropImage?(s.openBlock(),s.createBlock(Et,{key:1,tertiary:"",size:e.compact?"small":"medium","aria-label":e.compact?e.editLabel??"Edit Image":void 0,onClick:G},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(eC))]),_:1})]),default:s.withCtx(()=>[e.compact?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(e.editLabel??"Edit Image"),1)],64))]),_:1},8,["size","aria-label"])):s.createCommentVNode("",!0),e.allowPadding&&a.value.cropMode==="contain"?(s.openBlock(),s.createElementBlock("div",dre,[s.createElementVNode("span",{class:"label",id:s.unref(c)},"Padding",8,fre),s.createVNode(G0,{modelValue:f.value,"onUpdate:modelValue":m[6]||(m[6]=V=>f.value=V),min:0,max:100,step:1,"aria-labelledby":s.unref(c),"aria-valuetext":`${f.value}%`},null,8,["modelValue","aria-labelledby","aria-valuetext"])])):s.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-e4fc5342"]]),hre=["src","alt"],gre={key:0,class:"actions"},T1=2,dk=ht(s.defineComponent({__name:"Image",props:s.mergeModels({layout:{},allowUploadFromDevice:{type:Boolean},width:{},height:{},allowedTypes:{},convertTo:{},quality:{},imageLibraries:{},uploadLabel:{default:"Select image"},actionsLabel:{default:"More"},maxSize:{default:1/0},bridge:{},mobile:{type:Boolean,default:!1},field:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=jl(),r=s.useModel(e,"modelValue"),n=e,a=s.ref(!1),{uploadFiles:i,uploadProgresses:o,uploading:c}=Gf(s.toRef(n,"width"),s.toRef(n,"height"),s.toRef(n,"convertTo"),s.toRef(n,"quality"),n.bridge.handleUpload,s.toRef(n,"field"));async function l(){const b=await x2({types:n.allowedTypes,maxSize:n.maxSize,multiple:!0}),C=_1({title:"Uploading images",content:()=>[s.h(yu,{value:o.value.reduce((x,E)=>x+E,0)/o.value.length})],closeable:!1,icon:()=>s.h(E2),disableBackgroundEffect:!0}),w=await i(b);C.close();const y=w[0];y&&g(y.src)}const u=s.computed(()=>[...n.allowUploadFromDevice?[{label:n.uploadLabel,action:l,icon:()=>s.h(Xl),key:"upload"}]:[],...n.imageLibraries.map(C=>({label:C.label,icon:()=>{if(C.type==="sharedDrive")switch(C.service){case"googledrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/1/12/Google_Drive_icon_%282020%29.svg"});case"onedrive":return s.h("img",{src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Microsoft_OneDrive_Icon_%282025_-_present%29.svg"});default:return s.h(Xl)}else return C.type==="pexels"?s.h("img",{src:"https://www.drupal.org/files/project-images/pexels_logo_0.png"}):s.h(Xl)},key:C.type==="sharedDrive"?C.service:C.type==="custom"?"custom":C.type,lib:C}))]),f=s.ref(),h=s.computed(()=>u.value.slice(T1-1).map(b=>({label:b.label,value:b.key,icon:b.icon})));function d(b){b==="upload"?l():(f.value=b,a.value=!0)}function g(b){r.value=b,a.value=!1}function p(){if(n.allowUploadFromDevice){l();return}f.value=void 0,a.value=!0}jx(()=>n.field,p);function A(b){n.imageLibraries.length===0&&n.allowUploadFromDevice&&(l(),b.stopImmediatePropagation(),b.stopPropagation(),s.nextTick(()=>{a.value=!1}))}return(b,C)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["image-field",{["layout-"+e.layout]:!0}])},[s.createVNode(wu,{show:a.value,"onUpdate:show":C[2]||(C[2]=w=>a.value=w),type:"layer",trigger:"click",fullscreen:""},{title:s.withCtx(()=>[f.value?(s.openBlock(),s.createBlock(Et,{key:0,circle:"",tertiary:"",onClick:C[0]||(C[0]=w=>f.value=void 0)},{icon:s.withCtx(()=>[s.createVNode(gt,{size:"small"},{default:s.withCtx(()=>[s.createVNode(s.unref(X3))]),_:1})]),_:1})):s.createCommentVNode("",!0),C[3]||(C[3]=s.createElementVNode("h3",null,"Select image",-1))]),trigger:s.withCtx(()=>[s.createElementVNode("div",{class:s.normalizeClass(["image-preview",{"single-button-height":u.value.length<=1}]),onClick:A},[r.value?(s.openBlock(),s.createElementBlock("img",{key:0,src:s.unref(t)(r.value),alt:e.uploadLabel},null,8,hre)):(s.openBlock(),s.createBlock(gt,{key:1,class:"image-placeholder","aria-hidden":"true"},{default:s.withCtx(()=>[s.createVNode(s.unref(Xl))]),_:1}))],2)]),content:s.withCtx(()=>[s.createVNode(HB,{"active-key":f.value,"onUpdate:activeKey":C[1]||(C[1]=w=>f.value=w),options:u.value,"image-libraries":e.imageLibraries,width:e.width,height:e.height,quality:e.quality,"convert-to":e.convertTo,bridge:e.bridge,field:e.field,onSelect:g},null,8,["active-key","options","image-libraries","width","height","quality","convert-to","bridge","field"])]),_:1},8,["show"]),e.layout!=="compact"?(s.openBlock(),s.createElementBlock("div",gre,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(u.value.slice(0,u.value.length>T1?T1-1:T1),w=>(s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createVNode(Et,{onClick:y=>d(w.key)},{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(w.icon)))]),_:2},1024)]),default:s.withCtx(()=>[s.createTextVNode(" "+s.toDisplayString(w.label),1)]),_:2},1032,["onClick"]),s.createVNode(L1,{trigger:"click",options:h.value,onSelect:d,"mobile-layout":e.mobile,"aria-label":e.actionsLabel},{trigger:s.withCtx(()=>[u.value.length>T1?(s.openBlock(),s.createBlock(Et,{key:0},{icon:s.withCtx(()=>[s.createVNode(gt,{size:"small"},{default:s.withCtx(()=>[s.createVNode(s.unref(aB))]),_:1})]),default:s.withCtx(()=>[s.createTextVNode(" "+s.toDisplayString(e.actionsLabel),1)]),_:1})):s.createCommentVNode("",!0)]),_:1},8,["options","mobile-layout","aria-label"])],64))),256))])):s.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-b855661b"]]),mre={key:0,class:"title-wrapper"},pre={key:0,class:"root-index"},Are={key:1,class:"title"},bre={type:"button",class:"help-trigger","aria-label":"More information"},fk=ht(s.defineComponent({__name:"Group",props:{layout:{},isRoot:{type:Boolean,default:!1},index:{default:0},fields:{},card:{type:Boolean},description:{},detailedDescription:{},bridge:{}},setup(e){return(t,r)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["group-field",{}])},[s.createVNode(N1,{transculent:!e.card,class:s.normalizeClass({"no-card":e.card===!1}),dividers:!1},{default:s.withCtx(()=>[e.description||e.detailedDescription?(s.openBlock(),s.createElementBlock("div",mre,[e.isRoot?(s.openBlock(),s.createElementBlock("div",pre,s.toDisplayString(e.index),1)):s.createCommentVNode("",!0),e.description?(s.openBlock(),s.createElementBlock("h4",Are,s.toDisplayString(e.description),1)):s.createCommentVNode("",!0),e.detailedDescription?(s.openBlock(),s.createBlock(G1,{key:2,trigger:"hover"},{trigger:s.withCtx(()=>[s.createElementVNode("button",bre,[s.createVNode(gt,{size:16},{default:s.withCtx(()=>[s.createVNode(s.unref(iB))]),_:1})])]),content:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(e.detailedDescription),1)]),_:1})):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),s.createVNode(f7,{fields:e.fields,bridge:e.bridge,layout:e.layout,"is-root":!1},null,8,["fields","bridge","layout"])]),_:1},8,["transculent","class"])]))}}),[["__scopeId","data-v-6023598b"]]),vre={class:"text-field"},Cre="calc(2*1.2em + 5px * 2)",hk=ht(s.defineComponent({__name:"Text",props:s.mergeModels({maxLength:{},maxLines:{},maxLineLength:{},showWordCount:{type:Boolean},clearable:{type:Boolean},multiline:{type:Boolean},uppercase:{type:Boolean},placeholder:{},richtext:{},bridge:{},maxHeight:{},labelId:{},minWidth:{},maxWidth:{}},{modelValue:{type:[String,Number,Boolean,Array],required:!1,default:"Hello world"},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=s.useModel(e,"modelValue");function r(i){t.value=i}const n=e,a=s.computed(()=>!n.maxHeight||n.maxHeight===Cre?void 0:n.maxHeight);return(i,o)=>(s.openBlock(),s.createElementBlock("div",vre,[s.createVNode(el,{type:e.multiline?"textarea":"text","model-value":t.value,"onUpdate:modelValue":r,"show-word-count":e.showWordCount,clearable:e.clearable,"max-length":e.maxLength??1/0,"max-line-length":e.maxLineLength??1/0,"max-lines":e.maxLines??1/0,placeholder:e.placeholder||"Text Field...",resizeable:!1,richtext:e.richtext.enabled?e.richtext:void 0,"max-height":a.value,"max-rows":20,"aria-labelledby":e.labelId,ring:"",bordered:""},null,8,["type","model-value","show-word-count","clearable","max-length","max-line-length","max-lines","placeholder","richtext","max-height","aria-labelledby"])]))}}),[["__scopeId","data-v-ceacb5b8"]]),yre={class:"field-image-adjust"},gk=ht(s.defineComponent({__name:"ImageAdjust",props:s.mergeModels({minX:{},maxX:{},minY:{},maxY:{},minScale:{},maxScale:{},type:{},aspectRatio:{},bridge:{}},{image:{required:!0},imageModifiers:{},adjust:{required:!0},adjustModifiers:{}}),emits:["update:image","update:adjust"],setup(e){s.inject(C1);const t=s.useModel(e,"image"),r=s.useModel(e,"adjust"),n=e,a=s.ref();return s.watchEffect(async()=>{t.value&&(a.value=await ld(t.value))}),s.computed(()=>P2(r.value,a.value.width,a.value.height,n.aspectRatio)),(i,o)=>(s.openBlock(),s.createElementBlock("div",yre,[s.createVNode(Et,null,{icon:s.withCtx(()=>[s.createVNode(gt,null,{default:s.withCtx(()=>[s.createVNode(s.unref(eC))]),_:1})]),default:s.withCtx(()=>[o[0]||(o[0]=s.createTextVNode(" Crop ",-1))]),_:1})]))}}),[["__scopeId","data-v-9e4c42cb"]]),wre=["aria-labelledby"],Ire=["aria-checked","aria-label","tabindex","onClick"],xre={class:"image-card"},Ere={class:"label-image-proxy"},Bre=["src"],kre={key:0,class:"label"},mk=ht(s.defineComponent({__name:"Select",props:s.mergeModels({options:{},layout:{},cardSize:{},showLabels:{type:Boolean},labelId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=s.useModel(e,"modelValue"),n=jl(),a=s.computed(()=>t.layout==="grid"||t.layout==="cards");function i(h){r.value=h.value}const o=s.ref([]);function c(h,d){o.value[d]=h}const l=s.computed(()=>{const h=t.options.findIndex(d=>d.value===r.value);return h>=0?h:0});function u(h){var A;const d=t.options.length;if(d===0)return;const g=o.value.findIndex(b=>b===document.activeElement);let p;switch(h.key){case"ArrowRight":case"ArrowDown":p=g<0?0:(g+1)%d;break;case"ArrowLeft":case"ArrowUp":p=g<0?d-1:(g-1+d)%d;break;case"Home":p=0;break;case"End":p=d-1;break;case"Enter":case" ":g>=0&&(h.preventDefault(),i(t.options[g]));return;default:return}h.preventDefault(),(A=o.value[p])==null||A.focus(),i(t.options[p])}const f=s.computed(()=>t.options.map(h=>({label:h.label,value:h.value,icon:h.image?()=>s.h(gt,{},()=>s.h("img",{src:h.image,style:{"object-fit":"cover",width:"24px",height:"24px"}})):void 0})));return(h,d)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["select-field",{"grid-layout":a.value,"horizontal-scroll":e.layout==="cards"}])},[a.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["select-grid",{["size-"+e.cardSize]:!0,"horizontal-scroll":e.layout==="cards"}]),role:"radiogroup","aria-labelledby":e.labelId,onKeydown:u},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.options,(g,p)=>(s.openBlock(),s.createElementBlock("div",{key:p,ref_for:!0,ref:A=>c(A,p),class:s.normalizeClass(["option-item",{active:g.value===r.value}]),role:"radio","aria-checked":g.value===r.value?"true":"false","aria-label":g.label,tabindex:p===l.value?0:-1,onClick:A=>i(g)},[s.createElementVNode("div",xre,[s.createElementVNode("div",Ere,[s.createElementVNode("span",null,s.toDisplayString(g.label),1)]),g.image?(s.openBlock(),s.createElementBlock("img",{key:0,src:s.unref(n)(g.image)},null,8,Bre)):s.createCommentVNode("",!0)]),e.showLabels?(s.openBlock(),s.createElementBlock("div",kre,s.toDisplayString(g.label),1)):s.createCommentVNode("",!0)],10,Ire))),128))],42,wre)):(s.openBlock(),s.createBlock(ai,{key:1,modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=g=>r.value=g),options:f.value,"aria-labelledby":e.labelId,bordered:""},null,8,["modelValue","options","aria-labelledby"]))],2))}}),[["__scopeId","data-v-9bc0926e"]]);function pk(e){const t=s.computed(()=>{const n=s.toValue(e.disabled)??!1,a=s.toValue(e.labelledBy);return{role:e.role,tabindex:n?-1:0,"aria-checked":s.toValue(e.checked)?"true":"false","aria-disabled":n?"true":void 0,"aria-labelledby":a,"aria-label":a?void 0:s.toValue(e.label)}});function r(n){s.toValue(e.disabled)||(n.key===" "||n.key==="Enter")&&(n.preventDefault(),e.toggle())}return{attrs:t,onKeydown:r}}const xu=ht(s.defineComponent({__name:"BxCheckbox",props:s.mergeModels({label:{},ariaLabel:{},ariaLabelledby:{},size:{default:"medium"},disabled:{type:Boolean,default:!1},secondary:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=s.useModel(e,"modelValue"),n=()=>{t.disabled||(r.value=!r.value)},{attrs:a,onKeydown:i}=pk({role:"checkbox",checked:()=>r.value,disabled:()=>t.disabled,label:()=>t.ariaLabel??t.label,labelledBy:()=>t.ariaLabelledby,toggle:n});return(o,c)=>(s.openBlock(),s.createElementBlock("div",s.mergeProps({class:["bx-checkbox",{checked:r.value,disabled:e.disabled,secondary:e.secondary}]},s.unref(a),{onClick:n,onKeydown:c[0]||(c[0]=(...l)=>s.unref(i)&&s.unref(i)(...l))}),[...c[1]||(c[1]=[s.createElementVNode("div",{class:"checkbox-box"},[s.createElementVNode("div",{class:"checkbox-symbol"},[s.createElementVNode("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"check-icon","aria-hidden":"true"},[s.createElementVNode("path",{d:"M12.1875 3.75L5.625 11.25L2.8125 8.4375",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})])])],-1)])],16))}}),[["__scopeId","data-v-6cd2378e"]]),Sre={class:"label"},_re=["id"],Ak=ht(s.defineComponent({__name:"Checkbox",props:s.mergeModels({description:{},detailedDescription:{},label:{},mobile:{type:Boolean,default:!1},secondary:{type:Boolean,default:!1},labelId:{}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=mi("bx-checkbox-label"),r=s.useModel(e,"modelValue");return(n,a)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["checkbox-field",{mobile:e.mobile}])},[s.createVNode(xu,{modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=i=>r.value=i),size:"medium","aria-labelledby":e.label?s.unref(t):e.labelId},null,8,["modelValue","aria-labelledby"]),e.label?(s.openBlock(),s.createElementBlock("div",{key:0,class:"checkbox-label",onClick:a[1]||(a[1]=i=>r.value=!r.value)},[s.createElementVNode("div",Sre,[s.createElementVNode("span",{id:s.unref(t)},s.toDisplayString(e.label),9,_re)])])):s.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-8852852c"]]),Rre=s.defineComponent({__name:"CollectionEntryFields",props:{bridge:{},fields:{},layout:{},data:{}},emits:["update:data"],setup(e,{emit:t}){const r=e,n=t,a=s.ref(r.data);return s.watch(()=>r.data,i=>{i!==a.value&&(a.value=i)}),s.provide("data",a),s.watch(a,()=>{n("update:data",a.value)},{deep:!0}),(i,o)=>(s.openBlock(),s.createBlock(fk,{bridge:e.bridge,fields:e.fields,card:!1,layout:e.layout},null,8,["bridge","fields","layout"]))}});/**!
149
149
  * Sortable 1.15.7
150
150
  * @author RubaXa <trash@rubaxa.org>
151
151
  * @author owenm <owen23355@gmail.com>