@cogic/annotorious 2.7.18 → 2.7.19

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.
@@ -21,5 +21,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
21
21
  0%, 80%, 100% { opacity: 0; }
22
22
  40% { opacity: 1; }
23
23
  `]))),Nb=function(e){var n=e.isFocused,r=e.size,o=e.theme,i=o.colors,a=o.spacing.baseUnit;return{label:"loadingIndicator",color:n?i.neutral60:i.neutral20,display:"flex",padding:a*2,transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"}},ai=function(e){var n=e.delay,r=e.offset;return M("span",{css:Qo({animation:"".concat(Rb," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":null,height:"1em",verticalAlign:"top",width:"1em"},"","")})},Yl=function(e){var n=e.className,r=e.cx,o=e.getStyles,i=e.innerProps,a=e.isRtl;return M("div",T({css:o("loadingIndicator",e),className:r({indicator:!0,"loading-indicator":!0},n)},i),M(ai,{delay:0,offset:a}),M(ai,{delay:160,offset:!0}),M(ai,{delay:320,offset:!a}))};Yl.defaultProps={size:4};var Lb=function(e){var n=e.isDisabled,r=e.isFocused,o=e.theme,i=o.colors,a=o.borderRadius,s=o.spacing;return{label:"control",alignItems:"center",backgroundColor:n?i.neutral5:i.neutral0,borderColor:n?i.neutral10:r?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(i.primary):null,cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:s.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms","&:hover":{borderColor:r?i.primary:i.neutral30}}},Bb=function(e){var n=e.children,r=e.cx,o=e.getStyles,i=e.className,a=e.isDisabled,s=e.isFocused,u=e.innerRef,c=e.innerProps,l=e.menuIsOpen;return M("div",T({ref:u,css:o("control",e),className:r({control:!0,"control--is-disabled":a,"control--is-focused":s,"control--menu-is-open":l},i)},c),n)},Vb=function(e){var n=e.theme.spacing;return{paddingBottom:n.baseUnit*2,paddingTop:n.baseUnit*2}},Hb=function(e){var n=e.children,r=e.className,o=e.cx,i=e.getStyles,a=e.Heading,s=e.headingProps,u=e.innerProps,c=e.label,l=e.theme,f=e.selectProps;return M("div",T({css:i("group",e),className:o({group:!0},r)},u),M(a,T({},s,{selectProps:f,theme:l,getStyles:i,cx:o}),c),M("div",null,n))},Ub=function(e){var n=e.theme.spacing;return{label:"group",color:"#999",cursor:"default",display:"block",fontSize:"75%",fontWeight:"500",marginBottom:"0.25em",paddingLeft:n.baseUnit*3,paddingRight:n.baseUnit*3,textTransform:"uppercase"}},jb=function(e){var n=e.getStyles,r=e.cx,o=e.className,i=Il(e);i.data;var a=Mt(i,["data"]);return M("div",T({css:n("groupHeading",e),className:r({"group-heading":!0},o)},a))},zb=function(e){var n=e.isDisabled,r=e.theme,o=r.spacing,i=r.colors;return{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,visibility:n?"hidden":"visible",color:i.neutral80}},Wb=function(e){return{label:"input",background:0,border:0,fontSize:"inherit",opacity:e?0:1,outline:0,padding:0,color:"inherit"}},Gb=function(e){var n=e.className,r=e.cx,o=e.getStyles,i=Il(e),a=i.innerRef,s=i.isDisabled,u=i.isHidden,c=Mt(i,["innerRef","isDisabled","isHidden"]);return M("div",{css:o("input",e)},M(Z0,T({className:r({input:!0},n),inputRef:a,inputStyle:Wb(u),disabled:s},c)))},qb=function(e){var n=e.theme,r=n.spacing,o=n.borderRadius,i=n.colors;return{label:"multiValue",backgroundColor:i.neutral10,borderRadius:o/2,display:"flex",margin:r.baseUnit/2,minWidth:0}},Yb=function(e){var n=e.theme,r=n.borderRadius,o=n.colors,i=e.cropWithEllipsis;return{borderRadius:r/2,color:o.neutral80,fontSize:"85%",overflow:"hidden",padding:3,paddingLeft:6,textOverflow:i?"ellipsis":null,whiteSpace:"nowrap"}},Xb=function(e){var n=e.theme,r=n.spacing,o=n.borderRadius,i=n.colors,a=e.isFocused;return{alignItems:"center",borderRadius:o/2,backgroundColor:a&&i.dangerLight,display:"flex",paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}}},Xl=function(e){var n=e.children,r=e.innerProps;return M("div",r,n)},Kb=Xl,Jb=Xl;function Zb(t){var e=t.children,n=t.innerProps;return M("div",n,e||M(ii,{size:14}))}var Kl=function(e){var n=e.children,r=e.className,o=e.components,i=e.cx,a=e.data,s=e.getStyles,u=e.innerProps,c=e.isDisabled,l=e.removeProps,f=e.selectProps,d=o.Container,p=o.Label,m=o.Remove;return M(j0,null,function(b){var v=b.css,S=b.cx;return M(d,{data:a,innerProps:ie({className:S(v(s("multiValue",e)),i({"multi-value":!0,"multi-value--is-disabled":c},r))},u),selectProps:f},M(p,{data:a,innerProps:{className:S(v(s("multiValueLabel",e)),i({"multi-value__label":!0},r))},selectProps:f},n),M(m,{data:a,innerProps:ie({className:S(v(s("multiValueRemove",e)),i({"multi-value__remove":!0},r))},l),selectProps:f}))})};Kl.defaultProps={cropWithEllipsis:!0};var Qb=function(e){var n=e.isDisabled,r=e.isFocused,o=e.isSelected,i=e.theme,a=i.spacing,s=i.colors;return{label:"option",backgroundColor:o?s.primary:r?s.primary25:"transparent",color:n?s.neutral20:o?s.neutral0:"inherit",cursor:"default",display:"block",fontSize:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",":active":{backgroundColor:!n&&(o?s.primary:s.primary50)}}},e1=function(e){var n=e.children,r=e.className,o=e.cx,i=e.getStyles,a=e.isDisabled,s=e.isFocused,u=e.isSelected,c=e.innerRef,l=e.innerProps;return M("div",T({css:i("option",e),className:o({option:!0,"option--is-disabled":a,"option--is-focused":s,"option--is-selected":u},r),ref:c},l),n)},t1=function(e){var n=e.theme,r=n.spacing,o=n.colors;return{label:"placeholder",color:o.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2,position:"absolute",top:"50%",transform:"translateY(-50%)"}},n1=function(e){var n=e.children,r=e.className,o=e.cx,i=e.getStyles,a=e.innerProps;return M("div",T({css:i("placeholder",e),className:o({placeholder:!0},r)},a),n)},r1=function(e){var n=e.isDisabled,r=e.theme,o=r.spacing,i=r.colors;return{label:"singleValue",color:n?i.neutral40:i.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2,maxWidth:"calc(100% - ".concat(o.baseUnit*2,"px)"),overflow:"hidden",position:"absolute",textOverflow:"ellipsis",whiteSpace:"nowrap",top:"50%",transform:"translateY(-50%)"}},o1=function(e){var n=e.children,r=e.className,o=e.cx,i=e.getStyles,a=e.isDisabled,s=e.innerProps;return M("div",T({css:i("singleValue",e),className:o({"single-value":!0,"single-value--is-disabled":a},r)},s),n)},i1={ClearIndicator:kb,Control:Bb,DropdownIndicator:Tb,DownChevron:Gl,CrossIcon:ii,Group:Hb,GroupHeading:jb,IndicatorsContainer:xb,IndicatorSeparator:Ib,Input:Gb,LoadingIndicator:Yl,Menu:vb,MenuList:yb,MenuPortal:Eb,LoadingMessage:jl,NoOptionsMessage:Ul,MultiValue:Kl,MultiValueContainer:Kb,MultiValueLabel:Jb,MultiValueRemove:Zb,Option:e1,Placeholder:n1,SelectContainer:Ab,SingleValue:o1,ValueContainer:Ob},a1=function(e){return ie(ie({},i1),e.components)};function si(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s1(t){if(Array.isArray(t))return si(t)}function u1(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function l1(t,e){if(!!t){if(typeof t=="string")return si(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return si(t,e)}}function c1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
24
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jl(t){return s1(t)||u1(t)||l1(t)||c1()}var Zl=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function f1(t,e){return!!(t===e||Zl(t)&&Zl(e))}function d1(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!f1(t[n],e[n]))return!1;return!0}function p1(t,e){e===void 0&&(e=d1);var n,r=[],o,i=!1;function a(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return i&&n===this&&e(s,r)||(o=t.apply(this,s),i=!0,n=this,r=s),o}return a}for(var h1={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},m1=function(e){return M("span",T({css:h1},e))},v1={guidance:function(e){var n=e.isSearchable,r=e.isMulti,o=e.isDisabled,i=e.tabSelectsValue,a=e.context;switch(a){case"menu":return"Use Up and Down to choose options".concat(o?"":", press Enter to select the currently focused option",", press Escape to exit the menu").concat(i?", press Tab to select the option and exit the menu":"",".");case"input":return"".concat(e["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":"");case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var n=e.action,r=e.label,o=r===void 0?"":r,i=e.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(o,", deselected.");case"select-option":return i?"option ".concat(o," is disabled. Select another option."):"option ".concat(o,", selected.");default:return""}},onFocus:function(e){var n=e.context,r=e.focused,o=r===void 0?{}:r,i=e.options,a=e.label,s=a===void 0?"":a,u=e.selectValue,c=e.isDisabled,l=e.isSelected,f=function(b,v){return b&&b.length?"".concat(b.indexOf(v)+1," of ").concat(b.length):""};if(n==="value"&&u)return"value ".concat(s," focused, ").concat(f(u,o),".");if(n==="menu"){var d=c?" disabled":"",p="".concat(l?"selected":"focused").concat(d);return"option ".concat(s," ").concat(p,", ").concat(f(i,o),".")}return""},onFilter:function(e){var n=e.inputValue,r=e.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},g1=function(e){var n=e.ariaSelection,r=e.focusedOption,o=e.focusedValue,i=e.focusableOptions,a=e.isFocused,s=e.selectValue,u=e.selectProps,c=u.ariaLiveMessages,l=u.getOptionLabel,f=u.inputValue,d=u.isMulti,p=u.isOptionDisabled,m=u.isSearchable,b=u.menuIsOpen,v=u.options,S=u.screenReaderStatus,C=u.tabSelectsValue,P=u["aria-label"],F=u["aria-live"],O=He(function(){return ie(ie({},v1),c||{})},[c]),k=He(function(){var W="";if(n&&O.onChange){var z=n.option,Y=n.removedValue,de=n.value,Ie=function(Re){return Array.isArray(Re)?null:Re},he=Y||z||Ie(de),te=ie({isDisabled:he&&p(he),label:he?l(he):""},n);W=O.onChange(te)}return W},[n,p,l,O]),x=He(function(){var W="",z=r||o,Y=!!(r&&s&&s.includes(r));if(z&&O.onFocus){var de={focused:z,label:l(z),isDisabled:p(z),isSelected:Y,options:v,context:z===r?"menu":"value",selectValue:s};W=O.onFocus(de)}return W},[r,o,l,p,O,v,s]),X=He(function(){var W="";if(b&&v.length&&O.onFilter){var z=S({count:i.length});W=O.onFilter({inputValue:f,resultsMessage:z})}return W},[i,f,b,O,v,S]),H=He(function(){var W="";if(O.guidance){var z=o?"value":b?"menu":"input";W=O.guidance({"aria-label":P,context:z,isDisabled:r&&p(r),isMulti:d,isSearchable:m,tabSelectsValue:C})}return W},[P,r,o,d,p,m,b,O,C]),fe="".concat(x," ").concat(X," ").concat(H);return M(m1,{"aria-live":F,"aria-atomic":"false","aria-relevant":"additions text"},a&&M(g.Fragment,null,M("span",{id:"aria-selection"},k),M("span",{id:"aria-context"},fe)))},ui=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}],y1=new RegExp("["+ui.map(function(t){return t.letters}).join("")+"]","g"),Ql={},li=0;li<ui.length;li++)for(var ci=ui[li],fi=0;fi<ci.letters.length;fi++)Ql[ci.letters[fi]]=ci.base;var ec=function(e){return e.replace(y1,function(n){return Ql[n]})},b1=p1(ec),tc=function(e){return e.replace(/^\s+|\s+$/g,"")},S1=function(e){return"".concat(e.label," ").concat(e.value)},_1=function(e){return function(n,r){var o=ie({ignoreCase:!0,ignoreAccents:!0,stringify:S1,trim:!0,matchFrom:"any"},e),i=o.ignoreCase,a=o.ignoreAccents,s=o.stringify,u=o.trim,c=o.matchFrom,l=u?tc(r):r,f=u?tc(s(n)):s(n);return i&&(l=l.toLowerCase(),f=f.toLowerCase()),a&&(l=b1(l),f=ec(f)),c==="start"?f.substr(0,l.length)===l:f.indexOf(l)>-1}};function E1(t){t.in,t.out,t.onExited,t.appear,t.enter,t.exit;var e=t.innerRef;t.emotion;var n=Mt(t,["in","out","onExited","appear","enter","exit","innerRef","emotion"]);return M("input",T({ref:e},n,{css:Qo({label:"dummyInput",background:0,border:0,fontSize:"inherit",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(0)"},"","")}))}var C1=function(e){e.preventDefault(),e.stopPropagation()};function A1(t){var e=t.isEnabled,n=t.onBottomArrive,r=t.onBottomLeave,o=t.onTopArrive,i=t.onTopLeave,a=$e(!1),s=$e(!1),u=$e(0),c=$e(null),l=xe(function(v,S){if(c.current!==null){var C=c.current,P=C.scrollTop,F=C.scrollHeight,O=C.clientHeight,k=c.current,x=S>0,X=F-O-P,H=!1;X>S&&a.current&&(r&&r(v),a.current=!1),x&&s.current&&(i&&i(v),s.current=!1),x&&S>X?(n&&!a.current&&n(v),k.scrollTop=F,H=!0,a.current=!0):!x&&-S>P&&(o&&!s.current&&o(v),k.scrollTop=0,H=!0,s.current=!0),H&&C1(v)}},[]),f=xe(function(v){l(v,v.deltaY)},[l]),d=xe(function(v){u.current=v.changedTouches[0].clientY},[]),p=xe(function(v){var S=u.current-v.changedTouches[0].clientY;l(v,S)},[l]),m=xe(function(v){if(!!v){var S=db?{passive:!1}:!1;typeof v.addEventListener=="function"&&v.addEventListener("wheel",f,S),typeof v.addEventListener=="function"&&v.addEventListener("touchstart",d,S),typeof v.addEventListener=="function"&&v.addEventListener("touchmove",p,S)}},[p,d,f]),b=xe(function(v){!v||(typeof v.removeEventListener=="function"&&v.removeEventListener("wheel",f,!1),typeof v.removeEventListener=="function"&&v.removeEventListener("touchstart",d,!1),typeof v.removeEventListener=="function"&&v.removeEventListener("touchmove",p,!1))},[p,d,f]);return tt(function(){if(!!e){var v=c.current;return m(v),function(){b(v)}}},[e,m,b]),function(v){c.current=v}}var nc=["boxSizing","height","overflow","paddingRight","position"],rc={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function oc(t){t.preventDefault()}function ic(t){t.stopPropagation()}function ac(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function sc(){return"ontouchstart"in window||navigator.maxTouchPoints}var uc=!!(typeof window!="undefined"&&window.document&&window.document.createElement),on=0,Ft={capture:!1,passive:!1};function w1(t){var e=t.isEnabled,n=t.accountForScrollbars,r=n===void 0?!0:n,o=$e({}),i=$e(null),a=xe(function(u){if(!!uc){var c=document.body,l=c&&c.style;if(r&&nc.forEach(function(m){var b=l&&l[m];o.current[m]=b}),r&&on<1){var f=parseInt(o.current.paddingRight,10)||0,d=document.body?document.body.clientWidth:0,p=window.innerWidth-d+f||0;Object.keys(rc).forEach(function(m){var b=rc[m];l&&(l[m]=b)}),l&&(l.paddingRight="".concat(p,"px"))}c&&sc()&&(c.addEventListener("touchmove",oc,Ft),u&&(u.addEventListener("touchstart",ac,Ft),u.addEventListener("touchmove",ic,Ft))),on+=1}},[]),s=xe(function(u){if(!!uc){var c=document.body,l=c&&c.style;on=Math.max(on-1,0),r&&on<1&&nc.forEach(function(f){var d=o.current[f];l&&(l[f]=d)}),c&&sc()&&(c.removeEventListener("touchmove",oc,Ft),u&&(u.removeEventListener("touchstart",ac,Ft),u.removeEventListener("touchmove",ic,Ft)))}},[]);return tt(function(){if(!!e){var u=i.current;return a(u),function(){s(u)}}},[e,a,s]),function(u){i.current=u}}var O1=function(){return document.activeElement&&document.activeElement.blur()},$1={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function x1(t){var e=t.children,n=t.lockEnabled,r=t.captureEnabled,o=r===void 0?!0:r,i=t.onBottomArrive,a=t.onBottomLeave,s=t.onTopArrive,u=t.onTopLeave,c=A1({isEnabled:o,onBottomArrive:i,onBottomLeave:a,onTopArrive:s,onTopLeave:u}),l=w1({isEnabled:n}),f=function(p){c(p),l(p)};return M(g.Fragment,null,n&&M("div",{onClick:O1,css:$1}),e(f))}var P1=function(e){return e.label},D1=function(e){return e.label},T1=function(e){return e.value},M1=function(e){return!!e.isDisabled},k1={clearIndicator:Mb,container:Cb,control:Lb,dropdownIndicator:Db,group:Vb,groupHeading:Ub,indicatorsContainer:$b,indicatorSeparator:Fb,input:zb,loadingIndicator:Nb,loadingMessage:Sb,menu:mb,menuList:gb,menuPortal:_b,multiValue:qb,multiValueLabel:Yb,multiValueRemove:Xb,noOptionsMessage:bb,option:Qb,placeholder:t1,singleValue:r1,valueContainer:wb},F1={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},I1=4,lc=4,R1=38,N1=lc*2,L1={baseUnit:lc,controlHeight:R1,menuGutter:N1},di={borderRadius:I1,colors:F1,spacing:L1},B1={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Nl(),captureMenuScroll:!Nl(),closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:_1(),formatGroupLabel:P1,getOptionLabel:D1,getOptionValue:T1,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:M1,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!cb(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var n=e.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:"0",tabSelectsValue:!0};function cc(t,e,n,r){var o=mc(t,e,n),i=vc(t,e,n),a=hc(t,e),s=br(t,e);return{type:"option",data:e,isDisabled:o,isSelected:i,label:a,value:s,index:r}}function fc(t,e){return t.options.map(function(n,r){if(n.options){var o=n.options.map(function(a,s){return cc(t,a,e,s)}).filter(function(a){return pc(t,a)});return o.length>0?{type:"group",data:n,options:o,index:r}:void 0}var i=cc(t,n,e,r);return pc(t,i)?i:void 0}).filter(function(n){return!!n})}function dc(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,Jl(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function V1(t,e){return dc(fc(t,e))}function pc(t,e){var n=t.inputValue,r=n===void 0?"":n,o=e.data,i=e.isSelected,a=e.label,s=e.value;return(!yc(t)||!i)&&gc(t,{label:a,value:s,data:o},r)}function H1(t,e){var n=t.focusedValue,r=t.selectValue,o=r.indexOf(n);if(o>-1){var i=e.indexOf(n);if(i>-1)return n;if(o<e.length)return e[o]}return null}function U1(t,e){var n=t.focusedOption;return n&&e.indexOf(n)>-1?n:e[0]}var hc=function(e,n){return e.getOptionLabel(n)},br=function(e,n){return e.getOptionValue(n)};function mc(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function vc(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=br(t,e);return n.some(function(o){return br(t,o)===r})}function gc(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var yc=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},j1=1,bc=function(t){dr(n,t);var e=hr(n);function n(r){var o;return lr(this,n),o=e.call(this,r),o.state={ariaSelection:null,focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0},o.blockOptionHover=!1,o.isComposing=!1,o.commonProps=void 0,o.initialTouchX=0,o.initialTouchY=0,o.instancePrefix="",o.openAfterFocus=!1,o.scrollToFocusedOptionOnUpdate=!1,o.userIsDragging=void 0,o.controlRef=null,o.getControlRef=function(i){o.controlRef=i},o.focusedOptionRef=null,o.getFocusedOptionRef=function(i){o.focusedOptionRef=i},o.menuListRef=null,o.getMenuListRef=function(i){o.menuListRef=i},o.inputRef=null,o.getInputRef=function(i){o.inputRef=i},o.focus=o.focusInput,o.blur=o.blurInput,o.onChange=function(i,a){var s=o.props,u=s.onChange,c=s.name;a.name=c,o.ariaOnChange(i,a),u(i,a)},o.setValue=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"set-value",s=arguments.length>2?arguments[2]:void 0,u=o.props,c=u.closeMenuOnSelect,l=u.isMulti;o.onInputChange("",{action:"set-value"}),c&&(o.setState({inputIsHiddenAfterUpdate:!l}),o.onMenuClose()),o.setState({clearFocusValueOnUpdate:!0}),o.onChange(i,{action:a,option:s})},o.selectOption=function(i){var a=o.props,s=a.blurInputOnSelect,u=a.isMulti,c=a.name,l=o.state.selectValue,f=u&&o.isOptionSelected(i,l),d=o.isOptionDisabled(i,l);if(f){var p=o.getOptionValue(i);o.setValue(l.filter(function(m){return o.getOptionValue(m)!==p}),"deselect-option",i)}else if(!d)u?o.setValue([].concat(Jl(l),[i]),"select-option",i):o.setValue(i,"select-option");else{o.ariaOnChange(i,{action:"select-option",name:c});return}s&&o.blurInput()},o.removeValue=function(i){var a=o.props.isMulti,s=o.state.selectValue,u=o.getOptionValue(i),c=s.filter(function(f){return o.getOptionValue(f)!==u}),l=a?c:c[0]||null;o.onChange(l,{action:"remove-value",removedValue:i}),o.focusInput()},o.clearValue=function(){var i=o.state.selectValue;o.onChange(o.props.isMulti?[]:null,{action:"clear",removedValues:i})},o.popValue=function(){var i=o.props.isMulti,a=o.state.selectValue,s=a[a.length-1],u=a.slice(0,a.length-1),c=i?u:u[0]||null;o.onChange(c,{action:"pop-value",removedValue:s})},o.getValue=function(){return o.state.selectValue},o.cx=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];return ib.apply(void 0,[o.props.classNamePrefix].concat(a))},o.getOptionLabel=function(i){return hc(o.props,i)},o.getOptionValue=function(i){return br(o.props,i)},o.getStyles=function(i,a){var s=k1[i](a);s.boxSizing="border-box";var u=o.props.styles[i];return u?u(s,a):s},o.getElementId=function(i){return"".concat(o.instancePrefix,"-").concat(i)},o.getComponents=function(){return a1(o.props)},o.buildCategorizedOptions=function(){return fc(o.props,o.state.selectValue)},o.getCategorizedOptions=function(){return o.props.menuIsOpen?o.buildCategorizedOptions():[]},o.buildFocusableOptions=function(){return dc(o.buildCategorizedOptions())},o.getFocusableOptions=function(){return o.props.menuIsOpen?o.buildFocusableOptions():[]},o.ariaOnChange=function(i,a){o.setState({ariaSelection:ie({value:i},a)})},o.onMenuMouseDown=function(i){i.button===0&&(i.stopPropagation(),i.preventDefault(),o.focusInput())},o.onMenuMouseMove=function(i){o.blockOptionHover=!1},o.onControlMouseDown=function(i){var a=o.props.openMenuOnClick;o.state.isFocused?o.props.menuIsOpen?i.target.tagName!=="INPUT"&&i.target.tagName!=="TEXTAREA"&&o.onMenuClose():a&&o.openMenu("first"):(a&&(o.openAfterFocus=!0),o.focusInput()),i.target.tagName!=="INPUT"&&i.target.tagName!=="TEXTAREA"&&i.preventDefault()},o.onDropdownIndicatorMouseDown=function(i){if(!(i&&i.type==="mousedown"&&i.button!==0)&&!o.props.isDisabled){var a=o.props,s=a.isMulti,u=a.menuIsOpen;o.focusInput(),u?(o.setState({inputIsHiddenAfterUpdate:!s}),o.onMenuClose()):o.openMenu("first"),i.preventDefault(),i.stopPropagation()}},o.onClearIndicatorMouseDown=function(i){i&&i.type==="mousedown"&&i.button!==0||(o.clearValue(),i.stopPropagation(),o.openAfterFocus=!1,i.type==="touchend"?o.focusInput():setTimeout(function(){return o.focusInput()}))},o.onScroll=function(i){typeof o.props.closeMenuOnScroll=="boolean"?i.target instanceof HTMLElement&&ri(i.target)&&o.props.onMenuClose():typeof o.props.closeMenuOnScroll=="function"&&o.props.closeMenuOnScroll(i)&&o.props.onMenuClose()},o.onCompositionStart=function(){o.isComposing=!0},o.onCompositionEnd=function(){o.isComposing=!1},o.onTouchStart=function(i){var a=i.touches,s=a&&a.item(0);!s||(o.initialTouchX=s.clientX,o.initialTouchY=s.clientY,o.userIsDragging=!1)},o.onTouchMove=function(i){var a=i.touches,s=a&&a.item(0);if(!!s){var u=Math.abs(s.clientX-o.initialTouchX),c=Math.abs(s.clientY-o.initialTouchY),l=5;o.userIsDragging=u>l||c>l}},o.onTouchEnd=function(i){o.userIsDragging||(o.controlRef&&!o.controlRef.contains(i.target)&&o.menuListRef&&!o.menuListRef.contains(i.target)&&o.blurInput(),o.initialTouchX=0,o.initialTouchY=0)},o.onControlTouchEnd=function(i){o.userIsDragging||o.onControlMouseDown(i)},o.onClearIndicatorTouchEnd=function(i){o.userIsDragging||o.onClearIndicatorMouseDown(i)},o.onDropdownIndicatorTouchEnd=function(i){o.userIsDragging||o.onDropdownIndicatorMouseDown(i)},o.handleInputChange=function(i){var a=i.currentTarget.value;o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange(a,{action:"input-change"}),o.props.menuIsOpen||o.onMenuOpen()},o.onInputFocus=function(i){o.props.onFocus&&o.props.onFocus(i),o.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(o.openAfterFocus||o.props.openMenuOnFocus)&&o.openMenu("first"),o.openAfterFocus=!1},o.onInputBlur=function(i){if(o.menuListRef&&o.menuListRef.contains(document.activeElement)){o.inputRef.focus();return}o.props.onBlur&&o.props.onBlur(i),o.onInputChange("",{action:"input-blur"}),o.onMenuClose(),o.setState({focusedValue:null,isFocused:!1})},o.onOptionHover=function(i){o.blockOptionHover||o.state.focusedOption===i||o.setState({focusedOption:i})},o.shouldHideSelectedOptions=function(){return yc(o.props)},o.onKeyDown=function(i){var a=o.props,s=a.isMulti,u=a.backspaceRemovesValue,c=a.escapeClearsValue,l=a.inputValue,f=a.isClearable,d=a.isDisabled,p=a.menuIsOpen,m=a.onKeyDown,b=a.tabSelectsValue,v=a.openMenuOnFocus,S=o.state,C=S.focusedOption,P=S.focusedValue,F=S.selectValue;if(!d&&!(typeof m=="function"&&(m(i),i.defaultPrevented))){switch(o.blockOptionHover=!0,i.key){case"ArrowLeft":if(!s||l)return;o.focusValue("previous");break;case"ArrowRight":if(!s||l)return;o.focusValue("next");break;case"Delete":case"Backspace":if(l)return;if(P)o.removeValue(P);else{if(!u)return;s?o.popValue():f&&o.clearValue()}break;case"Tab":if(o.isComposing||i.shiftKey||!p||!b||!C||v&&o.isOptionSelected(C,F))return;o.selectOption(C);break;case"Enter":if(i.keyCode===229)break;if(p){if(!C||o.isComposing)return;o.selectOption(C);break}return;case"Escape":p?(o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange("",{action:"menu-close"}),o.onMenuClose()):f&&c&&o.clearValue();break;case" ":if(l)return;if(!p){o.openMenu("first");break}if(!C)return;o.selectOption(C);break;case"ArrowUp":p?o.focusOption("up"):o.openMenu("last");break;case"ArrowDown":p?o.focusOption("down"):o.openMenu("first");break;case"PageUp":if(!p)return;o.focusOption("pageup");break;case"PageDown":if(!p)return;o.focusOption("pagedown");break;case"Home":if(!p)return;o.focusOption("first");break;case"End":if(!p)return;o.focusOption("last");break;default:return}i.preventDefault()}},o.instancePrefix="react-select-"+(o.props.instanceId||++j1),o.state.selectValue=Fl(r.value),o}return cr(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()}},{key:"componentDidUpdate",value:function(o){var i=this.props,a=i.isDisabled,s=i.menuIsOpen,u=this.state.isFocused;(u&&!a&&o.isDisabled||u&&s&&!o.menuIsOpen)&&this.focusInput(),u&&a&&!o.isDisabled&&this.setState({isFocused:!1},this.onMenuClose),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ub(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close"}),this.props.onMenuClose()}},{key:"onInputChange",value:function(o,i){this.props.onInputChange(o,i)}},{key:"focusInput",value:function(){!this.inputRef||this.inputRef.focus()}},{key:"blurInput",value:function(){!this.inputRef||this.inputRef.blur()}},{key:"openMenu",value:function(o){var i=this,a=this.state,s=a.selectValue,u=a.isFocused,c=this.buildFocusableOptions(),l=o==="first"?0:c.length-1;if(!this.props.isMulti){var f=c.indexOf(s[0]);f>-1&&(l=f)}this.scrollToFocusedOptionOnUpdate=!(u&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[l]},function(){return i.onMenuOpen()})}},{key:"focusValue",value:function(o){var i=this.state,a=i.selectValue,s=i.focusedValue;if(!!this.props.isMulti){this.setState({focusedOption:null});var u=a.indexOf(s);s||(u=-1);var c=a.length-1,l=-1;if(!!a.length){switch(o){case"previous":u===0?l=0:u===-1?l=c:l=u-1;break;case"next":u>-1&&u<c&&(l=u+1);break}this.setState({inputIsHidden:l!==-1,focusedValue:a[l]})}}}},{key:"focusOption",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",i=this.props.pageSize,a=this.state.focusedOption,s=this.getFocusableOptions();if(!!s.length){var u=0,c=s.indexOf(a);a||(c=-1),o==="up"?u=c>0?c-1:s.length-1:o==="down"?u=(c+1)%s.length:o==="pageup"?(u=c-i,u<0&&(u=0)):o==="pagedown"?(u=c+i,u>s.length-1&&(u=s.length-1)):o==="last"&&(u=s.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:s[u],focusedValue:null})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(di):ie(ie({},di),this.props.theme):di}},{key:"getCommonProps",value:function(){var o=this.clearValue,i=this.cx,a=this.getStyles,s=this.getValue,u=this.selectOption,c=this.setValue,l=this.props,f=l.isMulti,d=l.isRtl,p=l.options,m=this.hasValue();return{clearValue:o,cx:i,getStyles:a,getValue:s,hasValue:m,isMulti:f,isRtl:d,options:p,selectOption:u,selectProps:l,setValue:c,theme:this.getTheme()}}},{key:"hasValue",value:function(){var o=this.state.selectValue;return o.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var o=this.props,i=o.isClearable,a=o.isMulti;return i===void 0?a:i}},{key:"isOptionDisabled",value:function(o,i){return mc(this.props,o,i)}},{key:"isOptionSelected",value:function(o,i){return vc(this.props,o,i)}},{key:"filterOption",value:function(o,i){return gc(this.props,o,i)}},{key:"formatOptionLabel",value:function(o,i){if(typeof this.props.formatOptionLabel=="function"){var a=this.props.inputValue,s=this.state.selectValue;return this.props.formatOptionLabel(o,{context:i,inputValue:a,selectValue:s})}else return this.getOptionLabel(o)}},{key:"formatGroupLabel",value:function(o){return this.props.formatGroupLabel(o)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var o=this.props,i=o.isDisabled,a=o.isSearchable,s=o.inputId,u=o.inputValue,c=o.tabIndex,l=o.form,f=this.getComponents(),d=f.Input,p=this.state.inputIsHidden,m=this.commonProps,b=s||this.getElementId("input"),v={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};return a?g.createElement(d,T({},m,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:b,innerRef:this.getInputRef,isDisabled:i,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:l,type:"text",value:u},v)):g.createElement(E1,T({id:b,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:mr,onFocus:this.onInputFocus,readOnly:!0,disabled:i,tabIndex:c,form:l,value:""},v))}},{key:"renderPlaceholderOrValue",value:function(){var o=this,i=this.getComponents(),a=i.MultiValue,s=i.MultiValueContainer,u=i.MultiValueLabel,c=i.MultiValueRemove,l=i.SingleValue,f=i.Placeholder,d=this.commonProps,p=this.props,m=p.controlShouldRenderValue,b=p.isDisabled,v=p.isMulti,S=p.inputValue,C=p.placeholder,P=this.state,F=P.selectValue,O=P.focusedValue,k=P.isFocused;if(!this.hasValue()||!m)return S?null:g.createElement(f,T({},d,{key:"placeholder",isDisabled:b,isFocused:k}),C);if(v){var x=F.map(function(H,fe){var W=H===O;return g.createElement(a,T({},d,{components:{Container:s,Label:u,Remove:c},isFocused:W,isDisabled:b,key:"".concat(o.getOptionValue(H)).concat(fe),index:fe,removeProps:{onClick:function(){return o.removeValue(H)},onTouchEnd:function(){return o.removeValue(H)},onMouseDown:function(Y){Y.preventDefault(),Y.stopPropagation()}},data:H}),o.formatOptionLabel(H,"value"))});return x}if(S)return null;var X=F[0];return g.createElement(l,T({},d,{data:X,isDisabled:b}),this.formatOptionLabel(X,"value"))}},{key:"renderClearIndicator",value:function(){var o=this.getComponents(),i=o.ClearIndicator,a=this.commonProps,s=this.props,u=s.isDisabled,c=s.isLoading,l=this.state.isFocused;if(!this.isClearable()||!i||u||!this.hasValue()||c)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(i,T({},a,{innerProps:f,isFocused:l}))}},{key:"renderLoadingIndicator",value:function(){var o=this.getComponents(),i=o.LoadingIndicator,a=this.commonProps,s=this.props,u=s.isDisabled,c=s.isLoading,l=this.state.isFocused;if(!i||!c)return null;var f={"aria-hidden":"true"};return g.createElement(i,T({},a,{innerProps:f,isDisabled:u,isFocused:l}))}},{key:"renderIndicatorSeparator",value:function(){var o=this.getComponents(),i=o.DropdownIndicator,a=o.IndicatorSeparator;if(!i||!a)return null;var s=this.commonProps,u=this.props.isDisabled,c=this.state.isFocused;return g.createElement(a,T({},s,{isDisabled:u,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var o=this.getComponents(),i=o.DropdownIndicator;if(!i)return null;var a=this.commonProps,s=this.props.isDisabled,u=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(i,T({},a,{innerProps:c,isDisabled:s,isFocused:u}))}},{key:"renderMenu",value:function(){var o=this,i=this.getComponents(),a=i.Group,s=i.GroupHeading,u=i.Menu,c=i.MenuList,l=i.MenuPortal,f=i.LoadingMessage,d=i.NoOptionsMessage,p=i.Option,m=this.commonProps,b=this.state.focusedOption,v=this.props,S=v.captureMenuScroll,C=v.inputValue,P=v.isLoading,F=v.loadingMessage,O=v.minMenuHeight,k=v.maxMenuHeight,x=v.menuIsOpen,X=v.menuPlacement,H=v.menuPosition,fe=v.menuPortalTarget,W=v.menuShouldBlockScroll,z=v.menuShouldScrollIntoView,Y=v.noOptionsMessage,de=v.onMenuScrollToTop,Ie=v.onMenuScrollToBottom;if(!x)return null;var he=function(_,E){var A=_.type,w=_.data,D=_.isDisabled,I=_.isSelected,j=_.label,U=_.value,Ze=b===w,We=D?void 0:function(){return o.onOptionHover(w)},Qe=D?void 0:function(){return o.selectOption(w)},Ne="".concat(o.getElementId("option"),"-").concat(E),cn={id:Ne,onClick:Qe,onMouseMove:We,onMouseOver:We,tabIndex:-1};return g.createElement(p,T({},m,{innerProps:cn,data:w,isDisabled:D,isSelected:I,key:Ne,label:j,type:A,value:U,isFocused:Ze,innerRef:Ze?o.getFocusedOptionRef:void 0}),o.formatOptionLabel(_.data,"menu"))},te;if(this.hasOptions())te=this.getCategorizedOptions().map(function(y){if(y.type==="group"){var _=y.data,E=y.options,A=y.index,w="".concat(o.getElementId("group"),"-").concat(A),D="".concat(w,"-heading");return g.createElement(a,T({},m,{key:w,data:_,options:E,Heading:s,headingProps:{id:D,data:y.data},label:o.formatGroupLabel(y.data)}),y.options.map(function(I){return he(I,"".concat(A,"-").concat(I.index))}))}else if(y.type==="option")return he(y,"".concat(y.index))});else if(P){var ln=F({inputValue:C});if(ln===null)return null;te=g.createElement(f,m,ln)}else{var Re=Y({inputValue:C});if(Re===null)return null;te=g.createElement(d,m,Re)}var we={minMenuHeight:O,maxMenuHeight:k,menuPlacement:X,menuPosition:H,menuShouldScrollIntoView:z},dt=g.createElement(Vl,T({},m,we),function(y){var _=y.ref,E=y.placerProps,A=E.placement,w=E.maxHeight;return g.createElement(u,T({},m,we,{innerRef:_,innerProps:{onMouseDown:o.onMenuMouseDown,onMouseMove:o.onMenuMouseMove},isLoading:P,placement:A}),g.createElement(x1,{captureEnabled:S,onTopArrive:de,onBottomArrive:Ie,lockEnabled:W},function(D){return g.createElement(c,T({},m,{innerRef:function(j){o.getMenuListRef(j),D(j)},isLoading:P,maxHeight:w,focusedOption:b}),te)}))});return fe||H==="fixed"?g.createElement(l,T({},m,{appendTo:fe,controlElement:this.controlRef,menuPlacement:X,menuPosition:H}),dt):dt}},{key:"renderFormField",value:function(){var o=this,i=this.props,a=i.delimiter,s=i.isDisabled,u=i.isMulti,c=i.name,l=this.state.selectValue;if(!(!c||s))if(u)if(a){var f=l.map(function(m){return o.getOptionValue(m)}).join(a);return g.createElement("input",{name:c,type:"hidden",value:f})}else{var d=l.length>0?l.map(function(m,b){return g.createElement("input",{key:"i-".concat(b),name:c,type:"hidden",value:o.getOptionValue(m)})}):g.createElement("input",{name:c,type:"hidden"});return g.createElement("div",null,d)}else{var p=l[0]?this.getOptionValue(l[0]):"";return g.createElement("input",{name:c,type:"hidden",value:p})}}},{key:"renderLiveRegion",value:function(){var o=this.commonProps,i=this.state,a=i.ariaSelection,s=i.focusedOption,u=i.focusedValue,c=i.isFocused,l=i.selectValue,f=this.getFocusableOptions();return g.createElement(g1,T({},o,{ariaSelection:a,focusedOption:s,focusedValue:u,isFocused:c,selectValue:l,focusableOptions:f}))}},{key:"render",value:function(){var o=this.getComponents(),i=o.Control,a=o.IndicatorsContainer,s=o.SelectContainer,u=o.ValueContainer,c=this.props,l=c.className,f=c.id,d=c.isDisabled,p=c.menuIsOpen,m=this.state.isFocused,b=this.commonProps=this.getCommonProps();return g.createElement(s,T({},b,{className:l,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:d,isFocused:m}),this.renderLiveRegion(),g.createElement(i,T({},b,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:d,isFocused:m,menuIsOpen:p}),g.createElement(u,T({},b,{isDisabled:d}),this.renderPlaceholderOrValue(),this.renderInput()),g.createElement(a,T({},b,{isDisabled:d}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(o,i){var a=i.prevProps,s=i.clearFocusValueOnUpdate,u=i.inputIsHiddenAfterUpdate,c=o.options,l=o.value,f=o.menuIsOpen,d=o.inputValue,p={};if(a&&(l!==a.value||c!==a.options||f!==a.menuIsOpen||d!==a.inputValue)){var m=Fl(l),b=f?V1(o,m):[],v=s?H1(i,m):null,S=U1(i,b);p={selectValue:m,focusedOption:S,focusedValue:v,clearFocusValueOnUpdate:!1}}var C=u!=null&&o!==a?{inputIsHidden:u,inputIsHiddenAfterUpdate:void 0}:{};return ie(ie(ie({},p),C),{},{prevProps:o})}}]),n}(J);bc.defaultProps=B1;var z1={defaultInputValue:"",defaultMenuIsOpen:!1,defaultValue:null},W1=function(e){var n,r;return r=n=function(o){dr(a,o);var i=hr(a);function a(){var s;lr(this,a);for(var u=arguments.length,c=new Array(u),l=0;l<u;l++)c[l]=arguments[l];return s=i.call.apply(i,[this].concat(c)),s.select=void 0,s.state={inputValue:s.props.inputValue!==void 0?s.props.inputValue:s.props.defaultInputValue,menuIsOpen:s.props.menuIsOpen!==void 0?s.props.menuIsOpen:s.props.defaultMenuIsOpen,value:s.props.value!==void 0?s.props.value:s.props.defaultValue},s.onChange=function(f,d){s.callProp("onChange",f,d),s.setState({value:f})},s.onInputChange=function(f,d){var p=s.callProp("onInputChange",f,d);s.setState({inputValue:p!==void 0?p:f})},s.onMenuOpen=function(){s.callProp("onMenuOpen"),s.setState({menuIsOpen:!0})},s.onMenuClose=function(){s.callProp("onMenuClose"),s.setState({menuIsOpen:!1})},s}return cr(a,[{key:"focus",value:function(){this.select.focus()}},{key:"blur",value:function(){this.select.blur()}},{key:"getProp",value:function(u){return this.props[u]!==void 0?this.props[u]:this.state[u]}},{key:"callProp",value:function(u){if(typeof this.props[u]=="function"){for(var c,l=arguments.length,f=new Array(l>1?l-1:0),d=1;d<l;d++)f[d-1]=arguments[d];return(c=this.props)[u].apply(c,f)}}},{key:"render",value:function(){var u=this,c=this.props;c.defaultInputValue,c.defaultMenuIsOpen,c.defaultValue;var l=Mt(c,["defaultInputValue","defaultMenuIsOpen","defaultValue"]);return g.createElement(e,T({},l,{ref:function(d){u.select=d},inputValue:this.getProp("inputValue"),menuIsOpen:this.getProp("menuIsOpen"),onChange:this.onChange,onInputChange:this.onInputChange,onMenuClose:this.onMenuClose,onMenuOpen:this.onMenuOpen,value:this.getProp("value")}))}}]),a}(J),n.defaultProps=z1,r},G1=W1(bc),q1=G1;const pi=[{value:"assessing",label:"Assessing"},{value:"bookmarking",label:"Bookmarking"},{value:"classifying",label:"Classifying"},{value:"commenting",label:"Commenting"},{value:"describing",label:"Describing"},{value:"editing",label:"Editing"},{value:"highlighting",label:"Highlighting"},{value:"identifying",label:"Identifying"},{value:"linking",label:"Linking"},{value:"moderating",label:"Moderating"},{value:"questioning",label:"Questioning"},{value:"replying",label:"Replying"},{value:"supplementing",label:"Transcription"}];var Sc=t=>{const e=t.content?pi.find(n=>n.value===t.content):null;return g.createElement("div",{className:"r6o-purposedropdown"},g.createElement(q1,{value:e,onChange:t.onChange,options:pi,isDisabled:!t.editable}))};const Y1=t=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1000 940",width:t.width},g.createElement("metadata",null,"IcoFont Icons"),g.createElement("title",null,"simple-down"),g.createElement("glyph",{glyphName:"simple-down",unicode:"\uEAB2",horizAdvX:"1000"}),g.createElement("path",{fill:"currentColor",d:"M200 392.6l300 300 300-300-85.10000000000002-85.10000000000002-214.89999999999998 214.79999999999995-214.89999999999998-214.89999999999998-85.10000000000002 85.20000000000005z"})),X1=t=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"180 150 700 800",width:t.width},g.createElement("metadata",null,"IcoFont Icons"),g.createElement("title",null,"close"),g.createElement("glyph",{glyphName:"close",unicode:"\uEEE4",horizAdvX:"1000"}),g.createElement("path",{fill:"currentColor",d:"M709.8 206.6c-64.39999999999998 65.50000000000003-128.89999999999998 131.20000000000002-194.19999999999993 197.6-8.600000000000023 8.699999999999989-22.400000000000034 8.800000000000011-31 0-65-66-129.70000000000005-131.8-194.5-197.6-8.600000000000023-8.699999999999989-22.400000000000034-8.599999999999994-30.900000000000034 0.09999999999999432-15.699999999999989 16.200000000000017-31.099999999999994 32.30000000000001-47.099999999999994 48.80000000000001-8.5 8.800000000000011-8.299999999999983 23 0.20000000000001705 31.69999999999999 63.099999999999966 64.19999999999999 127.89999999999998 130.10000000000002 193.59999999999997 197 8.600000000000023 8.699999999999989 8.5 22.80000000000001 0 31.599999999999966-65.19999999999999 66.40000000000009-130.2 132.5-194.7 198.10000000000002-8.5 8.700000000000045-8.5 22.800000000000068 0.20000000000001705 31.399999999999977l47.79999999999998 47.90000000000009c8.600000000000023 8.599999999999909 22.600000000000023 8.599999999999909 31.100000000000023-0.10000000000002274l194.2-197.30000000000007c8.600000000000023-8.699999999999932 22.399999999999977-8.699999999999932 31 0 64.70000000000005 65.80000000000007 129.20000000000005 131.4000000000001 194.20000000000005 197.5 8.599999999999909 8.700000000000045 22.5 8.800000000000068 31 0.10000000000002274 16-16.199999999999932 31.699999999999932-32.19999999999993 47.59999999999991-48.299999999999955 8.600000000000023-8.700000000000045 8.600000000000023-22.899999999999977 0.10000000000002274-31.600000000000023-63.799999999999955-65-128.5-130.89999999999998-194.19999999999993-197.79999999999995-8.600000000000023-8.700000000000045-8.600000000000023-22.900000000000034 0-31.600000000000023 65.19999999999993-66.40000000000003 130.0999999999999-132.5 194.5-198.20000000000005 8.599999999999909-8.699999999999989 8.5-22.799999999999955-0.10000000000002274-31.49999999999997l-47.80000000000007-48.099999999999994c-8.5-8.5-22.399999999999977-8.400000000000006-31 0.29999999999998295z"})),K1=t=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:t.width},g.createElement("path",{fill:"currentColor",d:"M268 416h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12zM432 80h-82.41l-34-56.7A48 48 0 0 0 274.41 0H173.59a48 48 0 0 0-41.16 23.3L98.41 80H16A16 16 0 0 0 0 96v16a16 16 0 0 0 16 16h16v336a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128h16a16 16 0 0 0 16-16V96a16 16 0 0 0-16-16zM171.84 50.91A6 6 0 0 1 177 48h94a6 6 0 0 1 5.15 2.91L293.61 80H154.39zM368 464H80V128h288zm-212-48h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12z"}));var J1=t=>{const[e,n]=Ve(!1),[r,o]=Ve(!1),i=f=>{n(!0),o(!1)},a=f=>{t.onDelete(t.body),o(!1)},s=f=>t.onUpdate(t.body,{...t.body,value:f.target.value}),u=f=>t.onUpdate(t.body,{...t.body,purpose:f.value}),c=t.body.modified||t.body.created,l=t.body.creator&&g.createElement("div",{className:"r6o-lastmodified"},g.createElement("span",{className:"r6o-lastmodified-by"},t.body.creator.name||t.body.creator.id),t.body.created&&g.createElement("span",{className:"r6o-lastmodified-at"},g.createElement(Wd,{datetime:t.env.toClientTime(c),locale:Se.locale()})));return t.readOnly?g.createElement("div",{className:"r6o-widget comment"},g.createElement("div",{className:"r6o-readonly-comment"},t.body.value),l):g.createElement("div",{className:e?"r6o-widget comment editable":"r6o-widget comment"},g.createElement(Zu,{editable:e,content:t.body.value,onChange:s,onSaveAndClose:t.onSaveAndClose}),!e&&l,t.purposeSelector&&g.createElement(Sc,{editable:e,content:t.body.purpose,onChange:u,onSaveAndClose:t.onSaveAndClose}),g.createElement("div",{className:r?"r6o-icon r6o-arrow-down r6o-menu-open":"r6o-icon r6o-arrow-down",onClick:()=>o(!r)},g.createElement(Y1,{width:12})),r&&g.createElement(ky,{onEdit:i,onDelete:a,onClickOutside:()=>o(!1)}))};const Z1=pi.map(t=>t.value),_c=(t,e)=>{const n=e?Z1.indexOf(t.purpose)>-1:t.purpose=="commenting"||t.purpose=="replying";return t.type==="TextualBody"&&(!Object.prototype.hasOwnProperty.call(t,"purpose")||n)},Ec=(t,e)=>{var n,r;if(e.editable===!0)return!1;if(e.editable===!1)return!0;if(e.editable==="MINE_ONLY"){const o=(n=t.creator)==null?void 0:n.id;return((r=e.env.user)==null?void 0:r.id)!==o}return e.readOnly},Q1=(t,e)=>t||{type:"TextualBody",value:"",purpose:e?"replying":"commenting",draft:!0},Cc=t=>{const e=t.annotation?t.annotation.bodies.filter(u=>_c(u,t.purposeSelector)):[],n=Q1(e.find(u=>u.draft==!0),e.length>1),r=e.filter(u=>u!=n),o=u=>{const c=n.value,l=u.target.value;c.length===0&&l.length>0?t.onAppendBody({...n,value:l}):c.length>0&&l.length===0?t.onRemoveBody(n):t.onUpdateBody(n,{...n,value:l})},i=u=>t.onUpdateBody(n,{...n,purpose:u.value}),a=!t.readOnly&&t.annotation,s=r.length===0||!t.disableReply;return g.createElement(g.Fragment,null,r.map((u,c)=>g.createElement(J1,{key:c,env:t.env,purposeSelector:t.purposeSelector,readOnly:Ec(u,t),body:u,onUpdate:t.onUpdateBody,onDelete:t.onRemoveBody,onSaveAndClose:t.onSaveAndClose})),a&&s&&g.createElement("div",{className:"r6o-widget comment editable"},g.createElement(Zu,{focus:t.focus,content:n.value,editable:!0,placeholder:r.length>0?Se.t("Add a reply..."):t.textPlaceHolder||Se.t("Add a comment..."),onChange:o,onSaveAndClose:()=>t.onSaveAndClose()}),t.purposeSelector&&n.value.length>0&&g.createElement(Sc,{editable:!0,content:n.purpose,onChange:i,onSaveAndClose:()=>t.onSaveAndClose()})))};Cc.disableDelete=(t,e)=>t.bodies.filter(r=>_c(r,e.purposeSelector)).some(r=>Ec(r,e));var Ac=Cc;function wc(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,fr(t,e)}function eS(t,e){return t.classList?!!e&&t.classList.contains(e):(" "+(t.className.baseVal||t.className)+" ").indexOf(" "+e+" ")!==-1}function tS(t,e){t.classList?t.classList.add(e):eS(t,e)||(typeof t.className=="string"?t.className=t.className+" "+e:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+e))}function Oc(t,e){return t.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function nS(t,e){t.classList?t.classList.remove(e):typeof t.className=="string"?t.className=Oc(t.className,e):t.setAttribute("class",Oc(t.className&&t.className.baseVal||"",e))}var $c={disabled:!1},xc=g.createContext(null),an="unmounted",ct="exited",ft="entering",It="entered",hi="exiting",ze=function(t){wc(e,t);function e(r,o){var i;i=t.call(this,r,o)||this;var a=o,s=a&&!a.isMounting?r.enter:r.appear,u;return i.appearStatus=null,r.in?s?(u=ct,i.appearStatus=ft):u=It:r.unmountOnExit||r.mountOnEnter?u=an:u=ct,i.state={status:u},i.nextCallback=null,i}e.getDerivedStateFromProps=function(o,i){var a=o.in;return a&&i.status===an?{status:ct}:null};var n=e.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var a=this.state.status;this.props.in?a!==ft&&a!==It&&(i=ft):(a===ft||a===It)&&(i=hi)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,a,s;return i=a=s=o,o!=null&&typeof o!="number"&&(i=o.exit,a=o.enter,s=o.appear!==void 0?o.appear:a),{exit:i,enter:a,appear:s}},n.updateStatus=function(o,i){o===void 0&&(o=!1),i!==null?(this.cancelNextCallback(),i===ft?this.performEnter(o):this.performExit()):this.props.unmountOnExit&&this.state.status===ct&&this.setState({status:an})},n.performEnter=function(o){var i=this,a=this.props.enter,s=this.context?this.context.isMounting:o,u=this.props.nodeRef?[s]:[g.findDOMNode(this),s],c=u[0],l=u[1],f=this.getTimeouts(),d=s?f.appear:f.enter;if(!o&&!a||$c.disabled){this.safeSetState({status:It},function(){i.props.onEntered(c)});return}this.props.onEnter(c,l),this.safeSetState({status:ft},function(){i.props.onEntering(c,l),i.onTransitionEnd(d,function(){i.safeSetState({status:It},function(){i.props.onEntered(c,l)})})})},n.performExit=function(){var o=this,i=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:g.findDOMNode(this);if(!i||$c.disabled){this.safeSetState({status:ct},function(){o.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:hi},function(){o.props.onExiting(s),o.onTransitionEnd(a.exit,function(){o.safeSetState({status:ct},function(){o.props.onExited(s)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,i.nextCallback=null,o(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var a=this.props.nodeRef?this.props.nodeRef.current:g.findDOMNode(this),s=o==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],c=u[0],l=u[1];this.props.addEndListener(c,l)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===an)return null;var i=this.props,a=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var s=ei(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return g.createElement(xc.Provider,{value:null},typeof a=="function"?a(o,s):g.cloneElement(g.Children.only(a),s))},e}(g.Component);ze.contextType=xc,ze.propTypes={};function Rt(){}ze.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Rt,onEntering:Rt,onEntered:Rt,onExit:Rt,onExiting:Rt,onExited:Rt},ze.UNMOUNTED=an,ze.EXITED=ct,ze.ENTERING=ft,ze.ENTERED=It,ze.EXITING=hi;var rS=ze,oS=function(e,n){return e&&n&&n.split(" ").forEach(function(r){return tS(e,r)})},mi=function(e,n){return e&&n&&n.split(" ").forEach(function(r){return nS(e,r)})},vi=function(t){wc(e,t);function e(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(s,u){var c=r.resolveArguments(s,u),l=c[0],f=c[1];r.removeClasses(l,"exit"),r.addClass(l,f?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(s,u)},r.onEntering=function(s,u){var c=r.resolveArguments(s,u),l=c[0],f=c[1],d=f?"appear":"enter";r.addClass(l,d,"active"),r.props.onEntering&&r.props.onEntering(s,u)},r.onEntered=function(s,u){var c=r.resolveArguments(s,u),l=c[0],f=c[1],d=f?"appear":"enter";r.removeClasses(l,d),r.addClass(l,d,"done"),r.props.onEntered&&r.props.onEntered(s,u)},r.onExit=function(s){var u=r.resolveArguments(s),c=u[0];r.removeClasses(c,"appear"),r.removeClasses(c,"enter"),r.addClass(c,"exit","base"),r.props.onExit&&r.props.onExit(s)},r.onExiting=function(s){var u=r.resolveArguments(s),c=u[0];r.addClass(c,"exit","active"),r.props.onExiting&&r.props.onExiting(s)},r.onExited=function(s){var u=r.resolveArguments(s),c=u[0];r.removeClasses(c,"exit"),r.addClass(c,"exit","done"),r.props.onExited&&r.props.onExited(s)},r.resolveArguments=function(s,u){return r.props.nodeRef?[r.props.nodeRef.current,s]:[s,u]},r.getClassNames=function(s){var u=r.props.classNames,c=typeof u=="string",l=c&&u?u+"-":"",f=c?""+l+s:u[s],d=c?f+"-active":u[s+"Active"],p=c?f+"-done":u[s+"Done"];return{baseClassName:f,activeClassName:d,doneClassName:p}},r}var n=e.prototype;return n.addClass=function(o,i,a){var s=this.getClassNames(i)[a+"ClassName"],u=this.getClassNames("enter"),c=u.doneClassName;i==="appear"&&a==="done"&&c&&(s+=" "+c),a==="active"&&o&&o.scrollTop,s&&(this.appliedClasses[i][a]=s,oS(o,s))},n.removeClasses=function(o,i){var a=this.appliedClasses[i],s=a.base,u=a.active,c=a.done;this.appliedClasses[i]={},s&&mi(o,s),u&&mi(o,u),c&&mi(o,c)},n.render=function(){var o=this.props;o.classNames;var i=ei(o,["classNames"]);return g.createElement(rS,T({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e}(g.Component);vi.defaultProps={classNames:""},vi.propTypes={};var iS=vi;const aS=(t,e)=>e.filter(n=>(n.label?n.label:n).toLowerCase().startsWith(t.toLowerCase())),sS=(t,e)=>e(t);var uS=t=>{const e=$e(),[n,r]=Ve(t.initialValue||""),[o,i]=Ve([]),[a,s]=Ve(null);tt(()=>{t.focus&&e.current.querySelector("input").focus({preventScroll:!0})},[]),tt(()=>{t.onChange&&t.onChange(n)},[n]);const u=d=>{if(typeof t.vocabulary=="function"){const p=sS(d,t.vocabulary);p.then?p.then(i):i(p)}else{const p=aS(d,t.vocabulary);i(p)}},c=()=>{if(a!==null)t.onSubmit(o[a]);else{const d=n.trim();if(d){const p=Array.isArray(t.vocabulary)?t.vocabulary.find(m=>(m.label||m).toLowerCase()===d.toLowerCase()):null;p?t.onSubmit(p):t.onSubmit(d)}}r(""),i([]),s(null)},l=d=>{if(d.which===13)c();else if(d.which===27)t.onCancel&&t.onCancel();else if(o.length>0){if(d.which===38)if(a===null)s(0);else{const p=Math.max(0,a-1);s(p)}else if(d.which===40)if(a===null)s(0);else{const p=Math.min(o.length-1,a+1);s(p)}}else d.which===40&&Array.isArray(t.vocabulary)&&i(t.vocabulary)},f=d=>{const{value:p}=d.target;r(p),s(null),p?u(p):i([])};return g.createElement("div",{ref:e,className:"r6o-autocomplete"},g.createElement("div",null,g.createElement("input",{onKeyDown:l,onChange:f,value:n,placeholder:t.placeholder})),g.createElement("ul",null,o.length>0&&o.map((d,p)=>g.createElement("li",{key:`${d.label?d.label:d}${p}`,onClick:c,onMouseEnter:()=>s(p),style:a===p?{backgroundColor:"#bde4ff"}:{}},d.label?d.label:d))))};const lS=t=>t||{type:"TextualBody",value:"",purpose:"tagging",draft:!0};var Pc=t=>{const e=t.annotation?t.annotation.bodies.filter(f=>f.purpose==="tagging"):[],n=lS(e.slice().reverse().find(f=>f.draft)),r=e.filter(f=>f!=n),[o,i]=Ve(!1),a=f=>d=>{i(o===f?!1:f)},s=f=>{const d=n.value.trim(),p=f.trim();d.length===0&&p.length>0?t.onAppendBody({...n,value:p}):d.length>0&&p.length===0?t.onRemoveBody(n):d!==p&&t.onUpdateBody(n,{...n,value:p})},u=f=>d=>{d.stopPropagation(),t.onRemoveBody(f)},c=f=>{const d=f.uri?{type:"SpecificResource",purpose:"tagging",source:{id:f.uri,label:f.label}}:{type:"TextualBody",purpose:"tagging",value:f.label||f};n.value.trim().length===0?t.onAppendBody(d):t.onUpdateBody(n,d)},l=f=>f.value||f.source.label;return g.createElement("div",{className:"r6o-widget r6o-tag"},r.length>0&&g.createElement("ul",{className:"r6o-taglist"},r.map(f=>g.createElement("li",{key:l(f),onClick:a(f)},g.createElement("span",{className:"r6o-label"},l(f)),!t.readOnly&&g.createElement(iS,{in:o===f,timeout:200,classNames:"r6o-delete"},g.createElement("span",{className:"r6o-delete-wrapper",onClick:u(f)},g.createElement("span",{className:"r6o-delete"},g.createElement(X1,{width:12}))))))),!t.readOnly&&g.createElement(uS,{focus:t.focus,placeholder:t.textPlaceHolder||Se.t("Add tag..."),vocabulary:t.vocabulary||[],onChange:s,onSubmit:c}))};class Dc extends J{constructor(e){super(e),this.element=g.createRef()}renderWidget(e){const n=this.props.widget({annotation:e.annotation,readOnly:e.readOnly,...e.config,onAppendBody:(r,o)=>e.onAppendBody(r,o),onUpdateBody:(r,o,i)=>e.onUpdateBody(r,o,i),onUpsertBody:(r,o,i)=>e.onUpsertBody(r,o,i),onRemoveBody:(r,o)=>e.onRemoveBody(r,o),onBatchModify:(r,o)=>e.onBatchModify(r,o),onSetProperty:(r,o)=>e.onSetProperty(r,o),onAddContext:r=>e.onAddContext(r),onSaveAndClose:()=>e.onSaveAndClose()});for(;this.element.current.firstChild;)this.element.current.removeChild(this.element.current.lastChild);this.element.current.appendChild(n)}componentDidMount(){this.renderWidget(this.props)}componentWillReceiveProps(e){this.element.current&&this.props.annotation!==e.annotation&&this.renderWidget(e)}render(){return g.createElement("div",{ref:this.element,className:"widget"})}}window.React=g,window.ReactDOM=g;const cS={COMMENT:Ac,TAG:Pc},fS=[g.createElement(Ac,null),g.createElement(Pc,null)],dS=t=>{const e=r=>{var o;return typeof r=="function"&&!!((o=r.prototype)!=null&&o.isReactComponent)},n=r=>typeof r=="function"&&(String(r).match(/return .+\(['|"].+['|"],\s*\{/g)||String(r).match(/return .+preact_compat/)||String(r).match(/return .+\.createElement/g));return e(t)||n(t)},pS=t=>{const e=(n,r,o)=>{if(typeof n=="string"||n instanceof String)return g.createElement(cS[n],r);if((o==null?void 0:o.toLowerCase())==="react")return g.createElement(n,r);if((o==null?void 0:o.toLowerCase())==="plainjs")return g.createElement(Dc,{widget:n,config:r});if(dS(n))return g.createElement(n,r);if(typeof n=="function"||n instanceof Function)return g.createElement(Dc,{widget:n,config:r});throw`${n} is not a valid plugin`};if(t.widget){const{widget:n,force:r,...o}=t;return e(n,o,r)}else return e(t)},Tc=14;var Mc=(t,e,n,r)=>{const o=t.getBoundingClientRect();e.className="r6o-editor r6o-arrow-top r6o-arrow-left";const{left:i,top:a,right:s,bottom:u}=n.getBoundingClientRect();if(e.style.top=`${u-o.top+Tc}px`,e.style.left=`${i-o.left}px`,r){const c=e.children[1].getBoundingClientRect(),{innerWidth:l,innerHeight:f}=t.ownerDocument.defaultView;if(c.right>l&&(e.classList.remove("r6o-arrow-left"),e.classList.add("r6o-arrow-right"),e.style.left=`${s-c.width-o.left}px`),c.bottom>f){e.classList.remove("r6o-arrow-top"),e.classList.add("r6o-arrow-bottom");const p=e.children[1].getBoundingClientRect().height;e.style.top=`${a-o.top-p-Tc}px`}const d=e.children[1].getBoundingClientRect();if(d.top<0){e.classList.add("pushed","down"),e.style.top=`${-o.top}px`;const p=u-o.top;d.height-o.top>p&&e.classList.remove("r6o-arrow-bottom")}d.left<0&&(e.classList.add("pushed","right"),e.style.left=`${-o.left}px`),requestAnimationFrame(()=>e.style.opacity=1)}};const kc=t=>{const{top:e,left:n,width:r,height:o}=t.getBoundingClientRect();return`${e}, ${n}, ${r}, ${o}`};class hS extends J{constructor(n){super(n);h(this,"initResizeObserver",()=>{const n=this.props.autoPosition===void 0?!0:this.props.autoPosition;if(window!=null&&window.ResizeObserver){const r=new ResizeObserver(()=>{this.state.dragged||Mc(this.props.wrapperEl,this.element.current,this.props.selectedElement,n)});return r.observe(this.props.wrapperEl),()=>r.disconnect()}else this.state.dragged||Mc(this.props.wrapperEl,this.element.current,this.props.selectedElement,n)});h(this,"creationMeta",n=>{const r={},{user:o}=this.props.env;return o&&(r.creator={},o.id&&(r.creator.id=o.id),o.displayName&&(r.creator.name=o.displayName),r[n.created?"modified":"created"]=this.props.env.getCurrentTimeAdjusted()),r});h(this,"getCurrentAnnotation",()=>this.state.currentAnnotation.clone());h(this,"hasChanges",()=>{var n;return!((n=this.props.annotation)!=null&&n.isEqual(this.state.currentAnnotation))});h(this,"updateCurrentAnnotation",(n,r)=>{this.setState({currentAnnotation:this.state.currentAnnotation.clone(n)},()=>{r?this.onOk():this.props.onChanged&&this.props.onChanged()})});h(this,"onAppendBody",(n,r)=>this.updateCurrentAnnotation({body:[...this.state.currentAnnotation.bodies,{...n,...this.creationMeta(n)}]},r));h(this,"onUpdateBody",(n,r,o)=>this.updateCurrentAnnotation({body:this.state.currentAnnotation.bodies.map(i=>i===n?{...r,...this.creationMeta(r)}:i)},o));h(this,"onRemoveBody",(n,r)=>this.updateCurrentAnnotation({body:this.state.currentAnnotation.bodies.filter(o=>o!==n)},r));h(this,"onUpsertBody",(n,r,o)=>{if(n==null&&r!=null)this.onAppendBody(r,o);else if(n!=null&&r!=null)this.onUpdateBody(n,r,o);else if(n!=null&&r==null){const i=this.state.currentAnnotation.bodies.find(a=>a.purpose===n.purpose);i?this.onUpdateBody(i,n,o):this.onAppendBody(n,o)}});h(this,"onBatchModify",(n,r)=>{const o=n.filter(c=>c.action==="upsert"&&c.body).map(c=>({previous:this.state.currentAnnotation.bodies.find(l=>l.purpose===c.body.purpose),updated:{...c.body,...this.creationMeta(c.body)}})),i=n.filter(c=>c.action==="remove").map(c=>c.body),a=[...n.filter(c=>c.action==="append"||c.action==="upsert"&&c.updated&&!c.previous).map(c=>({...c.body,...this.creationMeta(c.body)})),...o.filter(c=>!c.previous).map(c=>c.updated)],s=[...n.filter(c=>c.action==="update"||c.action==="upsert"&&c.updated&&c.previous).map(c=>({previous:c.previous,updated:{...c.updated,...this.creationMeta(c.updated)}})),...o.filter(c=>c.previous)],u=[...this.state.currentAnnotation.bodies.filter(c=>!i.includes(c)).map(c=>{const l=s.find(f=>f.previous===c);return l?l.updated:c}),...a];this.updateCurrentAnnotation({body:u},r)});h(this,"onSetProperty",(n,r)=>{if(["@context","id","type","body","target"].includes(n))throw new Exception(`Cannot set ${n} - not allowed`);if(r)this.updateCurrentAnnotation({[n]:r});else{const i=this.currentAnnotation.clone();delete i[n],this.setState({currentAnnotation:i})}});h(this,"onAddContext",n=>{const{currentAnnotation:r}=this.state,o=Array.isArray(r.context)?r.context:[r.context];o.indexOf(n)<0&&(o.push(n),this.updateCurrentAnnotation({"@context":o}))});h(this,"onCancel",()=>this.props.onCancel(this.props.annotation));h(this,"onOk",()=>{const n=o=>o.clone({body:o.bodies.map(({draft:i,...a})=>a)}),{currentAnnotation:r}=this.state;r.bodies.length===0&&!this.props.allowEmpty?r.isSelection?this.onCancel():this.props.onAnnotationDeleted(this.props.annotation):r.isSelection?this.props.onAnnotationCreated(n(r).toAnnotation()):this.props.onAnnotationUpdated(n(r),this.props.annotation)});h(this,"onDelete",()=>this.props.onAnnotationDeleted(this.props.annotation));this.element=g.createRef(),this.state={currentAnnotation:n.annotation,dragged:!1,selectionBounds:kc(n.selectedElement)}}componentWillReceiveProps(n){var i;const{selectionBounds:r}=this.state,o=kc(n.selectedElement);(i=this.props.annotation)!=null&&i.isEqual(n.annotation)?this.setState({selectionBounds:o}):this.setState({currentAnnotation:n.annotation,selectionBounds:o}),this.props.modifiedTarget!=n.modifiedTarget&&this.state.currentAnnotation&&this.updateCurrentAnnotation({target:this.props.modifiedTarget}),r!=o&&this.element.current&&(this.removeObserver&&this.removeObserver(),this.removeObserver=this.initResizeObserver())}componentDidMount(){this.removeObserver=this.initResizeObserver(),new MutationObserver(()=>{this.element.current&&(this.removeObserver&&this.removeObserver(),this.removeObserver=this.initResizeObserver())}).observe(this.element.current,{childList:!0,subtree:!0})}componentWillUnmount(){this.removeObserver&&this.removeObserver()}render(){const{currentAnnotation:n}=this.state,r=this.props.widgets?this.props.widgets.map(pS):fS,o=a=>a.type.disableDelete?a.type.disableDelete(n,{...a.props,readOnly:this.props.readOnly,env:this.props.env}):!1,i=n&&(n.bodies.length>0||this.props.allowEmpty)&&!this.props.readOnly&&!n.isSelection&&!r.some(o);return g.createElement(Md,{disabled:!this.props.detachable,handle:".r6o-draggable",cancel:".r6o-btn, .r6o-btn *",onDrag:()=>this.setState({dragged:!0})},g.createElement("div",{ref:this.element,className:this.state.dragged?"r6o-editor dragged":"r6o-editor"},g.createElement("div",{className:"r6o-arrow"}),g.createElement("div",{className:"r6o-editor-inner"},r.map((a,s)=>g.cloneElement(a,{key:`${s}`,focus:s===0,annotation:n,readOnly:this.props.readOnly,env:this.props.env,onAppendBody:this.onAppendBody,onUpdateBody:this.onUpdateBody,onRemoveBody:this.onRemoveBody,onUpsertBody:this.onUpsertBody,onBatchModify:this.onBatchModify,onSetProperty:this.onSetProperty,onAddContext:this.onAddContext,onSaveAndClose:this.onOk})),this.props.readOnly?g.createElement("div",{className:"r6o-footer"},g.createElement("button",{className:"r6o-btn",onClick:this.onCancel},Se.t("Close"))):g.createElement("div",{className:this.props.detachable?"r6o-footer r6o-draggable":"r6o-footer"},i&&g.createElement("button",{className:"r6o-btn left delete-annotation",title:Se.t("Delete"),onClick:this.onDelete},g.createElement(K1,{width:12})),g.createElement("button",{className:"r6o-btn outline",onClick:this.onCancel},Se.t("Cancel")),g.createElement("button",{className:"r6o-btn ",onClick:this.onOk},Se.t("Ok"))))))}}var Sr,mS=new Uint8Array(16);function vS(){if(!Sr&&(Sr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Sr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Sr(mS)}var gS=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yS(t){return typeof t=="string"&&gS.test(t)}for(var ae=[],gi=0;gi<256;++gi)ae.push((gi+256).toString(16).substr(1));function bS(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ae[t[e+0]]+ae[t[e+1]]+ae[t[e+2]]+ae[t[e+3]]+"-"+ae[t[e+4]]+ae[t[e+5]]+"-"+ae[t[e+6]]+ae[t[e+7]]+"-"+ae[t[e+8]]+ae[t[e+9]]+"-"+ae[t[e+10]]+ae[t[e+11]]+ae[t[e+12]]+ae[t[e+13]]+ae[t[e+14]]+ae[t[e+15]]).toLowerCase();if(!yS(n))throw TypeError("Stringified UUID is invalid");return n}function Fc(t,e,n){t=t||{};var r=t.random||(t.rng||vS)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=r[o];return e}return bS(r)}var SS=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var a=i[o];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n},Ic=SS;const Ar=class{constructor(e,n){h(this,"clone",(e,n)=>new Ar({...this.underlying,...e},{...this.opts,...n}));h(this,"selector",e=>{const{target:n}=this.underlying;if(n.selector)return(Array.isArray(n.selector)?n.selector:[n.selector]).find(o=>o.type===e)});this.underlying=e,this.opts=n}isEqual(e){return(e==null?void 0:e.type)!=="Annotation"?!1:this.underlying===e.underlying?!0:!this.underlying.id||!e.underlying.id?!1:Ic(this.underlying,e.underlying)}get readOnly(){var e;return(e=this.opts)==null?void 0:e.readOnly}get id(){return this.underlying.id}get context(){return this.underlying["@context"]}get type(){return this.underlying.type}get motivation(){return this.underlying.motivation}get body(){return this.underlying.body}get target(){return this.underlying.target}get bodies(){return Array.isArray(this.underlying.body)?this.underlying.body:[this.underlying.body]}set bodies(e){this.underlying.body=e}get targets(){return Array.isArray(this.underlying.target)?this.underlying.target:[this.underlying.target]}get quote(){var e;return(e=this.selector("TextQuoteSelector"))==null?void 0:e.exact}get start(){var e;return(e=this.selector("TextPositionSelector"))==null?void 0:e.start}get end(){var e;return(e=this.selector("TextPositionSelector"))==null?void 0:e.end}};let Je=Ar;h(Je,"create",e=>{const n={"@context":"http://www.w3.org/ns/anno.jsonld",type:"Annotation",id:`#${Fc()}`,body:[]};return new Ar({...n,...e})});class sn{constructor(e,n){h(this,"clone",e=>{const n=new sn;return n.underlying=JSON.parse(JSON.stringify(this.underlying)),e&&(n.underlying={...n.underlying,...e}),n});h(this,"selector",e=>{const{target:n}=this.underlying;if(n.selector)return(Array.isArray(n.selector)?n.selector:[n.selector]).find(o=>o.type===e)});h(this,"toAnnotation",()=>{const e=Object.assign({},this.underlying,{type:"Annotation",id:`#${Fc()}`});return new Je(e)});this.underlying={"@context":"http://www.w3.org/ns/anno.jsonld",type:"Selection",body:n||[],target:e}}get context(){return this.underlying["@context"]}get type(){return this.underlying.type}get body(){return this.underlying.body}get target(){return this.underlying.target}get targets(){return Array.isArray(this.underlying.target)?this.underlying.target:[this.underlying.target]}isEqual(e){return e?Ic(this.underlying,e.underlying):!1}get bodies(){return Array.isArray(this.underlying.body)?this.underlying.body:[this.underlying.body]}get quote(){var e;return(e=this.selector("TextQuoteSelector"))==null?void 0:e.exact}get isSelection(){return!0}}let yi=0;var _S=()=>({setServerTime:t=>{const e=Date.now();yi=t-e},getCurrentTimeAdjusted:()=>new Date(Date.now()+yi).toISOString(),toClientTime:t=>Date.parse(t)-yi});const ES=(t,e)=>{if(t){const n=t==="auto"?window.navigator.userLanguage||window.navigator.language:t,r=n.split("-")[0].toLowerCase(),o=[n,r].find(i=>My.includes(i));o||console.warn(`Unsupported locale '${n}'. Falling back to default en.`),Se.init(o,e)}else Se.init(null,e)};class CS{constructor(e,n,r,o,i){h(this,"dragTo",(e,n)=>{this.group.style.display=null,this.opposite=[e,n];const{x:r,y:o,w:i,h:a}=this.bbox;Ea(this.mask,this.env.image,r,o,i,a),Ca(this.rect,r,o,i,a)});h(this,"getBoundingClientRect",()=>this.rect.getBoundingClientRect());h(this,"toSelection",()=>{const{x:e,y:n,w:r,h:o}=this.bbox;return new sn(zr(e,n,r,o,this.env.image,this.config.fragmentUnit))});h(this,"destroy",()=>{this.group.parentNode.removeChild(this.group),this.mask=null,this.rect=null,this.group=null});this.anchor=[e,n],this.opposite=[e,n],this.config=o,this.env=i,this.group=document.createElementNS(B,"g"),this.mask=_a(i.image,e,n,2,2),this.mask.setAttribute("class","a9s-selection-mask"),this.rect=Wr(e,n,2,2),this.rect.setAttribute("class","a9s-selection"),this.group.style.pointerEvents="none",this.group.style.display="none",this.group.appendChild(this.mask),this.group.appendChild(this.rect),r.appendChild(this.group)}get bbox(){const e=this.opposite[0]-this.anchor[0],n=this.opposite[1]-this.anchor[1];return{x:e>0?this.anchor[0]:this.opposite[0],y:n>0?this.anchor[1]:this.opposite[1],w:Math.max(1,Math.abs(e)),h:Math.max(1,Math.abs(n))}}get element(){return this.rect}}const AS={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"},Rc=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,wS=t=>{let e=null;const n=(o,i)=>new MouseEvent(o,{screenX:i.screenX,screenY:i.screenY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,bubbles:!0}),r=o=>{const i=o.changedTouches[0],a=n(AS[o.type],i);i.target.dispatchEvent(a),o.preventDefault(),(o.type==="touchstart"||o.type==="touchmove")&&(e&&clearTimeout(e),e=setTimeout(()=>{const s=n("dblclick",i);i.target.dispatchEvent(s)},800)),o.type==="touchend"&&e&&clearTimeout(e)};t.addEventListener("touchstart",r,!0),t.addEventListener("touchmove",r,!0),t.addEventListener("touchend",r,!0),t.addEventListener("touchcancel",r,!0)},_r="An implementation is missing",OS=Rc();class Nc extends mn{constructor(n,r,o){super();h(this,"enableResponsive",()=>{window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{const n=this.svg.getBoundingClientRect(),{width:r,height:o}=this.svg.viewBox.baseVal;this.scale=Math.max(r/n.width,o/n.height),this.onScaleChanged&&this.onScaleChanged(this.scale)}),this.resizeObserver.observe(this.svg.parentNode))});h(this,"getSVGPoint",n=>{const r=this.svg.createSVGPoint();if(OS){const o=this.svg.getBoundingClientRect(),i=n.clientX-o.x,a=n.clientY-o.y,{left:s,top:u}=this.svg.getBoundingClientRect();return r.x=i+s,r.y=a+u,r.matrixTransform(this.g.getScreenCTM().inverse())}else return r.x=n.offsetX,r.y=n.offsetY,r.matrixTransform(this.g.getCTM().inverse())});h(this,"drawHandle",(n,r)=>{const o=document.createElementNS(B,"g");o.setAttribute("class","a9s-handle");const i=document.createElementNS(B,"g"),a=l=>{const f=document.createElementNS(B,"circle");return f.setAttribute("cx",n),f.setAttribute("cy",r),f.setAttribute("r",l),f.setAttribute("transform-origin",`${n} ${r}`),f},s=this.config.handleRadius||6,u=a(s);u.setAttribute("class","a9s-handle-inner");const c=a(s+1);return c.setAttribute("class","a9s-handle-outer"),i.appendChild(c),i.appendChild(u),o.appendChild(i),o});h(this,"setHandleXY",(n,r,o)=>{const i=n.querySelector(".a9s-handle-inner");i.setAttribute("cx",r),i.setAttribute("cy",o),i.setAttribute("transform-origin",`${r} ${o}`);const a=n.querySelector(".a9s-handle-outer");a.setAttribute("cx",r),a.setAttribute("cy",o),a.setAttribute("transform-origin",`${r} ${o}`)});h(this,"getHandleXY",n=>{const r=n.querySelector(".a9s-handle-outer");return{x:parseFloat(r.getAttribute("cx")),y:parseFloat(r.getAttribute("cy"))}});h(this,"scaleHandle",n=>{const r=n.querySelector(".a9s-handle-inner"),o=n.querySelector(".a9s-handle-outer"),i=this.scale*(this.config.handleRadius||6);r.setAttribute("r",i),o.setAttribute("r",i)});this.svg=n.closest("svg"),this.g=n,this.config=r,this.env=o,this.scale=1;const{image:i}=o;(i instanceof Element||i instanceof HTMLDocument)&&this.enableResponsive()}destroy(){this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeObserver=null}}class bi extends Nc{constructor(n,r,o){super(n,r,o);h(this,"attachListeners",({mouseMove:n,mouseUp:r,mouseDown:o,dblClick:i})=>{n&&(this.mouseMove=a=>{const{x:s,y:u}=this.getSVGPoint(a);this.started||(this.emit("startSelection",{x:s,y:u}),this.started=!0),n(s,u,a)},this.svg.addEventListener("mousemove",this.mouseMove)),r&&(this.mouseUp=a=>{if(a.button!==0)return;const{x:s,y:u}=this.getSVGPoint(a);r(s,u,a)},document.addEventListener("mouseup",this.mouseUp)),o&&(this.mouseDown=a=>{if(a.button!==0)return;const{x:s,y:u}=this.getSVGPoint(a);o(s,u,a)},document.addEventListener("mousedown",this.mouseDown)),i&&(this.dblClick=a=>{const{x:s,y:u}=this.getSVGPoint(a);i(s,u,a)},document.addEventListener("dblclick",this.dblClick))});h(this,"detachListeners",()=>{this.mouseMove&&this.svg.removeEventListener("mousemove",this.mouseMove),this.mouseUp&&document.removeEventListener("mouseup",this.mouseUp),this.mouseDown&&document.removeEventListener("mousedown",this.mouseDown),this.dblClick&&document.removeEventListener("dblclick",this.dblClick)});h(this,"start",(n,r)=>{const{x:o,y:i}=this.getSVGPoint(n),{naturalWidth:a,naturalHeight:s}=this.env.image,u=o<0?0:o>a?a:o,c=i<0?0:i>s?s:i;this.startDrawing(u,c,r,n)});h(this,"startDrawing",n=>{throw new Error(_r)});h(this,"createEditableShape",(n,r)=>{throw new Error(_r)});this.started=!1}get isDrawing(){throw new Error(_r)}}bi.supports=t=>{throw new Error(_r)};const Lc="An implementation is missing";class Bc extends Nc{constructor(n,r,o,i){super(r,o,i);h(this,"updateState",n=>{throw new Error(Lc)});this.annotation=n}get element(){throw new Error(Lc)}}const $S=/firefox/i.test(navigator.userAgent),Vc=(t,e,n,r,o)=>{t.setAttribute("width",r),t.setAttribute("height",o),$S?(t.setAttribute("x",0),t.setAttribute("y",0),t.setAttribute("transform",`translate(${e}, ${n})`)):(t.setAttribute("x",e),t.setAttribute("y",n))},xS=(t,e)=>{const r=e.querySelector(".a9s-inner")||e,{x:o,y:i,width:a,height:s}=r.getBBox(),u=document.createElementNS(B,"svg");u.setAttribute("class","a9s-formatter-el"),Vc(u,o,i,a,s);const c=document.createElementNS(B,"g");c.appendChild(t),u.appendChild(c),e.append(u)},Si=(t,e,n)=>{if(!n)return t;const r=n.reduce((u,c)=>{const l=c(e);if(!l)return u;if(typeof l=="string"||l instanceof String)u.className=u.className?`${u.className} ${l}`:l;else if(l.nodeType===Node.ELEMENT_NODE)u.elements=u.elements?[...u.elements,l]:[l];else{const{className:f,style:d,shapeStyle:p,element:m}=l;f&&(u.className=u.className?`${u.className} ${f}`:f),d&&(u.style=u.style?`${u.style} ${d}`:d),p&&(u.shapeStyle=u.shapeStyle?`${u.shapeStyle} ${p}`:p),m&&(u.elements=u.elements?[...u.elements,m]:[m])}for(const f in l)l.hasOwnProperty(f)&&f.startsWith("data-")&&(u[f]=l[f]);return u},{}),{className:o,style:i,shapeStyle:a,elements:s}=r;if(o&&gt(t,o),i){const u=t.querySelector(".a9s-outer"),c=t.querySelector(".a9s-inner");u&&c?(u.setAttribute("style","display:none"),c.setAttribute("style",i)):t.setAttribute("style",i)}a&&t.setAttribute("style",a),s&&s.forEach(u=>xS(u,t));for(const u in r)r.hasOwnProperty(u)&&u.startsWith("data-")&&t.setAttribute(u,r[u])},Hc=(t,e,n,r,o)=>{const i=t.querySelector(".a9s-formatter-el");i&&Vc(i,e,n,r,o)},un="corner",Er="edge";class PS extends Bc{constructor(n,r,o,i){super(n,r,o,i);h(this,"onScaleChanged",()=>this.handles.map(this.scaleHandle));h(this,"setSize",(n,r,o,i)=>{Ca(this.rectangle,n,r,o,i),Ea(this.mask,this.env.image,n,r,o,i),Hc(this.elementGroup,n,r,o,i);const[a,s,u,c,l,f,d,p]=this.handles;this.setHandleXY(a,n,r),this.setHandleXY(s,n+o,r),this.setHandleXY(u,n+o,r+i),this.setHandleXY(c,n,r+i),this.enableEdgeControls&&(this.setHandleXY(l,n+o/2,r),this.setHandleXY(f,n+o,r+i/2),this.setHandleXY(d,n+o/2,r+i),this.setHandleXY(p,n,r+i/2))});h(this,"stretchCorners",(n,r,o)=>{const i=this.getHandleXY(r),a=o.x-i.x,s=o.y-i.y,u=a>0?i.x:o.x,c=s>0?i.y:o.y,l=Math.abs(a),f=Math.abs(s);return this.setSize(u,c,l,f),{x:u,y:c,w:l,h:f}});h(this,"stretchEdge",(n,r,o)=>{const i=this.getHandleXY(r),a=Gr(this.rectangle),s=n%2===0,u=s?a.w:o.x-i.x,c=s?o.y-i.y:a.h,l=s?a.x:u>0?i.x:o.x,f=s?c>0?i.y:o.y:a.y,d=Math.abs(u),p=Math.abs(c);return this.setSize(l,f,d,p),{x:l,y:f,w:d,h:p}});h(this,"onGrab",(n,r)=>o=>{if(o.button!==0)return;this.grabbedElem=n,this.grabbedType=r;const i=this.getSVGPoint(o),{x:a,y:s}=Gr(this.rectangle);this.mouseOffset={x:i.x-a,y:i.y-s}});h(this,"onMouseMove",n=>{if(n.button!==0)return;const r=(a,s)=>a<0?0:a>s?s:a,{naturalWidth:o,naturalHeight:i}=this.env.image;if(this.grabbedElem){const a=this.getSVGPoint(n);if(this.grabbedElem===this.rectangle){const{w:s,h:u}=Gr(this.rectangle),c=r(a.x-this.mouseOffset.x,o-s),l=r(a.y-this.mouseOffset.y,i-u);this.setSize(c,l,s,u),this.emit("update",zr(c,l,s,u,this.env.image,this.config.fragmentUnit))}else{const s=this.handles.indexOf(this.grabbedElem),u=this.handles[s^2],c={x:Math.min(Math.max(a.x,0),o),y:Math.min(Math.max(a.y,0),i)},{x:l,y:f,w:d,h:p}=this.grabbedType===un?this.stretchCorners(s,u,c):this.stretchEdge(s,u,c);this.emit("update",zr(l,f,d,p,this.env.image,this.config.fragmentUnit))}}});h(this,"onMouseUp",n=>{this.grabbedElem=null,this.grabbedType=null,this.mouseOffset=null});h(this,"updateState",n=>{const{x:r,y:o,w:i,h:a}=vn(n,this.env.image);this.setSize(r,o,i,a)});h(this,"detachListeners",()=>{this.svg.removeEventListener("mousemove",this.onMouseMove),this.svg.removeEventListener("mouseup",this.onMouseUp)});this.svg.addEventListener("mousemove",this.onMouseMove),this.svg.addEventListener("mouseup",this.onMouseUp);const{x:a,y:s,w:u,h:c}=vn(n,i.image);this.containerGroup=document.createElementNS(B,"g"),this.mask=_a(i.image,a,s,u,c),this.mask.setAttribute("class","a9s-selection-mask"),this.containerGroup.appendChild(this.mask),this.elementGroup=document.createElementNS(B,"g"),this.elementGroup.setAttribute("class","a9s-annotation editable selected"),this.elementGroup.setAttribute("data-id",n.id),this.rectangle=Wr(a,s,u,c),this.rectangle.querySelector(".a9s-inner").addEventListener("mousedown",this.onGrab(this.rectangle)),this.elementGroup.appendChild(this.rectangle),this.enableEdgeControls=o.enableEdgeControls;const l=this.enableEdgeControls?[[a+u/2,s,Er],[a+u,s+c/2,Er],[a+u/2,s+c,Er],[a,s+c/2,Er]]:[];this.handles=[[a,s,un],[a+u,s,un],[a+u,s+c,un],[a,s+c,un],...l].map(f=>{const[d,p,m]=f,b=this.drawHandle(d,p);return b.addEventListener("mousedown",this.onGrab(b,m)),this.elementGroup.appendChild(b),b}),this.containerGroup.appendChild(this.elementGroup),r.appendChild(this.containerGroup),Si(this.elementGroup,n,o.formatters),this.grabbedElem=null,this.grabbedType=null,this.mouseOffset=null}get element(){return this.elementGroup}destroy(){this.detachListeners(),this.containerGroup.parentNode.removeChild(this.containerGroup),super.destroy()}}class Cr extends bi{constructor(n,r,o){super(n,r,o);h(this,"startDrawing",(n,r)=>{this.attachListeners({mouseMove:this.onMouseMove,mouseUp:this.onMouseUp}),this.rubberband=new CS(n,r,this.g,this.config,this.env)});h(this,"stop",()=>{this.detachListeners(),this.rubberband&&(this.rubberband.destroy(),this.rubberband=null)});h(this,"onMouseMove",(n,r)=>{const{naturalWidth:o,naturalHeight:i}=this.env.image,a=Math.min(Math.max(n,0),o),s=Math.min(Math.max(r,0),i);this.rubberband.dragTo(a,s)});h(this,"onMouseUp",()=>{this.started=!1;const{width:n,height:r}=this.rubberband.getBoundingClientRect(),o=this.config.minSelectionWidth||4,i=this.config.minSelectionHeight||4;if(n>=o&&r>=i){const{element:a}=this.rubberband;a.annotation=this.rubberband.toSelection(),this.emit("complete",a)}else this.emit("cancel");this.stop()});h(this,"createEditableShape",(n,r)=>new PS(n,this.g,{...this.config,formatters:r},this.env));this.rubberband=null}get isDrawing(){return this.rubberband!=null}}Cr.identifier="rect",Cr.supports=t=>{const e=t.selector("FragmentSelector");return e==null?void 0:e.conformsTo.startsWith("http://www.w3.org/TR/media-frags")};class Uc{constructor(e,n){h(this,"redraw",()=>{this.mask.setAttribute("d",`M0 0 h${this.w} v${this.h} h-${this.w} z M${this.polygon.getAttribute("points")} z`)});h(this,"destroy",()=>this.mask.parentNode.removeChild(this.mask));this.w=e.naturalWidth,this.h=e.naturalHeight,this.polygon=n,this.mask=document.createElementNS(B,"path"),this.mask.setAttribute("fill-rule","evenodd"),this.mask.setAttribute("class","a9s-selection-mask"),this.mask.setAttribute("d",`M0 0 h${this.w} v${this.h} h-${this.w} z M${this.polygon.getAttribute("points")} z`)}get element(){return this.mask}}class DS{constructor(e,n,r){h(this,"setPoints",e=>{const n=e.map(r=>`${r[0]},${r[1]}`).join(" ");this.outer.setAttribute("points",n),this.inner.setAttribute("points",n)});h(this,"getBoundingClientRect",()=>this.outer.getBoundingClientRect());h(this,"dragTo",e=>{this.group.style.display=null,this.mousepos=e;const n=[...this.points,e];this.setPoints(n),this.mask.redraw()});h(this,"addPoint",()=>{const[e,n]=this.mousepos,r=this.points[this.points.length-1];Math.pow(e-r[0],2)+Math.pow(n-r[1],2)>4&&(this.points=[...this.points,this.mousepos],this.setPoints(this.points),this.mask.redraw())});h(this,"destroy",()=>{this.group.parentNode.removeChild(this.group),this.polygon=null,this.group=null});h(this,"toSelection",()=>new sn(Yr(this.group,this.env.image)));this.points=[e],this.env=r,this.mousepos=e,this.group=document.createElementNS(B,"g"),this.polygon=document.createElementNS(B,"g"),this.polygon.setAttribute("class","a9s-selection"),this.outer=document.createElementNS(B,"polygon"),this.outer.setAttribute("class","a9s-outer"),this.inner=document.createElementNS(B,"polygon"),this.inner.setAttribute("class","a9s-inner"),this.setPoints(this.points),this.mask=new Uc(r.image,this.inner),this.polygon.appendChild(this.outer),this.polygon.appendChild(this.inner),this.group.style.display="none",this.group.appendChild(this.mask.element),this.group.appendChild(this.polygon),n.appendChild(this.group)}get element(){return this.polygon}}const _i=t=>{const e=t.querySelector(".a9s-inner").points,n=[];for(let r=0;r<e.numberOfItems;r++)n.push(e.getItem(r));return n},TS=t=>t.querySelector(".a9s-inner").getBBox();class MS extends Bc{constructor(n,r,o,i){super(n,r,o,i);h(this,"onScaleChanged",()=>this.handles.map(this.scaleHandle));h(this,"setPoints",n=>{const r=f=>Math.round(10*f)/10,o=n.map(f=>`${r(f.x)},${r(f.y)}`).join(" "),i=this.shape.querySelector(".a9s-inner");i.setAttribute("points",o),this.shape.querySelector(".a9s-outer").setAttribute("points",o),this.mask.redraw();const{x:s,y:u,width:c,height:l}=i.getBBox();Hc(this.elementGroup,s,u,c,l)});h(this,"onGrab",n=>r=>{r.button===0&&(this.grabbedElem=n,this.grabbedAt=this.getSVGPoint(r))});h(this,"onMouseMove",n=>{const r=(o,i,a)=>o+i<0?-o:o+i>a?a-o:i;if(this.grabbedElem){const o=this.getSVGPoint(n),{naturalWidth:i,naturalHeight:a}=this.env.image;if(this.grabbedElem===this.shape){const{x:s,y:u,width:c,height:l}=TS(this.shape),f=r(s,o.x-this.grabbedAt.x,i-c),d=r(u,o.y-this.grabbedAt.y,a-l),p=_i(this.shape).map(m=>({x:m.x+f,y:m.y+d}));this.grabbedAt=o,this.setPoints(p),p.forEach((m,b)=>this.setHandleXY(this.handles[b],m.x,m.y)),this.emit("update",Yr(this.shape,this.env.image))}else{const s=this.handles.indexOf(this.grabbedElem),u={x:Math.min(Math.max(o.x,0),i),y:Math.min(Math.max(o.y,0),a)},c=_i(this.shape).map((l,f)=>f===s?u:l);this.setPoints(c),this.setHandleXY(this.handles[s],u.x,u.y),this.emit("update",Yr(this.shape,this.env.image))}}});h(this,"onMouseUp",n=>{this.grabbedElem=null,this.grabbedAt=null});h(this,"updateState",n=>{const r=qr(n).getAttribute("points").split(" ").map(o=>{const[i,a]=o.split(",").map(s=>parseFloat(s.trim()));return{x:i,y:a}});this.setPoints(r),r.forEach((o,i)=>this.setHandleXY(this.handles[i],o.x,o.y))});h(this,"detachListeners",()=>{this.svg.removeEventListener("mousemove",this.onMouseMove),this.svg.removeEventListener("mouseup",this.onMouseUp)});h(this,"destroy",()=>{this.detachListeners(),this.containerGroup.parentNode.removeChild(this.containerGroup),super.destroy()});this.svg.addEventListener("mousemove",this.onMouseMove),this.svg.addEventListener("mouseup",this.onMouseUp),this.containerGroup=document.createElementNS(B,"g"),this.shape=wa(n),this.shape.querySelector(".a9s-inner").addEventListener("mousedown",this.onGrab(this.shape)),this.mask=new Uc(i.image,this.shape.querySelector(".a9s-inner")),this.containerGroup.appendChild(this.mask.element),this.elementGroup=document.createElementNS(B,"g"),this.elementGroup.setAttribute("class","a9s-annotation editable selected"),this.elementGroup.setAttribute("data-id",n.id),this.elementGroup.appendChild(this.shape),this.handles=_i(this.shape).map(a=>{const s=this.drawHandle(a.x,a.y);return s.addEventListener("mousedown",this.onGrab(s)),this.elementGroup.appendChild(s),s}),this.containerGroup.appendChild(this.elementGroup),r.appendChild(this.containerGroup),Si(this.elementGroup,n,o.formatters),this.grabbedElem=null,this.grabbedAt=null}get element(){return this.elementGroup}}class Ei extends bi{constructor(n,r,o){super(n,r,o);h(this,"startDrawing",(n,r,o)=>{this._isDrawing=!0,this._startOnSingleClick=o,this.attachListeners({mouseMove:this.onMouseMove,[this.config.addPolygonPointOnMouseDown&&o?"mouseDown":"mouseUp"]:this.onMouseUpDown,dblClick:this.onDblClick}),this.rubberband=new DS([n,r],this.g,this.env)});h(this,"stop",()=>{this.detachListeners(),this._isDrawing=!1,this.rubberband&&(this.rubberband.destroy(),this.rubberband=null)});h(this,"onMouseMove",(n,r)=>{const{naturalWidth:o,naturalHeight:i}=this.env.image,a=Math.min(Math.max(n,0),o),s=Math.min(Math.max(r,0),i);this.rubberband.dragTo([a,s])});h(this,"onMouseUp",()=>{const{width:n,height:r}=this.rubberband.getBoundingClientRect(),o=this.config.minSelectionWidth||4,i=this.config.minSelectionHeight||4;n>=o||r>=i?this.rubberband.addPoint():this._startOnSingleClick||(this.emit("cancel"),this.stop())});h(this,"onMouseUpDown",()=>{this.onMouseUp()});h(this,"onDblClick",()=>{if(this.rubberband.points.length<(this.config.minPolygonPoints||0))return;this._isDrawing=!1;const n=this.rubberband.element;n.annotation=this.rubberband.toSelection(),this.emit("complete",n),this.stop()});h(this,"createEditableShape",(n,r)=>new MS(n,this.g,{...this.config,formatters:r},this.env));this._isDrawing=!1,this._startOnSingleClick=!1}get isDrawing(){return this._isDrawing}}Ei.identifier="polygon",Ei.supports=t=>{var n;const e=t.selector("SvgSelector");if(e)return(n=e.value)==null?void 0:n.match(/^<svg.*<polygon/g)};class kS extends mn{constructor(n,r,o){super();h(this,"listTools",()=>this._registered.map(n=>n.identifier));h(this,"registerTool",n=>{const r=n.identifier;this.listTools().includes(r)&&this.unregisterTool(r),this._registered.unshift(n)});h(this,"unregisterTool",n=>this._registered=this._registered.filter(r=>r.identifier!==n));h(this,"setCurrent",n=>{this._current&&this._current.destroy();const r=typeof n=="string"||n instanceof String?this._registered.find(o=>o.identifier===n):n;this._current=new r(this._g,this._config,this._env),this._current.on("startSelection",o=>this.emit("startSelection",o)),this._current.on("complete",o=>this.emit("complete",o)),this._current.on("cancel",o=>this.emit("cancel",o))});h(this,"forAnnotation",n=>{var s;const[r,...o]=n.targets,i=(s=r.renderedVia)==null?void 0:s.name,a=i?this._registered.find(u=>u.identifier===i):this._registered.find(u=>u.supports(n));return a?new a(this._g,this._config,this._env):null});this._g=n,this._config=r,this._env=o,this._registered=[Cr,Ei],this.setCurrent(Cr)}get current(){return this._current}}class FS{constructor(e,n,r){this.svg=e.closest("svg"),this.g=document.createElementNS(B,"g"),this.g.setAttribute("class","a9s-crosshair");const o=document.createElementNS(B,"line"),i=document.createElementNS(B,"line");this.g.appendChild(o),this.g.appendChild(i),e.appendChild(this.g);const a=s=>{const u=this.svg.getBoundingClientRect(),c=s.clientX-u.x,l=s.clientY-u.y,f=this.svg.createSVGPoint(),{left:d,top:p}=this.svg.getBoundingClientRect();return f.x=c+d,f.y=l+p,f.matrixTransform(e.getScreenCTM().inverse())};this.svg.parentElement.addEventListener("pointermove",s=>{const{x:u,y:c}=a(s);o.setAttribute("x1",0),o.setAttribute("y1",c),o.setAttribute("x2",n),o.setAttribute("y2",c),i.setAttribute("x1",u),i.setAttribute("y1",0),i.setAttribute("x2",u),i.setAttribute("y2",r)})}}const jc=(t,e)=>{const r=(Sa(e,".a9s-annotation")?e:e.closest(".a9s-annotation")).querySelector(".a9s-outer"),o=t.naturalWidth/t.width,i=t.naturalHeight/t.height,a=t.getBoundingClientRect(),s=r.getBoundingClientRect(),u=s.x-a.x,c=s.y-a.y,{width:l,height:f}=s,d=document.createElement("CANVAS"),p=d.getContext("2d");return d.width=l*o,d.height=f*i,p.drawImage(t,u*o,c*i,l*o,f*i,0,0,l*o,f*i),{snippet:d,transform:m=>{const b=u*o+m[0],v=c*i+m[1];return[b,v]}}},zc=Rc();class IS extends mn{constructor(n){super();h(this,"_attachMouseListeners",(n,r)=>{n.addEventListener("mouseenter",()=>{var o,i;(i=(o=this.tools)==null?void 0:o.current)!=null&&i.isDrawing||(this.currentHover!==n&&this.emit("mouseEnterAnnotation",r,n),this.currentHover=n)}),n.addEventListener("mouseleave",()=>{var o,i;(i=(o=this.tools)==null?void 0:o.current)!=null&&i.isDrawing||(this.emit("mouseLeaveAnnotation",r,n),this.currentHover=null)}),zc&&(n.addEventListener("touchstart",o=>{o.stopPropagation(),this.currentHover=n}),n.addEventListener("touchend",o=>{const{clientX:i,clientY:a}=o.changedTouches[0],s=document.elementFromPoint(i,a);o.stopPropagation(),n.contains(s)&&(this.currentHover=n,this.selectCurrentHover())}))});h(this,"_lazy",n=>{this.imageEl.naturalWidth?n():this.imageEl.addEventListener("load",()=>n())});h(this,"_onMouseDown",n=>{var r,o;n.button===0&&(this.readOnly||(this.allowDrawingWithSelection?this.selectedShape&&this.selectedShape.element===this.currentHover:this.selectedShape)||this.tools.current.isDrawing?!((o=(r=this.tools)==null?void 0:r.current)!=null&&o.isDrawing)&&this.selectedShape!==this.currentHover&&this.selectCurrentHover():this.tools.current.start(n,this.drawOnSingleClick&&!this.currentHover))});h(this,"_refreshNonScalingAnnotations",()=>{const n=this.getCurrentScale();n!==1/0&&Array.from(this.svg.querySelectorAll(".a9s-non-scaling")).forEach(r=>{r.setAttribute("transform",`scale(${n})`)})});h(this,"_scaleFormatterElements",n=>{const r=this.getCurrentScale();if(r!==1/0)if(n){const o=n.querySelector(".a9s-formatter-el");o&&o.firstChild.setAttribute("transform",`scale(${r})`)}else Array.from(this.g.querySelectorAll(".a9s-formatter-el")).forEach(i=>i.firstChild.setAttribute("transform",`scale(${r})`))});h(this,"addAnnotation",n=>{const r=Mf(n,this.imageEl);return gt(r,"a9s-annotation"),r.setAttribute("data-id",n.id),r.annotation=n,this._attachMouseListeners(r,n),this.g.appendChild(r),Si(r,n,this.formatters),this._scaleFormatterElements(r),r});h(this,"addDrawingTool",n=>{var r;return(r=this.tools)==null?void 0:r.registerTool(n)});h(this,"addOrUpdateAnnotation",(n,r)=>{this.selectedShape&&(this.selectedShape.annotation.isEqual(n)||this.selectedShape.annotation.isEqual(r))&&(this.deselect(),this.emit("select",{})),r&&this.removeAnnotation(r),this.removeAnnotation(n);const o=this.addAnnotation(n);Sa(o,"a9s-non-scaling")&&o.setAttribute("transform",`scale(${this.getCurrentScale()})`),this.redraw()});h(this,"deselect",n=>{var r;if(this.selectedShape){(r=this.tools)==null||r.current.stop();const{annotation:o}=this.selectedShape;this.selectedShape.destroy?(this.selectedShape.destroy(),this.selectedShape=null,o.isSelection||(this.addAnnotation(o),n||this.redraw())):(gf(this.selectedShape,"selected"),this.selectedShape=null)}});h(this,"destroy",()=>{this.deselect(),this.currentHover=null,this.svg.parentNode.removeChild(this.svg)});h(this,"findShape",n=>{const r=n!=null&&n.id?n.id:n;return this.g.querySelector(`.a9s-annotation[data-id="${r}"]`)});h(this,"getAnnotations",()=>Array.from(this.g.querySelectorAll(".a9s-annotation")).map(r=>r.annotation));h(this,"getCurrentScale",()=>{const n=this.svg.getBoundingClientRect(),{width:r,height:o}=this.svg.viewBox.baseVal;return Math.max(r/n.width,o/n.height)});h(this,"getSelectedImageSnippet",()=>{if(this.selectedShape){const n=this.selectedShape.element||this.selectedShape;return jc(this.imageEl,n)}});h(this,"init",n=>{this.deselect(),this.currentHover=null,Array.from(this.g.querySelectorAll(".a9s-annotation")).forEach(o=>this.g.removeChild(o)),this._lazy(()=>{n.sort((o,i)=>Sn(i,this.imageEl)-Sn(o,this.imageEl)),n.forEach(this.addAnnotation)}),this._refreshNonScalingAnnotations()});h(this,"listDrawingTools",()=>{var n;return(n=this.tools)==null?void 0:n.listTools()});h(this,"overrideId",(n,r)=>{const o=this.findShape(n);o.setAttribute("data-id",r);const{annotation:i}=o,a=i.clone({id:r});return o.annotation=a,a});h(this,"redraw",()=>{const n=Array.from(this.g.querySelectorAll(".a9s-annotation:not(.selected)")),r=n.map(o=>o.annotation);r.sort((o,i)=>Sn(i,this.imageEl)-Sn(o,this.imageEl)),n.forEach(o=>this.g.removeChild(o)),r.forEach(this.addAnnotation)});h(this,"removeAnnotation",n=>{var i,a,s;const r=n.type?n.id:n;((i=this.selectedShape)==null?void 0:i.annotation.id)===r&&this.deselect();const o=this.findShape(n);o&&(((a=this.selectedShape)==null?void 0:a.annotation)===o.annotation&&this.deselect(),((s=this.currentHover)==null?void 0:s.annotation)===o.annotation&&(this.currentHover=null),o.parentNode.removeChild(o))});h(this,"removeDrawingTool",n=>{var r;return(r=this.tools)==null?void 0:r.unregisterTool(n)});h(this,"selectAnnotation",(n,r)=>{this.selectedShape&&this.deselect();const o=this.findShape(n);if(o){this.selectShape(o,r);const i=this.selectedShape.element?this.selectedShape.element:this.selectedShape;return{annotation:o.annotation,element:i}}else this.deselect()});h(this,"selectCurrentHover",()=>{this.currentHover?this.disableSelect?this.emit("clickAnnotation",this.currentHover.annotation,this.currentHover):this.selectShape(this.currentHover):(this.deselect(),this.emit("select",{skipEvent:!0}))});h(this,"selectShape",(n,r)=>{var a;if(!r&&!n.annotation.isSelection&&this.emit("clickAnnotation",n.annotation,n),((a=this.selectedShape)==null?void 0:a.annotation)===n.annotation)return;this.selectedShape&&this.selectedShape.annotation!==n.annotation&&this.deselect(!0);const{annotation:o}=n;if(this.readOnly||o.readOnly)gt(n,"selected"),this.selectedShape=n,r||this.emit("select",{annotation:o,element:n,skipEvent:r});else{const s=this.tools.forAnnotation(o);s?(n.parentNode.removeChild(n),this.selectedShape=s.createEditableShape(o,this.formatters),this.selectedShape.element.annotation=o,this._scaleFormatterElements(this.selectedShape.element),this.selectedShape.on("update",u=>{this.selectedShape&&this.emit("updateTarget",this.selectedShape.element,u)}),setTimeout(()=>{var u;this.selectedShape!=null&&this._attachMouseListeners(this.selectedShape.element,o),!r&&((u=this.selectedShape)==null?void 0:u.element)&&(this.currentHover=this.selectedShape.element)},1)):this.selectedShape=n,r||this.emit("select",{annotation:o,element:this.selectedShape.element||this.selectedShape})}});h(this,"setDrawingTool",n=>{var r;this.tools&&((r=this.tools.current)==null||r.stop(),this.tools.setCurrent(n))});h(this,"setVisible",n=>{n?this.svg.style.display=null:(this.deselect(),this.svg.style.display="none")});h(this,"stopDrawing",()=>{var n,r;(r=(n=this.tools)==null?void 0:n.current)==null||r.stop()});const{wrapperEl:r,config:o,env:i}=n;this.imageEl=i.image,this.readOnly=o.readOnly,this.allowDrawingWithSelection=o.allowDrawingWithSelection,o.formatter?this.formatters=[o.formatter]:o.formatters&&(this.formatters=Array.isArray(o.formatters)?o.formatters:[o.formatters]),this.disableSelect=o.disableSelect,this.drawOnSingleClick=o.drawOnSingleClick,this.svg=document.createElementNS(B,"svg"),this.svg.setAttribute("tabindex",0),zc?(this.svg.setAttribute("class","a9s-annotationlayer touch"),wS(this.svg),this.svg.addEventListener("touchstart",()=>{this.currentHover=null,this.selectCurrentHover()})):this.svg.setAttribute("class","a9s-annotationlayer");const{naturalWidth:a,naturalHeight:s}=this.imageEl;if(!a&&!s){const{width:u,height:c}=this.imageEl;this.svg.setAttribute("viewBox",`0 0 ${u} ${c}`),this.imageEl.nodeName.toLowerCase()!=="img"&&(this.imageEl.naturalWidth=u,this.imageEl.naturalHeight=c),this.imageEl.addEventListener("load",()=>{this.emit("load",this.imageEl.src),this.svg.setAttribute("viewBox",`0 0 ${this.imageEl.naturalWidth} ${this.imageEl.naturalHeight}`)})}else this.svg.setAttribute("viewBox",`0 0 ${a} ${s}`);this.g=document.createElementNS(B,"g"),this.svg.appendChild(this.g),r.appendChild(this.svg),o.crosshair&&(this.crosshair=new FS(this.g,a,s),o.crosshairWithCursor||gt(this.svg,"no-cursor")),this.selectedShape=null,this.tools=new kS(this.g,o,i),this.tools.on("startSelection",u=>this.emit("startSelection",u)),this.tools.on("cancel",this.selectCurrentHover),this.tools.on("complete",this.selectShape),this.svg.addEventListener("mousedown",this._onMouseDown),this.currentHover=null,window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{this._refreshNonScalingAnnotations(),this._scaleFormatterElements()}),this.resizeObserver.observe(this.svg.parentNode))}}var ZE="",RS=0;function Wc(t,e,n,r,o){var i,a,s={};for(a in e)a=="ref"?i=e[a]:s[a]=e[a];var u={type:t,props:s,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--RS,__source:r,__self:o};if(typeof t=="function"&&(i=t.defaultProps))for(a in i)s[a]===void 0&&(s[a]=i[a]);return $.vnode&&$.vnode(u),u}class NS extends J{constructor(n){super(n);h(this,"clearState",n=>this.setState({selectedAnnotation:null,selectedDOMElement:null,modifiedTarget:null,beforeHeadlessModify:null},n));h(this,"forwardEvent",(n,r)=>{this.annotationLayer.on(n,(o,i)=>{this.props[r](o.clone(),i)})});h(this,"onKeyUp",n=>{if(n.which===27){this.annotationLayer.stopDrawing();const{selectedAnnotation:r}=this.state;r&&(this.cancelSelected(),this.props.onCancelSelected(r))}else if(n.which===46){const{disableDeleteKey:r}=this.props.config;if(!r){const{selectedAnnotation:o}=this.state;o&&(o.isSelection?this.onCancelAnnotation(o):this.onDeleteAnnotation(o))}}});h(this,"handleStartSelect",n=>this.props.onSelectionStarted(n));h(this,"handleSelect",(n,r)=>{this.state.editorDisabled?this.onHeadlessSelect(n,r):this.onNormalSelect(n,r)});h(this,"onNormalSelect",(n,r)=>{const{annotation:o,element:i}=n;if(o){const a=u=>{this.setState({selectedAnnotation:o,selectedDOMElement:i,modifiedTarget:null,beforeHeadlessModify:null},()=>{r||(o.isSelection?this.props.onSelectionCreated(o.clone()):this.props.onAnnotationSelected(o.clone(),i)),u&&u()})},{selectedAnnotation:s}=this.state;s&&!s.isEqual(o)?this.clearState(()=>{this.props.onCancelSelected(s.clone()),a(()=>this.props.onChangeSelected(o.clone(),s.clone()))}):a()}else{const{selectedAnnotation:a}=this.state;a?this.clearState(()=>{this.props.onCancelSelected(a)}):this.clearState()}});h(this,"onHeadlessSelect",(n,r)=>{this.saveSelected().then(()=>{this.onNormalSelect(n,r);const{annotation:o}=n;if(o&&!o.isSelection){const i=this.annotationLayer.selectAnnotation(n.annotation,!0);this.setState({selectedDOMElement:i.element})}})});h(this,"handleUpdateTarget",(n,r)=>{this.setState({selectedDOMElement:n,modifiedTarget:r});const o=JSON.parse(JSON.stringify(r));this.props.onSelectionTargetChanged(o)});h(this,"overrideAnnotationId",n=>r=>{const{id:o}=n;this.state.selectedAnnotation?this.clearState(()=>{this.annotationLayer.overrideId(o,r)}):this.annotationLayer.overrideId(o,r)});h(this,"onCreateOrUpdateAnnotation",(n,r)=>(o,i)=>{let a=o.isSelection?o.toAnnotation():o;a=this.state.modifiedTarget?a.clone({target:this.state.modifiedTarget}):a.clone(),this.clearState(()=>{this.annotationLayer.deselect(),this.annotationLayer.addOrUpdateAnnotation(a,i),i?this.props[n](a,i.clone()):this.props[n](a,this.overrideAnnotationId(a)),r&&r()})});h(this,"onDeleteAnnotation",n=>{this.clearState(),this.annotationLayer.removeAnnotation(n),this.props.onAnnotationDeleted(n)});h(this,"onCancelAnnotation",(n,r)=>{this.annotationLayer.deselect(),this.props.onCancelSelected(n),this.clearState(r)});h(this,"addAnnotation",n=>this.annotationLayer.addOrUpdateAnnotation(n.clone()));h(this,"addDrawingTool",n=>this.annotationLayer.addDrawingTool(n));h(this,"cancelSelected",()=>new Promise(n=>{this.annotationLayer.deselect(),this.state.selectedAnnotation?this.clearState(n):n()}));h(this,"getAnnotationById",n=>{var r;return(r=this.annotationLayer.findShape(n))==null?void 0:r.annotation});h(this,"getAnnotations",()=>this.annotationLayer.getAnnotations().map(n=>n.clone()));h(this,"getImageSnippetById",n=>{const r=this.annotationLayer.findShape(n);if(r)return jc(this.props.env.image,r)});h(this,"getSelected",()=>{var n;if(this.state.selectedAnnotation)return this.state.editorDisabled?this.state.selectedAnnotation:(n=this._editor.current)==null?void 0:n.getCurrentAnnotation()});h(this,"getSelectedImageSnippet",()=>this.annotationLayer.getSelectedImageSnippet());h(this,"getCurrentDrawingTool",()=>{var n;return(n=this.annotationLayer.tools)==null?void 0:n.current});h(this,"getSelectedShape",()=>this.annotationLayer.selectedShape);h(this,"listDrawingTools",()=>this.annotationLayer.listDrawingTools());h(this,"removeAnnotation",n=>{this.annotationLayer.removeAnnotation(n),this.state.selectedAnnotation&&this.setState({selectedAnnotation:null})});h(this,"removeDrawingTool",n=>this.annotationLayer.removeDrawingTool(n));h(this,"saveSelected",()=>new Promise(n=>{const r=this.state.selectedAnnotation;if(r)if(this._editor.current)this._editor.current.onOk(),n();else if(r.isSelection)r.bodies.length>0||this.props.config.allowEmpty?this.onCreateOrUpdateAnnotation("onAnnotationCreated",n)(r):(this.annotationLayer.deselect(),n());else{const{beforeHeadlessModify:o,modifiedTarget:i}=this.state;o?this.onCreateOrUpdateAnnotation("onAnnotationUpdated",n)(r,o):i?this.onCreateOrUpdateAnnotation("onAnnotationUpdated",n)(r,r):this.onCancelAnnotation(r,n)}else n()}));h(this,"selectAnnotation",n=>{const r=this.annotationLayer.selectAnnotation(n,!0);if(r)return this.handleSelect(r,!0),r.annotation.clone();this.clearState()});h(this,"setAnnotations",n=>this.annotationLayer.init(n.map(r=>r.clone())));h(this,"setDrawingTool",n=>this.annotationLayer.setDrawingTool(n));h(this,"setVisible",n=>{this.annotationLayer.setVisible(n),n||this.clearState()});h(this,"updateSelected",(n,r)=>new Promise(o=>{this.state.selectedAnnotation&&(r?this.state.selectedAnnotation.isSelection?this.onCreateOrUpdateAnnotation("onAnnotationCreated",o)(n):this.onCreateOrUpdateAnnotation("onAnnotationUpdated",o)(n,this.state.selectedAnnotation):this.setState({selectedAnnotation:n,beforeHeadlessModify:this.state.beforeHeadlessModify||this.state.selectedAnnotation},o))}));this.state={selectedAnnotation:null,selectedDOMElement:null,modifiedTarget:null,readOnly:this.props.config.readOnly,editorDisabled:this.props.config.disableEditor,widgets:this.props.config.widgets,beforeHeadlessModify:null},this._editor=g.createRef()}componentDidMount(){this.annotationLayer=new IS(this.props),this.annotationLayer.on("load",this.props.onLoad),this.annotationLayer.on("startSelection",this.handleStartSelect),this.annotationLayer.on("select",this.handleSelect),this.annotationLayer.on("updateTarget",this.handleUpdateTarget),this.forwardEvent("clickAnnotation","onClickAnnotation"),this.forwardEvent("mouseEnterAnnotation","onMouseEnterAnnotation"),this.forwardEvent("mouseLeaveAnnotation","onMouseLeaveAnnotation"),document.addEventListener("keyup",this.onKeyUp)}componentWillUnmount(){this.annotationLayer.destroy(),document.removeEventListener("keyup",this.onKeyUp)}get disableEditor(){return this.state.editorDisabled}set disableEditor(n){this.setState({editorDisabled:n})}get disableSelect(){return this.annotationLayer.disableSelect}set disableSelect(n){this.annotationLayer.disableSelect=n}get formatters(){return this.annotationLayer.formatters}set formatters(n){this.annotationLayer.formatters=n,this.annotationLayer.redraw()}get readOnly(){return this.state.readOnly}set readOnly(n){this.annotationLayer.readOnly=n,this.setState({readOnly:n})}get widgets(){return this.state.widgets}set widgets(n){this.setState({widgets:n})}render(){var o;const n=this.state.selectedAnnotation&&!this.state.editorDisabled,r=this.state.readOnly||((o=this.state.selectedAnnotation)==null?void 0:o.readOnly);return n&&Wc(hS,{ref:this._editor,detachable:!0,wrapperEl:this.props.wrapperEl,annotation:this.state.selectedAnnotation,modifiedTarget:this.state.modifiedTarget,selectedElement:this.state.selectedDOMElement,readOnly:r,allowEmpty:this.props.config.allowEmpty,widgets:this.state.widgets,env:this.props.env,onAnnotationCreated:this.onCreateOrUpdateAnnotation("onAnnotationCreated"),onAnnotationUpdated:this.onCreateOrUpdateAnnotation("onAnnotationUpdated"),onAnnotationDeleted:this.onDeleteAnnotation,onCancel:this.onCancelAnnotation})}}var QE="";class Gc{constructor(e){h(this,"handleAnnotationCreated",(e,n)=>this._emitter.emit("createAnnotation",e.underlying,n));h(this,"handleAnnotationDeleted",e=>this._emitter.emit("deleteAnnotation",e.underlying));h(this,"handleAnnotationSelected",(e,n)=>this._emitter.emit("selectAnnotation",e.underlying,n));h(this,"handleAnnotationUpdated",(e,n)=>this._emitter.emit("updateAnnotation",e.underlying,n.underlying));h(this,"handleCancelSelected",e=>this._emitter.emit("cancelSelected",e.underlying));h(this,"handleChangeSelected",(e,n)=>this._emitter.emit("changeSelected",e.underlying,n.underlying));h(this,"handleClickAnnotation",(e,n)=>this._emitter.emit("clickAnnotation",e.underlying,n));h(this,"handleLoad",e=>this._emitter.emit("load",e));h(this,"handleSelectionCreated",e=>this._emitter.emit("createSelection",e.underlying));h(this,"handleSelectionStarted",e=>this._emitter.emit("startSelection",e));h(this,"handleSelectionTargetChanged",e=>this._emitter.emit("changeSelectionTarget",e));h(this,"handleMouseEnterAnnotation",(e,n)=>this._emitter.emit("mouseEnterAnnotation",e.underlying,n));h(this,"handleMouseLeaveAnnotation",(e,n)=>this._emitter.emit("mouseLeaveAnnotation",e.underlying,n));h(this,"_wrap",e=>(e==null?void 0:e.type)==="Annotation"?new Je(e):e);h(this,"addAnnotation",(e,n)=>this._app.current.addAnnotation(new Je(e,{readOnly:n})));h(this,"addDrawingTool",e=>this._app.current.addDrawingTool(e));h(this,"cancelSelected",()=>this._app.current.cancelSelected());h(this,"clearAnnotations",()=>this.setAnnotations([]));h(this,"clearAuthInfo",()=>this._env.user=null);h(this,"destroy",()=>{g.unmountComponentAtNode(this._appContainerEl),this._element.parentNode.insertBefore(this._env.image,this._element),this._element.parentNode.removeChild(this._element)});h(this,"getAnnotationById",e=>{const n=this._app.current.getAnnotationById(e);return n==null?void 0:n.underlying});h(this,"getAnnotations",()=>this._app.current.getAnnotations().map(n=>n.underlying));h(this,"getImageSnippetById",e=>this._app.current.getImageSnippetById(e));h(this,"getSelected",()=>{const e=this._app.current.getSelected();return e==null?void 0:e.underlying});h(this,"getSelectedImageSnippet",()=>this._app.current.getSelectedImageSnippet());h(this,"getCurrentDrawingTool",()=>this._app.current.getCurrentDrawingTool());h(this,"getSelectedShape",()=>this._app.current.getSelectedShape());h(this,"listDrawingTools",()=>this._app.current.listDrawingTools());h(this,"loadAnnotations",e=>fetch(e).then(n=>n.json()).then(n=>(this.setAnnotations(n),n)));h(this,"off",(e,n)=>this._emitter.off(e,n));h(this,"on",(e,n)=>this._emitter.on(e,n));h(this,"once",(e,n)=>this._emitter.once(e,n));h(this,"removeAnnotation",e=>this._app.current.removeAnnotation(this._wrap(e)));h(this,"removeDrawingTool",e=>this._app.current.removeDrawingTool(e));h(this,"saveSelected",()=>this._app.current.saveSelected());h(this,"selectAnnotation",e=>{const n=this._app.current.selectAnnotation(this._wrap(e));return n==null?void 0:n.underlying});h(this,"setAnnotations",e=>{const r=(e||[]).map(o=>new Je(o));this._app.current.setAnnotations(r)});h(this,"setAuthInfo",e=>this._env.user=e);h(this,"setDrawingTool",e=>this._app.current.setDrawingTool(e));h(this,"setServerTime",e=>this._env.setServerTime(e));h(this,"setVisible",e=>this._app.current.setVisible(e));h(this,"updateSelected",(e,n)=>{let r=null;e.type==="Annotation"?r=new Je(e):e.type==="Selection"&&(r=new sn(e.target,e.body)),r&&this._app.current.updateSelected(r,n)});this._app=g.createRef(),this._emitter=new mn,e.disableEditor=e.disableEditor||e.headless;const n=e.image.nodeType?e.image:document.getElementById(e.image);n.style.display="block",this._env=_S(),this._env.image=n,ES(e.locale,e.messages),this._element=document.createElement("DIV"),this._element.style.position="relative",this._element.style.display="inline-block",n.parentNode.insertBefore(this._element,n),this._element.appendChild(n),this._appContainerEl=document.createElement("DIV"),this._element.appendChild(this._appContainerEl),g.render(Wc(NS,{ref:this._app,env:this._env,wrapperEl:this._element,config:e,onSelectionStarted:this.handleSelectionStarted,onSelectionCreated:this.handleSelectionCreated,onSelectionTargetChanged:this.handleSelectionTargetChanged,onAnnotationCreated:this.handleAnnotationCreated,onAnnotationSelected:this.handleAnnotationSelected,onAnnotationUpdated:this.handleAnnotationUpdated,onAnnotationDeleted:this.handleAnnotationDeleted,onCancelSelected:this.handleCancelSelected,onChangeSelected:this.handleChangeSelected,onClickAnnotation:this.handleClickAnnotation,onLoad:this.handleLoad,onMouseEnterAnnotation:this.handleMouseEnterAnnotation,onMouseLeaveAnnotation:this.handleMouseLeaveAnnotation}),this._appContainerEl)}get disableEditor(){return this._app.current.disableEditor}set disableEditor(e){this._app.current.disableEditor=e}get disableSelect(){return this._app.current.disableSelect}set disableSelect(e){this._app.current.disableSelect=e}get formatters(){return this._app.current.formatters||[]}set formatters(e){if(e){const n=Array.isArray(e)?e:[e];this._app.current.formatters=n}else this._app.current.formatters=null}get readOnly(){return this._app.current.readOnly}set readOnly(e){this._app.current.readOnly=e}get widgets(){return this._app.current.widgets}set widgets(e){this._app.current.widgets=e}}const LS=t=>new Gc(t);me.Annotorious=Gc,me.init=LS,Object.defineProperty(me,"__esModule",{value:!0}),me[Symbol.toStringTag]="Module"});
24
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jl(t){return s1(t)||u1(t)||l1(t)||c1()}var Zl=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function f1(t,e){return!!(t===e||Zl(t)&&Zl(e))}function d1(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!f1(t[n],e[n]))return!1;return!0}function p1(t,e){e===void 0&&(e=d1);var n,r=[],o,i=!1;function a(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return i&&n===this&&e(s,r)||(o=t.apply(this,s),i=!0,n=this,r=s),o}return a}for(var h1={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},m1=function(e){return M("span",T({css:h1},e))},v1={guidance:function(e){var n=e.isSearchable,r=e.isMulti,o=e.isDisabled,i=e.tabSelectsValue,a=e.context;switch(a){case"menu":return"Use Up and Down to choose options".concat(o?"":", press Enter to select the currently focused option",", press Escape to exit the menu").concat(i?", press Tab to select the option and exit the menu":"",".");case"input":return"".concat(e["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":"");case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var n=e.action,r=e.label,o=r===void 0?"":r,i=e.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(o,", deselected.");case"select-option":return i?"option ".concat(o," is disabled. Select another option."):"option ".concat(o,", selected.");default:return""}},onFocus:function(e){var n=e.context,r=e.focused,o=r===void 0?{}:r,i=e.options,a=e.label,s=a===void 0?"":a,u=e.selectValue,c=e.isDisabled,l=e.isSelected,f=function(b,v){return b&&b.length?"".concat(b.indexOf(v)+1," of ").concat(b.length):""};if(n==="value"&&u)return"value ".concat(s," focused, ").concat(f(u,o),".");if(n==="menu"){var d=c?" disabled":"",p="".concat(l?"selected":"focused").concat(d);return"option ".concat(s," ").concat(p,", ").concat(f(i,o),".")}return""},onFilter:function(e){var n=e.inputValue,r=e.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},g1=function(e){var n=e.ariaSelection,r=e.focusedOption,o=e.focusedValue,i=e.focusableOptions,a=e.isFocused,s=e.selectValue,u=e.selectProps,c=u.ariaLiveMessages,l=u.getOptionLabel,f=u.inputValue,d=u.isMulti,p=u.isOptionDisabled,m=u.isSearchable,b=u.menuIsOpen,v=u.options,S=u.screenReaderStatus,C=u.tabSelectsValue,P=u["aria-label"],F=u["aria-live"],O=He(function(){return ie(ie({},v1),c||{})},[c]),k=He(function(){var W="";if(n&&O.onChange){var z=n.option,Y=n.removedValue,de=n.value,Ie=function(Re){return Array.isArray(Re)?null:Re},he=Y||z||Ie(de),te=ie({isDisabled:he&&p(he),label:he?l(he):""},n);W=O.onChange(te)}return W},[n,p,l,O]),x=He(function(){var W="",z=r||o,Y=!!(r&&s&&s.includes(r));if(z&&O.onFocus){var de={focused:z,label:l(z),isDisabled:p(z),isSelected:Y,options:v,context:z===r?"menu":"value",selectValue:s};W=O.onFocus(de)}return W},[r,o,l,p,O,v,s]),X=He(function(){var W="";if(b&&v.length&&O.onFilter){var z=S({count:i.length});W=O.onFilter({inputValue:f,resultsMessage:z})}return W},[i,f,b,O,v,S]),H=He(function(){var W="";if(O.guidance){var z=o?"value":b?"menu":"input";W=O.guidance({"aria-label":P,context:z,isDisabled:r&&p(r),isMulti:d,isSearchable:m,tabSelectsValue:C})}return W},[P,r,o,d,p,m,b,O,C]),fe="".concat(x," ").concat(X," ").concat(H);return M(m1,{"aria-live":F,"aria-atomic":"false","aria-relevant":"additions text"},a&&M(g.Fragment,null,M("span",{id:"aria-selection"},k),M("span",{id:"aria-context"},fe)))},ui=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}],y1=new RegExp("["+ui.map(function(t){return t.letters}).join("")+"]","g"),Ql={},li=0;li<ui.length;li++)for(var ci=ui[li],fi=0;fi<ci.letters.length;fi++)Ql[ci.letters[fi]]=ci.base;var ec=function(e){return e.replace(y1,function(n){return Ql[n]})},b1=p1(ec),tc=function(e){return e.replace(/^\s+|\s+$/g,"")},S1=function(e){return"".concat(e.label," ").concat(e.value)},_1=function(e){return function(n,r){var o=ie({ignoreCase:!0,ignoreAccents:!0,stringify:S1,trim:!0,matchFrom:"any"},e),i=o.ignoreCase,a=o.ignoreAccents,s=o.stringify,u=o.trim,c=o.matchFrom,l=u?tc(r):r,f=u?tc(s(n)):s(n);return i&&(l=l.toLowerCase(),f=f.toLowerCase()),a&&(l=b1(l),f=ec(f)),c==="start"?f.substr(0,l.length)===l:f.indexOf(l)>-1}};function E1(t){t.in,t.out,t.onExited,t.appear,t.enter,t.exit;var e=t.innerRef;t.emotion;var n=Mt(t,["in","out","onExited","appear","enter","exit","innerRef","emotion"]);return M("input",T({ref:e},n,{css:Qo({label:"dummyInput",background:0,border:0,fontSize:"inherit",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(0)"},"","")}))}var C1=function(e){e.preventDefault(),e.stopPropagation()};function A1(t){var e=t.isEnabled,n=t.onBottomArrive,r=t.onBottomLeave,o=t.onTopArrive,i=t.onTopLeave,a=$e(!1),s=$e(!1),u=$e(0),c=$e(null),l=xe(function(v,S){if(c.current!==null){var C=c.current,P=C.scrollTop,F=C.scrollHeight,O=C.clientHeight,k=c.current,x=S>0,X=F-O-P,H=!1;X>S&&a.current&&(r&&r(v),a.current=!1),x&&s.current&&(i&&i(v),s.current=!1),x&&S>X?(n&&!a.current&&n(v),k.scrollTop=F,H=!0,a.current=!0):!x&&-S>P&&(o&&!s.current&&o(v),k.scrollTop=0,H=!0,s.current=!0),H&&C1(v)}},[]),f=xe(function(v){l(v,v.deltaY)},[l]),d=xe(function(v){u.current=v.changedTouches[0].clientY},[]),p=xe(function(v){var S=u.current-v.changedTouches[0].clientY;l(v,S)},[l]),m=xe(function(v){if(!!v){var S=db?{passive:!1}:!1;typeof v.addEventListener=="function"&&v.addEventListener("wheel",f,S),typeof v.addEventListener=="function"&&v.addEventListener("touchstart",d,S),typeof v.addEventListener=="function"&&v.addEventListener("touchmove",p,S)}},[p,d,f]),b=xe(function(v){!v||(typeof v.removeEventListener=="function"&&v.removeEventListener("wheel",f,!1),typeof v.removeEventListener=="function"&&v.removeEventListener("touchstart",d,!1),typeof v.removeEventListener=="function"&&v.removeEventListener("touchmove",p,!1))},[p,d,f]);return tt(function(){if(!!e){var v=c.current;return m(v),function(){b(v)}}},[e,m,b]),function(v){c.current=v}}var nc=["boxSizing","height","overflow","paddingRight","position"],rc={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function oc(t){t.preventDefault()}function ic(t){t.stopPropagation()}function ac(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function sc(){return"ontouchstart"in window||navigator.maxTouchPoints}var uc=!!(typeof window!="undefined"&&window.document&&window.document.createElement),on=0,Ft={capture:!1,passive:!1};function w1(t){var e=t.isEnabled,n=t.accountForScrollbars,r=n===void 0?!0:n,o=$e({}),i=$e(null),a=xe(function(u){if(!!uc){var c=document.body,l=c&&c.style;if(r&&nc.forEach(function(m){var b=l&&l[m];o.current[m]=b}),r&&on<1){var f=parseInt(o.current.paddingRight,10)||0,d=document.body?document.body.clientWidth:0,p=window.innerWidth-d+f||0;Object.keys(rc).forEach(function(m){var b=rc[m];l&&(l[m]=b)}),l&&(l.paddingRight="".concat(p,"px"))}c&&sc()&&(c.addEventListener("touchmove",oc,Ft),u&&(u.addEventListener("touchstart",ac,Ft),u.addEventListener("touchmove",ic,Ft))),on+=1}},[]),s=xe(function(u){if(!!uc){var c=document.body,l=c&&c.style;on=Math.max(on-1,0),r&&on<1&&nc.forEach(function(f){var d=o.current[f];l&&(l[f]=d)}),c&&sc()&&(c.removeEventListener("touchmove",oc,Ft),u&&(u.removeEventListener("touchstart",ac,Ft),u.removeEventListener("touchmove",ic,Ft)))}},[]);return tt(function(){if(!!e){var u=i.current;return a(u),function(){s(u)}}},[e,a,s]),function(u){i.current=u}}var O1=function(){return document.activeElement&&document.activeElement.blur()},$1={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function x1(t){var e=t.children,n=t.lockEnabled,r=t.captureEnabled,o=r===void 0?!0:r,i=t.onBottomArrive,a=t.onBottomLeave,s=t.onTopArrive,u=t.onTopLeave,c=A1({isEnabled:o,onBottomArrive:i,onBottomLeave:a,onTopArrive:s,onTopLeave:u}),l=w1({isEnabled:n}),f=function(p){c(p),l(p)};return M(g.Fragment,null,n&&M("div",{onClick:O1,css:$1}),e(f))}var P1=function(e){return e.label},D1=function(e){return e.label},T1=function(e){return e.value},M1=function(e){return!!e.isDisabled},k1={clearIndicator:Mb,container:Cb,control:Lb,dropdownIndicator:Db,group:Vb,groupHeading:Ub,indicatorsContainer:$b,indicatorSeparator:Fb,input:zb,loadingIndicator:Nb,loadingMessage:Sb,menu:mb,menuList:gb,menuPortal:_b,multiValue:qb,multiValueLabel:Yb,multiValueRemove:Xb,noOptionsMessage:bb,option:Qb,placeholder:t1,singleValue:r1,valueContainer:wb},F1={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},I1=4,lc=4,R1=38,N1=lc*2,L1={baseUnit:lc,controlHeight:R1,menuGutter:N1},di={borderRadius:I1,colors:F1,spacing:L1},B1={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Nl(),captureMenuScroll:!Nl(),closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:_1(),formatGroupLabel:P1,getOptionLabel:D1,getOptionValue:T1,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:M1,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!cb(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var n=e.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:"0",tabSelectsValue:!0};function cc(t,e,n,r){var o=mc(t,e,n),i=vc(t,e,n),a=hc(t,e),s=br(t,e);return{type:"option",data:e,isDisabled:o,isSelected:i,label:a,value:s,index:r}}function fc(t,e){return t.options.map(function(n,r){if(n.options){var o=n.options.map(function(a,s){return cc(t,a,e,s)}).filter(function(a){return pc(t,a)});return o.length>0?{type:"group",data:n,options:o,index:r}:void 0}var i=cc(t,n,e,r);return pc(t,i)?i:void 0}).filter(function(n){return!!n})}function dc(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,Jl(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function V1(t,e){return dc(fc(t,e))}function pc(t,e){var n=t.inputValue,r=n===void 0?"":n,o=e.data,i=e.isSelected,a=e.label,s=e.value;return(!yc(t)||!i)&&gc(t,{label:a,value:s,data:o},r)}function H1(t,e){var n=t.focusedValue,r=t.selectValue,o=r.indexOf(n);if(o>-1){var i=e.indexOf(n);if(i>-1)return n;if(o<e.length)return e[o]}return null}function U1(t,e){var n=t.focusedOption;return n&&e.indexOf(n)>-1?n:e[0]}var hc=function(e,n){return e.getOptionLabel(n)},br=function(e,n){return e.getOptionValue(n)};function mc(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function vc(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=br(t,e);return n.some(function(o){return br(t,o)===r})}function gc(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var yc=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},j1=1,bc=function(t){dr(n,t);var e=hr(n);function n(r){var o;return lr(this,n),o=e.call(this,r),o.state={ariaSelection:null,focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0},o.blockOptionHover=!1,o.isComposing=!1,o.commonProps=void 0,o.initialTouchX=0,o.initialTouchY=0,o.instancePrefix="",o.openAfterFocus=!1,o.scrollToFocusedOptionOnUpdate=!1,o.userIsDragging=void 0,o.controlRef=null,o.getControlRef=function(i){o.controlRef=i},o.focusedOptionRef=null,o.getFocusedOptionRef=function(i){o.focusedOptionRef=i},o.menuListRef=null,o.getMenuListRef=function(i){o.menuListRef=i},o.inputRef=null,o.getInputRef=function(i){o.inputRef=i},o.focus=o.focusInput,o.blur=o.blurInput,o.onChange=function(i,a){var s=o.props,u=s.onChange,c=s.name;a.name=c,o.ariaOnChange(i,a),u(i,a)},o.setValue=function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"set-value",s=arguments.length>2?arguments[2]:void 0,u=o.props,c=u.closeMenuOnSelect,l=u.isMulti;o.onInputChange("",{action:"set-value"}),c&&(o.setState({inputIsHiddenAfterUpdate:!l}),o.onMenuClose()),o.setState({clearFocusValueOnUpdate:!0}),o.onChange(i,{action:a,option:s})},o.selectOption=function(i){var a=o.props,s=a.blurInputOnSelect,u=a.isMulti,c=a.name,l=o.state.selectValue,f=u&&o.isOptionSelected(i,l),d=o.isOptionDisabled(i,l);if(f){var p=o.getOptionValue(i);o.setValue(l.filter(function(m){return o.getOptionValue(m)!==p}),"deselect-option",i)}else if(!d)u?o.setValue([].concat(Jl(l),[i]),"select-option",i):o.setValue(i,"select-option");else{o.ariaOnChange(i,{action:"select-option",name:c});return}s&&o.blurInput()},o.removeValue=function(i){var a=o.props.isMulti,s=o.state.selectValue,u=o.getOptionValue(i),c=s.filter(function(f){return o.getOptionValue(f)!==u}),l=a?c:c[0]||null;o.onChange(l,{action:"remove-value",removedValue:i}),o.focusInput()},o.clearValue=function(){var i=o.state.selectValue;o.onChange(o.props.isMulti?[]:null,{action:"clear",removedValues:i})},o.popValue=function(){var i=o.props.isMulti,a=o.state.selectValue,s=a[a.length-1],u=a.slice(0,a.length-1),c=i?u:u[0]||null;o.onChange(c,{action:"pop-value",removedValue:s})},o.getValue=function(){return o.state.selectValue},o.cx=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];return ib.apply(void 0,[o.props.classNamePrefix].concat(a))},o.getOptionLabel=function(i){return hc(o.props,i)},o.getOptionValue=function(i){return br(o.props,i)},o.getStyles=function(i,a){var s=k1[i](a);s.boxSizing="border-box";var u=o.props.styles[i];return u?u(s,a):s},o.getElementId=function(i){return"".concat(o.instancePrefix,"-").concat(i)},o.getComponents=function(){return a1(o.props)},o.buildCategorizedOptions=function(){return fc(o.props,o.state.selectValue)},o.getCategorizedOptions=function(){return o.props.menuIsOpen?o.buildCategorizedOptions():[]},o.buildFocusableOptions=function(){return dc(o.buildCategorizedOptions())},o.getFocusableOptions=function(){return o.props.menuIsOpen?o.buildFocusableOptions():[]},o.ariaOnChange=function(i,a){o.setState({ariaSelection:ie({value:i},a)})},o.onMenuMouseDown=function(i){i.button===0&&(i.stopPropagation(),i.preventDefault(),o.focusInput())},o.onMenuMouseMove=function(i){o.blockOptionHover=!1},o.onControlMouseDown=function(i){var a=o.props.openMenuOnClick;o.state.isFocused?o.props.menuIsOpen?i.target.tagName!=="INPUT"&&i.target.tagName!=="TEXTAREA"&&o.onMenuClose():a&&o.openMenu("first"):(a&&(o.openAfterFocus=!0),o.focusInput()),i.target.tagName!=="INPUT"&&i.target.tagName!=="TEXTAREA"&&i.preventDefault()},o.onDropdownIndicatorMouseDown=function(i){if(!(i&&i.type==="mousedown"&&i.button!==0)&&!o.props.isDisabled){var a=o.props,s=a.isMulti,u=a.menuIsOpen;o.focusInput(),u?(o.setState({inputIsHiddenAfterUpdate:!s}),o.onMenuClose()):o.openMenu("first"),i.preventDefault(),i.stopPropagation()}},o.onClearIndicatorMouseDown=function(i){i&&i.type==="mousedown"&&i.button!==0||(o.clearValue(),i.stopPropagation(),o.openAfterFocus=!1,i.type==="touchend"?o.focusInput():setTimeout(function(){return o.focusInput()}))},o.onScroll=function(i){typeof o.props.closeMenuOnScroll=="boolean"?i.target instanceof HTMLElement&&ri(i.target)&&o.props.onMenuClose():typeof o.props.closeMenuOnScroll=="function"&&o.props.closeMenuOnScroll(i)&&o.props.onMenuClose()},o.onCompositionStart=function(){o.isComposing=!0},o.onCompositionEnd=function(){o.isComposing=!1},o.onTouchStart=function(i){var a=i.touches,s=a&&a.item(0);!s||(o.initialTouchX=s.clientX,o.initialTouchY=s.clientY,o.userIsDragging=!1)},o.onTouchMove=function(i){var a=i.touches,s=a&&a.item(0);if(!!s){var u=Math.abs(s.clientX-o.initialTouchX),c=Math.abs(s.clientY-o.initialTouchY),l=5;o.userIsDragging=u>l||c>l}},o.onTouchEnd=function(i){o.userIsDragging||(o.controlRef&&!o.controlRef.contains(i.target)&&o.menuListRef&&!o.menuListRef.contains(i.target)&&o.blurInput(),o.initialTouchX=0,o.initialTouchY=0)},o.onControlTouchEnd=function(i){o.userIsDragging||o.onControlMouseDown(i)},o.onClearIndicatorTouchEnd=function(i){o.userIsDragging||o.onClearIndicatorMouseDown(i)},o.onDropdownIndicatorTouchEnd=function(i){o.userIsDragging||o.onDropdownIndicatorMouseDown(i)},o.handleInputChange=function(i){var a=i.currentTarget.value;o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange(a,{action:"input-change"}),o.props.menuIsOpen||o.onMenuOpen()},o.onInputFocus=function(i){o.props.onFocus&&o.props.onFocus(i),o.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(o.openAfterFocus||o.props.openMenuOnFocus)&&o.openMenu("first"),o.openAfterFocus=!1},o.onInputBlur=function(i){if(o.menuListRef&&o.menuListRef.contains(document.activeElement)){o.inputRef.focus();return}o.props.onBlur&&o.props.onBlur(i),o.onInputChange("",{action:"input-blur"}),o.onMenuClose(),o.setState({focusedValue:null,isFocused:!1})},o.onOptionHover=function(i){o.blockOptionHover||o.state.focusedOption===i||o.setState({focusedOption:i})},o.shouldHideSelectedOptions=function(){return yc(o.props)},o.onKeyDown=function(i){var a=o.props,s=a.isMulti,u=a.backspaceRemovesValue,c=a.escapeClearsValue,l=a.inputValue,f=a.isClearable,d=a.isDisabled,p=a.menuIsOpen,m=a.onKeyDown,b=a.tabSelectsValue,v=a.openMenuOnFocus,S=o.state,C=S.focusedOption,P=S.focusedValue,F=S.selectValue;if(!d&&!(typeof m=="function"&&(m(i),i.defaultPrevented))){switch(o.blockOptionHover=!0,i.key){case"ArrowLeft":if(!s||l)return;o.focusValue("previous");break;case"ArrowRight":if(!s||l)return;o.focusValue("next");break;case"Delete":case"Backspace":if(l)return;if(P)o.removeValue(P);else{if(!u)return;s?o.popValue():f&&o.clearValue()}break;case"Tab":if(o.isComposing||i.shiftKey||!p||!b||!C||v&&o.isOptionSelected(C,F))return;o.selectOption(C);break;case"Enter":if(i.keyCode===229)break;if(p){if(!C||o.isComposing)return;o.selectOption(C);break}return;case"Escape":p?(o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange("",{action:"menu-close"}),o.onMenuClose()):f&&c&&o.clearValue();break;case" ":if(l)return;if(!p){o.openMenu("first");break}if(!C)return;o.selectOption(C);break;case"ArrowUp":p?o.focusOption("up"):o.openMenu("last");break;case"ArrowDown":p?o.focusOption("down"):o.openMenu("first");break;case"PageUp":if(!p)return;o.focusOption("pageup");break;case"PageDown":if(!p)return;o.focusOption("pagedown");break;case"Home":if(!p)return;o.focusOption("first");break;case"End":if(!p)return;o.focusOption("last");break;default:return}i.preventDefault()}},o.instancePrefix="react-select-"+(o.props.instanceId||++j1),o.state.selectValue=Fl(r.value),o}return cr(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()}},{key:"componentDidUpdate",value:function(o){var i=this.props,a=i.isDisabled,s=i.menuIsOpen,u=this.state.isFocused;(u&&!a&&o.isDisabled||u&&s&&!o.menuIsOpen)&&this.focusInput(),u&&a&&!o.isDisabled&&this.setState({isFocused:!1},this.onMenuClose),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ub(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close"}),this.props.onMenuClose()}},{key:"onInputChange",value:function(o,i){this.props.onInputChange(o,i)}},{key:"focusInput",value:function(){!this.inputRef||this.inputRef.focus()}},{key:"blurInput",value:function(){!this.inputRef||this.inputRef.blur()}},{key:"openMenu",value:function(o){var i=this,a=this.state,s=a.selectValue,u=a.isFocused,c=this.buildFocusableOptions(),l=o==="first"?0:c.length-1;if(!this.props.isMulti){var f=c.indexOf(s[0]);f>-1&&(l=f)}this.scrollToFocusedOptionOnUpdate=!(u&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[l]},function(){return i.onMenuOpen()})}},{key:"focusValue",value:function(o){var i=this.state,a=i.selectValue,s=i.focusedValue;if(!!this.props.isMulti){this.setState({focusedOption:null});var u=a.indexOf(s);s||(u=-1);var c=a.length-1,l=-1;if(!!a.length){switch(o){case"previous":u===0?l=0:u===-1?l=c:l=u-1;break;case"next":u>-1&&u<c&&(l=u+1);break}this.setState({inputIsHidden:l!==-1,focusedValue:a[l]})}}}},{key:"focusOption",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",i=this.props.pageSize,a=this.state.focusedOption,s=this.getFocusableOptions();if(!!s.length){var u=0,c=s.indexOf(a);a||(c=-1),o==="up"?u=c>0?c-1:s.length-1:o==="down"?u=(c+1)%s.length:o==="pageup"?(u=c-i,u<0&&(u=0)):o==="pagedown"?(u=c+i,u>s.length-1&&(u=s.length-1)):o==="last"&&(u=s.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:s[u],focusedValue:null})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(di):ie(ie({},di),this.props.theme):di}},{key:"getCommonProps",value:function(){var o=this.clearValue,i=this.cx,a=this.getStyles,s=this.getValue,u=this.selectOption,c=this.setValue,l=this.props,f=l.isMulti,d=l.isRtl,p=l.options,m=this.hasValue();return{clearValue:o,cx:i,getStyles:a,getValue:s,hasValue:m,isMulti:f,isRtl:d,options:p,selectOption:u,selectProps:l,setValue:c,theme:this.getTheme()}}},{key:"hasValue",value:function(){var o=this.state.selectValue;return o.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var o=this.props,i=o.isClearable,a=o.isMulti;return i===void 0?a:i}},{key:"isOptionDisabled",value:function(o,i){return mc(this.props,o,i)}},{key:"isOptionSelected",value:function(o,i){return vc(this.props,o,i)}},{key:"filterOption",value:function(o,i){return gc(this.props,o,i)}},{key:"formatOptionLabel",value:function(o,i){if(typeof this.props.formatOptionLabel=="function"){var a=this.props.inputValue,s=this.state.selectValue;return this.props.formatOptionLabel(o,{context:i,inputValue:a,selectValue:s})}else return this.getOptionLabel(o)}},{key:"formatGroupLabel",value:function(o){return this.props.formatGroupLabel(o)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var o=this.props,i=o.isDisabled,a=o.isSearchable,s=o.inputId,u=o.inputValue,c=o.tabIndex,l=o.form,f=this.getComponents(),d=f.Input,p=this.state.inputIsHidden,m=this.commonProps,b=s||this.getElementId("input"),v={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};return a?g.createElement(d,T({},m,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:b,innerRef:this.getInputRef,isDisabled:i,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:l,type:"text",value:u},v)):g.createElement(E1,T({id:b,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:mr,onFocus:this.onInputFocus,readOnly:!0,disabled:i,tabIndex:c,form:l,value:""},v))}},{key:"renderPlaceholderOrValue",value:function(){var o=this,i=this.getComponents(),a=i.MultiValue,s=i.MultiValueContainer,u=i.MultiValueLabel,c=i.MultiValueRemove,l=i.SingleValue,f=i.Placeholder,d=this.commonProps,p=this.props,m=p.controlShouldRenderValue,b=p.isDisabled,v=p.isMulti,S=p.inputValue,C=p.placeholder,P=this.state,F=P.selectValue,O=P.focusedValue,k=P.isFocused;if(!this.hasValue()||!m)return S?null:g.createElement(f,T({},d,{key:"placeholder",isDisabled:b,isFocused:k}),C);if(v){var x=F.map(function(H,fe){var W=H===O;return g.createElement(a,T({},d,{components:{Container:s,Label:u,Remove:c},isFocused:W,isDisabled:b,key:"".concat(o.getOptionValue(H)).concat(fe),index:fe,removeProps:{onClick:function(){return o.removeValue(H)},onTouchEnd:function(){return o.removeValue(H)},onMouseDown:function(Y){Y.preventDefault(),Y.stopPropagation()}},data:H}),o.formatOptionLabel(H,"value"))});return x}if(S)return null;var X=F[0];return g.createElement(l,T({},d,{data:X,isDisabled:b}),this.formatOptionLabel(X,"value"))}},{key:"renderClearIndicator",value:function(){var o=this.getComponents(),i=o.ClearIndicator,a=this.commonProps,s=this.props,u=s.isDisabled,c=s.isLoading,l=this.state.isFocused;if(!this.isClearable()||!i||u||!this.hasValue()||c)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(i,T({},a,{innerProps:f,isFocused:l}))}},{key:"renderLoadingIndicator",value:function(){var o=this.getComponents(),i=o.LoadingIndicator,a=this.commonProps,s=this.props,u=s.isDisabled,c=s.isLoading,l=this.state.isFocused;if(!i||!c)return null;var f={"aria-hidden":"true"};return g.createElement(i,T({},a,{innerProps:f,isDisabled:u,isFocused:l}))}},{key:"renderIndicatorSeparator",value:function(){var o=this.getComponents(),i=o.DropdownIndicator,a=o.IndicatorSeparator;if(!i||!a)return null;var s=this.commonProps,u=this.props.isDisabled,c=this.state.isFocused;return g.createElement(a,T({},s,{isDisabled:u,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var o=this.getComponents(),i=o.DropdownIndicator;if(!i)return null;var a=this.commonProps,s=this.props.isDisabled,u=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(i,T({},a,{innerProps:c,isDisabled:s,isFocused:u}))}},{key:"renderMenu",value:function(){var o=this,i=this.getComponents(),a=i.Group,s=i.GroupHeading,u=i.Menu,c=i.MenuList,l=i.MenuPortal,f=i.LoadingMessage,d=i.NoOptionsMessage,p=i.Option,m=this.commonProps,b=this.state.focusedOption,v=this.props,S=v.captureMenuScroll,C=v.inputValue,P=v.isLoading,F=v.loadingMessage,O=v.minMenuHeight,k=v.maxMenuHeight,x=v.menuIsOpen,X=v.menuPlacement,H=v.menuPosition,fe=v.menuPortalTarget,W=v.menuShouldBlockScroll,z=v.menuShouldScrollIntoView,Y=v.noOptionsMessage,de=v.onMenuScrollToTop,Ie=v.onMenuScrollToBottom;if(!x)return null;var he=function(_,E){var A=_.type,w=_.data,D=_.isDisabled,I=_.isSelected,j=_.label,U=_.value,Ze=b===w,We=D?void 0:function(){return o.onOptionHover(w)},Qe=D?void 0:function(){return o.selectOption(w)},Ne="".concat(o.getElementId("option"),"-").concat(E),cn={id:Ne,onClick:Qe,onMouseMove:We,onMouseOver:We,tabIndex:-1};return g.createElement(p,T({},m,{innerProps:cn,data:w,isDisabled:D,isSelected:I,key:Ne,label:j,type:A,value:U,isFocused:Ze,innerRef:Ze?o.getFocusedOptionRef:void 0}),o.formatOptionLabel(_.data,"menu"))},te;if(this.hasOptions())te=this.getCategorizedOptions().map(function(y){if(y.type==="group"){var _=y.data,E=y.options,A=y.index,w="".concat(o.getElementId("group"),"-").concat(A),D="".concat(w,"-heading");return g.createElement(a,T({},m,{key:w,data:_,options:E,Heading:s,headingProps:{id:D,data:y.data},label:o.formatGroupLabel(y.data)}),y.options.map(function(I){return he(I,"".concat(A,"-").concat(I.index))}))}else if(y.type==="option")return he(y,"".concat(y.index))});else if(P){var ln=F({inputValue:C});if(ln===null)return null;te=g.createElement(f,m,ln)}else{var Re=Y({inputValue:C});if(Re===null)return null;te=g.createElement(d,m,Re)}var we={minMenuHeight:O,maxMenuHeight:k,menuPlacement:X,menuPosition:H,menuShouldScrollIntoView:z},dt=g.createElement(Vl,T({},m,we),function(y){var _=y.ref,E=y.placerProps,A=E.placement,w=E.maxHeight;return g.createElement(u,T({},m,we,{innerRef:_,innerProps:{onMouseDown:o.onMenuMouseDown,onMouseMove:o.onMenuMouseMove},isLoading:P,placement:A}),g.createElement(x1,{captureEnabled:S,onTopArrive:de,onBottomArrive:Ie,lockEnabled:W},function(D){return g.createElement(c,T({},m,{innerRef:function(j){o.getMenuListRef(j),D(j)},isLoading:P,maxHeight:w,focusedOption:b}),te)}))});return fe||H==="fixed"?g.createElement(l,T({},m,{appendTo:fe,controlElement:this.controlRef,menuPlacement:X,menuPosition:H}),dt):dt}},{key:"renderFormField",value:function(){var o=this,i=this.props,a=i.delimiter,s=i.isDisabled,u=i.isMulti,c=i.name,l=this.state.selectValue;if(!(!c||s))if(u)if(a){var f=l.map(function(m){return o.getOptionValue(m)}).join(a);return g.createElement("input",{name:c,type:"hidden",value:f})}else{var d=l.length>0?l.map(function(m,b){return g.createElement("input",{key:"i-".concat(b),name:c,type:"hidden",value:o.getOptionValue(m)})}):g.createElement("input",{name:c,type:"hidden"});return g.createElement("div",null,d)}else{var p=l[0]?this.getOptionValue(l[0]):"";return g.createElement("input",{name:c,type:"hidden",value:p})}}},{key:"renderLiveRegion",value:function(){var o=this.commonProps,i=this.state,a=i.ariaSelection,s=i.focusedOption,u=i.focusedValue,c=i.isFocused,l=i.selectValue,f=this.getFocusableOptions();return g.createElement(g1,T({},o,{ariaSelection:a,focusedOption:s,focusedValue:u,isFocused:c,selectValue:l,focusableOptions:f}))}},{key:"render",value:function(){var o=this.getComponents(),i=o.Control,a=o.IndicatorsContainer,s=o.SelectContainer,u=o.ValueContainer,c=this.props,l=c.className,f=c.id,d=c.isDisabled,p=c.menuIsOpen,m=this.state.isFocused,b=this.commonProps=this.getCommonProps();return g.createElement(s,T({},b,{className:l,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:d,isFocused:m}),this.renderLiveRegion(),g.createElement(i,T({},b,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:d,isFocused:m,menuIsOpen:p}),g.createElement(u,T({},b,{isDisabled:d}),this.renderPlaceholderOrValue(),this.renderInput()),g.createElement(a,T({},b,{isDisabled:d}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(o,i){var a=i.prevProps,s=i.clearFocusValueOnUpdate,u=i.inputIsHiddenAfterUpdate,c=o.options,l=o.value,f=o.menuIsOpen,d=o.inputValue,p={};if(a&&(l!==a.value||c!==a.options||f!==a.menuIsOpen||d!==a.inputValue)){var m=Fl(l),b=f?V1(o,m):[],v=s?H1(i,m):null,S=U1(i,b);p={selectValue:m,focusedOption:S,focusedValue:v,clearFocusValueOnUpdate:!1}}var C=u!=null&&o!==a?{inputIsHidden:u,inputIsHiddenAfterUpdate:void 0}:{};return ie(ie(ie({},p),C),{},{prevProps:o})}}]),n}(J);bc.defaultProps=B1;var z1={defaultInputValue:"",defaultMenuIsOpen:!1,defaultValue:null},W1=function(e){var n,r;return r=n=function(o){dr(a,o);var i=hr(a);function a(){var s;lr(this,a);for(var u=arguments.length,c=new Array(u),l=0;l<u;l++)c[l]=arguments[l];return s=i.call.apply(i,[this].concat(c)),s.select=void 0,s.state={inputValue:s.props.inputValue!==void 0?s.props.inputValue:s.props.defaultInputValue,menuIsOpen:s.props.menuIsOpen!==void 0?s.props.menuIsOpen:s.props.defaultMenuIsOpen,value:s.props.value!==void 0?s.props.value:s.props.defaultValue},s.onChange=function(f,d){s.callProp("onChange",f,d),s.setState({value:f})},s.onInputChange=function(f,d){var p=s.callProp("onInputChange",f,d);s.setState({inputValue:p!==void 0?p:f})},s.onMenuOpen=function(){s.callProp("onMenuOpen"),s.setState({menuIsOpen:!0})},s.onMenuClose=function(){s.callProp("onMenuClose"),s.setState({menuIsOpen:!1})},s}return cr(a,[{key:"focus",value:function(){this.select.focus()}},{key:"blur",value:function(){this.select.blur()}},{key:"getProp",value:function(u){return this.props[u]!==void 0?this.props[u]:this.state[u]}},{key:"callProp",value:function(u){if(typeof this.props[u]=="function"){for(var c,l=arguments.length,f=new Array(l>1?l-1:0),d=1;d<l;d++)f[d-1]=arguments[d];return(c=this.props)[u].apply(c,f)}}},{key:"render",value:function(){var u=this,c=this.props;c.defaultInputValue,c.defaultMenuIsOpen,c.defaultValue;var l=Mt(c,["defaultInputValue","defaultMenuIsOpen","defaultValue"]);return g.createElement(e,T({},l,{ref:function(d){u.select=d},inputValue:this.getProp("inputValue"),menuIsOpen:this.getProp("menuIsOpen"),onChange:this.onChange,onInputChange:this.onInputChange,onMenuClose:this.onMenuClose,onMenuOpen:this.onMenuOpen,value:this.getProp("value")}))}}]),a}(J),n.defaultProps=z1,r},G1=W1(bc),q1=G1;const pi=[{value:"assessing",label:"Assessing"},{value:"bookmarking",label:"Bookmarking"},{value:"classifying",label:"Classifying"},{value:"commenting",label:"Commenting"},{value:"describing",label:"Describing"},{value:"editing",label:"Editing"},{value:"highlighting",label:"Highlighting"},{value:"identifying",label:"Identifying"},{value:"linking",label:"Linking"},{value:"moderating",label:"Moderating"},{value:"questioning",label:"Questioning"},{value:"replying",label:"Replying"},{value:"supplementing",label:"Transcription"}];var Sc=t=>{const e=t.content?pi.find(n=>n.value===t.content):null;return g.createElement("div",{className:"r6o-purposedropdown"},g.createElement(q1,{value:e,onChange:t.onChange,options:pi,isDisabled:!t.editable}))};const Y1=t=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1000 940",width:t.width},g.createElement("metadata",null,"IcoFont Icons"),g.createElement("title",null,"simple-down"),g.createElement("glyph",{glyphName:"simple-down",unicode:"\uEAB2",horizAdvX:"1000"}),g.createElement("path",{fill:"currentColor",d:"M200 392.6l300 300 300-300-85.10000000000002-85.10000000000002-214.89999999999998 214.79999999999995-214.89999999999998-214.89999999999998-85.10000000000002 85.20000000000005z"})),X1=t=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"180 150 700 800",width:t.width},g.createElement("metadata",null,"IcoFont Icons"),g.createElement("title",null,"close"),g.createElement("glyph",{glyphName:"close",unicode:"\uEEE4",horizAdvX:"1000"}),g.createElement("path",{fill:"currentColor",d:"M709.8 206.6c-64.39999999999998 65.50000000000003-128.89999999999998 131.20000000000002-194.19999999999993 197.6-8.600000000000023 8.699999999999989-22.400000000000034 8.800000000000011-31 0-65-66-129.70000000000005-131.8-194.5-197.6-8.600000000000023-8.699999999999989-22.400000000000034-8.599999999999994-30.900000000000034 0.09999999999999432-15.699999999999989 16.200000000000017-31.099999999999994 32.30000000000001-47.099999999999994 48.80000000000001-8.5 8.800000000000011-8.299999999999983 23 0.20000000000001705 31.69999999999999 63.099999999999966 64.19999999999999 127.89999999999998 130.10000000000002 193.59999999999997 197 8.600000000000023 8.699999999999989 8.5 22.80000000000001 0 31.599999999999966-65.19999999999999 66.40000000000009-130.2 132.5-194.7 198.10000000000002-8.5 8.700000000000045-8.5 22.800000000000068 0.20000000000001705 31.399999999999977l47.79999999999998 47.90000000000009c8.600000000000023 8.599999999999909 22.600000000000023 8.599999999999909 31.100000000000023-0.10000000000002274l194.2-197.30000000000007c8.600000000000023-8.699999999999932 22.399999999999977-8.699999999999932 31 0 64.70000000000005 65.80000000000007 129.20000000000005 131.4000000000001 194.20000000000005 197.5 8.599999999999909 8.700000000000045 22.5 8.800000000000068 31 0.10000000000002274 16-16.199999999999932 31.699999999999932-32.19999999999993 47.59999999999991-48.299999999999955 8.600000000000023-8.700000000000045 8.600000000000023-22.899999999999977 0.10000000000002274-31.600000000000023-63.799999999999955-65-128.5-130.89999999999998-194.19999999999993-197.79999999999995-8.600000000000023-8.700000000000045-8.600000000000023-22.900000000000034 0-31.600000000000023 65.19999999999993-66.40000000000003 130.0999999999999-132.5 194.5-198.20000000000005 8.599999999999909-8.699999999999989 8.5-22.799999999999955-0.10000000000002274-31.49999999999997l-47.80000000000007-48.099999999999994c-8.5-8.5-22.399999999999977-8.400000000000006-31 0.29999999999998295z"})),K1=t=>g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:t.width},g.createElement("path",{fill:"currentColor",d:"M268 416h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12zM432 80h-82.41l-34-56.7A48 48 0 0 0 274.41 0H173.59a48 48 0 0 0-41.16 23.3L98.41 80H16A16 16 0 0 0 0 96v16a16 16 0 0 0 16 16h16v336a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128h16a16 16 0 0 0 16-16V96a16 16 0 0 0-16-16zM171.84 50.91A6 6 0 0 1 177 48h94a6 6 0 0 1 5.15 2.91L293.61 80H154.39zM368 464H80V128h288zm-212-48h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12z"}));var J1=t=>{const[e,n]=Ve(!1),[r,o]=Ve(!1),i=f=>{n(!0),o(!1)},a=f=>{t.onDelete(t.body),o(!1)},s=f=>t.onUpdate(t.body,{...t.body,value:f.target.value}),u=f=>t.onUpdate(t.body,{...t.body,purpose:f.value}),c=t.body.modified||t.body.created,l=t.body.creator&&g.createElement("div",{className:"r6o-lastmodified"},g.createElement("span",{className:"r6o-lastmodified-by"},t.body.creator.name||t.body.creator.id),t.body.created&&g.createElement("span",{className:"r6o-lastmodified-at"},g.createElement(Wd,{datetime:t.env.toClientTime(c),locale:Se.locale()})));return t.readOnly?g.createElement("div",{className:"r6o-widget comment"},g.createElement("div",{className:"r6o-readonly-comment"},t.body.value),l):g.createElement("div",{className:e?"r6o-widget comment editable":"r6o-widget comment"},g.createElement(Zu,{editable:e,content:t.body.value,onChange:s,onSaveAndClose:t.onSaveAndClose}),!e&&l,t.purposeSelector&&g.createElement(Sc,{editable:e,content:t.body.purpose,onChange:u,onSaveAndClose:t.onSaveAndClose}),g.createElement("div",{className:r?"r6o-icon r6o-arrow-down r6o-menu-open":"r6o-icon r6o-arrow-down",onClick:()=>o(!r)},g.createElement(Y1,{width:12})),r&&g.createElement(ky,{onEdit:i,onDelete:a,onClickOutside:()=>o(!1)}))};const Z1=pi.map(t=>t.value),_c=(t,e)=>{const n=e?Z1.indexOf(t.purpose)>-1:t.purpose=="commenting"||t.purpose=="replying";return t.type==="TextualBody"&&(!Object.prototype.hasOwnProperty.call(t,"purpose")||n)},Ec=(t,e)=>{var n,r;if(e.editable===!0)return!1;if(e.editable===!1)return!0;if(e.editable==="MINE_ONLY"){const o=(n=t.creator)==null?void 0:n.id;return((r=e.env.user)==null?void 0:r.id)!==o}return e.readOnly},Q1=(t,e)=>t||{type:"TextualBody",value:"",purpose:e?"replying":"commenting",draft:!0},Cc=t=>{const e=t.annotation?t.annotation.bodies.filter(u=>_c(u,t.purposeSelector)):[],n=Q1(e.find(u=>u.draft==!0),e.length>1),r=e.filter(u=>u!=n),o=u=>{const c=n.value,l=u.target.value;c.length===0&&l.length>0?t.onAppendBody({...n,value:l}):c.length>0&&l.length===0?t.onRemoveBody(n):t.onUpdateBody(n,{...n,value:l})},i=u=>t.onUpdateBody(n,{...n,purpose:u.value}),a=!t.readOnly&&t.annotation,s=r.length===0||!t.disableReply;return g.createElement(g.Fragment,null,r.map((u,c)=>g.createElement(J1,{key:c,env:t.env,purposeSelector:t.purposeSelector,readOnly:Ec(u,t),body:u,onUpdate:t.onUpdateBody,onDelete:t.onRemoveBody,onSaveAndClose:t.onSaveAndClose})),a&&s&&g.createElement("div",{className:"r6o-widget comment editable"},g.createElement(Zu,{focus:t.focus,content:n.value,editable:!0,placeholder:r.length>0?Se.t("Add a reply..."):t.textPlaceHolder||Se.t("Add a comment..."),onChange:o,onSaveAndClose:()=>t.onSaveAndClose()}),t.purposeSelector&&n.value.length>0&&g.createElement(Sc,{editable:!0,content:n.purpose,onChange:i,onSaveAndClose:()=>t.onSaveAndClose()})))};Cc.disableDelete=(t,e)=>t.bodies.filter(r=>_c(r,e.purposeSelector)).some(r=>Ec(r,e));var Ac=Cc;function wc(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,fr(t,e)}function eS(t,e){return t.classList?!!e&&t.classList.contains(e):(" "+(t.className.baseVal||t.className)+" ").indexOf(" "+e+" ")!==-1}function tS(t,e){t.classList?t.classList.add(e):eS(t,e)||(typeof t.className=="string"?t.className=t.className+" "+e:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+e))}function Oc(t,e){return t.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function nS(t,e){t.classList?t.classList.remove(e):typeof t.className=="string"?t.className=Oc(t.className,e):t.setAttribute("class",Oc(t.className&&t.className.baseVal||"",e))}var $c={disabled:!1},xc=g.createContext(null),an="unmounted",ct="exited",ft="entering",It="entered",hi="exiting",ze=function(t){wc(e,t);function e(r,o){var i;i=t.call(this,r,o)||this;var a=o,s=a&&!a.isMounting?r.enter:r.appear,u;return i.appearStatus=null,r.in?s?(u=ct,i.appearStatus=ft):u=It:r.unmountOnExit||r.mountOnEnter?u=an:u=ct,i.state={status:u},i.nextCallback=null,i}e.getDerivedStateFromProps=function(o,i){var a=o.in;return a&&i.status===an?{status:ct}:null};var n=e.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var a=this.state.status;this.props.in?a!==ft&&a!==It&&(i=ft):(a===ft||a===It)&&(i=hi)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,a,s;return i=a=s=o,o!=null&&typeof o!="number"&&(i=o.exit,a=o.enter,s=o.appear!==void 0?o.appear:a),{exit:i,enter:a,appear:s}},n.updateStatus=function(o,i){o===void 0&&(o=!1),i!==null?(this.cancelNextCallback(),i===ft?this.performEnter(o):this.performExit()):this.props.unmountOnExit&&this.state.status===ct&&this.setState({status:an})},n.performEnter=function(o){var i=this,a=this.props.enter,s=this.context?this.context.isMounting:o,u=this.props.nodeRef?[s]:[g.findDOMNode(this),s],c=u[0],l=u[1],f=this.getTimeouts(),d=s?f.appear:f.enter;if(!o&&!a||$c.disabled){this.safeSetState({status:It},function(){i.props.onEntered(c)});return}this.props.onEnter(c,l),this.safeSetState({status:ft},function(){i.props.onEntering(c,l),i.onTransitionEnd(d,function(){i.safeSetState({status:It},function(){i.props.onEntered(c,l)})})})},n.performExit=function(){var o=this,i=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:g.findDOMNode(this);if(!i||$c.disabled){this.safeSetState({status:ct},function(){o.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:hi},function(){o.props.onExiting(s),o.onTransitionEnd(a.exit,function(){o.safeSetState({status:ct},function(){o.props.onExited(s)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,i.nextCallback=null,o(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var a=this.props.nodeRef?this.props.nodeRef.current:g.findDOMNode(this),s=o==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],c=u[0],l=u[1];this.props.addEndListener(c,l)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===an)return null;var i=this.props,a=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var s=ei(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return g.createElement(xc.Provider,{value:null},typeof a=="function"?a(o,s):g.cloneElement(g.Children.only(a),s))},e}(g.Component);ze.contextType=xc,ze.propTypes={};function Rt(){}ze.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Rt,onEntering:Rt,onEntered:Rt,onExit:Rt,onExiting:Rt,onExited:Rt},ze.UNMOUNTED=an,ze.EXITED=ct,ze.ENTERING=ft,ze.ENTERED=It,ze.EXITING=hi;var rS=ze,oS=function(e,n){return e&&n&&n.split(" ").forEach(function(r){return tS(e,r)})},mi=function(e,n){return e&&n&&n.split(" ").forEach(function(r){return nS(e,r)})},vi=function(t){wc(e,t);function e(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(s,u){var c=r.resolveArguments(s,u),l=c[0],f=c[1];r.removeClasses(l,"exit"),r.addClass(l,f?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(s,u)},r.onEntering=function(s,u){var c=r.resolveArguments(s,u),l=c[0],f=c[1],d=f?"appear":"enter";r.addClass(l,d,"active"),r.props.onEntering&&r.props.onEntering(s,u)},r.onEntered=function(s,u){var c=r.resolveArguments(s,u),l=c[0],f=c[1],d=f?"appear":"enter";r.removeClasses(l,d),r.addClass(l,d,"done"),r.props.onEntered&&r.props.onEntered(s,u)},r.onExit=function(s){var u=r.resolveArguments(s),c=u[0];r.removeClasses(c,"appear"),r.removeClasses(c,"enter"),r.addClass(c,"exit","base"),r.props.onExit&&r.props.onExit(s)},r.onExiting=function(s){var u=r.resolveArguments(s),c=u[0];r.addClass(c,"exit","active"),r.props.onExiting&&r.props.onExiting(s)},r.onExited=function(s){var u=r.resolveArguments(s),c=u[0];r.removeClasses(c,"exit"),r.addClass(c,"exit","done"),r.props.onExited&&r.props.onExited(s)},r.resolveArguments=function(s,u){return r.props.nodeRef?[r.props.nodeRef.current,s]:[s,u]},r.getClassNames=function(s){var u=r.props.classNames,c=typeof u=="string",l=c&&u?u+"-":"",f=c?""+l+s:u[s],d=c?f+"-active":u[s+"Active"],p=c?f+"-done":u[s+"Done"];return{baseClassName:f,activeClassName:d,doneClassName:p}},r}var n=e.prototype;return n.addClass=function(o,i,a){var s=this.getClassNames(i)[a+"ClassName"],u=this.getClassNames("enter"),c=u.doneClassName;i==="appear"&&a==="done"&&c&&(s+=" "+c),a==="active"&&o&&o.scrollTop,s&&(this.appliedClasses[i][a]=s,oS(o,s))},n.removeClasses=function(o,i){var a=this.appliedClasses[i],s=a.base,u=a.active,c=a.done;this.appliedClasses[i]={},s&&mi(o,s),u&&mi(o,u),c&&mi(o,c)},n.render=function(){var o=this.props;o.classNames;var i=ei(o,["classNames"]);return g.createElement(rS,T({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e}(g.Component);vi.defaultProps={classNames:""},vi.propTypes={};var iS=vi;const aS=(t,e)=>e.filter(n=>(n.label?n.label:n).toLowerCase().startsWith(t.toLowerCase())),sS=(t,e)=>e(t);var uS=t=>{const e=$e(),[n,r]=Ve(t.initialValue||""),[o,i]=Ve([]),[a,s]=Ve(null);tt(()=>{t.focus&&e.current.querySelector("input").focus({preventScroll:!0})},[]),tt(()=>{t.onChange&&t.onChange(n)},[n]);const u=d=>{if(typeof t.vocabulary=="function"){const p=sS(d,t.vocabulary);p.then?p.then(i):i(p)}else{const p=aS(d,t.vocabulary);i(p)}},c=()=>{if(a!==null)t.onSubmit(o[a]);else{const d=n.trim();if(d){const p=Array.isArray(t.vocabulary)?t.vocabulary.find(m=>(m.label||m).toLowerCase()===d.toLowerCase()):null;p?t.onSubmit(p):t.onSubmit(d)}}r(""),i([]),s(null)},l=d=>{if(d.which===13)c();else if(d.which===27)t.onCancel&&t.onCancel();else if(o.length>0){if(d.which===38)if(a===null)s(0);else{const p=Math.max(0,a-1);s(p)}else if(d.which===40)if(a===null)s(0);else{const p=Math.min(o.length-1,a+1);s(p)}}else d.which===40&&Array.isArray(t.vocabulary)&&i(t.vocabulary)},f=d=>{const{value:p}=d.target;r(p),s(null),p?u(p):i([])};return g.createElement("div",{ref:e,className:"r6o-autocomplete"},g.createElement("div",null,g.createElement("input",{onKeyDown:l,onChange:f,value:n,placeholder:t.placeholder})),g.createElement("ul",null,o.length>0&&o.map((d,p)=>g.createElement("li",{key:`${d.label?d.label:d}${p}`,onClick:c,onMouseEnter:()=>s(p),style:a===p?{backgroundColor:"#bde4ff"}:{}},d.label?d.label:d))))};const lS=t=>t||{type:"TextualBody",value:"",purpose:"tagging",draft:!0};var Pc=t=>{const e=t.annotation?t.annotation.bodies.filter(f=>f.purpose==="tagging"):[],n=lS(e.slice().reverse().find(f=>f.draft)),r=e.filter(f=>f!=n),[o,i]=Ve(!1),a=f=>d=>{i(o===f?!1:f)},s=f=>{const d=n.value.trim(),p=f.trim();d.length===0&&p.length>0?t.onAppendBody({...n,value:p}):d.length>0&&p.length===0?t.onRemoveBody(n):d!==p&&t.onUpdateBody(n,{...n,value:p})},u=f=>d=>{d.stopPropagation(),t.onRemoveBody(f)},c=f=>{const d=f.uri?{type:"SpecificResource",purpose:"tagging",source:{id:f.uri,label:f.label}}:{type:"TextualBody",purpose:"tagging",value:f.label||f};n.value.trim().length===0?t.onAppendBody(d):t.onUpdateBody(n,d)},l=f=>f.value||f.source.label;return g.createElement("div",{className:"r6o-widget r6o-tag"},r.length>0&&g.createElement("ul",{className:"r6o-taglist"},r.map(f=>g.createElement("li",{key:l(f),onClick:a(f)},g.createElement("span",{className:"r6o-label"},l(f)),!t.readOnly&&g.createElement(iS,{in:o===f,timeout:200,classNames:"r6o-delete"},g.createElement("span",{className:"r6o-delete-wrapper",onClick:u(f)},g.createElement("span",{className:"r6o-delete"},g.createElement(X1,{width:12}))))))),!t.readOnly&&g.createElement(uS,{focus:t.focus,placeholder:t.textPlaceHolder||Se.t("Add tag..."),vocabulary:t.vocabulary||[],onChange:s,onSubmit:c}))};class Dc extends J{constructor(e){super(e),this.element=g.createRef()}renderWidget(e){const n=this.props.widget({annotation:e.annotation,readOnly:e.readOnly,...e.config,onAppendBody:(r,o)=>e.onAppendBody(r,o),onUpdateBody:(r,o,i)=>e.onUpdateBody(r,o,i),onUpsertBody:(r,o,i)=>e.onUpsertBody(r,o,i),onRemoveBody:(r,o)=>e.onRemoveBody(r,o),onBatchModify:(r,o)=>e.onBatchModify(r,o),onSetProperty:(r,o)=>e.onSetProperty(r,o),onAddContext:r=>e.onAddContext(r),onSaveAndClose:()=>e.onSaveAndClose()});for(;this.element.current.firstChild;)this.element.current.removeChild(this.element.current.lastChild);this.element.current.appendChild(n)}componentDidMount(){this.renderWidget(this.props)}componentWillReceiveProps(e){this.element.current&&this.props.annotation!==e.annotation&&this.renderWidget(e)}render(){return g.createElement("div",{ref:this.element,className:"widget"})}}window.React=g,window.ReactDOM=g;const cS={COMMENT:Ac,TAG:Pc},fS=[g.createElement(Ac,null),g.createElement(Pc,null)],dS=t=>{const e=r=>{var o;return typeof r=="function"&&!!((o=r.prototype)!=null&&o.isReactComponent)},n=r=>typeof r=="function"&&(String(r).match(/return .+\(['|"].+['|"],\s*\{/g)||String(r).match(/return .+preact_compat/)||String(r).match(/return .+\.createElement/g));return e(t)||n(t)},pS=t=>{const e=(n,r,o)=>{if(typeof n=="string"||n instanceof String)return g.createElement(cS[n],r);if((o==null?void 0:o.toLowerCase())==="react")return g.createElement(n,r);if((o==null?void 0:o.toLowerCase())==="plainjs")return g.createElement(Dc,{widget:n,config:r});if(dS(n))return g.createElement(n,r);if(typeof n=="function"||n instanceof Function)return g.createElement(Dc,{widget:n,config:r});throw`${n} is not a valid plugin`};if(t.widget){const{widget:n,force:r,...o}=t;return e(n,o,r)}else return e(t)},Tc=14;var Mc=(t,e,n,r)=>{const o=t.getBoundingClientRect();e.className="r6o-editor r6o-arrow-top r6o-arrow-left";const{left:i,top:a,right:s,bottom:u}=n.getBoundingClientRect();if(e.style.top=`${u-o.top+Tc}px`,e.style.left=`${i-o.left}px`,r){const c=e.children[1].getBoundingClientRect(),{innerWidth:l,innerHeight:f}=t.ownerDocument.defaultView;if(c.right>l&&(e.classList.remove("r6o-arrow-left"),e.classList.add("r6o-arrow-right"),e.style.left=`${s-c.width-o.left}px`),c.bottom>f){e.classList.remove("r6o-arrow-top"),e.classList.add("r6o-arrow-bottom");const p=e.children[1].getBoundingClientRect().height;e.style.top=`${a-o.top-p-Tc}px`}const d=e.children[1].getBoundingClientRect();if(d.top<0){e.classList.add("pushed","down"),e.style.top=`${-o.top}px`;const p=u-o.top;d.height-o.top>p&&e.classList.remove("r6o-arrow-bottom")}d.left<0&&(e.classList.add("pushed","right"),e.style.left=`${-o.left}px`),requestAnimationFrame(()=>e.style.opacity=1)}};const kc=t=>{const{top:e,left:n,width:r,height:o}=t.getBoundingClientRect();return`${e}, ${n}, ${r}, ${o}`};class hS extends J{constructor(n){super(n);h(this,"initResizeObserver",()=>{const n=this.props.autoPosition===void 0?!0:this.props.autoPosition;if(window!=null&&window.ResizeObserver){const r=new ResizeObserver(()=>{this.state.dragged||Mc(this.props.wrapperEl,this.element.current,this.props.selectedElement,n)});return r.observe(this.props.wrapperEl),()=>r.disconnect()}else this.state.dragged||Mc(this.props.wrapperEl,this.element.current,this.props.selectedElement,n)});h(this,"creationMeta",n=>{const r={},{user:o}=this.props.env;return o&&(r.creator={},o.id&&(r.creator.id=o.id),o.displayName&&(r.creator.name=o.displayName),r[n.created?"modified":"created"]=this.props.env.getCurrentTimeAdjusted()),r});h(this,"getCurrentAnnotation",()=>this.state.currentAnnotation.clone());h(this,"hasChanges",()=>{var n;return!((n=this.props.annotation)!=null&&n.isEqual(this.state.currentAnnotation))});h(this,"updateCurrentAnnotation",(n,r)=>{this.setState({currentAnnotation:this.state.currentAnnotation.clone(n)},()=>{r?this.onOk():this.props.onChanged&&this.props.onChanged()})});h(this,"onAppendBody",(n,r)=>this.updateCurrentAnnotation({body:[...this.state.currentAnnotation.bodies,{...n,...this.creationMeta(n)}]},r));h(this,"onUpdateBody",(n,r,o)=>this.updateCurrentAnnotation({body:this.state.currentAnnotation.bodies.map(i=>i===n?{...r,...this.creationMeta(r)}:i)},o));h(this,"onRemoveBody",(n,r)=>this.updateCurrentAnnotation({body:this.state.currentAnnotation.bodies.filter(o=>o!==n)},r));h(this,"onUpsertBody",(n,r,o)=>{if(n==null&&r!=null)this.onAppendBody(r,o);else if(n!=null&&r!=null)this.onUpdateBody(n,r,o);else if(n!=null&&r==null){const i=this.state.currentAnnotation.bodies.find(a=>a.purpose===n.purpose);i?this.onUpdateBody(i,n,o):this.onAppendBody(n,o)}});h(this,"onBatchModify",(n,r)=>{const o=n.filter(c=>c.action==="upsert"&&c.body).map(c=>({previous:this.state.currentAnnotation.bodies.find(l=>l.purpose===c.body.purpose),updated:{...c.body,...this.creationMeta(c.body)}})),i=n.filter(c=>c.action==="remove").map(c=>c.body),a=[...n.filter(c=>c.action==="append"||c.action==="upsert"&&c.updated&&!c.previous).map(c=>({...c.body,...this.creationMeta(c.body)})),...o.filter(c=>!c.previous).map(c=>c.updated)],s=[...n.filter(c=>c.action==="update"||c.action==="upsert"&&c.updated&&c.previous).map(c=>({previous:c.previous,updated:{...c.updated,...this.creationMeta(c.updated)}})),...o.filter(c=>c.previous)],u=[...this.state.currentAnnotation.bodies.filter(c=>!i.includes(c)).map(c=>{const l=s.find(f=>f.previous===c);return l?l.updated:c}),...a];this.updateCurrentAnnotation({body:u},r)});h(this,"onSetProperty",(n,r)=>{if(["@context","id","type","body","target"].includes(n))throw new Exception(`Cannot set ${n} - not allowed`);if(r)this.updateCurrentAnnotation({[n]:r});else{const i=this.currentAnnotation.clone();delete i[n],this.setState({currentAnnotation:i})}});h(this,"onAddContext",n=>{const{currentAnnotation:r}=this.state,o=Array.isArray(r.context)?r.context:[r.context];o.indexOf(n)<0&&(o.push(n),this.updateCurrentAnnotation({"@context":o}))});h(this,"onCancel",()=>this.props.onCancel(this.props.annotation));h(this,"onOk",()=>{const n=o=>o.clone({body:o.bodies.map(({draft:i,...a})=>a)}),{currentAnnotation:r}=this.state;r.bodies.length===0&&!this.props.allowEmpty?r.isSelection?this.onCancel():this.props.onAnnotationDeleted(this.props.annotation):r.isSelection?this.props.onAnnotationCreated(n(r).toAnnotation()):this.props.onAnnotationUpdated(n(r),this.props.annotation)});h(this,"onDelete",()=>this.props.onAnnotationDeleted(this.props.annotation));this.element=g.createRef(),this.state={currentAnnotation:n.annotation,dragged:!1,selectionBounds:kc(n.selectedElement)}}componentWillReceiveProps(n){var i;const{selectionBounds:r}=this.state,o=kc(n.selectedElement);(i=this.props.annotation)!=null&&i.isEqual(n.annotation)?this.setState({selectionBounds:o}):this.setState({currentAnnotation:n.annotation,selectionBounds:o}),this.props.modifiedTarget!=n.modifiedTarget&&this.state.currentAnnotation&&this.updateCurrentAnnotation({target:this.props.modifiedTarget}),r!=o&&this.element.current&&(this.removeObserver&&this.removeObserver(),this.removeObserver=this.initResizeObserver())}componentDidMount(){this.removeObserver=this.initResizeObserver(),new MutationObserver(()=>{this.element.current&&(this.removeObserver&&this.removeObserver(),this.removeObserver=this.initResizeObserver())}).observe(this.element.current,{childList:!0,subtree:!0})}componentWillUnmount(){this.removeObserver&&this.removeObserver()}render(){const{currentAnnotation:n}=this.state,r=this.props.widgets?this.props.widgets.map(pS):fS,o=a=>a.type.disableDelete?a.type.disableDelete(n,{...a.props,readOnly:this.props.readOnly,env:this.props.env}):!1,i=n&&(n.bodies.length>0||this.props.allowEmpty)&&!this.props.readOnly&&!n.isSelection&&!r.some(o);return g.createElement(Md,{disabled:!this.props.detachable,handle:".r6o-draggable",cancel:".r6o-btn, .r6o-btn *",onDrag:()=>this.setState({dragged:!0})},g.createElement("div",{ref:this.element,className:this.state.dragged?"r6o-editor dragged":"r6o-editor"},g.createElement("div",{className:"r6o-arrow"}),g.createElement("div",{className:"r6o-editor-inner"},r.map((a,s)=>g.cloneElement(a,{key:`${s}`,focus:s===0,annotation:n,readOnly:this.props.readOnly,env:this.props.env,onAppendBody:this.onAppendBody,onUpdateBody:this.onUpdateBody,onRemoveBody:this.onRemoveBody,onUpsertBody:this.onUpsertBody,onBatchModify:this.onBatchModify,onSetProperty:this.onSetProperty,onAddContext:this.onAddContext,onSaveAndClose:this.onOk})),this.props.readOnly?g.createElement("div",{className:"r6o-footer"},g.createElement("button",{className:"r6o-btn",onClick:this.onCancel},Se.t("Close"))):g.createElement("div",{className:this.props.detachable?"r6o-footer r6o-draggable":"r6o-footer"},i&&g.createElement("button",{className:"r6o-btn left delete-annotation",title:Se.t("Delete"),onClick:this.onDelete},g.createElement(K1,{width:12})),g.createElement("button",{className:"r6o-btn outline",onClick:this.onCancel},Se.t("Cancel")),g.createElement("button",{className:"r6o-btn ",onClick:this.onOk},Se.t("Ok"))))))}}var Sr,mS=new Uint8Array(16);function vS(){if(!Sr&&(Sr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Sr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Sr(mS)}var gS=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yS(t){return typeof t=="string"&&gS.test(t)}for(var ae=[],gi=0;gi<256;++gi)ae.push((gi+256).toString(16).substr(1));function bS(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ae[t[e+0]]+ae[t[e+1]]+ae[t[e+2]]+ae[t[e+3]]+"-"+ae[t[e+4]]+ae[t[e+5]]+"-"+ae[t[e+6]]+ae[t[e+7]]+"-"+ae[t[e+8]]+ae[t[e+9]]+"-"+ae[t[e+10]]+ae[t[e+11]]+ae[t[e+12]]+ae[t[e+13]]+ae[t[e+14]]+ae[t[e+15]]).toLowerCase();if(!yS(n))throw TypeError("Stringified UUID is invalid");return n}function Fc(t,e,n){t=t||{};var r=t.random||(t.rng||vS)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=r[o];return e}return bS(r)}var SS=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var a=i[o];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n},Ic=SS;const Ar=class{constructor(e,n){h(this,"clone",(e,n)=>new Ar({...this.underlying,...e},{...this.opts,...n}));h(this,"selector",e=>{const{target:n}=this.underlying;if(n.selector)return(Array.isArray(n.selector)?n.selector:[n.selector]).find(o=>o.type===e)});this.underlying=e,this.opts=n}isEqual(e){return(e==null?void 0:e.type)!=="Annotation"?!1:this.underlying===e.underlying?!0:!this.underlying.id||!e.underlying.id?!1:Ic(this.underlying,e.underlying)}get readOnly(){var e;return(e=this.opts)==null?void 0:e.readOnly}get id(){return this.underlying.id}get context(){return this.underlying["@context"]}get type(){return this.underlying.type}get motivation(){return this.underlying.motivation}get body(){return this.underlying.body}get target(){return this.underlying.target}get bodies(){return Array.isArray(this.underlying.body)?this.underlying.body:[this.underlying.body]}set bodies(e){this.underlying.body=e}get targets(){return Array.isArray(this.underlying.target)?this.underlying.target:[this.underlying.target]}get quote(){var e;return(e=this.selector("TextQuoteSelector"))==null?void 0:e.exact}get start(){var e;return(e=this.selector("TextPositionSelector"))==null?void 0:e.start}get end(){var e;return(e=this.selector("TextPositionSelector"))==null?void 0:e.end}};let Je=Ar;h(Je,"create",e=>{const n={"@context":"http://www.w3.org/ns/anno.jsonld",type:"Annotation",id:`#${Fc()}`,body:[]};return new Ar({...n,...e})});class sn{constructor(e,n){h(this,"clone",e=>{const n=new sn;return n.underlying=JSON.parse(JSON.stringify(this.underlying)),e&&(n.underlying={...n.underlying,...e}),n});h(this,"selector",e=>{const{target:n}=this.underlying;if(n.selector)return(Array.isArray(n.selector)?n.selector:[n.selector]).find(o=>o.type===e)});h(this,"toAnnotation",()=>{const e=Object.assign({},this.underlying,{type:"Annotation",id:`#${Fc()}`});return new Je(e)});this.underlying={"@context":"http://www.w3.org/ns/anno.jsonld",type:"Selection",body:n||[],target:e}}get context(){return this.underlying["@context"]}get type(){return this.underlying.type}get body(){return this.underlying.body}get target(){return this.underlying.target}get targets(){return Array.isArray(this.underlying.target)?this.underlying.target:[this.underlying.target]}isEqual(e){return e?Ic(this.underlying,e.underlying):!1}get bodies(){return Array.isArray(this.underlying.body)?this.underlying.body:[this.underlying.body]}get quote(){var e;return(e=this.selector("TextQuoteSelector"))==null?void 0:e.exact}get isSelection(){return!0}}let yi=0;var _S=()=>({setServerTime:t=>{const e=Date.now();yi=t-e},getCurrentTimeAdjusted:()=>new Date(Date.now()+yi).toISOString(),toClientTime:t=>Date.parse(t)-yi});const ES=(t,e)=>{if(t){const n=t==="auto"?window.navigator.userLanguage||window.navigator.language:t,r=n.split("-")[0].toLowerCase(),o=[n,r].find(i=>My.includes(i));o||console.warn(`Unsupported locale '${n}'. Falling back to default en.`),Se.init(o,e)}else Se.init(null,e)};class CS{constructor(e,n,r,o,i){h(this,"dragTo",(e,n)=>{this.group.style.display=null,this.opposite=[e,n];const{x:r,y:o,w:i,h:a}=this.bbox;Ea(this.mask,this.env.image,r,o,i,a),Ca(this.rect,r,o,i,a)});h(this,"getBoundingClientRect",()=>this.rect.getBoundingClientRect());h(this,"toSelection",()=>{const{x:e,y:n,w:r,h:o}=this.bbox;return new sn(zr(e,n,r,o,this.env.image,this.config.fragmentUnit))});h(this,"destroy",()=>{this.group.parentNode.removeChild(this.group),this.mask=null,this.rect=null,this.group=null});this.anchor=[e,n],this.opposite=[e,n],this.config=o,this.env=i,this.group=document.createElementNS(B,"g"),this.mask=_a(i.image,e,n,2,2),this.mask.setAttribute("class","a9s-selection-mask"),this.rect=Wr(e,n,2,2),this.rect.setAttribute("class","a9s-selection"),this.group.style.pointerEvents="none",this.group.style.display="none",this.group.appendChild(this.mask),this.group.appendChild(this.rect),r.appendChild(this.group)}get bbox(){const e=this.opposite[0]-this.anchor[0],n=this.opposite[1]-this.anchor[1];return{x:e>0?this.anchor[0]:this.opposite[0],y:n>0?this.anchor[1]:this.opposite[1],w:Math.max(1,Math.abs(e)),h:Math.max(1,Math.abs(n))}}get element(){return this.rect}}const AS={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"},Rc=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,wS=t=>{let e=null;const n=(o,i)=>new MouseEvent(o,{screenX:i.screenX,screenY:i.screenY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,bubbles:!0}),r=o=>{const i=o.changedTouches[0],a=n(AS[o.type],i);i.target.dispatchEvent(a),o.preventDefault(),(o.type==="touchstart"||o.type==="touchmove")&&(e&&clearTimeout(e),e=setTimeout(()=>{const s=n("dblclick",i);i.target.dispatchEvent(s)},800)),o.type==="touchend"&&e&&clearTimeout(e)};t.addEventListener("touchstart",r,!0),t.addEventListener("touchmove",r,!0),t.addEventListener("touchend",r,!0),t.addEventListener("touchcancel",r,!0)},_r="An implementation is missing",OS=Rc();class Nc extends mn{constructor(n,r,o){super();h(this,"enableResponsive",()=>{window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{const n=this.svg.getBoundingClientRect(),{width:r,height:o}=this.svg.viewBox.baseVal;this.scale=Math.max(r/n.width,o/n.height),this.onScaleChanged&&this.onScaleChanged(this.scale)}),this.resizeObserver.observe(this.svg.parentNode))});h(this,"getSVGPoint",n=>{const r=this.svg.createSVGPoint();if(OS){const o=this.svg.getBoundingClientRect(),i=n.clientX-o.x,a=n.clientY-o.y,{left:s,top:u}=this.svg.getBoundingClientRect();return r.x=i+s,r.y=a+u,r.matrixTransform(this.g.getScreenCTM().inverse())}else return r.x=n.offsetX,r.y=n.offsetY,r.matrixTransform(this.g.getCTM().inverse())});h(this,"drawHandle",(n,r)=>{const o=document.createElementNS(B,"g");o.setAttribute("class","a9s-handle");const i=document.createElementNS(B,"g"),a=l=>{const f=document.createElementNS(B,"circle");return f.setAttribute("cx",n),f.setAttribute("cy",r),f.setAttribute("r",l),f.setAttribute("transform-origin",`${n} ${r}`),f},s=this.config.handleRadius||6,u=a(s);u.setAttribute("class","a9s-handle-inner");const c=a(s+1);return c.setAttribute("class","a9s-handle-outer"),i.appendChild(c),i.appendChild(u),o.appendChild(i),o});h(this,"setHandleXY",(n,r,o)=>{const i=n.querySelector(".a9s-handle-inner");i.setAttribute("cx",r),i.setAttribute("cy",o),i.setAttribute("transform-origin",`${r} ${o}`);const a=n.querySelector(".a9s-handle-outer");a.setAttribute("cx",r),a.setAttribute("cy",o),a.setAttribute("transform-origin",`${r} ${o}`)});h(this,"getHandleXY",n=>{const r=n.querySelector(".a9s-handle-outer");return{x:parseFloat(r.getAttribute("cx")),y:parseFloat(r.getAttribute("cy"))}});h(this,"scaleHandle",n=>{const r=n.querySelector(".a9s-handle-inner"),o=n.querySelector(".a9s-handle-outer"),i=this.scale*(this.config.handleRadius||6);r.setAttribute("r",i),o.setAttribute("r",i)});this.svg=n.closest("svg"),this.g=n,this.config=r,this.env=o,this.scale=1;const{image:i}=o;(i instanceof Element||i instanceof HTMLDocument)&&this.enableResponsive()}destroy(){this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeObserver=null}}class bi extends Nc{constructor(n,r,o){super(n,r,o);h(this,"attachListeners",({mouseMove:n,mouseUp:r,mouseDown:o,dblClick:i})=>{n&&(this.mouseMove=a=>{const{x:s,y:u}=this.getSVGPoint(a);this.started||(this.emit("startSelection",{x:s,y:u}),this.started=!0),n(s,u,a)},this.svg.addEventListener("mousemove",this.mouseMove)),r&&(this.mouseUp=a=>{if(a.button!==0)return;const{x:s,y:u}=this.getSVGPoint(a);r(s,u,a)},document.addEventListener("mouseup",this.mouseUp)),o&&(this.mouseDown=a=>{if(a.button!==0)return;const{x:s,y:u}=this.getSVGPoint(a);o(s,u,a)},document.addEventListener("mousedown",this.mouseDown)),i&&(this.dblClick=a=>{const{x:s,y:u}=this.getSVGPoint(a);i(s,u,a)},document.addEventListener("dblclick",this.dblClick))});h(this,"detachListeners",()=>{this.mouseMove&&this.svg.removeEventListener("mousemove",this.mouseMove),this.mouseUp&&document.removeEventListener("mouseup",this.mouseUp),this.mouseDown&&document.removeEventListener("mousedown",this.mouseDown),this.dblClick&&document.removeEventListener("dblclick",this.dblClick)});h(this,"start",(n,r)=>{const{x:o,y:i}=this.getSVGPoint(n),{naturalWidth:a,naturalHeight:s}=this.env.image,u=o<0?0:o>a?a:o,c=i<0?0:i>s?s:i;this.startDrawing(u,c,r,n)});h(this,"startDrawing",n=>{throw new Error(_r)});h(this,"createEditableShape",(n,r)=>{throw new Error(_r)});this.started=!1}get isDrawing(){throw new Error(_r)}}bi.supports=t=>{throw new Error(_r)};const Lc="An implementation is missing";class Bc extends Nc{constructor(n,r,o,i){super(r,o,i);h(this,"updateState",n=>{throw new Error(Lc)});this.annotation=n}get element(){throw new Error(Lc)}}const $S=/firefox/i.test(navigator.userAgent),Vc=(t,e,n,r,o)=>{t.setAttribute("width",r),t.setAttribute("height",o),$S?(t.setAttribute("x",0),t.setAttribute("y",0),t.setAttribute("transform",`translate(${e}, ${n})`)):(t.setAttribute("x",e),t.setAttribute("y",n))},xS=(t,e)=>{const r=e.querySelector(".a9s-inner")||e,{x:o,y:i,width:a,height:s}=r.getBBox(),u=document.createElementNS(B,"svg");u.setAttribute("class","a9s-formatter-el"),Vc(u,o,i,a,s);const c=document.createElementNS(B,"g");c.appendChild(t),u.appendChild(c),e.append(u)},Si=(t,e,n)=>{if(!n)return t;const r=n.reduce((u,c)=>{const l=c(e);if(!l)return u;if(typeof l=="string"||l instanceof String)u.className=u.className?`${u.className} ${l}`:l;else if(l.nodeType===Node.ELEMENT_NODE)u.elements=u.elements?[...u.elements,l]:[l];else{const{className:f,style:d,shapeStyle:p,element:m}=l;f&&(u.className=u.className?`${u.className} ${f}`:f),d&&(u.style=u.style?`${u.style} ${d}`:d),p&&(u.shapeStyle=u.shapeStyle?`${u.shapeStyle} ${p}`:p),m&&(u.elements=u.elements?[...u.elements,m]:[m])}for(const f in l)l.hasOwnProperty(f)&&f.startsWith("data-")&&(u[f]=l[f]);return u},{}),{className:o,style:i,shapeStyle:a,elements:s}=r;if(o&&gt(t,o),i){const u=t.querySelector(".a9s-outer"),c=t.querySelector(".a9s-inner");u&&c?(u.setAttribute("style","display:none"),c.setAttribute("style",i)):t.setAttribute("style",i)}a&&t.setAttribute("style",a),s&&s.forEach(u=>xS(u,t));for(const u in r)r.hasOwnProperty(u)&&u.startsWith("data-")&&t.setAttribute(u,r[u])},Hc=(t,e,n,r,o)=>{const i=t.querySelector(".a9s-formatter-el");i&&Vc(i,e,n,r,o)},un="corner",Er="edge";class PS extends Bc{constructor(n,r,o,i){super(n,r,o,i);h(this,"onScaleChanged",()=>this.handles.map(this.scaleHandle));h(this,"setSize",(n,r,o,i)=>{Ca(this.rectangle,n,r,o,i),Ea(this.mask,this.env.image,n,r,o,i),Hc(this.elementGroup,n,r,o,i);const[a,s,u,c,l,f,d,p]=this.handles;this.setHandleXY(a,n,r),this.setHandleXY(s,n+o,r),this.setHandleXY(u,n+o,r+i),this.setHandleXY(c,n,r+i),this.enableEdgeControls&&(this.setHandleXY(l,n+o/2,r),this.setHandleXY(f,n+o,r+i/2),this.setHandleXY(d,n+o/2,r+i),this.setHandleXY(p,n,r+i/2))});h(this,"stretchCorners",(n,r,o)=>{const i=this.getHandleXY(r),a=o.x-i.x,s=o.y-i.y,u=a>0?i.x:o.x,c=s>0?i.y:o.y,l=Math.abs(a),f=Math.abs(s);return this.setSize(u,c,l,f),{x:u,y:c,w:l,h:f}});h(this,"stretchEdge",(n,r,o)=>{const i=this.getHandleXY(r),a=Gr(this.rectangle),s=n%2===0,u=s?a.w:o.x-i.x,c=s?o.y-i.y:a.h,l=s?a.x:u>0?i.x:o.x,f=s?c>0?i.y:o.y:a.y,d=Math.abs(u),p=Math.abs(c);return this.setSize(l,f,d,p),{x:l,y:f,w:d,h:p}});h(this,"onGrab",(n,r)=>o=>{if(o.button!==0)return;this.grabbedElem=n,this.grabbedType=r;const i=this.getSVGPoint(o),{x:a,y:s}=Gr(this.rectangle);this.mouseOffset={x:i.x-a,y:i.y-s}});h(this,"onMouseMove",n=>{if(n.button!==0)return;const r=(a,s)=>a<0?0:a>s?s:a,{naturalWidth:o,naturalHeight:i}=this.env.image;if(this.grabbedElem){const a=this.getSVGPoint(n);if(this.grabbedElem===this.rectangle){const{w:s,h:u}=Gr(this.rectangle),c=r(a.x-this.mouseOffset.x,o-s),l=r(a.y-this.mouseOffset.y,i-u);this.setSize(c,l,s,u),this.emit("update",zr(c,l,s,u,this.env.image,this.config.fragmentUnit))}else{const s=this.handles.indexOf(this.grabbedElem),u=this.handles[s^2],c={x:Math.min(Math.max(a.x,0),o),y:Math.min(Math.max(a.y,0),i)},{x:l,y:f,w:d,h:p}=this.grabbedType===un?this.stretchCorners(s,u,c):this.stretchEdge(s,u,c);this.emit("update",zr(l,f,d,p,this.env.image,this.config.fragmentUnit))}}});h(this,"onMouseUp",n=>{this.grabbedElem=null,this.grabbedType=null,this.mouseOffset=null});h(this,"updateState",n=>{const{x:r,y:o,w:i,h:a}=vn(n,this.env.image);this.setSize(r,o,i,a)});h(this,"detachListeners",()=>{this.svg.removeEventListener("mousemove",this.onMouseMove),this.svg.removeEventListener("mouseup",this.onMouseUp)});this.svg.addEventListener("mousemove",this.onMouseMove),this.svg.addEventListener("mouseup",this.onMouseUp);const{x:a,y:s,w:u,h:c}=vn(n,i.image);this.containerGroup=document.createElementNS(B,"g"),this.mask=_a(i.image,a,s,u,c),this.mask.setAttribute("class","a9s-selection-mask"),this.containerGroup.appendChild(this.mask),this.elementGroup=document.createElementNS(B,"g"),this.elementGroup.setAttribute("class","a9s-annotation editable selected"),this.elementGroup.setAttribute("data-id",n.id),this.rectangle=Wr(a,s,u,c),this.rectangle.querySelector(".a9s-inner").addEventListener("mousedown",this.onGrab(this.rectangle)),this.elementGroup.appendChild(this.rectangle),this.enableEdgeControls=o.enableEdgeControls;const l=this.enableEdgeControls?[[a+u/2,s,Er],[a+u,s+c/2,Er],[a+u/2,s+c,Er],[a,s+c/2,Er]]:[];this.handles=[[a,s,un],[a+u,s,un],[a+u,s+c,un],[a,s+c,un],...l].map(f=>{const[d,p,m]=f,b=this.drawHandle(d,p);return b.addEventListener("mousedown",this.onGrab(b,m)),this.elementGroup.appendChild(b),b}),this.containerGroup.appendChild(this.elementGroup),r.appendChild(this.containerGroup),Si(this.elementGroup,n,o.formatters),this.grabbedElem=null,this.grabbedType=null,this.mouseOffset=null}get element(){return this.elementGroup}destroy(){this.detachListeners(),this.containerGroup.parentNode.removeChild(this.containerGroup),super.destroy()}}class Cr extends bi{constructor(n,r,o){super(n,r,o);h(this,"startDrawing",(n,r)=>{this.attachListeners({mouseMove:this.onMouseMove,mouseUp:this.onMouseUp}),this.rubberband=new CS(n,r,this.g,this.config,this.env)});h(this,"stop",()=>{this.detachListeners(),this.rubberband&&(this.rubberband.destroy(),this.rubberband=null)});h(this,"onMouseMove",(n,r)=>{const{naturalWidth:o,naturalHeight:i}=this.env.image,a=Math.min(Math.max(n,0),o),s=Math.min(Math.max(r,0),i);this.rubberband.dragTo(a,s)});h(this,"onMouseUp",()=>{this.started=!1;const{width:n,height:r}=this.rubberband.getBoundingClientRect(),o=this.config.minSelectionWidth||4,i=this.config.minSelectionHeight||4;if(n>=o&&r>=i){const{element:a}=this.rubberband;a.annotation=this.rubberband.toSelection(),this.emit("complete",a)}else this.emit("cancel");this.stop()});h(this,"createEditableShape",(n,r)=>new PS(n,this.g,{...this.config,formatters:r},this.env));this.rubberband=null}get isDrawing(){return this.rubberband!=null}}Cr.identifier="rect",Cr.supports=t=>{const e=t.selector("FragmentSelector");return e==null?void 0:e.conformsTo.startsWith("http://www.w3.org/TR/media-frags")};class Uc{constructor(e,n){h(this,"redraw",()=>{this.mask.setAttribute("d",`M0 0 h${this.w} v${this.h} h-${this.w} z M${this.polygon.getAttribute("points")} z`)});h(this,"destroy",()=>this.mask.parentNode.removeChild(this.mask));this.w=e.naturalWidth,this.h=e.naturalHeight,this.polygon=n,this.mask=document.createElementNS(B,"path"),this.mask.setAttribute("fill-rule","evenodd"),this.mask.setAttribute("class","a9s-selection-mask"),this.mask.setAttribute("d",`M0 0 h${this.w} v${this.h} h-${this.w} z M${this.polygon.getAttribute("points")} z`)}get element(){return this.mask}}class DS{constructor(e,n,r){h(this,"setPoints",e=>{const n=e.map(r=>`${r[0]},${r[1]}`).join(" ");this.outer.setAttribute("points",n),this.inner.setAttribute("points",n)});h(this,"getBoundingClientRect",()=>this.outer.getBoundingClientRect());h(this,"dragTo",e=>{this.group.style.display=null,this.mousepos=e;const n=[...this.points,e];this.setPoints(n),this.mask.redraw()});h(this,"addPoint",()=>{const[e,n]=this.mousepos,r=this.points[this.points.length-1];Math.pow(e-r[0],2)+Math.pow(n-r[1],2)>4&&(this.points=[...this.points,this.mousepos],this.setPoints(this.points),this.mask.redraw())});h(this,"destroy",()=>{this.group.parentNode.removeChild(this.group),this.polygon=null,this.group=null});h(this,"toSelection",()=>new sn(Yr(this.group,this.env.image)));this.points=[e],this.env=r,this.mousepos=e,this.group=document.createElementNS(B,"g"),this.polygon=document.createElementNS(B,"g"),this.polygon.setAttribute("class","a9s-selection"),this.outer=document.createElementNS(B,"polygon"),this.outer.setAttribute("class","a9s-outer"),this.inner=document.createElementNS(B,"polygon"),this.inner.setAttribute("class","a9s-inner"),this.setPoints(this.points),this.mask=new Uc(r.image,this.inner),this.polygon.appendChild(this.outer),this.polygon.appendChild(this.inner),this.group.style.display="none",this.group.appendChild(this.mask.element),this.group.appendChild(this.polygon),n.appendChild(this.group)}get element(){return this.polygon}}const _i=t=>{const e=t.querySelector(".a9s-inner").points,n=[];for(let r=0;r<e.numberOfItems;r++)n.push(e.getItem(r));return n},TS=t=>t.querySelector(".a9s-inner").getBBox();class MS extends Bc{constructor(n,r,o,i){super(n,r,o,i);h(this,"onScaleChanged",()=>this.handles.map(this.scaleHandle));h(this,"setPoints",n=>{const r=f=>Math.round(10*f)/10,o=n.map(f=>`${r(f.x)},${r(f.y)}`).join(" "),i=this.shape.querySelector(".a9s-inner");i.setAttribute("points",o),this.shape.querySelector(".a9s-outer").setAttribute("points",o),this.mask.redraw();const{x:s,y:u,width:c,height:l}=i.getBBox();Hc(this.elementGroup,s,u,c,l)});h(this,"onGrab",n=>r=>{r.button===0&&(this.grabbedElem=n,this.grabbedAt=this.getSVGPoint(r))});h(this,"onMouseMove",n=>{const r=(o,i,a)=>o+i<0?-o:o+i>a?a-o:i;if(this.grabbedElem){const o=this.getSVGPoint(n),{naturalWidth:i,naturalHeight:a}=this.env.image;if(this.grabbedElem===this.shape){const{x:s,y:u,width:c,height:l}=TS(this.shape),f=r(s,o.x-this.grabbedAt.x,i-c),d=r(u,o.y-this.grabbedAt.y,a-l),p=_i(this.shape).map(m=>({x:m.x+f,y:m.y+d}));this.grabbedAt=o,this.setPoints(p),p.forEach((m,b)=>this.setHandleXY(this.handles[b],m.x,m.y)),this.emit("update",Yr(this.shape,this.env.image))}else{const s=this.handles.indexOf(this.grabbedElem),u={x:Math.min(Math.max(o.x,0),i),y:Math.min(Math.max(o.y,0),a)},c=_i(this.shape).map((l,f)=>f===s?u:l);this.setPoints(c),this.setHandleXY(this.handles[s],u.x,u.y),this.emit("update",Yr(this.shape,this.env.image))}}});h(this,"onMouseUp",n=>{this.grabbedElem=null,this.grabbedAt=null});h(this,"updateState",n=>{const r=qr(n).getAttribute("points").split(" ").map(o=>{const[i,a]=o.split(",").map(s=>parseFloat(s.trim()));return{x:i,y:a}});this.setPoints(r),r.forEach((o,i)=>this.setHandleXY(this.handles[i],o.x,o.y))});h(this,"detachListeners",()=>{this.svg.removeEventListener("mousemove",this.onMouseMove),this.svg.removeEventListener("mouseup",this.onMouseUp)});h(this,"destroy",()=>{this.detachListeners(),this.containerGroup.parentNode.removeChild(this.containerGroup),super.destroy()});this.svg.addEventListener("mousemove",this.onMouseMove),this.svg.addEventListener("mouseup",this.onMouseUp),this.containerGroup=document.createElementNS(B,"g"),this.shape=wa(n),this.shape.querySelector(".a9s-inner").addEventListener("mousedown",this.onGrab(this.shape)),this.mask=new Uc(i.image,this.shape.querySelector(".a9s-inner")),this.containerGroup.appendChild(this.mask.element),this.elementGroup=document.createElementNS(B,"g"),this.elementGroup.setAttribute("class","a9s-annotation editable selected"),this.elementGroup.setAttribute("data-id",n.id),this.elementGroup.appendChild(this.shape),this.handles=_i(this.shape).map(a=>{const s=this.drawHandle(a.x,a.y);return s.addEventListener("mousedown",this.onGrab(s)),this.elementGroup.appendChild(s),s}),this.containerGroup.appendChild(this.elementGroup),r.appendChild(this.containerGroup),Si(this.elementGroup,n,o.formatters),this.grabbedElem=null,this.grabbedAt=null}get element(){return this.elementGroup}}class Ei extends bi{constructor(n,r,o){super(n,r,o);h(this,"startDrawing",(n,r,o)=>{this._isDrawing=!0,this._startOnSingleClick=o,this.attachListeners({mouseMove:this.onMouseMove,[this.config.addPolygonPointOnMouseDown&&o?"mouseDown":"mouseUp"]:this.onMouseUpDown,dblClick:this.onDblClick}),this.rubberband=new DS([n,r],this.g,this.env)});h(this,"stop",()=>{this.detachListeners(),this._isDrawing=!1,this.rubberband&&(this.rubberband.destroy(),this.rubberband=null)});h(this,"onMouseMove",(n,r)=>{const{naturalWidth:o,naturalHeight:i}=this.env.image,a=Math.min(Math.max(n,0),o),s=Math.min(Math.max(r,0),i);this.rubberband.dragTo([a,s])});h(this,"onMouseUp",()=>{const{width:n,height:r}=this.rubberband.getBoundingClientRect(),o=this.config.minSelectionWidth||4,i=this.config.minSelectionHeight||4;n>=o||r>=i?this.rubberband.addPoint():this._startOnSingleClick||(this.emit("cancel"),this.stop())});h(this,"onMouseUpDown",()=>{this.onMouseUp()});h(this,"onDblClick",()=>{if(this.rubberband.points.length<(this.config.minPolygonPoints||0))return;this._isDrawing=!1;const n=this.rubberband.element;n.annotation=this.rubberband.toSelection(),this.emit("complete",n),this.stop()});h(this,"createEditableShape",(n,r)=>new MS(n,this.g,{...this.config,formatters:r},this.env));this._isDrawing=!1,this._startOnSingleClick=!1}get isDrawing(){return this._isDrawing}}Ei.identifier="polygon",Ei.supports=t=>{var n;const e=t.selector("SvgSelector");if(e)return(n=e.value)==null?void 0:n.match(/^<svg.*<polygon/g)};class kS extends mn{constructor(n,r,o){super();h(this,"listTools",()=>this._registered.map(n=>n.identifier));h(this,"registerTool",n=>{const r=n.identifier;this.listTools().includes(r)&&this.unregisterTool(r),this._registered.unshift(n)});h(this,"unregisterTool",n=>this._registered=this._registered.filter(r=>r.identifier!==n));h(this,"setCurrent",n=>{this._current&&this._current.destroy();const r=typeof n=="string"||n instanceof String?this._registered.find(o=>o.identifier===n):n;this._current=new r(this._g,this._config,this._env),this._current.on("startSelection",o=>this.emit("startSelection",o)),this._current.on("complete",o=>this.emit("complete",o)),this._current.on("cancel",o=>this.emit("cancel",o))});h(this,"forAnnotation",n=>{var s;const[r,...o]=n.targets,i=(s=r.renderedVia)==null?void 0:s.name,a=i?this._registered.find(u=>u.identifier===i):this._registered.find(u=>u.supports(n));return a?new a(this._g,this._config,this._env):null});this._g=n,this._config=r,this._env=o,this._registered=[Cr,Ei],this.setCurrent(Cr)}get current(){return this._current}}class FS{constructor(e,n,r){this.svg=e.closest("svg"),this.g=document.createElementNS(B,"g"),this.g.setAttribute("class","a9s-crosshair");const o=document.createElementNS(B,"line"),i=document.createElementNS(B,"line");this.g.appendChild(o),this.g.appendChild(i),e.appendChild(this.g);const a=s=>{const u=this.svg.getBoundingClientRect(),c=s.clientX-u.x,l=s.clientY-u.y,f=this.svg.createSVGPoint(),{left:d,top:p}=this.svg.getBoundingClientRect();return f.x=c+d,f.y=l+p,f.matrixTransform(e.getScreenCTM().inverse())};this.svg.parentElement.addEventListener("pointermove",s=>{const{x:u,y:c}=a(s);o.setAttribute("x1",0),o.setAttribute("y1",c),o.setAttribute("x2",n),o.setAttribute("y2",c),i.setAttribute("x1",u),i.setAttribute("y1",0),i.setAttribute("x2",u),i.setAttribute("y2",r)})}}const jc=(t,e)=>{const r=(Sa(e,".a9s-annotation")?e:e.closest(".a9s-annotation")).querySelector(".a9s-outer"),o=t.naturalWidth/t.width,i=t.naturalHeight/t.height,a=t.getBoundingClientRect(),s=r.getBoundingClientRect(),u=s.x-a.x,c=s.y-a.y,{width:l,height:f}=s,d=document.createElement("CANVAS"),p=d.getContext("2d");return d.width=l*o,d.height=f*i,p.drawImage(t,u*o,c*i,l*o,f*i,0,0,l*o,f*i),{snippet:d,transform:m=>{const b=u*o+m[0],v=c*i+m[1];return[b,v]}}},zc=Rc();class IS extends mn{constructor(n){super();h(this,"_attachMouseListeners",(n,r)=>{n.addEventListener("mouseenter",()=>{var o,i;(i=(o=this.tools)==null?void 0:o.current)!=null&&i.isDrawing||(this.currentHover!==n&&this.emit("mouseEnterAnnotation",r,n),this.currentHover=n)}),n.addEventListener("mouseleave",()=>{var o,i;(i=(o=this.tools)==null?void 0:o.current)!=null&&i.isDrawing||(this.emit("mouseLeaveAnnotation",r,n),this.currentHover=null)}),zc&&(n.addEventListener("touchstart",o=>{o.stopPropagation(),this.currentHover=n}),n.addEventListener("touchend",o=>{const{clientX:i,clientY:a}=o.changedTouches[0],s=document.elementFromPoint(i,a);o.stopPropagation(),n.contains(s)&&(this.currentHover=n,this.selectCurrentHover())}))});h(this,"_lazy",n=>{this.imageEl.naturalWidth?n():this.imageEl.addEventListener("load",()=>n())});h(this,"_onMouseDown",n=>{var r,o;n.button===0&&(this.readOnly||(this.allowDrawingWithSelection?this.selectedShape&&this.selectedShape.element===this.currentHover:this.selectedShape)||this.tools.current.isDrawing?!((o=(r=this.tools)==null?void 0:r.current)!=null&&o.isDrawing)&&this.selectedShape!==this.currentHover&&this.selectCurrentHover():this.tools.current.start(n,this.drawOnSingleClick&&!this.currentHover))});h(this,"_refreshNonScalingAnnotations",()=>{const n=this.getCurrentScale();n!==1/0&&Array.from(this.svg.querySelectorAll(".a9s-non-scaling")).forEach(r=>{r.setAttribute("transform",`scale(${n})`)})});h(this,"_scaleFormatterElements",n=>{const r=this.getCurrentScale();if(r!==1/0)if(n){const o=n.querySelector(".a9s-formatter-el");o&&o.firstChild.setAttribute("transform",`scale(${r})`)}else Array.from(this.g.querySelectorAll(".a9s-formatter-el")).forEach(i=>i.firstChild.setAttribute("transform",`scale(${r})`))});h(this,"addAnnotation",n=>{const r=Mf(n,this.imageEl);return gt(r,"a9s-annotation"),r.setAttribute("data-id",n.id),r.annotation=n,this._attachMouseListeners(r,n),this.g.appendChild(r),Si(r,n,this.formatters),this._scaleFormatterElements(r),r});h(this,"addDrawingTool",n=>{var r;return(r=this.tools)==null?void 0:r.registerTool(n)});h(this,"addOrUpdateAnnotation",(n,r)=>{this.selectedShape&&(this.selectedShape.annotation.isEqual(n)||this.selectedShape.annotation.isEqual(r))&&(this.deselect(),this.emit("select",{})),r&&this.removeAnnotation(r),this.removeAnnotation(n);const o=this.addAnnotation(n);Sa(o,"a9s-non-scaling")&&o.setAttribute("transform",`scale(${this.getCurrentScale()})`),this.redraw()});h(this,"deselect",n=>{var r;if(this.selectedShape){(r=this.tools)==null||r.current.stop();const{annotation:o}=this.selectedShape;this.selectedShape.destroy?(this.selectedShape.destroy(),this.selectedShape=null,o.isSelection||(this.addAnnotation(o),n||this.redraw())):(gf(this.selectedShape,"selected"),this.selectedShape=null)}});h(this,"destroy",()=>{this.deselect(),this.currentHover=null,this.svg.parentNode.removeChild(this.svg)});h(this,"findShape",n=>{const r=n!=null&&n.id?n.id:n;return this.g.querySelector(`.a9s-annotation[data-id="${r}"]`)});h(this,"getAnnotations",()=>Array.from(this.g.querySelectorAll(".a9s-annotation")).map(r=>r.annotation));h(this,"getCurrentScale",()=>{const n=this.svg.getBoundingClientRect(),{width:r,height:o}=this.svg.viewBox.baseVal;return Math.max(r/n.width,o/n.height)});h(this,"getSelectedImageSnippet",()=>{if(this.selectedShape){const n=this.selectedShape.element||this.selectedShape;return jc(this.imageEl,n)}});h(this,"init",n=>{this.deselect(),this.currentHover=null,Array.from(this.g.querySelectorAll(".a9s-annotation")).forEach(o=>this.g.removeChild(o)),this._lazy(()=>{n.sort((o,i)=>Sn(i,this.imageEl)-Sn(o,this.imageEl)),n.forEach(this.addAnnotation)}),this._refreshNonScalingAnnotations()});h(this,"listDrawingTools",()=>{var n;return(n=this.tools)==null?void 0:n.listTools()});h(this,"overrideId",(n,r)=>{const o=this.findShape(n);o.setAttribute("data-id",r);const{annotation:i}=o,a=i.clone({id:r});return o.annotation=a,a});h(this,"redraw",()=>{const n=Array.from(this.g.querySelectorAll(".a9s-annotation:not(.selected)")),r=n.map(o=>o.annotation);r.sort((o,i)=>Sn(i,this.imageEl)-Sn(o,this.imageEl)),n.forEach(o=>this.g.removeChild(o)),r.forEach(this.addAnnotation)});h(this,"removeAnnotation",n=>{var i,a,s;const r=n.type?n.id:n;((i=this.selectedShape)==null?void 0:i.annotation.id)===r&&this.deselect();const o=this.findShape(n);o&&(((a=this.selectedShape)==null?void 0:a.annotation)===o.annotation&&this.deselect(),((s=this.currentHover)==null?void 0:s.annotation)===o.annotation&&(this.currentHover=null),o.parentNode.removeChild(o))});h(this,"removeDrawingTool",n=>{var r;return(r=this.tools)==null?void 0:r.unregisterTool(n)});h(this,"selectAnnotation",(n,r)=>{this.selectedShape&&this.deselect();const o=this.findShape(n);if(o){this.selectShape(o,r);const i=this.selectedShape.element?this.selectedShape.element:this.selectedShape;return{annotation:o.annotation,element:i}}else this.deselect()});h(this,"selectCurrentHover",()=>{this.currentHover?this.disableSelect?this.emit("clickAnnotation",this.currentHover.annotation,this.currentHover):this.selectShape(this.currentHover):(this.deselect(),this.emit("select",{skipEvent:!0}))});h(this,"selectShape",(n,r)=>{var a;if(!r&&!n.annotation.isSelection&&this.emit("clickAnnotation",n.annotation,n),((a=this.selectedShape)==null?void 0:a.annotation)===n.annotation)return;this.selectedShape&&this.selectedShape.annotation!==n.annotation&&this.deselect(!0);const{annotation:o}=n;if(this.readOnly||o.readOnly)gt(n,"selected"),this.selectedShape=n,r||this.emit("select",{annotation:o,element:n,skipEvent:r});else{const s=this.tools.forAnnotation(o);s?(n.parentNode.removeChild(n),this.selectedShape=s.createEditableShape(o,this.formatters),this.selectedShape.element.annotation=o,this._scaleFormatterElements(this.selectedShape.element),this.selectedShape.on("update",u=>{this.selectedShape&&this.emit("updateTarget",this.selectedShape.element,u)}),setTimeout(()=>{var u;this.selectedShape!=null&&this._attachMouseListeners(this.selectedShape.element,o),!r&&((u=this.selectedShape)==null?void 0:u.element)&&(this.currentHover=this.selectedShape.element)},1)):this.selectedShape=n,r||this.emit("select",{annotation:o,element:this.selectedShape.element||this.selectedShape})}});h(this,"setDrawingTool",n=>{var r;this.tools&&((r=this.tools.current)==null||r.stop(),this.tools.setCurrent(n))});h(this,"setVisible",n=>{n?this.svg.style.display=null:(this.deselect(),this.svg.style.display="none")});h(this,"stopDrawing",()=>{var n,r;(r=(n=this.tools)==null?void 0:n.current)==null||r.stop()});const{wrapperEl:r,config:o,env:i}=n;this.imageEl=i.image,this.readOnly=o.readOnly,this.allowDrawingWithSelection=o.allowDrawingWithSelection,o.formatter?this.formatters=[o.formatter]:o.formatters&&(this.formatters=Array.isArray(o.formatters)?o.formatters:[o.formatters]),this.disableSelect=o.disableSelect,this.drawOnSingleClick=o.drawOnSingleClick,this.svg=document.createElementNS(B,"svg"),this.svg.setAttribute("tabindex",0),zc?(this.svg.setAttribute("class","a9s-annotationlayer touch"),wS(this.svg),this.svg.addEventListener("touchstart",()=>{this.currentHover=null,this.selectCurrentHover()})):this.svg.setAttribute("class","a9s-annotationlayer");const{naturalWidth:a,naturalHeight:s}=this.imageEl;if(!a&&!s){const{width:u,height:c}=this.imageEl;this.svg.setAttribute("viewBox",`0 0 ${u} ${c}`),this.imageEl.nodeName.toLowerCase()!=="img"&&(this.imageEl.naturalWidth=u,this.imageEl.naturalHeight=c),this.imageEl.addEventListener("load",()=>{this.emit("load",this.imageEl.src),this.svg.setAttribute("viewBox",`0 0 ${this.imageEl.naturalWidth} ${this.imageEl.naturalHeight}`)})}else this.svg.setAttribute("viewBox",`0 0 ${a} ${s}`);this.g=document.createElementNS(B,"g"),this.svg.appendChild(this.g),r.appendChild(this.svg),o.crosshair&&(this.crosshair=new FS(this.g,a,s),o.crosshairWithCursor||gt(this.svg,"no-cursor")),this.selectedShape=null,this.tools=new kS(this.g,o,i),this.tools.on("startSelection",u=>this.emit("startSelection",u)),this.tools.on("cancel",this.selectCurrentHover),this.tools.on("complete",this.selectShape),this.svg.addEventListener("mousedown",this._onMouseDown),this.currentHover=null,window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{this._refreshNonScalingAnnotations(),this._scaleFormatterElements()}),this.resizeObserver.observe(this.svg.parentNode))}}var ZE="",RS=0;function Wc(t,e,n,r,o){var i,a,s={};for(a in e)a=="ref"?i=e[a]:s[a]=e[a];var u={type:t,props:s,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--RS,__source:r,__self:o};if(typeof t=="function"&&(i=t.defaultProps))for(a in i)s[a]===void 0&&(s[a]=i[a]);return $.vnode&&$.vnode(u),u}class NS extends J{constructor(n){super(n);h(this,"clearState",n=>this.setState({selectedAnnotation:null,selectedDOMElement:null,modifiedTarget:null,beforeHeadlessModify:null},n));h(this,"forwardEvent",(n,r)=>{this.annotationLayer.on(n,(o,i)=>{this.props[r](o.clone(),i)})});h(this,"onKeyUp",n=>{if(n.which===27){const{disableEscapeKey:r}=this.props.config;if(!r){this.annotationLayer.stopDrawing();const{selectedAnnotation:o}=this.state;o&&(this.cancelSelected(),this.props.onCancelSelected(o))}}else if(n.which===46){const{disableDeleteKey:r}=this.props.config;if(!r){const{selectedAnnotation:o}=this.state;o&&(o.isSelection?this.onCancelAnnotation(o):this.onDeleteAnnotation(o))}}});h(this,"handleStartSelect",n=>this.props.onSelectionStarted(n));h(this,"handleSelect",(n,r)=>{this.state.editorDisabled?this.onHeadlessSelect(n,r):this.onNormalSelect(n,r)});h(this,"onNormalSelect",(n,r)=>{const{annotation:o,element:i}=n;if(o){const a=u=>{this.setState({selectedAnnotation:o,selectedDOMElement:i,modifiedTarget:null,beforeHeadlessModify:null},()=>{r||(o.isSelection?this.props.onSelectionCreated(o.clone()):this.props.onAnnotationSelected(o.clone(),i)),u&&u()})},{selectedAnnotation:s}=this.state;s&&!s.isEqual(o)?this.clearState(()=>{this.props.onCancelSelected(s.clone()),a(()=>this.props.onChangeSelected(o.clone(),s.clone()))}):a()}else{const{selectedAnnotation:a}=this.state;a?this.clearState(()=>{this.props.onCancelSelected(a)}):this.clearState()}});h(this,"onHeadlessSelect",(n,r)=>{this.saveSelected().then(()=>{this.onNormalSelect(n,r);const{annotation:o}=n;if(o&&!o.isSelection){const i=this.annotationLayer.selectAnnotation(n.annotation,!0);this.setState({selectedDOMElement:i.element})}})});h(this,"handleUpdateTarget",(n,r)=>{this.setState({selectedDOMElement:n,modifiedTarget:r});const o=JSON.parse(JSON.stringify(r));this.props.onSelectionTargetChanged(o)});h(this,"overrideAnnotationId",n=>r=>{const{id:o}=n;this.state.selectedAnnotation?this.clearState(()=>{this.annotationLayer.overrideId(o,r)}):this.annotationLayer.overrideId(o,r)});h(this,"onCreateOrUpdateAnnotation",(n,r)=>(o,i)=>{let a=o.isSelection?o.toAnnotation():o;a=this.state.modifiedTarget?a.clone({target:this.state.modifiedTarget}):a.clone(),this.clearState(()=>{this.annotationLayer.deselect(),this.annotationLayer.addOrUpdateAnnotation(a,i),i?this.props[n](a,i.clone()):this.props[n](a,this.overrideAnnotationId(a)),r&&r()})});h(this,"onDeleteAnnotation",n=>{this.clearState(),this.annotationLayer.removeAnnotation(n),this.props.onAnnotationDeleted(n)});h(this,"onCancelAnnotation",(n,r)=>{this.annotationLayer.deselect(),this.props.onCancelSelected(n),this.clearState(r)});h(this,"addAnnotation",n=>this.annotationLayer.addOrUpdateAnnotation(n.clone()));h(this,"addDrawingTool",n=>this.annotationLayer.addDrawingTool(n));h(this,"cancelSelected",()=>new Promise(n=>{this.annotationLayer.deselect(),this.state.selectedAnnotation?this.clearState(n):n()}));h(this,"getAnnotationById",n=>{var r;return(r=this.annotationLayer.findShape(n))==null?void 0:r.annotation});h(this,"getAnnotations",()=>this.annotationLayer.getAnnotations().map(n=>n.clone()));h(this,"getImageSnippetById",n=>{const r=this.annotationLayer.findShape(n);if(r)return jc(this.props.env.image,r)});h(this,"getSelected",()=>{var n;if(this.state.selectedAnnotation)return this.state.editorDisabled?this.state.selectedAnnotation:(n=this._editor.current)==null?void 0:n.getCurrentAnnotation()});h(this,"getSelectedImageSnippet",()=>this.annotationLayer.getSelectedImageSnippet());h(this,"getCurrentDrawingTool",()=>{var n;return(n=this.annotationLayer.tools)==null?void 0:n.current});h(this,"getSelectedShape",()=>this.annotationLayer.selectedShape);h(this,"listDrawingTools",()=>this.annotationLayer.listDrawingTools());h(this,"removeAnnotation",n=>{this.annotationLayer.removeAnnotation(n),this.state.selectedAnnotation&&this.setState({selectedAnnotation:null})});h(this,"removeDrawingTool",n=>this.annotationLayer.removeDrawingTool(n));h(this,"saveSelected",()=>new Promise(n=>{const r=this.state.selectedAnnotation;if(r)if(this._editor.current)this._editor.current.onOk(),n();else if(r.isSelection)r.bodies.length>0||this.props.config.allowEmpty?this.onCreateOrUpdateAnnotation("onAnnotationCreated",n)(r):(this.annotationLayer.deselect(),n());else{const{beforeHeadlessModify:o,modifiedTarget:i}=this.state;o?this.onCreateOrUpdateAnnotation("onAnnotationUpdated",n)(r,o):i?this.onCreateOrUpdateAnnotation("onAnnotationUpdated",n)(r,r):this.onCancelAnnotation(r,n)}else n()}));h(this,"selectAnnotation",n=>{const r=this.annotationLayer.selectAnnotation(n,!0);if(r)return this.handleSelect(r,!0),r.annotation.clone();this.clearState()});h(this,"setAnnotations",n=>this.annotationLayer.init(n.map(r=>r.clone())));h(this,"setDrawingTool",n=>this.annotationLayer.setDrawingTool(n));h(this,"setVisible",n=>{this.annotationLayer.setVisible(n),n||this.clearState()});h(this,"updateSelected",(n,r)=>new Promise(o=>{this.state.selectedAnnotation&&(r?this.state.selectedAnnotation.isSelection?this.onCreateOrUpdateAnnotation("onAnnotationCreated",o)(n):this.onCreateOrUpdateAnnotation("onAnnotationUpdated",o)(n,this.state.selectedAnnotation):this.setState({selectedAnnotation:n,beforeHeadlessModify:this.state.beforeHeadlessModify||this.state.selectedAnnotation},o))}));this.state={selectedAnnotation:null,selectedDOMElement:null,modifiedTarget:null,readOnly:this.props.config.readOnly,editorDisabled:this.props.config.disableEditor,widgets:this.props.config.widgets,beforeHeadlessModify:null},this._editor=g.createRef()}componentDidMount(){this.annotationLayer=new IS(this.props),this.annotationLayer.on("load",this.props.onLoad),this.annotationLayer.on("startSelection",this.handleStartSelect),this.annotationLayer.on("select",this.handleSelect),this.annotationLayer.on("updateTarget",this.handleUpdateTarget),this.forwardEvent("clickAnnotation","onClickAnnotation"),this.forwardEvent("mouseEnterAnnotation","onMouseEnterAnnotation"),this.forwardEvent("mouseLeaveAnnotation","onMouseLeaveAnnotation"),document.addEventListener("keyup",this.onKeyUp)}componentWillUnmount(){this.annotationLayer.destroy(),document.removeEventListener("keyup",this.onKeyUp)}get disableEditor(){return this.state.editorDisabled}set disableEditor(n){this.setState({editorDisabled:n})}get disableSelect(){return this.annotationLayer.disableSelect}set disableSelect(n){this.annotationLayer.disableSelect=n}get formatters(){return this.annotationLayer.formatters}set formatters(n){this.annotationLayer.formatters=n,this.annotationLayer.redraw()}get readOnly(){return this.state.readOnly}set readOnly(n){this.annotationLayer.readOnly=n,this.setState({readOnly:n})}get widgets(){return this.state.widgets}set widgets(n){this.setState({widgets:n})}render(){var o;const n=this.state.selectedAnnotation&&!this.state.editorDisabled,r=this.state.readOnly||((o=this.state.selectedAnnotation)==null?void 0:o.readOnly);return n&&Wc(hS,{ref:this._editor,detachable:!0,wrapperEl:this.props.wrapperEl,annotation:this.state.selectedAnnotation,modifiedTarget:this.state.modifiedTarget,selectedElement:this.state.selectedDOMElement,readOnly:r,allowEmpty:this.props.config.allowEmpty,widgets:this.state.widgets,env:this.props.env,onAnnotationCreated:this.onCreateOrUpdateAnnotation("onAnnotationCreated"),onAnnotationUpdated:this.onCreateOrUpdateAnnotation("onAnnotationUpdated"),onAnnotationDeleted:this.onDeleteAnnotation,onCancel:this.onCancelAnnotation})}}var QE="";class Gc{constructor(e){h(this,"handleAnnotationCreated",(e,n)=>this._emitter.emit("createAnnotation",e.underlying,n));h(this,"handleAnnotationDeleted",e=>this._emitter.emit("deleteAnnotation",e.underlying));h(this,"handleAnnotationSelected",(e,n)=>this._emitter.emit("selectAnnotation",e.underlying,n));h(this,"handleAnnotationUpdated",(e,n)=>this._emitter.emit("updateAnnotation",e.underlying,n.underlying));h(this,"handleCancelSelected",e=>this._emitter.emit("cancelSelected",e.underlying));h(this,"handleChangeSelected",(e,n)=>this._emitter.emit("changeSelected",e.underlying,n.underlying));h(this,"handleClickAnnotation",(e,n)=>this._emitter.emit("clickAnnotation",e.underlying,n));h(this,"handleLoad",e=>this._emitter.emit("load",e));h(this,"handleSelectionCreated",e=>this._emitter.emit("createSelection",e.underlying));h(this,"handleSelectionStarted",e=>this._emitter.emit("startSelection",e));h(this,"handleSelectionTargetChanged",e=>this._emitter.emit("changeSelectionTarget",e));h(this,"handleMouseEnterAnnotation",(e,n)=>this._emitter.emit("mouseEnterAnnotation",e.underlying,n));h(this,"handleMouseLeaveAnnotation",(e,n)=>this._emitter.emit("mouseLeaveAnnotation",e.underlying,n));h(this,"_wrap",e=>(e==null?void 0:e.type)==="Annotation"?new Je(e):e);h(this,"addAnnotation",(e,n)=>this._app.current.addAnnotation(new Je(e,{readOnly:n})));h(this,"addDrawingTool",e=>this._app.current.addDrawingTool(e));h(this,"cancelSelected",()=>this._app.current.cancelSelected());h(this,"clearAnnotations",()=>this.setAnnotations([]));h(this,"clearAuthInfo",()=>this._env.user=null);h(this,"destroy",()=>{g.unmountComponentAtNode(this._appContainerEl),this._element.parentNode.insertBefore(this._env.image,this._element),this._element.parentNode.removeChild(this._element)});h(this,"getAnnotationById",e=>{const n=this._app.current.getAnnotationById(e);return n==null?void 0:n.underlying});h(this,"getAnnotations",()=>this._app.current.getAnnotations().map(n=>n.underlying));h(this,"getImageSnippetById",e=>this._app.current.getImageSnippetById(e));h(this,"getSelected",()=>{const e=this._app.current.getSelected();return e==null?void 0:e.underlying});h(this,"getSelectedImageSnippet",()=>this._app.current.getSelectedImageSnippet());h(this,"getCurrentDrawingTool",()=>this._app.current.getCurrentDrawingTool());h(this,"getSelectedShape",()=>this._app.current.getSelectedShape());h(this,"listDrawingTools",()=>this._app.current.listDrawingTools());h(this,"loadAnnotations",e=>fetch(e).then(n=>n.json()).then(n=>(this.setAnnotations(n),n)));h(this,"off",(e,n)=>this._emitter.off(e,n));h(this,"on",(e,n)=>this._emitter.on(e,n));h(this,"once",(e,n)=>this._emitter.once(e,n));h(this,"removeAnnotation",e=>this._app.current.removeAnnotation(this._wrap(e)));h(this,"removeDrawingTool",e=>this._app.current.removeDrawingTool(e));h(this,"saveSelected",()=>this._app.current.saveSelected());h(this,"selectAnnotation",e=>{const n=this._app.current.selectAnnotation(this._wrap(e));return n==null?void 0:n.underlying});h(this,"setAnnotations",e=>{const r=(e||[]).map(o=>new Je(o));this._app.current.setAnnotations(r)});h(this,"setAuthInfo",e=>this._env.user=e);h(this,"setDrawingTool",e=>this._app.current.setDrawingTool(e));h(this,"setServerTime",e=>this._env.setServerTime(e));h(this,"setVisible",e=>this._app.current.setVisible(e));h(this,"updateSelected",(e,n)=>{let r=null;e.type==="Annotation"?r=new Je(e):e.type==="Selection"&&(r=new sn(e.target,e.body)),r&&this._app.current.updateSelected(r,n)});this._app=g.createRef(),this._emitter=new mn,e.disableEditor=e.disableEditor||e.headless;const n=e.image.nodeType?e.image:document.getElementById(e.image);n.style.display="block",this._env=_S(),this._env.image=n,ES(e.locale,e.messages),this._element=document.createElement("DIV"),this._element.style.position="relative",this._element.style.display="inline-block",n.parentNode.insertBefore(this._element,n),this._element.appendChild(n),this._appContainerEl=document.createElement("DIV"),this._element.appendChild(this._appContainerEl),g.render(Wc(NS,{ref:this._app,env:this._env,wrapperEl:this._element,config:e,onSelectionStarted:this.handleSelectionStarted,onSelectionCreated:this.handleSelectionCreated,onSelectionTargetChanged:this.handleSelectionTargetChanged,onAnnotationCreated:this.handleAnnotationCreated,onAnnotationSelected:this.handleAnnotationSelected,onAnnotationUpdated:this.handleAnnotationUpdated,onAnnotationDeleted:this.handleAnnotationDeleted,onCancelSelected:this.handleCancelSelected,onChangeSelected:this.handleChangeSelected,onClickAnnotation:this.handleClickAnnotation,onLoad:this.handleLoad,onMouseEnterAnnotation:this.handleMouseEnterAnnotation,onMouseLeaveAnnotation:this.handleMouseLeaveAnnotation}),this._appContainerEl)}get disableEditor(){return this._app.current.disableEditor}set disableEditor(e){this._app.current.disableEditor=e}get disableSelect(){return this._app.current.disableSelect}set disableSelect(e){this._app.current.disableSelect=e}get formatters(){return this._app.current.formatters||[]}set formatters(e){if(e){const n=Array.isArray(e)?e:[e];this._app.current.formatters=n}else this._app.current.formatters=null}get readOnly(){return this._app.current.readOnly}set readOnly(e){this._app.current.readOnly=e}get widgets(){return this._app.current.widgets}set widgets(e){this._app.current.widgets=e}}const LS=t=>new Gc(t);me.Annotorious=Gc,me.init=LS,Object.defineProperty(me,"__esModule",{value:!0}),me[Symbol.toStringTag]="Module"});
25
25
  //# sourceMappingURL=annotorious.umd.js.map